Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Bad error reporting for unimplemented function value reference #60

Open
quasilyte opened this issue Oct 3, 2018 · 0 comments
Open

Bad error reporting for unimplemented function value reference #60

quasilyte opened this issue Oct 3, 2018 · 0 comments

Comments

@quasilyte
Copy link
Contributor

Given this code:

import hpat
import pandas as pd
import numpy as np

@hpat.jit
def weird():
    df = pd.DataFrame({'A': np.ones(10), 'B': np.arange(10)})
    return df.columns

print(weird())

Execution leads to this error:


Traceback (most recent call last):
  File "examples/hello2.py", line 10, in <module>
    print(weird())
  File "~/miniconda3/envs/HPAT/lib/python3.6/site-packages/numba/dispatcher.py", line 348, in _compile_for_args
    error_rewrite(e, 'typing')
  File "~/miniconda3/envs/HPAT/lib/python3.6/site-packages/numba/dispatcher.py", line 315, in error_rewrite
    reraise(type(e), e, None)
  File "~/miniconda3/envs/HPAT/lib/python3.6/site-packages/numba/six.py", line 658, in reraise
    raise value.with_traceback(tb)
numba.errors.TypingError: Failed in hpat mode pipeline (step: nopython frontend)
Undefined variable 'df', operation: $0.15, location: examples/hello2.py (7)

File "examples/hello2.py", line 7:
def weird():
    df = pd.DataFrame({'A': np.ones(10), 'B': np.arange(10)})
    ^

But this is misleading. df is defined, the problem is that df.count method is unimplemented and when it's not called but the method value is referenced instead, such error is produced.
If df.count is changed to df.count() we get better error message:

NotImplementedError: Failed in hpat mode pipeline (step: convert DataFrames)
data frame function columns not implemented yet

HPAT could probably give a better error message in the first case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant