depyo 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/depyo.js +43 -2
- package/lib/OpCodes.js +22 -5
- package/lib/PycDecompiler.js +1050 -40
- package/lib/PycDisassembler.js +1 -1
- package/lib/PycReader.js +22 -3
- package/lib/PythonObject.js +42 -6
- package/lib/ast/ast_node.js +381 -88
- package/lib/bytecode/python_3_0.js +1 -1
- package/lib/bytecode/python_3_12.js +1 -1
- package/lib/bytecode/python_3_13.js +13 -13
- package/lib/bytecode/python_3_14.js +13 -13
- package/lib/bytecode/python_3_15.js +183 -0
- package/lib/code_reader.js +107 -146
- package/lib/handlers/collections_update.js +50 -1
- package/lib/handlers/comparisons.js +3 -10
- package/lib/handlers/context_managers.js +202 -13
- package/lib/handlers/control_flow_jumps.js +516 -23
- package/lib/handlers/exceptions_blocks.js +92 -24
- package/lib/handlers/formatting.js +60 -17
- package/lib/handlers/function_calls.js +474 -58
- package/lib/handlers/function_class_build.js +170 -65
- package/lib/handlers/generators_async.js +67 -0
- package/lib/handlers/load_store_names.js +190 -57
- package/lib/handlers/loop_iterator.js +162 -6
- package/lib/handlers/misc_other.js +253 -44
- package/lib/handlers/stack_ops.js +81 -19
- package/lib/handlers/subscript_slice.js +103 -1
- package/lib/handlers/unpack.js +18 -16
- package/package.json +2 -2
package/lib/handlers/unpack.js
CHANGED
|
@@ -102,28 +102,30 @@ function handleBuildSetUnpackA() {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function handleBuildMapUnpackA() {
|
|
105
|
-
|
|
105
|
+
// Py 3.5-3.8: count of mappings to merge for {**a, **b} dict literal.
|
|
106
|
+
processBuildMapUnpack.call(this, /*withCall=*/false);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
function handleBuildMapUnpackWithCallA() {
|
|
109
|
-
|
|
110
|
+
// Py 3.5 only: oparg = count + (fn_loc << 8). Lower byte is the map count,
|
|
111
|
+
// upper byte locates the callable for error reporting.
|
|
112
|
+
// Py 3.6-3.8: oparg = plain count (this opcode is kept for unpack-with-call
|
|
113
|
+
// semantics but the fn_loc byte is dropped).
|
|
114
|
+
processBuildMapUnpack.call(this, /*withCall=*/true);
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
function processBuildMapUnpack() {
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} else {
|
|
121
|
-
if (global.g_cliArgs?.debug) {
|
|
122
|
-
console.error("Expected a map for BUILD_MAP_UNPACK");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
117
|
+
function processBuildMapUnpack(withCall) {
|
|
118
|
+
let count = this.code.Current.Argument;
|
|
119
|
+
if (withCall && this.object.Reader.versionCompare(3, 6) < 0) {
|
|
120
|
+
count = count & 0xFF;
|
|
121
|
+
}
|
|
122
|
+
let items = [];
|
|
123
|
+
for (let idx = 0; idx < count; idx++) {
|
|
124
|
+
items.unshift(this.dataStack.pop());
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
let node = new AST.ASTMapUnpack(items);
|
|
127
|
+
node.line = this.code.Current.LineNo;
|
|
128
|
+
this.dataStack.push(node);
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "depyo",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Python bytecode decompiler (Python 1.0–3.
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Python bytecode decompiler (Python 1.0–3.15) implemented in Node.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"depyo": "./depyo.js"
|
|
7
7
|
},
|