diff options
author | Victor Stinner <vstinner@python.org> | 2020-12-09 21:37:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 21:37:27 (GMT) |
commit | a82f63f5af027a0eab0f0812d750b804368cbd25 (patch) | |
tree | aa8703c8745915d904d05ef132c1aa96fb1fd911 /Include | |
parent | ca064402079f889226cb107b26b329891431c319 (diff) | |
download | cpython-a82f63f5af027a0eab0f0812d750b804368cbd25.zip cpython-a82f63f5af027a0eab0f0812d750b804368cbd25.tar.gz cpython-a82f63f5af027a0eab0f0812d750b804368cbd25.tar.bz2 |
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()
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/pylifecycle.h | 1 | ||||
-rw-r--r-- | Include/cpython/pythonrun.h | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index f38ec5a..b4e2c8a 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -44,6 +44,7 @@ PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *); PyAPI_FUNC(void) _Py_RestoreSignals(void); PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); +PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename); PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *); diff --git a/Include/cpython/pythonrun.h b/Include/cpython/pythonrun.h index febda73..e396a67 100644 --- a/Include/cpython/pythonrun.h +++ b/Include/cpython/pythonrun.h @@ -13,6 +13,11 @@ PyAPI_FUNC(int) PyRun_AnyFileExFlags( const char *filename, /* decoded from the filesystem encoding */ int closeit, PyCompilerFlags *flags); +PyAPI_FUNC(int) _PyRun_AnyFileObject( + FILE *fp, + PyObject *filename, + int closeit, + PyCompilerFlags *flags); PyAPI_FUNC(int) PyRun_SimpleFileExFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ @@ -30,6 +35,10 @@ PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ PyCompilerFlags *flags); +PyAPI_FUNC(int) _PyRun_InteractiveLoopObject( + FILE *fp, + PyObject *filename, + PyCompilerFlags *flags); PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, |