-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Issue with f2py in Numpy 1.13 when character arrays appear in a callback function #10027
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
Comments
The proximate cause is this code in the generated source:
|
charris
added a commit
to charris/numpy
that referenced
this issue
Nov 15, 2017
When NPY_CHAR was deprecated and replaced by NPY_STRING in f2py, calls to PyArray_New that previously relied on the type to get the itemsize needed the size explicitly specified, but that modification was missed in some of the code. Because the strings that replacee the 'c' type are always 'S1', we use an itemsize of 1 for the string types and pass it explicitly. Closes numpy#10027.
charris
added a commit
to charris/numpy
that referenced
this issue
Nov 16, 2017
charris
added a commit
to charris/numpy
that referenced
this issue
Nov 18, 2017
When NPY_CHAR was deprecated and replaced by NPY_STRING in f2py, calls to PyArray_New that previously relied on the type to get the itemsize needed the size explicitly specified, but that modification was missed in some of the code. Because the strings that replacee the 'c' type are always 'S1', we use an itemsize of 1 for the string types and pass it explicitly. Closes numpy#10027.
charris
added a commit
to charris/numpy
that referenced
this issue
Nov 18, 2017
This was referenced Jun 5, 2022
Note that the original issue of callbacks and character arrays is fixed by #19388. The issue raised for allocations is still relevant and tracked separately. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an issue with f2py in Numpy 1.13 when character arrays appear in a callback function. The following example works with Numpy 1.12 but not in 1.13:
================
Numpy Version: 1.12.1
Lencu: 1
Calling callback...
In callback: [['' '' '' '' '' '' '' '']]
Back in fortran...
================
Numpy Version: 1.13.3
Lencu: 1
Calling callback...
Call-back cb_callback_in_func_with_callback__user__routines failed.
Traceback (most recent call last):
File "test_callback.py", line 57, in
func_with_callback(callBack, cu)
ValueError: data type must provide an itemsize
The text was updated successfully, but these errors were encountered: