-
Notifications
You must be signed in to change notification settings - Fork 164
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
Lift Python interoperability from C to ASR #2050
Comments
// Defined in `pyerrors.h`
PyAPI_DATA(PyObject *) PyExc_BaseException;
PyAPI_DATA(PyObject *) PyExc_Exception;
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
#endif
PyAPI_DATA(PyObject *) PyExc_StopIteration;
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
PyAPI_DATA(PyObject *) PyExc_LookupError;
PyAPI_DATA(PyObject *) PyExc_AssertionError;
PyAPI_DATA(PyObject *) PyExc_AttributeError;
PyAPI_DATA(PyObject *) PyExc_BufferError;
PyAPI_DATA(PyObject *) PyExc_EOFError;
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
PyAPI_DATA(PyObject *) PyExc_OSError;
PyAPI_DATA(PyObject *) PyExc_ImportError; It seems there are several predefined exception codes which get defined when including For example: if (_import_array() < 0) {
PyErr_Print();
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
fprintf(stderr, "Failed to import numpy Python module(s)\n");
return -1;
} How do we support the above exception codes at the ASR Level? |
The #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#include <numpy/arrayobject.h> Do we have a mechanism in the ASR to support these? |
For global variables, let's first implement them in LFortran and test it well: lfortran/lfortran#1951, then let's figure out some syntax in LPython to use it as well. |
The next step is to do what is done here: #2107 (comment), create regular LPython code and try to get the interoperability with CPython working, using current LPython. If there are any bugs or missing features, let's fix that. After that works, let's create the ASR pass that will do the transformation from |
Originally posted by @certik in #1704 (comment)
The text was updated successfully, but these errors were encountered: