mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20517: Functions in the os module that accept two filenames
now register both filenames in the exception on failure. This required adding new C API functions allowing OSError exceptions to reference two filenames instead of one.
This commit is contained in:
parent
dc62b7e261
commit
b082731fbb
10 changed files with 380 additions and 73 deletions
|
@ -241,6 +241,15 @@ in various ways. There is a separate error indicator for each thread.
|
|||
exception instance.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromErrnoWithFilenameObjects(PyObject *type, PyObject *filenameObject, PyObject *filenameObject2)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a second
|
||||
filename object, for raising errors when a function that takes two filenames
|
||||
fails.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromErrnoWithFilename(PyObject *type, const char *filename)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename
|
||||
|
@ -248,6 +257,14 @@ in various ways. There is a separate error indicator for each thread.
|
|||
(:func:`os.fsdecode`).
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromErrnoWithFilenames(PyObject *type, const char *filename, const char *filename2)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromErrnoWithFilename`, but accepts a
|
||||
second filename.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
|
||||
|
||||
This is a convenience function to raise :exc:`WindowsError`. If called with
|
||||
|
@ -266,13 +283,6 @@ in various ways. There is a separate error indicator for each thread.
|
|||
specifying the exception type to be raised. Availability: Windows.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilenameObject(int ierr, PyObject *filenameObject)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior
|
||||
that if *filenameObject* is not *NULL*, it is passed to the constructor of
|
||||
:exc:`WindowsError` as a third parameter. Availability: Windows.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, but the
|
||||
|
@ -280,6 +290,14 @@ in various ways. There is a separate error indicator for each thread.
|
|||
encoding (:func:`os.fsdecode`). Availability: Windows.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilenames(int ierr, const char *filename, const char *filename2)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, but accepts
|
||||
a second filename. Availability: Windows.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenameObject(PyObject *type, int ierr, PyObject *filename)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, with an
|
||||
|
@ -287,12 +305,30 @@ in various ways. There is a separate error indicator for each thread.
|
|||
Availability: Windows.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenameObjects(PyObject *type, int ierr, PyObject *filename, PyObject *filename2)
|
||||
|
||||
Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`,
|
||||
but accepts a second filename object.
|
||||
Availability: Windows.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, const char *filename)
|
||||
|
||||
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional
|
||||
parameter specifying the exception type to be raised. Availability: Windows.
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenames(PyObject *type, int ierr, const char *filename, const char *filename2)
|
||||
|
||||
Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilename`,
|
||||
but accepts a second filename object.
|
||||
Availability: Windows.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)
|
||||
|
||||
This is a convenience function to raise :exc:`ImportError`. *msg* will be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue