summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ExprNodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'Cython/Compiler/ExprNodes.py')
-rw-r--r--Cython/Compiler/ExprNodes.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 57adc791e..c4e7679cd 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -7225,6 +7225,7 @@ class AttributeNode(ExprNode):
is_memslice_transpose = False
is_special_lookup = False
is_py_attr = 0
+ dont_mangle_private_names = False # skip mangling class.__attr names
def as_cython_attribute(self):
if (isinstance(self.obj, NameNode) and
@@ -7570,8 +7571,9 @@ class AttributeNode(ExprNode):
def analyse_as_python_attribute(self, env, obj_type=None, immutable_obj=False):
if obj_type is None:
obj_type = self.obj.type
- # mangle private '__*' Python attributes used inside of a class
- self.attribute = env.mangle_class_private_name(self.attribute)
+ if not self.dont_mangle_private_names:
+ # mangle private '__*' Python attributes used inside of a class
+ self.attribute = env.mangle_class_private_name(self.attribute)
self.member = self.attribute
self.type = py_object_type
self.is_py_attr = 1