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

Disable Numba looplift on _extract_pairs to suppress warning #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxanier
Copy link

@maxanier maxanier commented Sep 5, 2024

When numba is installed, every time I run a script that imports RsWaveform a warning is printed to console:

xxx/venv/lib/python3.10/site-packages/RsWaveform/iqw/load.py:68: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "_extract_pairs" failed type inference due to: Unknown attribute 'extend' of type bytearray(uint8, 1d, C)

File "../../../../venv/lib/python3.10/site-packages/RsWaveform/iqw/load.py", line 75:
    def _extract_pairs(buf: bytes, start: int = 0) -> bytes:
        <source elided>
        for idx in np.arange(start * 4, length, 8):
            single_pair.extend(buf[idx : idx + 4])
            ^

During: typing of get attribute at xxx/venv/lib/python3.10/site-packages/RsWaveform/iqw/load.py (75)

File "../../../../venv/lib/python3.10/site-packages/RsWaveform/iqw/load.py", line 75:
    def _extract_pairs(buf: bytes, start: int = 0) -> bytes:
        <source elided>
        for idx in np.arange(start * 4, length, 8):
            single_pair.extend(buf[idx : idx + 4])
            ^

  @staticmethod

Maybe it is possible to somehow help Numba to looplift this function by giving it some information about the extend method, but I don't know how.
My proposed solution is to just specifically disabling looplifting on that function. It is not applied anyway due to above error and by disabling it no warning is printed.

Feel free to manually implement this without merging this PR or implementing a different solution

Numby fails to looplift this function due to Unknown attribute 'extend' of type bytearray(uint8, 1d, C).
To avoid printing a warning when running, just disable this right away
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant