Skip to content

Commit d9e1c23

Browse files
committed
Don't allocate a global type version tag unless required
1 parent 33adfc3 commit d9e1c23

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Objects/typeobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8896,11 +8896,11 @@ init_static_type(PyInterpreterState *interp, PyTypeObject *self,
88968896
type_add_flags(self, _Py_TPFLAGS_STATIC_BUILTIN);
88978897
type_add_flags(self, Py_TPFLAGS_IMMUTABLETYPE);
88988898

8899-
unsigned int version;
8900-
if (!get_next_global_version(&version)) {
8901-
assert(0 && "we have run out of version numbers");
8902-
}
89038899
if (self->tp_version_tag == 0) {
8900+
unsigned int version;
8901+
if (!get_next_global_version(&version)) {
8902+
assert(0 && "we have run out of version numbers");
8903+
}
89048904
_PyType_SetVersion(self, version);
89058905
}
89068906
}

0 commit comments

Comments
 (0)