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

Commit

Permalink
Fix compiler warnings involving debug.refine_category_hash_check
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Nov 23, 2017
1 parent 92f95ce commit 8dfff41
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
@@ -425,13 +425,15 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
True
"""
cdef Py_hash_t hash_old = -1
if debug.refine_category_hash_check:
# check that the hash stays the same after refinement
hash_old = hash(self)

if self._category is None:
self._init_category_(category)
if debug.refine_category_hash_check and hash_old != hash(self):
print('hash of {0} changed in Parent._refine_category_ during initialisation'.format(str(self.__class__)))
if hash_old != -1 and hash_old != hash(self):
print(f'hash of {type(self)} changed in Parent._refine_category_ during initialisation')
return
if category is self._category:
return
@@ -454,12 +456,12 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
# If the element class has already been assigned, it
# needs to be erased now.
try:
self.__dict__.__delitem__('element_class')
self.__dict__.__delitem__('_abstract_element_class')
del self.__dict__['element_class']
del self.__dict__['_abstract_element_class']
except (AttributeError, KeyError):
pass
if debug.refine_category_hash_check and hash_old != hash(self):
print('hash of {0} changed in Parent._refine_category_ during refinement'.format(str(self.__class__)))
if hash_old != -1 and hash_old != hash(self):
print(f'hash of {type(self)} changed in Parent._refine_category_ during refinement')

def _unset_category(self):
"""

0 comments on commit 8dfff41

Please sign in to comment.