class AutoTestDictTransform(ScopeTrackingTransform):
# Handles autotestdict directive
- blacklist = ['__cinit__', '__dealloc__', '__richcmp__', '__nonzero__']
+ blacklist = ['__cinit__', '__dealloc__', '__richcmp__', '__nonzero__',
+ '__len__', '__contains__']
def visit_ModuleNode(self, node):
if node.is_pxd:
def generate_method_table(self, env, code):
code.putln("")
code.putln(
- "static struct PyMethodDef %s[] = {" %
+ "static PyMethodDef %s[] = {" %
env.method_table_cname)
for entry in env.pyfunc_entries:
code.put_pymethoddef(entry, ",")
code.putln("%s; /*proto*/" % header)
if proto_only:
return
- if self.entry.doc and Options.docstrings:
+ if (Options.docstrings and self.entry.doc and
+ (not self.entry.is_special or
+ self.entry.signature.method_flags()) and
+ not self.entry.scope.is_property_scope
+ ):
docstr = self.entry.doc
if docstr.is_unicode:
docstr = docstr.utf8encode()
# return_type PyrexType or None Return type of function owning scope
# is_py_class_scope boolean Is a Python class scope
# is_c_class_scope boolean Is an extension type scope
+ # is_cpp_class_scope boolean Is a C++ class scope
+ # is_property_scope boolean Is a extension type property scope
# scope_prefix string Disambiguator for C names
# in_cinclude boolean Suppress C declaration code
# qualified_name string "modname" or "modname.classname"
is_py_class_scope = 0
is_c_class_scope = 0
is_cpp_class_scope = 0
+ is_property_scope = 0
is_module_scope = 0
scope_prefix = ""
in_cinclude = 0
# a property of an extension type.
#
# parent_type PyExtensionType The type to which the property belongs
+
+ is_property_scope = 1
def declare_pyfunction(self, name, pos):
# Add an entry for a method.
cdef class C:
+ def __cinit__(self):
+ "This is an unusable docstring."
def __init__(self):
"This is an unusable docstring."
+ def __dealloc__(self):
+ "This is an unusable docstring."
+ def __richcmp__(self, other, int op):
+ "This is an unusable docstring."
+ def __nonzero__(self):
+ "This is an unusable docstring."
+ return False
+ def __contains__(self, other):
+ "This is an unusable docstring."
+
property foo:
def __get__(self):
"So is this."
def __set__(self, x):
"And here is another one."
+
+ def __add__(self, other):
+ "usable docstring"
+ def __iter__(self):
+ "usable docstring"
+ return False
+ def __next__(self):
+ "usable docstring"
+ return False
+
False
"""
+ def __len__(self):
+ """
+ Should not be included, as it can't be looked up with getattr in Py 3.1
+
+ >>> True
+ False
+ """
+
+ def __contains__(self, value):
+ """
+ Should not be included, as it can't be looked up with getattr in Py 3.1
+
+ >>> True
+ False
+ """
+
cdeffunc()