Commit 55445737 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix invisible special methods.

parent 77af99cb
...@@ -2045,7 +2045,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2045,7 +2045,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# unless we let PyType_Ready create the slot wrappers we have # unless we let PyType_Ready create the slot wrappers we have
# a significant performance hit. (See trac #561.) # a significant performance hit. (See trac #561.)
for func in entry.type.scope.pyfunc_entries: for func in entry.type.scope.pyfunc_entries:
if func.is_special and func.doc: if func.is_special and func.wrapperbase_cname:
code.putln("{"); code.putln("{");
code.putln( code.putln(
'PyObject *wrapper = PyObject_GetAttrString((PyObject *)&%s, "%s"); %s' % ( 'PyObject *wrapper = PyObject_GetAttrString((PyObject *)&%s, "%s"); %s' % (
......
...@@ -2111,6 +2111,9 @@ class DefNode(FuncDefNode): ...@@ -2111,6 +2111,9 @@ class DefNode(FuncDefNode):
entry.doc_cname = \ entry.doc_cname = \
Naming.funcdoc_prefix + prefix + name Naming.funcdoc_prefix + prefix + name
if entry.is_special: if entry.is_special:
if entry.name in TypeSlots.invisible or not entry.doc:
entry.wrapperbase_cname = None
else:
entry.wrapperbase_cname = Naming.wrapperbase_prefix + prefix + name entry.wrapperbase_cname = Naming.wrapperbase_prefix + prefix + name
else: else:
entry.doc = None entry.doc = None
...@@ -2226,7 +2229,8 @@ class DefNode(FuncDefNode): ...@@ -2226,7 +2229,8 @@ 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.scope.is_property_scope): not self.entry.scope.is_property_scope and
(not self.entry.is_special or self.entry.wrapperbase_cname)):
docstr = self.entry.doc docstr = self.entry.doc
if docstr.is_unicode: if docstr.is_unicode:
docstr = docstr.utf8encode() docstr = docstr.utf8encode()
......
...@@ -8,6 +8,9 @@ import PyrexTypes ...@@ -8,6 +8,9 @@ import PyrexTypes
import StringEncoding import StringEncoding
import sys import sys
invisible = ['__cinit__', '__dealloc__', '__richcmp__',
'__nonzero__', '__bool__']
class Signature(object): class Signature(object):
# Method slot signature descriptor. # Method slot signature descriptor.
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment