diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-29 11:12:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 11:12:17 (GMT) |
commit | 4246fe977d850f8b78505c982f055d33d52ff339 (patch) | |
tree | fcc5f21f6a3963f175cad58f571bedc1016f6747 /Objects/typeobject.c | |
parent | 4cfc1b8568bd8bf0d44fadc42ec86696d0561d33 (diff) | |
download | cpython-4246fe977d850f8b78505c982f055d33d52ff339.zip cpython-4246fe977d850f8b78505c982f055d33d52ff339.tar.gz cpython-4246fe977d850f8b78505c982f055d33d52ff339.tar.bz2 |
gh-99845: Change _PyDict_KeysSize() return type to size_t (#99848)
* Change _PyDict_KeysSize() and shared_keys_usable_size() return type
from signed (Py_ssize_t) to unsigned (size_t) type.
* new_values() argument type is now unsigned (size_t).
* init_inline_values() now uses size_t rather than int for the 'i'
iterator variable.
* type.__sizeof__() implementation now uses unsigned (size_t) type.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a4974a1..ae80f5a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4680,16 +4680,17 @@ static PyObject * type___sizeof___impl(PyTypeObject *self) /*[clinic end generated code: output=766f4f16cd3b1854 input=99398f24b9cf45d6]*/ { - Py_ssize_t size; + size_t size; if (self->tp_flags & Py_TPFLAGS_HEAPTYPE) { PyHeapTypeObject* et = (PyHeapTypeObject*)self; size = sizeof(PyHeapTypeObject); if (et->ht_cached_keys) size += _PyDict_KeysSize(et->ht_cached_keys); } - else + else { size = sizeof(PyTypeObject); - return PyLong_FromSsize_t(size); + } + return PyLong_FromSize_t(size); } static PyMethodDef type_methods[] = { |