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

Overflow-Checks produce a Warning/Error Mix

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Shiboken
    • None

      When an overflow occurs, we get no OverflowError("nice error message")
      but a warning message and some empty overflow error.
      This can be seen in a shiboken test by passing -i:

      $ python3 -i /Users/tismer/src/QtC/pyside-setup/sources/shiboken2/tests/samplebinding/point_test.py
      ......../usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py:202: RuntimeWarning: libshiboken: Overflow: Value 840835495615213080 exceeds limits of type  [unsigned] "j" (4bytes).
        callable_obj(*args, **kwargs)
      .
      ----------------------------------------------------------------------
      Ran 9 tests in 0.002s
      
      OK
      Traceback (most recent call last):
        File "/Users/tismer/src/QtC/pyside-setup/sources/shiboken2/tests/samplebinding/point_test.py", line 116, in <module>
          unittest.main()
        File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py", line 101, in __init__
          self.runTests()
        File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py", line 273, in runTests
          sys.exit(not self.result.wasSuccessful())
      SystemExit: False
      

      Now we enter something into the test:

      >>> Point(0.0, 0.0).setXAsUint(-1)
      <stdin>:1: RuntimeWarning: libshiboken: Overflow: Value -1 exceeds limits of type  [unsigned] "j" (4bytes).
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      OverflowError
      >>> 
      

      This should not be a warning followed by an empty error, but always a nicely
      visible error.

      sources/shiboken2/libshiboken/sbkconverter_p.h:128

        1. pyside1375_5.py
          0.2 kB
          Friedemann Kleint
        2. pyside1375.diff
          0.6 kB
          Friedemann Kleint
        3. pyside1375.py
          0.2 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            ctismer Christian Tismer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes