Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bb2f64

Browse files
committed
Always output an inheritance-aware version of the xxxx_Check() macro. Also
fixed that macro to actually work:-)
1 parent 03d00d5 commit 5bb2f64

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Tools/bgen/bgen/bgenObjectDefinition.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ def generate(self):
4747
sf = self.static and "static "
4848
Output("%sPyTypeObject %s;", sf, self.typename)
4949
Output()
50-
if self.basetype:
51-
Output("#define %s_Check(x) ((x)->ob_type == &%s || PyObject_TypeCheck((x), %s)",
50+
Output("#define %s_Check(x) ((x)->ob_type == &%s || PyObject_TypeCheck((x), &%s))",
5251
self.prefix, self.typename, self.typename)
53-
else:
54-
Output("#define %s_Check(x) ((x)->ob_type == &%s)",
55-
self.prefix, self.typename)
5652
Output()
5753
Output("typedef struct %s {", self.objecttype)
5854
IndentLevel()

0 commit comments

Comments
 (0)