This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients abacabadabacaba, belopolsky, billm, georg.brandl, loewis
Date 2011-01-14.04:55:18
SpamBayes Score 4.0656517e-10
Marked as misclassified No
Message-id <1294980920.06.0.0192263893688.issue6083@psf.upfronthosting.co.za>
In-reply-to
Content
Let me summarize the issue: the PyArg_ParseTuple format code 'O' returns a borrowed reference.  However, when the 'O' code appears inside parenthesis, there may not be an object to hold the reference to borrow from.  This is what happens in the test-functools.py crasher:  partial.__setstate__() takes a 4-tuple argument that is unpacked using a "(OOOO)" format.  The test case passes an instance instead of a tuple that supports the sequence methods, but does not hold the reference to the "items" that its []-operator returns.  This is not a problem at the top level because args argument to PyArg_ParseTuple is always a real tuple.

I think that rather than deprecating the use of 'O' format inside parentheses, "(..O..)" unpacking should reject to unpack arguments other than tuples or maybe lists.
History
Date User Action Args
2011-01-14 04:55:20belopolskysetrecipients: + belopolsky, loewis, georg.brandl, billm, abacabadabacaba
2011-01-14 04:55:20belopolskysetmessageid: <1294980920.06.0.0192263893688.issue6083@psf.upfronthosting.co.za>
2011-01-14 04:55:18belopolskylinkissue6083 messages
2011-01-14 04:55:18belopolskycreate