From 58d50de9a2e891490d1ee3a90ee2d84aa7153cd8c81e47894b6083d022493032 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 10 Sep 2025 09:11:29 +0000 Subject: [PATCH] - Update to 0.17.0 * Add support for Python 3.14 PR #166 Support for Python 3.14, comes with a number of changes reflecting changes in CPython bytecode itself: - introduced an enum for BINARY_OP argument which now supports subscribe. When disassembling the enum is always used, when creating bytecode from scratch integer values are coerced into the right enum member. - support BUILD_TEMPLATE, BUILD_INTERPOLATION, LOAD_SMALL_INT, LOAD_FAST_BORROW and LOAD_FAST_BORROW_LOAD_FAST_BORROW - LOAD_COMMON_CONSTANT, LOAD_SPECIAL whose argument is described using dedicated enums CommonConstant, SpecialMethod - CONVERT_VALUE (FORMAT_VALUE in Python < 3.13) now use the FormatValue enum. When disassembling the enum is always used, when creating bytecode from scratch integer values are coerced into the right enum member. * properly set the next_block attribute of the new block created by ControlFlowGraph.split_block. PR #170 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bytecode?expand=0&rev=27 --- .gitattributes | 23 ++++++ .gitignore | 1 + bytecode-0.17.0.tar.gz | 3 + python-bytecode.changes | 168 ++++++++++++++++++++++++++++++++++++++++ python-bytecode.spec | 62 +++++++++++++++ 5 files changed, 257 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 bytecode-0.17.0.tar.gz create mode 100644 python-bytecode.changes create mode 100644 python-bytecode.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/bytecode-0.17.0.tar.gz b/bytecode-0.17.0.tar.gz new file mode 100644 index 0000000..3dbd099 --- /dev/null +++ b/bytecode-0.17.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c37efa5bd158b1b873f530cceea2c645611d55bd2dc2a4758b09f185749b6fd +size 105863 diff --git a/python-bytecode.changes b/python-bytecode.changes new file mode 100644 index 0000000..d7073c2 --- /dev/null +++ b/python-bytecode.changes @@ -0,0 +1,168 @@ +------------------------------------------------------------------- +Wed Sep 10 06:59:32 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 0.17.0 + * Add support for Python 3.14 PR #166 + Support for Python 3.14, comes with a number of changes reflecting changes in + CPython bytecode itself: + - introduced an enum for BINARY_OP argument which now supports subscribe. + When disassembling the enum is always used, when creating bytecode from + scratch integer values are coerced into the right enum member. + - support BUILD_TEMPLATE, BUILD_INTERPOLATION, LOAD_SMALL_INT, LOAD_FAST_BORROW + and LOAD_FAST_BORROW_LOAD_FAST_BORROW + - LOAD_COMMON_CONSTANT, LOAD_SPECIAL whose argument is described using dedicated + enums CommonConstant, SpecialMethod + - CONVERT_VALUE (FORMAT_VALUE in Python < 3.13) now use the FormatValue enum. + When disassembling the enum is always used, when creating bytecode from + scratch integer values are coerced into the right enum member. + * properly set the next_block attribute of the new block created by + ControlFlowGraph.split_block. PR #170 + +------------------------------------------------------------------- +Tue May 6 10:22:56 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 0.16.2 + * fix ControlFlowGraph dead block detection by accounting for + fall-through edges. PR #161 + +------------------------------------------------------------------- +Mon Feb 3 13:33:39 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 0.16.1 + * Minor fixes following linter recommendations by @MatthieuDartiailh in #154 + * build(deps): bump codecov/codecov-action from 4 to 5 by @dependabot in #153 + * Fix flag inference by @MatthieuDartiailh in #157 + +------------------------------------------------------------------- +Fri Nov 1 08:33:19 UTC 2024 - Steve Kowalik + +- Update to 0.16.0: + * Fix the document for python3.12 by @colinxu2020 in #142 + * fix: handle small try blocks by @P403n1x87 in #145 + * Add support for Python 3.13 by @MatthieuDartiailh in #146 + +------------------------------------------------------------------- +Wed Aug 14 15:03:42 UTC 2024 - Dirk Müller + +- use modern python on sle15 +- switch to PEP517 build + +------------------------------------------------------------------- +Tue Nov 14 15:47:28 UTC 2023 - Dirk Müller + +- update to 0.15.1: + * Disallow creating an instruction targeting a + pseudo/instrumented opcode PR #133 + * Fixes encoding of 0 as a varint PR #132 + * Correct spelling of "INTRINSIC" in several places; this + affected some ops in Python 3.12. PR #131 + +------------------------------------------------------------------- +Mon Sep 18 10:14:40 UTC 2023 - Dirk Müller + +- update to 0.15.0: + * Add support for Python 3.12 PR #122 + * Support for Python 3.12, comes with a number of changes + reflecting changes in CPython bytecode itself: + * handle the ability of ``LOAD_ATTR`` to replace + ``LOAD_METHOD`` + As a consequence the argument is now a ``tuple[bool, str]`` + similarly ``LOAD_SUPER_ATTR`` which uses the 2 lowest bits as + flag takes a ``tuple[bool, bool, str]`` as argument + * ``POP_JUMP_IF_*`` instructions are undirected in Python 3.12 + * ``YIELD_VALUE`` now takes an argument + * Support for ``CALL_INSTRINSIC_1/2`` led to the addition of 2 + new enums to represent the argument + +------------------------------------------------------------------- +Sat May 27 21:36:54 UTC 2023 - Dirk Müller + +- update to 0.14.2: + * allow to convert a CFG, for which stack sizes have not been + computed, to Bytecode even in the presence of mergeable + TryBegin/TryEnd + * remove spurious TryEnd leftover when going from CFG to + Bytecode + +------------------------------------------------------------------- +Wed Apr 19 09:32:16 UTC 2023 - Dirk Müller + +- update to 0.14.1: + * allow to disassemble code containing ``EXTENDED_ARG`` + targeting a ``NOP`` PR #117 + +------------------------------------------------------------------- +Thu Dec 15 22:44:00 UTC 2022 - Ben Greiner + +- Fix dependencies +- Fix python-sitelib-glob-in-files and 0.0.0 version egg-info by + not forgetting setuptools_scm + +------------------------------------------------------------------- +Fri Dec 9 17:16:11 UTC 2022 - Yogalakshmi Arunachalam + +- Update to 0.14.0 + * New features: + Removed the peephole optimizer PR #107 + Basically changes in Python 3.11 made it hard to port and the maintenance cost exceeded the perceived use. It could be re-added if there is a demand for it. + Add support for Python 3.11 PR #107 + Support for Python 3.11, comes with a number of changes reflecting changes in CPython bytecode itself: + support for the exception table in ConcreteBytecode + support for pseudo-instruction TryBegin and TryEnd describing the exception table in Bytecode and ControlflowGraph + new keyword arguments in conversion method related to computations required for the exception table + handling of CACHE opcode at the ConcreteBytecode level + handling of the ability of LOAD_GLOBAL to push NULL (the argument is now a tuple[bool, str]) + support for end_lineno and column offsets in instructions + support for co_qualname (as qualname on bytecode objects) + and a number of internal changes related to changes in the internal bytecode representation. + Add type annotations and make types stricter PR # 105 In particular, ConcreteInstr does not inherit from Instr anymore and one cannot + use ConcreteInstr in Bytecode object. This is saner than before. + * Bugfixes: + Removed EXC_MATCH from the Compare enumeration starting with Python 3.9. The new JUMP_IF_NOT_EXC_MATCH opcode should be used instead. + Removed IN, NOT_IN, IS, NOT_IS from the Compare enumeration starting with Python 3.9. The new CONTAINS_OP and IS_OP opcodes should be used instead. + Add proper pre and post stack effects to all opcodes (up to Python 3.11) PR #106 #107 + * Maintenance: + Make the install process PEP517 compliant PR #97 + Drop support for Python 3.6 and 3.7 PR #100 + +------------------------------------------------------------------- +Thu Nov 18 11:47:11 UTC 2021 - John Paul Adrian Glaubitz + +- Update to 0.13.0 + * Add support for Python 3.10 new encoding of line number. This support is + minimal in the sense that we still systematically assign a line number + while the new format allow bytecode with absolutely no line number. PR #72 + * Fix handling of RERAISE (introduced in 3.9) when creating a ControlFlowGraph, + previously it was not considered final. PR #72 + * Fix line table assembly in Python 3.10. PR #85 + +------------------------------------------------------------------- +Tue Aug 31 11:04:29 UTC 2021 - John Paul Adrian Glaubitz + +- Update to 0.12.0 + * All calculations of stacksize now check for stack underflow to + avoid segfault at runtime PR #69 + * Fix recursion limitations when compiling bytecode with numerous basic + blocks. PR #57 + * Fix handling of line offsets. Issue #67, PR #71 + * Forbid an :class:`Instr` to hold an EXTENDED_ARG op_code PR #65 + * Forbid the use of :class:`ConcreteInstr` in :class:`Bytecode` and + :class:`ControlFlowGraph` PR #65 + This is motivated by the extra complexity that handling possible EXTENDED_ARG + instruction in those representation would bring (stack computation, etc) + * Always remove EXTENDED_ARG when converting :class:`ConcreteBytecode` to + :class:`Bytecode` PR #65 + * This is equivalent to say that the :class:`ConcreteBytecode` converted to + :class:`Bytecode` was generated by :meth:`ConcreteBytecode.from_code` + with extended_args=False + * :class:`Instr` now has a new method :meth:`Instr.pre_and_post_stack_effect` + for checking the prerequisite stack size of an operation PR #69 + * :meth:`_compute_stack_size` now uses :meth:`Instr.pre_and_post_stack_effect` + to compute the stack size to reject code that will lead to runtime segfault + caused by stack underflow PR #69 + +------------------------------------------------------------------- +Thu Apr 9 11:29:55 UTC 2020 - pgajdos@suse.com + +- initial version 0.11.0, required by python-enaml + diff --git a/python-bytecode.spec b/python-bytecode.spec new file mode 100644 index 0000000..f999a61 --- /dev/null +++ b/python-bytecode.spec @@ -0,0 +1,62 @@ +# +# spec file for package python-bytecode +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-bytecode +Version: 0.17.0 +Release: 0 +Summary: Python module to generate and modify bytecode +License: MIT +URL: https://github.com/vstinner/bytecode +Source: https://files.pythonhosted.org/packages/source/b/bytecode/bytecode-%{version}.tar.gz +BuildRequires: %{python_module base >= 3.8} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +# /SECTION +%python_subpackages + +%description +Python module to generate and modify bytecode + +%prep +%setup -q -n bytecode-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.rst +%license COPYING +%{python_sitelib}/bytecode +%{python_sitelib}/bytecode-%{version}.dist-info + +%changelog