Skip to content
Draft
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
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Include/boolobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ extern "C" {

// PyBool_Type is declared by object.h

#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 16)
PyAPI_FUNC(int) PyBool_Check(PyObject *x);
#endif
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < _Py_PACK_VERSION(3, 16)
# define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
#else
# define PyBool_Check(x) PyBool_Check(_PyObject_CAST(x))
#endif

/* Py_False and Py_True are the only two bools in existence. */

Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_stable_abi_ctypes.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In the Limited C API 3.16 and newer, :c:func:`PyBool_Check` is now available
as a function instead of a macro.
3 changes: 3 additions & 0 deletions Misc/stable_abi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2831,3 +2831,6 @@

[function.PyObject_CallFinalizerFromDealloc]
added = '3.15'

[function.PyBool_Check]
added = '3.16'
5 changes: 5 additions & 0 deletions Objects/boolobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,8 @@ struct _longobject _Py_TrueStruct = {
{ 1 }
}
};

// Implementations for the Stable ABI

#undef PyBool_Check
int PyBool_Check(PyObject *x) { return Py_IS_TYPE(x, &PyBool_Type); }
1 change: 1 addition & 0 deletions PC/python3dll.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading