8000 BUG, ENH: Fix ``iso_c_binding`` type maps and fix ``bind(c)`` support by charris · Pull Request #24622 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG, ENH: Fix iso_c_binding type maps and fix bind(c) support #24622

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

Merged
merged 17 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST: Add more tests for iso_c_binding
Functions and subroutines
  • Loading branch information
HaoZeke authored and charris committed Sep 2, 2023
commit 3755a4b6496c06bbc5c785df5cb8034b81ab6f63
< 8000 /thead>
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
module coddity
use iso_c_binding, only: c_double
use iso_c_binding, only: c_double, c_int
implicit none
contains
subroutine c_add(a, b, c) bind(c, name="c_add")
real(c_double), intent(in) :: a, b
real(c_double), intent(out) :: c
c = a + b
end subroutine c_add
! gh-9693
function wat(x, y) result(z) bind(c, name='wat')
integer(c_int), intent(in) :: x, y
integer(c_int) :: z

z = x + 7
end function wat
end module coddity
11 changes: 0 additions & 11 deletions numpy/f2py/tests/test_f2cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,3 @@ def test_long_long_map(self):
out = self.module.func1(inp)
exp_out = 3
assert out == exp_out

class TestISOCmap(util.F2PyTest):
sources = [
util.getpath("tests", "src", "f2cmap", "iso_c_oddity.f90"),
]

# gh-24553
def test_c_double(self):
out = self.module.coddity.c_add(1, 2)
exp_out = 3
assert out == exp_out
19 changes: 19 additions & 0 deletions numpy/f2py/tests/test_isoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from . import util
import numpy as np

class TestISOC(util.F2PyTest):
sources = [
util.getpath("tests", "src", "isocintrin", "isoCtests.f90"),
]

# gh-24553
def test_c_double(self):
out = self.module.coddity.c_add(1, 2)
exp_out = 3
assert out == exp_out

# gh-9693
def test_bindc_function(self):
out = self.module.coddity.wat(1, 20)
exp_out = 8
assert out == exp_out
0