Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
The Access appears to happenning during the call to Py_Finalize.
The debugger shows that Python calls
PyGC_Collect
which calls Py_AddPendingCall in which the error occurs.
So it appears that there is a problem during garbage collection.
Original comment by pyscripter
on 10 Dec 2008 at 12:59
Still with the Demo01, if I disconnect the redirection there is no error
occurring
even if I execute code. So the issue might be the pyio module creation.
I had to modify Py_InitModule since Py_InitModule4 was removed in Python 3000.
Here
is the version in SVN. Is anything wrong with this? (redirection works fine).
function TPythonInterface.Py_InitModule( const AName : PChar; md :
PPyMethodDef) :
PPyObject;
Var
moduledef : PyModuleDef;
modules : PPyObject;
begin
CheckPython;
if IsPython3000 then begin
FillChar(moduledef, SizeOf(moduledef), 0);
moduledef.m_base.ob_refcnt := 1;
moduledef.m_name := AName;
moduledef.m_methods := md;
moduledef.m_size := -1;
Result:= PyModule_Create2(@moduledef, APIVersion);
if not Assigned(Result) then
GetPythonEngine.CheckError;
// To emulate Py_InitModule4 we need to add the module to sys.modules
modules := PyImport_GetModuleDict;
if PyDict_SetItemString(modules, AName, Result) <> 0 then
GetPythonEngine.CheckError;
end else
Result := Py_InitModule4( AName, md, nil, nil, APIVersion );
end;
Original comment by pyscripter
on 10 Dec 2008 at 9:48
The problem actually was in the above function.
Fixed in todays commit.
At long last...
Original comment by pyscripter
on 13 Feb 2009 at 12:36
Original issue reported on code.google.com by
pyscripter
on 10 Dec 2008 at 12:40