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