Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated arraydecl to throw require literal value
  • Loading branch information
Nicholas J Riasanovsky
Nicholas J Riasanovsky committed Jul 9, 2021
commit 16467012d339fecb281fd8b7e60b6be66590a030
3 changes: 3 additions & 0 deletions numba/core/typing/arraydecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,12 @@ def resolve_view(self, ary, args, kws):

@bound_function("array.astype")
def resolve_astype(self, ary, args, kws):
from numba.core.errors import RequireLiteralValue
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
from .npydecl import parse_dtype
assert not kws
dtype, = args
if dtype == types.unicode_type:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if dtype == types.unicode_type:
if isinstance(dtype, types.UnicodeType):

raise RequireLiteralValue("array.astype if dtype is a string it must be constant")
Comment thread
stuartarchibald marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs wrapping to 80 chars.

dtype = parse_dtype(dtype)
if dtype is None:
return
Expand Down