Opened 14 years ago

Closed 13 years ago

#5758 closed defect (fixed)

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

Reported by: William Stein Owned by: Robert Bradshaw
Priority: major Milestone: sage-4.1.2
Component: coercion Keywords:
Cc: Robert Bradshaw Merged in: Sage 4.1.2.alpha2
Authors: John Palmieri Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

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 John Palmieri 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by William Stein

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 14 years ago by Michael Abshoff

Milestone: sage-3.4.1sage-3.4.2

Bouncing to 3.4.2.

Cheers,

Michael

comment:3 Changed 13 years ago by John Palmieri

Cc: Robert Bradshaw added
Summary: weird "hello" bug in homset coerce![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 13 years ago by John Palmieri

Attachment: trac_5758-hello.patch added

comment:4 Changed 13 years ago by Mike Hansen

Authors: John Palmieri
Reviewers: Mike Hansen
Summary: [with patch, needs review] weird "hello" bug in homset coerce![with patch, positive review] weird "hello" bug in homset coerce!

Looks good to me.

comment:5 Changed 13 years ago by Minh Van Nguyen

Merged in: Sage 4.1.2.alpha2
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.