[Python-checkins] GH-99767: update PyTypeObject docs for type watchers (GH-99928)

markshannon webhook-mailer at python.org
Thu Dec 15 06:26:14 EST 2022


https://github.com/python/cpython/commit/b7e4f1d97c6e784d2dee182d2b81541ddcff5751
commit: b7e4f1d97c6e784d2dee182d2b81541ddcff5751
branch: main
author: Carl Meyer <carl at oddbird.net>
committer: markshannon <mark at hotpy.org>
date: 2022-12-15T11:26:08Z
summary:

GH-99767: update PyTypeObject docs for type watchers (GH-99928)

files:
M Doc/c-api/typeobj.rst
M Doc/includes/typestruct.h

diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 8f8869ec668a..c7b318b21853 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -147,6 +147,8 @@ Quick Reference
    +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
    | :c:member:`~PyTypeObject.tp_vectorcall`        | :c:type:`vectorcallfunc`          |                   |   |   |   |   |
    +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
+   | :c:member:`~PyTypeObject.tp_watched`           | char                              |                   |   |   |   |   |
+   +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
 
 .. [#slots]
 
@@ -2090,6 +2092,13 @@ and :c:type:`PyType_Type` effectively act as defaults.)
    .. versionadded:: 3.9 (the field exists since 3.8 but it's only used since 3.9)
 
 
+.. c:member:: char PyTypeObject.tp_watched
+
+   Internal. Do not use.
+
+   .. versionadded:: 3.12
+
+
 .. _static-types:
 
 Static Types
diff --git a/Doc/includes/typestruct.h b/Doc/includes/typestruct.h
index 02f8ccfe4438..f0ad1e47cb0d 100644
--- a/Doc/includes/typestruct.h
+++ b/Doc/includes/typestruct.h
@@ -80,4 +80,7 @@ typedef struct _typeobject {
 
     destructor tp_finalize;
     vectorcallfunc tp_vectorcall;
+
+    /* bitset of which type-watchers care about this type */
+    char tp_watched;
 } PyTypeObject;



More information about the Python-checkins mailing list