#1144984 python3.14 says /usr/lib/libreoffice/share/Scripts/python/ScriptForgeHelper.py:257: SyntaxWarning: 'return' in a 'finally' block

#1144984#5
Date:
2026-08-21 07:26:48 UTC
From:
To:
Debian 14 / python 3.14 now complains about ScriptForgeHelper.py.

    /usr/lib/libreoffice/share/Scripts/python/ScriptForgeHelper.py:257: SyntaxWarning: 'return' in a 'finally' block
      return None

It is this code:

    def _SF_Session__OpenURLInBrowser(url: str):    # Used by SF_Session.OpenURLInBrowser() Basic method
        """
        Display url using the default browser
        """
        try:
            webbrowser.open(url, new = 2)
        finally:
            return None

Based on https://github.com/iritkatriel/finally#:~:text=contains%20only%20a%20return
I think the correct fix is:

         try:
             webbrowser.open(url, new = 2)
        -finally:
        -    return None
        +return None

A minimum recipe to reproduce this error is:

    mmdebstrap forky /dev/null --quiet --include=libreoffice-common,python3 --customize-hook='chroot $1 python3 -m compileall /usr/lib/libreoffice/'

See also:

https://docs.python.org/3/whatsnew/3.14.html#pep-765-control-flow-in-finally-blocks
https://peps.python.org/pep-0765/