Use CppClass.pystruct instead of name wherever possible to avoid name conflicts.
This commit is contained in:
1 parent
fd2968d4d8
commit
bdee7fa4b1
2 files changed
+6
-6
No files matched your search
@@ -775,7 +775,7 @@ typedef struct {
|
||||
static_getsets = self.static_attributes.generate(code_sink)
|
||||
|
||||
## --- register the class type in the module ---
|
||||
module.after_init.write_code("/* Register the '%s' class */" % self.name)
|
||||
module.after_init.write_code("/* Register the '%s' class */" % self.full_name)
|
||||
|
||||
## generate a metaclass if needed
|
||||
if static_getsets == '0':
|
||||
@@ -901,14 +901,14 @@ typedef struct {
|
||||
code_sink.writeln()
|
||||
method_defs.extend(parent_caller_methods)
|
||||
## generate the method table
|
||||
code_sink.writeln("static PyMethodDef %s_methods[] = {" % (self.name,))
|
||||
code_sink.writeln("static PyMethodDef %s_methods[] = {" % (self.pystruct,))
|
||||
code_sink.indent()
|
||||
for methdef in method_defs:
|
||||
code_sink.writeln(methdef)
|
||||
code_sink.writeln("{NULL, NULL, 0, NULL}")
|
||||
code_sink.unindent()
|
||||
code_sink.writeln("};")
|
||||
self.slots.setdefault("tp_methods", "%s_methods" % (self.name,))
|
||||
self.slots.setdefault("tp_methods", "%s_methods" % (self.pystruct,))
|
||||
|
||||
def _generate_gc_methods(self, code_sink):
|
||||
"""Generate tp_clear and tp_traverse"""
|
||||
|
||||
@@ -72,7 +72,7 @@ class CppMethod(ForwardWrapperBase):
|
||||
"""set the class object this method belongs to"""
|
||||
self._class = class_
|
||||
self.wrapper_base_name = "_wrap_%s_%s" % (
|
||||
class_.name, self.mangled_name)
|
||||
class_.pystruct, self.mangled_name)
|
||||
def get_class(self):
|
||||
"""get the class object this method belongs to"""
|
||||
return self._class
|
||||
@@ -230,7 +230,7 @@ class CppConstructor(ForwardWrapperBase):
|
||||
"Set the class wrapper object (CppClass)"
|
||||
self._class = class_
|
||||
self.wrapper_base_name = "_wrap_%s__tp_init" % (
|
||||
class_.name,)
|
||||
class_.pystruct,)
|
||||
def get_class(self):
|
||||
"Get the class wrapper object (CppClass)"
|
||||
return self._class
|
||||
@@ -336,7 +336,7 @@ class CppNoConstructor(ForwardWrapperBase):
|
||||
#assert isinstance(class_, CppClass)
|
||||
|
||||
wrapper_function_name = "_wrap_%s__tp_init" % (
|
||||
class_.name,)
|
||||
class_.pystruct,)
|
||||
code_sink.writeln("static int")
|
||||
code_sink.writeln("%s(void)" % wrapper_function_name)
|
||||
code_sink.writeln('{')
|
||||
|
||||
Reference in new issue
Block a user