summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-11-21 22:52:16 (GMT)
committerGitHub <noreply@github.com>2024-11-21 22:52:16 (GMT)
commit78a530a57800264433d1874a41c91b0939156c03 (patch)
tree93599658400b15d14c46d73f4ff4c58d078cd413 /Objects
parent09c240f20c47db126ad7e162df41e5c2596962d4 (diff)
downloadcpython-78a530a57800264433d1874a41c91b0939156c03.zip
cpython-78a530a57800264433d1874a41c91b0939156c03.tar.gz
cpython-78a530a57800264433d1874a41c91b0939156c03.tar.bz2
gh-115999: Add free-threaded specialization for ``TO_BOOL`` (gh-126616)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 840d004..2611404 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5645,6 +5645,24 @@ _PyType_SetFlags(PyTypeObject *self, unsigned long mask, unsigned long flags)
END_TYPE_LOCK();
}
+int
+_PyType_Validate(PyTypeObject *ty, _py_validate_type validate, unsigned int *tp_version)
+{
+ int err;
+ BEGIN_TYPE_LOCK();
+ err = validate(ty);
+ if (!err) {
+ if(assign_version_tag(_PyInterpreterState_GET(), ty)) {
+ *tp_version = ty->tp_version_tag;
+ }
+ else {
+ err = -1;
+ }
+ }
+ END_TYPE_LOCK();
+ return err;
+}
+
static void
set_flags_recursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
{