Commit Graph

71 Commits

Author SHA1 Message Date
Michael Hansen
0b45b5fa07 Fix FORMAT_VALUE for values that have both a conversion and a format_spec.
Also output the conversion and flags in disassembly.
2024-08-01 13:28:43 -07:00
MrDakik
da859f5a2b Added support for opcodes: (in DESC)
`KW_NAMES`
`POP_JUMP_FORWARD_IF_FALSE`
`POP_JUMP_FORWARD_IF_TRUE`
`LOAD_GLOBAL`
2023-07-18 18:33:03 +03:00
Michael Hansen
409f175827 Reduce code duplication for pre-3.11 binary ops, based on #348 2023-06-01 13:55:17 -07:00
Michael Hansen
90815b47ca Squash merge of #348
(Plus some whitespace cleanup)

commit ca302777438a6ac0ff00b9dbc87d2cf9e816b807
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 14:55:26 2023 -0400

    Test

commit 1764514e1dc4018abf050e2e2c3378b6ebaca2a2
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 14:46:49 2023 -0400

    Semi-Support

commit 104fa62355a18a071dae2d09db00af3b2fd22b6c
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 14:46:30 2023 -0400

    Semi-Support

commit 0809a71c725e3a92ece9348265f26f72fdb6664d
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 14:46:11 2023 -0400

    Semi-Support

commit bdf1695a57d2ad9eb1505a92ff4fa46c6f5ea90f
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 00:06:34 2023 -0400

    Updated Test

commit ea69a0b3be10568b70d02d744174e3bfc1d3546a
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 00:06:23 2023 -0400

    Updated Test

commit ecde2146208ea7a533267ace7293a49ce7a132bb
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Thu Jun 1 00:06:12 2023 -0400

    Updated Test

commit d5bbbe6224fc0aa8c5c3bc39b4f8845c8f941c7f
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 23:59:46 2023 -0400

    Feat: @zrax

    Co-authored-by: Michael Hansen <zrax0111@gmail.com>

commit f8d2299d14a3a0f69b40486006d629ccc5c719df
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 23:59:03 2023 -0400

    Feat: @zrax

    Co-authored-by: Michael Hansen <zrax0111@gmail.com>

commit 3fa8691f4c379dd10026227778ac60587fd07e68
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 23:58:53 2023 -0400

    Feat: @zrax

    Co-authored-by: Michael Hansen <zrax0111@gmail.com>

commit 6af17f0cffee31bc03ed8151e82b1720119d6a8d
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 23:58:45 2023 -0400

    Feat: @zrax

    Co-authored-by: Michael Hansen <zrax0111@gmail.com>

commit c7c76097fce1f45da0308b9f5e9cfffb5a323fd9
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 16:55:20 2023 -0400

    Remove `iostream`

commit 2edaec022f8cbcb36bffd7ec86b5f71b391fb372
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 16:54:48 2023 -0400

    Mistake

commit a36d4c5e62afe24691701f6d0b7c758b4113db91
Author: TheHellTower <thehelltower@tuta.io>
Date:   Wed May 31 16:52:12 2023 -0400

    Remove `iostream`

commit 1c3a5b02c95352a8e90247757df17d1563698fb6
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 16:43:30 2023 -0400

    Should be a bit better

commit 11603f1bb244c4d60ec34b675e1cd9c10945abf5
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 04:07:47 2023 -0400

    Update

commit 689b544fc1023ec60e4df257f3448064fdf84c2b
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 04:07:38 2023 -0400

    Update

commit 20bc5b820fb2ef6fd9199546e11ac02d78e5b6da
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 04:07:24 2023 -0400

    Update

commit c01e8251fac1577d25ab440ade4bfe2b42eb1860
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 04:05:28 2023 -0400

    Format problem ?

commit f35c494dd0d943323ec899cd8b2a236d11de67fc
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Wed May 31 04:02:03 2023 -0400

    Fix

commit 7f3265e4192e2b6eec81dc30a630691cead59694
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:57:01 2023 -0400

    BINARY_OP | Simplified

commit 045a6041f7a5abb7b5cdeaa4882b2620462e1927
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:56:53 2023 -0400

    BINARY_OP | Simplified

commit 0bfb76280e466e15c32ef42851d9981b9df57059
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:56:41 2023 -0400

    BINARY_OP | Simplified

commit 31159d69e8f802d7955244b258795563018c3eda
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:50:19 2023 -0400

    Fix Matching...

