gh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)

Add note about PY_SSIZE_T_CLEAN in extending and embedding document.
This commit is contained in:
Inada Naoki 2023-07-03 00:54:35 +09:00 committed by GitHub
parent 5950e7dbfc
commit 20b7c79b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -87,6 +87,13 @@ perform some operation on a file. ::
Py_ExitStatusException(status); Py_ExitStatusException(status);
} }
.. note::
``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be
used in some APIs instead of ``int``.
It is not necessary since Python 3.13, but we keep it here for backward compatibility.
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
Setting :c:member:`PyConfig.program_name` should be called before Setting :c:member:`PyConfig.program_name` should be called before
:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time :c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time
libraries. Next, the Python interpreter is initialized with libraries. Next, the Python interpreter is initialized with

View File

@ -69,8 +69,10 @@ the module and a copyright notice if you like).
headers on some systems, you *must* include :file:`Python.h` before any standard headers on some systems, you *must* include :file:`Python.h` before any standard
headers are included. headers are included.
It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including ``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be
``Python.h``. See :ref:`arg-parsing-string-and-buffers` for a description of this macro. used in some APIs instead of ``int``.
It is not necessary since Python 3.13, but we keep it here for backward compatibility.
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
``PY``, except those defined in standard header files. For convenience, and ``PY``, except those defined in standard header files. For convenience, and