Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1303

quintptr is incorrectly mapped to unsigned long (32-bit on Windows)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.1
    • 5.14.2.1
    • PySide
    • None
    • Windows
    • ef10f62e66a3f409d0077c36f3849c87f96950d2 (pyside/pyside-setup/5.14)

    Description

      To convert C++ quintptr <-> Python int, PySide seems to use PyLong_AsUnsignedLong, PyLong_FromUnsignedLong, which are based on the unsigned long type, which is always 32-bit on Windows, while quintptr is 64-bit on a 64-bit system.

      This caused a user to get an error

      builtins.OverflowError: Python int too large to convert to C unsigned long
      

      when passing a pointer-derived value (namely an id()) to QAbstractItemModel::createIndex.

      Problematic code

      Chat conversation that led us here

      Note that this issue will not be reproducible on a non-Windows system or if your Python happens to never return an id(object()) >= 2**32

      Attachments

        Activity

          People

            kleint Friedemann Kleint
            oprypin Oleh Prypin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: