Opened 11 years ago

Closed 11 years ago

#5758 closed defect (fixed)

[with patch, positive review] weird "hello" bug in homset coerce!

Reported by: was Owned by: robertwb
Priority: major Milestone: sage-4.1.2
Component: coercion Keywords:
Cc: robertwb Merged in: Sage 4.1.2.alpha2
Authors: John Palmieri Reviewers: Mike Hansen
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

With a 100% clean sage-3.4.1.rc2:

wstein@sage:~/build/sage-3.4.1.rc2$ ./sage
----------------------------------------------------------------------
| Sage Version 3.4.1.rc2, Release Date: 2009-04-10                   |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
Loading Sage library. Current Mercurial branch is: ref
sage: Zmod(8).lift() == 1
init_coerce() for  <class 'sage.categories.homset.Homset'>
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)

/scratch/wstein/sage/temp/sage.math.washington.edu/4833/_scratch_wstein_sage_init_sage_0.py in <module>()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__richcmp__ (sage/rings/integer.c:7457)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/element.so in sage.structure.element.Element._richcmp (sage/structure/element.c:5714)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.canonical_coercion (sage/structure/coerce.c:7434)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.coercion_maps (sage/structure/coerce.c:9262)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.discover_coercion (sage/structure/coerce.c:11046)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c:9337)()

/scratch/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.init_coerce (sage/structure/parent.c:3085)()

ZeroDivisionError: hello

Attachments (1)

trac_5758-hello.patch (1.2 KB) - added by jhpalmieri 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by was

NOTE: When this is fixed, be sure to add this test to rings/morphism.pyx:

sage: Zmod(8).lift() == 1
False

See #5756.

comment:2 Changed 11 years ago by mabshoff

  • Milestone changed from sage-3.4.1 to sage-3.4.2

Bouncing to 3.4.2.

Cheers,

Michael

comment:3 Changed 11 years ago by jhpalmieri

  • Cc robertwb added
  • Summary changed from weird "hello" bug in homset coerce! to [with patch, needs review] weird "hello" bug in homset coerce!

The cuplrit here is in parent.pyx,

    cdef int init_coerce(self, bint warn=True) except -1:
        if self._coerce_from_hash is None:
            if warn:
                print "init_coerce() for ", type(self)
                raise ZeroDivisionError, "hello"
        ...

I'm attaching a patch which I think fixes the problem, but maybe someone familiar with the coercion code should take a look. (It's a one-line patch, plus the doctest that William requested.)

Changed 11 years ago by jhpalmieri

comment:4 Changed 11 years ago by mhansen

  • Authors set to John Palmieri
  • Reviewers set to Mike Hansen
  • Summary changed from [with patch, needs review] weird "hello" bug in homset coerce! to [with patch, positive review] weird "hello" bug in homset coerce!

Looks good to me.

comment:5 Changed 11 years ago by mvngu

  • Merged in set to Sage 4.1.2.alpha2
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.