From 29f052da470ac281f15d87d4a40511b5cd1e4834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 26 Oct 2023 14:55:12 +0200 Subject: [PATCH 1/2] Fix setuptools.depends:get_module_constant() on Python 3.13.0a1 Don't hardcode opcode numbers, look them up instead. Fixes https://github.com/pypa/setuptools/issues/4090 --- setuptools/depends.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/depends.py b/setuptools/depends.py index 180e820459..42907d9bd4 100644 --- a/setuptools/depends.py +++ b/setuptools/depends.py @@ -142,9 +142,9 @@ def extract_constant(code, symbol, default=-1): name_idx = list(code.co_names).index(symbol) - STORE_NAME = 90 - STORE_GLOBAL = 97 - LOAD_CONST = 100 + STORE_NAME = dis.opmap['STORE_NAME'] + STORE_GLOBAL = dis.opmap['STORE_GLOBAL'] + LOAD_CONST = dis.opmap['LOAD_CONST'] const = default From beb7931bc9e0b362c1256b647394fc567456d5de Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 20 Nov 2023 15:16:37 +0000 Subject: [PATCH 2/2] Add newsfragment --- newsfragments/4094.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 newsfragments/4094.bugfix.rst diff --git a/newsfragments/4094.bugfix.rst b/newsfragments/4094.bugfix.rst new file mode 100644 index 0000000000..8c73eaedbf --- /dev/null +++ b/newsfragments/4094.bugfix.rst @@ -0,0 +1,2 @@ +Replaced hardcoded numeric values with :obj:`dis.opmap`, +fixing problem with 3.13.0a1.