Skip to content

Commit 20b7c79

Browse files
authored
gh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)
Add note about PY_SSIZE_T_CLEAN in extending and embedding document.
1 parent 5950e7d commit 20b7c79

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Doc/extending/embedding.rst

+7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ perform some operation on a file. ::
8787
Py_ExitStatusException(status);
8888
}
8989

90+
.. note::
91+
92+
``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be
93+
used in some APIs instead of ``int``.
94+
It is not necessary since Python 3.13, but we keep it here for backward compatibility.
95+
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
96+
9097
Setting :c:member:`PyConfig.program_name` should be called before
9198
:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time
9299
libraries. Next, the Python interpreter is initialized with

Doc/extending/extending.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ the module and a copyright notice if you like).
6969
headers on some systems, you *must* include :file:`Python.h` before any standard
7070
headers are included.
7171

72-
It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including
73-
``Python.h``. See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
72+
``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be
73+
used in some APIs instead of ``int``.
74+
It is not necessary since Python 3.13, but we keep it here for backward compatibility.
75+
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
7476

7577
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
7678
``PY``, except those defined in standard header files. For convenience, and

0 commit comments

Comments
 (0)