def test_is_this_a_none_objmode(self): pyfunc = is_this_a_none flags = Flags() flags.force_pyobject = True cres = compile_isolated(pyfunc, [types.intp], flags=flags) cfunc = cres.entry_point self.assertTrue(cres.objectmode) for v in [-1, 0, 1, 2]: self.assertPreciseEqual(pyfunc(v), cfunc(v))
from numba.core.untyped_passes import PreserveIR import unittest from numba.core.runtime import rtsys from numba.np import numpy_support from numba.pycc.platform import _external_compiler_ok try: import scipy except ImportError: scipy = None enable_pyobj_flags = Flags() enable_pyobj_flags.enable_pyobject = True force_pyobj_flags = Flags() force_pyobj_flags.force_pyobject = True no_pyobj_flags = Flags() nrt_flags = Flags() nrt_flags.nrt = True tag = testing.make_tag_decorator(['important', 'long_running']) _32bit = sys.maxsize <= 2**32 is_parfors_unsupported = _32bit skip_parfors_unsupported = unittest.skipIf( is_parfors_unsupported, 'parfors not supported', ) skip_py38_or_later = unittest.skipIf(utils.PYVERSION >= (3, 8),
def complex_constant(n): tmp = n + 4 return tmp + 3j def long_constant(n): return n + 100000000000000000000000000000000000000000000000 def delitem_usecase(x): del x[:] forceobj = Flags() forceobj.force_pyobject = True def loop_nest_3(x, y): n = 0 for i in range(x): for j in range(y): for k in range(x + y): n += i * j return n def array_of_object(x): return x