Skip to content

./python -m test test_interpreters test_struct fails with: KeyError: concurrent.interpreters._queues.UNBOUND #142414

Description

@ppigazzini

Bug report

Bug description:

I routinely use on my Ubuntu machines pyenv and a script to install python versions:

Click to view
 python_ver=3.14.2
# setup pyenv and install latest python# https://github.com/pyenv/pyenv# https://github.com/python/pyperformanceif!command -v pyenv &>/dev/null;then# dependencies according to pyenv#sudo apt update; sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev# Workaround missing libmpdec-dev on ubuntu 24.04 (it should be re introduced in ubuntu 26.04):# https://launchpad.net/~ondrej/+archive/ubuntu/php# https://deb.sury.org/
sudo add-apt-repository -y ppa:ondrej/php
# dependencies according to python build doc dropping packages used in CI (ccache, cmake, gdb, inetutils-inetd, lcov, lzma, strace, xvfb)# https://devguide.python.org/getting-started/setup-building/index.html#build-dependencies# https://github.com/python/cpython/blob/main/.github/workflows/posix-deps-apt.sh
sudo apt update; sudo apt install -y build-essential pkg-config libb2-dev libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma-dev tk-dev uuid-dev zlib1g-dev libzstd-dev libmpdec-dev
pyenv_dir="$HOME/.pyenv"
git clone https://github.com/pyenv/pyenv.git "$pyenv_dir"
cat << 'EOF' >> "$HOME/.profile"# pyenv: keep at the end of the fileexport PYENV_ROOT="$HOME/.pyenv"command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"eval "$(pyenv init -)"EOF
cat << 'EOF' >> "$HOME/.bashrc"# pyenv: keep at the end of the fileexport PYENV_ROOT="$HOME/.pyenv"command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"eval "$(pyenv init -)"EOF."$HOME/.profile"pushd"$pyenv_dir"&& src/configure && make -C src &&popd#CC="clang" CXX="clang++" LDFLAGS="${LDFLAGS:+$LDFLAGS }-fuse-ld=lld" PYTHON_CONFIGURE_OPTS="--enable-optimizations --with-lto --with-tail-call-interp --enable-bolt" PYTHON_CFLAGS="-march=native -mtune=native" pyenv install "$python_ver"
CC="clang" CXX="clang++" LDFLAGS="${LDFLAGS:+$LDFLAGS }-fuse-ld=lld" PYTHON_CONFIGURE_OPTS="--enable-optimizations --with-lto" PYTHON_CFLAGS="-march=native -mtune=native" pyenv install "$python_ver"#PYTHON_CONFIGURE_OPTS="--enable-optimizations --with-lto" PYTHON_CFLAGS="-march=native -mtune=native" pyenv install "$python_ver"
pyenv global "$python_ver"fi

test_struct fails in python3 -m test with python 3.14.2 (and 3.14.1) with this traceback:

Click to view
0:18:03 load avg: 0.84 [387/491] test_struct
Exception in initializer:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 88, in serialize_unbound
flag = _UNBOUND_CONSTANT_TO_FLAG[op]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: concurrent.interpreters._queues.UNBOUND
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/thread.py", line 99, in _worker
ctx.initialize()
~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/interpreter.py", line 64, in initialize
self.results = interpreters.create_queue(maxsize)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 75, in create
unbound = _serialize_unbound(unbounditems)
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 56, in _serialize_unbound
return _crossinterp.serialize_unbound(unbound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 90, in serialize_unbound
raise NotImplementedError(f'unsupported unbound replacement op {op!r}')
NotImplementedError: unsupported unbound replacement op concurrent.interpreters._queues.UNBOUND
Exception in initializer:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 88, in serialize_unbound
flag = _UNBOUND_CONSTANT_TO_FLAG[op]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: concurrent.interpreters._queues.UNBOUND
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/thread.py", line 99, in _worker
ctx.initialize()
~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/interpreter.py", line 64, in initialize
self.results = interpreters.create_queue(maxsize)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 75, in create
unbound = _serialize_unbound(unbounditems)
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 56, in _serialize_unbound
return _crossinterp.serialize_unbound(unbound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 90, in serialize_unbound
raise NotImplementedError(f'unsupported unbound replacement op {op!r}')
NotImplementedError: unsupported unbound replacement op concurrent.interpreters._queues.UNBOUND
Exception in initializer:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 88, in serialize_unbound
flag = _UNBOUND_CONSTANT_TO_FLAG[op]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: concurrent.interpreters._queues.UNBOUND
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/thread.py", line 99, in _worker
ctx.initialize()
~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/interpreter.py", line 64, in initialize
self.results = interpreters.create_queue(maxsize)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 75, in create
unbound = _serialize_unbound(unbounditems)
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 56, in _serialize_unbound
return _crossinterp.serialize_unbound(unbound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 90, in serialize_unbound
raise NotImplementedError(f'unsupported unbound replacement op {op!r}')
NotImplementedError: unsupported unbound replacement op concurrent.interpreters._queues.UNBOUND
Exception in initializer:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 88, in serialize_unbound
flag = _UNBOUND_CONSTANT_TO_FLAG[op]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: concurrent.interpreters._queues.UNBOUND
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/thread.py", line 99, in _worker
ctx.initialize()
~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/interpreter.py", line 64, in initialize
self.results = interpreters.create_queue(maxsize)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 75, in create
unbound = _serialize_unbound(unbounditems)
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 56, in _serialize_unbound
return _crossinterp.serialize_unbound(unbound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 90, in serialize_unbound
raise NotImplementedError(f'unsupported unbound replacement op {op!r}')
NotImplementedError: unsupported unbound replacement op concurrent.interpreters._queues.UNBOUND
Exception in initializer:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 88, in serialize_unbound
flag = _UNBOUND_CONSTANT_TO_FLAG[op]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: concurrent.interpreters._queues.UNBOUND
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/thread.py", line 99, in _worker
ctx.initialize()
~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/interpreter.py", line 64, in initialize
self.results = interpreters.create_queue(maxsize)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 75, in create
unbound = _serialize_unbound(unbounditems)
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_queues.py", line 56, in _serialize_unbound
return _crossinterp.serialize_unbound(unbound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/interpreters/_crossinterp.py", line 90, in serialize_unbound
raise NotImplementedError(f'unsupported unbound replacement op {op!r}')
NotImplementedError: unsupported unbound replacement op concurrent.interpreters._queues.UNBOUND
test test_struct failed -- Traceback (most recent call last):
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/test/test_struct.py", line 818, in test_endian_table_init_subinterpreters
self.assertListEqual(list(results), [None] * 5)
~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/_base.py", line 639, in result_iterator
yield _result_or_cancel(fs.pop())
~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/_base.py", line 311, in _result_or_cancel
return fut.result(timeout)
~~~~~~~~~~^^^^^^^^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/_base.py", line 450, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/home/usr00/.pyenv/versions/3.14.2/lib/python3.14/concurrent/futures/_base.py", line 395, in __get_result
raise self._exception
concurrent.futures.interpreter.BrokenInterpreterPool: A thread initializer failed, the thread pool is not usable anymore
0:18:04 load avg: 0.84 [387/491/1] test_struct failed (1 error)

Tested on Ubuntu 24.04 (gcc 14.2.0 - clang 21.1.8) and Ubuntu 20.04 (gcc 11.4.0), several CPUs.

python 3.14.0 and 3.13.x, bult in the same way, pass smoothly python3 -m test

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Todo
    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions