summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonmain.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pythonmain.c b/Python/pythonmain.c
index 4344cde..1c64692 100644
--- a/Python/pythonmain.c
+++ b/Python/pythonmain.c
@@ -105,6 +105,16 @@ main(argc, argv)
sts = run_command(command) != 0;
}
else {
+ if (filename == NULL && isatty((int)fileno(fp))) {
+ char *startup = getenv("PYTHONSTARTUP");
+ if (startup != NULL && startup[0] != '\0') {
+ FILE *fp = fopen(startup, "r");
+ if (fp != NULL) {
+ (void) run_script(fp, startup);
+ err_clear();
+ }
+ }
+ }
sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
}