Skip to content

Commit 3143552

Browse files
code review
1 parent be846e8 commit 3143552

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Objects/typeobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,13 +1359,13 @@ _PyType_LookupByVersion(unsigned int version)
13591359
#endif
13601360

13611361
static inline unsigned int
1362-
get_next_global_version_tag(void)
1362+
next_global_version_tag(void)
13631363
{
13641364
unsigned int old;
13651365
do {
13661366
old = _Py_atomic_load_uint_relaxed(&_PyRuntime.types.next_version_tag);
13671367
if (old >= _Py_MAX_GLOBAL_TYPE_VERSION_TAG) {
1368-
return (unsigned int)-1;
1368+
return 0;
13691369
}
13701370
} while (!_Py_atomic_compare_exchange_uint(&_PyRuntime.types.next_version_tag, &old, old + 1));
13711371
return old + 1;
@@ -1401,8 +1401,8 @@ assign_version_tag(PyInterpreterState *interp, PyTypeObject *type)
14011401
}
14021402
if (type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) {
14031403
/* static types */
1404-
unsigned int next_version_tag = get_next_global_version_tag();
1405-
if (next_version_tag == (unsigned int)-1) {
1404+
unsigned int next_version_tag = next_global_version_tag();
1405+
if (next_version_tag == 0) {
14061406
/* We have run out of version numbers */
14071407
return 0;
14081408
}
@@ -9238,8 +9238,8 @@ init_static_type(PyInterpreterState *interp, PyTypeObject *self,
92389238
type_add_flags(self, Py_TPFLAGS_IMMUTABLETYPE);
92399239

92409240
if (self->tp_version_tag == 0) {
9241-
unsigned int next_version_tag = get_next_global_version_tag();
9242-
assert(next_version_tag != (unsigned int)-1);
9241+
unsigned int next_version_tag = next_global_version_tag();
9242+
assert(next_version_tag != 0);
92439243
_PyType_SetVersion(self, next_version_tag);
92449244
}
92459245
}

0 commit comments

Comments
 (0)