mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-77782: Py_FdIsInteractive() now uses PyConfig.interactive (#93916)
This commit is contained in:
parent
c5b750dc0b
commit
1735710873
6 changed files with 29 additions and 23 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue