@@ -89,6 +89,10 @@ If you encounter :exc:`NameError`\s or pickling errors coming out of
8989:mod: `multiprocessing ` or :mod: `concurrent.futures `, see the
9090:ref: `forkserver restrictions <multiprocessing-programming-forkserver >`.
9191
92+ The interpreter avoids some reference count modifications internally when
93+ it's safe to do so. This can lead to different values returned from
94+ :func: `sys.getrefcount ` and :c:func: `Py_REFCNT ` compared to previous versions
95+ of Python. See :ref: `below <whatsnew314-refcount >` for details.
9296
9397New features
9498============
@@ -803,11 +807,16 @@ ctypes
803807 loaded by the current process.
804808 (Contributed by Brian Ward in :gh: `119349 `.)
805809
810+ * Move :func: `ctypes.POINTER ` types cache from a global internal cache
811+ (``_pointer_type_cache ``) to the :attr: `ctypes._CData.__pointer_type__ `
812+ attribute of the corresponding :mod: `ctypes ` types.
813+ This will stop the cache from growing without limits in some situations.
814+ (Contributed by Sergey Miryanov in :gh: `100926 `).
815+
806816* The :class: `ctypes.py_object ` type now supports subscription,
807817 making it a :term: `generic type `.
808818 (Contributed by Brian Schubert in :gh: `132168 `.)
809819
810-
811820datetime
812821--------
813822
@@ -1309,8 +1318,8 @@ struct
13091318------
13101319
13111320* Support the :c:expr: `float complex ` and :c:expr: `double complex ` C types in
1312- the :mod: `struct ` module (formatting characters ``'F' `` and ``'D' ``,
1313- respectively) if the compiler has C11 complex arithmetic .
1321+ the :mod: `struct ` module (formatting characters ``'F' `` and ``'D' ``
1322+ respectively).
13141323 (Contributed by Sergey B Kirpichev in :gh: `121249 `.)
13151324
13161325
@@ -1372,6 +1381,9 @@ tkinter
13721381 arguments passed by keyword.
13731382 (Contributed by Zhikang Yan in :gh: `126899 `.)
13741383
1384+ * Add ability to specify name for :class: `!tkinter.OptionMenu ` and
1385+ :class: `!tkinter.ttk.OptionMenu `.
1386+ (Contributed by Zhikang Yan in :gh: `130482 `.)
13751387
13761388turtle
13771389------
@@ -1672,6 +1684,13 @@ Deprecated
16721684 :func: `codecs.open ` is now deprecated. Use :func: `open ` instead.
16731685 (Contributed by Inada Naoki in :gh: `133036 `.)
16741686
1687+ * :mod: `ctypes `:
1688+ Calling :func: `ctypes.POINTER ` on a string is deprecated.
1689+ Use :ref: `ctypes-incomplete-types ` for self-referential structures.
1690+ Also, the internal ``ctypes._pointer_type_cache `` is deprecated.
1691+ See :func: `ctypes.POINTER ` for updated implementation details.
1692+ (Contributed by Sergey Myrianov in :gh: `100926 `.)
1693+
16751694* :mod: `functools `:
16761695 Calling the Python implementation of :func: `functools.reduce ` with *function *
16771696 or *sequence * as keyword arguments is now deprecated.
@@ -2212,6 +2231,11 @@ New features
22122231 take a C integer and produce a Python :class: `bool ` object. (Contributed by
22132232 Pablo Galindo in :issue: `45325 `.)
22142233
2234+ * Add :c:func: `PyUnstable_Object_IsUniqueReferencedTemporary ` to determine if an object
2235+ is a unique temporary object on the interpreter's operand stack. This can
2236+ be used in some cases as a replacement for checking if :c:func: `Py_REFCNT `
2237+ is ``1 `` for Python objects passed as arguments to C API functions.
2238+
22152239
22162240Limited C API changes
22172241---------------------
@@ -2246,6 +2270,17 @@ Porting to Python 3.14
22462270 a :exc: `UnicodeError ` object.
22472271 (Contributed by Bénédikt Tran in :gh: `127691 `.)
22482272
2273+ .. _whatsnew314-refcount :
2274+
2275+ * The interpreter internally avoids some reference count modifications when
2276+ loading objects onto the operands stack by :term: `borrowing <borrowed reference> `
2277+ references when possible. This can lead to smaller reference count values
2278+ compared to previous Python versions. C API extensions that checked
2279+ :c:func: `Py_REFCNT ` of ``1 `` to determine if an function argument is not
2280+ referenced by any other code should instead use
2281+ :c:func: `PyUnstable_Object_IsUniqueReferencedTemporary ` as a safer replacement.
2282+
2283+
22492284* Private functions promoted to public C APIs:
22502285
22512286 * ``_PyBytes_Join() ``: :c:func: `PyBytes_Join `.
0 commit comments