Skip to content

Commit 621e29a

Browse files
committed
Document PyUnstable_WritePerfMapEntry signature change in 3.15
The code_size widening from unsigned int to size_t is an LP64 ABI break; add a whatsnew Porting note, a versionchanged directive, and mention it in the NEWS entry so extension authors know to recompile.
1 parent 77777a6 commit 621e29a

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

Doc/c-api/perfmaps.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ Note that holding an :term:`attached thread state` is not required for these API
4343
the perf map file is not already opened. Returns ``0`` on success, or the
4444
same error codes as :c:func:`PyUnstable_PerfMapState_Init` on failure.
4545
46+
.. versionchanged:: 3.15
47+
48+
The *code_size* parameter was widened from ``unsigned int`` to
49+
:c:type:`size_t`. On LP64 platforms this is an ABI-incompatible
50+
change; see the :ref:`porting notes <whatsnew315-c-api-porting>`.
51+
4652
.. c:function:: void PyUnstable_PerfMapState_Fini(void)
4753
4854
Close the perf map file opened by :c:func:`PyUnstable_PerfMapState_Init`.

Doc/whatsnew/3.15.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,14 @@ Changed C APIs
17671767
for ``NULL`` should be updated to call :c:macro:`PyDateTime_IMPORT` instead.
17681768
(Contributed by Kumar Aditya in :gh:`141563`.)
17691769

1770+
* The *code_size* parameter of :c:func:`PyUnstable_WritePerfMapEntry` was
1771+
widened from ``unsigned int`` to :c:type:`size_t` to support JIT code
1772+
regions larger than 4 GiB. On LP64 platforms this widens the
1773+
argument slot from 32 to 64 bits; see the Porting section below.
1774+
(Contributed by Diego Russo in :gh:`126910`.)
1775+
1776+
.. _whatsnew315-c-api-porting:
1777+
17701778
Porting to Python 3.15
17711779
----------------------
17721780

@@ -1775,6 +1783,16 @@ Porting to Python 3.15
17751783
The |pythoncapi_compat_project| can be used to get most of these new
17761784
functions on Python 3.14 and older.
17771785

1786+
* The signature of :c:func:`PyUnstable_WritePerfMapEntry` changed in an
1787+
ABI-incompatible way: the *code_size* parameter is now :c:type:`size_t`
1788+
instead of ``unsigned int``. On LP64 platforms (Linux x86_64, AArch64,
1789+
etc.) this widens the argument from 32 to 64 bits. Extensions that call
1790+
this function must be recompiled against CPython 3.15 headers; mixing a
1791+
3.14-compiled caller with the 3.15 runtime will pass garbage in the
1792+
upper 32 bits of *code_size*. As the ``PyUnstable_`` prefix indicates,
1793+
this API has no backward-compatibility guarantee across feature
1794+
releases. (Contributed by Diego Russo in :gh:`126910`.)
1795+
17781796

17791797
Removed C APIs
17801798
--------------
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
Add support for unwinding JIT frames using GDB. Patch by Diego Russo
1+
Add support for unwinding JIT frames using GDB. As part of this change, the
2+
*code_size* parameter of :c:func:`PyUnstable_WritePerfMapEntry` was widened
3+
from ``unsigned int`` to :c:type:`size_t`; this is an ABI-incompatible
4+
change on LP64 platforms and requires extensions that use that function to
5+
be recompiled against CPython 3.15 headers. Patch by Diego Russo.

0 commit comments

Comments
 (0)