Skip to content

Missing quoting of \s in src/Soros.py #131

Description

@stbergmann

With an --enable-ext-numbertext build of recent LibreOffice master (which thus bundles b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt as a LibreOffice extension), I notice that during make JunitTest_svx_unoapi, it spits out some

warn:pyuno.runtime:3199389:3202828:pyuno/source/module/pyuno_runtime.cxx:951: Python exception: <class 'SyntaxError'>: invalid escape sequence '\s' (Soros.py, line 37), traceback follows
  File "/home/sberg/lo2/build/instdir/program/unohelper.py", line 292, in createInstanceWithContext
    return self.clazz( context )
  File "/home/sberg/lo2/build/instdir/share/extensions/numbertext/reg.uno.py", line 7, in createInstance
    import org.Numbertext
  File "/home/sberg/lo2/build/instdir/program/uno.py", line 346, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
  File "/home/sberg/lo2/build/instdir/share/extensions/numbertext/pythonpath/org/Numbertext/__init__.py", line 8, in <module>
    from org.Numbertext import Soros
  File "/home/sberg/lo2/build/instdir/program/uno.py", line 346, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)

 at /home/sberg/lo2/source/pyuno/source/module/pyuno_runtime.cxx:950

Looks like that old revision of src/Soros.py would need some quoting like

@@ -34,7 +34,7 @@
             prg = "0+(0|[1-9]\\d*) $1\n" + prg.replace("__numbertext__", "")
         prg = _tr(prg, _m[:4], _c[:4], "\\") # \\, \", \;, \# -> \uE000..\uE003
         for s in re.sub("(#[^\n]*)?(\n|$)", ";", prg).split(";"):
-            m = re.match("^\s*(\"[^\"]*\"|[^\s]*)\s*(.*[^\s])?\s*$", s)
+            m = re.match("^\\s*(\"[^\"]*\"|[^\\s]*)\\s*(.*[^\\s])?\\s*$", s)
             if m != None:
                 s = _tr(m.group(1).strip("\""), _c[1:4], _m[1:4], "") \
                     .replace(_c[_m.find("\\")], "\\\\") # -> \\, ", ;, #

That source file has apparently changed since then, but I think the most recent revision of src/Soros.py would still need that fix on line 46,

        matchline = re.compile("^\s*(\"[^\"]*\"|[^\s]*)\s*(.*[^\s])?\s*$")

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions