Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-398

Enforce use of Stable API (Py_LIMITED_API) for C-extension

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 1.1, 2.0
    • None
    • Generic
    • None
    • 3.15

    Description

      To modernize MariaDB Connector/Python and eliminate version-specific compilation dependencies, we should enforce the CPython Stable API (Py_LIMITED_API) across the C-extension module.

      Currently, enabling Py_LIMITED_API breaks the build in mariadb/mariadb.c due to direct usage of unstable C-struct macros (specifically PyDateTime_IMPORT and <datetime.h> internals). Refactoring these sections to use stable C-API equivalents will allow us to target abi3 and streamline driver distribution.

      Motivation

      Single Binary Wheel Distribution (abi3):

      • Without Py_LIMITED_API, a unique C-extension binary must be built, tested, and shipped for every minor Python release (3.9, 3.10, 3.11, 3.12, 3.13, 3.14, 3.15, etc.).
      • With Py_LIMITED_API=0x03090000, a single abi3 wheel per OS/architecture works seamlessly across all current and future CPython 3.9+ releases.

      Forward Compatibility & Python 3.15+ Readiness:

      • CPython is progressively hiding internal struct representations and deprecating direct C-struct macro access.
      • Enforcing Py_LIMITED_API guarantees that the driver strictly relies on public, forward-compatible C-API functions, preventing build breakages on future CPython releases and improving compatibility with free-threaded (No-GIL) runtimes.

      CI Efficiency:

      • Significantly reduces matrix complexity and build time in automated wheel-building pipelines

      Attachments

        Activity

          People

            georg Georg Richter
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.