Accepting request 625840 from devel:languages:python:numeric

OBS-URL: https://build.opensuse.org/request/show/625840
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-numba?expand=0&rev=13
This commit is contained in:
Dominique Leuenberger 2018-07-28 10:45:33 +00:00 committed by Git OBS Bridge
parent c5bd671cc4
commit 4a228144f6
3 changed files with 62 additions and 6 deletions

View File

@ -0,0 +1,48 @@
From 99d35798b2e833792624574fd1b31b41bd1f496e Mon Sep 17 00:00:00 2001
From: Stuart Archibald <stuart.archibald@googlemail.com>
Date: Thu, 19 Jul 2018 20:38:31 +0100
Subject: [PATCH] Fix #3135
This fixes #3135 by adding guards to make sure that only line
numbers in Z^+ are accessed and if no lines are found then they
are not addressed. Test case from bug report is added.
---
numba/ir.py | 18 ++++++++++++------
numba/tests/test_errorhandling.py | 16 ++++++++++++++++
2 files changed, 28 insertions(+), 6 deletions(-)
--- a/numba/ir.py
+++ b/numba/ir.py
@@ -63,7 +63,12 @@ class Loc(object):
spaces += 1
return spaces
- selected = lines[self.line - nlines_up:self.line]
+ # A few places in the code still use no `loc` or default to line 1
+ # this is often in places where exceptions are used for the purposes
+ # of flow control. As a result max is in use to prevent slice from
+ # `[negative: positive]`
+ selected = lines[max(0, self.line - nlines_up):self.line]
+
# see if selected contains a definition
def_found = False
for x in selected:
@@ -83,12 +88,13 @@ class Loc(object):
spaces = count_spaces(x)
ret.append(' '*(4 + spaces) + '<source elided>\n')
- ret.extend(selected[:-1])
- ret.append(_termcolor.highlight(selected[-1]))
+ if selected:
+ ret.extend(selected[:-1])
+ ret.append(_termcolor.highlight(selected[-1]))
- # point at the problem with a caret
- spaces = count_spaces(selected[-1])
- ret.append(' '*(spaces) + _termcolor.indicate("^"))
+ # point at the problem with a caret
+ spaces = count_spaces(selected[-1])
+ ret.append(' '*(spaces) + _termcolor.indicate("^"))
# if in the REPL source may not be available
if not ret:

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jul 20 13:09:58 UTC 2018 - mcepl@suse.com
- Add patch numba-0.39.0-fix-3135.patch to make not fail datashader
tests. (https://github.com/bokeh/datashader/issues/620)
-------------------------------------------------------------------
Fri Jul 13 09:20:32 UTC 2018 - tchvatal@suse.com

View File

@ -25,6 +25,7 @@ License: BSD-2-Clause
Group: Development/Languages/Python
URL: http://numba.github.com
Source: https://files.pythonhosted.org/packages/source/n/numba/numba-%{version}.tar.gz
Patch0: numba-0.39.0-fix-3135.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module llvmlite >= 0.24}
BuildRequires: %{python_module numpy-devel >= 1.10}
@ -76,6 +77,7 @@ This package contains files for developing applications using numba.
%prep
%setup -q -n numba-%{version}
%patch0 -p1
sed -i '1{\@^#!%{_bindir}/env python@d}' numba/appdirs.py
%build
@ -89,12 +91,12 @@ sed -i '1{\@^#!%{_bindir}/env python@d}' numba/appdirs.py
%python_clone -a %{buildroot}%{_bindir}/pycc
%check
# Sadly needs 3 hours to finish in OBS run localy when updating!
#%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
#pushd $PYTHONPATH
#$python -Wd -m pytest numba/tests -v -rs
#popd
#}
# # Sadly needs 3 hours to finish in OBS run localy when updating!
# %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
# pushd $PYTHONPATH
# $python -Wd -m pytest numba/tests -v -rs
# popd
# }
%post
%{python_install_alternative numba pycc}