Skip to content

Commit f082a05

Browse files
authored
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.
1 parent 84a275c commit f082a05

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Python/pythonrun.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,14 @@ int
8989
PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit,
9090
PyCompilerFlags *flags)
9191
{
92-
PyObject *filename_obj;
92+
PyObject *filename_obj = NULL;
9393
if (filename != NULL) {
9494
filename_obj = PyUnicode_DecodeFSDefault(filename);
9595
if (filename_obj == NULL) {
9696
PyErr_Print();
9797
return -1;
9898
}
9999
}
100-
else {
101-
filename_obj = NULL;
102-
}
103100
int res = _PyRun_AnyFileObject(fp, filename_obj, closeit, flags);
104101
Py_XDECREF(filename_obj);
105102
return res;

0 commit comments

Comments
 (0)