[issue28959] Add a macro for dict size

Serhiy Storchaka report at bugs.python.org
Wed Dec 14 04:59:13 EST 2016


Serhiy Storchaka added the comment:

Updated patch addresses Victor's issue. _PyDict_GET_SIZE is renamed to PyDict_GET_SIZE and now it includes an assertion. This is good argument for introducing this macro against using PyDict_Size (without checking the result for error) and Py_SIZE (which doesn't check the type).

> Can someone check if it has an impact of the size of the structure (because of the complex rules of alignment)?

There are special tests for that.

Actually I think that switching to PyObject_VAR_HEAD is different issue. The patch can be pushed without changes to dictobject.c and the structure of a dict.

----------
Added file: http://bugs.python.org/file45892/PyDict_GET_SIZE-3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28959>
_______________________________________


More information about the Python-bugs-list mailing list