diff options
author | Sergii K <gorsing444@gmail.com> | 2024-02-25 20:45:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 20:45:38 (GMT) |
commit | f082a05c67cc949ccd1a940ecf6721953bbdc34f (patch) | |
tree | 3b2c3d3d5eb4618ae4fc0e679c8a81987f2fe022 /Python | |
parent | 84a275c4a2c8a22d198c6f227d538e6b27bbb029 (diff) | |
download | cpython-f082a05c67cc949ccd1a940ecf6721953bbdc34f.zip cpython-f082a05c67cc949ccd1a940ecf6721953bbdc34f.tar.gz cpython-f082a05c67cc949ccd1a940ecf6721953bbdc34f.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 5f305aa..f87c53f 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; |