Github messages for voidlinux
 help / color / mirror / Atom feed
From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [ISSUE] Bug: Control-C on ipython (on extension code using cysignals) is broken
Date: Sun, 20 Feb 2022 00:44:00 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-35712@inbox.vuxu.org> (raw)

[-- 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.

             reply	other threads:[~2022-02-19 23:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-19 23:44 tornaria [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-35712@inbox.vuxu.org \
    --to=tornaria@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).