Skip to content

Commit d469dde

Browse files
committed
Fix mod_python.publisher controls for Python 3.14.
1 parent 9248f11 commit d469dde

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/python/mod_python/publisher.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,16 @@ def lookup(name):
255255
if name in names:
256256
i = list(names).index(name)
257257
if i is not None:
258-
if PY2 or sys.hexversion >= 0x030b0000: # 3.12.0
259-
return (1, func_code.co_consts[i+1])
258+
# Python 3.11 moved qualified name into code object
259+
# https://github.com/python/cpython/pull/26941
260+
# commit 2f180ce2cb6e6a7e3c517495e0f4873d6aaf5f2f
261+
if PY2 or sys.hexversion >= 0x030b0000:
262+
# Python 3.14 added CO_HAS_DOCSTRING (0x4000000)
263+
# https://github.com/python/cpython/issues/126072
264+
# https://github.com/python/cpython/pull/126101
265+
# commit 35df4eb959b3923c08aaaeff728c5ed1706f31cf
266+
offset = 1 if sys.hexversion < 0x030e0000 or (func_code.co_flags & 0x4000000) != 0 else 0
267+
return (1, func_code.co_consts[offset+i])
260268
else:
261269
return (1, func_code.co_consts[1+i*2])
262270

0 commit comments

Comments
 (0)