Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage.structure.debug_options should be cimported
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Jul 26, 2016
1 parent cadb3b6 commit fb6ef31
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sage/structure/category_object.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ from __future__ import print_function
cimport generators
cimport sage_object
from sage.categories.category import Category
from sage.structure.debug_options import debug
from sage.structure.debug_options cimport debug
from sage.misc.cachefunc import cached_method


Expand Down
3 changes: 2 additions & 1 deletion src/sage/structure/debug_options.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

cdef class DebugOptions_class:
cdef public bint bad_parent_warnings
cdef public bint unique_parent_warnings
cdef public bint refine_category_hash_check

cdef DebugOptions_class debug
12 changes: 11 additions & 1 deletion src/sage/structure/debug_options.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,14 @@ cdef class DebugOptions_class:
self.refine_category_hash_check = False


debug = DebugOptions_class()
cdef DebugOptions_class debug = DebugOptions_class()

# Since "debug" is declared with a type, it can only be cimported at
# the Cython level, not imported in plain Python. So we add it to the
# globals manually. We need to hack into Cython internals for this
# since Sage is compiled with the old_style_globals option.
from cpython.object cimport PyObject
cdef extern from *:
PyObject* __pyx_d

(<object>__pyx_d)["debug"] = debug
2 changes: 1 addition & 1 deletion src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ from types import MethodType
from .element cimport parent_c, coercion_model
cimport sage.categories.morphism as morphism
cimport sage.categories.map as map
from sage.structure.debug_options import debug
from sage.structure.debug_options cimport debug
from sage.structure.sage_object cimport SageObject, rich_to_bool
from sage.structure.misc import (dir_with_other_class, getattr_from_other_class,
is_extension_type)
Expand Down

0 comments on commit fb6ef31

Please sign in to comment.