Skip to content
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

FIX: in analong_indicator, explicitly cast to int for py310+ compat #1080

Merged
merged 1 commit into from
May 30, 2024

Conversation

ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented May 29, 2024

Starting at python 3.10, the rules for passing floats into python C extension modules like pyqt has gotten stricter.
See #951 (closes #951)

The analog indicator widgets have this issue, but they mask over it with try/except blocks to prevent the app from crashing.
This PR makes the widget render as intended by casting all variable inputs to int.
Some of these are guaranteed to always be ints, but some of them are floats. Rather than parse out which is which, I figured it was better to cover all of them.

Python 3.9 pre-PR:
indicatorpy39

Python 3.12 pre-PR:
indicatorpy312

Python 3.12 post-PR:
indicator312_fixed

@ZLLentz
Copy link
Member Author

ZLLentz commented May 29, 2024

I marked this as closing the linked issue because, as far as I can tell, this is the only remaining case in pydm that has the problem.

Copy link
Collaborator

@jbellister-slac jbellister-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and thanks as well for taking a look through all the .pyi files!

@jbellister-slac jbellister-slac merged commit 92069c7 into slaclab:master May 30, 2024
19 checks passed
@ZLLentz ZLLentz deleted the fix_analog_indicator_py310 branch May 30, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python 3.10/pyqt has stricter typing rules
2 participants