[issue3777] long(4.2) now returns an int

Barry Alan Scott report at bugs.python.org
Sun Sep 7 00:43:08 CEST 2008


Barry Alan Scott <barry-scott at users.sourceforge.net> added the comment:

My concern and yours is that this is not backwards
compatible. I would hate to see "random" failures
of extensions written using PyCXX because of this.

I'm tempted to says that I'll keep PyCXX 5.x as is for
Python 2.x and leave all the changes in semantics
for PyCXX 6.0 that will support Python 3.0.
And in Python 3.0 this problem does not exist
by design.

I don't think you example proves anything.
Python does not check at the pure python level at all.

>>> class X:
...     def __long__( self ):
...             return "Hello"
... 
>>> long( X() )
'Hello'
>>> 

You get all you deserve if you define __long__ and break its
API.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3777>
_______________________________________


More information about the Python-bugs-list mailing list