Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ Python 3.14

Not available on PyPy. ``Py_REFCNT()`` semantics is different on PyPy.

Not available on the limited C API.

.. c:function:: void PyUnstable_EnableTryIncRef(PyObject *op)

See `PyUnstable_EnableTryIncRef() documentation <https://docs.python.org/dev/c-api/object.html#c.PyUnstable_EnableTryIncRef>`__.
Expand Down
4 changes: 3 additions & 1 deletion pythoncapi_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,9 @@ static inline int PyUnstable_Object_IsUniquelyReferenced(PyObject *obj)
// gh-128926 added PyUnstable_TryIncRef() and PyUnstable_EnableTryIncRef() to
// Python 3.14. Adapted from _Py_TryIncref() and _PyObject_SetMaybeWeakref().
// Not available on PyPy: Py_REFCNT() semantics is different on PyPy.
#if PY_VERSION_HEX < _Py_PACK_VERSION(3, 14) && !defined(PYPY_VERSION)
// Not available on the limited C API.
#if (PY_VERSION_HEX < _Py_PACK_VERSION(3, 14) \
&& !defined(PYPY_VERSION) && !defined(Py_LIMITED_API))
static inline int PyUnstable_TryIncRef(PyObject *op)
{
#ifndef Py_GIL_DISABLED
Expand Down
1 change: 1 addition & 0 deletions tests/test_pythoncapi_compat_cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,7 @@ test_try_incref(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
#endif // !defined(PYPY_VERSION) && !defined(Py_LIMITED_API)


// Test PyUnstable_SetImmortal()
#if (_Py_PACK_VERSION(3, 13) <= PY_VERSION_HEX \
&& !defined(PYPY_VERSION) && !defined(Py_LIMITED_API))
static PyObject *
Expand Down
Loading