Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reported upstream] Bug in python range #1159

Closed
robertwb opened this issue Nov 12, 2007 · 12 comments
Closed

[reported upstream] Bug in python range #1159

robertwb opened this issue Nov 12, 2007 · 12 comments

Comments

@robertwb
Copy link
Contributor

%python
class MyInt:
    def __init__(self, n):
        self.n = int(n)
    def __int__(self):
        return self.n

print range(MyInt(2**3), MyInt(2**3+10))
print "here"
print range(MyInt(2**34), MyInt(2**34+10))

Fixed by #9958.

Upstream: Fixed upstream, in a later stable release.

Component: packages: standard

Reviewer: Jason Grout

Issue created by migration from https://trac.sagemath.org/ticket/1159

@robertwb
Copy link
Contributor Author

comment:1
%python
class MyInt:
    def __init__(self, n):
        self.n = int(n)
    def __int__(self):
        return self.n

print range(MyInt(2**3), MyInt(2**3+10))
print "here"
print range(MyInt(2**34), MyInt(2**34+10))

@sagetrac-mabshoff sagetrac-mabshoff mannequin added this to the sage-2.8.13 milestone Nov 13, 2007
@sagetrac-mabshoff

This comment has been minimized.

@sagetrac-mabshoff

This comment has been minimized.

@mwhansen
Copy link
Contributor

comment:5

I can't find any issue with this. It works correctly for me in both the Python and Sage environments.

@robertwb
Copy link
Contributor Author

robertwb commented Dec 1, 2007

comment:6

I get

Traceback (most recent call last):    print range(MyInt(2**34), MyInt(2**34+10))
  File "/Users/robert/sage/current/local/lib/python2.5/site-packages/sage/server/support.py", line 260, in syseval
    return system.eval(cmd)
  File "/Users/robert/sage/current/local/lib/python2.5/site-packages/sage/misc/python.py", line 21, in eval
    eval(z, globals, locals)
  File "/Users/robert/sage/sage-2.8.11/data/extcode/sage/", line 1, in <module>
    
TypeError: range() integer start argument expected, got instance.

On a 64-bit machine, try

print range(2**64, 2**64+10)
print range(MyInt(2**64), MyInt(2**64+10))

I believe this is a bug in Python, and have reported it here: http://bugs.python.org/issue1533

@robertwb robertwb modified the milestones: sage-2.8.15, sage-2.9 Dec 1, 2007
@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title Bug in python range [reported upstream] Bug in python range Jan 24, 2008
@mwhansen
Copy link
Contributor

Upstream: Reported upstream. Little or no feedback.

@sagetrac-Koen
Copy link
Mannequin

sagetrac-Koen mannequin commented Dec 10, 2010

comment:11

Fixed in upstream Python 2.6.6 / Python 2.7 (see issue 1533 linked to above) and fix will also be in Python 3 releases. This needs an upgrade of the Sage Python from 2.6.4 to 2.6.6.

@sagetrac-Koen sagetrac-Koen mannequin added the s: needs work label Dec 10, 2010
@sagetrac-Koen
Copy link
Mannequin

sagetrac-Koen mannequin commented Dec 10, 2010

comment:12

Alternative fix to upgrade to Python 2.6.6 would be the upgrade to Python 2.7 from ticket #9958

@jasongrout
Copy link
Member

comment:13

Fixed by #9958, when it gets merged (upgrade to python 2.7)

@jdemeyer
Copy link

jdemeyer commented Jan 6, 2012

Changed upstream from Reported upstream. Little or no feedback. to Fixed upstream, in a later stable release.

@jdemeyer
Copy link

jdemeyer commented Jan 6, 2012

Reviewer: Jason Grout

@jdemeyer jdemeyer removed this from the sage-4.8 milestone Jan 6, 2012
@jdemeyer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants