File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Modules/_remote_debugging Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ extern "C" {
2929#include "internal/pycore_interpframe.h" // FRAME_OWNED_BY_INTERPRETER
3030#include "internal/pycore_llist.h" // struct llist_node
3131#include "internal/pycore_long.h" // _PyLong_GetZero
32+ #include "internal/pycore_pyerrors.h" // _PyErr_FormatFromCause
3233#include "internal/pycore_stackref.h" // Py_TAG_BITS
3334#include "../../Python/remote_debug.h"
3435
@@ -174,9 +175,15 @@ typedef enum _WIN32_THREADSTATE {
174175
175176/* Exception cause macro */
176177#define set_exception_cause (unwinder , exc_type , message ) \
177- if (unwinder->debug) { \
178- _set_debug_exception_cause(exc_type, message); \
179- }
178+ do { \
179+ if (!PyErr_ExceptionMatches(PyExc_PermissionError)) { \
180+ if (!PyErr_Occurred()) { \
181+ PyErr_SetString(exc_type, message); \
182+ } else if (unwinder->debug) { \
183+ _PyErr_FormatFromCause(exc_type, "%s", message); \
184+ } \
185+ } \
186+ } while (0)
180187
181188/* ============================================================================
182189 * TYPE DEFINITIONS
You can’t perform that action at this time.
0 commit comments