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

Bad error reporting for unimplemented function value reference #60

Description

@quasilyte

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions