Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21807 from HaoZeke/useFortranValue
- Loading branch information
Showing
5 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
F2PY supports the value attribute | ||
================================= | ||
|
||
The Fortran standard requires that variables declared with the ``value`` | ||
attribute must be passed by value instead of reference. F2PY now supports this | ||
use pattern correctly. So ``integer, intent(in), value :: x`` in Fortran codes | ||
will have correct wrappers generated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module fortfuncs | ||
implicit none | ||
contains | ||
subroutine square(x,y) | ||
integer, intent(in), value :: x | ||
integer, intent(out) :: y | ||
y = x*x | ||
end subroutine square | ||
end module fortfuncs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
import pytest | ||
|
||
from . import util | ||
|
||
class TestValueAttr(util.F2PyTest): | ||
sources = [util.getpath("tests", "src", "value_attrspec", "gh21665.f90")] | ||
|
||
# gh-21665 | ||
def test_long_long_map(self): | ||
inp = 2 | ||
out = self.module.fortfuncs.square(inp) | ||
exp_out = 4 | ||
assert out == exp_out |