summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-03-22 08:41:46 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-03-22 08:41:46 +0100
commit85d2424f4f9229cc14007f3da60efd679ae1fc4d (patch)
treebf00b9c46cbc09386100a61e6e67a3588851fadc
parent492fd0cf8e5474392c23be351b443816cc8f9510 (diff)
downloadcython-85d2424f4f9229cc14007f3da60efd679ae1fc4d.tar.gz
Clarify a variable name and simplify its usage.
-rw-r--r--Cython/Compiler/ModuleNode.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 58fd6b550..e5e30ba96 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1284,9 +1284,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
cpp_class_attrs = [entry for entry in scope.var_entries
if entry.type.is_cpp_class]
- new_func_entry = scope.lookup_here("__new__")
- if base_type or (new_func_entry and new_func_entry.is_special
- and not new_func_entry.trivial_signature):
+ cinit_func_entry = scope.lookup_here("__cinit__")
+ if cinit_func_entry and not cinit_func_entry.is_special:
+ cinit_func_entry = None
+
+ if base_type or (cinit_func_entry and not cinit_func_entry.trivial_signature):
unused_marker = ''
else:
unused_marker = 'CYTHON_UNUSED '
@@ -1394,14 +1396,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if cclass_entry.cname == '__pyx_memoryviewslice':
code.putln("p->from_slice.memview = NULL;")
- if new_func_entry and new_func_entry.is_special:
- if new_func_entry.trivial_signature:
+ if cinit_func_entry:
+ if cinit_func_entry.trivial_signature:
cinit_args = "o, %s, NULL" % Naming.empty_tuple
else:
cinit_args = "o, a, k"
needs_error_cleanup = True
code.putln("if (unlikely(%s(%s) < 0)) goto bad;" % (
- new_func_entry.func_cname, cinit_args))
+ cinit_func_entry.func_cname, cinit_args))
code.putln(
"return o;")