pymain_run_file_obj attempts to skip the source first line before verifying that the file is not a directory.
|
|
|
if (skip_source_first_line) { |
|
int ch; |
|
/* Push back first newline so line numbers remain the same */ |
|
while ((ch = getc(fp)) != EOF) { |
|
if (ch == '\n') { |
|
(void)ungetc(ch, fp); |
|
break; |
|
} |
|
} |
|
} |
|
|
|
struct _Py_stat_struct sb; |
|
if (_Py_fstat_noraise(fileno(fp), &sb) == 0 && S_ISDIR(sb.st_mode)) { |
|
PySys_FormatStderr("%S: %R is a directory, cannot continue\n", |
|
program_name, filename); |
|
fclose(fp); |
|
return 1; |
|
} |
|
|
Linked PRs
pymain_run_file_objattempts to skip the source first line before verifying that the file is not a directory.cpython/Modules/main.c
Lines 382 to 401 in 4eab90f
Linked PRs