File tree 1 file changed +10
-8
lines changed
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:
41
41
42
42
cdef DebugOptions_class debug = DebugOptions_class()
43
43
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
45
45
# 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