Skip to content

Commit

Permalink
Fix setuptools.depends:get_module_constant() on Python 3.13.0a1 (#4094)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 20, 2023
2 parents 3aec9c6 + beb7931 commit 70c41b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions newsfragments/4094.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Replaced hardcoded numeric values with :obj:`dis.opmap`,
fixing problem with 3.13.0a1.
6 changes: 3 additions & 3 deletions setuptools/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 70c41b6

Please sign in to comment.