Ticket #9944: trac9944_second_referee.patch

File trac9944_second_referee.patch, 1.1 KB (added by SimonKing, 9 years ago)

Call Parent.init during initialisation of a ring

  • sage/rings/ring.pyx

    # HG changeset patch
    # User Simon King <simon.king@uni-jena.de>
    # Date 1301484257 -7200
    # Node ID b957652c17d644d79f968f32643615ea46f6c217
    # Parent  be909039b9bb942c18344254ba8bfe7495836924
    #9944: Call Parent.__init__ during initialization of a ring.
    
    diff -r be909039b9bb -r b957652c17d6 sage/rings/ring.pyx
    a b  
    7272    """
    7373    Generic ring class.
    7474    """
     75    # Unfortunately, ParentWithGens inherits from sage.structure.parent_old.Parent.
     76    # Its __init__ method does *not* call Parent.__init__, since this would somehow
     77    # yield an infinite recursion. But when we call it from here, it works.
     78    # This is done in order to ensure that __init_extra__ is called.
     79    def __init__(self, base, names=None, normalize=True, category = None):
     80        ParentWithGens.__init__(self, base, names=names, normalize=normalize)
     81        Parent.__init__(self, category=category)
     82
    7583    def __iter__(self):
    7684        r"""
    7785        Return an iterator through the elements of self. Not implemented in general.