[Python-checkins] [3.12] GH-101291: Add warning to "what's new" that `PyLongObject` internals have changed. (GH-107388) (#107392)

gvanrossum webhook-mailer at python.org
Mon Jul 31 13:16:04 EDT 2023


https://github.com/python/cpython/commit/5f7862dc1f0ba7e47fc01acb7f7a2e0f68176924
commit: 5f7862dc1f0ba7e47fc01acb7f7a2e0f68176924
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2023-07-31T10:16:00-07:00
summary:

[3.12] GH-101291: Add warning to "what's new" that `PyLongObject` internals have changed. (GH-107388) (#107392)

(cherry picked from commit 1ee605c5888fbc3d51b3e7610bac38ea6bc25e31)

Co-authored-by: Mark Shannon <mark at hotpy.org>

files:
M Doc/whatsnew/3.12.rst

diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 2ec25eb25ecb4..fe912e8422e9e 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -1867,6 +1867,17 @@ Porting to Python 3.12
   subinterpreter that they don't support (or haven't yet been loaded in). See
   :gh:`104668` for more info.
 
+* :c:struct:`PyLongObject` has had its internals changed for better performance.
+  Although the internals of :c:struct:`PyLongObject` are private, they are used
+  by some extension modules.
+  The internal fields should no longer be accessed directly, instead the API
+  functions beginning ``PyLong_...`` should be used instead.
+  Two new *unstable* API functions are provided for efficient access to the
+  value of :c:struct:`PyLongObject`\s which fit into a single machine word:
+
+  * :c:func:`PyUnstable_Long_IsCompact`
+  * :c:func:`PyUnstable_Long_CompactValue`
+
 Deprecated
 ----------
 



More information about the Python-checkins mailing list