[New-bugs-announce] [issue29867] Add asserts in PyXXX_GET_SIZE macros

Serhiy Storchaka report at bugs.python.org
Tue Mar 21 03:53:03 EDT 2017


New submission from Serhiy Storchaka:

Proposed patch adds asserts for checking the type in macros PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. This can help to find the misuse of these macros. Asserts already are used in macros PyBytes_GET_SIZE, PyByteArray_GET_SIZE, PyUnicode_GET_SIZE and PyDict_GET_SIZE. See also the discussion on Python-Dev: https://mail.python.org/pipermail/python-dev/2017-March/147628.html .

This change can break the code that uses these macros for setting the size. For example one place in odictobject.c. But I expect that such cases are rare. And all these macros are not in the limited API.

----------
components: Interpreter Core
messages: 289927
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add asserts in PyXXX_GET_SIZE macros
type: enhancement
versions: Python 3.7

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


More information about the New-bugs-announce mailing list