Embedding: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
When using PEP 578 and 551 entry points to log python activity on Fedora-41, it results in above error.
setting TERM=dumb is a valid workaround
build ok (tested on Fedora 41/python 3.13.2)
usage nok (TypeError, see readme.md)
$ ./spython
Python 3.13.2 (main, Feb 4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello")
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib64/python3.13/_pyrepl/__main__.py", line 6, in <module>
__pyrepl_interactive_console()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/main.py", line 59, in interactive_console
run_multiline_interactive_console(console)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib64/python3.13/_pyrepl/simple_interact.py", line 143, in run_multiline_interactive_console
statement = multiline_input(more_lines, ps1, ps2)
File "/usr/lib64/python3.13/_pyrepl/readline.py", line 389, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/reader.py", line 806, in readline
self.restore()
~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/reader.py", line 659, in restore
self.console.restore()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/unix_console.py", line 380, in restore
signal.signal(signal.SIGWINCH, self.old_sigwinch)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.13/signal.py", line 58, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Follow-up of
https://github.com/juju4/spython/tree/devel-journald/journald (code)
https://github.com/zooba/spython/issues/13
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the ./spython session on Fedora 41 with Python 3.13.2, comparing normal operation with TERM=dumb. Read the traceback paths in _pyrepl/unix_console.py and signal.py, focusing on restore() and the SIGWINCH handler. Done means the embedded interactive console works without the TERM workaround and the behavior is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100