From 4839ecd3c3a771083da3848eddcbffb582403e9a Mon Sep 17 00:00:00 2001
Origin: https://github.com/numba/numba/pull/8590
From: Siu Kwan Lam <1929845+sklam@users.noreply.github.com>
Date: Wed, 16 Nov 2022 16:28:43 -0600
Subject: [PATCH 05/14] (Not a py311 change) stop printing source code in
 errmsg when lineno is unavail

---
 numba/core/ir.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/numba/core/ir.py b/numba/core/ir.py
index dc0c07def1c..063370195fd 100644
--- a/numba/core/ir.py
+++ b/numba/core/ir.py
@@ -138,7 +138,7 @@ def strformat(self, nlines_up=2):
 
 
         ret = [] # accumulates output
-        if lines and use_line:
+        if lines and use_line > 0:
 
             def count_spaces(string):
                 spaces = 0
@@ -181,7 +181,11 @@ def count_spaces(string):
 
         # if in the REPL source may not be available
         if not ret:
-            ret = "<source missing, REPL/exec in use?>"
+            if not lines:
+                ret = "<source missing, REPL/exec in use?>"
+            elif use_line <= 0:
+                ret = "<source line number missing>"
+
 
         err = _termcolor.filename('\nFile "%s", line %d:')+'\n%s'
         tmp = err % (self._get_path(), use_line, _termcolor.code(''.join(ret)))

