[New-bugs-announce] [issue36876] Global C variables are a problem.

Eric Snow report at bugs.python.org
Fri May 10 15:01:42 EDT 2019


New submission from Eric Snow <ericsnowcurrently at gmail.com>:

We still have a bunch of "global" C variables (static globals, static locals, maybe thread-local storage) in our code-base that break the isolation between interpreters.  I added Tools/c-globals/check-c-globals.py a while back to help identify such variables, however more have crept in.  I also did not take static locals or thread-locals into account.

To address the above, we should do the following:

1. update check-c-globals.py to identify static locals (and thread-locals)
2. deal with any identified globals
   * move them to _PyRuntimeState (or thread-locals to PyThreadState, etc.)
   * ignore them by adding them to Tools/c-globals/ignored-globals.txt
3. add check-c-globals.py to "make check"
4. (if "make check" isn't already there), ensure check-c-globals.py is run at some point in CI

Separately, we should move fields out of _PyRuntimeState into PyInterpreterState wherever possible.  That can also be done at step 2 if it's not too much work.

----------
assignee: eric.snow
components: Interpreter Core
messages: 342119
nosy: eric.snow, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Global C variables are a problem.
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36876>
_______________________________________


More information about the New-bugs-announce mailing list