[Python-Dev] Anonymous + varargs: possible serious breakage -- please confirm!

Thomas Wouters thomas@xs4all.net
Thu, 25 Jan 2001 10:24:24 +0100


On Wed, Jan 24, 2001 at 12:33:43PM -0800, Ka-Ping Yee wrote:

> Please try:

>     >>> def f(a, (b, c), *d):
>     ...     x = 1
>     ...     print a, b, c, d, x
>     ...
>     >>> f(1, (2, 3), 4)
>     1 2 3
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>       File "<stdin>", line 3, in f
>     UnboundLocalError: local variable 'd' referenced before assignment
>     >>> 

> In Python 1.5.2, this prints "1 2 3 (4,)" as expected.

> I only have 1.5.2 and 2.1a1 to test.  I hope this problem
> isn't present in 2.0...

It isn't present in 2.0. This is probably related to Jeremy's changes
in the call mechanism or the compiler track, though Jeremy himself is the
best person to claim that for sure :)

> Note that test_inspect was the only test to fail!  It might be the
> only test that checks anonymous and *varargs at the same time.
> (Yet another reason to put inspect in the core...)

Well, this is not an inspect-specific test, so it shouldn't *be* in
test_inspect, it should be in test_extcall :)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!