Upgrade embedded Python from 3.12 to 3.14 #135
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: john/McRogueFace#135
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Upgrade the embedded Python interpreter from 3.12.2 to 3.14.0 (commit ebf955d). This is a significant upgrade spanning two major versions with breaking changes in both the Python API and C API.
Current State
modules/cpythonBreaking Changes Analysis
Python 3.13 C API Changes (must address)
Deprecated APIs used by McRogueFace:
PySys_SetArgvEx()- Deprecated in 3.11src/main.cpp:146PyConfigAPI (PEP 587/741)Py_InspectFlag- Deprecated in 3.12src/main.cpp:191PyConfig.inspector new PyInitConfig API (PEP 741)Header changes -
Python.hno longer includes:<time.h>- providesclock(),gmtime()<sys/select.h>- providesselect()<sys/time.h>- providesfutimes(),gettimeofday(),setitimer()<stddef.h>(Windows only) - providesoffsetof(),size_t,ptrdiff_tAction: Audit all
.cppfiles for implicit use of these headersRemoved private APIs (check if used):
_PyDict_Pop()→PyDict_Pop()_PyLong_AsInt()→PyLong_AsInt()_PyThreadState_UncheckedGet()→PyThreadState_GetUnchecked()_Py_IsFinalizing()→Py_IsFinalizing()Trashcan macros (if used in custom types):
Py_TRASHCAN_SAFE_BEGIN/Py_TRASHCAN_SAFE_ENDremovedPy_TRASHCAN_BEGIN/Py_TRASHCAN_ENDPython 3.14 C API Changes
New PyInitConfig API (PEP 741):
PyInitConfig_Create(),PyInitConfig_Free()PyInitConfig_SetInt(),PyInitConfig_SetStr()Py_InitializeFromInitConfig()Limited C API changes:
Py_TYPE()andPy_REFCNT()now opaque function callsPySequence_Fast_GET_SIZE,PySequence_Fast_GET_ITEM,PySequence_Fast_ITEMSremovedNew useful APIs:
PyBytes_Join()- likesep.join(iterable)PyUnicode_Equal()- test string equalityPyLong_IsPositive(),PyLong_IsNegative(),PyLong_IsZero()PyIter_NextItem()- replaces ambiguousPyIter_Next()Build System Changes
--with-system-libmpdecnow defaults to yesMcRogueFace Code Audit
Files requiring changes:
src/main.cpp:Files to audit for private API usage:
src/McRFPy_API.cppsrc/PyColor.cppsrc/PyTexture.cppsrc/PyFont.cppsrc/UIFrame.cppsrc/UICaption.cppsrc/UISprite.cppsrc/UIGrid.cppsrc/UIEntity.cppPy*.cppfilesGrep patterns to check:
Implementation Strategy
Option A: Direct upgrade (recommended if changes are minimal)
Option B: Incremental upgrade
Option C: Use pythoncapi-compat
Tasks
src/main.cppto use PyConfig/PyInitConfig APITesting Requirements
After upgrade:
References