Commit 71925a16 authored by Robert Bradshaw's avatar Robert Bradshaw

Casting from C pointer to object does not incref

Casting a non-Python pointer type to a Python type no longer
generates an incref, unless one is required for other reasons.
    [Arc Riley]
parent c20db3ec
......@@ -2737,9 +2737,8 @@ class TypecastNode(ExprNode):
if from_py and not to_py and self.operand.is_ephemeral() and not self.type.is_numeric:
error(self.pos, "Casting temporary Python object to non-numeric non-Python type")
if to_py and not from_py:
self.result_ctype = py_object_type
self.is_temp = 1
if self.operand.type.to_py_function:
self.result_ctype = py_object_type
self.operand = self.operand.coerce_to_pyobject(env)
else:
warning(self.pos, "No conversion from %s to %s, python object pointer used." % (self.operand.type, self.type))
......@@ -3850,9 +3849,6 @@ class CloneNode(CoercionNode):
if hasattr(self.arg, 'entry'):
self.entry = self.arg.entry
#def result_as_extension_type(self):
# return self.arg.result_as_extension_type()
def generate_evaluation_code(self, code):
pass
......
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