From 2fae0b524569659fc1bda89d8d47f2f6616bf5fd Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 2 Mar 2021 11:59:50 +0200 Subject: make init_flags a init_function --- pypy/module/cpyext/api.py | 9 +++++---- 1 file 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)) #_____________________________________________________ -- cgit v1.2.3-65-gdbad