noOriginally Posted by Pyrogine
noOriginally Posted by Pyrogine
From brazil (:
Pascal pownz!
im getting crazy with this stuff =.=Code:function Py_Eval(const module, com, resultformat: string; const resultvalue: array of Pointer): Boolean; var pModule, pDict, pResult: PPyObject; begin Result := False; pModule := PyImport_ImportModule(PChar(module)); if PyModule_Check(pModule) then begin pDict := PyModule_GetDict(pModule); if PyDict_Check(pDict) then begin pResult := PyRun_String(PChar(com), eval_input, pDict, pDict); if Assigned(pResult) then begin if PyArg_Parse(pResult, PChar(resultformat), resultvalue) <> 0 then Result := True; Py_DECREF(pResult); end; Py_DECREF(pDict);// ERROR HERE, WHY ? Don't Know! end; Py_DECREF(pModule); end; end;
i tested exactly same code on C++ and works perfectly :roll:
From brazil (:
Pascal pownz!
Hmm... check your spam filter maybe?no
Sweet!im getting crazy with this stuff =.=
i tested exactly same code on C++ and works perfectly :roll:
Jarrod Davis
Technical Director @ Piradyne Games
its not there ;/Originally Posted by Pyrogine
i expressed myself wrong :lol:Originally Posted by Pyrogine
it's bad, i don't know why im getting an error when dec dicts reference count :x
Code:Py_DECREF(pDict);// ERROR HERE, WHY ? Don't Know!
From brazil (:
Pascal pownz!
oh... ok. Hmmm.. let me see then... maybe the call to PyRun_String. I have no idea how it works. I see you pass pDict in twice? is that correct? Also maybe it does something to the ref count after it returns? What happens to ref count of pDict if PyRun_String fails?
Jarrod Davis
Technical Director @ Piradyne Games
a guy from google python group explained me the problem that is "borrowed" value, i must not dec it reference count and PyModule_GetDict returns a a borrowed value :?Originally Posted by Pyrogine
all solved
From brazil (:
Pascal pownz!
Ah, good news.
Jarrod Davis
Technical Director @ Piradyne Games
Bookmarks