Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Jan 21, 2024
1 parent eafca5f commit 6070d55
Show file tree
Hide file tree
Showing 32 changed files with 6,246 additions and 2,951 deletions.
8 changes: 3 additions & 5 deletions _pydevd_bundle/pydevd_bytecode_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

from _pydev_bundle import pydev_log
from types import CodeType
from _pydevd_frame_eval.vendored.bytecode.instr import _Variable, TryBegin, \
TryEnd, Label
from _pydevd_frame_eval.vendored.bytecode.instr import _Variable, Label
from _pydevd_frame_eval.vendored import bytecode
from _pydevd_frame_eval.vendored.bytecode import cfg as bytecode_cfg
import dis
Expand Down Expand Up @@ -739,8 +738,7 @@ def _get_smart_step_into_targets(code):
:return list(Target)
'''
b = bytecode.Bytecode.from_code(code)
# cfg = bytecode_cfg.ControlFlowGraph.from_bytecode(b)
cfg = [b]
cfg = bytecode_cfg.ControlFlowGraph.from_bytecode(b)

ret = []

Expand All @@ -749,7 +747,7 @@ def _get_smart_step_into_targets(code):
print('\nStart block----')
stack = _StackInterpreter(block)
for instr in block:
if isinstance(instr, (TryBegin, TryEnd, Label)):
if isinstance(instr, (Label,)):
# No name for these
continue
try:
Expand Down
2 changes: 1 addition & 1 deletion _pydevd_frame_eval/vendored/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pip install bytecode --target .

or from master (if needed for some early bugfix):

python -m pip install git+https://github.com/MatthieuDartiailh/bytecode.git --target .
python -m pip install https://github.com/MatthieuDartiailh/bytecode/archive/main.zip --target .

Then run 'pydevd_fix_code.py' to fix the imports on the vendored file, run its tests (to see
if things are still ok) and commit.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright Contributors to the bytecode project.
Copyright (c) 2016 Red Hat.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Metadata-Version: 2.1
Name: bytecode
Version: 0.13.0.dev0
Summary: Python module to generate and modify bytecode
Home-page: https://github.com/MatthieuDartiailh/bytecode
Author: Victor Stinner
Author-email: [email protected]
Maintainer: Matthieu C. Dartiailh
Maintainer-email: [email protected]
License: MIT license
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6

********
bytecode
********

.. image:: https://img.shields.io/pypi/v/bytecode.svg
:alt: Latest release on the Python Cheeseshop (PyPI)
:target: https://pypi.python.org/pypi/bytecode

.. image:: https://github.com/MatthieuDartiailh/bytecode/workflows/Continuous%20Integration/badge.svg
:target: https://github.com/MatthieuDartiailh/bytecode/actions
:alt: Continuous integration

.. image:: https://github.com/MatthieuDartiailh/bytecode/workflows/Documentation%20building/badge.svg
:target: https://github.com/MatthieuDartiailh/bytecode/actions
:alt: Documentation building

.. image:: https://img.shields.io/codecov/c/github/MatthieuDartiailh/bytecode/master.svg
:alt: Code coverage of bytecode on codecov.io
:target: https://codecov.io/github/MatthieuDartiailh/bytecode

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:alt: Code formatted using Black
:target: https://github.com/psf/black

``bytecode`` is a Python module to generate and modify bytecode.

* `bytecode project homepage at GitHub
<https://github.com/MatthieuDartiailh/bytecode>`_ (code, bugs)
* `bytecode documentation
<https://bytecode.readthedocs.io/>`_
* `Download latest bytecode release at the Python Cheeseshop (PyPI)
<https://pypi.python.org/pypi/bytecode>`_

Install bytecode: ``python3 -m pip install bytecode``. It requires Python 3.6
or newer. The latest release that supports Python 3.5 is 0.12.0. For Python 2.7
support, have a look at `dead-bytecode
<https://github.com/p403n1x87/dead-bytecode>`_ instead.

Example executing ``print('Hello World!')``:

.. code:: python

from bytecode import Instr, Bytecode

bytecode = Bytecode([Instr("LOAD_NAME", 'print'),
Instr("LOAD_CONST", 'Hello World!'),
Instr("CALL_FUNCTION", 1),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE")])
code = bytecode.to_code()
exec(code)

42 changes: 42 additions & 0 deletions _pydevd_frame_eval/vendored/bytecode-0.13.0.dev0.dist-info/RECORD
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
bytecode-0.13.0.dev0.dist-info/COPYING,sha256=baWkm-Te2LLURwK7TL0zOkMSVjVCU_ezvObHBo298Tk,1074
bytecode-0.13.0.dev0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
bytecode-0.13.0.dev0.dist-info/METADATA,sha256=9XadDK6YTQ-FPowYI5DS4ieA7hRGnRP_fM5Z9ioPkEQ,2929
bytecode-0.13.0.dev0.dist-info/RECORD,,
bytecode-0.13.0.dev0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
bytecode-0.13.0.dev0.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
bytecode-0.13.0.dev0.dist-info/direct_url.json,sha256=s58Rb4KXRlMKxk-mzpvr_tJRQ-Hx8-DHsU6NdohCnAg,93
bytecode-0.13.0.dev0.dist-info/top_level.txt,sha256=9BhdB7HqYZ-PvHNoWX6ilwLYWQqcgEOLwdb3aXm5Gys,9
bytecode/__init__.py,sha256=d-yk4Xh4SwOWq9NgoD2rmBLG6RhUFNljeqs-NjMNSYM,3885
bytecode/__pycache__/__init__.cpython-38.pyc,,
bytecode/__pycache__/bytecode.cpython-38.pyc,,
bytecode/__pycache__/cfg.cpython-38.pyc,,
bytecode/__pycache__/concrete.cpython-38.pyc,,
bytecode/__pycache__/flags.cpython-38.pyc,,
bytecode/__pycache__/instr.cpython-38.pyc,,
bytecode/__pycache__/peephole_opt.cpython-38.pyc,,
bytecode/bytecode.py,sha256=IMCcatHMtQ7M31nwj4r3drcvQuGVJAOP0d7C0O8P_SE,6894
bytecode/cfg.py,sha256=RmJGJqwCxR-XYaPH9YGY4wNDycdtLvIBJb1OGSmxcN0,15274
bytecode/concrete.py,sha256=0eb6Yh_NDLmzJNcMs2TFom0EqFVSM1cO3inMH90YE-s,21683
bytecode/flags.py,sha256=hAvM_B2yQKRw44leHP0oCae0aaJraAbDDTpqIf4I1CM,5987
bytecode/instr.py,sha256=HYc65LjNSOB3GCWkNkCSkee1rRzUyr89rgdjbKBaTpE,11616
bytecode/peephole_opt.py,sha256=W-cFVPOZN-JKfDV3aImsYenDSZkSNBDTVQqeMrGPU18,15712
bytecode/tests/__init__.py,sha256=BAdOXXNRdMVX4D8TuRYPlG9PHU7Cb0bzvyfA9s435kM,4968
bytecode/tests/__pycache__/__init__.cpython-38.pyc,,
bytecode/tests/__pycache__/test_bytecode.cpython-38.pyc,,
bytecode/tests/__pycache__/test_cfg.cpython-38.pyc,,
bytecode/tests/__pycache__/test_code.cpython-38.pyc,,
bytecode/tests/__pycache__/test_concrete.cpython-38.pyc,,
bytecode/tests/__pycache__/test_flags.cpython-38.pyc,,
bytecode/tests/__pycache__/test_instr.cpython-38.pyc,,
bytecode/tests/__pycache__/test_misc.cpython-38.pyc,,
bytecode/tests/__pycache__/test_peephole_opt.cpython-38.pyc,,
bytecode/tests/__pycache__/util_annotation.cpython-38.pyc,,
bytecode/tests/test_bytecode.py,sha256=buvtlDC0NwoQ3zuZ7OENIIDngSqtiO9WkAa2-UvxGkI,15584
bytecode/tests/test_cfg.py,sha256=c0xT8OfV-mDHu-DIDWr6LVlZQyK4GfgLSmT5AsodbMk,28194
bytecode/tests/test_code.py,sha256=XCOH29rOXSoQz130s-AIC62r23e9qNjk8Y2xDB2LmSc,2100
bytecode/tests/test_concrete.py,sha256=qT2qvabkF0yC7inniNx53cMSDN-2Qi0IE3pwBZSzF8g,49253
bytecode/tests/test_flags.py,sha256=DY9U3c6tJdxJFm0jEm_To1Cc0I99EidQv_0guud-4oE,5684
bytecode/tests/test_instr.py,sha256=rYeF8u-L0aW8bLPBxTUSy_T7KP6SaXyJKv9OhC8k6aA,11295
bytecode/tests/test_misc.py,sha256=wyK1wpVPHRfaXgo-EqUI-F1nyB9-UACerHsHbExAo1U,6758
bytecode/tests/test_peephole_opt.py,sha256=niUfhgEbiFR7IAmdQ_N9Qgh7D3wdRQ_zS0V8mKC4EzI,32640
bytecode/tests/util_annotation.py,sha256=wKq6yPWrzkNlholl5Y10b3VjuCkoiYVgvcIjk_8jzf8,485
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.42.0)
Generator: bdist_wheel (0.36.2)
Root-Is-Purelib: true
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"archive_info": {}, "url": "https://github.com/MatthieuDartiailh/bytecode/archive/main.zip"}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6070d55

Please sign in to comment.