Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Restore OS-level signal handler after changing it in plt.pause()#29947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
user202729 wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromuser202729:handler
Draft
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletionslib/matplotlib/backend_bases.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,7 @@
import time
import weakref
from weakref import WeakKeyDictionary
from ctypes import c_int, c_void_p, pythonapi

import numpy as np

Expand All@@ -59,6 +60,11 @@
from matplotlib._enums import JoinStyle, CapStyle


pythonapi.PyOS_getsig.restype = c_void_p
pythonapi.PyOS_getsig.argtypes = (c_int,)
pythonapi.PyOS_setsig.restype = c_void_p
pythonapi.PyOS_setsig.argtypes = (c_int, c_void_p)

_log = logging.getLogger(__name__)
_default_filetypes = {
'eps': 'Encapsulated Postscript',
Expand DownExpand Up@@ -1655,6 +1661,10 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
old_wakeup_fd = signal.set_wakeup_fd(wsock.fileno())
notifier = prepare_notifier(rsock)

# Save OS level sigint handlers
# See https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1576
sigint_os = pythonapi.PyOS_getsig(signal.SIGINT)

def save_args_and_handle_sigint(*args):
nonlocal handler_args
handler_args = args
Expand All@@ -1668,6 +1678,7 @@ def save_args_and_handle_sigint(*args):
rsock.close()
signal.set_wakeup_fd(old_wakeup_fd)
signal.signal(signal.SIGINT, old_sigint_handler)
pythonapi.PyOS_setsig(signal.SIGINT, sigint_os)
if handler_args is not None:
old_sigint_handler(*handler_args)

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp