Hello community, here is the log from the commit of package python-numba for openSUSE:Factory checked in at 2018-01-09 14:51:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-numba (Old) and /work/SRC/openSUSE:Factory/.python-numba.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-numba" Tue Jan 9 14:51:43 2018 rev:4 rq:561310 version:0.36.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-numba/python-numba.changes 2017-12-14 10:55:16.054032383 +0100 +++ /work/SRC/openSUSE:Factory/.python-numba.new/python-numba.changes 2018-01-09 14:51:46.147807942 +0100 @@ -1,0 +2,7 @@ +Thu Dec 21 18:33:16 UTC 2017 - [email protected] + +- update to version 0.36.2: + * PR #2645: Avoid CPython bug with "exec" in older 2.7.x. + * PR #2652: Add support for CUDA 9. + +------------------------------------------------------------------- Old: ---- numba-0.36.1.tar.gz New: ---- numba-0.36.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-numba.spec ++++++ --- /var/tmp/diff_new_pack.DIHhPh/_old 2018-01-09 14:51:46.831775876 +0100 +++ /var/tmp/diff_new_pack.DIHhPh/_new 2018-01-09 14:51:46.831775876 +0100 @@ -20,7 +20,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-numba -Version: 0.36.1 +Version: 0.36.2 Release: 0 Summary: Compiling Python code using LLVM License: BSD-2-Clause ++++++ numba-0.36.1.tar.gz -> numba-0.36.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/CHANGE_LOG new/numba-0.36.2/CHANGE_LOG --- old/numba-0.36.1/CHANGE_LOG 2017-12-08 17:03:10.000000000 +0100 +++ new/numba-0.36.2/CHANGE_LOG 2017-12-20 17:56:24.000000000 +0100 @@ -1,3 +1,12 @@ +Version 0.36.2 +-------------- + +This is a bugfix release that provides minor changes to address: + +* PR #2645: Avoid CPython bug with ``exec`` in older 2.7.x. +* PR #2652: Add support for CUDA 9. + + Version 0.36.1 -------------- @@ -132,7 +141,7 @@ Misc fixes/enhancements: * PR #2455: add contextual information to runtime errors -* PR #2470: Fixes #2458, poor performance in np.median +* PR #2470: Fixes #2458, poor performance in np.median * PR #2471: Ensure LLVM threadsafety in {g,}ufunc building. * PR #2494: Update doc theme * PR #2503: Remove hacky code added in 2482 and feature enhancement @@ -195,23 +204,23 @@ CUDA support enhancements: -* PR #2377: New GPU reduction algorithm +* PR #2377: New GPU reduction algorithm CUDA support fixes: -* PR #2397: Fix #2393, always set alignment of cuda static memory regions +* PR #2397: Fix #2393, always set alignment of cuda static memory regions Misc Fixes: * PR #2373, Issue #2372: 32-bit compatibility fix for parfor related code * PR #2376: Fix #2375 missing stdint.h for py2.7 vc9 -* PR #2378: Fix deadlock in parallel gufunc when kernel acquires the GIL. -* PR #2382: Forbid unsafe casting in bitwise operation -* PR #2385: docs: fix Sphinx errors -* PR #2396: Use 64-bit RHS operand for shift -* PR #2404: Fix threadsafety logic issue in ufunc compilation cache. +* PR #2378: Fix deadlock in parallel gufunc when kernel acquires the GIL. +* PR #2382: Forbid unsafe casting in bitwise operation +* PR #2385: docs: fix Sphinx errors +* PR #2396: Use 64-bit RHS operand for shift +* PR #2404: Fix threadsafety logic issue in ufunc compilation cache. * PR #2424: Ensure consistent iteration order of blocks for type inference. * PR #2425: Guard code to prevent the use of 'parallel' on win32 + py27 * PR #2426: Basic test for Enum member type recovery. @@ -225,16 +234,16 @@ Misc Enhancements: * PR #2366: Improvements to IR utils -* PR #2388: Update README.rst to indicate the proper version of LLVM -* PR #2394: Upgrade to llvmlite 0.19.* +* PR #2388: Update README.rst to indicate the proper version of LLVM +* PR #2394: Upgrade to llvmlite 0.19.* * PR #2395: Update llvmlite version to 0.19 -* PR #2406: Expose environment object to ufuncs -* PR #2407: Expose environment object to target-context inside lowerer -* PR #2413: Add flags to pass through to conda build for buildbot +* PR #2406: Expose environment object to ufuncs +* PR #2407: Expose environment object to target-context inside lowerer +* PR #2413: Add flags to pass through to conda build for buildbot * PR #2414: Add cross compile flags to local recipe * PR #2415: A few cleanups for rewrites * PR #2418: Add getitem support for Enum classes -* PR #2419: Add support for returning enums in vectorize +* PR #2419: Add support for returning enums in vectorize * PR #2421: Add copyright notice for Intel contributed files. * PR #2422: Patch code base to work with np 1.13 release * PR #2448: Adds in warning message when using 'parallel' if cache=True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/PKG-INFO new/numba-0.36.2/PKG-INFO --- old/numba-0.36.1/PKG-INFO 2017-12-08 17:22:38.000000000 +0100 +++ new/numba-0.36.2/PKG-INFO 2017-12-20 18:17:06.000000000 +0100 @@ -1,12 +1,11 @@ Metadata-Version: 1.1 Name: numba -Version: 0.36.1 +Version: 0.36.2 Summary: compiling Python code using LLVM Home-page: http://numba.github.com Author: Anaconda, Inc. Author-email: [email protected] License: BSD -Description-Content-Type: UNKNOWN Description: ***** Numba ***** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/_version.py new/numba-0.36.2/numba/_version.py --- old/numba-0.36.1/numba/_version.py 2017-12-08 17:22:38.000000000 +0100 +++ new/numba-0.36.2/numba/_version.py 2017-12-20 18:17:06.000000000 +0100 @@ -4,8 +4,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.36.1' -version_full = 'f6391886b29b446a9924cbeebd924f53909dd7cc' +version_version = '0.36.2' +version_full = '540650dbcffcdc94424596987fc63a49352525ef' def get_versions(default={}, verbose=False): return {'version': version_version, 'full': version_full} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/cuda/cudadrv/libs.py new/numba-0.36.2/numba/cuda/cudadrv/libs.py --- old/numba-0.36.1/numba/cuda/cudadrv/libs.py 2017-12-08 17:03:10.000000000 +0100 +++ new/numba-0.36.2/numba/cuda/cudadrv/libs.py 2017-12-20 17:56:24.000000000 +0100 @@ -17,8 +17,15 @@ def get_libdevice(arch): libdir = (os.environ.get('NUMBAPRO_LIBDEVICE') or os.environ.get('NUMBAPRO_CUDALIB')) + pat = r'libdevice\.%s(\.\d+)*\.bc$' % arch candidates = find_file(re.compile(pat), libdir) + + if not candidates: + # CUDA 9 switches to fat library, with no arch in name + pat = r'libdevice(\.\d+)*\.bc$' + candidates = find_file(re.compile(pat), libdir) + return max(candidates) if candidates else None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/cuda/cudadrv/nvvm.py new/numba-0.36.2/numba/cuda/cudadrv/nvvm.py --- old/numba-0.36.1/numba/cuda/cudadrv/nvvm.py 2017-12-08 17:03:10.000000000 +0100 +++ new/numba-0.36.2/numba/cuda/cudadrv/nvvm.py 2017-12-20 17:56:24.000000000 +0100 @@ -274,8 +274,22 @@ default_data_layout = data_layout[tuple.__itemsize__ * 8] +try: + NVVM_VERSION = NVVM().get_version() +except: + # the CUDA driver may not be present + NVVM_VERSION = (0, 0) + # List of supported compute capability in sorted order -SUPPORTED_CC = (2, 0), (2, 1), (3, 0), (3, 5), (5, 0), (5, 2) +if NVVM_VERSION < (1, 3): + # CUDA 7.5 and earlier + SUPPORTED_CC = (2, 0), (2, 1), (3, 0), (3, 5), (5, 0), (5, 2) +elif NVVM_VERSION < (1, 4): + # CUDA 8.0 + SUPPORTED_CC = (2, 0), (2, 1), (3, 0), (3, 5), (5, 0), (5, 2), (5, 3), (6, 0), (6, 1), (6, 2) +else: + # CUDA 9.0 and later + SUPPORTED_CC = (3, 0), (3, 5), (5, 0), (5, 2), (5, 3), (6, 0), (6, 1), (6, 2), (7, 0) def _find_arch(mycc): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/cuda/tests/cudadrv/test_nvvm_driver.py new/numba-0.36.2/numba/cuda/tests/cudadrv/test_nvvm_driver.py --- old/numba-0.36.1/numba/cuda/tests/cudadrv/test_nvvm_driver.py 2017-12-08 17:03:10.000000000 +0100 +++ new/numba-0.36.2/numba/cuda/tests/cudadrv/test_nvvm_driver.py 2017-12-20 17:56:24.000000000 +0100 @@ -77,15 +77,13 @@ @skip_on_cudasim('NVVM Driver unsupported in the simulator') class TestArchOption(unittest.TestCase): def test_get_arch_option(self): - self.assertEqual(get_arch_option(2, 0), 'compute_20') - self.assertEqual(get_arch_option(2, 1), 'compute_21') + # Test returning the nearest lowest arch. self.assertEqual(get_arch_option(3, 0), 'compute_30') self.assertEqual(get_arch_option(3, 3), 'compute_30') self.assertEqual(get_arch_option(3, 4), 'compute_30') - self.assertEqual(get_arch_option(3, 5), 'compute_35') - self.assertEqual(get_arch_option(3, 6), 'compute_35') - self.assertEqual(get_arch_option(5, 0), 'compute_50') - self.assertEqual(get_arch_option(5, 1), 'compute_50') + # Test known arch. + for arch in SUPPORTED_CC: + self.assertEqual(get_arch_option(*arch), 'compute_%d%d' % arch) self.assertEqual(get_arch_option(1000, 0), 'compute_%d%d' % SUPPORTED_CC[-1]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/ir_utils.py new/numba-0.36.2/numba/ir_utils.py --- old/numba-0.36.1/numba/ir_utils.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/ir_utils.py 2017-12-20 17:56:24.000000000 +0100 @@ -2,14 +2,16 @@ # Copyright (c) 2017 Intel Corporation # SPDX-License-Identifier: BSD-2-Clause # +import numpy -import numba import types as pytypes + +from llvmlite import ir as lir +import numba +from numba.six import exec_ from numba import ir, types, typing, config, analysis, utils, cgutils from numba.typing.templates import signature, infer_global, AbstractTemplate -from llvmlite import ir as lir from numba.targets.imputils import impl_ret_untracked -import numpy from numba.analysis import (compute_live_map, compute_use_defs, compute_cfg_from_blocks) import copy @@ -1418,7 +1420,7 @@ func_text = "def g():\n%s\n def f(%s):\n return (%s)\n return f" % ( func_env, func_arg, func_clo) loc = {} - exec(func_text, glbls, loc) + exec_(func_text, glbls, loc) # hack parameter name .0 for Python 3 versions < 3.6 if utils.PYVERSION >= (3,) and utils.PYVERSION < (3, 6): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/npyufunc/deviceufunc.py new/numba-0.36.2/numba/npyufunc/deviceufunc.py --- old/numba-0.36.1/numba/npyufunc/deviceufunc.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/npyufunc/deviceufunc.py 2017-12-20 17:56:24.000000000 +0100 @@ -10,6 +10,7 @@ import numpy as np +from numba.six import exec_ from numba.utils import longint from numba.utils import IS_PY3 from numba.npyufunc.ufuncbuilder import _BaseUFuncBuilder, parse_identity @@ -17,16 +18,6 @@ from numba.typing import signature from numba.npyufunc.sigparse import parse_signature -if IS_PY3: - def _exec(codestr, glbls): - exec(codestr, glbls) -else: - eval(compile(""" -def _exec(codestr, glbls): - exec codestr in glbls -""", - "<_exec>", "exec")) - def _broadcast_axis(a, b): """ @@ -393,7 +384,7 @@ corefn, return_type = self._compile_core(devfnsig) glbl = self._get_globals(corefn) sig = signature(types.void, *([a[:] for a in args] + [return_type[:]])) - _exec(kernelsource, glbl) + exec_(kernelsource, glbl) stager = glbl['__vectorized_%s' % funcname] kernel = self._compile_kernel(stager, sig) @@ -470,7 +461,7 @@ glbls = self._get_globals(sig) - _exec(src, glbls) + exec_(src, glbls) fnobj = glbls['__gufunc_{name}'.format(name=funcname)] outertys = list(_determine_gufunc_outer_types(args, indims + outdims)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/npyufunc/parfor.py new/numba-0.36.2/numba/npyufunc/parfor.py --- old/numba-0.36.1/numba/npyufunc/parfor.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/npyufunc/parfor.py 2017-12-20 17:56:24.000000000 +0100 @@ -3,23 +3,24 @@ import ast from collections import defaultdict, OrderedDict import sys +import copy + +import llvmlite.llvmpy.core as lc +import numba from .. import compiler, ir, types, six, cgutils, sigutils, lowering, parfor from numba.ir_utils import (add_offset_to_labels, replace_var_names, remove_dels, legalize_names, mk_unique_var, rename_labels, get_name_var_table, visit_vars_inner, - get_definition, guard, find_callname, - get_call_table, is_pure, + get_definition, guard, find_callname, + get_call_table, is_pure, get_unused_var_name) from numba.analysis import (compute_use_defs, compute_live_map, compute_dead_maps, compute_cfg_from_blocks) from ..typing import signature from numba import config from numba.targets.cpu import ParallelOptions -import llvmlite.llvmpy.core as lc -import numba -import copy - +from numba.six import exec_ def _lower_parfor_parallel(lowerer, parfor): """Lowerer that handles LLVM code generation for parfor. @@ -256,7 +257,7 @@ new_block = [] for inst in block.body: if isinstance(inst, ir.Assign) and inst.target.name in def_once: - if _hoist_internal(inst, dep_on_param, call_table, + if _hoist_internal(inst, dep_on_param, call_table, hoisted, typemap): # don't add this instuction to the block since it is hoisted continue @@ -452,7 +453,7 @@ if config.DEBUG_ARRAY_OPT: print("gufunc_txt = ", type(gufunc_txt), "\n", gufunc_txt) # Force gufunc outline into existence. - exec(gufunc_txt) + exec_(gufunc_txt) gufunc_func = eval(gufunc_name) if config.DEBUG_ARRAY_OPT: print("gufunc_func = ", type(gufunc_func), "\n", gufunc_func) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/pycc/decorators.py new/numba-0.36.2/numba/pycc/decorators.py --- old/numba-0.36.1/numba/pycc/decorators.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/pycc/decorators.py 2017-12-20 17:56:24.000000000 +0100 @@ -5,6 +5,7 @@ from numba import sigutils, typing from .compiler import ExportEntry +from numba.six import exec_ # Registry is okay to be a global because we are using pycc as a standalone # commandline tool. @@ -43,7 +44,7 @@ """ for ifile in inputs: with open(ifile) as fin: - exec(compile(fin.read(), ifile, 'exec')) + exec_(compile(fin.read(), ifile, 'exec')) def clear_export_registry(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/stencil.py new/numba-0.36.2/numba/stencil.py --- old/numba-0.36.1/numba/stencil.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/stencil.py 2017-12-20 17:56:24.000000000 +0100 @@ -3,16 +3,20 @@ # SPDX-License-Identifier: BSD-2-Clause # -import numpy as np import copy + +import numpy as np +from llvmlite import ir as lir + from numba import compiler, types, ir_utils, ir, typing, numpy_support, utils from numba import config from numba.typing.templates import (CallableTemplate, signature, infer_global, AbstractTemplate) from numba.targets import registry from numba.targets.imputils import lower_builtin -from llvmlite import ir as lir from numba.extending import register_jitable +from numba.six import exec_ + class StencilFuncLowerer(object): '''Callable class responsible for lowering calls to a specific StencilFunc. @@ -344,7 +348,7 @@ sig = signature(real_ret, *argtys_extra) dummy_text = ("def __numba_dummy_stencil({}{}):\n pass\n".format( ",".join(self.kernel_ir.arg_names), sig_extra)) - exec(dummy_text) in globals(), locals() + exec_(dummy_text) in globals(), locals() dummy_func = eval("__numba_dummy_stencil") sig.pysig = utils.pysignature(dummy_func) self._targetctx.insert_func_defn([(self._lower_me, self, argtys_extra)]) @@ -437,7 +441,7 @@ # the index variable for each dimension. index0, index1, ... index_vars = [] for i in range(the_array.ndim): - index_var_name = ir_utils.get_unused_var_name("index" + str(i), + index_var_name = ir_utils.get_unused_var_name("index" + str(i), name_var_table) index_vars += [index_var_name] @@ -571,7 +575,7 @@ print(func_text) # Force the new stencil function into existence. - exec(func_text) in globals(), locals() + exec_(func_text) in globals(), locals() stencil_func = eval(stencil_func_name) if sigret is not None: pysig = utils.pysignature(stencil_func) @@ -610,7 +614,7 @@ # Search all the block in the stencil outline for the sentinel. for label, block in stencil_ir.blocks.items(): for i, inst in enumerate(block.body): - if (isinstance( inst, ir.Assign) and + if (isinstance( inst, ir.Assign) and inst.target.name == sentinel_name): # We found the sentinel assignment. loc = inst.loc @@ -636,7 +640,7 @@ stencil_ir.blocks[new_label] = block stencil_ir.blocks[label] = prev_block - # Add a jump from all the blocks that previously contained + # Add a jump from all the blocks that previously contained # a return in the stencil kernel to the block # containing statements after the sentinel. for ret_block in ret_blocks: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/stencilparfor.py new/numba-0.36.2/numba/stencilparfor.py --- old/numba-0.36.1/numba/stencilparfor.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/stencilparfor.py 2017-12-20 17:56:24.000000000 +0100 @@ -3,7 +3,13 @@ # SPDX-License-Identifier: BSD-2-Clause # +import numbers +import copy import types as pytypes +from operator import add + +import numpy as np + import numba from numba import types from numba.typing.templates import infer_global, AbstractTemplate @@ -12,10 +18,7 @@ from numba.ir_utils import (get_call_table, mk_unique_var, compile_to_numba_ir, replace_arg_nodes, guard, find_callname) -from operator import add -import numpy as np -import numbers -import copy +from numba.six import exec_ def _compute_last_ind(dim_size, index_const): @@ -541,7 +544,7 @@ return slice({} + offset, {} + offset) """.format(slice_var.start, slice_var.stop) loc = {} - exec(f_text, {}, loc) + exec_(f_text, {}, loc) f = loc['f'] args = [offset_var] arg_typs = (types.intp,) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/tests/serialize_usecases.py new/numba-0.36.2/numba/tests/serialize_usecases.py --- old/numba-0.36.1/numba/tests/serialize_usecases.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/tests/serialize_usecases.py 2017-12-20 17:56:24.000000000 +0100 @@ -6,6 +6,7 @@ import math from numba import jit, generated_jit, types +from numba.six import exec_ @jit((types.int32, types.int32)) @@ -106,7 +107,7 @@ return res """ ns = {} - exec(code.strip(), ns) + exec_(code.strip(), ns) return jit(**jit_args)(ns['dyn_func']) dyn_func = _get_dyn_func(nopython=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/tests/test_closure.py new/numba-0.36.2/numba/tests/test_closure.py --- old/numba-0.36.1/numba/tests/test_closure.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/tests/test_closure.py 2017-12-20 17:56:24.000000000 +0100 @@ -10,6 +10,7 @@ from numba import njit, jit, testing, utils from numba.errors import NotDefinedError, TypingError, LoweringError from .support import TestCase, tag +from numba.six import exec_ class TestClosure(TestCase): @@ -175,7 +176,7 @@ return inner(x) + inner(x) + z """ ns = {} - exec(code.strip(), ns) + exec_(code.strip(), ns) cfunc = njit(ns['outer']) self.assertEqual(cfunc(10), ns['outer'](10)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/tests/test_dyn_func.py new/numba-0.36.2/numba/tests/test_dyn_func.py --- old/numba-0.36.1/numba/tests/test_dyn_func.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/tests/test_dyn_func.py 2017-12-20 17:56:24.000000000 +0100 @@ -4,6 +4,7 @@ import numba from .support import TestCase +from numba.six import exec_ class Issue455(object): @@ -22,7 +23,7 @@ x[i] = 1. """ d = {} - exec(code.strip(), d) + exec_(code.strip(), d) self.f.append(numba.jit("void(f8[:])", nopython=True)(d['f'])) def call_f(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numba-0.36.1/numba/tests/test_ufuncs.py new/numba-0.36.2/numba/tests/test_ufuncs.py --- old/numba-0.36.1/numba/tests/test_ufuncs.py 2017-12-08 17:03:11.000000000 +0100 +++ new/numba-0.36.2/numba/tests/test_ufuncs.py 2017-12-20 17:56:24.000000000 +0100 @@ -17,7 +17,7 @@ from numba.config import PYVERSION from numba.errors import LoweringError, TypingError from .support import TestCase, CompilationCache, MemoryLeakMixin, tag - +from numba.six import exec_ from numba.typing.npydecl import supported_ufuncs, all_ufuncs is32bits = tuple.__itemsize__ == 4 @@ -54,7 +54,7 @@ ldict = {} arg_str = ','.join(['a{0}'.format(i) for i in range(ufunc.nargs)]) func_str = 'def fn({0}):\n np.{1}({0})'.format(arg_str, ufunc.__name__) - exec(func_str, globals(), ldict) + exec_(func_str, globals(), ldict) fn = ldict['fn'] fn.__name__ = '{0}_usecase'.format(ufunc.__name__) return fn @@ -63,7 +63,7 @@ def _make_unary_ufunc_usecase(ufunc): ufunc_name = ufunc.__name__ ldict = {} - exec("def fn(x,out):\n np.{0}(x,out)".format(ufunc_name), globals(), ldict) + exec_("def fn(x,out):\n np.{0}(x,out)".format(ufunc_name), globals(), ldict) fn = ldict["fn"] fn.__name__ = "{0}_usecase".format(ufunc_name) return fn @@ -71,7 +71,7 @@ def _make_unary_ufunc_op_usecase(ufunc_op): ldict = {} - exec("def fn(x):\n return {0}(x)".format(ufunc_op), globals(), ldict) + exec_("def fn(x):\n return {0}(x)".format(ufunc_op), globals(), ldict) fn = ldict["fn"] fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) return fn @@ -80,7 +80,7 @@ def _make_binary_ufunc_usecase(ufunc): ufunc_name = ufunc.__name__ ldict = {} - exec("def fn(x,y,out):\n np.{0}(x,y,out)".format(ufunc_name), globals(), ldict); + exec_("def fn(x,y,out):\n np.{0}(x,y,out)".format(ufunc_name), globals(), ldict); fn = ldict['fn'] fn.__name__ = "{0}_usecase".format(ufunc_name) return fn @@ -88,7 +88,7 @@ def _make_binary_ufunc_op_usecase(ufunc_op): ldict = {} - exec("def fn(x,y):\n return x{0}y".format(ufunc_op), globals(), ldict) + exec_("def fn(x,y):\n return x{0}y".format(ufunc_op), globals(), ldict) fn = ldict["fn"] fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) return fn @@ -96,7 +96,7 @@ def _make_inplace_ufunc_op_usecase(ufunc_op): ldict = {} - exec("def fn(x,y):\n x{0}y".format(ufunc_op), globals(), ldict) + exec_("def fn(x,y):\n x{0}y".format(ufunc_op), globals(), ldict) fn = ldict["fn"] fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) return fn
