You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently PythonEngine.pas was modified to include 'obj.Free' when Engine.PyErr_Occurred indicates an error. As a result, the newly created object will be destroyed twice as Engine.Py_DECREF(Result) will also call the destructor in PyObjectDestructor() (in this code 'obj' and 'Result' are pointing to the same object following 'obj := PythonToDelphi(Result)').
Here is the relevant code excerpt:
function TPythonType.NewSubtypeInst( aType: PPyTypeObject; args, kwds : PPyObject) : PPyObject;
var
obj : TPyObject;
begin
(..)
if Assigned(Result) then
begin
obj := PythonToDelphi(Result);
(..)
if Engine.PyErr_Occurred <> nil then
begin
Engine.Py_DECREF(Result);
Result := nil;
obj.Free; // <- This statement is redundant and calls the destructor for the 2nd time
end;
end;
end;
My proposal is to remove the redundant/erroneous call to obj.Free above. Do you agree?
The text was updated successfully, but these errors were encountered:
Recently PythonEngine.pas was modified to include 'obj.Free' when Engine.PyErr_Occurred indicates an error. As a result, the newly created object will be destroyed twice as Engine.Py_DECREF(Result) will also call the destructor in PyObjectDestructor() (in this code 'obj' and 'Result' are pointing to the same object following 'obj := PythonToDelphi(Result)').
Here is the relevant code excerpt:
My proposal is to remove the redundant/erroneous call to obj.Free above. Do you agree?
The text was updated successfully, but these errors were encountered: