[3.12] gh-105979: Fix exception handling in unmarshal_frozen_code (Python/import.c) (GH-105980) (#106055)

gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980)
(cherry picked from commit cd5280367a)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-06-26 01:31:01 -07:00 committed by GitHub
parent e9366df3ec
commit b786fe8a09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -2053,6 +2053,7 @@ unmarshal_frozen_code(PyInterpreterState *interp, struct frozen_info *info)
PyObject *co = PyMarshal_ReadObjectFromString(info->data, info->size);
if (co == NULL) {
/* Does not contain executable code. */
PyErr_Clear();
set_frozen_error(FROZEN_INVALID, info->nameobj);
return NULL;
}