Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos
Commits
02048a11
Commit
02048a11
authored
Mar 21, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python3: pdb.set_trace() did not work in multi-threading environment.
parent
340b0a67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
component/python3/buildout.cfg
component/python3/buildout.cfg
+1
-0
component/python3/pdb_ignore-ValueError-from-signal-in-non-main-thread.patch
...db_ignore-ValueError-from-signal-in-non-main-thread.patch
+88
-0
No files found.
component/python3/buildout.cfg
View file @
02048a11
...
@@ -31,6 +31,7 @@ executable = @@LOCATION@@/bin/${:_buildout_section_name_}
...
@@ -31,6 +31,7 @@ executable = @@LOCATION@@/bin/${:_buildout_section_name_}
patch-options = -p1
patch-options = -p1
patches =
patches =
${:_profile_base_location_}/default_encoding.patch#4ad9664e622d5556b4c32b1d9cb587ff
${:_profile_base_location_}/default_encoding.patch#4ad9664e622d5556b4c32b1d9cb587ff
${:_profile_base_location_}/pdb_ignore-ValueError-from-signal-in-non-main-thread.patch#29a34d7c6ef8372d4fb40b1704933349
url =
url =
https://www.python.org/ftp/python/${:package_version}/Python-${:package_version}${:package_version_suffix}.tar.xz
https://www.python.org/ftp/python/${:package_version}/Python-${:package_version}${:package_version_suffix}.tar.xz
configure-options =
configure-options =
...
...
component/python3/pdb_ignore-ValueError-from-signal-in-non-main-thread.patch
0 → 100644
View file @
02048a11
From df5702a647587b07c89ac6405dece5e91f4f2a33 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Mon, 9 Sep 2019 04:25:21 -0700
Subject: [PATCH] bpo-36250: ignore ValueError from signal in non-main thread
(GH-12251)
Authored-By: blueyed <github@thequod.de>
(cherry
picked from commit 8d64bfafdffd9f866bb6ac2e5b4c4bdfcb16aea0)
Co-authored-by: Daniel Hahler <github@thequod.de>
---
Lib/pdb.py | 8 +++--
Lib/test/test_pdb.py | 29 +++++++++++++++++++
.../2019-03-09-16-04-12.bpo-36250.tSK4N1.rst | 2 ++
3 files changed, 37 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/Library/2019-03-09-16-04-12.bpo-36250.tSK4N1.rst
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 806bc6741f..6d76f4e7f4 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -339,8 +339,12 @@
class Pdb(bdb.Bdb, cmd.Cmd):
def interaction(self, frame, traceback):
# Restore the previous signal handler at the Pdb prompt.
if Pdb._previous_sigint_handler:
- signal.signal(signal.SIGINT, Pdb._previous_sigint_handler)
- Pdb._previous_sigint_handler = None
+ try:
+ signal.signal(signal.SIGINT, Pdb._previous_sigint_handler)
+ except ValueError: # ValueError: signal only works in main thread
+ pass
+ else:
+ Pdb._previous_sigint_handler = None
if self.setup(frame, traceback):
# no interaction desired at this time (happens if .pdbrc contains
# a command like "continue")
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 63909e21f2..8eb084c0c7 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1306,6 +1306,35 @@
class PdbTestCase(unittest.TestCase):
self.assertNotIn('Error', stdout.decode(),
"Got an error running test script under PDB")
+ def test_issue36250(self):
+
+ with open(support.TESTFN, 'wb') as f:
+ f.write(textwrap.dedent("""
+ import threading
+ import pdb
+
+ evt = threading.Event()
+
+ def start_pdb():
+ evt.wait()
+ pdb.Pdb(readrc=False).set_trace()
+
+ t = threading.Thread(target=start_pdb)
+ t.start()
+ pdb.Pdb(readrc=False).set_trace()
+ evt.set()
+ t.join()""").encode('ascii'))
+ cmd = [sys.executable, '-u', support.TESTFN]
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ )
+ self.addCleanup(proc.stdout.close)
+ stdout, stderr = proc.communicate(b'cont\ncont\n')
+ self.assertNotIn('Error', stdout.decode(),
+ "Got an error running test script under PDB")
+
def test_issue16180(self):
# A syntax error in the debuggee.
script = "def f: pass\n"
diff --git a/Misc/NEWS.d/next/Library/2019-03-09-16-04-12.bpo-36250.tSK4N1.rst b/Misc/NEWS.d/next/Library/2019-03-09-16-04-12.bpo-36250.tSK4N1.rst
new file mode 100644
index 0000000000..8d9fbcbb1c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-03-09-16-04-12.bpo-36250.tSK4N1.rst
@@ -0,0 +1,2 @@
+Ignore ``ValueError`` from ``signal`` with ``interaction`` in non-main
+thread.
--
2.35.1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment