aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-03-02 11:59:50 +0200
committerMatti Picus <matti.picus@gmail.com>2021-03-02 11:59:50 +0200
commit2fae0b524569659fc1bda89d8d47f2f6616bf5fd (patch)
treebe00a028430fd7353346cde8e0d85543721e764a
parentsync Py_.*Flags with sys.flags, issue 3409 (diff)
downloadpypy-2fae0b524569659fc1bda89d8d47f2f6616bf5fd.tar.gz
pypy-2fae0b524569659fc1bda89d8d47f2f6616bf5fd.tar.bz2
pypy-2fae0b524569659fc1bda89d8d47f2f6616bf5fd.zip
make init_flags a init_function
-rw-r--r--pypy/module/cpyext/api.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
index 237285be5c..8e1a476509 100644
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1197,11 +1197,12 @@ def attach_c_functions(space, eci, prefix):
include_dirs=include_dirs,
includes=['Python.h'],
link_extra = libs,
- )
+ )
+ state.C.flag_setters = {}
for c_name, attr in _flags:
_, setter = rffi.CExternVariable(rffi.SIGNED, c_name, eci_flags,
_nowrapper=True, c_type='int')
- setattr(state.C, 'set_' + attr, setter)
+ state.C.flag_setters[attr] = setter
@@ -1217,11 +1218,11 @@ def run_bootstrap_functions(space):
for func in BOOTSTRAP_FUNCTIONS:
func(space)
-@bootstrap_function
+@init_function
def init_flags(space):
state = space.fromcache(State)
for _, attr in _flags:
- f = getattr(state.C, 'set_' + attr)
+ f = state.C.flag_setters[attr]
f(space.sys.get_flag(attr))
#_____________________________________________________