[Libreoffice-commits] core.git: librelogo/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 8 10:05:20 UTC 2018


 librelogo/source/LibreLogo/LibreLogo.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 841ee6fb052fb35467d74b70f575a86c8c0fe3b7
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 7 17:55:30 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Nov 8 11:03:41 2018 +0100

    Adapt LibreLogo.py to Python 3.7 re.sub change
    
    In a build using the system Python during build (i.e., not using
    --enable-python=fully-internal) on Fedora 29 (where /usr/bin/python3 is 3.7.1),
    UITest_librelogo failed with
    
    > ======================================================================
    > FAIL: test_compile_librelogo (compile.LibreLogoCompileTest)
    > ----------------------------------------------------------------------
    > Traceback (most recent call last):
    >   File "/data/sbergman/lo-system/core/sw/qa/uitest/librelogo/compile.py", line 128, in test_compile_librelogo
    >     self.assertEqual(test[1], re.sub(r'(\n| +\n)+', '\n', re.sub(r'\( ', '(', compiled)).strip())
    > AssertionError: 'glob[52 chars]_#\n label(_y + _z)\n #_ at L_i_N_e@_#\n#_ at L_i_N_e@_#\nx(25, 26)' != 'glob[52 chars]_#\n label(_y + _z)\n #_ at L_i_N_e@_#\n#_ at L_i_N_e@_#\nx(25, ,26)'
    >   global x
    >   def x(_y, _z):
    >    __checkhalt__()
    >    #_ at L_i_N_e@_#
    >    label(_y + _z)
    >    #_ at L_i_N_e@_#
    >   #_ at L_i_N_e@_#
    > - x(25, 26)+ x(25, ,26)?       +
    >
    >
    > ----------------------------------------------------------------------
    
    due to an upstream Python change discussed at
    <https://bugs.python.org/issue34982#msg329418> "re.sub() different behavior in
    3.7".
    
    I am not sure that upstream change really makes sense, despite that being
    explicitly confirmed in <https://bugs.python.org/issue34982#msg329420>.  But
    lets tweak our code to adapt to that anyway.  (There may be further places in
    LibreLogo.py that would need similar changes; I just fixed enough to make
    UITest_librelogo succeed for me.)
    
    Change-Id: I6c8f4b78f63953d582b88037fa56388b50af2b54
    Reviewed-on: https://gerrit.libreoffice.org/63038
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index bb17005a9684..6dde2f3c237a 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -1765,9 +1765,9 @@ def __l2p__(i, par, insub, inarray):
                 # add commas, except if already added, eg. with special RANGE
                 # (variable argument counts: RANGE 1 or RANGE 1 100 or RANGE 1 100 10)
                 if j > 0 and par["out"][-1] != ",":
-                    par["out"] = re.sub("( *)$",",\\1", par["out"])
+                    par["out"] = re.sub("( *),$",",\\1", par["out"] + ",")
                 __l2p__(i, par, True, False)
-            par["out"] = re.sub("( *)$", ")\\1", par["out"])
+            par["out"] = re.sub("( *)\\)$", ")\\1", par["out"] + ")")
         # operators
         elif pos in par["op"]:
             op = i[pos:par["op"][pos]]


More information about the Libreoffice-commits mailing list