This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Support PyObject interface for global variables in local scope and debugger
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dzhamoytsin
Priority: normal Keywords: patch

Created on 2021-12-16 10:33 by dzhamoytsin, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 30141 open dzhamoytsin, 2021-12-16 12:13
Repositories containing patches
https://github.com/dzhamoytsin/cpython
Messages (1)
msg408684 - (view) Author: Dmitry (dzhamoytsin) * Date: 2021-12-16 10:33
We use the embedded Python in a multiscript environment. For example, VBS can execute Python code and vice versa. 

For that purpose we use a global context which is common for all running scripts (Python, VBS etc.) and control access to variables in that context by PyObject interface. 

But we faced with an issue:

1) Setting/deleting global variables in local scope are done outside of our control (without using PyObject interface).

2) A debugger (LOAD_NAME tag) does not see global variables in local scope.

We would like to fix that issue by adding a check for exact PyDict (PyDict_CheckExact) in STORE_GLOBAL, DELETE_GLOBAL and LOAD_NAME tags in ceval.c. 
If a global dictionary is redefined then use PyObject interface instead of direct PyDict one.
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90254
2021-12-16 12:13:02dzhamoytsinsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28359
2021-12-16 10:33:14dzhamoytsincreate