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

Regression for Python 3.9 due to type hints #1386

Closed
rockstorm101 opened this issue Oct 13, 2023 · 1 comment
Closed

Regression for Python 3.9 due to type hints #1386

rockstorm101 opened this issue Oct 13, 2023 · 1 comment

Comments

@rockstorm101
Copy link
Collaborator

https://github.com/kliment/Printrun/blame/9a759a03e6893991876a6fe5549b3ac8498e72ae/printrun/gui/widgets.py#L308 introduced in commit 4e3d90a produces the following error on a machine running Python 3.9.2. (I'll see if we can automate detecting this kind of errors)

$ ./pronterface.py
Traceback (most recent call last):
  File "/home/rock/Printrun/./pronterface.py", line 30, in <module>
    from printrun.pronterface import PronterApp
  File "/home/rock/Printrun/printrun/pronterface.py", line 32, in <module>
    from . import pronsole
  File "/home/rock/Printrun/printrun/pronsole.py", line 41, in <module>
    from .settings import Settings, BuildDimensionsSetting
  File "/home/rock/Printrun/printrun/settings.py", line 26, in <module>
    from .gui.widgets import get_space
  File "/home/rock/Printrun/printrun/gui/__init__.py", line 29, in <module>
    from .controls import ControlsSizer, add_extra_controls
  File "/home/rock/Printrun/printrun/gui/controls.py", line 21, in <module>
    from .widgets import TempGauge
  File "/home/rock/Printrun/printrun/gui/widgets.py", line 159, in <module>
    class FindAndReplace():
  File "/home/rock/Printrun/printrun/gui/widgets.py", line 308, in FindAndReplace
    def bools_to_flags(self, bools: tuple | list) -> int:
TypeError: unsupported operand type(s) for |: 'type' and 'type'

I haven't looked much onto it but the quick and dirty change below seems to do the trick. Any better ideas @neofelis2X?

- def bools_to_flags(self, bools: tuple | list) -> int:
+ def bools_to_flags(self, bools) -> int:
@neofelis2X
Copy link
Contributor

Oh damn, I was blissfully unaware that this | is only supported 3.10+.
Yes I think a simple and pragmatic fix like this is good.

I will set up an older python version to test too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants