summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2016-09-03 14:43:27 +0200
committerStefan Behnel <stefan_ml@behnel.de>2016-09-03 14:43:27 +0200
commit0bc337583557aa4517554e994c9a8a363f111fdd (patch)
treecb4e4540796a9b929b44a83c9fa74af011e0d02e /Cython/Compiler/ModuleNode.py
parent600fe084f79501938a148c11a63404011808a302 (diff)
downloadcython-0bc337583557aa4517554e994c9a8a363f111fdd.tar.gz
restrict "__dict__" property generation to declared "__dict__" attributes and ignore everything else
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 65e0a9a33..b02a69f9f 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1993,8 +1993,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"};")
def generate_dict_getter_function(self, scope, code):
- func_name = scope.mangle_internal("__dict__getter")
dict_attr = scope.lookup_here("__dict__")
+ if not dict_attr or not dict_attr.is_variable:
+ return
+ func_name = scope.mangle_internal("__dict__getter")
dict_name = dict_attr.cname
code.putln("")
code.putln("static PyObject *%s(PyObject *o, CYTHON_UNUSED void *x) {" % func_name)