From 7daebc87d57e77ea1e1646d3f4a7701b5e55ad87 Mon Sep 17 00:00:00 2001
From: Julian Gilbey <jdg@debian.org>
Date: Thu, 12 Oct 2023 17:23:57 +0100
Subject: [PATCH] New upstream version; update patch and add new INSTRINSIC
 patch

---
 debian/changelog                              |  7 ++
 .../patches/Fix-spelling-of-INTRINSIC.patch   | 99 +++++++++++++++++++
 .../pydevd-add-offset-to-instructions.patch   | 22 ++---
 debian/patches/series                         |  1 +
 4 files changed, 118 insertions(+), 11 deletions(-)
 create mode 100644 debian/patches/Fix-spelling-of-INTRINSIC.patch

diff --git a/debian/changelog b/debian/changelog
index c98b6b2..9dba631 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-bytecode (0.15.0-1) unstable; urgency=medium
+
+  * New upstream version 0.15.0
+  * Add patch to fix spelling of "INTRINSIC"
+
+ -- Julian Gilbey <jdg@debian.org>  Thu, 12 Oct 2023 17:23:45 +0100
+
 python-bytecode (0.14.2-1) unstable; urgency=medium
 
   * New upstream version
diff --git a/debian/patches/Fix-spelling-of-INTRINSIC.patch b/debian/patches/Fix-spelling-of-INTRINSIC.patch
new file mode 100644
index 0000000..8d07652
--- /dev/null
+++ b/debian/patches/Fix-spelling-of-INTRINSIC.patch
@@ -0,0 +1,99 @@
+From: Julian Gilbey <jdg@debian.org>
+Subject: Fix spelling of INTRINSIC
+Last-Update: 2023-10-12
+Forwarded: https://github.com/MatthieuDartiailh/bytecode/pull/131
+
+---
+ doc/api.rst           | 12 ++++++------
+ doc/changelog.rst     |  2 +-
+ src/bytecode/instr.py |  8 ++++----
+ tests/test_instr.py   |  2 +-
+ 4 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/doc/api.rst b/doc/api.rst
+index cf91ba8..db54cae 100644
+--- a/doc/api.rst
++++ b/doc/api.rst
+@@ -351,11 +351,11 @@ Intrinsic operations
+ 
+ .. class:: Intrinsic1Op
+ 
+-   Enum for the argument of the ``CALL_INSTRINSIC_1`` instruction (3.12+).
++   Enum for the argument of the ``CALL_INTRINSIC_1`` instruction (3.12+).
+ 
+-   ``INSTRINSIC_1_INVALID``
+-   ``INSTRINSIC_PRINT``
+-   ``INSTRINSIC_IMPORT_STAR``
++   ``INTRINSIC_1_INVALID``
++   ``INTRINSIC_PRINT``
++   ``INTRINSIC_IMPORT_STAR``
+    ``INTRINSIC_STOPITERATION_ERROR``
+    ``INTRINSIC_ASYNC_GEN_WRAP``
+    ``INTRINSIC_UNARY_POSITIVE``
+@@ -368,9 +368,9 @@ Intrinsic operations
+ 
+ .. class:: Intrinsic2Op
+ 
+-   Enum for the argument of the ``CALL_INSTRINSIC_2`` instruction (3.12+).
++   Enum for the argument of the ``CALL_INTRINSIC_2`` instruction (3.12+).
+ 
+-   ``INSTRINSIC_2_INVALID``
++   ``INTRINSIC_2_INVALID``
+    ``INTRINSIC_PREP_RERAISE_STAR``
+    ``INTRINSIC_TYPEVAR_WITH_BOUND``
+    ``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``
+diff --git a/doc/changelog.rst b/doc/changelog.rst
+index 01a1950..f252f50 100644
+--- a/doc/changelog.rst
++++ b/doc/changelog.rst
+@@ -17,7 +17,7 @@ New features:
+     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
++  - Support for ``CALL_INTRINSIC_1/2`` led to the addition of 2 new enums to
+     represent the argument
+ 
+ 2023-05-24: Version 0.14.2
+diff --git a/src/bytecode/instr.py b/src/bytecode/instr.py
+index f65e5af..95e1c43 100644
+--- a/src/bytecode/instr.py
++++ b/src/bytecode/instr.py
+@@ -104,9 +104,9 @@ class BinaryOp(enum.IntEnum):
+ 
+ @enum.unique
+ class Intrinsic1Op(enum.IntEnum):
+-    INSTRINSIC_1_INVALID = 0
+-    INSTRINSIC_PRINT = 1
+-    INSTRINSIC_IMPORT_STAR = 2
++    INTRINSIC_1_INVALID = 0
++    INTRINSIC_PRINT = 1
++    INTRINSIC_IMPORT_STAR = 2
+     INTRINSIC_STOPITERATION_ERROR = 3
+     INTRINSIC_ASYNC_GEN_WRAP = 4
+     INTRINSIC_UNARY_POSITIVE = 5
+@@ -120,7 +120,7 @@ class Intrinsic1Op(enum.IntEnum):
+ 
+ @enum.unique
+ class Intrinsic2Op(enum.IntEnum):
+-    INSTRINSIC_2_INVALID = 0
++    INTRINSIC_2_INVALID = 0
+     INTRINSIC_PREP_RERAISE_STAR = 1
+     INTRINSIC_TYPEVAR_WITH_BOUND = 2
+     INTRINSIC_TYPEVAR_WITH_CONSTRAINTS = 3
+diff --git a/tests/test_instr.py b/tests/test_instr.py
+index d36c315..4952ab2 100644
+--- a/tests/test_instr.py
++++ b/tests/test_instr.py
+@@ -208,7 +208,7 @@ class InstrTests(TestCase):
+ 
+         for name in [opcode.opname[i] for i in INTRINSIC_1OP]:
+             self.assertRaises(TypeError, Instr, name, 1)
+-            Instr(name, Intrinsic1Op.INSTRINSIC_PRINT)
++            Instr(name, Intrinsic1Op.INTRINSIC_PRINT)
+ 
+         for name in [opcode.opname[i] for i in INTRINSIC_2OP]:
+             self.assertRaises(TypeError, Instr, name, 1)
+-- 
+2.42.0
+
diff --git a/debian/patches/pydevd-add-offset-to-instructions.patch b/debian/patches/pydevd-add-offset-to-instructions.patch
index e810d88..051b74d 100644
--- a/debian/patches/pydevd-add-offset-to-instructions.patch
+++ b/debian/patches/pydevd-add-offset-to-instructions.patch
@@ -15,7 +15,7 @@ Forwarded: not-needed
 
 --- a/src/bytecode/concrete.py
 +++ b/src/bytecode/concrete.py
-@@ -72,7 +72,7 @@
+@@ -79,7 +79,7 @@
      # For ConcreteInstr the argument is always an integer
      _arg: int
  
@@ -24,7 +24,7 @@ Forwarded: not-needed
  
      def __init__(
          self,
-@@ -82,12 +82,14 @@
+@@ -89,12 +89,14 @@
          lineno: Union[int, None, _UNSET] = UNSET,
          location: Optional[InstrLocation] = None,
          extended_args: Optional[int] = None,
@@ -39,8 +39,8 @@ Forwarded: not-needed
 +        super().__init__(name, arg, lineno=lineno, location=location, offset=offset)
  
      def _check_arg(self, name: str, opcode: int, arg: int) -> None:
-         if opcode >= _opcode.HAVE_ARGUMENT:
-@@ -161,7 +163,11 @@
+         if opcode_has_argument(opcode):
+@@ -174,7 +176,11 @@
          else:
              arg = UNSET
          name = _opcode.opname[op]
@@ -51,9 +51,9 @@ Forwarded: not-needed
 +        return cls(name, arg, lineno=lineno, offset=index)
 +
  
- 
- class ExceptionTableEntry:
-@@ -747,6 +753,7 @@
+     def use_cache_opcodes(self) -> int:
+         return (
+@@ -770,6 +776,7 @@
                      arg,
                      location=instr.location,
                      extended_args=nb_extended_args,
@@ -61,7 +61,7 @@ Forwarded: not-needed
                  )
                  instructions[index] = instr
                  nb_extended_args = 0
-@@ -1026,7 +1033,7 @@
+@@ -1057,7 +1064,7 @@
                      instr_index = len(instructions)
                      jumps.append((instr_index, jump_target))
  
@@ -72,7 +72,7 @@ Forwarded: not-needed
              if current_instr_offset in ex_end:
 --- a/src/bytecode/instr.py
 +++ b/src/bytecode/instr.py
-@@ -433,7 +433,7 @@
+@@ -520,7 +520,7 @@
  class BaseInstr(Generic[A]):
      """Abstract instruction."""
  
@@ -81,7 +81,7 @@ Forwarded: not-needed
  
      # Work around an issue with the default value of arg
      def __init__(
-@@ -443,8 +443,10 @@
+@@ -530,8 +530,10 @@
          *,
          lineno: Union[int, None, _UNSET] = UNSET,
          location: Optional[InstrLocation] = None,
@@ -92,7 +92,7 @@ Forwarded: not-needed
          if location:
              self._location = location
          elif lineno is UNSET:
-@@ -564,7 +566,7 @@
+@@ -656,7 +658,7 @@
              return (_effect, 0)
  
      def copy(self: T) -> T:
diff --git a/debian/patches/series b/debian/patches/series
index 787f5a3..31f7c0b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 pydevd-add-offset-to-instructions.patch
+Fix-spelling-of-INTRINSIC.patch
-- 
GitLab