commit e4a978aeadebe9c574856c30928ec58da9e32639
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:50:06 2023 -0400

    Fix Matching...

commit d7a1b25b8f85886fcdc0a7c10c885e7e9e011281
Author: TheHellTower <thehelltower@tuta.io>
Date:   Mon May 29 00:41:43 2023 -0400

    Add `BINARY_OP` support

commit 6527299a67f043eb2b63e13ae43c4e9f060456e2
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:40:32 2023 -0400

    Add `BINARY_OP` test tokenized

commit c053cab7895f49a085a0797a98e28e87f4874d39
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:40:11 2023 -0400

    Add `BINARY_OP` test

commit e32f006f90a4e450099edd7d2f0bdbb0f1bbc612
Author: TheHellTower <dontbeshybuddy@gmail.com>
Date:   Mon May 29 00:39:53 2023 -0400

    Add `BINARY_OP` test compiled

Closes #333
Closes #348

Co-authored-by: TheHellTower <dontbeshybuddy@gmail.com>
2023-06-01 13:21:23 -07:00
Akash Munagala
f00921d3d3 Use deque instead of set 2023-02-13 19:25:45 -08:00
Akash Munagala
aaad868445 Implement BUILD_SET and SET_UPDATE 2023-02-12 16:21:20 -08:00
Michael Hansen
305494c4b2 Fix unintentional method shadowing in ASTAnnotatedVar 2022-12-01 16:03:09 -08:00
Adrian Haensler
462260991e fix for loops in 3.8 2022-07-08 20:25:13 -05:00
Michael Hansen
b0fa45840f Minor code style cleanups for consistency 2022-04-26 12:56:19 -07:00
Nenad Čaklović
46affe279c Support for conditonal expression (if-expression) 2022-03-29 12:30:06 +02:00
Aralox
7a89b72260 Support chained assignment statements, e.g. a = b = c.
We know when we have begun a chained assignment when we process a DUP_TOP with non-null on the stack. Push a NODE_CHAINSTORE onto the stack when this happens, and keep it 'floating' on top of the stack for all STORE_X operations until the stack is empty.
To support versions of Python <= 2.5 which use DUP_TOP in more places, I modified ROT_TWO, ROT_THREE and ROT_FOUR to get rid of NODE_CHAINSTORE on the stack if it is present.
2020-10-23 21:19:01 +11:00
Michael Hansen
0540b3991c Merge pull request #181 from Aralox/Issue-124-handle-async-for-GET_AITER_GET_ANEXT
Add support for `async for`
2020-10-22 08:24:56 -07:00
John Richards
345035b544 Adds support for SETUP_ANNOTATION op and variable annotations
Tests have also been added.

Fixes #169
2020-10-21 21:42:13 -04:00
Aralox
5bdc0b5baf Merge remote-tracking branch 'upstream/master' into Issue-124-handle-async-for-GET_AITER_GET_ANEXT
Conflicts:
	ASTree.cpp
