[Python-Dev] SIGCHECK() in longobject.c

Antoine Pitrou solipsis at pitrou.net
Sun Oct 18 22:01:54 CEST 2009


Hello,

In Objects/longobject.c, there's the SIGCHECK() macro which periodically checks
for signals when doing long integer computations (divisions, multiplications).
It does so by messing with the _Py_Ticker variable.

It was added in 1991 under the title "Many small changes", and I suppose it was
useful back then.

However, nowadays long objects are ridiculously fast, witness for example:

$ ./py3k/python -m timeit -s "a=eval('3'*10000+'5');b=eval('8'*6000+'7')"
"str(a//b)"
1000 loops, best of 3: 1.47 msec per loop

Can we remove this check, or are there people doing million-digits calculations
they want to interrupt using Control-C ?

Regards

Antoine.




More information about the Python-Dev mailing list