https://github.com/python/cpython/commit/f082a05c67cc949ccd1a940ecf6721953bbdc34f
commit: f082a05c67cc949ccd1a940ecf6721953bbdc34f
branch: main
author: Sergii K <[email protected]>
committer: gpshead <[email protected]>
date: 2024-02-25T12:45:38-08:00
summary:
gh-115914: minor cleanup: simplify filename_obj assignment in
PyRun_AnyFileExFlags (gh-115916)
This simplifies the code: less lines, easier to read. Logically equivalent, as
any compiler likely already determined.
files:
M Python/pythonrun.c
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 5f305aa00e08b9..f87c53fb28fbea 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -89,7 +89,7 @@ int
PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit,
PyCompilerFlags *flags)
{
- PyObject *filename_obj;
+ PyObject *filename_obj = NULL;
if (filename != NULL) {
filename_obj = PyUnicode_DecodeFSDefault(filename);
if (filename_obj == NULL) {
@@ -97,9 +97,6 @@ PyRun_AnyFileExFlags(FILE *fp, const char *filename, int
closeit,
return -1;
}
}
- else {
- filename_obj = NULL;
- }
int res = _PyRun_AnyFileObject(fp, filename_obj, closeit, flags);
Py_XDECREF(filename_obj);
return res;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]