jameskermode / f90wrap

F90 to Python interface generator with derived type support
GNU Lesser General Public License v3.0
243 stars 80 forks source link

Optional out string #209

Closed danbeibei closed 7 months ago

danbeibei commented 7 months ago

Calling a wrapped routine with an optional string array produces a segfault with numpy version >= 1.24.0 when called without the argument. I belive the problems is that the C generated code trys to acces data from Py_None object. This PR adds a check in the C generated code from f2py_f90wrap.py script. It also add some related tests on various way to manipulate strings.

jameskermode commented 7 months ago

Thank you, this looks good and since you have already added a new test I will go ahead and merge directly.