1
0
mirror of https://github.com/python/cpython synced 2024-07-08 19:20:43 +00:00

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.
This commit is contained in:
Sergii K 2024-02-25 23:45:38 +03:00 committed by GitHub
parent 84a275c4a2
commit f082a05c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;