mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #9869: Make long() and PyNumber_Long return something of type
long for a class whose __long__ method returns a plain int. This fixes an interpreter crash (due to long_subtype_new assuming PyNumber_Long returns a long) when initializing an instance of a long subclass from an object whose __long__ method returns a plain int.
This commit is contained in:
parent
3eac591a5c
commit
cb61e5d9b5
4 changed files with 30 additions and 2 deletions
|
@ -513,7 +513,7 @@ class ClassTests(unittest.TestCase):
|
|||
|
||||
callLst[:] = []
|
||||
as_long = long(mixIntAndLong)
|
||||
self.assertEquals(type(as_long), int)
|
||||
self.assertEquals(type(as_long), long)
|
||||
self.assertEquals(as_long, 64)
|
||||
self.assertCallStack([('__long__', (mixIntAndLong,))])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue