- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue27015
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016-05-13 16:59 by Taywee, last changed 2022-04-11 14:58 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11580 | open | remi.lapeyre, 2019-01-16 14:17 | |
| Messages (4) | |||
|---|---|---|---|
| msg265482 - (view) | Author: Taywee (Taywee) | Date: 2016-05-13 16:59 | |
When using kwargs to construct a CalledProcessError, the repr doesn't show those args, and using kwargs also breaks pickling: >>> import pickle; from subprocess import CalledProcessError >>> CalledProcessError(2, 'foo') CalledProcessError(2, 'foo') >>> CalledProcessError(2, 'foo').returncode 2 >>> CalledProcessError(2, 'foo').cmd 'foo' >>> CalledProcessError(returncode=2, cmd='foo') CalledProcessError() >>> CalledProcessError(returncode=2, cmd='foo').returncode 2 >>> CalledProcessError(returncode=2, cmd='foo').cmd 'foo' >>> pickle.loads(pickle.dumps(CalledProcessError(2, 'foo'))) CalledProcessError(2, 'foo') >>> pickle.loads(pickle.dumps(CalledProcessError(returncode=2, cmd='foo'))) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() missing 2 required positional arguments: 'returncode' and 'cmd' >>> |
|||
| msg265486 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2016-05-13 19:37 | |
This is a problem not only with CalledProcessError, but with all custom exceptions with overridden __init__. BaseException.__new__ saves positional arguments as the "args" attribute, but ignores keyword arguments. repr() and pickle use "args". |
|||
| msg333769 - (view) | Author: Rémi Lapeyre (remi.lapeyre) * | Date: 2019-01-16 14:19 | |
I tried to fix the issue, the attached PR solves the issue of saving the kwargs and unpickling the exception but I was not able to fix a regression I caused in test_memory_error_in_PyErr_PrintEx. |
|||
| msg334626 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2019-01-31 13:33 | |
Reviewing Rémi's page made me realise that a big part of the root cause here is pickle support in exceptions predating the introduction of `__getnewargs__` and `__getnewargs_ex__`. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:31 | admin | set | github: 71202 |
| 2022-01-06 13:25:55 | iritkatriel | set | keywords:
patch, patch, patch title: subprocess.CalledProcessError's repr changes based on kwargs, and doesn't unpickle -> pickling and repr of exceptions with kwargs versions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 |
| 2022-01-06 13:22:02 | iritkatriel | link | issue37489 superseder |
| 2019-01-31 13:33:08 | ncoghlan | set | keywords:
patch, patch, patch nosy: + ncoghlan messages: + msg334626 |
| 2019-01-31 11:30:22 | ncoghlan | set | pull_requests: - pull_request11261 |
| 2019-01-31 11:30:08 | ncoghlan | set | pull_requests: - pull_request11260 |
| 2019-01-16 14:19:09 | remi.lapeyre | set | messages:
+ msg333769 versions: + Python 3.6, Python 3.7, Python 3.8 |
| 2019-01-16 14:17:14 | remi.lapeyre | set | keywords:
+ patch stage: patch review pull_requests: + pull_request11262 |
| 2019-01-16 14:17:05 | remi.lapeyre | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request11261 |
| 2019-01-16 14:16:55 | remi.lapeyre | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request11260 |
| 2019-01-11 16:20:11 | remi.lapeyre | set | nosy:
+ remi.lapeyre |
| 2016-05-13 19:37:28 | serhiy.storchaka | set | nosy:
+ gregory.p.smith, serhiy.storchaka, astrand messages: + msg265486 |
| 2016-05-13 16:59:09 | Taywee | create | |


