]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-109521: Fix obscure cases handling in PyImport_GetImporter() (GH-109522...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 2 Oct 2023 15:22:40 +0000 (08:22 -0700)
committerGitHub <noreply@github.com>
Mon, 2 Oct 2023 15:22:40 +0000 (17:22 +0200)
commit5e6e99646e46d485e018429f6000661609e4f1b5
treedb68548fffc53b7c3fe4440e723560912238a5af
parent6a6bea3ee8bbe52e4307c4da1ed4a7b9c78cbe45
[3.12] gh-109521: Fix obscure cases handling in PyImport_GetImporter() (GH-109522) (#109777)

gh-109521: Fix obscure cases handling in PyImport_GetImporter() (GH-109522)

PyImport_GetImporter() now sets RuntimeError if it fails to get sys.path_hooks
or sys.path_importer_cache or they are not list and dict correspondingly.

Previously it could return NULL without setting error in obscure cases,
crash or raise SystemError if these attributes have wrong type.
(cherry picked from commit 62c7015e89cbdedb5218d4fedd45f971885f67a8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Misc/NEWS.d/next/C API/2023-09-17-21-47-31.gh-issue-109521.JDF6i9.rst [new file with mode: 0644]
Python/import.c