Commit 77e853ad authored by Stefan Behnel's avatar Stefan Behnel

tighten Python-to-C++-reference warning to apply only to C++ classes as target...

tighten Python-to-C++-reference warning to apply only to C++ classes as target and do not show it by default (usage might be legitimate and/or enforced by an external API)
parent 075e025f
...@@ -782,11 +782,10 @@ class ExprNode(Node): ...@@ -782,11 +782,10 @@ class ExprNode(Node):
if src.constant_result is not None: if src.constant_result is not None:
src = PyTypeTestNode(src, dst_type, env) src = PyTypeTestNode(src, dst_type, env)
elif src.type.is_pyobject: elif src.type.is_pyobject:
if used_as_reference: if used_as_reference and dst_type.is_cpp_class:
warning( warning(
self.pos, self.pos,
"Cannot pass Python object as C++ data structure reference (%s &), will pass by copy." % dst_type, "Cannot pass Python object as C++ data structure reference (%s &), will pass by copy." % dst_type)
level=1)
src = CoerceFromPyTypeNode(dst_type, src, env) src = CoerceFromPyTypeNode(dst_type, src, env)
elif (dst_type.is_complex elif (dst_type.is_complex
and src_type != dst_type and src_type != dst_type
......
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