summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/import.c
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-02-07 19:56:35 +0300
committershadchin <[email protected]>2026-02-07 20:23:53 +0300
commit19d43a3e6fb4cb8ea11747d7d7bca7a3542fbb44 (patch)
tree0b1418938140a0b6470953bef6069454ffdf1bd0 /contrib/tools/python3/Python/import.c
parent0879409bfc0891ab8103828a3bdbf0e960475fec (diff)
Update Python 3 to 3.13.12
commit_hash:71d3efea437a769b2b7910d196120bb02587046e
Diffstat (limited to 'contrib/tools/python3/Python/import.c')
-rw-r--r--contrib/tools/python3/Python/import.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/contrib/tools/python3/Python/import.c b/contrib/tools/python3/Python/import.c
index 32a25e4478c..03a49ea0599 100644
--- a/contrib/tools/python3/Python/import.c
+++ b/contrib/tools/python3/Python/import.c
@@ -4678,6 +4678,7 @@ static PyObject *
_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file)
/*[clinic end generated code: output=83249b827a4fde77 input=c31b954f4cf4e09d]*/
{
+ FILE *fp = NULL;
PyObject *mod = NULL;
PyThreadState *tstate = _PyThreadState_GET();
@@ -4720,16 +4721,12 @@ _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file)
/* We would move this (and the fclose() below) into
* _PyImport_GetModInitFunc(), but it isn't clear if the intervening
* code relies on fp still being open. */
- FILE *fp;
if (file != NULL) {
fp = _Py_fopen_obj(info.filename, "r");
if (fp == NULL) {
goto finally;
}
}
- else {
- fp = NULL;
- }
PyModInitFunction p0 = _PyImport_GetModInitFunc(&info, fp);
if (p0 == NULL) {
@@ -4753,12 +4750,10 @@ _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file)
}
#endif
- // XXX Shouldn't this happen in the error cases too (i.e. in "finally")?
- if (fp) {
+finally:
+ if (fp != NULL) {
fclose(fp);
}
-
-finally:
_Py_ext_module_loader_info_clear(&info);
return mod;
}