File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,14 @@ cdef class DebugOptions_class:
4141
4242cdef DebugOptions_class debug = DebugOptions_class()
4343
44- # Since "debug" is declared with a type , it can only be cimported at
44+ # Since "debug" is declared with cdef , it can only be cimported at
4545# the Cython level, not imported in plain Python. So we add it to the
46- # globals manually. We need to hack into Cython internals for this
47- # since Sage is compiled with the old_style_globals option.
48- from cpython.object cimport PyObject
49- cdef extern from * :
50- PyObject* __pyx_d
51-
52- (< object > __pyx_d)[" debug" ] = debug
46+ # globals manually. However this will make the variable out of sync
47+ # if some user modifies the object, which is inevitable.
48+ # See https://github.com/cython/cython/issues/3959#issuecomment-753455240
49+ # and https://github.com/cython/cython/issues/656
50+ # Note that ``_this_module`` could not be ``globals()``
51+ # because Sage is compiled with the old_style_globals option.
52+ import sage.structure.debug_options as _this_module
53+ _this_module.debug = debug
54+ del _this_module
You can’t perform that action at this time.
0 commit comments