[New-bugs-announce] [issue3230] dictobject.c: inappropriate use of PySet_GET_SIZE?
report at bugs.python.org
Sat Jun 28 23:31:47 CEST 2008
New submission from Martina Oefelein <Martina at oefelein.de>:
The first use of PySet_GET_SIZE in dict_fromkeys (file dictobject.c) is applied to a PyDictObject. These seem to work by chance, as the PyDictObject and PySetObject have very
similar structure so that it does not matter if you cast a PyDictObject* to a PySetObject*. But if their structure ever diverges, this would cause unpredictable behaviour.
Thus, this use of PySet_GET_SIZE should probably be replaced with a call of PyDict_Size.
(There are two more calls to PySet_GET_SIZE resp. _PySet_NextEntry in the same function,
but these are OK as they actually apply to a set.)
components: Interpreter Core
title: dictobject.c: inappropriate use of PySet_GET_SIZE?
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce