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

QtCore.QLocale().toLong() doesn't report whether it succeeded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.6.0
    • 5.15.2, 6.3.2, 6.4.2
    • PySide, Shiboken
    • None
    • 54898f87b (dev)

    Description

      Despite help(QtCore.QLocale().toLong) reads that the function returns tuple[int, bool], the function actually returns a single int value. The docs confuse more than help.

      On the other hand, QtCore.QLocale().toInt returns a tuple, in accordance with the help.

      So, the MWE is the following:

      from PySide6 import QtCore  # or from PySide2
      print(QtCore.QLocale().toLong('42'))
      

      The expected output is (42, True), however the actual one is just 42.

      The same refers to QtCore.QLocale().toULong, but not to any other to-number function of the family.

      Attachments

        For Gerrit Dashboard: PYSIDE-2226
        # Subject Branch Project Status CR V

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            stsav012 Anton Yablokov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes