Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] Bug: Control-C on ipython (on extension code using cysignals) is broken
@ 2022-02-19 23:44 tornaria
  2022-02-21 12:10 ` tornaria
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tornaria @ 2022-02-19 23:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2866 bytes --]

New issue by tornaria on void-packages repository

https://github.com/void-linux/void-packages/issues/35712

Description:
Correct behaviour (using python):
```
$ python
Python 3.10.2 (main, Jan 15 2022, 03:11:32) [GCC 10.2.1 20201203] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cypari2.pari_instance import Pari
>>> a = Pari()(54853908712446157179434453567343931596301333824416758692208077566613224454501131209)
>>> a.factor() # takes ~ 1/2 hour
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cypari2/gen.pyx", line 4361, in cypari2.gen.Gen.factor
KeyboardInterrupt
>>> 
```
After running `a.factor()` I hit control-C (the statement takes ~ half hour to finish). Since this is running extension code (pari C library) python is not catching signals; that's why cypari uses cysignals which is supposed to catch the signal and raise the `KeyboardInterrupt`.

But when running the same code using ipython nothing happens:
```
$ ipython
Python 3.10.2 (main, Jan 15 2022, 03:11:32) [GCC 10.2.1 20201203]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from cypari2.pari_instance import Pari

In [2]: a = Pari()(54853908712446157179434453567343931596301333824416758692208077566613224454501131209)

In [3]: a.factor() # takes 1/2 hour
^C^C^C^C^C
```

This bug affects our sagemath which is using our system packages for ipython, cypari2, cysignals, etc. When using the vendored version of these packages in sagemath, this works ok:
```
$ ./sage -ipython
Python 3.10.2 (main, Jan 15 2022, 03:11:32) [GCC 10.2.1 20201203]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from cypari2.pari_instance import Pari

In [2]: a = Pari()(54853908712446157179434453567343931596301333824416758692208077566613224454501131209)

In [3]: a.factor()
^C---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-af0555404bb2> in <module>
----> 1 a.factor()

cypari2/gen.pyx in cypari2.gen.Gen.factor()

KeyboardInterrupt: 

In [4]: 
```
It's possible that there's something about our packages that is breaking signal handling.

For the record, the package versions are:
 - ipython: 7.31.0 in void, 7.29.0 in sagemath
 - cypari2: 2.1.2 in void, 2.1.2 in sagemath
 - cysignals: 1.11.2 in void, 1.10.3 in sagemath

Downgrading system ipython to 7.29.0 (which I happen to have in my cache) doesn't fix the issue. I will try to build cysignals-1.10.3 as a void package (since 1.11.2 is the first version to be shipped in void) and see if that changes anything.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-28  2:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19 23:44 [ISSUE] Bug: Control-C on ipython (on extension code using cysignals) is broken tornaria
2022-02-21 12:10 ` tornaria
2022-02-21 12:20 ` tornaria
2022-02-21 12:26 ` tornaria
2022-02-21 13:34 ` tornaria
2022-02-28  2:25 ` [ISSUE] [CLOSED] " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).