File tree 5 files changed +16
-4
lines changed
Misc/NEWS.d/next/Core and Builtins
5 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ Quick Reference
147
147
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
148
148
| :c:member: `~PyTypeObject.tp_vectorcall ` | :c:type: `vectorcallfunc ` | | | | | |
149
149
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150
- | [:c:member: `~PyTypeObject.tp_watched `] | char | | | | | |
150
+ | [:c:member: `~PyTypeObject.tp_watched `] | unsigned char | | | | | |
151
151
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
152
152
153
153
.. [#slots ]
@@ -2141,7 +2141,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
2141
2141
.. versionadded :: 3.9 (the field exists since 3.8 but it's only used since 3.9)
2142
2142
2143
2143
2144
- .. c :member :: char PyTypeObject.tp_watched
2144
+ .. c :member :: unsigned char PyTypeObject.tp_watched
2145
2145
2146
2146
Internal. Do not use.
2147
2147
Original file line number Diff line number Diff line change @@ -82,5 +82,5 @@ typedef struct _typeobject {
82
82
vectorcallfunc tp_vectorcall ;
83
83
84
84
/* bitset of which type-watchers care about this type */
85
- char tp_watched ;
85
+ unsigned char tp_watched ;
86
86
} PyTypeObject ;
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ struct _typeobject {
227
227
vectorcallfunc tp_vectorcall ;
228
228
229
229
/* bitset of which type-watchers care about this type */
230
- char tp_watched ;
230
+ unsigned char tp_watched ;
231
231
};
232
232
233
233
/* This struct is used by the specializer
Original file line number Diff line number Diff line change @@ -294,6 +294,16 @@ class C2: pass
294
294
C2 .hmm = "baz"
295
295
self .assert_events ([C1 , [C2 ]])
296
296
297
+ def test_all_watchers (self ):
298
+ class C : pass
299
+ with ExitStack () as stack :
300
+ last_wid = - 1
301
+ while last_wid < self .TYPE_MAX_WATCHERS - 1 :
302
+ last_wid = stack .enter_context (self .watcher ())
303
+ self .watch (last_wid , C )
304
+ C .foo = "bar"
305
+ self .assert_events ([C ])
306
+
297
307
def test_watch_non_type (self ):
298
308
with self .watcher () as wid :
299
309
with self .assertRaisesRegex (ValueError , r"Cannot watch non-type" ):
Original file line number Diff line number Diff line change
1
+ Fix abort / segfault when using all eight type watcher slots, on platforms
2
+ where ``char `` is signed by default.
You can’t perform that action at this time.
0 commit comments