summaryrefslogtreecommitdiffstats
path: root/Objects/boolobject.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-03-22 14:49:51 (GMT)
committerGitHub <noreply@github.com>2023-03-22 14:49:51 (GMT)
commit7559f5fda94ab568a1a910b17683ed81dc3426fb (patch)
treea050bbc075372c6246fe3386560596f2283ae8bb /Objects/boolobject.c
parent713df2c53489ce8012d0ede10b70950e6b0d8372 (diff)
downloadcpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.zip
cpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.tar.gz
cpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.tar.bz2
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts. * Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints. * Add functions to hide some internals of long object, and for setting sign and digit count. * Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
Diffstat (limited to 'Objects/boolobject.c')
-rw-r--r--Objects/boolobject.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Objects/boolobject.c b/Objects/boolobject.c
index a035f46..9d8e956 100644
--- a/Objects/boolobject.c
+++ b/Objects/boolobject.c
@@ -2,6 +2,7 @@
#include "Python.h"
#include "pycore_object.h" // _Py_FatalRefcountError()
+#include "pycore_long.h" // FALSE_TAG TRUE_TAG
#include "pycore_runtime.h" // _Py_ID()
#include <stddef.h>
@@ -198,10 +199,14 @@ PyTypeObject PyBool_Type = {
struct _longobject _Py_FalseStruct = {
PyObject_HEAD_INIT(&PyBool_Type)
- { 0, { 0 } }
+ { .lv_tag = _PyLong_FALSE_TAG,
+ { 0 }
+ }
};
struct _longobject _Py_TrueStruct = {
PyObject_HEAD_INIT(&PyBool_Type)
- { 1, { 1 } }
+ { .lv_tag = _PyLong_TRUE_TAG,
+ { 1 }
+ }
};