-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No longer use implicit convertion to int with loss #82180
Comments
Use only the __index__() method for implicit conversion to iteger, and not __int__(). This converts deprecation warnings added in bpo-36048 into TypeError. |
There are some comments in the Objects/longobject.c code that still refer to __int__, and could use an update. For example: Line 366 in 7da46b6
|
I think it is all here. Thank you Mark for your review and for fixing outdated docs and comments. |
….getgrgid in 3.10 (pythonGH-95346) (cherry picked from commit 50bf5fa) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
….getgrgid in 3.10 (pythonGH-95346) (cherry picked from commit 50bf5fa) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Apparently python 3.10 no longer silently truncates floats to ints, (see python/cpython#82180) Current code passes a float to the wxGauge progress bar, which then prints (not) tracebacks like: TypeError: Gauge.SetValue(): argument 1 has unexpected type 'float' Traceback (most recent call last): File "/usr/lib64/python3.10/site-packages/wx/core.py", line 3285, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) At least someone is catching and ignoring the exception, so the app works, just the progress bar is broken. It just needs to be explicitly forced to an int to make it work again Signed-off-by: Karl Palsson <karlp@etactica.com>
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
…3.10 (#5467) # Description Python 3.10 no longer casts floats to ints python/cpython#82180 The variable `POLL_INTERVAL_MS` is used by QTimer and the `setInterval()` needs an int (in milliseconds), see: https://doc.qt.io/qt-5/qtimer.html This means that in python 3.10 the existing value (16.666) results in a TypeError (see #5415 ) and napari doesn't even launch. Note: This is part of the experimental async/octree and apparently not tested on 3.10 CI. `POLL_INTERVAL_MS` is fairly arbitrary and unused anywhere else, so in this PR I simply assign an int to it, `16` rather than the `16.666` (~1/60). ## Type of change <!-- Please delete options that are not relevant. --> - [x] Bug-fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # References Closes #5415 # How has this been tested? <!-- Please describe the tests that you ran to verify your changes. --> - [ ] example: the test suite for my feature covers cases x, y, and z - [ ] example: all tests pass with my change - [x] example: If I enable the experimental features in settings, then napari won't launch on main (as in the issue) but will launch with this branch. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html).
Implicit cast of float to int was removed, c.f. python/cpython#82180 Also move the custom excepthook above since new versions of PyQt will abort on unhandled exceptions in absence of a custom hook.
Implicit cast of float to int was removed, c.f. python/cpython#82180 Also move the custom excepthook above since new versions of PyQt will abort on unhandled exceptions in absence of a custom hook.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: