Fix func worker segfault on Python 3.13 by redirecting worker to Python 3.12

The Azure Functions Python worker crashes with SIGSEGV (exit code 139)
on Python 3.13 due to protobuf C extension (google._upb) compatibility
issues.  When the test runner uses Python >=3.13, the conftest now
automatically finds a compatible Python 3.10-3.12 and sets
languageWorkers__python__defaultExecutablePath so the func host uses
it for the worker process.

The CI setup action also ensures Python 3.12 is available on the
runner, falling back to uv python install if the system doesn't have
it.

Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-26 16:52:50 +00:00
Unverified
parent 3826e504be
commit aa93e61e48
2 changed files with 50 additions and 0 deletions
@@ -46,3 +46,18 @@ runs:
echo "Installing Azure Functions Core Tools"
npm install -g azure-functions-core-tools@4 --unsafe-perm true
func --version
- name: Ensure Python 3.12 is available for Azure Functions worker
shell: bash
run: |
# The Azure Functions Python worker may segfault on Python >=3.13
# (protobuf C extension crash). Ensure a compatible Python is
# available so the conftest can redirect the worker to it.
if ! python3.12 --version 2>/dev/null; then
echo "Python 3.12 not found on system, installing via uv..."
uv python install 3.12
FUNC_WORKER_PYTHON="$(uv python find 3.12)"
echo "FUNC_WORKER_PYTHON=${FUNC_WORKER_PYTHON}" >> "$GITHUB_ENV"
echo "Installed Python 3.12 at ${FUNC_WORKER_PYTHON}"
else
echo "System Python 3.12 found: $(which python3.12)"
fi