A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-March/147628.html below:

[Python-Dev] Py_SIZE vs PyXXX_GET_SIZE

[Python-Dev] Py_SIZE vs PyXXX_GET_SIZE [Python-Dev] Py_SIZE vs PyXXX_GET_SIZESerhiy Storchaka storchaka at gmail.com
Mon Mar 20 07:26:34 EDT 2017
What is the preferable way of getting the size of tuple, list, bytes, 
bytearray: Py_SIZE or PyTuple_GET_SIZE, PyList_GET_SIZE, 
PyBytes_GET_SIZE, PyByteArray_GET_SIZE? Are macros for concrete types 
more preferable or they are outdated?

On one hand concrete type macros are longer than Py_SIZE, and since 
concrete type macros are defined not for all PyVarObject types we need 
to use Py_SIZE for them in any case (for example for PyLongObject and 
PyTypeObject).

On other hand we can add asserts for checking that concrete type macros 
are used with correct types. When I wrote a patch that replaces Py_SIZE 
with concrete type macros I found two cases of misusing Py_SIZE with 
dict object: one in _json.c (already fixed in 
3023ebb43f7607584c3e123aff56e867cb04a418) and other in dictobject.c 
(still not fixed). If prefer using concrete type macros this would 
unlikely happen.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4