prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `TypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'` with PySide 6.4.0.1 application
  <!--
  Welcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:
  
  1. This tracker should only be used to report bugs and request features / enhancements to PyInstaller
      - For questions and general support, use the discussions forum.
  2. Use the search function before creating a new issue. Duplicates will be closed and directed to
     the original discussion.
  3. When making a bug report, make sure you provide all required information. The easier it is for
     maintainers to reproduce, the faster it'll be fixed.
  -->
  
  <!-- +++ ONLY TEXT +++ DO NOT POST IMAGES +++ -->
  
  ## Description of the issue
  
  When running a frozen PySide6 application using PySide 6.4.0.1, the `|` operator between Qt.KeyboardModifier and Qt.Key stops working, for example:
  ```
  Traceback (most recent call last):
    File "script.py", line 28, in <module>
      window = MainWindow()
    File "script.py", line 18, in __init__
      button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))
  TypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'
  [10109] Failed to execute script 'script' due to unhandled exception!
  ```
  
  Note that the script used for this works just fine if invoked directly from a development environment, and it works both in a development and a frozen build if downgraded to 6.3.2.
  
  Before filing this I made a repo to demonstrate the bug, but most of the info is included in this issue template already. https://github.com/twizmwazin/pyside-pyinstaller-unsupported-operand-bug
  
  ### Context information (for bug reports)
  
  * Output of `pyinstaller --version`: ```5.6.2```
  * Version of Python: Python 3.10.8
  * Platform: Ubuntu 20.04 on WSL 2
  * How you installed Python: Python 3.10.8 from source
  * Did you also try this on another platform? Does it work there?
  First discovered after upgrading to PySide 6.4.0.1 in Azure DevOps CI using Ubuntu 20.04 and MS's build of Python 3.10. Also reproduced on Windows 11 using Python 3.10.8 64-bit installed using the python.org installer.
  
  
  * try the latest development version, using the following command:
  
  ```shell
  pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
  ```
  
  * follow *all* the instructions in our "If Things Go Wrong" Guide
    (https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
  
  ### Make sure [everything is packaged correctly](https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sure-everything-is-packaged-correctly)
  
    * [x] start with clean installation
    * [x] use the latest development version
    * [x] Run your frozen program **from a command window (shell)** — instead of double-clicking on it
    * [x] Package your program in **--onedir mode**
    * [x] Package **without UPX**, say: use the option `--noupx` or set `upx=False` in your .spec-file
    * [x] Repackage you application in **verbose/debug mode**. For this, pass the option `--debug` to `pyi-makespec` or `pyinstaller` or use `EXE(..., debug=1, ...)` in your .spec file.
  
  
  ### A minimal example program which shows the error
  
  ```
  #!/usr/bin/env python3
  
  from PySide6.QtCore import Qt
  from PySide6.QtGui import QAction, QKeySequence
  from PySide6.QtWidgets import QApplication, QToolBar, QMainWindow
  
  
  class MainWindow(QMainWindow):
      def __init__(self):
          super(MainWindow, self).__init__()
  
          self.setWindowTitle("My Awesome App")
  
          toolbar = QToolBar("My main toolbar")
          self.addToolBar(toolbar)
  
          button_action = QAction("Your button", self)
          button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))
          button_action.triggered.connect(self.onMyToolBarButtonClick)
          toolbar.addAction(button_action)
  
      def onMyToolBarButtonClick(self, s):
          print("click", s)
  
  
  if __name__ == "__main__":
      app = QApplication()
      window = MainWindow()
      window.show()
      app.exec()
  ```
  
  ### Stacktrace / full error message
  
  
  ```
  Traceback (most recent call last):
    File "script.py", line 31, in <module>
      window = MainWindow()
    File "script.py", line 21, in __init__
      button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))
  TypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'
  ```
  
  Please also see <https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs>
  for more about what would use to solve the issue.
  
  
  </issue>
  <code>
  [start of PyInstaller/hooks/hook-PySide6.py]
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2021-2022, PyInstaller Development Team.
  3 #
  4 # Distributed under the terms of the GNU General Public License (version 2
  5 # or later) with exception for distributing the bootloader.
  6 #
  7 # The full license is in the file COPYING.txt, distributed with this software.
  8 #
  9 # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
  10 #-----------------------------------------------------------------------------
  11 
  12 from PyInstaller.utils.hooks.qt import get_qt_binaries, pyside6_library_info
  13 
  14 # Only proceed if PySide6 can be imported.
  15 if pyside6_library_info.version is not None:
  16     hiddenimports = ['shiboken6', 'inspect']
  17 
  18     # Collect required Qt binaries.
  19     binaries = get_qt_binaries(pyside6_library_info)
  20
  [end of PyInstaller/hooks/hook-PySide6.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/PyInstaller/hooks/hook-PySide6.py b/PyInstaller/hooks/hook-PySide6.py
  --- a/PyInstaller/hooks/hook-PySide6.py
  +++ b/PyInstaller/hooks/hook-PySide6.py
  @@ -9,11 +9,17 @@
   # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
   #-----------------------------------------------------------------------------
   
  +from PyInstaller.utils.hooks import is_module_satisfies
   from PyInstaller.utils.hooks.qt import get_qt_binaries, pyside6_library_info
   
   # Only proceed if PySide6 can be imported.
   if pyside6_library_info.version is not None:
       hiddenimports = ['shiboken6', 'inspect']
   
  +    # Starting with PySide6 6.4.0, we need to collect PySide6.support.deprecated for | and & operators to work with
  +    # Qt key and key modifiers enums. See #7249.
  +    if is_module_satisfies("PySide6 >= 6.4.0"):
  +        hiddenimports += ['PySide6.support.deprecated']
  +
       # Collect required Qt binaries.
       binaries = get_qt_binaries(pyside6_library_info)
  
verification_info: {"golden_diff": "diff --git a/PyInstaller/hooks/hook-PySide6.py b/PyInstaller/hooks/hook-PySide6.py\n--- a/PyInstaller/hooks/hook-PySide6.py\n+++ b/PyInstaller/hooks/hook-PySide6.py\n@@ -9,11 +9,17 @@\n # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n #-----------------------------------------------------------------------------\n \n+from PyInstaller.utils.hooks import is_module_satisfies\n from PyInstaller.utils.hooks.qt import get_qt_binaries, pyside6_library_info\n \n # Only proceed if PySide6 can be imported.\n if pyside6_library_info.version is not None:\n     hiddenimports = ['shiboken6', 'inspect']\n \n+    # Starting with PySide6 6.4.0, we need to collect PySide6.support.deprecated for | and & operators to work with\n+    # Qt key and key modifiers enums. See #7249.\n+    if is_module_satisfies(\"PySide6 >= 6.4.0\"):\n+        hiddenimports += ['PySide6.support.deprecated']\n+\n     # Collect required Qt binaries.\n     binaries = get_qt_binaries(pyside6_library_info)\n", "issue": "`TypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'` with PySide 6.4.0.1 application\n<!--\r\nWelcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:\r\n\r\n1. This tracker should only be used to report bugs and request features / enhancements to PyInstaller\r\n    - For questions and general support, use the discussions forum.\r\n2. Use the search function before creating a new issue. Duplicates will be closed and directed to\r\n   the original discussion.\r\n3. When making a bug report, make sure you provide all required information. The easier it is for\r\n   maintainers to reproduce, the faster it'll be fixed.\r\n-->\r\n\r\n<!-- +++ ONLY TEXT +++ DO NOT POST IMAGES +++ -->\r\n\r\n## Description of the issue\r\n\r\nWhen running a frozen PySide6 application using PySide 6.4.0.1, the `|` operator between Qt.KeyboardModifier and Qt.Key stops working, for example:\r\n```\r\nTraceback (most recent call last):\r\n  File \"script.py\", line 28, in <module>\r\n    window = MainWindow()\r\n  File \"script.py\", line 18, in __init__\r\n    button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))\r\nTypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'\r\n[10109] Failed to execute script 'script' due to unhandled exception!\r\n```\r\n\r\nNote that the script used for this works just fine if invoked directly from a development environment, and it works both in a development and a frozen build if downgraded to 6.3.2.\r\n\r\nBefore filing this I made a repo to demonstrate the bug, but most of the info is included in this issue template already. https://github.com/twizmwazin/pyside-pyinstaller-unsupported-operand-bug\r\n\r\n### Context information (for bug reports)\r\n\r\n* Output of `pyinstaller --version`: ```5.6.2```\r\n* Version of Python: Python 3.10.8\r\n* Platform: Ubuntu 20.04 on WSL 2\r\n* How you installed Python: Python 3.10.8 from source\r\n* Did you also try this on another platform? Does it work there?\r\nFirst discovered after upgrading to PySide 6.4.0.1 in Azure DevOps CI using Ubuntu 20.04 and MS's build of Python 3.10. Also reproduced on Windows 11 using Python 3.10.8 64-bit installed using the python.org installer.\r\n\r\n\r\n* try the latest development version, using the following command:\r\n\r\n```shell\r\npip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip\r\n```\r\n\r\n* follow *all* the instructions in our \"If Things Go Wrong\" Guide\r\n  (https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and\r\n\r\n### Make sure [everything is packaged correctly](https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sure-everything-is-packaged-correctly)\r\n\r\n  * [x] start with clean installation\r\n  * [x] use the latest development version\r\n  * [x] Run your frozen program **from a command window (shell)** \u2014 instead of double-clicking on it\r\n  * [x] Package your program in **--onedir mode**\r\n  * [x] Package **without UPX**, say: use the option `--noupx` or set `upx=False` in your .spec-file\r\n  * [x] Repackage you application in **verbose/debug mode**. For this, pass the option `--debug` to `pyi-makespec` or `pyinstaller` or use `EXE(..., debug=1, ...)` in your .spec file.\r\n\r\n\r\n### A minimal example program which shows the error\r\n\r\n```\r\n#!/usr/bin/env python3\r\n\r\nfrom PySide6.QtCore import Qt\r\nfrom PySide6.QtGui import QAction, QKeySequence\r\nfrom PySide6.QtWidgets import QApplication, QToolBar, QMainWindow\r\n\r\n\r\nclass MainWindow(QMainWindow):\r\n    def __init__(self):\r\n        super(MainWindow, self).__init__()\r\n\r\n        self.setWindowTitle(\"My Awesome App\")\r\n\r\n        toolbar = QToolBar(\"My main toolbar\")\r\n        self.addToolBar(toolbar)\r\n\r\n        button_action = QAction(\"Your button\", self)\r\n        button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))\r\n        button_action.triggered.connect(self.onMyToolBarButtonClick)\r\n        toolbar.addAction(button_action)\r\n\r\n    def onMyToolBarButtonClick(self, s):\r\n        print(\"click\", s)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    app = QApplication()\r\n    window = MainWindow()\r\n    window.show()\r\n    app.exec()\r\n```\r\n\r\n### Stacktrace / full error message\r\n\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"script.py\", line 31, in <module>\r\n    window = MainWindow()\r\n  File \"script.py\", line 21, in __init__\r\n    button_action.setShortcut(QKeySequence(Qt.AltModifier | Qt.Key_D))\r\nTypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'Key'\r\n```\r\n\r\nPlease also see <https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs>\r\nfor more about what would use to solve the issue.\r\n\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2021-2022, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\nfrom PyInstaller.utils.hooks.qt import get_qt_binaries, pyside6_library_info\n\n# Only proceed if PySide6 can be imported.\nif pyside6_library_info.version is not None:\n    hiddenimports = ['shiboken6', 'inspect']\n\n    # Collect required Qt binaries.\n    binaries = get_qt_binaries(pyside6_library_info)\n", "path": "PyInstaller/hooks/hook-PySide6.py"}]}