Issue31450
Created on 2017-09-13 12:25 by msekletar, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11422 | merged | harman786, 2019-01-03 11:17 | |
| PR 11422 | merged | harman786, 2019-01-03 11:17 | |
| PR 11422 | merged | harman786, 2019-01-03 11:17 | |
| PR 11422 | merged | harman786, 2019-01-03 11:17 | |
| PR 11426 | merged | miss-islington, 2019-01-03 19:54 | |
| PR 11426 | merged | miss-islington, 2019-01-03 19:54 | |
| PR 11426 | merged | miss-islington, 2019-01-03 19:54 | |
| Messages (4) | |||
|---|---|---|---|
| msg302064 - (view) | Author: Michal Sekletar (msekletar) | Date: 2017-09-13 12:25 | |
Issue
-----
Documentation of subprocess module claims that exceptions raised in child process will be re-raised in the parent process and will have child_traceback attribute set [1]. At least on Fedora Rawhide with python-3.6.2 this is not the case.
Reproducer
----------
$ cat preexec-exception.py
#!/usr/bin/env python3
import subprocess
class PreExecCallback:
def __call__(self):
raise Exception()
if __name__ == "__main__":
p = PreExecCallback()
try:
subprocess.Popen(['/bin/echo', 'foobar'], preexec_fn=p)
except subprocess.SubprocessError as e:
if not hasattr(e, 'child_traceback'):
print('BUG: Exception happened in child, but exception object does not have child_traceback attribute')
Actual result
-------------
$ ./preexec-exception.py
BUG: Exception happened in child, but exception object does not have child_traceback attribute
Expected result
---------------
No output, because child_traceback attribute is present
Additional info
---------------
I happened to notice this while working with pre-exec callbacks. However, according to https://stackoverflow.com/questions/38433837/subprocess-child-traceback this seems to be the generic problem.
[1] https://docs.python.org/3/library/subprocess.html#exceptions
|
|||
| msg302066 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2017-09-13 12:32 | |
Documentation and implementation are out of sync. Python 3's subprocess module no longer sets child_traceback. I checked 3.3 to master. The assignment has been removed. |
|||
| msg332945 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2019-01-03 19:53 | |
New changeset 47a2fced84605a32b79aa3ebc543533ad1a976a1 by Gregory P. Smith (Harmandeep Singh) in branch 'master': bpo-31450: Remove documentation mentioning that subprocess's child_traceback is available with the parent process (GH-11422) https://github.com/python/cpython/commit/47a2fced84605a32b79aa3ebc543533ad1a976a1 |
|||
| msg332946 - (view) | Author: miss-islington (miss-islington) | Date: 2019-01-03 20:01 | |
New changeset 47c035f3efa77a439967776b5b6ba11d010ce466 by Miss Islington (bot) in branch '3.7': bpo-31450: Remove documentation mentioning that subprocess's child_traceback is available with the parent process (GH-11422) https://github.com/python/cpython/commit/47c035f3efa77a439967776b5b6ba11d010ce466 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:52 | admin | set | github: 75631 |
| 2019-01-07 15:43:57 | vstinner | set | keywords:
patch, patch, patch, patch status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-01-03 20:01:48 | miss-islington | set | nosy:
+ miss-islington messages: + msg332946 |
| 2019-01-03 19:54:27 | miss-islington | set | pull_requests: + pull_request10849 |
| 2019-01-03 19:54:21 | miss-islington | set | pull_requests: + pull_request10848 |
| 2019-01-03 19:54:15 | miss-islington | set | pull_requests: + pull_request10847 |
| 2019-01-03 19:53:58 | gregory.p.smith | set | messages: + msg332945 |
| 2019-01-03 11:17:39 | harman786 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request10839 |
| 2019-01-03 11:17:32 | harman786 | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request10838 |
| 2019-01-03 11:17:22 | harman786 | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request10837 |
| 2019-01-03 11:17:16 | harman786 | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request10836 |
| 2017-09-13 12:32:57 | christian.heimes | set | nosy:
+ gregory.p.smith, christian.heimes messages:
+ msg302066 |
| 2017-09-13 12:27:31 | cstratak | set | nosy:
+ cstratak |
| 2017-09-13 12:25:50 | msekletar | create | |
