Use new 3.14 C APIs when available (#5854)

* Use new 3.14 C APIs when available

Use the new "unstable" C APIs for the functions added in #5494.

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2 files changed