mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
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.
This commit is contained in:
parent
4cfc1b8568
commit
4246fe977d
3 changed files with 31 additions and 35 deletions
|
@ -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[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue