8000 BUG: Handle .pyf.src and fix SciPy [urgent] by HaoZeke · Pull Request #25287 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Handle .pyf.src and fix SciPy [urgent] #25287

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 8 commits into from
Dec 1, 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 a test mimicing some flapack checks
  • Loading branch information
HaoZeke committed Dec 1, 2023
commit cf70d72899252e415770c13a61746cf1ba3703bf
14 changes: 14 additions & 0 deletions numpy/f2py/tests/src/string/gh25286.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
subroutine charint(trans, info)
character, intent(in) :: trans
integer, intent(out) :: info
if (trans == 'N') then
info = 1 10000
else if (trans == 'T') then
info = 2
else if (trans == 'C') then
info = 3
else
info = -1
end if

end subroutine charint
12 changes: 12 additions & 0 deletions numpy/f2py/tests/src/string/gh25286.pyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python module _char_handling_test
interface
subroutine charint(trans, info)
callstatement (*f2py_func)(&trans, &info)
callprotoargument char*, int*

character, intent(in), check(trans=='N'||trans=='T'||trans=='C') :: trans = 'N'
integer intent(out) :: info

end subroutine charint
end interface
end python module _char_handling_test
12 changes: 12 additions & 0 deletions numpy/f2py/tests/src/string/gh25286_bc.pyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python module _char_handling_test
interface
subroutine charint(trans, info)
callstatement (*f2py_func)(&trans, &info)
callprotoargument char*, int*

character, intent(in), check(*trans=='N'||*trans=='T'||*trans=='C') :: trans = 'N'
integer intent(out) :: info

end subroutine charint
end interface
end python module _char_handling_test
27 changes: 27 additions & 0 deletions numpy/f2py/tests/test_character.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,3 +610,30 @@ def test_gh24662(self):
with pytest.raises(Exception):
aa = "Hi"
self.module.string_inout_optional(aa)


@pytest.mark.slow
class TestNewCharHandling(util.F2PyTest):
# from v1.24 onwards, gh-19388
sources = [
util.getpath("tests", "src", "string", "gh25286.pyf"),
util.getpath("tests", "src", "string", "gh25286.f90")
]
module_name = "_char_handling_test"

def test_gh25286(self):
info = self.module.charint('T')
assert info == 2

@pytest.mark.slow
class TestBCCharHandling(util.F2PyTest):
# SciPy style, "incorrect" bindings with a hook
sources = [
util.getpath("tests", "src", "string", "gh25286_bc.pyf"),
util.getpath("tests", "src", "string", "gh25286.f90")
]
module_name = "_char_handling_test"

def test_gh25286(self):
info = self.module.charint('T')
assert info == 2
0