Unable to assign 0 as NULL to void** local
See original GitHub issueReporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
Pointers can be set to NULL
by assigning 0. This appears not to work with pointers to pointers.
import numba
# Succeeds
@numba.cfunc("void()", locals = {"bar": numba.types.voidptr})
def foo():
bar = 0
# Fails
@numba.cfunc("void()", locals = {"bar": numba.types.CPointer(numba.types.voidptr)})
def foo():
bar = 0
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No conversion from Literal[int](0) to void** for 'bar', defined at None
I would assume that if this works with pointers generally, it shouldn’t fail for the specific case of a pointer to a pointer.
This is actually blocking progress on something for me at the moment, so any comments on workarounds would be appreciated! I need to pass a NULL
void**
into a ctypes function from inside a cfunc.
This seems to work fine, but I can’t alter the signature of my cfunc to accommodate so it’s not a solution for me.
@numba.cfunc(numba.types.void(numba.types.CPointer(numba.types.voidptr)))
def foo(a):
return
foo(0)
The pointer types don’t appear to have casting support.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Unable to assign NULL to a pointer - Stack Overflow
I want to call my_function to set my struct to a known state because i'm declaring my struct inside main so it becomes...
Read more >How to Fix and Avoid NullPointerException in Java - Rollbar
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified.
Read more >Null In Java: Understanding the Basics - Upwork
Learn all about how and when to apply null in Java. Through the best examples, understand the common situations and caveats of using...
Read more >Null in Python: Understanding Python's NoneType Object
As the null in Python, None is not defined to be 0 or any other value. In Python, None is an object and...
Read more >Strict mode - JavaScript - MDN Web Docs
There are three ways to fail a property assignment: ... Strict mode forbids a 0 -prefixed octal literal or octal escape sequence.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem. If you know roughly what the LLVM is for what you want, then
@intrinsic
gives you an escape hatch to do that.clang -S -emit-llvm
can help with getting the “rough” LLVM from some C code.Something like this might work: