Skip to content

Embedded use vs. signal handlers #93411

Open
@smurfix

Description

@smurfix

Enhancement

C signal handlers should be restore-able. Ideally you also want to call them from Python.

signal.signal(signal.SIGINT, signal.getsignal(signal.SIGINT))

This (ostensibly no-op) code raises TypeError when you use it in an embedded Python interpreter and a signal handler has been installed by the C (or whatever) side.

It shouldn't. My Python code wants to be able to restore the signal handler to its previous state when it's done.

Ideally my code should also be able to wrap that C handler, i.e. the result of getsignal() should be a callable from Python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesstdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions