@@ -786,33 +786,52 @@ Functions encoding to and decoding from the :term:`filesystem encoding and
786
786
error handler` (:pep: `383 ` and :pep: `529 `).
787
787
788
788
To encode file names to :class:`bytes` during argument parsing, the ``"O&"``
789
- converter should be used, passing :c:func:`PyUnicode_FSConverter` as the
789
+ converter should be used, passing :c:func:`! PyUnicode_FSConverter` as the
790
790
conversion function:
791
791
792
792
.. c:function:: int PyUnicode_FSConverter(PyObject* obj, void* result)
793
793
794
- ParseTuple converter: encode :class:`str` objects -- obtained directly or
794
+ :ref:`PyArg_Parse\* converter <arg-parsing>` : encode :class:`str` objects -- obtained directly or
795
795
through the :class:`os.PathLike` interface -- to :class:`bytes` using
796
796
:c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is.
797
- *result * must be a :c:expr: `PyBytesObject* ` which must be released when it is
798
- no longer used.
797
+ *result * must be an address of a C variable of type :c:expr: `PyObject* `
798
+ (or :c:expr: `PyBytesObject* `).
799
+ On success, set the variable to a new :term:`strong reference` to
800
+ a :ref:`bytes object <bytesobjects>` which must be released
801
+ when it is no longer used and return a non-zero value
802
+ (:c:macro: `Py_CLEANUP_SUPPORTED `).
803
+ Embedded null bytes are not allowed in the result.
804
+ On failure, return ``0`` with an exception set.
805
+
806
+ If *obj* is ``NULL``, the function releases a strong reference
807
+ stored in the variable referred by *result* and returns ``1``.
799
808
800
809
.. versionadded:: 3.1
801
810
802
811
.. versionchanged:: 3.6
803
812
Accepts a :term:`path-like object`.
804
813
805
814
To decode file names to :class:`str` during argument parsing, the ``"O&"``
806
- converter should be used, passing :c:func: `PyUnicode_FSDecoder ` as the
815
+ converter should be used, passing :c:func:`! PyUnicode_FSDecoder` as the
807
816
conversion function:
808
817
809
818
.. c:function:: int PyUnicode_FSDecoder(PyObject* obj, void* result)
810
819
811
- ParseTuple converter: decode :class:`bytes` objects -- obtained either
820
+ :ref:`PyArg_Parse\* converter <arg-parsing>` : decode :class:`bytes` objects -- obtained either
812
821
directly or indirectly through the :class:`os.PathLike` interface -- to
813
822
:class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str`
814
- objects are output as-is. *result * must be a :c:expr: `PyUnicodeObject* ` which
815
- must be released when it is no longer used.
823
+ objects are output as-is.
824
+ *result * must be an address of a C variable of type :c:expr: `PyObject* `
825
+ (or :c:expr: `PyUnicodeObject* `).
826
+ On success, set the variable to a new :term:`strong reference` to
827
+ a :ref:`Unicode object <unicodeobjects>` which must be released
828
+ when it is no longer used and return a non-zero value
829
+ (:c:macro: `Py_CLEANUP_SUPPORTED `).
830
+ Embedded null characters are not allowed in the result.
831
+ On failure, return ``0`` with an exception set.
832
+
833
+ If *obj* is ``NULL``, release the strong reference
834
+ to the object referred to by *result* and return ``1``.
816
835
817
836
.. versionadded:: 3.2
818
837
0 commit comments