Update SWIG Python typemaps to use Python 3 C API

XMLWordPrintableJSON

    • Storage Engines
    • 107.325
    • None
    • None

      Issue Summary

      The WiredTiger Python SWIG wrapper fails to compile with SWIG 4.5 and current Python 3 installations because lang/python/wiredtiger.i uses legacy Python 2 C-API names that are not declared by Python 3.14.

      error: call to undeclared function 'PyInt_AsLong'
      error: call to undeclared function 'PyInt_FromLong'
      error: call to undeclared function 'PyString_InternFromString'
      

      Context

      • Python removed PyInt_ and PyString_ from the Python 3 C API in Python 3.0; the corresponding APIs are PyLong_ and PyUnicode_.
      • SWIG 4.5 generates the wrapper successfully, but the generated wrapper contains these calls from the WiredTiger typemaps.
      • The issue was reproduced using SWIG 4.5.0 and Python 3.14.6.

      Proposed Solution

      • Replace PyInt_AsLong with PyLong_AsLong.
      • Replace PyInt_FromLong with PyLong_FromLong.
      • Replace PyString_InternFromString with PyUnicode_InternFromString.
      • Add or update Python wrapper build coverage so this compatibility issue is caught in CI.

      Acceptance Criteria

      • The Python SWIG wrapper builds successfully with SWIG 4.5 and supported Python 3 versions.
      • No legacy PyInt_ or PyString_ calls remain in the Python SWIG interface.
      • The Python smoke test and relevant Python API tests pass.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Haribabu Kommi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: