gh-106287: Do not write objects after an unmarshalling error (GH-132715)

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.
This commit is contained in:
Duane Griffin 2026-01-15 00:25:46 +13:00 committed by GitHub
parent 94dbce1397
commit ce8f5f98c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -432,6 +432,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) {