2020-10-21 19:34:37 +11:00
Aralox
91a23f914d Implement better handling for async for.
Instead of ignoring boilerplate when decompiling `async for`, build the loop semantically by deconstructing the BLK_WHILE -> BLK_CONTAINER -> BLK_TRY that python generates when compiling an `async for` (see https://www.python.org/dev/peps/pep-0492/#asynchronous-iterators-and-async-for).
When reading GET_AITER, convert the BLK_WHILE into a BLK_ASYNCFOR in the same way as a `for` loop.
Ignore GET_ANEXT.
Use END_FINALLY as the trigger to finish building the BLK_ASYNCFOR:
-> Extract the loop variable from the contents of the BLK_TRY.
-> Throw away the BLK_TRY and BLK_CONTAINER, leave the BLK_ASYNCFOR on top of the stack.
2020-10-21 19:32:20 +11:00
Michael Hansen
d3a46f711f Merge remote-tracking branch 'dotjrich/issue-172' into master 2020-10-20 21:10:55 -07:00
Michael Hansen
568867c80a Minor style adjustments 2020-10-20 21:08:02 -07:00
Aralox
8933c9a4a9 Add support for async for. Issue #124
Ignore 'boilerplate' opcodes that set up the async iteration logic internally (https://www.python.org/dev/peps/pep-0492/#asynchronous-iterators-and-async-for) - We don’t need any of this as GET_AITER is enough to tell us that we are in an `async for`.
2020-10-20 20:39:23 +11:00
John Richards
5b819fa23e Adds support for BUILD_CONST_KEY_MAP opcode
Tests have also been added.

Fixes #172
2020-10-20 01:46:38 -04:00
Aralox
7af40a779f CRAs 2020-10-20 16:42:19 +11:00
Aralox
1f07a24451 Fix up some dodgy spacing 2020-10-17 21:04:39 +11:00
Aralox
0c9fbd9caf Issue-165 Added support for f-strings (literal string interpolation https://www.python.org/dev/peps/pep-0498/)
Opcodes handled: FORMAT_VALUE, BUILD_STRING.
Added AST node classes for FormattedValue and JoinedStr.
2020-10-17 20:52:57 +11:00
Michael Hansen
375b8b0c68 Fix non-inplace matrix multiplication operator. 2019-10-10 11:47:48 -07:00
Michael Hansen
de3f7982c3 Support 'yield from' (Python 3.3) and await (Python 3.5) expressions.
Currently unsupported are yield from in newer Python versions, and
yield/yield from into an assignment expression.
2019-10-10 10:59:10 -07:00
Michael Hansen
881a200ab0 Change handling of POP_TOP to explicitly mark already-processed nodes. 2019-10-10 10:55:28 -07:00
Michael Hansen
15da179173 Merge print nodes in the AST rather than attempting to manage it during
print statement output. Fixes numerous bugs with mangled print statements.
2019-10-09 14:20:46 -07:00
Michael Hansen
cbbffd28e6 Modernize ASTNode.h 2019-10-08 13:34:15 -07:00
Michael Hansen
8713b3b05f Merge 'pass' node into existing ASTKeyword node type 2019-10-08 13:12:31 -07:00
Michael Hansen
9309effba9 Support Python 3.x kw-only arguments. 2019-10-08 11:36:12 -07:00
Michael Hansen
b5696c8398 Port Python 2.7 list comprehension fixes by @ReDucTor from #78 2019-10-04 16:35:58 -07:00
Michael Hansen
2e93d29233 Don't write parens around for loop value tuples 2019-10-04 14:08:47 -07:00
Michael Hansen
8d3752b4f0 Start requring C++11 with explicit virtual overrides. 2019-10-02 14:41:49 -07:00
Michael Hansen
b9dd99d518 Don't create special objects for NULL, just use NULL directly.
Also move null check into PycRef for nullable references.
2017-07-05 16:36:04 -07:00
Michael Hansen
888882c743 Help convince clang that 'this' can be NULL in some cases. Closes #65 2015-10-02 23:00:07 -07:00
Michael Hansen
badd17bd21 Support @ operator 2015-10-01 17:03:41 -07:00
mancoast
58edafd872 Add support for LOAD_BUILD_CLASS op-code
Issue #39
2015-04-20 17:38:36 -04:00
Kunal Parmar
cc9bdfa085 Support for with statement. 2012-06-06 22:02:33 -07:00
Michael Hansen
c474d368a1 Use less conflicting filenames 2011-10-23 17:48:10 -07:00
Darryl Pogue
cce5f3cf34 Fix for pickle.pyc from Python 2.2.
This feels like the hackiest fix EVER.
2011-10-10 21:22:02 -07:00
Darryl Pogue
e2cf440736 List comprehension support. 2011-10-10 15:57:20 -07:00
Darryl Pogue
7701f221e8 Function varargs and keywordargs. 2011-10-09 22:38:18 -07:00
Darryl Pogue
2df831176e Fixes for obscure loop conditions. 2011-10-09 15:43:24 -07:00
Darryl Pogue
ff8bb4844b Fix except/else and generic except statements. 2011-10-02 18:58:38 -07:00
Darryl Pogue
70160f8a28 Basic handling of try/except/finally blocks. 2011-10-01 19:40:34 -07:00
Darryl Pogue
ac4d254a73 Remove old attempts at try handling. 2011-10-01 19:09:59 -07:00
Darryl Pogue
1e249b42fd Fix importing modules with aliases.
aka - from blah import foo as bar
2011-09-20 22:36:15 -07:00
Darryl Pogue
51ca98d766 Support for the yield statement. 2011-09-18 22:31:09 -07:00
Darryl Pogue
84b8cba005 Correct output for in-place operators. 2011-09-18 12:06:29 -07:00
Darryl Pogue
521490c819 Support for printing to a stream (PRINT_*_TO). 2011-09-18 00:35:28 -07:00
Darryl Pogue
13a7c0d6c8 Added exec statement 2011-01-10 13:15:56 -08:00