numba/numba — pull request #677 by seibert (2014-08-06 17:29:55+00:00)
Title: Add NUMBA_WARNING_LEVEL to print messages about functions compiling to object mode

This starts to implement the feature suggested in #586.

For example, this code:
``` python
@jit
def add(x, y):
return x + y

add([1], [2])
```
will print:
```
(NUMBA WARNING) Function "add" was compiled in object mode without forceobj=True.
```
when `NUMBA_WARNING_LEVEL=1` and:
```
(NUMBA WARNING) Function "add" failed type inference: Arg 0 of pyobject is not legal in nopython mode
(NUMBA WARNING) Function "add" was compiled in object mode without forceobj=True.
```
when `NUMBA_WARNING_LEVEL=2`.

This is only a partial fix for #586 because the error messages returned by type inference exceptions are not particularly helpful yet. For example, the function:
``` python
@jit('i4(i4, i4)')
def mult(a, b):
return a + b + []
```
will emit the warnings (`NUMBA_WARNING_LEVEL=2`):
```
(NUMBA WARNING) Function "mult" failed type inference: (, build_list(items=[]))
(NUMBA WARNING) Function "mult" was compiled in object mode without forceobj=True.
```

I don't have a good approach to unit test printing of warning messages, so this PR adds no new tests.