@@ -93,12 +93,6 @@ types_world_is_stopped(void)
9393    return  interp -> stoptheworld .world_stopped ;
9494}
9595
96- // Checks that either the type has not yet been exposed (revealed) to other 
97- // threads (it was newly created and the Py_TPFLAGS_EXPOSED flag is not set 
98- // yet) or the world is stopped and we can safely update it without races. 
99- #define  ASSERT_NEW_OR_STOPPED (tp ) \
100-     assert((((tp)->tp_flags & Py_TPFLAGS_EXPOSED) == 0) || types_world_is_stopped())
101- 
10296static  void 
10397types_stop_world (void )
10498{
@@ -166,7 +160,6 @@ types_mutex_unlock(void)
166160#define  types_stop_world ()
167161#define  types_start_world ()
168162#define  ASSERT_TYPE_LOCK_HELD ()
169- #define  ASSERT_NEW_OR_STOPPED (tp )
170163
171164#endif 
172165
@@ -436,15 +429,13 @@ type_set_flags(PyTypeObject *tp, unsigned long flags)
436429        // be active). 
437430        ASSERT_TYPE_LOCK_HELD ();
438431    }
439-     ASSERT_NEW_OR_STOPPED (tp );
440432    tp -> tp_flags  =  flags ;
441433}
442434
443435static  void 
444436type_set_flags_with_mask (PyTypeObject  * tp , unsigned long  mask , unsigned long  flags )
445437{
446438    ASSERT_TYPE_LOCK_HELD ();
447-     ASSERT_NEW_OR_STOPPED (tp );
448439    unsigned long  new_flags  =  (tp -> tp_flags  &  ~mask ) | flags ;
449440    type_set_flags (tp , new_flags );
450441}
@@ -580,7 +571,6 @@ static inline void
580571set_tp_bases (PyTypeObject  * self , PyObject  * bases , int  initial )
581572{
582573    assert (PyTuple_CheckExact (bases ));
583-     ASSERT_NEW_OR_STOPPED (self );
584574    if  (self -> tp_flags  &  _Py_TPFLAGS_STATIC_BUILTIN ) {
585575        // XXX tp_bases can probably be statically allocated for each 
586576        // static builtin type. 
@@ -638,7 +628,6 @@ _PyType_GetMRO(PyTypeObject *self)
638628static  inline  void 
639629set_tp_mro (PyTypeObject  * self , PyObject  * mro , int  initial )
640630{
641-     ASSERT_NEW_OR_STOPPED (self );
642631    if  (mro  !=  NULL ) {
643632        assert (PyTuple_CheckExact (mro ));
644633        if  (self -> tp_flags  &  _Py_TPFLAGS_STATIC_BUILTIN ) {
@@ -1717,7 +1706,6 @@ static int
17171706mro_hierarchy (PyTypeObject  * type , PyObject  * temp )
17181707{
17191708    ASSERT_TYPE_LOCK_HELD ();
1720-     ASSERT_NEW_OR_STOPPED (type );
17211709
17221710    PyObject  * old_mro ;
17231711    int  res  =  mro_internal (type , & old_mro );
@@ -3564,7 +3552,6 @@ static int
35643552mro_internal_unlocked (PyTypeObject  * type , int  initial , PyObject  * * p_old_mro )
35653553{
35663554    ASSERT_TYPE_LOCK_HELD ();
3567-     ASSERT_NEW_OR_STOPPED (type );
35683555
35693556    PyObject  * new_mro , * old_mro ;
35703557    int  reent ;
@@ -3614,7 +3601,6 @@ static int
36143601mro_internal (PyTypeObject  * type , PyObject  * * p_old_mro )
36153602{
36163603    int  res ;
3617-     ASSERT_NEW_OR_STOPPED (type );
36183604    res  =  mro_internal_unlocked (type , 0 , p_old_mro );
36193605    return  res ;
36203606}
@@ -4694,8 +4680,6 @@ type_new_impl(type_new_ctx *ctx)
46944680    }
46954681
46964682    assert (_PyType_CheckConsistency (type ));
4697-     // After this point, other threads can potentally use this type. 
4698-     type -> tp_flags  |= Py_TPFLAGS_EXPOSED ;
46994683
47004684    return  (PyObject  * )type ;
47014685
@@ -5409,8 +5393,6 @@ PyType_FromMetaclass(
54095393    }
54105394
54115395    assert (_PyType_CheckConsistency (type ));
5412-     // After this point, other threads can potentally use this type. 
5413-     type -> tp_flags  |= Py_TPFLAGS_EXPOSED ;
54145396
54155397 finally :
54165398    if  (PyErr_Occurred ()) {
@@ -8668,7 +8650,6 @@ static int
86688650type_ready_mro (PyTypeObject  * type , int  initial )
86698651{
86708652    ASSERT_TYPE_LOCK_HELD ();
8671-     ASSERT_NEW_OR_STOPPED (type );
86728653
86738654    if  (type -> tp_flags  &  _Py_TPFLAGS_STATIC_BUILTIN ) {
86748655        if  (!initial ) {
@@ -8744,7 +8725,6 @@ static int
87448725type_ready_inherit (PyTypeObject  * type )
87458726{
87468727    ASSERT_TYPE_LOCK_HELD ();
8747-     ASSERT_NEW_OR_STOPPED (type );
87488728
87498729    /* Inherit special flags from dominant base */ 
87508730    PyTypeObject  * base  =  type -> tp_base ;
@@ -8942,7 +8922,6 @@ static int
89428922type_ready (PyTypeObject  * type , int  initial )
89438923{
89448924    ASSERT_TYPE_LOCK_HELD ();
8945-     ASSERT_NEW_OR_STOPPED (type );
89468925
89478926    _PyObject_ASSERT ((PyObject  * )type , !is_readying (type ));
89488927    start_readying (type );
@@ -11275,7 +11254,6 @@ static pytype_slotdef *
1127511254update_one_slot (PyTypeObject  * type , pytype_slotdef  * p )
1127611255{
1127711256    ASSERT_TYPE_LOCK_HELD ();
11278-     ASSERT_NEW_OR_STOPPED (type );
1127911257
1128011258    PyObject  * descr ;
1128111259    PyWrapperDescrObject  * d ;
@@ -11392,7 +11370,6 @@ static int
1139211370update_slots_callback (PyTypeObject  * type , void  * data )
1139311371{
1139411372    ASSERT_TYPE_LOCK_HELD ();
11395-     ASSERT_NEW_OR_STOPPED (type );
1139611373
1139711374    pytype_slotdef  * * pp  =  (pytype_slotdef  * * )data ;
1139811375    for  (; * pp ; pp ++ ) {
@@ -11411,7 +11388,6 @@ update_slot(PyTypeObject *type, PyObject *name)
1141111388    int  offset ;
1141211389
1141311390    ASSERT_TYPE_LOCK_HELD ();
11414-     ASSERT_NEW_OR_STOPPED (type );
1141511391    assert (types_world_is_stopped ());
1141611392    assert (PyUnicode_CheckExact (name ));
1141711393    assert (PyUnicode_CHECK_INTERNED (name ));
@@ -11466,7 +11442,6 @@ update_all_slots(PyTypeObject* type)
1146611442    pytype_slotdef  * p ;
1146711443
1146811444    ASSERT_TYPE_LOCK_HELD ();
11469-     ASSERT_NEW_OR_STOPPED (type );
1147011445
1147111446    /* Clear the VALID_VERSION flag of 'type' and all its subclasses. */ 
1147211447    type_modified_unlocked (type );
0 commit comments