This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Alex Groce
Recipients Alex Groce
Date 2016-08-26.19:12:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Using a random testing system to compare Python long behavior to GMP (via gmpy2), I notice that in a low-memory situation (created by allocating many large integers in both Python and GMP), a left-shift of 0 by large number of bytes:

- returns 0 via gmpy2
- causes a memory error in Python, e.g.:

val4 = val3 << val4
val3: 0 (GMP) 0 (Python)
val4: 1459166279268040830 (GMP) 1459166279268040830 (Python)
[operation successful via GMP]
Python(4463,0x7fff7152c300) malloc: *** mach_vm_map(size=194555503902408704) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

Auto-generated test is attached, though probably not needed to understand the issue.  File is not minimized, since I suspect most of the code is just to choke memory, and you probably need the right memory config to replay, but it shows the basic idea.

For more info, see
Date User Action Args
2016-08-26 19:12:23Alex Grocesetrecipients: + Alex Groce
2016-08-26 19:12:23Alex Grocesetmessageid: <>
2016-08-26 19:12:23Alex Grocelinkissue27870 messages
2016-08-26 19:12:23Alex Grocecreate