https://bugs.documentfoundation.org/show_bug.cgi?id=173228

            Bug ID: 173228
           Summary: SyntaxWarning: 'return' in a 'finally' block in
                    ScriptForgeHelper.py with python 3.14
           Product: LibreOffice
           Version: 26.2.4.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Hi,

from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1144984:

--- snip ---
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/
--- snip ---

Steps to Reproduce:
see the original report, mmdebstrap of course is Debian-package only but it
should be possible to reproduce nevertheless in an upstream build with
(system-)python 3.14

Actual Results:
SyntaxWarning

Expected Results:
no SyntaxWarning


Reproducible: Always


User Profile Reset: No

Additional Info:
still in master

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to