Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
bbda6f56
Commit
bbda6f56
authored
Nov 07, 2007
by
Gustavo Sverzut Barbieri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re: Disabling docstrings in generated .so?
parent
8a141881
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+4
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+7
-5
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+1
-0
No files found.
Cython/Compiler/CmdLine.py
View file @
bbda6f56
...
@@ -24,6 +24,7 @@ Options:
...
@@ -24,6 +24,7 @@ Options:
"from <module> import *" at the top of the file.
"from <module> import *" at the top of the file.
--incref-local-binop Force local an extra incref on local variables before
--incref-local-binop Force local an extra incref on local variables before
performing any binary operations.
performing any binary operations.
-D, --no-docstrings Remove docstrings.
"""
"""
#The following experimental options are supported only on MacOSX:
#The following experimental options are supported only on MacOSX:
# -C, --compile Compile generated .c file to .o file
# -C, --compile Compile generated .c file to .o file
...
@@ -82,6 +83,8 @@ def parse_command_line(args):
...
@@ -82,6 +83,8 @@ def parse_command_line(args):
Options
.
incref_local_binop
=
1
Options
.
incref_local_binop
=
1
elif
option
==
"--cleanup"
:
elif
option
==
"--cleanup"
:
Options
.
generate_cleanup_code
=
int
(
pop_arg
())
Options
.
generate_cleanup_code
=
int
(
pop_arg
())
elif
option
in
(
"-D"
,
"--no-docstrings"
):
Options
.
docstrings
=
False
else
:
else
:
bad_usage
()
bad_usage
()
else
:
else
:
...
...
Cython/Compiler/Nodes.py
View file @
bbda6f56
...
@@ -1024,7 +1024,9 @@ class DefNode(FuncDefNode):
...
@@ -1024,7 +1024,9 @@ class DefNode(FuncDefNode):
Naming
.
pyfunc_prefix
+
prefix
+
name
Naming
.
pyfunc_prefix
+
prefix
+
name
entry
.
pymethdef_cname
=
\
entry
.
pymethdef_cname
=
\
Naming
.
pymethdef_prefix
+
prefix
+
name
Naming
.
pymethdef_prefix
+
prefix
+
name
if
not
entry
.
is_special
:
if
not
Options
.
docstrings
:
self
.
entry
.
doc
=
None
elif
not
entry
.
is_special
:
if
Options
.
embed_pos_in_docstring
:
if
Options
.
embed_pos_in_docstring
:
entry
.
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
entry
.
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
if
not
self
.
doc
is
None
:
if
not
self
.
doc
is
None
:
...
@@ -1120,7 +1122,7 @@ class DefNode(FuncDefNode):
...
@@ -1120,7 +1122,7 @@ class DefNode(FuncDefNode):
code
.
putln
(
"%s; /*proto*/"
%
header
)
code
.
putln
(
"%s; /*proto*/"
%
header
)
if
proto_only
:
if
proto_only
:
return
return
if
self
.
entry
.
doc
:
if
self
.
entry
.
doc
and
Options
.
docstrings
:
code
.
putln
(
code
.
putln
(
'static char %s[] = "%s";'
%
(
'static char %s[] = "%s";'
%
(
self
.
entry
.
doc_cname
,
self
.
entry
.
doc_cname
,
...
@@ -1433,7 +1435,7 @@ class PyClassDefNode(StatNode, BlockNode):
...
@@ -1433,7 +1435,7 @@ class PyClassDefNode(StatNode, BlockNode):
self
.
body
=
body
self
.
body
=
body
import
ExprNodes
import
ExprNodes
self
.
dict
=
ExprNodes
.
DictNode
(
pos
,
key_value_pairs
=
[])
self
.
dict
=
ExprNodes
.
DictNode
(
pos
,
key_value_pairs
=
[])
if
self
.
doc
:
if
self
.
doc
and
Options
.
docstrings
:
if
Options
.
embed_pos_in_docstring
:
if
Options
.
embed_pos_in_docstring
:
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
doc
=
doc
+
'
\
\
n'
+
self
.
doc
doc
=
doc
+
'
\
\
n'
+
self
.
doc
...
@@ -1546,7 +1548,7 @@ class CClassDefNode(StatNode):
...
@@ -1546,7 +1548,7 @@ class CClassDefNode(StatNode):
api
=
self
.
api
)
api
=
self
.
api
)
scope
=
self
.
entry
.
type
.
scope
scope
=
self
.
entry
.
type
.
scope
if
self
.
doc
:
if
self
.
doc
and
Options
.
docstrings
:
if
Options
.
embed_pos_in_docstring
:
if
Options
.
embed_pos_in_docstring
:
scope
.
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
scope
.
doc
=
'File: %s (starting at line %s)'
%
relative_position
(
self
.
pos
)
scope
.
doc
=
scope
.
doc
+
'
\
\
n'
+
self
.
doc
scope
.
doc
=
scope
.
doc
+
'
\
\
n'
+
self
.
doc
...
@@ -1588,7 +1590,7 @@ class PropertyNode(StatNode):
...
@@ -1588,7 +1590,7 @@ class PropertyNode(StatNode):
def
analyse_declarations
(
self
,
env
):
def
analyse_declarations
(
self
,
env
):
entry
=
env
.
declare_property
(
self
.
name
,
self
.
doc
,
self
.
pos
)
entry
=
env
.
declare_property
(
self
.
name
,
self
.
doc
,
self
.
pos
)
if
entry
:
if
entry
:
if
self
.
doc
:
if
self
.
doc
and
Options
.
docstrings
:
doc_entry
=
env
.
get_string_const
(
self
.
doc
)
doc_entry
=
env
.
get_string_const
(
self
.
doc
)
entry
.
doc_cname
=
doc_entry
.
cname
entry
.
doc_cname
=
doc_entry
.
cname
self
.
body
.
analyse_declarations
(
entry
.
scope
)
self
.
body
.
analyse_declarations
(
entry
.
scope
)
...
...
Cython/Compiler/Options.py
View file @
bbda6f56
...
@@ -9,6 +9,7 @@ embed_pos_in_docstring = 0
...
@@ -9,6 +9,7 @@ embed_pos_in_docstring = 0
gcc_branch_hints
=
1
gcc_branch_hints
=
1
pre_import
=
None
pre_import
=
None
docstrings
=
True
# This is a SAGE-specific option that will
# This is a SAGE-specific option that will
# cause Cython to incref local variables before
# cause Cython to incref local variables before
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment