Skip to content
Discussion options

You must be logged in to vote

If you want to clean up your created global variables, the best way is to use the following ExecString/EvalString overloads:

    procedure  ExecString(const command: AnsiString; locals, globals: PPyObject; const FileName: string = '<string>'); overload;
    function   EvalString(const command: AnsiString; locals, globals: PPyObject; const FileName: string = '<string>'): PPyObject; overload;

and provide a new locals dictionary (PyDict_New), which you destroy (Py_DECREF) after the calling the above functions.

Note that if globals is nil, it becomes the same as locals.

Replies: 8 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@MKostitsyn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MKostitsyn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MKostitsyn
Comment options

Comment options

You must be logged in to vote
1 reply
@MKostitsyn
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pyscripter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants