[Backport maintenance/3.3.x] Initial fixes for Python 3.14 (#2747) (#2748) (cherry picked from commit 43111bb4e2b8ae618168a449dcabcd40d19e5c3a)