Repository: numba/numba

Issue:
Refactor: rename one of the `TargetConfig` classes
Rename one of these `TargetConfig` classes

https://github.com/numba/numba/blob/38ab89dd369a14b8826d3fa30d080aa083aed00b/numba/core/dispatcher.py#L28

https://github.com/numba/numba/blob/38ab89dd369a14b8826d3fa30d080aa083aed00b/numba/core/targetconfig.py#L99


Discussion:
@sklam  Is it still opened ?
This is a maintainer task. See https://github.com/numba/numba/issues/7150#issuecomment-896073525 for details.

Resolving patch:
diff --git a/numba/core/dispatcher.py b/numba/core/dispatcher.py
--- a/numba/core/dispatcher.py
+++ b/numba/core/dispatcher.py
@@ -25,7 +25,7 @@
 import numba.core.event as ev
 
 
-class TargetConfig:
+class TargetConfigurationStack:
     """The target configuration stack.
 
     Uses the BORG pattern and stores states in threadlocal storage.
@@ -1067,17 +1067,18 @@ def _get_retarget_dispatcher(self):
         """Returns a dispatcher for the retarget request.
         """
         # Check TLS target configuration
-        tc = TargetConfig()
+        tc = TargetConfigurationStack()
         retarget = tc.get()
         retarget.check_compatible(self)
         disp = retarget.retarget(self)
         return disp
 
     def _get_dispatcher_for_current_target(self):
-        """Returns a dispatcher for the current target registered in `TargetConfig`.
-        `self` is returned if no target is specified.
+        """Returns a dispatcher for the current target registered in
+        `TargetConfigurationStack`. `self` is returned if no target is
+        specified.
         """
-        tc = TargetConfig()
+        tc = TargetConfigurationStack()
         if tc:
             return self._get_retarget_dispatcher()
         else:


Test patch:
diff --git a/numba/tests/parfors_max_label_error.py b/numba/tests/parfors_max_label_error.py
--- a/numba/tests/parfors_max_label_error.py
+++ b/numba/tests/parfors_max_label_error.py
@@ -10,7 +10,7 @@
 import numpy as np
 
 from numba import njit
-from numba.core.dispatcher import TargetConfig
+from numba.core.dispatcher import TargetConfigurationStack
 from numba.core.target_extension import (
     dispatcher_registry,
     CPUDispatcher,
@@ -58,7 +58,7 @@ def f(a):
 
 def main():
     a = np.ones(20)
-    with TargetConfig.switch_target(retarget):
+    with TargetConfigurationStack.switch_target(retarget):
         r = f(a)
     np.testing.assert_equal(r, f.py_func(a))
     print("TEST PASSED")
diff --git a/numba/tests/test_retargeting.py b/numba/tests/test_retargeting.py
--- a/numba/tests/test_retargeting.py
+++ b/numba/tests/test_retargeting.py
@@ -4,7 +4,7 @@
 from numba import njit
 from numba.core import errors, cpu, utils, typing
 from numba.core.descriptors import TargetDescriptor
-from numba.core.dispatcher import TargetConfig
+from numba.core.dispatcher import TargetConfigurationStack
 from numba.core.retarget import BasicRetarget
 from numba.core.extending import overload
 from numba.core.target_extension import (
@@ -154,7 +154,7 @@ def flex_target(x):
         self.retarget = CustomCPURetarget()
 
     def switch_target(self):
-        return TargetConfig.switch_target(self.retarget)
+        return TargetConfigurationStack.switch_target(self.retarget)
 
     @contextmanager
     def check_retarget_error(self):