-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-131591: Implement PEP 768 #131937
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-131591: Implement PEP 768 #131937
Changes from 13 commits
6f6b4cd
9b86022
af84100
19ef7ae
444453c
1d3ad3c
eeec1f6
fd993e3
96798c3
075ca65
45e73c5
ed2f325
6076548
a9d3ea9
e235e62
d51dda0
38a4d51
a98898d
997b557
f6dec59
d273c5b
c9a2146
4af1744
5c0b8b9
c8779cd
6889042
7f7aa8b
fbecfdb
fa98f64
5b4cb00
0dd7797
b8a0503
9344d1d
9368d38
166f4d6
d253966
8e04fdd
0c2b275
80856d3
f01d8d3
cca28c5
727a02f
6ec528c
f7e3963
40bda7c
780561b
2ab5d70
3a5f004
6346063
b442b1c
3a4ed23
8514d6e
72d3ece
9130bb8
373d4c4
bccc8a8
90ab65f
ffd340f
247e753
3c4c41c
18c2e64
139b234
4306a73
35003a8
80fab75
0905105
8db68e3
25cc486
0557de0
6dd7530
7c340e1
9096375
6516356
e6cb8fb
8b3ffa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1965,6 +1965,7 @@ def _supports_remote_attaching(): | |
"Test only runs on Linux, Windows and MacOS") | ||
@unittest.skipIf(sys.platform == "linux" and not _supports_remote_attaching(), | ||
"Test only runs on Linux with process_vm_readv support") | ||
@test.support.cpython_only | ||
class TestRemoteExec(unittest.TestCase): | ||
def tearDown(self): | ||
test.support.reap_children() | ||
|
@@ -2152,5 +2153,31 @@ def test_remote_exec_invalid_script_path(self): | |
with self.assertRaises(OSError): | ||
sys.remote_exec(os.getpid(), "invalid_script_path") | ||
|
||
def test_remote_exec_in_process_without_debug_fails_envvar(self): | ||
"""Test remote exec in a process without remote debugging enabled""" | ||
script = os_helper.TESTFN + '_remote.py' | ||
self.addCleanup(os_helper.unlink, script) | ||
with open(script, 'w') as f: | ||
f.write('print("Remote script executed successfully!")') | ||
env = os.environ.copy() | ||
env['PYTHON_DISABLE_REMOTE_DEBUG'] = '1' | ||
|
||
_, out, err = assert_python_failure('-c', f'import os, sys; sys.remote_exec(os.getpid(), "{script}")', **env) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Random thought - should we special-case (or disallow) calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, it actually requires no work whatsoever on our part, which is very cool! And we use it all the time for testing and developing since having to attach debuggers to two or even 3 processes is much much harder. I am happy to keep it unless you feel strongly |
||
self.assertIn(b"Remote debugging is not enabled", err) | ||
self.assertEqual(out, b"") | ||
|
||
def test_remote_exec_in_process_without_debug_fails_xoption(self): | ||
"""Test remote exec in a process without remote debugging enabled""" | ||
script = os_helper.TESTFN + '_remote.py' | ||
self.addCleanup(os_helper.unlink, script) | ||
with open(script, 'w') as f: | ||
f.write('print("Remote script executed successfully!")') | ||
|
||
_, out, err = assert_python_failure('-Xdisable-remote-debug', '-c', f'import os, sys; sys.remote_exec(os.getpid(), "{script}")') | ||
self.assertIn(b"Remote debugging is not enabled", err) | ||
self.assertEqual(out, b"") | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Uh oh!
There was an error while loading. Please reload this page.