[New-bugs-announce] [issue24992] collections.OrderedDict constructor (odict_new) doesn't handle PyDict_New() failure

STINNER Victor report at bugs.python.org
Thu Sep 3 11:53:53 CEST 2015


New submission from STINNER Victor:

If PyDict_New() fails (ex: memory allocation failure), odict_new() returns a new OrderedDict with an exception set. It's a bug. Attached patch fixes it.

odict_new() constructor also returns NULL without destroying the newly created object if _odict_initialize() fails. My patch also fixes this.

My patch inlines _odict_initialize() into odict_new() and avoids useless initialization to 0.

----------
files: odict.patch
keywords: patch
messages: 249625
nosy: eric.snow, haypo
priority: normal
severity: normal
status: open
title: collections.OrderedDict constructor (odict_new) doesn't handle PyDict_New() failure
versions: Python 3.6
Added file: http://bugs.python.org/file40334/odict.patch

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


More information about the New-bugs-announce mailing list