File: 217-Fix-rebase-error-in-op_LOAD_DEREF.patch

package info (click to toggle)
numba 0.56.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,672 kB
  • sloc: python: 183,651; ansic: 15,370; cpp: 2,259; javascript: 424; sh: 308; makefile: 174
file content (61 lines) | stat: -rw-r--r-- 2,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From b08e4da173ef3eec7380da31b015f5a887e25059 Mon Sep 17 00:00:00 2001
From: Stuart Archibald <stuartarchibald@users.noreply.github.com>
Origin: https://github.com/numba/numba/pull/8639
Date: Mon, 5 Dec 2022 11:38:19 +0000
Subject: [PATCH 17/20] Fix rebase error in op_LOAD_DEREF

Branches for Python ==3.11 vs <3.11 were the wrong way around.

Also fixes flake8 in numba.core.interpreter.
---
 numba/core/interpreter.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

--- a/numba/core/interpreter.py
+++ b/numba/core/interpreter.py
@@ -14,6 +14,7 @@
 from numba.core.unsafe import eh
 from numba.cpython.unsafe.tuple import unpack_single_tuple
 
+
 class _UNKNOWN_VALUE(object):
     """Represents an unknown value, this is for ease of debugging purposes only.
     """
@@ -2229,7 +2230,7 @@
     def op_COPY_FREE_VARS(self, inst):
         pass
 
-    if PYVERSION < (3, 11):
+    if PYVERSION == (3, 11):
         def op_LOAD_DEREF(self, inst, res):
             name = self.func_id.func.__code__._varname_from_oparg(inst.arg)
             if name in self.code_cellvars:
@@ -2239,21 +2240,22 @@
                 value = self.get_closure_value(idx)
                 gl = ir.FreeVar(idx, name, value, loc=self.loc)
             self.store(gl, res)
-    else:
+    elif PYVERSION < (3, 11):
         def op_LOAD_DEREF(self, inst, res):
             n_cellvars = len(self.code_cellvars)
-            idx = inst.arg - len(self.code_locals)
-            if idx < n_cellvars:
-                name = self.code_cellvars[idx]
+            if inst.arg < n_cellvars:
+                name = self.code_cellvars[inst.arg]
                 gl = self.get(name)
             else:
-                name = self.code_freevars[idx - n_cellvars]
+                idx = inst.arg - n_cellvars
+                name = self.code_freevars[idx]
                 value = self.get_closure_value(idx)
                 gl = ir.FreeVar(idx, name, value, loc=self.loc)
             self.store(gl, res)
+    else:
+        raise NotImplementedError(PYVERSION)
 
     if PYVERSION >= (3, 11):
-
         def op_MAKE_CELL(self, inst):
             pass  # ignored bytecode