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 ajaksu2
Recipients ajaksu2, dingo, giampaolo.rodola, jyasskin, loewis, mark.dickinson, rhettinger
Date 2008-12-21.13:47:35
SpamBayes Score 1.1657e-06
Marked as misclassified No
Message-id <>
Hi Mark,
I think there's an overflow for ndigits that predates your patch:
>>> round(2, -2**31 +1)
>>> round(2, -2**31 +2)
(it looks like these lines above make 2.6 hang :/)

Now, I'm getting a segfault in 3.0 when Ctrl + C-ing during a long
running round:

Python 3.1a0 (py3k:67893M, Dec 21 2008, 10:38:30)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> round(2, -2**31 + 1)
>>> round(2, -2**31 + 2) # Press Ctrl + C
Segmentation fault
(backtrace below)

Also, maybe "round(2, -2**31 + 2)" taking long is a bug of its own?

The crash with backtrace:
Starting program: /home/ajaksu/py3k/python
[Thread debugging using libthread_db enabled]
Python 3.1a0 (py3k:67893M, Dec 21 2008, 11:08:29)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[New Thread 0xb7d2e8c0 (LWP 14925)]
>>> round(2, -2**31 + 1)
>>> round(2, -2**31 + 2) # Press Ctrl + C

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d2e8c0 (LWP 14925)]
_PyUnicode_New (length=10) at Objects/unicodeobject.c:359
359         unicode->str[0] = 0;
(gdb) bt
#0  _PyUnicode_New (length=10) at Objects/unicodeobject.c:359
#1  0x080708a5 in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x813d8dc
"last_value", size=10, errors=0x0, consumed=0x0)
    at Objects/unicodeobject.c:2022
#2  0x08072e22 in PyUnicodeUCS2_FromStringAndSize (u=0x813d8dc
"last_value", size=10) at Objects/unicodeobject.c:2000
#3  0x08072f82 in PyUnicodeUCS2_FromString (u=0x813d8dc "last_value") at
#4  0x0810ddf7 in PyDict_SetItemString (v=0xb7b21714, key=0x813d8dc
"last_value", item=0xb7a4e43c)
    at Objects/dictobject.c:2088
#5  0x080b5fb1 in PySys_SetObject (name=0x813d8dc "last_value", v=0xa)
at Python/sysmodule.c:67
#6  0x080afedb in PyErr_PrintEx (set_sys_last_vars=1) at
#7  0x080b063c in PyRun_InteractiveOneFlags (fp=0xb7e7a440,
filename=0x813f509 "<stdin>", flags=0xbf84bd34)
    at Python/pythonrun.c:1189
#8  0x080b0816 in PyRun_InteractiveLoopFlags (fp=0xb7e7a440,
filename=0x813f509 "<stdin>", flags=0xbf84bd34)
    at Python/pythonrun.c:909
#9  0x080b0fa2 in PyRun_AnyFileExFlags (fp=0xb7e7a440,
filename=0x813f509 "<stdin>", closeit=0, flags=0xbf84bd34)
    at Python/pythonrun.c:878
#10 0x080bc49a in Py_Main (argc=0, argv=0x8192008) at Modules/main.c:611
#11 0x0805a1dc in main (argc=1, argv=0xbf84de24) at ./Modules/python.c:70

I hope this helps :)
Date User Action Args
2008-12-21 13:47:37ajaksu2setrecipients: + ajaksu2, loewis, rhettinger, mark.dickinson, giampaolo.rodola, jyasskin, dingo
2008-12-21 13:47:37ajaksu2setmessageid: <>
2008-12-21 13:47:36ajaksu2linkissue4707 messages
2008-12-21 13:47:35ajaksu2create