unidecompiler-plugin-python-pyc 0.1.3__tar.gz → 0.1.4__tar.gz

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.
Files changed (17) hide show
  1. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/PKG-INFO +2 -2
  2. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/pyproject.toml +2 -2
  3. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/lifter.py +65 -19
  4. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc.egg-info/PKG-INFO +2 -2
  5. unidecompiler_plugin_python_pyc-0.1.4/src/unidecompiler_plugin_python_pyc.egg-info/requires.txt +1 -0
  6. unidecompiler_plugin_python_pyc-0.1.3/src/unidecompiler_plugin_python_pyc.egg-info/requires.txt +0 -1
  7. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/README.md +0 -0
  8. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/setup.cfg +0 -0
  9. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/__init__.py +0 -0
  10. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/plugin.py +0 -0
  11. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/pyc.py +0 -0
  12. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/simulation.py +0 -0
  13. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc/support.py +0 -0
  14. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc.egg-info/SOURCES.txt +0 -0
  15. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc.egg-info/dependency_links.txt +0 -0
  16. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc.egg-info/entry_points.txt +0 -0
  17. {unidecompiler_plugin_python_pyc-0.1.3 → unidecompiler_plugin_python_pyc-0.1.4}/src/unidecompiler_plugin_python_pyc.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unidecompiler-plugin-python-pyc
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Python bytecode frontend plugin for unidecompiler
5
5
  Author-email: Wker <1670133844@qq.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/Wker666/unidecompiler
9
9
  Project-URL: Issues, https://github.com/Wker666/unidecompiler/issues
10
10
  Requires-Python: >=3.11
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: unidecompiler<0.2.0,>=0.1.6
12
+ Requires-Dist: unidecompiler<0.2.0,>=0.1.9
13
13
 
14
14
  # unidecompiler-plugin-python-pyc
15
15
 
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "unidecompiler-plugin-python-pyc"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Python bytecode frontend plugin for unidecompiler"
9
9
  readme = "README.md"
10
10
  license = "AGPL-3.0-or-later"
11
11
  authors = [{ name = "Wker", email = "1670133844@qq.com" }]
12
12
  requires-python = ">=3.11"
13
- dependencies = ["unidecompiler>=0.1.6,<0.2.0"]
13
+ dependencies = ["unidecompiler>=0.1.9,<0.2.0"]
14
14
 
15
15
  [project.urls]
16
16
  Homepage = "https://github.com/Wker666/unidecompiler"
@@ -13,6 +13,10 @@ from unidecompiler.core.effects import (
13
13
  BuildArrayCall,
14
14
  CallTopAs,
15
15
  Copy,
16
+ DeleteAttr,
17
+ DeleteGlobal,
18
+ DeleteItem,
19
+ DeleteLocal,
16
20
  DropBelowTop,
17
21
  Effect,
18
22
  Compare,
@@ -42,6 +46,7 @@ from unidecompiler.core.effects import (
42
46
  ReturnTop,
43
47
  ReturnVoid,
44
48
  StoreAttr,
49
+ StoreGlobal,
45
50
  StoreLocal,
46
51
  StoreMany,
47
52
  StoreManyFromPopOrder,
@@ -101,6 +106,10 @@ BINARY_SYMBOLS = {
101
106
  "-=": "-",
102
107
  "*": "*",
103
108
  "*=": "*",
109
+ "**": "**",
110
+ "**=": "**",
111
+ "@": "@",
112
+ "@=": "@",
104
113
  "/": "/",
105
114
  "/=": "/",
106
115
  "//": "//",
@@ -188,8 +197,7 @@ def _load_build_class(_context, _instruction, source: SourceRef) -> tuple[Effect
188
197
 
189
198
  def _import_name(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
190
199
  return (
191
- Pop(source=source, count=2, allow_missing=True),
192
- Push(source=source, value=Global(name=str(instruction.argval), source=source)),
200
+ BuildCall(source=source, callee=Global(name=f"__import__:{instruction.argval}", source=source), arg_count=2, returns=1),
193
201
  )
194
202
 
195
203
 
@@ -217,6 +225,14 @@ def _load_local(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
217
225
  return (LoadLocal(source=source, name=name, fallback=Var(name=name, source=source)),)
218
226
 
219
227
 
228
+ def _load_and_clear_local(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
229
+ name = str(instruction.argval)
230
+ return (
231
+ LoadLocal(source=source, name=name, fallback=Var(name=name, source=source)),
232
+ DeleteLocal(source=source, name=name),
233
+ )
234
+
235
+
220
236
  def _load_closure(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
221
237
  name = str(instruction.argval)
222
238
  return (Push(source=source, value=CapturedVar(name=name, source=source)),)
@@ -241,12 +257,25 @@ def _load_global(_context, instruction, source: SourceRef) -> tuple[Effect, ...]
241
257
 
242
258
  def _load_from_dict_or_globals(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
243
259
  name = str(instruction.argval)
260
+ return (BuildCall(source=source, callee=Global(name=f"load_from_dict_or_globals:{name}", source=source), arg_count=1, returns=1),)
261
+
262
+
263
+ def _call_intrinsic_1(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
264
+ return (CallTopAs(source=source, callee_name=str(instruction.argval or instruction.argrepr or "intrinsic")),)
265
+
266
+
267
+ def _before_with(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
268
+ name = "before_async_with" if "ASYNC" in instruction.opname else "before_with"
244
269
  return (
245
- Pop(source=source, count=1, allow_missing=True),
246
- Push(source=source, value=Global(name=name, source=source)),
270
+ BuildCall(source=source, callee=Global(name=name, source=source), arg_count=1, returns=1),
271
+ Unpack(source=source, count=2),
247
272
  )
248
273
 
249
274
 
275
+ def _set_function_attribute(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
276
+ return (BuildCall(source=source, callee=Global(name=f"set_function_attribute:{instruction.argval or instruction.argrepr}", source=source), arg_count=2, returns=1),)
277
+
278
+
250
279
  def _make_function(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
251
280
  return (MakeFunctionValue(source=source, fallback_name=str(instruction.argval or instruction.argrepr or "<function>")),)
252
281
 
@@ -322,7 +351,7 @@ def _unary(op: str):
322
351
 
323
352
  def _store_global(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
324
353
  name = str(instruction.argval)
325
- return (StoreLocal(source=source, name=name, target=Var(name=name, source=source), materialize=False),)
354
+ return (StoreGlobal(source=source, name=name),)
326
355
 
327
356
 
328
357
  def _store_deref(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
@@ -337,16 +366,32 @@ def _store_deref(_context, instruction, source: SourceRef) -> tuple[Effect, ...]
337
366
  )
338
367
 
339
368
 
340
- def _delete_global(_context, _instruction, source: SourceRef) -> tuple[Effect, ...]:
341
- return (Pop(source=source, count=1, allow_missing=True),)
369
+ def _delete_local(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
370
+ name = str(instruction.argval)
371
+ return (DeleteLocal(source=source, name=name),)
342
372
 
343
373
 
344
- def _delete_attr(_context, _instruction, source: SourceRef) -> tuple[Effect, ...]:
345
- return (Pop(source=source, count=1, allow_missing=True),)
374
+ def _delete_deref(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
375
+ name = str(instruction.argval)
376
+ return (
377
+ DeleteLocal(
378
+ source=source,
379
+ name=name,
380
+ target=CapturedVar(name=name, source=source),
381
+ ),
382
+ )
383
+
384
+
385
+ def _delete_global(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
386
+ return (DeleteGlobal(source=source, name=str(instruction.argval)),)
387
+
388
+
389
+ def _delete_attr(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
390
+ return (DeleteAttr(source=source, attr=str(instruction.argval)),)
346
391
 
347
392
 
348
393
  def _delete_subscr(_context, _instruction, source: SourceRef) -> tuple[Effect, ...]:
349
- return (Pop(source=source, count=2, allow_missing=True),)
394
+ return (DeleteItem(source=source),)
350
395
 
351
396
 
352
397
  def _build_slice(_context, instruction, source: SourceRef) -> tuple[Effect, ...]:
@@ -532,24 +577,17 @@ PYTHON_EFFECT_TABLE = VMEffectTable(
532
577
  "JUMP_NO_INTERRUPT",
533
578
  "INSTRUMENTED_JUMP_BACKWARD",
534
579
  "INSTRUMENTED_JUMP_FORWARD",
535
- "CALL_INTRINSIC_1",
536
- "BEFORE_WITH",
537
580
  "CLEANUP_THROW",
538
581
  "CHECK_EG_MATCH",
539
582
  "END_ASYNC_FOR",
540
583
  "LOOKUP_METHOD",
541
584
  "PUSH_EXC_INFO",
542
585
  "WITH_EXCEPT_START",
543
- "DELETE_FAST",
544
- "DELETE_NAME",
545
- "DELETE_DEREF",
546
- "DELETE_GLOBAL",
547
586
  "ENTER_EXECUTOR",
548
587
  "EXIT_INIT_CHECK",
549
588
  "INSTRUMENTED_INSTRUCTION",
550
589
  "INSTRUMENTED_LINE",
551
590
  "INSTRUMENTED_RESUME",
552
- "INTERPRETER_EXIT",
553
591
  "POP_BLOCK",
554
592
  "RESERVED",
555
593
  "SETUP_CLEANUP",
@@ -570,12 +608,15 @@ PYTHON_EFFECT_TABLE = VMEffectTable(
570
608
  "LOAD_CLOSURE": _load_closure,
571
609
  "LOAD_FAST": _load_local,
572
610
  "LOAD_FAST_CHECK": _load_local,
573
- "LOAD_FAST_AND_CLEAR": _load_local,
611
+ "LOAD_FAST_AND_CLEAR": _load_and_clear_local,
574
612
  "LOAD_FAST_LOAD_FAST": _load_fast_pair,
575
613
  "LOAD_FROM_DICT_OR_GLOBALS": _load_from_dict_or_globals,
576
614
  "LOAD_GLOBAL": _load_global,
577
615
  "MAKE_FUNCTION": _make_function,
578
616
  "STORE_GLOBAL": _store_global,
617
+ "DELETE_FAST": _delete_local,
618
+ "DELETE_NAME": _delete_local,
619
+ "DELETE_DEREF": _delete_deref,
579
620
  "DELETE_GLOBAL": _delete_global,
580
621
  "DELETE_ATTR": _delete_attr,
581
622
  "DELETE_SUBSCR": _delete_subscr,
@@ -588,7 +629,12 @@ PYTHON_EFFECT_TABLE = VMEffectTable(
588
629
  "CALL_FUNCTION_EX": _call_function_ex,
589
630
  "INSTRUMENTED_CALL_FUNCTION_EX": _call_function_ex,
590
631
  "LOAD_LOCALS": _load_locals,
591
- "SET_FUNCTION_ATTRIBUTE": lambda _context, _instruction, source: (DropBelowTop(source=source, count=1),),
632
+ "SET_FUNCTION_ATTRIBUTE": _set_function_attribute,
633
+ "CALL_INTRINSIC_1": _call_intrinsic_1,
634
+ "BEFORE_WITH": _before_with,
635
+ "BEFORE_ASYNC_WITH": _before_with,
636
+ "EXIT_INIT_CHECK": lambda _context, _instruction, source: (BuildCall(source=source, callee=Global(name="exit_init_check", source=source), arg_count=1, returns=0),),
637
+ "INTERPRETER_EXIT": lambda _context, _instruction, source: (ReturnTop(source=source),),
592
638
  "COPY": _copy,
593
639
  "SWAP": _swap,
594
640
  "LOAD_ATTR": _load_attr,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unidecompiler-plugin-python-pyc
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Python bytecode frontend plugin for unidecompiler
5
5
  Author-email: Wker <1670133844@qq.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/Wker666/unidecompiler
9
9
  Project-URL: Issues, https://github.com/Wker666/unidecompiler/issues
10
10
  Requires-Python: >=3.11
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: unidecompiler<0.2.0,>=0.1.6
12
+ Requires-Dist: unidecompiler<0.2.0,>=0.1.9
13
13
 
14
14
  # unidecompiler-plugin-python-pyc
15
15