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
Py_buffer builtin struct unusable after 0.27.0 #2046
Comments
The |
You cannot assign a Py_buffer, as it is a struct intended to be used by passing pointers to it. Thus, most real-world use cases will not contain assignments. That said, adding no-op assignments to make it local without actually executing the assignment doesn't work either: import cython
@cython.locals(pybuf = 'Py_buffer')
def f():
pybuf = pybuf
return cython.cast(int, cython.address(pybuf))
print f()
Using an alternative declaration syntax doesn't work either in 0.27.3, yet it does in 0.27.0: import cython
def f():
pybuf = cython.declare('Py_buffer')
return cython.cast(int, cython.address(pybuf))
print f()
|
Real-world code can be found here |
This still happens in 0.28.3 |
Create #2317 which seems to fix this |
Should this be closed? |
Yes |
Since 0.27.1, declaring Py_buffer variables in pure-python mode ceased working. This applies to 0.27.1, 0.27.2 and 0.27.3.
I know this isn't really useful code, but it illustrates the issue with a minimal example. I'm getting this error in actual working (with 0.27.0) code.
When compiling with cython 0.27.2 (and .3), gives:
In cython 0.27.0, however, it builds correctly, generating the following code:
I could find no directly relatable changes in the commit history, but I'm not that familiar with this code, so maybe someone else can figure this out.
To clarify, in non-pure-python mode it works correctly:
Compiles in all versions.
Adding the cimport to buffer_bug.pxd in pure-python mode doesn't change a thing.
FTR, I realize Py_buffer is unusable in pure python. The use case for this always involves compiled-only code paths:
The text was updated successfully, but these errors were encountered: