mirror of https://github.com/python/cpython
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:
parent
84a275c4a2
commit
f082a05c67
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue