Fix MAKE_FUNCTION default args for py 3.4
Some changes for the handling of MAKE_FUNCTION operand & arguments in py3.0-3.5 that I discovered while updating MAKE_FUNCTION to support the changed operand for py3.6+ (planning to raise that as another PR).
MAKE_FUNCTION Python 3.0 Docs MAKE_FUNCTION Python 3.4 Docs
Summary
- Update compiled test_functions_py3 for py 3.4 to match input .py
- Update tokenized test_functions_py3 to match input .py
- Update compiled test_functions_py3 for py 3.0 to match input .py
- Updated handling of Kwarg pairs for all versions
- Changed order of pops to take Kwargs first for py3.4+
- Added code to pop & ignore type annotations
Tests
The test_functions_py3 tests were passing for 3.0 & 3.4, but the .pyc's & tokenized files were missing a number of additional cases that were present in the input .py
The changes to the .pyc's & tokenized output are to include these additional cases. I used the token_dump and pymultic scripts for this, with a slight modification to use -alpine containers in pymultic.
Wrong Order of Arg Defaults
With the current master, pycdc produced this output for the last test case on py3.4.
def x7d(foo = 2, *, bar = 'bar', **kwargs):
However, this is the input
def x7d(foo = 1, *, bar = 2, **kwargs):
With the issue seeming to be the changed order of Position & Kwarg defaults on the stack between 3.3 & newer.
Incorrect Popping of Kwarg Defaults
I also added an additional test case with multiple Kwargs:
def x7e(foo = 1, *, bar = 2, baz = 3, **kwargs):
pass
Again with the current master this fails for py3.0
def x7e(foo = 1, *, bar = 'baz', baz = 3, **kwargs):
pass
and for py3.4
def x7e(foo = 3, *, bar = 2, baz = 'baz', **kwargs):
pass
Which seems to be due to only 1 item being popped from the stack per Kwarg, when there are actually 2 (value followed by key).
Related Issues #91 ?