gh-91058: Add error suggestions to 'import from' import errors (#98305)

This commit is contained in:
Pablo Galindo Salgado 2022-10-25 23:56:59 +01:00 committed by GitHub
parent 1f737edb67
commit 7cfbb49fcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 235 additions and 14 deletions

View file

@ -37,6 +37,7 @@ typedef struct {
PyObject *msg;
PyObject *name;
PyObject *path;
PyObject *name_from;
} PyImportErrorObject;
typedef struct {
@ -176,4 +177,11 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
const char *format,
...);
extern PyObject *_PyErr_SetImportErrorWithNameFrom(
PyObject *,
PyObject *,
PyObject *,
PyObject *);
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))