Repository: numba/numba

Issue:
unittest: tbb test fork from non main thread is broken on mainline
- [x] I have tried using the ~mainline~ released version of Numba (most recent is
 visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).

Current HEAD (d0ca288) of mainline has this failure on CI, happened on Python 3.7 with TBB.:
<details>
<summary>Details:</summary>

```
======================================================================
2021-05-11T23:01:23.1946584Z FAIL: test_fork_from_non_main_thread (numba.tests.test_parallel_backend.TestTBBSpecificIssues)
2021-05-11T23:01:23.1947935Z ----------------------------------------------------------------------
2021-05-11T23:01:23.1948686Z Traceback (most recent call last):
2021-05-11T23:01:23.1949243Z   File "/home/vsts/work/1/s/numba/tests/test_parallel_backend.py", line 945, in test_fork_from_non_main_thread
2021-05-11T23:01:23.1950157Z     out, err = self.run_cmd(cmdline)
2021-05-11T23:01:23.1950645Z   File "/home/vsts/work/1/s/numba/tests/test_parallel_backend.py", line 477, in run_cmd
2021-05-11T23:01:23.1951145Z     (popen.returncode, err.decode()))
2021-05-11T23:01:23.1952200Z AssertionError: process failed with code -9: stderr follows
2021-05-11T23:01:23.1952874Z Exception in thread Thread-1:
2021-05-11T23:01:23.1953694Z Traceback (most recent call last):
2021-05-11T23:01:23.1954208Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 744, in new_error_context
2021-05-11T23:01:23.1954646Z     yield
2021-05-11T23:01:23.1955082Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.1955543Z     self.lower_inst(inst)
2021-05-11T23:01:23.1956005Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 323, in lower_inst
2021-05-11T23:01:23.1956461Z     val = self.lower_assign(ty, inst)
2021-05-11T23:01:23.1957100Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 499, in lower_assign
2021-05-11T23:01:23.1957582Z     return self.lower_expr(ty, value)
2021-05-11T23:01:23.1958058Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 1027, in lower_expr
2021-05-11T23:01:23.1958534Z     res = self.lower_call(resty, expr)
2021-05-11T23:01:23.1959046Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 742, in lower_call
2021-05-11T23:01:23.1959574Z     res = self._lower_call_ObjModeDispatcher(fnty, expr, signature)
2021-05-11T23:01:23.1960126Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 794, in _lower_call_ObjModeDispatcher
2021-05-11T23:01:23.1960676Z     callee = ObjModeUtils(self.pyapi).load_dispatcher(fnty, argtypes)
2021-05-11T23:01:23.1961188Z   File "/home/vsts/work/1/s/numba/core/pythonapi.py", line 1636, in load_dispatcher
2021-05-11T23:01:23.1961719Z     if serialize.is_serialiable(fnty.dispatcher):
2021-05-11T23:01:23.1962239Z   File "/home/vsts/work/1/s/numba/core/serialize.py", line 155, in is_serialiable
2021-05-11T23:01:23.1962965Z     pickler.dump(obj)
2021-05-11T23:01:23.1963476Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 563, in dump
2021-05-11T23:01:23.1963989Z     return Pickler.dump(self, obj)
2021-05-11T23:01:23.1964520Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 437, in dump
2021-05-11T23:01:23.1965037Z     self.save(obj)
2021-05-11T23:01:23.1965540Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1966053Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1966602Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.1967270Z     save(args)
2021-05-11T23:01:23.1967753Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1968292Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1968853Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.1969361Z     save(element)
2021-05-11T23:01:23.1969848Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1970363Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1970878Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.1971375Z     save(args)
2021-05-11T23:01:23.1972228Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1972926Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1973455Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.1973935Z     save(element)
2021-05-11T23:01:23.1974565Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1975084Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1975597Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1976093Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1976593Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1977177Z     save(v)
2021-05-11T23:01:23.1977614Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1978096Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1978587Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1979059Z     save(state)
2021-05-11T23:01:23.1979514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1980016Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1980540Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1981643Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1982375Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1982863Z     save(v)
2021-05-11T23:01:23.1983337Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1983894Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1984454Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1985289Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1985775Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1986239Z     save(v)
2021-05-11T23:01:23.1986692Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1987177Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1987658Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1988123Z     save(state)
2021-05-11T23:01:23.1988576Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1989093Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1989606Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1990101Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1990602Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1991069Z     save(v)
2021-05-11T23:01:23.1991514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1992016Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1992606Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 819, in save_list
2021-05-11T23:01:23.1993095Z     self._batch_appends(obj)
2021-05-11T23:01:23.1993584Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 843, in _batch_appends
2021-05-11T23:01:23.1994032Z     save(x)
2021-05-11T23:01:23.1994477Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1994966Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1995454Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1995939Z     save(state)
2021-05-11T23:01:23.1996587Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1997375Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1997953Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1998500Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1999040Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2000098Z     save(v)
2021-05-11T23:01:23.2000621Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2001158Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2001843Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2002371Z     save(state)
2021-05-11T23:01:23.2003700Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2004360Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2004928Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2005483Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2006699Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2007373Z     save(v)
2021-05-11T23:01:23.2008028Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2008766Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2009347Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 745, in save_function
2021-05-11T23:01:23.2010075Z     *self._dynamic_function_reduce(obj), obj=obj
2021-05-11T23:01:23.2010818Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 687, in _save_reduce_pickle5
2021-05-11T23:01:23.2011334Z     save(state)
2021-05-11T23:01:23.2011833Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2012403Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2012985Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2013506Z     save(element)
2021-05-11T23:01:23.2013998Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2014574Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2015155Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2015964Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2016470Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2017114Z     save(v)
2021-05-11T23:01:23.2017564Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2018087Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2018590Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2019319Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2019839Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2020331Z     save(v)
2021-05-11T23:01:23.2024862Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2025545Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2026089Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2026591Z     save(state)
2021-05-11T23:01:23.2027063Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2027586Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2028129Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2028646Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2029167Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2029655Z     save(v)
2021-05-11T23:01:23.2030099Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2030974Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2031439Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2031882Z     save(state)
2021-05-11T23:01:23.2032447Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2032948Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2033445Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2033919Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2034377Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2034829Z     save(v)
2021-05-11T23:01:23.2035252Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 524, in save
2021-05-11T23:01:23.2035702Z     rv = reduce(self.proto)
2021-05-11T23:01:23.2036514Z TypeError: can't pickle _thread.lock objects
2021-05-11T23:01:23.2036818Z 
2021-05-11T23:01:23.2037240Z During handling of the above exception, another exception occurred:
2021-05-11T23:01:23.2037539Z 
2021-05-11T23:01:23.2037879Z Traceback (most recent call last):
2021-05-11T23:01:23.2038323Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 154, in propagate
2021-05-11T23:01:23.2038760Z     constraint(typeinfer)
2021-05-11T23:01:23.2039192Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 566, in __call__
2021-05-11T23:01:23.2039648Z     self.resolve(typeinfer, typevars, fnty)
2021-05-11T23:01:23.2040082Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 586, in resolve
2021-05-11T23:01:23.2040555Z     sig = typeinfer.resolve_call(fnty, pos_args, kw_args)
2021-05-11T23:01:23.2041253Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 1538, in resolve_call
2021-05-11T23:01:23.2041770Z     return self.context.resolve_function_type(fnty, pos_args, kw_args)
2021-05-11T23:01:23.2042309Z   File "/home/vsts/work/1/s/numba/core/typing/context.py", line 195, in resolve_function_type
2021-05-11T23:01:23.2042810Z     res = self._resolve_user_function_type(func, args, kws)
2021-05-11T23:01:23.2043336Z   File "/home/vsts/work/1/s/numba/core/typing/context.py", line 247, in _resolve_user_function_type
2021-05-11T23:01:23.2043852Z     return func.get_call_type(self, args, kws)
2021-05-11T23:01:23.2044339Z   File "/home/vsts/work/1/s/numba/core/types/functions.py", line 552, in get_call_type
2021-05-11T23:01:23.2045022Z     self.dispatcher.get_call_template(args, kws)
2021-05-11T23:01:23.2045498Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 316, in get_call_template
2021-05-11T23:01:23.2045949Z     self.compile(tuple(args))
2021-05-11T23:01:23.2046632Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 911, in compile
2021-05-11T23:01:23.2047309Z     cres = self._compiler.compile(args, return_type)
2021-05-11T23:01:23.2047789Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 80, in compile
2021-05-11T23:01:23.2048299Z     status, retval = self._compile_cached(args, return_type)
2021-05-11T23:01:23.2048819Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 94, in _compile_cached
2021-05-11T23:01:23.2049318Z     retval = self._compile_core(args, return_type)
2021-05-11T23:01:23.2049805Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 112, in _compile_core
2021-05-11T23:01:23.2050289Z     pipeline_class=self.pipeline_class)
2021-05-11T23:01:23.2050765Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 675, in compile_extra
2021-05-11T23:01:23.2051241Z     return pipeline.compile_extra(func)
2021-05-11T23:01:23.2051702Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 419, in compile_extra
2021-05-11T23:01:23.2052553Z     return self._compile_bytecode()
2021-05-11T23:01:23.2053007Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 483, in _compile_bytecode
2021-05-11T23:01:23.2053460Z     return self._compile_core()
2021-05-11T23:01:23.2053901Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2054301Z     raise e
2021-05-11T23:01:23.2054711Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2055260Z     pm.run(self.state)
2021-05-11T23:01:23.2055702Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2056123Z     raise patched_exception
2021-05-11T23:01:23.2056556Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2057074Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2057648Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2058102Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2058655Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2059287Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2059948Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2060451Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2061086Z   File "/home/vsts/work/1/s/numba/core/untyped_passes.py", line 262, in run_pass
2021-05-11T23:01:23.2061642Z     pipeline_class=type(state.pipeline))
2021-05-11T23:01:23.2062179Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 739, in compile_ir
2021-05-11T23:01:23.2062621Z     lifted_from=lifted_from)
2021-05-11T23:01:23.2063110Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 429, in compile_ir
2021-05-11T23:01:23.2063595Z     return self._compile_ir()
2021-05-11T23:01:23.2064122Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 490, in _compile_ir
2021-05-11T23:01:23.2064574Z     return self._compile_core()
2021-05-11T23:01:23.2065228Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2065689Z     raise e
2021-05-11T23:01:23.2066149Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2066568Z     pm.run(self.state)
2021-05-11T23:01:23.2067048Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2067530Z     raise patched_exception
2021-05-11T23:01:23.2068004Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2068448Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2068956Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2069498Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2069987Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2070456Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2070962Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2071464Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2071949Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 396, in run_pass
2021-05-11T23:01:23.2072430Z     lower.lower()
2021-05-11T23:01:23.2072833Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 136, in lower
2021-05-11T23:01:23.2093383Z     self.lower_normal_function(self.fndesc)
2021-05-11T23:01:23.2093894Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 190, in lower_normal_function
2021-05-11T23:01:23.2094373Z     entry_block_tail = self.lower_function_body()
2021-05-11T23:01:23.2094818Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 216, in lower_function_body
2021-05-11T23:01:23.2095254Z     self.lower_block(block)
2021-05-11T23:01:23.2095676Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.2096278Z     self.lower_inst(inst)
2021-05-11T23:01:23.2096905Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/contextlib.py", line 130, in __exit__
2021-05-11T23:01:23.2097417Z     self.gen.throw(type, value, traceback)
2021-05-11T23:01:23.2097895Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 751, in new_error_context
2021-05-11T23:01:23.2098364Z     raise newerr.with_traceback(tb)
2021-05-11T23:01:23.2098824Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 744, in new_error_context
2021-05-11T23:01:23.2099402Z     yield
2021-05-11T23:01:23.2099826Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.2101716Z     self.lower_inst(inst)
2021-05-11T23:01:23.2102279Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 323, in lower_inst
2021-05-11T23:01:23.2102787Z     val = self.lower_assign(ty, inst)
2021-05-11T23:01:23.2103311Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 499, in lower_assign
2021-05-11T23:01:23.2105133Z     return self.lower_expr(ty, value)
2021-05-11T23:01:23.2106482Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 1027, in lower_expr
2021-05-11T23:01:23.2107286Z     res = self.lower_call(resty, expr)
2021-05-11T23:01:23.2107833Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 742, in lower_call
2021-05-11T23:01:23.2108412Z     res = self._lower_call_ObjModeDispatcher(fnty, expr, signature)
2021-05-11T23:01:23.2109015Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 794, in _lower_call_ObjModeDispatcher
2021-05-11T23:01:23.2109778Z     callee = ObjModeUtils(self.pyapi).load_dispatcher(fnty, argtypes)
2021-05-11T23:01:23.2110491Z   File "/home/vsts/work/1/s/numba/core/pythonapi.py", line 1636, in load_dispatcher
2021-05-11T23:01:23.2111504Z     if serialize.is_serialiable(fnty.dispatcher):
2021-05-11T23:01:23.2112147Z   File "/home/vsts/work/1/s/numba/core/serialize.py", line 155, in is_serialiable
2021-05-11T23:01:23.2112749Z     pickler.dump(obj)
2021-05-11T23:01:23.2113346Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 563, in dump
2021-05-11T23:01:23.2113811Z     return Pickler.dump(self, obj)
2021-05-11T23:01:23.2114287Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 437, in dump
2021-05-11T23:01:23.2114736Z     self.save(obj)
2021-05-11T23:01:23.2115165Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2115639Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2116113Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.2116569Z     save(args)
2021-05-11T23:01:23.2116994Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2119394Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2120464Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2121004Z     save(element)
2021-05-11T23:01:23.2121515Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2122046Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2122597Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.2123116Z     save(args)
2021-05-11T23:01:23.2123621Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2124184Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2125104Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2125624Z     save(element)
2021-05-11T23:01:23.2126282Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2126982Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2127664Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2128147Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2128646Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2129113Z     save(v)
2021-05-11T23:01:23.2129725Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2130180Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2130986Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2131446Z     save(state)
2021-05-11T23:01:23.2131873Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2132374Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2132883Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2133364Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2134068Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2134630Z     save(v)
2021-05-11T23:01:23.2135083Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2135604Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2136129Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2136616Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2137121Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2137589Z     save(v)
2021-05-11T23:01:23.2138036Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2138504Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2139173Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2139666Z     save(state)
2021-05-11T23:01:23.2140286Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2140943Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2141499Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2142004Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2142514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2144575Z     save(v)
2021-05-11T23:01:23.2145037Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2145561Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2146346Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 819, in save_list
2021-05-11T23:01:23.2147281Z     self._batch_appends(obj)
2021-05-11T23:01:23.2147807Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 843, in _batch_appends
2021-05-11T23:01:23.2148332Z     save(x)
2021-05-11T23:01:23.2148826Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2149358Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2149900Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2151798Z     save(state)
2021-05-11T23:01:23.2152281Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2152801Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2153322Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2153799Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2154304Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2154771Z     save(v)
2021-05-11T23:01:23.2155214Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2155686Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2156175Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2156646Z     save(state)
2021-05-11T23:01:23.2157308Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2158052Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2158583Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2159100Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2159810Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2160636Z     save(v)
2021-05-11T23:01:23.2161256Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2161785Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2162431Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 745, in save_function
2021-05-11T23:01:23.2163040Z     *self._dynamic_function_reduce(obj), obj=obj
2021-05-11T23:01:23.2163515Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 687, in _save_reduce_pickle5
2021-05-11T23:01:23.2164009Z     save(state)
2021-05-11T23:01:23.2164476Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2165009Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2165718Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2166590Z     save(element)
2021-05-11T23:01:23.2167043Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2167560Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2168082Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2168565Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2169063Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2169530Z     save(v)
2021-05-11T23:01:23.2169974Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2170493Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2171008Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2171503Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2172180Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2172660Z     save(v)
2021-05-11T23:01:23.2173101Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2173595Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2174291Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2174790Z     save(state)
2021-05-11T23:01:23.2175253Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2175803Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2176364Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2176892Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2177423Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2178215Z     save(v)
2021-05-11T23:01:23.2178663Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2179297Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2179966Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2180420Z     save(state)
2021-05-11T23:01:23.2181138Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2181724Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2182254Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2182853Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2183358Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2183823Z     save(v)
2021-05-11T23:01:23.2184270Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 524, in save
2021-05-11T23:01:23.2184744Z     rv = reduce(self.proto)
2021-05-11T23:01:23.2185242Z numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: Handle with contexts)
2021-05-11T23:01:23.2185818Z Failed in nopython mode pipeline (step: native lowering)
2021-05-11T23:01:23.2186802Z can't pickle _thread.lock objects
2021-05-11T23:01:23.2187253Z 
2021-05-11T23:01:23.2187633Z File "<string>", line 19:
2021-05-11T23:01:23.2188054Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2188291Z 
2021-05-11T23:01:23.2188755Z During: lowering "$11 = call $10(func=$10, args=[], kws=(), vararg=None, target=None)" at <string> (19)
2021-05-11T23:01:23.2189400Z During: resolving callee type: type(CPUDispatcher(<function obj_mode_func at 0x7f4269cb9c20>))
2021-05-11T23:01:23.2189915Z During: typing of call at <string> (27)
2021-05-11T23:01:23.2190176Z 
2021-05-11T23:01:23.2190352Z 
2021-05-11T23:01:23.2190937Z The above exception was the direct cause of the following exception:
2021-05-11T23:01:23.2191248Z 
2021-05-11T23:01:23.2191605Z Traceback (most recent call last):
2021-05-11T23:01:23.2192466Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/threading.py", line 926, in _bootstrap_inner
2021-05-11T23:01:23.2192932Z     self.run()
2021-05-11T23:01:23.2193387Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/threading.py", line 870, in run
2021-05-11T23:01:23.2193897Z     self._target(*self._args, **self._kwargs)
2021-05-11T23:01:23.2194319Z   File "<string>", line 31, in runner
2021-05-11T23:01:23.2194785Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 421, in _compile_for_args
2021-05-11T23:01:23.2195479Z     error_rewrite(e, 'typing')
2021-05-11T23:01:23.2195991Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 360, in error_rewrite
2021-05-11T23:01:23.2196664Z     raise e
2021-05-11T23:01:23.2197341Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 373, in _compile_for_args
2021-05-11T23:01:23.2197861Z     return_val = self.compile(tuple(argtypes))
2021-05-11T23:01:23.2198370Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 911, in compile
2021-05-11T23:01:23.2199052Z     cres = self._compiler.compile(args, return_type)
2021-05-11T23:01:23.2199754Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 84, in compile
2021-05-11T23:01:23.2200543Z     raise retval
2021-05-11T23:01:23.2200995Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 94, in _compile_cached
2021-05-11T23:01:23.2202395Z     retval = self._compile_core(args, return_type)
2021-05-11T23:01:23.2202970Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 112, in _compile_core
2021-05-11T23:01:23.2203493Z     pipeline_class=self.pipeline_class)
2021-05-11T23:01:23.2204019Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 675, in compile_extra
2021-05-11T23:01:23.2204550Z     return pipeline.compile_extra(func)
2021-05-11T23:01:23.2205274Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 419, in compile_extra
2021-05-11T23:01:23.2205749Z     return self._compile_bytecode()
2021-05-11T23:01:23.2206211Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 483, in _compile_bytecode
2021-05-11T23:01:23.2206687Z     return self._compile_core()
2021-05-11T23:01:23.2207153Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2207600Z     raise e
2021-05-11T23:01:23.2208019Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2208476Z     pm.run(self.state)
2021-05-11T23:01:23.2208931Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2209531Z     raise patched_exception
2021-05-11T23:01:23.2210092Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2210572Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2211066Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2211551Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2212005Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2212510Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2213015Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2214577Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2215202Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 112, in run_pass
2021-05-11T23:01:23.2215701Z     raise_errors=self._raise_errors)
2021-05-11T23:01:23.2216545Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 83, in type_inference_stage
2021-05-11T23:01:23.2217268Z     errs = infer.propagate(raise_errors=raise_errors)
2021-05-11T23:01:23.2217784Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 1071, in propagate
2021-05-11T23:01:23.2218230Z     raise errors[0]
2021-05-11T23:01:23.2218747Z numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
2021-05-11T23:01:23.2219353Z Internal error at <numba.core.typeinfer.CallConstraint object at 0x7f424a91e2d0>.
2021-05-11T23:01:23.2220357Z Failed in nopython mode pipeline (step: Handle with contexts)
2021-05-11T23:01:23.2221018Z Failed in nopython mode pipeline (step: native lowering)
2021-05-11T23:01:23.2221837Z can't pickle _thread.lock objects
2021-05-11T23:01:23.2222138Z 
2021-05-11T23:01:23.2222500Z File "<string>", line 19:
2021-05-11T23:01:23.2222972Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2223214Z 
2021-05-11T23:01:23.2223903Z During: lowering "$11 = call $10(func=$10, args=[], kws=(), vararg=None, target=None)" at <string> (19)
2021-05-11T23:01:23.2224530Z During: resolving callee type: type(CPUDispatcher(<function obj_mode_func at 0x7f4269cb9c20>))
2021-05-11T23:01:23.2225050Z During: typing of call at <string> (27)
2021-05-11T23:01:23.2225289Z 
2021-05-11T23:01:23.2225647Z Enable logging at debug level for details.
2021-05-11T23:01:23.2225886Z 
2021-05-11T23:01:23.2226189Z File "<string>", line 27:
2021-05-11T23:01:23.2226588Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2226815Z 
2021-05-11T23:01:23.2226981Z 
2021-05-11T23:01:23.2227162Z 
2021-05-11T23:01:23.2227356Z 
2021-05-11T23:01:23.2227995Z ----------------------------------------------------------------------
2021-05-11T23:01:23.2228492Z Ran 541 tests in 795.331s
2021-05-11T23:01:23.2228710Z 
2021-05-11T23:01:23.2229083Z FAILED (failures=1, skipped=40, expected failures=2)
2021-05-11T23:01:24.6503089Z ##[error]Bash exited with code '1'.
2021-05-11T23:01:24.6519092Z ##[section]Finishing: Test

```

</details>

unittest: tbb test fork from non main thread is broken on mainline
- [x] I have tried using the ~mainline~ released version of Numba (most recent is
 visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).

Current HEAD (d0ca288) of mainline has this failure on CI, happened on Python 3.7 with TBB.:
<details>
<summary>Details:</summary>

```
======================================================================
2021-05-11T23:01:23.1946584Z FAIL: test_fork_from_non_main_thread (numba.tests.test_parallel_backend.TestTBBSpecificIssues)
2021-05-11T23:01:23.1947935Z ----------------------------------------------------------------------
2021-05-11T23:01:23.1948686Z Traceback (most recent call last):
2021-05-11T23:01:23.1949243Z   File "/home/vsts/work/1/s/numba/tests/test_parallel_backend.py", line 945, in test_fork_from_non_main_thread
2021-05-11T23:01:23.1950157Z     out, err = self.run_cmd(cmdline)
2021-05-11T23:01:23.1950645Z   File "/home/vsts/work/1/s/numba/tests/test_parallel_backend.py", line 477, in run_cmd
2021-05-11T23:01:23.1951145Z     (popen.returncode, err.decode()))
2021-05-11T23:01:23.1952200Z AssertionError: process failed with code -9: stderr follows
2021-05-11T23:01:23.1952874Z Exception in thread Thread-1:
2021-05-11T23:01:23.1953694Z Traceback (most recent call last):
2021-05-11T23:01:23.1954208Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 744, in new_error_context
2021-05-11T23:01:23.1954646Z     yield
2021-05-11T23:01:23.1955082Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.1955543Z     self.lower_inst(inst)
2021-05-11T23:01:23.1956005Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 323, in lower_inst
2021-05-11T23:01:23.1956461Z     val = self.lower_assign(ty, inst)
2021-05-11T23:01:23.1957100Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 499, in lower_assign
2021-05-11T23:01:23.1957582Z     return self.lower_expr(ty, value)
2021-05-11T23:01:23.1958058Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 1027, in lower_expr
2021-05-11T23:01:23.1958534Z     res = self.lower_call(resty, expr)
2021-05-11T23:01:23.1959046Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 742, in lower_call
2021-05-11T23:01:23.1959574Z     res = self._lower_call_ObjModeDispatcher(fnty, expr, signature)
2021-05-11T23:01:23.1960126Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 794, in _lower_call_ObjModeDispatcher
2021-05-11T23:01:23.1960676Z     callee = ObjModeUtils(self.pyapi).load_dispatcher(fnty, argtypes)
2021-05-11T23:01:23.1961188Z   File "/home/vsts/work/1/s/numba/core/pythonapi.py", line 1636, in load_dispatcher
2021-05-11T23:01:23.1961719Z     if serialize.is_serialiable(fnty.dispatcher):
2021-05-11T23:01:23.1962239Z   File "/home/vsts/work/1/s/numba/core/serialize.py", line 155, in is_serialiable
2021-05-11T23:01:23.1962965Z     pickler.dump(obj)
2021-05-11T23:01:23.1963476Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 563, in dump
2021-05-11T23:01:23.1963989Z     return Pickler.dump(self, obj)
2021-05-11T23:01:23.1964520Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 437, in dump
2021-05-11T23:01:23.1965037Z     self.save(obj)
2021-05-11T23:01:23.1965540Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1966053Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1966602Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.1967270Z     save(args)
2021-05-11T23:01:23.1967753Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1968292Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1968853Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.1969361Z     save(element)
2021-05-11T23:01:23.1969848Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1970363Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1970878Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.1971375Z     save(args)
2021-05-11T23:01:23.1972228Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1972926Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1973455Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.1973935Z     save(element)
2021-05-11T23:01:23.1974565Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1975084Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1975597Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1976093Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1976593Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1977177Z     save(v)
2021-05-11T23:01:23.1977614Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1978096Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1978587Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1979059Z     save(state)
2021-05-11T23:01:23.1979514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1980016Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1980540Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1981643Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1982375Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1982863Z     save(v)
2021-05-11T23:01:23.1983337Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1983894Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1984454Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1985289Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1985775Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1986239Z     save(v)
2021-05-11T23:01:23.1986692Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1987177Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1987658Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1988123Z     save(state)
2021-05-11T23:01:23.1988576Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1989093Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1989606Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1990101Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1990602Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.1991069Z     save(v)
2021-05-11T23:01:23.1991514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1992016Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1992606Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 819, in save_list
2021-05-11T23:01:23.1993095Z     self._batch_appends(obj)
2021-05-11T23:01:23.1993584Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 843, in _batch_appends
2021-05-11T23:01:23.1994032Z     save(x)
2021-05-11T23:01:23.1994477Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.1994966Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.1995454Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.1995939Z     save(state)
2021-05-11T23:01:23.1996587Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.1997375Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.1997953Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.1998500Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.1999040Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2000098Z     save(v)
2021-05-11T23:01:23.2000621Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2001158Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2001843Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2002371Z     save(state)
2021-05-11T23:01:23.2003700Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2004360Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2004928Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2005483Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2006699Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2007373Z     save(v)
2021-05-11T23:01:23.2008028Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2008766Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2009347Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 745, in save_function
2021-05-11T23:01:23.2010075Z     *self._dynamic_function_reduce(obj), obj=obj
2021-05-11T23:01:23.2010818Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 687, in _save_reduce_pickle5
2021-05-11T23:01:23.2011334Z     save(state)
2021-05-11T23:01:23.2011833Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2012403Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2012985Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2013506Z     save(element)
2021-05-11T23:01:23.2013998Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2014574Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2015155Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2015964Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2016470Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2017114Z     save(v)
2021-05-11T23:01:23.2017564Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2018087Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2018590Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2019319Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2019839Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2020331Z     save(v)
2021-05-11T23:01:23.2024862Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2025545Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2026089Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2026591Z     save(state)
2021-05-11T23:01:23.2027063Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2027586Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2028129Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2028646Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2029167Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2029655Z     save(v)
2021-05-11T23:01:23.2030099Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2030974Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2031439Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2031882Z     save(state)
2021-05-11T23:01:23.2032447Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2032948Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2033445Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2033919Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2034377Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2034829Z     save(v)
2021-05-11T23:01:23.2035252Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 524, in save
2021-05-11T23:01:23.2035702Z     rv = reduce(self.proto)
2021-05-11T23:01:23.2036514Z TypeError: can't pickle _thread.lock objects
2021-05-11T23:01:23.2036818Z 
2021-05-11T23:01:23.2037240Z During handling of the above exception, another exception occurred:
2021-05-11T23:01:23.2037539Z 
2021-05-11T23:01:23.2037879Z Traceback (most recent call last):
2021-05-11T23:01:23.2038323Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 154, in propagate
2021-05-11T23:01:23.2038760Z     constraint(typeinfer)
2021-05-11T23:01:23.2039192Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 566, in __call__
2021-05-11T23:01:23.2039648Z     self.resolve(typeinfer, typevars, fnty)
2021-05-11T23:01:23.2040082Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 586, in resolve
2021-05-11T23:01:23.2040555Z     sig = typeinfer.resolve_call(fnty, pos_args, kw_args)
2021-05-11T23:01:23.2041253Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 1538, in resolve_call
2021-05-11T23:01:23.2041770Z     return self.context.resolve_function_type(fnty, pos_args, kw_args)
2021-05-11T23:01:23.2042309Z   File "/home/vsts/work/1/s/numba/core/typing/context.py", line 195, in resolve_function_type
2021-05-11T23:01:23.2042810Z     res = self._resolve_user_function_type(func, args, kws)
2021-05-11T23:01:23.2043336Z   File "/home/vsts/work/1/s/numba/core/typing/context.py", line 247, in _resolve_user_function_type
2021-05-11T23:01:23.2043852Z     return func.get_call_type(self, args, kws)
2021-05-11T23:01:23.2044339Z   File "/home/vsts/work/1/s/numba/core/types/functions.py", line 552, in get_call_type
2021-05-11T23:01:23.2045022Z     self.dispatcher.get_call_template(args, kws)
2021-05-11T23:01:23.2045498Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 316, in get_call_template
2021-05-11T23:01:23.2045949Z     self.compile(tuple(args))
2021-05-11T23:01:23.2046632Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 911, in compile
2021-05-11T23:01:23.2047309Z     cres = self._compiler.compile(args, return_type)
2021-05-11T23:01:23.2047789Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 80, in compile
2021-05-11T23:01:23.2048299Z     status, retval = self._compile_cached(args, return_type)
2021-05-11T23:01:23.2048819Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 94, in _compile_cached
2021-05-11T23:01:23.2049318Z     retval = self._compile_core(args, return_type)
2021-05-11T23:01:23.2049805Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 112, in _compile_core
2021-05-11T23:01:23.2050289Z     pipeline_class=self.pipeline_class)
2021-05-11T23:01:23.2050765Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 675, in compile_extra
2021-05-11T23:01:23.2051241Z     return pipeline.compile_extra(func)
2021-05-11T23:01:23.2051702Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 419, in compile_extra
2021-05-11T23:01:23.2052553Z     return self._compile_bytecode()
2021-05-11T23:01:23.2053007Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 483, in _compile_bytecode
2021-05-11T23:01:23.2053460Z     return self._compile_core()
2021-05-11T23:01:23.2053901Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2054301Z     raise e
2021-05-11T23:01:23.2054711Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2055260Z     pm.run(self.state)
2021-05-11T23:01:23.2055702Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2056123Z     raise patched_exception
2021-05-11T23:01:23.2056556Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2057074Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2057648Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2058102Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2058655Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2059287Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2059948Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2060451Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2061086Z   File "/home/vsts/work/1/s/numba/core/untyped_passes.py", line 262, in run_pass
2021-05-11T23:01:23.2061642Z     pipeline_class=type(state.pipeline))
2021-05-11T23:01:23.2062179Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 739, in compile_ir
2021-05-11T23:01:23.2062621Z     lifted_from=lifted_from)
2021-05-11T23:01:23.2063110Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 429, in compile_ir
2021-05-11T23:01:23.2063595Z     return self._compile_ir()
2021-05-11T23:01:23.2064122Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 490, in _compile_ir
2021-05-11T23:01:23.2064574Z     return self._compile_core()
2021-05-11T23:01:23.2065228Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2065689Z     raise e
2021-05-11T23:01:23.2066149Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2066568Z     pm.run(self.state)
2021-05-11T23:01:23.2067048Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2067530Z     raise patched_exception
2021-05-11T23:01:23.2068004Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2068448Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2068956Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2069498Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2069987Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2070456Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2070962Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2071464Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2071949Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 396, in run_pass
2021-05-11T23:01:23.2072430Z     lower.lower()
2021-05-11T23:01:23.2072833Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 136, in lower
2021-05-11T23:01:23.2093383Z     self.lower_normal_function(self.fndesc)
2021-05-11T23:01:23.2093894Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 190, in lower_normal_function
2021-05-11T23:01:23.2094373Z     entry_block_tail = self.lower_function_body()
2021-05-11T23:01:23.2094818Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 216, in lower_function_body
2021-05-11T23:01:23.2095254Z     self.lower_block(block)
2021-05-11T23:01:23.2095676Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.2096278Z     self.lower_inst(inst)
2021-05-11T23:01:23.2096905Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/contextlib.py", line 130, in __exit__
2021-05-11T23:01:23.2097417Z     self.gen.throw(type, value, traceback)
2021-05-11T23:01:23.2097895Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 751, in new_error_context
2021-05-11T23:01:23.2098364Z     raise newerr.with_traceback(tb)
2021-05-11T23:01:23.2098824Z   File "/home/vsts/work/1/s/numba/core/errors.py", line 744, in new_error_context
2021-05-11T23:01:23.2099402Z     yield
2021-05-11T23:01:23.2099826Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 230, in lower_block
2021-05-11T23:01:23.2101716Z     self.lower_inst(inst)
2021-05-11T23:01:23.2102279Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 323, in lower_inst
2021-05-11T23:01:23.2102787Z     val = self.lower_assign(ty, inst)
2021-05-11T23:01:23.2103311Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 499, in lower_assign
2021-05-11T23:01:23.2105133Z     return self.lower_expr(ty, value)
2021-05-11T23:01:23.2106482Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 1027, in lower_expr
2021-05-11T23:01:23.2107286Z     res = self.lower_call(resty, expr)
2021-05-11T23:01:23.2107833Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 742, in lower_call
2021-05-11T23:01:23.2108412Z     res = self._lower_call_ObjModeDispatcher(fnty, expr, signature)
2021-05-11T23:01:23.2109015Z   File "/home/vsts/work/1/s/numba/core/lowering.py", line 794, in _lower_call_ObjModeDispatcher
2021-05-11T23:01:23.2109778Z     callee = ObjModeUtils(self.pyapi).load_dispatcher(fnty, argtypes)
2021-05-11T23:01:23.2110491Z   File "/home/vsts/work/1/s/numba/core/pythonapi.py", line 1636, in load_dispatcher
2021-05-11T23:01:23.2111504Z     if serialize.is_serialiable(fnty.dispatcher):
2021-05-11T23:01:23.2112147Z   File "/home/vsts/work/1/s/numba/core/serialize.py", line 155, in is_serialiable
2021-05-11T23:01:23.2112749Z     pickler.dump(obj)
2021-05-11T23:01:23.2113346Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 563, in dump
2021-05-11T23:01:23.2113811Z     return Pickler.dump(self, obj)
2021-05-11T23:01:23.2114287Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 437, in dump
2021-05-11T23:01:23.2114736Z     self.save(obj)
2021-05-11T23:01:23.2115165Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2115639Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2116113Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.2116569Z     save(args)
2021-05-11T23:01:23.2116994Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2119394Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2120464Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2121004Z     save(element)
2021-05-11T23:01:23.2121515Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2122046Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2122597Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 638, in save_reduce
2021-05-11T23:01:23.2123116Z     save(args)
2021-05-11T23:01:23.2123621Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2124184Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2125104Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2125624Z     save(element)
2021-05-11T23:01:23.2126282Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2126982Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2127664Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2128147Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2128646Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2129113Z     save(v)
2021-05-11T23:01:23.2129725Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2130180Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2130986Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2131446Z     save(state)
2021-05-11T23:01:23.2131873Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2132374Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2132883Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2133364Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2134068Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2134630Z     save(v)
2021-05-11T23:01:23.2135083Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2135604Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2136129Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2136616Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2137121Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2137589Z     save(v)
2021-05-11T23:01:23.2138036Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2138504Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2139173Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2139666Z     save(state)
2021-05-11T23:01:23.2140286Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2140943Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2141499Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2142004Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2142514Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2144575Z     save(v)
2021-05-11T23:01:23.2145037Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2145561Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2146346Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 819, in save_list
2021-05-11T23:01:23.2147281Z     self._batch_appends(obj)
2021-05-11T23:01:23.2147807Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 843, in _batch_appends
2021-05-11T23:01:23.2148332Z     save(x)
2021-05-11T23:01:23.2148826Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2149358Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2149900Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2151798Z     save(state)
2021-05-11T23:01:23.2152281Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2152801Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2153322Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2153799Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2154304Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2154771Z     save(v)
2021-05-11T23:01:23.2155214Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2155686Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2156175Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2156646Z     save(state)
2021-05-11T23:01:23.2157308Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2158052Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2158583Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2159100Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2159810Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2160636Z     save(v)
2021-05-11T23:01:23.2161256Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2161785Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2162431Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 745, in save_function
2021-05-11T23:01:23.2163040Z     *self._dynamic_function_reduce(obj), obj=obj
2021-05-11T23:01:23.2163515Z   File "/home/vsts/work/1/s/numba/cloudpickle/cloudpickle_fast.py", line 687, in _save_reduce_pickle5
2021-05-11T23:01:23.2164009Z     save(state)
2021-05-11T23:01:23.2164476Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2165009Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2165718Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 774, in save_tuple
2021-05-11T23:01:23.2166590Z     save(element)
2021-05-11T23:01:23.2167043Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2167560Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2168082Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2168565Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2169063Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2169530Z     save(v)
2021-05-11T23:01:23.2169974Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2170493Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2171008Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2171503Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2172180Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2172660Z     save(v)
2021-05-11T23:01:23.2173101Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2173595Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2174291Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2174790Z     save(state)
2021-05-11T23:01:23.2175253Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2175803Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2176364Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2176892Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2177423Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2178215Z     save(v)
2021-05-11T23:01:23.2178663Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 549, in save
2021-05-11T23:01:23.2179297Z     self.save_reduce(obj=obj, *rv)
2021-05-11T23:01:23.2179966Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 662, in save_reduce
2021-05-11T23:01:23.2180420Z     save(state)
2021-05-11T23:01:23.2181138Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 504, in save
2021-05-11T23:01:23.2181724Z     f(self, obj) # Call unbound method with explicit self
2021-05-11T23:01:23.2182254Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 859, in save_dict
2021-05-11T23:01:23.2182853Z     self._batch_setitems(obj.items())
2021-05-11T23:01:23.2183358Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 885, in _batch_setitems
2021-05-11T23:01:23.2183823Z     save(v)
2021-05-11T23:01:23.2184270Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/pickle.py", line 524, in save
2021-05-11T23:01:23.2184744Z     rv = reduce(self.proto)
2021-05-11T23:01:23.2185242Z numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: Handle with contexts)
2021-05-11T23:01:23.2185818Z Failed in nopython mode pipeline (step: native lowering)
2021-05-11T23:01:23.2186802Z can't pickle _thread.lock objects
2021-05-11T23:01:23.2187253Z 
2021-05-11T23:01:23.2187633Z File "<string>", line 19:
2021-05-11T23:01:23.2188054Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2188291Z 
2021-05-11T23:01:23.2188755Z During: lowering "$11 = call $10(func=$10, args=[], kws=(), vararg=None, target=None)" at <string> (19)
2021-05-11T23:01:23.2189400Z During: resolving callee type: type(CPUDispatcher(<function obj_mode_func at 0x7f4269cb9c20>))
2021-05-11T23:01:23.2189915Z During: typing of call at <string> (27)
2021-05-11T23:01:23.2190176Z 
2021-05-11T23:01:23.2190352Z 
2021-05-11T23:01:23.2190937Z The above exception was the direct cause of the following exception:
2021-05-11T23:01:23.2191248Z 
2021-05-11T23:01:23.2191605Z Traceback (most recent call last):
2021-05-11T23:01:23.2192466Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/threading.py", line 926, in _bootstrap_inner
2021-05-11T23:01:23.2192932Z     self.run()
2021-05-11T23:01:23.2193387Z   File "/home/vsts/miniconda3/envs/azure_ci/lib/python3.7/threading.py", line 870, in run
2021-05-11T23:01:23.2193897Z     self._target(*self._args, **self._kwargs)
2021-05-11T23:01:23.2194319Z   File "<string>", line 31, in runner
2021-05-11T23:01:23.2194785Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 421, in _compile_for_args
2021-05-11T23:01:23.2195479Z     error_rewrite(e, 'typing')
2021-05-11T23:01:23.2195991Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 360, in error_rewrite
2021-05-11T23:01:23.2196664Z     raise e
2021-05-11T23:01:23.2197341Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 373, in _compile_for_args
2021-05-11T23:01:23.2197861Z     return_val = self.compile(tuple(argtypes))
2021-05-11T23:01:23.2198370Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 911, in compile
2021-05-11T23:01:23.2199052Z     cres = self._compiler.compile(args, return_type)
2021-05-11T23:01:23.2199754Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 84, in compile
2021-05-11T23:01:23.2200543Z     raise retval
2021-05-11T23:01:23.2200995Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 94, in _compile_cached
2021-05-11T23:01:23.2202395Z     retval = self._compile_core(args, return_type)
2021-05-11T23:01:23.2202970Z   File "/home/vsts/work/1/s/numba/core/dispatcher.py", line 112, in _compile_core
2021-05-11T23:01:23.2203493Z     pipeline_class=self.pipeline_class)
2021-05-11T23:01:23.2204019Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 675, in compile_extra
2021-05-11T23:01:23.2204550Z     return pipeline.compile_extra(func)
2021-05-11T23:01:23.2205274Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 419, in compile_extra
2021-05-11T23:01:23.2205749Z     return self._compile_bytecode()
2021-05-11T23:01:23.2206211Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 483, in _compile_bytecode
2021-05-11T23:01:23.2206687Z     return self._compile_core()
2021-05-11T23:01:23.2207153Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 462, in _compile_core
2021-05-11T23:01:23.2207600Z     raise e
2021-05-11T23:01:23.2208019Z   File "/home/vsts/work/1/s/numba/core/compiler.py", line 453, in _compile_core
2021-05-11T23:01:23.2208476Z     pm.run(self.state)
2021-05-11T23:01:23.2208931Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 339, in run
2021-05-11T23:01:23.2209531Z     raise patched_exception
2021-05-11T23:01:23.2210092Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 330, in run
2021-05-11T23:01:23.2210572Z     self._runPass(idx, pass_inst, state)
2021-05-11T23:01:23.2211066Z   File "/home/vsts/work/1/s/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
2021-05-11T23:01:23.2211551Z     return func(*args, **kwargs)
2021-05-11T23:01:23.2212005Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 289, in _runPass
2021-05-11T23:01:23.2212510Z     mutated |= check(pss.run_pass, internal_state)
2021-05-11T23:01:23.2213015Z   File "/home/vsts/work/1/s/numba/core/compiler_machinery.py", line 262, in check
2021-05-11T23:01:23.2214577Z     mangled = func(compiler_state)
2021-05-11T23:01:23.2215202Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 112, in run_pass
2021-05-11T23:01:23.2215701Z     raise_errors=self._raise_errors)
2021-05-11T23:01:23.2216545Z   File "/home/vsts/work/1/s/numba/core/typed_passes.py", line 83, in type_inference_stage
2021-05-11T23:01:23.2217268Z     errs = infer.propagate(raise_errors=raise_errors)
2021-05-11T23:01:23.2217784Z   File "/home/vsts/work/1/s/numba/core/typeinfer.py", line 1071, in propagate
2021-05-11T23:01:23.2218230Z     raise errors[0]
2021-05-11T23:01:23.2218747Z numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
2021-05-11T23:01:23.2219353Z Internal error at <numba.core.typeinfer.CallConstraint object at 0x7f424a91e2d0>.
2021-05-11T23:01:23.2220357Z Failed in nopython mode pipeline (step: Handle with contexts)
2021-05-11T23:01:23.2221018Z Failed in nopython mode pipeline (step: native lowering)
2021-05-11T23:01:23.2221837Z can't pickle _thread.lock objects
2021-05-11T23:01:23.2222138Z 
2021-05-11T23:01:23.2222500Z File "<string>", line 19:
2021-05-11T23:01:23.2222972Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2223214Z 
2021-05-11T23:01:23.2223903Z During: lowering "$11 = call $10(func=$10, args=[], kws=(), vararg=None, target=None)" at <string> (19)
2021-05-11T23:01:23.2224530Z During: resolving callee type: type(CPUDispatcher(<function obj_mode_func at 0x7f4269cb9c20>))
2021-05-11T23:01:23.2225050Z During: typing of call at <string> (27)
2021-05-11T23:01:23.2225289Z 
2021-05-11T23:01:23.2225647Z Enable logging at debug level for details.
2021-05-11T23:01:23.2225886Z 
2021-05-11T23:01:23.2226189Z File "<string>", line 27:
2021-05-11T23:01:23.2226588Z <source missing, REPL/exec in use?>
2021-05-11T23:01:23.2226815Z 
2021-05-11T23:01:23.2226981Z 
2021-05-11T23:01:23.2227162Z 
2021-05-11T23:01:23.2227356Z 
2021-05-11T23:01:23.2227995Z ----------------------------------------------------------------------
2021-05-11T23:01:23.2228492Z Ran 541 tests in 795.331s
2021-05-11T23:01:23.2228710Z 
2021-05-11T23:01:23.2229083Z FAILED (failures=1, skipped=40, expected failures=2)
2021-05-11T23:01:24.6503089Z ##[error]Bash exited with code '1'.
2021-05-11T23:01:24.6519092Z ##[section]Finishing: Test

```

</details>



Discussion:
There are only 'skip'ped commits left to test.
The first bad commit could be any of:
b9a7fc148ad298e60b0b1197ef75eb04c4109b2c
e13d80c9af2238ae2d510b5669272debce7c3ef3
033452bc2b16e06121a3fa78dda592eb17fba32d
58c4e3282607199ad3e260919c3a4849b8088153
34db404262b50c1b90ef12108da4d4b2fa092900

Problem stems from here:
https://github.com/numba/numba/blob/d0ca288f24eccff3ba1f86e38f0de07a717f8d4c/numba/tests/test_parallel_backend.py#L904
guess that the cloudpickle changes are seeing around the indirection and trying to pickle the lock?
This is the problem:
```pycon
In [1]: from numba import cloudpickle as cp

In [2]: import pickle

In [3]: import threading

In [4]: event = threading.Event()

In [5]: def defer():
   ...:     event.set()
   ...: 

In [6]: pickle.dumps(defer)
Out[6]: b'\x80\x04\x95\x16\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x05defer\x94\x93\x94.'

In [7]: cp.dumps(defer)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-2f2f9825db97> in <module>
----> 1 cp.dumps(defer)

<path>numba/cloudpickle/cloudpickle_fast.py in dumps(obj, protocol, buffer_callback)
     71                 file, protocol=protocol, buffer_callback=buffer_callback
     72             )
---> 73             cp.dump(obj)
     74             return file.getvalue()
     75 

<path>numba/cloudpickle/cloudpickle_fast.py in dump(self, obj)
    561     def dump(self, obj):
    562         try:
--> 563             return Pickler.dump(self, obj)
    564         except RuntimeError as e:
    565             if "recursion" in e.args[0]:

TypeError: cannot pickle '_thread.lock' object
```
The problem is caused by `cloudpickle` actually serializing functions and their globals; whereas, std `pickle` would refer to function by import paths. Both `cloudpickle` and `pickle` cannot serialize `_thread.lock`. So a possible fix is to customize the pickling on that particular function to serialize by import path:

```python

class PickleByPath:
    def __init__(self, fn):
        self._fn = fn

    def __call__(self, *args, **kwargs):
        return self._fn(*args, **kwargs)

    def __reduce__(self):
        return _rebuild, (__name__, self._fn.__name__,)


def _rebuild(modname, fn_path):
    import sys
    return PickleByPath(getattr(sys.modules[modname], fn_path))


def indirect_core():
    e_running.set()
    # wait for forker() to have forked
    while not e_proceed.isSet():
        pass

indirect = PickleByPath(indirect_core)
```
There are only 'skip'ped commits left to test.
The first bad commit could be any of:
b9a7fc148ad298e60b0b1197ef75eb04c4109b2c
e13d80c9af2238ae2d510b5669272debce7c3ef3
033452bc2b16e06121a3fa78dda592eb17fba32d
58c4e3282607199ad3e260919c3a4849b8088153
34db404262b50c1b90ef12108da4d4b2fa092900

Problem stems from here:
https://github.com/numba/numba/blob/d0ca288f24eccff3ba1f86e38f0de07a717f8d4c/numba/tests/test_parallel_backend.py#L904
guess that the cloudpickle changes are seeing around the indirection and trying to pickle the lock?
This is the problem:
```pycon
In [1]: from numba import cloudpickle as cp

In [2]: import pickle

In [3]: import threading

In [4]: event = threading.Event()

In [5]: def defer():
   ...:     event.set()
   ...: 

In [6]: pickle.dumps(defer)
Out[6]: b'\x80\x04\x95\x16\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x05defer\x94\x93\x94.'

In [7]: cp.dumps(defer)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-2f2f9825db97> in <module>
----> 1 cp.dumps(defer)

<path>numba/cloudpickle/cloudpickle_fast.py in dumps(obj, protocol, buffer_callback)
     71                 file, protocol=protocol, buffer_callback=buffer_callback
     72             )
---> 73             cp.dump(obj)
     74             return file.getvalue()
     75 

<path>numba/cloudpickle/cloudpickle_fast.py in dump(self, obj)
    561     def dump(self, obj):
    562         try:
--> 563             return Pickler.dump(self, obj)
    564         except RuntimeError as e:
    565             if "recursion" in e.args[0]:

TypeError: cannot pickle '_thread.lock' object
```
The problem is caused by `cloudpickle` actually serializing functions and their globals; whereas, std `pickle` would refer to function by import paths. Both `cloudpickle` and `pickle` cannot serialize `_thread.lock`. So a possible fix is to customize the pickling on that particular function to serialize by import path:

```python

class PickleByPath:
    def __init__(self, fn):
        self._fn = fn

    def __call__(self, *args, **kwargs):
        return self._fn(*args, **kwargs)

    def __reduce__(self):
        return _rebuild, (__name__, self._fn.__name__,)


def _rebuild(modname, fn_path):
    import sys
    return PickleByPath(getattr(sys.modules[modname], fn_path))


def indirect_core():
    e_running.set()
    # wait for forker() to have forked
    while not e_proceed.isSet():
        pass

indirect = PickleByPath(indirect_core)
```

Resolving patch:
diff --git a/numba/core/serialize.py b/numba/core/serialize.py
--- a/numba/core/serialize.py
+++ b/numba/core/serialize.py
@@ -1,6 +1,7 @@
 """
 Serialization support for compiled functions.
 """
+import sys
 import abc
 import io
 import copyreg
@@ -215,3 +216,33 @@ def _reduce_class(self):
 
     def __reduce__(self):
         return custom_reduce(self._reduce_class(), self._reduce_states())
+
+
+class PickleCallableByPath:
+    """Wrap a callable object to be pickled by path to workaround limitation
+    in pickling due to non-pickleable objects in function non-locals.
+
+    Note:
+    - Do not use this as a decorator.
+    - Wrapped object must be a global that exist in its parent module and it
+      can be imported by `from the_module import the_object`.
+
+    Usage:
+
+    >>> def my_fn(x):
+    >>>     ...
+    >>> wrapped_fn = PickleCallableByPath(my_fn)
+    >>> # refer to `wrapped_fn` instead of `my_fn`
+    """
+    def __init__(self, fn):
+        self._fn = fn
+
+    def __call__(self, *args, **kwargs):
+        return self._fn(*args, **kwargs)
+
+    def __reduce__(self):
+        return type(self)._rebuild, (self._fn.__module__, self._fn.__name__,)
+
+    @classmethod
+    def _rebuild(cls, modname, fn_path):
+        return cls(getattr(sys.modules[modname], fn_path))


Test patch:
diff --git a/numba/tests/test_parallel_backend.py b/numba/tests/test_parallel_backend.py
--- a/numba/tests/test_parallel_backend.py
+++ b/numba/tests/test_parallel_backend.py
@@ -895,17 +895,20 @@ def test_fork_from_non_main_thread(self):
             import numba
             numba.config.THREADING_LAYER='tbb'
             from numba import njit, prange, objmode
+            from numba.core.serialize import PickleCallableByPath
             import os
 
             e_running = threading.Event()
             e_proceed = threading.Event()
 
-            def indirect():
+            def indirect_core():
                 e_running.set()
                 # wait for forker() to have forked
                 while not e_proceed.isSet():
                     pass
 
+            indirect = PickleCallableByPath(indirect_core)
+
             @njit
             def obj_mode_func():
                 with objmode():