Commit Graph

85 Commits

Author SHA1 Message Date
Michael Hansen
19f8372358 Remove specialized opcodes.
They are used at runtime, and not written to .pyc / .pyo objects.
2024-08-12 11:24:07 -07:00
Michael Hansen
b939aeb87c Update operand documentation for new opcodes and oparg changes.
Also extends the disassembly oparg decoding for new 3.13 additions.
2024-08-07 15:44:36 -07:00
Alex
75de28decc Python 3.13 initial support (#497)
* Support for JUMP_BACKWARD

* Initial support for Python 3.13

* Remove opcode from another old PR, not needed in the current one

* Update bytes/python_3_13.cpp

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

* Update bytecode_ops.inl

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

* Update .gitignore

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

* Update bytecode_ops.inl

---------

Co-authored-by: Michael Hansen <zrax0111@gmail.com>
2024-08-07 15:39:40 -07:00
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
Levak Borok
2ae7f58a26 Fix Long Numeric Integer representation for Python 3
Before Python 3, long integers were input with an L suffix. Since
Python 3, all integers are 64-bit and do not need the L suffix.
2024-06-22 23:19:18 +02:00
ncaklovic
28b62b6534 Update bytecode.cpp
Co-authored-by: Michael Hansen <zrax0111@gmail.com>
2024-02-28 12:34:15 +01:00
Nenad Čaklović
5f225caf52 LOAD_ATTR operand changes in 3.12 2024-01-05 21:32:53 +01:00
Nenad Čaklović
830dd13228 COMPARE_OP operand changes in 3.12 2024-01-04 23:49:07 +01:00
Michael Hansen
7560149895 Ensure there is always space after the opcode (some opcode names are longer than 30 characters now) 2023-12-06 11:38:03 -08:00
Michael Hansen
ab6aaf6da3 Convert opcode maps to C++ source with macros.
This removes the requirement to run a python script to preprocess the
input files before compiling pycdas/pycdc.
2023-12-05 14:30:33 -08:00
Michael Hansen
74b8f7eec7 Move LOAD_SUPER_ATTR cases closer to other name cases 2023-11-30 12:37:29 -08:00
Michael Hansen
b424ae8fd7 Refactor disassembly operand formatting to remove single-use functions.
This also cleans up an unintentionally duplicated case, and makes it more
obvious when such duplication occurs.
2023-11-30 10:16:00 -08:00
Michael Hansen
9d1e156cec Correctly decode operand types for many newer opcodes in disassembly 2023-11-18 17:45:35 -08:00
Michael Hansen
4ecdd1f81b Remove unused python_NN_unmap() functions 2023-11-16 11:27:31 -08:00
Michael Hansen
57e16d19d1 Refactor bc_next to more clearly split pre- and post-3.6 behavior 2023-11-16 11:16:46 -08:00
Michael Hansen
21c35b2f4c Simplify PycDict key/value storage a bit 2023-11-09 15:05:55 -08:00
Michael Hansen
9b384ad1fa Add basic bytecode and disassembly support for Python 3.12 2023-11-09 12:17:03 -08:00
Michael Hansen
d62c8adf89 Merge branch '3_11-support-for-new-opcodes' of https://github.com/TiZCrocodile/pycdc 2023-08-26 10:58:37 -07:00
Michael Hansen
f5c1d4262b Move comment closer to where it applies, plus some formatting consistency 2023-08-19 21:24:03 -07:00
Roman Avdeenko
916103179c Fix LOAD_GLOBAL_A operand printing for versions prior to 3.11 2023-08-19 17:43:04 +03: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
753d42d94a Simplify string object printing to reduce code duplication 2023-06-09 09:09:03 -07:00
Michael Hansen
bf3599c87a Move some output stream parameters forward.
This allows us to avoid removing parameter defaults for these functions.
2023-06-05 13:56:25 -07:00
Perceval Wajsbürt
c4c35fc531 Use C++ streams over C style IO 2023-06-02 01:12:59 +02:00
Michael Hansen
ee934a1e99 Show binary ops from Python 3.11 in disassembly 2023-05-30 14:45:22 -07:00
Michael Hansen
0710ea07f1 Fix missing includes, which fixes build on GCC 13+ 2023-05-07 13:28:10 -07:00
Akash Munagala
ca73f05830 Print out frozenset in disasm too 2023-02-13 19:33:25 -08:00
Michael Hansen
60e4eb6316 Handle CACHE instructions in decompyle, and suppress them in disassembly by default.
Showing CACHE instructions and the extra PyCode fields in pycdas is now
controlled by command-line arguments.
2023-01-19 14:50:55 -08:00
Michael Hansen
5d855f0bd2 Fix LOAD_GLOBAL and cell var references in Python 3.11+ 2023-01-19 13:05:06 -08:00
Michael Hansen
379c0c94d0 Merge <3.11 VarNames and >=3.11 Locals+Names into a single variable for simplicity.
Also cleans up some extra verbose output by making extra PyCode fields optional
2023-01-19 11:32:07 -08:00
Michael Hansen
9f1d0f2a21 Add basic opcode (disassembly) support for Python 3.11 2023-01-19 11:32:07 -08:00
Michael Hansen
e623e9ac56 For String Refs, inherit the type of the reffed string object. 2022-12-01 11:42:31 -08:00
Adrian Haensler
882571c599 some fixes for 3.9 2022-07-08 17:45:07 -05:00
Nenad Čaklović
3039d8b410 Disassembler changes in 3.10 under BPO-27129 2022-03-24 22:06:35 +01:00
GawdOfROFL
e4e3a9f4ed added python 3.10 support 2021-10-10 00:52:41 +05:30
Michael Hansen
6140b4b33e Protect against out of range lookups in pycdas
Fixes #198.
2021-08-16 15:25:16 +00:00
Michael Hansen
56e549640f Fix format-truncation warning in bytecode.cpp 2021-04-12 10:12:45 -07:00
Michael Hansen
568867c80a Minor style adjustments 2020-10-20 21:08:02 -07: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
John Richards
ed11ba3fe4 Refactors how we handle NaN and infinity
The previous approach didn't work properly under MSVC. The wrong
output would be produced for NaN values.

This new approach will directly print out "nan" and "inf" with the
appropriate sign, rather than just wrapping the value in float('').
2020-10-15 21:35:19 -04:00
John Richards
870ecdc430 Handle NaN and infinity values
Right now, NaN/infinity values will produce "nan" and "inf", but
Python doesn't allow those in source code. This change will wrap
those values in float(''), which is allowed.

Tests for Python 2.7 and 3.8 have been added as well.

Fixes #136
2020-10-15 21:04:57 -04:00
Michael Hansen
8460d119fd Add bytecode support for Python 3.9 rc2 2020-09-29 09:28:15 -07:00
Michael Hansen
428d11c4b5 Add bytecode and disassembly support for Python 3.8.
Also fixes running pymultic from outside of its source directory.
2019-10-14 14:48:26 -07:00
Michael Hansen
8014ac2b14 Print unicode as default in Python 2.x when CO_FUTURE_UNICODE_LITERALS
is set.

Fixes #141.
2019-10-06 14:34:24 -07:00
Michael Hansen
5c896fa743 Clean up some loops with range-based for. 2019-10-04 15:56:24 -07:00
Michael Hansen
a9a362254e Use fputs instead of fprintf when no formatting is required 2018-01-28 15:37:44 -08:00
Michael Hansen
98ad031109 Add initial 3.7 alpha support, and fix 3.6 opcode map 2017-12-20 13:49:28 -08: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
6a9d6a6132 Update bytecode for Python 3.6 beta3, and use a common file for opcode names 2016-11-08 16:00:56 -08:00
Michael Hansen
5ee15c890c Fix display of cell vars 2016-09-07 18:22:49 -07:00