Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move overload of literal_unroll to avoid circular dependency that breaks Python 2.7 #4955

Merged
merged 1 commit into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions numba/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import sys

from numba.extending import overload
import numpy as np

from .typing.typeof import typeof
Expand Down Expand Up @@ -98,17 +97,6 @@ def literal_unroll(container):
return container


@overload(literal_unroll)
def literal_unroll_impl(container):
from numba.errors import UnsupportedError
if sys.version_info[:2] < (3, 6):
raise UnsupportedError("literal_unroll is only support in Python > 3.5")

def impl(container):
return container
return impl


__all__ = [
'typeof',
'prange',
Expand Down
2 changes: 1 addition & 1 deletion numba/targets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def refresh(self):
# Populate built-in registry
from . import (arraymath, enumimpl, iterators, linalg, numbers,
optional, polynomial, rangeobj, slicing, tupleobj,
gdb_hook, hashing, heapq, literal_dispatch)
gdb_hook, hashing, heapq, literal)
try:
from . import npdatetime
except NotImplementedError:
Expand Down
15 changes: 14 additions & 1 deletion numba/targets/literal_dispatch.py → numba/targets/literal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys

from numba.extending import overload
from numba import types
from numba.special import literally
from numba.special import literally, literal_unroll
from numba.errors import TypingError


Expand All @@ -12,3 +14,14 @@ def _ov_literally(obj):
else:
m = "Invalid use of non-Literal type in literally({})".format(obj)
raise TypingError(m)


@overload(literal_unroll)
def literal_unroll_impl(container):
from numba.errors import UnsupportedError
if sys.version_info[:2] < (3, 6):
raise UnsupportedError("literal_unroll is only support in Python > 3.5")

def impl(container):
return container
return impl