Skip to content

Runtime Error while twice usage (Trac #2203) #656

Closed

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/2203 on 2012-08-17 by trac user Lukasz16a, assigned to unknown.

The following simple code causes runtime error:

# include <Python.h>
# include <numpy/arrayobject.h>

void f() {
    import_array() ;
}

int main() {
    for(int i=0 ; i<2 ; i++) {
        Py_Initialize() ;
        f() ;
        Py_Finalize() ;
    }
}

The problem is loading numpy.core... I tested it on Visual Studio 2010 at Windows 7 Professional x64.

Activity

  1. charris commented on Feb 18, 2014

    @charris
    Member

    Hmm, looks like a strange construct. I'm inclined to close this unless you can provide a normal example where it fails.

  2. seberg commented on Jan 5, 2019

    @seberg
    Member

    IIRC it is not expected that import_array can be called twice. We can reopen when someone notes why it should work or has a use case.

  3. mattip commented on Jan 5, 2019

    @mattip
    Member

    This is important for subinterpreters. If PEP 554 gets accepted we may want to revisit this. But it is fine to close this as there are enough other issues open about Py_Finalize,

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions