We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
No error for jit(nopython=True, forceobj=True)
- [ x] I am using the latest released version of Numba (most recent is visible in
 the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- [ x] I have included below a minimal working reproducer (if you are unsure how
 to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).

When using the `jit` decorator with both `nopython=True` and `forceobj=True` no error is reported, despite these flags probably being mutually exclusive.
```python
import numba

@numba.jit(nopython=True, forceobj=True)
def f():
    pass

f()
```
The prior example runs without complaints. If the `njit` decorator is used instead, appropriate warnings are thrown.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `numba/core/decorators.py`
Content:
```
1 """
2 Define @jit and related decorators.
3 """
4 
5 
6 import sys
7 import warnings
8 import inspect
9 import logging
10 
11 from numba.core.errors import DeprecationError, NumbaDeprecationWarning
12 from numba.stencils.stencil import stencil
13 from numba.core import config, sigutils, registry
14 
15 
16 _logger = logging.getLogger(__name__)
17 
18 
19 # -----------------------------------------------------------------------------
20 # Decorators
21 
22 _msg_deprecated_signature_arg = ("Deprecated keyword argument `{0}`. "
23                                  "Signatures should be passed as the first "
24                                  "positional argument.")
25 
26 def jit(signature_or_function=None, locals={}, target='cpu', cache=False,
27         pipeline_class=None, boundscheck=False, **options):
28     """
29     This decorator is used to compile a Python function into native code.
30 
31     Args
32     -----
33     signature_or_function:
34         The (optional) signature or list of signatures to be compiled.
35         If not passed, required signatures will be compiled when the
36         decorated function is called, depending on the argument values.
37         As a convenience, you can directly pass the function to be compiled
38         instead.
39 
40     locals: dict
41         Mapping of local variable names to Numba types. Used to override the
42         types deduced by Numba's type inference engine.
43 
44     target: str
45         Specifies the target platform to compile for. Valid targets are cpu,
46         gpu, npyufunc, and cuda. Defaults to cpu.
47 
48     pipeline_class: type numba.compiler.CompilerBase
49             The compiler pipeline type for customizing the compilation stages.
50 
51     options:
52         For a cpu target, valid options are:
53             nopython: bool
54                 Set to True to disable the use of PyObjects and Python API
55                 calls. The default behavior is to allow the use of PyObjects
56                 and Python API. Default value is False.
57 
58             forceobj: bool
59                 Set to True to force the use of PyObjects for every value.
60                 Default value is False.
61 
62             looplift: bool
63                 Set to True to enable jitting loops in nopython mode while
64                 leaving surrounding code in object mode. This allows functions
65                 to allocate NumPy arrays and use Python objects, while the
66                 tight loops in the function can still be compiled in nopython
67                 mode. Any arrays that the tight loop uses should be created
68                 before the loop is entered. Default value is True.
69 
70             error_model: str
71                 The error-model affects divide-by-zero behavior.
72                 Valid values are 'python' and 'numpy'. The 'python' model
73                 raises exception.  The 'numpy' model sets the result to
74                 *+/-inf* or *nan*. Default value is 'python'.
75 
76             inline: str or callable
77                 The inline option will determine whether a function is inlined
78                 at into its caller if called. String options are 'never'
79                 (default) which will never inline, and 'always', which will
80                 always inline. If a callable is provided it will be called with
81                 the call expression node that is requesting inlining, the
82                 caller's IR and callee's IR as arguments, it is expected to
83                 return Truthy as to whether to inline.
84                 NOTE: This inlining is performed at the Numba IR level and is in
85                 no way related to LLVM inlining.
86 
87             boundscheck: bool
88                 Set to True to enable bounds checking for array indices. Out
89                 of bounds accesses will raise IndexError. The default is to
90                 not do bounds checking. If bounds checking is disabled, out of
91                 bounds accesses can produce garbage results or segfaults.
92                 However, enabling bounds checking will slow down typical
93                 functions, so it is recommended to only use this flag for
94                 debugging. You can also set the NUMBA_BOUNDSCHECK environment
95                 variable to 0 or 1 to globally override this flag.
96 
97     Returns
98     --------
99     A callable usable as a compiled function.  Actual compiling will be
100     done lazily if no explicit signatures are passed.
101 
102     Examples
103     --------
104     The function can be used in the following ways:
105 
106     1) jit(signatures, target='cpu', **targetoptions) -> jit(function)
107 
108         Equivalent to:
109 
110             d = dispatcher(function, targetoptions)
111             for signature in signatures:
112                 d.compile(signature)
113 
114         Create a dispatcher object for a python function.  Then, compile
115         the function with the given signature(s).
116 
117         Example:
118 
119             @jit("int32(int32, int32)")
120             def foo(x, y):
121                 return x + y
122 
123             @jit(["int32(int32, int32)", "float32(float32, float32)"])
124             def bar(x, y):
125                 return x + y
126 
127     2) jit(function, target='cpu', **targetoptions) -> dispatcher
128 
129         Create a dispatcher function object that specializes at call site.
130 
131         Examples:
132 
133             @jit
134             def foo(x, y):
135                 return x + y
136 
137             @jit(target='cpu', nopython=True)
138             def bar(x, y):
139                 return x + y
140 
141     """
142     if 'argtypes' in options:
143         raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes'))
144     if 'restype' in options:
145         raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))
146 
147     options['boundscheck'] = boundscheck
148 
149     # Handle signature
150     if signature_or_function is None:
151         # No signature, no function
152         pyfunc = None
153         sigs = None
154     elif isinstance(signature_or_function, list):
155         # A list of signatures is passed
156         pyfunc = None
157         sigs = signature_or_function
158     elif sigutils.is_signature(signature_or_function):
159         # A single signature is passed
160         pyfunc = None
161         sigs = [signature_or_function]
162     else:
163         # A function is passed
164         pyfunc = signature_or_function
165         sigs = None
166 
167     dispatcher_args = {}
168     if pipeline_class is not None:
169         dispatcher_args['pipeline_class'] = pipeline_class
170     wrapper = _jit(sigs, locals=locals, target=target, cache=cache,
171                    targetoptions=options, **dispatcher_args)
172     if pyfunc is not None:
173         return wrapper(pyfunc)
174     else:
175         return wrapper
176 
177 
178 def _jit(sigs, locals, target, cache, targetoptions, **dispatcher_args):
179     dispatcher = registry.dispatcher_registry[target]
180 
181     def wrapper(func):
182         if config.ENABLE_CUDASIM and target == 'cuda':
183             from numba import cuda
184             return cuda.jit(func)
185         if config.DISABLE_JIT and not target == 'npyufunc':
186             return func
187         disp = dispatcher(py_func=func, locals=locals,
188                           targetoptions=targetoptions,
189                           **dispatcher_args)
190         if cache:
191             disp.enable_caching()
192         if sigs is not None:
193             # Register the Dispatcher to the type inference mechanism,
194             # even though the decorator hasn't returned yet.
195             from numba.core import typeinfer
196             with typeinfer.register_dispatcher(disp):
197                 for sig in sigs:
198                     disp.compile(sig)
199                 disp.disable_compile()
200         return disp
201 
202     return wrapper
203 
204 
205 def generated_jit(function=None, target='cpu', cache=False,
206                   pipeline_class=None, **options):
207     """
208     This decorator allows flexible type-based compilation
209     of a jitted function.  It works as `@jit`, except that the decorated
210     function is called at compile-time with the *types* of the arguments
211     and should return an implementation function for those types.
212     """
213     dispatcher_args = {}
214     if pipeline_class is not None:
215         dispatcher_args['pipeline_class'] = pipeline_class
216     wrapper = _jit(sigs=None, locals={}, target=target, cache=cache,
217                    targetoptions=options, impl_kind='generated',
218                    **dispatcher_args)
219     if function is not None:
220         return wrapper(function)
221     else:
222         return wrapper
223 
224 
225 def njit(*args, **kws):
226     """
227     Equivalent to jit(nopython=True)
228 
229     See documentation for jit function/decorator for full description.
230     """
231     if 'nopython' in kws:
232         warnings.warn('nopython is set for njit and is ignored', RuntimeWarning)
233     if 'forceobj' in kws:
234         warnings.warn('forceobj is set for njit and is ignored', RuntimeWarning)
235     kws.update({'nopython': True})
236     return jit(*args, **kws)
237 
238 
239 def cfunc(sig, locals={}, cache=False, **options):
240     """
241     This decorator is used to compile a Python function into a C callback
242     usable with foreign C libraries.
243 
244     Usage::
245         @cfunc("float64(float64, float64)", nopython=True, cache=True)
246         def add(a, b):
247             return a + b
248 
249     """
250     sig = sigutils.normalize_signature(sig)
251 
252     def wrapper(func):
253         from numba.core.ccallback import CFunc
254         res = CFunc(func, sig, locals=locals, options=options)
255         if cache:
256             res.enable_caching()
257         res.compile()
258         return res
259 
260     return wrapper
261 
262 
263 def jit_module(**kwargs):
264     """ Automatically ``jit``-wraps functions defined in a Python module
265 
266     Note that ``jit_module`` should only be called at the end of the module to
267     be jitted. In addition, only functions which are defined in the module
268     ``jit_module`` is called from are considered for automatic jit-wrapping.
269     See the Numba documentation for more information about what can/cannot be
270     jitted.
271 
272     :param kwargs: Keyword arguments to pass to ``jit`` such as ``nopython``
273                    or ``error_model``.
274 
275     """
276     # Get the module jit_module is being called from
277     frame = inspect.stack()[1]
278     module = inspect.getmodule(frame[0])
279     # Replace functions in module with jit-wrapped versions
280     for name, obj in module.__dict__.items():
281         if inspect.isfunction(obj) and inspect.getmodule(obj) == module:
282             _logger.debug("Auto decorating function {} from module {} with jit "
283                           "and options: {}".format(obj, module.__name__, kwargs))
284             module.__dict__[name] = jit(obj, **kwargs)
285
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/numba/core/decorators.py b/numba/core/decorators.py
--- a/numba/core/decorators.py
+++ b/numba/core/decorators.py
@@ -143,6 +143,8 @@
         raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes'))
     if 'restype' in options:
         raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))
+    if options.get('nopython', False) and options.get('forceobj', False):
+        raise ValueError("Only one of 'nopython' or 'forceobj' can be True.")
 
     options['boundscheck'] = boundscheck
 
@@ -232,6 +234,7 @@
         warnings.warn('nopython is set for njit and is ignored', RuntimeWarning)
     if 'forceobj' in kws:
         warnings.warn('forceobj is set for njit and is ignored', RuntimeWarning)
+        del kws['forceobj']
     kws.update({'nopython': True})
     return jit(*args, **kws)

{"golden_diff": "diff --git a/numba/core/decorators.py b/numba/core/decorators.py\n--- a/numba/core/decorators.py\n+++ b/numba/core/decorators.py\n@@ -143,6 +143,8 @@\n         raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes'))\n     if 'restype' in options:\n         raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))\n+    if options.get('nopython', False) and options.get('forceobj', False):\n+        raise ValueError(\"Only one of 'nopython' or 'forceobj' can be True.\")\n \n     options['boundscheck'] = boundscheck\n \n@@ -232,6 +234,7 @@\n         warnings.warn('nopython is set for njit and is ignored', RuntimeWarning)\n     if 'forceobj' in kws:\n         warnings.warn('forceobj is set for njit and is ignored', RuntimeWarning)\n+        del kws['forceobj']\n     kws.update({'nopython': True})\n     return jit(*args, **kws)\n", "issue": "No error for jit(nopython=True, forceobj=True)\n- [ x] I am using the latest released version of Numba (most recent is visible in\r\n the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).\r\n- [ x] I have included below a minimal working reproducer (if you are unsure how\r\n to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).\r\n\r\nWhen using the `jit` decorator with both `nopython=True` and `forceobj=True` no error is reported, despite these flags probably being mutually exclusive.\r\n```python\r\nimport numba\r\n\r\n@numba.jit(nopython=True, forceobj=True)\r\ndef f():\r\n    pass\r\n\r\nf()\r\n```\r\nThe prior example runs without complaints. If the `njit` decorator is used instead, appropriate warnings are thrown.\n", "before_files": [{"content": "\"\"\"\nDefine @jit and related decorators.\n\"\"\"\n\n\nimport sys\nimport warnings\nimport inspect\nimport logging\n\nfrom numba.core.errors import DeprecationError, NumbaDeprecationWarning\nfrom numba.stencils.stencil import stencil\nfrom numba.core import config, sigutils, registry\n\n\n_logger = logging.getLogger(__name__)\n\n\n# -----------------------------------------------------------------------------\n# Decorators\n\n_msg_deprecated_signature_arg = (\"Deprecated keyword argument `{0}`. \"\n                                 \"Signatures should be passed as the first \"\n                                 \"positional argument.\")\n\ndef jit(signature_or_function=None, locals={}, target='cpu', cache=False,\n        pipeline_class=None, boundscheck=False, **options):\n    \"\"\"\n    This decorator is used to compile a Python function into native code.\n\n    Args\n    -----\n    signature_or_function:\n        The (optional) signature or list of signatures to be compiled.\n        If not passed, required signatures will be compiled when the\n        decorated function is called, depending on the argument values.\n        As a convenience, you can directly pass the function to be compiled\n        instead.\n\n    locals: dict\n        Mapping of local variable names to Numba types. Used to override the\n        types deduced by Numba's type inference engine.\n\n    target: str\n        Specifies the target platform to compile for. Valid targets are cpu,\n        gpu, npyufunc, and cuda. Defaults to cpu.\n\n    pipeline_class: type numba.compiler.CompilerBase\n            The compiler pipeline type for customizing the compilation stages.\n\n    options:\n        For a cpu target, valid options are:\n            nopython: bool\n                Set to True to disable the use of PyObjects and Python API\n                calls. The default behavior is to allow the use of PyObjects\n                and Python API. Default value is False.\n\n            forceobj: bool\n                Set to True to force the use of PyObjects for every value.\n                Default value is False.\n\n            looplift: bool\n                Set to True to enable jitting loops in nopython mode while\n                leaving surrounding code in object mode. This allows functions\n                to allocate NumPy arrays and use Python objects, while the\n                tight loops in the function can still be compiled in nopython\n                mode. Any arrays that the tight loop uses should be created\n                before the loop is entered. Default value is True.\n\n            error_model: str\n                The error-model affects divide-by-zero behavior.\n                Valid values are 'python' and 'numpy'. The 'python' model\n                raises exception.  The 'numpy' model sets the result to\n                *+/-inf* or *nan*. Default value is 'python'.\n\n            inline: str or callable\n                The inline option will determine whether a function is inlined\n                at into its caller if called. String options are 'never'\n                (default) which will never inline, and 'always', which will\n                always inline. If a callable is provided it will be called with\n                the call expression node that is requesting inlining, the\n                caller's IR and callee's IR as arguments, it is expected to\n                return Truthy as to whether to inline.\n                NOTE: This inlining is performed at the Numba IR level and is in\n                no way related to LLVM inlining.\n\n            boundscheck: bool\n                Set to True to enable bounds checking for array indices. Out\n                of bounds accesses will raise IndexError. The default is to\n                not do bounds checking. If bounds checking is disabled, out of\n                bounds accesses can produce garbage results or segfaults.\n                However, enabling bounds checking will slow down typical\n                functions, so it is recommended to only use this flag for\n                debugging. You can also set the NUMBA_BOUNDSCHECK environment\n                variable to 0 or 1 to globally override this flag.\n\n    Returns\n    --------\n    A callable usable as a compiled function.  Actual compiling will be\n    done lazily if no explicit signatures are passed.\n\n    Examples\n    --------\n    The function can be used in the following ways:\n\n    1) jit(signatures, target='cpu', **targetoptions) -> jit(function)\n\n        Equivalent to:\n\n            d = dispatcher(function, targetoptions)\n            for signature in signatures:\n                d.compile(signature)\n\n        Create a dispatcher object for a python function.  Then, compile\n        the function with the given signature(s).\n\n        Example:\n\n            @jit(\"int32(int32, int32)\")\n            def foo(x, y):\n                return x + y\n\n            @jit([\"int32(int32, int32)\", \"float32(float32, float32)\"])\n            def bar(x, y):\n                return x + y\n\n    2) jit(function, target='cpu', **targetoptions) -> dispatcher\n\n        Create a dispatcher function object that specializes at call site.\n\n        Examples:\n\n            @jit\n            def foo(x, y):\n                return x + y\n\n            @jit(target='cpu', nopython=True)\n            def bar(x, y):\n                return x + y\n\n    \"\"\"\n    if 'argtypes' in options:\n        raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes'))\n    if 'restype' in options:\n        raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))\n\n    options['boundscheck'] = boundscheck\n\n    # Handle signature\n    if signature_or_function is None:\n        # No signature, no function\n        pyfunc = None\n        sigs = None\n    elif isinstance(signature_or_function, list):\n        # A list of signatures is passed\n        pyfunc = None\n        sigs = signature_or_function\n    elif sigutils.is_signature(signature_or_function):\n        # A single signature is passed\n        pyfunc = None\n        sigs = [signature_or_function]\n    else:\n        # A function is passed\n        pyfunc = signature_or_function\n        sigs = None\n\n    dispatcher_args = {}\n    if pipeline_class is not None:\n        dispatcher_args['pipeline_class'] = pipeline_class\n    wrapper = _jit(sigs, locals=locals, target=target, cache=cache,\n                   targetoptions=options, **dispatcher_args)\n    if pyfunc is not None:\n        return wrapper(pyfunc)\n    else:\n        return wrapper\n\n\ndef _jit(sigs, locals, target, cache, targetoptions, **dispatcher_args):\n    dispatcher = registry.dispatcher_registry[target]\n\n    def wrapper(func):\n        if config.ENABLE_CUDASIM and target == 'cuda':\n            from numba import cuda\n            return cuda.jit(func)\n        if config.DISABLE_JIT and not target == 'npyufunc':\n            return func\n        disp = dispatcher(py_func=func, locals=locals,\n                          targetoptions=targetoptions,\n                          **dispatcher_args)\n        if cache:\n            disp.enable_caching()\n        if sigs is not None:\n            # Register the Dispatcher to the type inference mechanism,\n            # even though the decorator hasn't returned yet.\n            from numba.core import typeinfer\n            with typeinfer.register_dispatcher(disp):\n                for sig in sigs:\n                    disp.compile(sig)\n                disp.disable_compile()\n        return disp\n\n    return wrapper\n\n\ndef generated_jit(function=None, target='cpu', cache=False,\n                  pipeline_class=None, **options):\n    \"\"\"\n    This decorator allows flexible type-based compilation\n    of a jitted function.  It works as `@jit`, except that the decorated\n    function is called at compile-time with the *types* of the arguments\n    and should return an implementation function for those types.\n    \"\"\"\n    dispatcher_args = {}\n    if pipeline_class is not None:\n        dispatcher_args['pipeline_class'] = pipeline_class\n    wrapper = _jit(sigs=None, locals={}, target=target, cache=cache,\n                   targetoptions=options, impl_kind='generated',\n                   **dispatcher_args)\n    if function is not None:\n        return wrapper(function)\n    else:\n        return wrapper\n\n\ndef njit(*args, **kws):\n    \"\"\"\n    Equivalent to jit(nopython=True)\n\n    See documentation for jit function/decorator for full description.\n    \"\"\"\n    if 'nopython' in kws:\n        warnings.warn('nopython is set for njit and is ignored', RuntimeWarning)\n    if 'forceobj' in kws:\n        warnings.warn('forceobj is set for njit and is ignored', RuntimeWarning)\n    kws.update({'nopython': True})\n    return jit(*args, **kws)\n\n\ndef cfunc(sig, locals={}, cache=False, **options):\n    \"\"\"\n    This decorator is used to compile a Python function into a C callback\n    usable with foreign C libraries.\n\n    Usage::\n        @cfunc(\"float64(float64, float64)\", nopython=True, cache=True)\n        def add(a, b):\n            return a + b\n\n    \"\"\"\n    sig = sigutils.normalize_signature(sig)\n\n    def wrapper(func):\n        from numba.core.ccallback import CFunc\n        res = CFunc(func, sig, locals=locals, options=options)\n        if cache:\n            res.enable_caching()\n        res.compile()\n        return res\n\n    return wrapper\n\n\ndef jit_module(**kwargs):\n    \"\"\" Automatically ``jit``-wraps functions defined in a Python module\n\n    Note that ``jit_module`` should only be called at the end of the module to\n    be jitted. In addition, only functions which are defined in the module\n    ``jit_module`` is called from are considered for automatic jit-wrapping.\n    See the Numba documentation for more information about what can/cannot be\n    jitted.\n\n    :param kwargs: Keyword arguments to pass to ``jit`` such as ``nopython``\n                   or ``error_model``.\n\n    \"\"\"\n    # Get the module jit_module is being called from\n    frame = inspect.stack()[1]\n    module = inspect.getmodule(frame[0])\n    # Replace functions in module with jit-wrapped versions\n    for name, obj in module.__dict__.items():\n        if inspect.isfunction(obj) and inspect.getmodule(obj) == module:\n            _logger.debug(\"Auto decorating function {} from module {} with jit \"\n                          \"and options: {}\".format(obj, module.__name__, kwargs))\n            module.__dict__[name] = jit(obj, **kwargs)\n", "path": "numba/core/decorators.py"}], "after_files": [{"content": "\"\"\"\nDefine @jit and related decorators.\n\"\"\"\n\n\nimport sys\nimport warnings\nimport inspect\nimport logging\n\nfrom numba.core.errors import DeprecationError, NumbaDeprecationWarning\nfrom numba.stencils.stencil import stencil\nfrom numba.core import config, sigutils, registry\n\n\n_logger = logging.getLogger(__name__)\n\n\n# -----------------------------------------------------------------------------\n# Decorators\n\n_msg_deprecated_signature_arg = (\"Deprecated keyword argument `{0}`. \"\n                                 \"Signatures should be passed as the first \"\n                                 \"positional argument.\")\n\ndef jit(signature_or_function=None, locals={}, target='cpu', cache=False,\n        pipeline_class=None, boundscheck=False, **options):\n    \"\"\"\n    This decorator is used to compile a Python function into native code.\n\n    Args\n    -----\n    signature_or_function:\n        The (optional) signature or list of signatures to be compiled.\n        If not passed, required signatures will be compiled when the\n        decorated function is called, depending on the argument values.\n        As a convenience, you can directly pass the function to be compiled\n        instead.\n\n    locals: dict\n        Mapping of local variable names to Numba types. Used to override the\n        types deduced by Numba's type inference engine.\n\n    target: str\n        Specifies the target platform to compile for. Valid targets are cpu,\n        gpu, npyufunc, and cuda. Defaults to cpu.\n\n    pipeline_class: type numba.compiler.CompilerBase\n            The compiler pipeline type for customizing the compilation stages.\n\n    options:\n        For a cpu target, valid options are:\n            nopython: bool\n                Set to True to disable the use of PyObjects and Python API\n                calls. The default behavior is to allow the use of PyObjects\n                and Python API. Default value is False.\n\n            forceobj: bool\n                Set to True to force the use of PyObjects for every value.\n                Default value is False.\n\n            looplift: bool\n                Set to True to enable jitting loops in nopython mode while\n                leaving surrounding code in object mode. This allows functions\n                to allocate NumPy arrays and use Python objects, while the\n                tight loops in the function can still be compiled in nopython\n                mode. Any arrays that the tight loop uses should be created\n                before the loop is entered. Default value is True.\n\n            error_model: str\n                The error-model affects divide-by-zero behavior.\n                Valid values are 'python' and 'numpy'. The 'python' model\n                raises exception.  The 'numpy' model sets the result to\n                *+/-inf* or *nan*. Default value is 'python'.\n\n            inline: str or callable\n                The inline option will determine whether a function is inlined\n                at into its caller if called. String options are 'never'\n                (default) which will never inline, and 'always', which will\n                always inline. If a callable is provided it will be called with\n                the call expression node that is requesting inlining, the\n                caller's IR and callee's IR as arguments, it is expected to\n                return Truthy as to whether to inline.\n                NOTE: This inlining is performed at the Numba IR level and is in\n                no way related to LLVM inlining.\n\n            boundscheck: bool\n                Set to True to enable bounds checking for array indices. Out\n                of bounds accesses will raise IndexError. The default is to\n                not do bounds checking. If bounds checking is disabled, out of\n                bounds accesses can produce garbage results or segfaults.\n                However, enabling bounds checking will slow down typical\n                functions, so it is recommended to only use this flag for\n                debugging. You can also set the NUMBA_BOUNDSCHECK environment\n                variable to 0 or 1 to globally override this flag.\n\n    Returns\n    --------\n    A callable usable as a compiled function.  Actual compiling will be\n    done lazily if no explicit signatures are passed.\n\n    Examples\n    --------\n    The function can be used in the following ways:\n\n    1) jit(signatures, target='cpu', **targetoptions) -> jit(function)\n\n        Equivalent to:\n\n            d = dispatcher(function, targetoptions)\n            for signature in signatures:\n                d.compile(signature)\n\n        Create a dispatcher object for a python function.  Then, compile\n        the function with the given signature(s).\n\n        Example:\n\n            @jit(\"int32(int32, int32)\")\n            def foo(x, y):\n                return x + y\n\n            @jit([\"int32(int32, int32)\", \"float32(float32, float32)\"])\n            def bar(x, y):\n                return x + y\n\n    2) jit(function, target='cpu', **targetoptions) -> dispatcher\n\n        Create a dispatcher function object that specializes at call site.\n\n        Examples:\n\n            @jit\n            def foo(x, y):\n                return x + y\n\n            @jit(target='cpu', nopython=True)\n            def bar(x, y):\n                return x + y\n\n    \"\"\"\n    if 'argtypes' in options:\n        raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes'))\n    if 'restype' in options:\n        raise DeprecationError(_msg_deprecated_signature_arg.format('restype'))\n    if options.get('nopython', False) and options.get('forceobj', False):\n        raise ValueError(\"Only one of 'nopython' or 'forceobj' can be True.\")\n\n    options['boundscheck'] = boundscheck\n\n    # Handle signature\n    if signature_or_function is None:\n        # No signature, no function\n        pyfunc = None\n        sigs = None\n    elif isinstance(signature_or_function, list):\n        # A list of signatures is passed\n        pyfunc = None\n        sigs = signature_or_function\n    elif sigutils.is_signature(signature_or_function):\n        # A single signature is passed\n        pyfunc = None\n        sigs = [signature_or_function]\n    else:\n        # A function is passed\n        pyfunc = signature_or_function\n        sigs = None\n\n    dispatcher_args = {}\n    if pipeline_class is not None:\n        dispatcher_args['pipeline_class'] = pipeline_class\n    wrapper = _jit(sigs, locals=locals, target=target, cache=cache,\n                   targetoptions=options, **dispatcher_args)\n    if pyfunc is not None:\n        return wrapper(pyfunc)\n    else:\n        return wrapper\n\n\ndef _jit(sigs, locals, target, cache, targetoptions, **dispatcher_args):\n    dispatcher = registry.dispatcher_registry[target]\n\n    def wrapper(func):\n        if config.ENABLE_CUDASIM and target == 'cuda':\n            from numba import cuda\n            return cuda.jit(func)\n        if config.DISABLE_JIT and not target == 'npyufunc':\n            return func\n        disp = dispatcher(py_func=func, locals=locals,\n                          targetoptions=targetoptions,\n                          **dispatcher_args)\n        if cache:\n            disp.enable_caching()\n        if sigs is not None:\n            # Register the Dispatcher to the type inference mechanism,\n            # even though the decorator hasn't returned yet.\n            from numba.core import typeinfer\n            with typeinfer.register_dispatcher(disp):\n                for sig in sigs:\n                    disp.compile(sig)\n                disp.disable_compile()\n        return disp\n\n    return wrapper\n\n\ndef generated_jit(function=None, target='cpu', cache=False,\n                  pipeline_class=None, **options):\n    \"\"\"\n    This decorator allows flexible type-based compilation\n    of a jitted function.  It works as `@jit`, except that the decorated\n    function is called at compile-time with the *types* of the arguments\n    and should return an implementation function for those types.\n    \"\"\"\n    dispatcher_args = {}\n    if pipeline_class is not None:\n        dispatcher_args['pipeline_class'] = pipeline_class\n    wrapper = _jit(sigs=None, locals={}, target=target, cache=cache,\n                   targetoptions=options, impl_kind='generated',\n                   **dispatcher_args)\n    if function is not None:\n        return wrapper(function)\n    else:\n        return wrapper\n\n\ndef njit(*args, **kws):\n    \"\"\"\n    Equivalent to jit(nopython=True)\n\n    See documentation for jit function/decorator for full description.\n    \"\"\"\n    if 'nopython' in kws:\n        warnings.warn('nopython is set for njit and is ignored', RuntimeWarning)\n    if 'forceobj' in kws:\n        warnings.warn('forceobj is set for njit and is ignored', RuntimeWarning)\n        del kws['forceobj']\n    kws.update({'nopython': True})\n    return jit(*args, **kws)\n\n\ndef cfunc(sig, locals={}, cache=False, **options):\n    \"\"\"\n    This decorator is used to compile a Python function into a C callback\n    usable with foreign C libraries.\n\n    Usage::\n        @cfunc(\"float64(float64, float64)\", nopython=True, cache=True)\n        def add(a, b):\n            return a + b\n\n    \"\"\"\n    sig = sigutils.normalize_signature(sig)\n\n    def wrapper(func):\n        from numba.core.ccallback import CFunc\n        res = CFunc(func, sig, locals=locals, options=options)\n        if cache:\n            res.enable_caching()\n        res.compile()\n        return res\n\n    return wrapper\n\n\ndef jit_module(**kwargs):\n    \"\"\" Automatically ``jit``-wraps functions defined in a Python module\n\n    Note that ``jit_module`` should only be called at the end of the module to\n    be jitted. In addition, only functions which are defined in the module\n    ``jit_module`` is called from are considered for automatic jit-wrapping.\n    See the Numba documentation for more information about what can/cannot be\n    jitted.\n\n    :param kwargs: Keyword arguments to pass to ``jit`` such as ``nopython``\n                   or ``error_model``.\n\n    \"\"\"\n    # Get the module jit_module is being called from\n    frame = inspect.stack()[1]\n    module = inspect.getmodule(frame[0])\n    # Replace functions in module with jit-wrapped versions\n    for name, obj in module.__dict__.items():\n        if inspect.isfunction(obj) and inspect.getmodule(obj) == module:\n            _logger.debug(\"Auto decorating function {} from module {} with jit \"\n                          \"and options: {}\".format(obj, module.__name__, kwargs))\n            module.__dict__[name] = jit(obj, **kwargs)\n", "path": "numba/core/decorators.py"}]}