From 8c492e807961863058ed995962beb2b7c8771122 Mon Sep 17 00:00:00 2001 From: Antonio Cuni Date: Tue, 9 Feb 2021 08:59:55 +0100 Subject: [PATCH] add a sanity check to ensure that we don't try to wrap the debug ctx twice --- hpy/debug/src/debug_ctx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hpy/debug/src/debug_ctx.c b/hpy/debug/src/debug_ctx.c index aab004c64..0bb434149 100644 --- a/hpy/debug/src/debug_ctx.c +++ b/hpy/debug/src/debug_ctx.c @@ -41,6 +41,10 @@ static int debug_ctx_init(HPyContext dctx, HPyContext uctx) HPyContext hpy_debug_get_ctx(HPyContext uctx) { HPyContext dctx = &g_debug_ctx; + if (uctx == dctx) { + HPy_FatalError(uctx, "hpy_debug_get_ctx: expected an universal ctx, " + "got a debug ctx"); + } if (debug_ctx_init(dctx, uctx) < 0) return NULL; return dctx;