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 emilyemorehouse
Recipients Elias Vanderstuyft, emilyemorehouse, yselivanov
Date 2017-01-24.06:34:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485239649.62.0.809130960706.issue29354@psf.upfronthosting.co.za>
In-reply-to
Content
Yury, thanks for the encouragement to continue on this patch. I think it will be a good exercise to dive a bit deeper into Python's bytecode and put some knowledge to use.

I believe that tuple argument unpacking is handled appropriately, but there is an even further edge case where a closure is introduced. In the following, inspect.getargspec works for the first bit of code, but the second fails, as 'a' is referenced outside of scope.

>>> dis.dis(lambda (a,): lambda x: x)
  1           0 LOAD_FAST                0 (.0)
              3 UNPACK_SEQUENCE          1
              6 STORE_FAST               1 (a)
              9 LOAD_CONST               1 (<code object <lambda> at 0x10087a130, file "<stdin>", line 1>)
             12 MAKE_FUNCTION            0
             15 RETURN_VALUE
>>> dis.dis(lambda (a,): lambda x: a)
  1           0 LOAD_FAST                0 (.0)
              3 UNPACK_SEQUENCE          1
              6 STORE_DEREF              0 (a)
              9 LOAD_CLOSURE             0 (a)
             12 BUILD_TUPLE              1
             15 LOAD_CONST               1 (<code object <lambda> at 0x10087a930, file "<stdin>", line 1>)
             18 MAKE_CLOSURE             0
             21 RETURN_VALUE

I'll keep poking at this and see where I get.

-- EM
History
Date User Action Args
2017-01-24 06:34:09emilyemorehousesetrecipients: + emilyemorehouse, yselivanov, Elias Vanderstuyft
2017-01-24 06:34:09emilyemorehousesetmessageid: <1485239649.62.0.809130960706.issue29354@psf.upfronthosting.co.za>
2017-01-24 06:34:09emilyemorehouselinkissue29354 messages
2017-01-24 06:34:08emilyemorehousecreate