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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ebba4723
Commit
ebba4723
authored
Aug 15, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore special method docstrings.
parent
ca02e83b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+23
-0
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+1
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-4
No files found.
Cython/Compiler/ModuleNode.py
View file @
ebba4723
...
@@ -2041,6 +2041,29 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2041,6 +2041,29 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"if (PyType_Ready(&%s) < 0) %s"
%
(
"if (PyType_Ready(&%s) < 0) %s"
%
(
typeobj_cname
,
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
code
.
error_goto
(
entry
.
pos
)))
# Fix special method docstrings. This is a bit of a hack, but
# unless we let PyType_Ready create the slot wrappers we have
# a significant performance hit. (See trac #561.)
for
func
in
entry
.
type
.
scope
.
pyfunc_entries
:
if
func
.
is_special
and
func
.
doc
:
code
.
putln
(
"{"
);
code
.
putln
(
'PyObject *wrapper = PyObject_GetAttrString((PyObject *)&%s, "%s"); %s'
%
(
typeobj_cname
,
func
.
name
,
code
.
error_goto_if_null
(
'wrapper'
,
entry
.
pos
)));
code
.
putln
(
"if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {"
);
code
.
putln
(
"%s = *((PyWrapperDescrObject *)wrapper)->d_base;"
%
(
func
.
wrapperbase_cname
));
code
.
putln
(
"%s.doc = %s;"
%
(
func
.
wrapperbase_cname
,
func
.
doc_cname
));
code
.
putln
(
"((PyWrapperDescrObject *)wrapper)->d_base = &%s;"
%
(
func
.
wrapperbase_cname
));
code
.
putln
(
"}"
);
code
.
putln
(
"}"
);
if
type
.
vtable_cname
:
if
type
.
vtable_cname
:
code
.
putln
(
code
.
putln
(
"if (__Pyx_SetVtable(%s.tp_dict, %s) < 0) %s"
%
(
"if (__Pyx_SetVtable(%s.tp_dict, %s) < 0) %s"
%
(
...
...
Cython/Compiler/Naming.py
View file @
ebba4723
...
@@ -35,6 +35,7 @@ prop_set_prefix = pyrex_prefix + "setprop_"
...
@@ -35,6 +35,7 @@ prop_set_prefix = pyrex_prefix + "setprop_"
type_prefix
=
pyrex_prefix
+
"t_"
type_prefix
=
pyrex_prefix
+
"t_"
typeobj_prefix
=
pyrex_prefix
+
"type_"
typeobj_prefix
=
pyrex_prefix
+
"type_"
var_prefix
=
pyrex_prefix
+
"v_"
var_prefix
=
pyrex_prefix
+
"v_"
wrapperbase_prefix
=
pyrex_prefix
+
"wrapperbase_"
bufstruct_prefix
=
pyrex_prefix
+
"bstruct_"
bufstruct_prefix
=
pyrex_prefix
+
"bstruct_"
bufstride_prefix
=
pyrex_prefix
+
"bstride_"
bufstride_prefix
=
pyrex_prefix
+
"bstride_"
bufshape_prefix
=
pyrex_prefix
+
"bshape_"
bufshape_prefix
=
pyrex_prefix
+
"bshape_"
...
...
Cython/Compiler/Nodes.py
View file @
ebba4723
...
@@ -2110,6 +2110,8 @@ class DefNode(FuncDefNode):
...
@@ -2110,6 +2110,8 @@ class DefNode(FuncDefNode):
entry
.
doc
=
embed_position
(
self
.
pos
,
self
.
doc
)
entry
.
doc
=
embed_position
(
self
.
pos
,
self
.
doc
)
entry
.
doc_cname
=
\
entry
.
doc_cname
=
\
Naming
.
funcdoc_prefix
+
prefix
+
name
Naming
.
funcdoc_prefix
+
prefix
+
name
if
entry
.
is_special
:
entry
.
wrapperbase_cname
=
Naming
.
wrapperbase_prefix
+
prefix
+
name
else
:
else
:
entry
.
doc
=
None
entry
.
doc
=
None
...
@@ -2224,10 +2226,7 @@ class DefNode(FuncDefNode):
...
@@ -2224,10 +2226,7 @@ class DefNode(FuncDefNode):
if
proto_only
:
if
proto_only
:
return
return
if
(
Options
.
docstrings
and
self
.
entry
.
doc
and
if
(
Options
.
docstrings
and
self
.
entry
.
doc
and
(
not
self
.
entry
.
is_special
or
not
self
.
entry
.
scope
.
is_property_scope
):
self
.
entry
.
signature
.
method_flags
())
and
not
self
.
entry
.
scope
.
is_property_scope
):
docstr
=
self
.
entry
.
doc
docstr
=
self
.
entry
.
doc
if
docstr
.
is_unicode
:
if
docstr
.
is_unicode
:
docstr
=
docstr
.
utf8encode
()
docstr
=
docstr
.
utf8encode
()
...
@@ -2235,6 +2234,9 @@ class DefNode(FuncDefNode):
...
@@ -2235,6 +2234,9 @@ class DefNode(FuncDefNode):
'static char %s[] = "%s";'
%
(
'static char %s[] = "%s";'
%
(
self
.
entry
.
doc_cname
,
self
.
entry
.
doc_cname
,
split_string_literal
(
escape_byte_string
(
docstr
))))
split_string_literal
(
escape_byte_string
(
docstr
))))
if
self
.
entry
.
is_special
:
code
.
putln
(
"struct wrapperbase %s;"
%
self
.
entry
.
wrapperbase_cname
)
if
with_pymethdef
:
if
with_pymethdef
:
code
.
put
(
code
.
put
(
"static PyMethodDef %s = "
%
"static PyMethodDef %s = "
%
...
...
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