Skip to content

Commit cfbd154

Browse files
committed
Fix format, use memory error.
1 parent d14e57f commit cfbd154

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Objects/typeobject.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,21 +3505,21 @@ type_check_basicsize_includes_size_and_offsets(PyTypeObject* type)
35053505
}
35063506
if (type->tp_weaklistoffset + (Py_ssize_t)sizeof(PyObject*) > max) {
35073507
PyErr_Format(PyExc_TypeError,
3508-
"weaklist offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
3508+
"weaklist offset %zd is out of bounds for type '%s' (tp_basicsize = %zd)",
35093509
type->tp_weaklistoffset,
35103510
type->tp_name, type->tp_basicsize);
35113511
return -1;
35123512
}
35133513
if (type->tp_dictoffset + (Py_ssize_t)sizeof(PyObject*) > max) {
35143514
PyErr_Format(PyExc_TypeError,
3515-
"dict offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
3515+
"dict offset %zd is out of bounds for type '%s' (tp_basicsize = %zd)",
35163516
type->tp_dictoffset,
35173517
type->tp_name, type->tp_basicsize);
35183518
return -1;
35193519
}
35203520
if (type->tp_vectorcall_offset + (Py_ssize_t)sizeof(vectorcallfunc*) > max) {
35213521
PyErr_Format(PyExc_TypeError,
3522-
"vectorcall offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
3522+
"vectorcall offset %zd is out of bounds for type '%s' (tp_basicsize = %zd)",
35233523
type->tp_vectorcall_offset,
35243524
type->tp_name, type->tp_basicsize);
35253525
return -1;
@@ -6768,17 +6768,15 @@ type_ready_managed_dict(PyTypeObject *type)
67686768
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
67696769
PyErr_Format(PyExc_SystemError,
67706770
"type %s has the Py_TPFLAGS_MANAGED_DICT flag "
6771-
"but not Py_TPFLAGS_HEAPTYPE flag.",
6771+
"but not Py_TPFLAGS_HEAPTYPE flag",
67726772
type->tp_name);
67736773
return -1;
67746774
}
67756775
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
67766776
if (et->ht_cached_keys == NULL) {
67776777
et->ht_cached_keys = _PyDict_NewKeysForClass();
67786778
if (et->ht_cached_keys == NULL) {
6779-
PyErr_Format(PyExc_SystemError,
6780-
"failed to initialize ht_cached_keys of type %s.",
6781-
type->tp_name);
6779+
PyErr_NoMemory();
67826780
return -1;
67836781
}
67846782
}

0 commit comments

Comments
 (0)