mirror of
https://github.com/python/cpython.git
synced 2026-01-18 13:19:59 +00:00
[3.13] gh-106287: Do not write objects after an unmarshalling error (GH-132715) (GH-143833)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
(cherry picked from commit ce8f5f98c6)
Co-authored-by: Duane Griffin <duaneg@dghda.com>
This commit is contained in:
parent
5f7a49a77b
commit
8c6d87693b
3 changed files with 25 additions and 0 deletions
|
|
@ -362,6 +362,10 @@ w_object(PyObject *v, WFILE *p)
|
|||
{
|
||||
char flag = '\0';
|
||||
|
||||
if (p->error != WFERR_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
p->depth++;
|
||||
|
||||
if (p->depth > MAX_MARSHAL_STACK_DEPTH) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue