[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-09-19 Thread George Slavin
George Slavin added the comment: I've attached the test for this patch (I couldn't figure out how to upload two files with one comment). -- Added file: http://bugs.python.org/file44747/test_sig_int_builtins.py ___ Python tracker <

[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-09-19 Thread George Slavin
George Slavin added the comment: I have a patch that checks for KeyboardInterrupt during builtin operations. This allows sum, max, min, list, dict, set, and tuple calls to be interrupted when they are working on infinite iterators. I've attached the patch, and a test I wrote to show that you

[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin
George Slavin added the comment: The docs say the sleep call will end if a signal is caught, so once the main thread wakes, it won't go back to sleep. On Sep 6, 2016 12:35 AM, "Andre Merzky" <rep...@bugs.python.org> wrote: > > Andre Merzky added the comment: >

[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin
George Slavin added the comment: In case anyone else sees this thread, here's my trimmed down script to repro the issue: #!/usr/bin/env python2 import threading as mt import signal import time import os def sigusr2_handler(signum, frame): raise RuntimeError('caught sigusr2

[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin
George Slavin added the comment: Thanks for the reply! I've managed to reproduce the issue without using ctypes, so we can exclude ctypes as the cause of the problem :) The bug only occurs for me after hundreds of iterations of the script, so it is very intermittent. >From my resu

[issue27889] ctypes interfers with signal handling

2016-09-05 Thread George Slavin
George Slavin added the comment: I can reproduce this issue with Python 2.7.12 and Python 3.5.2 on a Arch linux VM using the python script provided, but I think this is an error in the code. The repro is tied to the time.sleep call in the try block. If I do time.sleep(1), I can reproduce