Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MAKE_FUNCTION default args for py 3.7 #539

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

CarrBen
Copy link

@CarrBen CarrBen commented Feb 13, 2025

DRAFT: This is stacked on top of #538 as both include changes to the same opcode

Some changes for the handling of MAKE_FUNCTION operand & arguments in py3.6-3.12 that I discovered while make some fixes to decompile a py 3.11 app. I started on this before I noticed that #391 existed, but as this PR is stacked on top of #538 it works for py 3.0 & py 3.4 too.

MAKE_FUNCTION Python 3.4 Docs
MAKE_FUNCTION Python 3.7 Docs

Summary

  • Remove xfail test_functions_py3 for py 3.7
  • Update compiled test_functions_py3 for py 3.7 to match input .py with the new test case in Fix MAKE_FUNCTION default args for py 3.4 #538
  • Added a branch for py 3.6+ to handle the args & kwargs being in tuples & dicts

Tests

The test_functions_py3 for py 3.7 was in xfail.
In the previous PR, I added a new test case and updated the tokenized version, to match this the test_functions_py3.3.7.pyc file in compiled was re-built from the (previously updated) source in input.
I used the token_dump and pymultic scripts for this, with a slight modification to use -alpine containers in pymultic.

New py3.6-12 Arg Defaults for MAKE_FUNCTION

With the current master, pycdc produced this output for the x7d test case on py3.7.

def x7d(foo = None, *, bar, **kwargs):

However, this is the input

def x7d(foo = 1, *, bar = 2, **kwargs):

This is because the MAKE_FUNCTION code expects individual args on the stack, but they are now on the stack inside of 0-4 tuples & kwargs indicated by the operand flag.

Stacked on top of #538
Duplicates #391
Related Issues
#507 ?
#155 ?
#138
#448 The MAKE_FUNCTION part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant