Closed
Description
Crash report
What happened?
The below example stores an integer counter as a class variable C.counter
. Incrementing the counter using C.counter += 1
between 2^32 - 2^24 and 2^32 times makes the Python 3.12.1 interpreter crash (after about 30 min) .
Tested with Python 3.12.1 on Windows 11.
# Windows 11: Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
# CPython interpreter crashes, last printed value: 4278190080 = 2**32 - 2**24
class C:
counter = 0 # Class variable
while True:
C.counter += 1 # Increment class variable
if C.counter & 0b111111111111111111111111 == 0:
print(C.counter)
(In the original application, the class was a wrapper class implementing __lt__
to count the number of comparisons performed by various algorithms)
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Output from running 'python -VV' on the command line:
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]