-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
f2py (1.20) drops definitiontypedef signed char signed_char; for callbacks in some circumstances #18335
Copy link
Copy link
Closed
Closed
f2py (1.20) drops definition
typedef signed char signed_char; for callbacks in some circumstances#18335#18350 (+2)
Copy link
Labels
Description
Reproducing code example:
Unfortunately this is part of a larger project.
And may be tricky to reproduce.
Depending on other definition of callback functions, I get the error message below for the second routine.
this causes the error:
subroutine pyexit(code)
implicit none
integer(kind=4), intent(IN):: code
!f2py integer intent(in): code
!f2py intent(callback, hide) endkepler()
external endkepler
call endkepler()
end subroutine pyexit
!=======================================================================
subroutine pygets(ttymsg)
implicit none
character*(*), intent(inout) :: ttymsg
integer, parameter :: n = 132
integer :: i
integer(kind=1), dimension(n) :: data
!f2py intent(callback, hide) ttykepler(data)
external ttykepler
call ttykepler(data)
do i = 1, min(n, len(ttymsg))
ttymsg(i:i) = char(data(i))
end do
end subroutine pygetsbut if I change the first routine to
subroutine pyexit(code)
implicit none
integer(kind=4), intent(IN):: code
!f2py integer intent(in): code
!f2py intent(callback, hide) endkepler(code)
external endkepler
call endkepler(code)
end subroutine pyexitthen the compilation error in the second routine does not occur.
Error message:
...
/tmp/tmp2skuwcza/src.linux-x86_64-3.9/_kepler_NBURN_8192_JMZ_1983_FULDAT_fuldat1_f_CPU_Intel_R_Xeon_R_W_2145_CPU_3_70GHzmodule.c:29:63: error: unknown type name ‘signed_char’; did you mean ‘signed char’?
29 | typedef void(*cb_ttykepler_in_pygets__user__routines_typedef)(signed_char *);
...
NumPy/Python version information:
1.20.0 3.9.1 (default, Dec 16 2020, 01:02:01)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]
Reactions are currently unavailable