mirror of
https://github.com/python/cpython.git
synced 2025-09-02 23:18:25 +00:00
bpo-32381: Add _PyRun_AnyFileObject() (GH-23723)
pymain_run_file() no longer encodes the filename: pass the filename as an object to the new _PyRun_AnyFileObject() function. Add new private functions: * _PyRun_AnyFileObject() * _PyRun_InteractiveLoopObject() * _Py_FdIsInteractive()
This commit is contained in:
parent
ca06440207
commit
a82f63f5af
5 changed files with 106 additions and 53 deletions
|
@ -2739,6 +2739,21 @@ Py_FdIsInteractive(FILE *fp, const char *filename)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
_Py_FdIsInteractive(FILE *fp, PyObject *filename)
|
||||
{
|
||||
if (isatty((int)fileno(fp))) {
|
||||
return 1;
|
||||
}
|
||||
if (!Py_InteractiveFlag) {
|
||||
return 0;
|
||||
}
|
||||
return (filename == NULL) ||
|
||||
(PyUnicode_CompareWithASCIIString(filename, "<stdin>") == 0) ||
|
||||
(PyUnicode_CompareWithASCIIString(filename, "???") == 0);
|
||||
}
|
||||
|
||||
|
||||
/* Wrappers around sigaction() or signal(). */
|
||||
|
||||
PyOS_sighandler_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue