-
Notifications
You must be signed in to change notification settings - Fork 642
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
Add support for 3.6+ default arguments #391
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be good to add or update tests for this case
The tests looked a bit strange from my observations (Python code wasn't the same as the expected output). I rebuilt the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names of the compiled test files are not correct (unfortunately, it's a bit misleading since the input file is "..._py3
", so "test_functions_py3.3.0.pyc" means "test_functions_py3.py for Python 3.0"). Also, when I rebuilt the test files for Python 3.4 (which was one of the original cases included), it appears to have a new failure:
tests/test_functions_py3.3.4.pyc.tok.txt does not match tests/tokenized/test_functions_py3.txt:
--- tests/tokenized/test_functions_py3.txt 2023-10-20 14:05:18.112904714 -0700
+++ tests/test_functions_py3.3.4.pyc.tok.txt 2023-10-20 14:07:39.786332445 -0700
@@ -58,7 +58,7 @@
<INDENT>
pass <EOL>
<OUTDENT>
-def x6d ( foo = 1 , * , bar = 2 ) : <EOL>
+def x6d ( foo = 2 , * , bar = 'bar' ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
@@ -74,6 +74,6 @@
<INDENT>
pass <EOL>
<OUTDENT>
-def x7d ( foo = 1 , * , bar = 2 , ** kwargs ) : <EOL>
+def x7d ( foo = 2 , * , bar = 'bar' , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
hey, any updates on this? |
Fixes #138.
Fixes #155.
Fixes #370.
Python 3.6 moved from pushing the default arguments individually to the stack to pushing a tuple with them.
Modifications:
LOAD_CLOSURE
should push junk to the stack instead of skipping, asMAKE_FUNCTION
with operand 8 will have a structure like follows:MAKE_FUNCTION
will handle default arguments of type 1, 2 and 8 (4 is about type hints).