Content-Length: 348055 | pFad | http://github.com/python/cpython/pull/111573/commits/d93f584855b7f983a21b5256a67629239b008b75

B2 gh-76785: Return an "excinfo" Object From Interpreter.run() by ericsnowcurrently · Pull Request #111573 · python/cpython · GitHub
Skip to content

gh-76785: Return an "excinfo" Object From Interpreter.run() #111573

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add more type info to _PyXI_excinfo.
  • Loading branch information
ericsnowcurrently committed Nov 22, 2023
commit d93f584855b7f983a21b5256a67629239b008b75
29 changes: 18 additions & 11 deletions Include/internal/pycore_crossinterp.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,14 @@ extern void _PyXI_Fini(PyInterpreterState *interp);
// of the exception in the calling interpreter.

typedef struct _excinfo {
const char *type;
struct _excinfo_type {
PyTypeObject *builtin;
const char *name;
const char *qualname;
const char *module;
} type;
const char *msg;
} _Py_excinfo;
} _PyXI_excinfo;


typedef enum error_code {
Expand All @@ -193,14 +198,16 @@ typedef struct _sharedexception {
// The kind of error to propagate.
_PyXI_errcode code;
// The exception information to propagate, if applicable.
// This is populated only for _PyXI_ERR_UNCAUGHT_EXCEPTION.
_Py_excinfo uncaught;
} _PyXI_exception_info;
// This is populated only for some error codes,
// but always for _PyXI_ERR_UNCAUGHT_EXCEPTION.
_PyXI_excinfo uncaught;
} _PyXI_error;

PyAPI_FUNC(void) _PyXI_ApplyExceptionInfo(
_PyXI_exception_info *info,
PyAPI_FUNC(void) _PyXI_ApplyError(
_PyXI_error *err,
PyObject *exctype);


typedef struct xi_session _PyXI_session;
typedef struct _sharedns _PyXI_namespace;

Expand Down Expand Up @@ -251,13 +258,13 @@ struct xi_session {

// This is set if the interpreter is entered and raised an exception
// that needs to be handled in some special way during exit.
_PyXI_errcode *exc_override;
_PyXI_errcode *error_override;
// This is set if exit captured an exception to propagate.
_PyXI_exception_info *exc;
_PyXI_error *error;

// -- pre-allocated memory --
_PyXI_exception_info _exc;
_PyXI_errcode _exc_override;
_PyXI_error _error;
_PyXI_errcode _error_override;
};

PyAPI_FUNC(int) _PyXI_Enter(
Expand Down
2 changes: 1 addition & 1 deletion Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ _run_in_interpreter(PyInterpreterState *interp,
// Prep and switch interpreters.
if (_PyXI_Enter(&session, interp, shareables) < 0) {
assert(!PyErr_Occurred());
_PyXI_ApplyExceptionInfo(session.exc, excwrapper);
_PyXI_ApplyError(session.error, excwrapper);
assert(PyErr_Occurred());
return -1;
}
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/111573/commits/d93f584855b7f983a21b5256a67629239b008b75

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy