Commit f8cbb006 authored by Robert Bradshaw's avatar Robert Bradshaw Committed by GitHub

Merge pull request #1526 from robertwb/no-object-attrs

Limit Python conversion on attribute access.
parents 3392afe9 2bfc14c5
...@@ -54,6 +54,9 @@ Other changes ...@@ -54,6 +54,9 @@ Other changes
* The `unraisable_tracebacks` now defaults to `True`. * The `unraisable_tracebacks` now defaults to `True`.
* Coercion of C++ containers to Python is no longer automatic on attribute
access (Github issue #1521).
0.25.2 (2016-12-08) 0.25.2 (2016-12-08)
=================== ===================
......
...@@ -6578,7 +6578,10 @@ class AttributeNode(ExprNode): ...@@ -6578,7 +6578,10 @@ class AttributeNode(ExprNode):
self.type = py_object_type self.type = py_object_type
self.is_py_attr = 1 self.is_py_attr = 1
if not obj_type.is_pyobject and not obj_type.is_error: if not obj_type.is_pyobject and not obj_type.is_error:
if obj_type.can_coerce_to_pyobject(env): # Expose python methods for immutable objects.
if (obj_type.is_string or obj_type.is_cpp_string
or obj_type.is_buffer or obj_type.is_numeric
or (obj_type.is_struct and obj_type.can_coerce_to_pyobject(env))):
if not immutable_obj: if not immutable_obj:
self.obj = self.obj.coerce_to_pyobject(env) self.obj = self.obj.coerce_to_pyobject(env)
elif (obj_type.is_cfunction and (self.obj.is_name or self.obj.is_attribute) elif (obj_type.is_cfunction and (self.obj.is_name or self.obj.is_attribute)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment