[Python-checkins] r43341 - in python/trunk: Lib/test/test_grammar.py Lib/test/test_inspect.py Python/ast.c

Georg Brandl g.brandl at gmx.net
Mon Mar 27 11:15:27 CEST 2006


neal.norwitz wrote:
> Author: neal.norwitz
> Date: Mon Mar 27 10:58:23 2006
> New Revision: 43341
> 
> Modified:
>    python/trunk/Lib/test/test_grammar.py
>    python/trunk/Lib/test/test_inspect.py
>    python/trunk/Python/ast.c
> Log:
> Fix SF bug #1458903 with AST compiler.
> 
> def foo((x)): was getting recognized as requiring tuple unpacking
> which is not correct.
> 
> Add tests for this case and the proper way to unpack a tuple of one:
> 	def foo((x,)):
> 
> test_inpsect was incorrect before.  I'm not sure why it was passing,
> but that has been corrected with a test for both functions above.
> This means the test (and therefore inspect.getargspec()) are broken in 2.4.

This raises the question of why "def foo((x))" is allowed in the first place.
It has no effect, and can really be confusing.

The language ref doesn't tell anything about tuple unpacking arguments other
than the grammar rules.

Georg



More information about the Python-checkins mailing list