Skip to content

f2py throws AssertionError on fortran 90 files which declare routines with C bindings (Trac #1679) #2275

Closed

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1679 on 2010-11-19 by trac user davidpowell, assigned to @pearu.

When running f2py on a fortran 90 file with the following contents:

interface
    function my_func(x) bind(c,name='my_func')
        use iso_c_binding
        real(c_double), intent(in) :: x
        real(c_double) :: my_func
    end function
end interface

It causes an exception in f2py, ending with the following line:

  File "C:\Python26\lib\site-packages\numpy\f2py\crackfortran.py", line 665, in markoutercomma
    assert not f,`f,line,l,cc`
AssertionError: (1, "x@)@ bind@(@c,name='my_func'", "x@)@ bind@(@c,name='my_func'", ')')

As far as I understand this is just a bug in the parser, since f2py shouldn't care that my fortran code is internally calling C routines.

Activity

  1. numpy-gitbot commented on Oct 19, 2012

    @numpy-gitbot
    Author

    @pearu wrote on 2010-12-02

    Fixed in numpy git repo.

  2. numpy-gitbot commented on Oct 19, 2012

    @numpy-gitbot
    Author

    Milestone changed to 1.6.0 by @mwiebe on 2011-05-31

  3. dhermes commented on Sep 14, 2017

    @dhermes
    Contributor

    It seems this issue has had a regression: https://gist.github.com/dhermes/b27be5cc4c73d9665beff24b6c18af4f

    Observed with numpy==1.13.1 in Python 3.6.

  4. charris commented on Sep 15, 2017

    @charris
    Member

    @dhermes AFAICT from checking back to NumPy 1.6, your example has never worked. I note that it isn't quite the same as the example in this issue.

  5. charris commented on Sep 15, 2017

    @charris
    Member

    @dhermes You should open a new issue for your problem.

  6. dhermes commented on Sep 15, 2017

    @dhermes
    Contributor

    Done (#9693). Thanks for the reply @charris!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions