diff options
author | Victor Stinner <vstinner@python.org> | 2022-06-17 13:19:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 13:19:28 (GMT) |
commit | 17357108732c731d6ed4f2bd123ee6ba1ff6891b (patch) | |
tree | 397113da596c3a246d6022324123933d613316ba /Python/pylifecycle.c | |
parent | c5b750dc0b4d4e58047c9d93c635fa26b06562f7 (diff) | |
download | cpython-17357108732c731d6ed4f2bd123ee6ba1ff6891b.zip cpython-17357108732c731d6ed4f2bd123ee6ba1ff6891b.tar.gz cpython-17357108732c731d6ed4f2bd123ee6ba1ff6891b.tar.bz2 |
gh-77782: Py_FdIsInteractive() now uses PyConfig.interactive (#93916)
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 0937cce..c2c9e90 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2938,28 +2938,30 @@ Py_Exit(int sts) int Py_FdIsInteractive(FILE *fp, const char *filename) { - if (isatty((int)fileno(fp))) + if (isatty(fileno(fp))) { return 1; - if (!Py_InteractiveFlag) + } + if (!_Py_GetConfig()->interactive) { return 0; - return (filename == NULL) || - (strcmp(filename, "<stdin>") == 0) || - (strcmp(filename, "???") == 0); + } + return ((filename == NULL) + || (strcmp(filename, "<stdin>") == 0) + || (strcmp(filename, "???") == 0)); } int _Py_FdIsInteractive(FILE *fp, PyObject *filename) { - if (isatty((int)fileno(fp))) { + if (isatty(fileno(fp))) { return 1; } - if (!Py_InteractiveFlag) { + if (!_Py_GetConfig()->interactive) { return 0; } - return (filename == NULL) || - (PyUnicode_CompareWithASCIIString(filename, "<stdin>") == 0) || - (PyUnicode_CompareWithASCIIString(filename, "???") == 0); + return ((filename == NULL) + || (PyUnicode_CompareWithASCIIString(filename, "<stdin>") == 0) + || (PyUnicode_CompareWithASCIIString(filename, "???") == 0)); } |