option to not override signal handler
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece em ipykernel/kernelbase.py, em pre_handler_hook, e acompanhe como dispatch_shell o invoca. Determine como uma aplicação incorporadora poderia optar por não substituir seu handler de SIGINT e, em seguida, verifique se o handler personalizado permanece intacto enquanto o tratamento normal de sinais do kernel continua funcionando.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
See also https://github.com/jupyter/qtconsole/issues/490
Hey there,
how can I embed qtconsole into an application without it overriding my own application's custom sigint handler?
Assume you have code that does
std::signal(SIGINT, &handleSigInt);
...
// do not initialize signal handlers
const auto initsigs = 0;
Py_InitializeEx(initsigs);
Then it is embedding qtconsole eventually, but at that point the sigint handler will be unset:
Thread 1 "QiTissue" hit Breakpoint 3, __interceptor_sigaction (signum=2, act=0x7fffffff8a60, oldact=0x7fffffff8b00)
at /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc:55
55 in /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc
(gdb) bt
#0 __interceptor_sigaction(int, __sanitizer::__sanitizer_sigaction const*, __sanitizer::__sanitizer_sigaction*)
(signum=2, act=0x7fffffff8a60, oldact=0x7fffffff8b00)
at /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_signal_interceptors.inc:55
#1 0x00007fff5c055f0f in PyOS_setsig (sig=sig@entry=2, handler=handler@entry=0x7fff5c0b6fec <signal_handler>)
at Python/pylifecycle.c:2536
#2 0x00007fff5c0b849f in signal_signal_impl
(module=<optimized out>, handler=<built-in method default_int_handler of module object at remote 0x7fff51eeaa40>, signalnum=2) at ./Modules/signalmodule.c:505
#3 signal_signal (module=<optimized out>, args=<optimized out>, nargs=<optimized out>)
at ./Modules/clinic/signalmodule.c.h:141
#4 0x00007fff5bf7bbf8 in cfunction_vectorcall_FASTCALL
(func=<built-in method signal of module object at remote 0x7fff51eeaa40>, args=0x7fff58a24a88, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/methodobject.c:426
or in python terms:
(gdb) py-bt
Traceback (most recent call first):
<built-in method signal of module object at remote 0x7fff51eeaa40>
File "/usr/lib/python3.9/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
File "/home/milian/.local/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 280, in pre_handler_hook
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
File "/home/milian/.local/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 257, in dispatch_shell
self.pre_handler_hook()
the kernelbase.py code seems to reset the signal handler unconditionally to some default which is highly unexpected to me:
def pre_handler_hook(self):
"""Hook to execute before calling message handler"""
# ensure default_int_handler during handler call
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
Is there a way to prevent this from happening?
- Linguagem predominante
- Python
- Estrelas
- 734
- Forks
- 412
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 13
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ipython/ipykernel
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
ipython/ipykernel#1569 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 68/100
ipython/ipykernel#1554 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Interrupt on swallowed `KeyboardInterrupt` exceptions (`SIGINT`) when pressing twice (within 5 seconds)Talvez livre de novo @Carreau assumiu há 38 dias e não há nenhum pull request aberto. Aberta
ipython/ipykernel#1550 · 1 comentário · 1 reação · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de ipython/ipykernel
Issues semelhantes
-
camlight produces degenerate target camera and light framesTalvez já em andamento @kavyabhand assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
google-deepmind/mujoco_warp#1743 ·
Mantenedores costumam responder em até 1 dia
-
netbird: Update to 0.80.0AbertaPackage: Update Request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
getsolus/packages#10933 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[work-item] adam-adae-serious-events: pin missing-AESER filter semanticsTalvez já em andamento @muse-yamaa-bot assumiu hoje. Abertawork-item
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
[Bug]: Non-vision image fallback calls vision_analyze with an empty source for oversized inline images and tells the model the image is corruptTalvez já em andamento @liuhao1024 assumiu hoje. Abertacomp/agent P2 tool/vision type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
NousResearch/hermes-agent#132605 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
pymc-labs/pymc-marketing#3102 · 1 comentário ·
Mantenedores costumam responder em até 1 dia