Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#5092 closed defect (fixed)

Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

Reported by: William Stein Owned by: William Stein
Priority: major Milestone: sage-4.2
Component: number theory Keywords:
Cc: Merged in: sage-4.2.alpha1
Authors: William Stein Reviewers: Mike Hansen, Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description


Attachments (1)

trac_5092.patch (2.5 KB) - added by Mike Hansen 13 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 14 years ago by William Stein

Summary: Primes()?? gets hung in len call[with patch; needs review] Primes()?? gets hung in len call

comment:2 Changed 14 years ago by William Stein

Summary: [with patch; needs review] Primes()?? gets hung in len call[with patch; needs review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

comment:3 Changed 14 years ago by Franco Saliola

Summary: [with patch; needs review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py[with patch; needs work] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

You don't need the first two lines below in cmp anymore.

        if isinstance(right, Primes_class):
            return 0
        return cmp(type(self), type(right))

Otherwise, it's a positive review.

comment:4 Changed 14 years ago by Franco Saliola

Summary: [with patch; needs work] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py[with patch; positive review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

comment:5 Changed 14 years ago by Michael Abshoff

Summary: [with patch; positive review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py[with patch; needs work] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

This patch causes one doctest failure:

sage -t -long "devel/sage/sage/sets/set.py"                 
**********************************************************************
File "/scratch/mabshoff/sage-3.3.alpha4/devel/sage/sage/sets/set.py", line 278:
    sage: Primes() < Set(QQ)
Expected:
    True
Got:
    False
**********************************************************************

Cheers,

Michael

comment:6 in reply to:  5 Changed 14 years ago by Franco Saliola

Replying to mabshoff:

This patch causes one doctest failure:

This is a weird test. I'm not even sure that it says anything meaningful. In fact, according to the documentation of cmp for Set, it doesn't:

        \note{If $X < Y$ is true this does \emph{not} necessarily mean
        that $X$ is a subset of $Y$.  Also, any two sets can be
        compared, which is a general Python philosophy.}

comment:7 Changed 14 years ago by Alex Ghitza

See #5933, which brings the coverage to 100% and was merged in 3.4.2.rc0.

comment:8 Changed 14 years ago by Michael Abshoff

Well, there is still a potential bug fix in here, so can someone take a look and extra a potential fix?

Cheers,

Michael

Changed 13 years ago by Mike Hansen

Attachment: trac_5092.patch added

comment:9 Changed 13 years ago by Mike Hansen

Authors: William Stein
Status: needs_workneeds_review

I've rebased the patch of #5933.

comment:10 Changed 13 years ago by Mike Hansen

Summary: [with patch; needs work] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py[with patch; needs review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.py

err, on top of #5933

comment:11 Changed 13 years ago by Karl-Dieter Crisman

Reviewers: Mike Hansen, Karl-Dieter Crisman
Status: needs_reviewpositive_review

Positive review. Unless you can provide an easily accessible example of where Primes(False) isn't Primes(True), but perhaps the first place that happens is waaay down the road...

comment:12 Changed 13 years ago by Mike Hansen

Merged in: sage-4.2.alpha1
Resolution: fixed
Status: positive_reviewclosed

comment:13 Changed 13 years ago by Mike Hansen

Summary: [with patch; needs review] Primes()?? gets hung in len call; also bring coverage to 100% for primes.pyPrimes()?? gets hung in len call; also bring coverage to 100% for primes.py
Note: See TracTickets for help on using tickets.