From 7bd04c72378d603d08dd4ccb4fa294c3da9bdd03 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Thu, 6 May 2021 10:44:40 -0500 Subject: [PATCH 1/3] Enable TARGET labels even when not using computed gotos. --- Python/ceval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 25548e34db246b..a3b573d46827f3 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1296,11 +1296,10 @@ eval_frame_handle_pending(PyThreadState *tstate) #define USE_COMPUTED_GOTOS 0 #endif -#if USE_COMPUTED_GOTOS #define TARGET(op) op: TARGET_##op +#if USE_COMPUTED_GOTOS #define DISPATCH_GOTO() goto *opcode_targets[opcode] #else -#define TARGET(op) op #define DISPATCH_GOTO() goto dispatch_opcode #endif From b5b9c15f39a274a8a0d9f9edf171ae798b0e0c3a Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Thu, 6 May 2021 10:54:09 -0500 Subject: [PATCH 2/3] add NEWS item --- .../Core and Builtins/2021-05-06-10-53-47.bpo-44060.ScfYXD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-05-06-10-53-47.bpo-44060.ScfYXD.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-05-06-10-53-47.bpo-44060.ScfYXD.rst b/Misc/NEWS.d/next/Core and Builtins/2021-05-06-10-53-47.bpo-44060.ScfYXD.rst new file mode 100644 index 00000000000000..7114d929225f75 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-05-06-10-53-47.bpo-44060.ScfYXD.rst @@ -0,0 +1,2 @@ +The TARGET_#op label is now available even when computed gotos aren't +enabled. From 80b82333f272dc6beab209f3615f74bbb0fb993d Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Thu, 6 May 2021 13:24:34 -0500 Subject: [PATCH 3/3] Perhaps this is better - still with warnings, but only when building a debug version of the interpreter. --- Python/ceval.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index a3b573d46827f3..e2c5a381f03fa3 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1296,7 +1296,12 @@ eval_frame_handle_pending(PyThreadState *tstate) #define USE_COMPUTED_GOTOS 0 #endif +#if USE_COMPUTED_GOTOS || defined(Py_DEBUG) #define TARGET(op) op: TARGET_##op +#else +#define TARGET(op) op +#endif + #if USE_COMPUTED_GOTOS #define DISPATCH_GOTO() goto *opcode_targets[opcode] #else