Skip to content

Commit 84860ea

Browse files
Remove printf and make slightly more threadsafe
1 parent 5da1a40 commit 84860ea

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Objects/typeobject.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ _PyType_SetVersion(PyTypeObject *tp, unsigned int version)
10661066
*slot = NULL;
10671067
}
10681068
#endif
1069-
tp->tp_version_tag = version;
1069+
FT_ATOMIC_STORE_UINT32_RELAXED(tp->tp_version_tag, version);
10701070
#ifndef Py_GIL_DISABLED
10711071
if (version != 0) {
10721072
PyTypeObject **slot =
@@ -1104,7 +1104,6 @@ _PyType_LookupByVersion(unsigned int version)
11041104
PyTypeObject **slot =
11051105
interp->types.type_version_cache
11061106
+ (version % TYPE_VERSION_CACHE_SIZE);
1107-
printf("slot: %p\n", slot);
11081107
if (*slot && (*slot)->tp_version_tag == version) {
11091108
return *slot;
11101109
}
@@ -1149,8 +1148,6 @@ assign_version_tag(PyInterpreterState *interp, PyTypeObject *type)
11491148
return 0;
11501149
}
11511150
_PyType_SetVersion(type, NEXT_GLOBAL_VERSION_TAG++);
1152-
// FT_ATOMIC_STORE_UINT32_RELAXED(type->tp_version_tag,
1153-
// NEXT_GLOBAL_VERSION_TAG++);
11541151
assert (type->tp_version_tag <= _Py_MAX_GLOBAL_TYPE_VERSION_TAG);
11551152
}
11561153
else {
@@ -1160,8 +1157,6 @@ assign_version_tag(PyInterpreterState *interp, PyTypeObject *type)
11601157
return 0;
11611158
}
11621159
_PyType_SetVersion(type, NEXT_VERSION_TAG(interp)++);
1163-
// FT_ATOMIC_STORE_UINT32_RELAXED(type->tp_version_tag,
1164-
// NEXT_VERSION_TAG(interp)++);
11651160
assert (type->tp_version_tag != 0);
11661161
}
11671162

0 commit comments

Comments
 (0)