File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,8 +158,7 @@ test_frozenset_add_in_capi(PyObject *self, PyObject *Py_UNUSED(obj))
158158static PyObject *
159159raiseTestError (const char * test_name , const char * msg )
160160{
161- PyObject * exc = PyErr_GetRaisedException ();
162- PyErr_Format (exc , "%s: %s" , test_name , msg );
161+ PyErr_Format (PyExc_AssertionError , "%s: %s" , test_name , msg );
163162 return NULL ;
164163}
165164
Original file line number Diff line number Diff line change @@ -1368,8 +1368,8 @@ make_new_set_basetype(PyTypeObject *type, PyObject *iterable)
13681368 return make_new_set (type , iterable );
13691369}
13701370
1371- void
13721371// gh-140232: check whether a frozenset can be untracked from the GC
1372+ void
13731373_PyFrozenSet_MaybeUntrack (PyObject * op )
13741374{
13751375 assert (op != NULL );
@@ -2957,7 +2957,7 @@ PyObject *
29572957PyFrozenSet_New (PyObject * iterable )
29582958{
29592959 PyObject * result = make_new_set (& PyFrozenSet_Type , iterable );
2960- if (result != 0 ) {
2960+ if (result != NULL ) {
29612961 _PyFrozenSet_MaybeUntrack (result );
29622962 }
29632963 return result ;
@@ -3038,8 +3038,9 @@ PySet_Add(PyObject *anyset, PyObject *key)
30383038 // API limits the usage of `PySet_Add` to "fill in the values of brand
30393039 // new frozensets before they are exposed to other code". In this case,
30403040 // this can be done without a lock.
3041- // since another key is added to the set, we must track the frozenset if needed
3042- if (PyFrozenSet_CheckExact (anyset ) && PyObject_GC_IsTracked (key ) && !PyObject_GC_IsTracked (anyset ) ) {
3041+ // Since another key is added to the set, we must track the frozenset
3042+ // if needed.
3043+ if (PyFrozenSet_CheckExact (anyset ) && PyObject_GC_IsTracked (key ) && !PyObject_GC_IsTracked (anyset )) {
30433044 _PyObject_GC_TRACK (anyset );
30443045 }
30453046 return set_add_key ((PySetObject * )anyset , key );
You can’t perform that action at this time.
0 commit comments