Changeset: 278b45e47d98 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/278b45e47d98
Modified Files:
        clients/examples/python/mclient-python3.py
        testing/Mconvert.py.in
        testing/hashstableout.py
        testing/mktest.py
Branch: Jun2023
Log Message:

Python 3.12 is stricter with backslashes in non-raw strings.


diffs (98 lines):

diff --git a/clients/examples/python/mclient-python3.py 
b/clients/examples/python/mclient-python3.py
--- a/clients/examples/python/mclient-python3.py
+++ b/clients/examples/python/mclient-python3.py
@@ -65,7 +65,7 @@ def main() :
     line = fi.readline()
     if encoding != 'utf-8':
         prompt = str(prompt, 'utf-8').encode(encoding, 'replace')
-    while line and line != "\q\n":
+    while line and line != "\\q\n":
         if encoding != 'utf-8':
             line = str(line, encoding).encode('utf-8')
         res = s.cmd('s' + line)
diff --git a/testing/Mconvert.py.in b/testing/Mconvert.py.in
--- a/testing/Mconvert.py.in
+++ b/testing/Mconvert.py.in
@@ -1165,7 +1165,7 @@ def RunTest(env, test, oktests, pSrvr):
         reason = "as MAPIPORT=%s is not available." % env['MAPIPORT']
     else:
         #test_rgx = re.compile("^"+TST+"((_[sp][0-9][0-9])?\..*)?$", 
re.MULTILINE)
-        test_rgx = re.compile("^"+TST+"((_[sp][0-9][0-9])?\.(?!stable).*)?$", 
re.MULTILINE)
+        test_rgx = re.compile("^"+TST+r"((_[sp][0-9][0-9])?\.(?!stable).*)?$", 
re.MULTILINE)
         for f in listdir(TSTSRCDIR):
             if test_rgx.match(f):
                 try:
@@ -1476,7 +1476,7 @@ def killProc(proc, outfile = None, cmd =
                 sym = r'c:\Symbols;'
         elif os.path.exists(r'c:\Program Files\Debugging Tools for Windows 
(x86)\cdb.exe'):
             cdb = r'c:\Program Files\Debugging Tools for Windows (x86)\cdb.exe'
-            if os.path.exists('c:\WINDOWS\Symbols'):
+            if os.path.exists(r'c:\WINDOWS\Symbols'):
                 sym = r'c:\WINDOWS\Symbols;'
         else:
             cdb = None
@@ -1993,11 +1993,11 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
 
     # Try to detect segfaults and the like
     # Try to detect aborts due to too deep recursion
-    for (regexp, msg) in [("(^(|[^#]*[\t ])((Memory|Segmentation) [Ff]ault|Bus 
[Ee]rror|Aborted|Assertion (|.* )failed[:\.]|!FATAL: BATSIGabort:)([ \t]|$))",
+    for (regexp, msg) in [("(^(|[^#]*[\t ])((Memory|Segmentation) [Ff]ault|Bus 
[Ee]rror|Aborted|Assertion (|.* )failed[:\\.]|!FATAL: BATSIGabort:)([ \t]|$))",
                            'segfault'),
                           ("aborted too deep recursion",
                            'recursion'),
-                          ("mal_mapi\.listen:operation failed: bind to stream 
socket port",
+                          (r"mal_mapi\.listen:operation failed: bind to stream 
socket port",
                            'socket')]:
         TO = re.compile(regexp, re.MULTILINE)
         # FIXME: this begs for a much nicer solution (100% copy of below)
@@ -2192,7 +2192,7 @@ os.environ['MAPIHOST'] = HOST
 if os.name == "nt":
     SYST    = "Windows"
     RELEASE = "5.0"
-    r = re.compile('^Microsoft Windows (.*)\[Version 
([0-9]+\.[0-9]+)([^\[0-9].*)\]$')
+    r = re.compile(r'^Microsoft Windows (.*)\[Version 
([0-9]+\.[0-9]+)([^\[0-9].*)\]$')
     if procdebug:
         print('starting process "cmd" "/c" "ver" (inpipe,outpipe)\n')
     proc = process.Popen('cmd /c ver', stdin=process.PIPE,
@@ -2302,7 +2302,7 @@ if SYST == "Linux":
     elif os.path.isfile('/etc/debian_version'):
         LINUX_DIST = "Debian:"+open('/etc/debian_version').readline().strip()
     if not LINUX_DIST:
-        LINUX_DIST = SYST+':'+re.match('^([0-9\.]*)([^0-9\.].*)$', 
RELEASE).group(1)
+        LINUX_DIST = SYST+':'+re.match(r'^([0-9\.]*)([^0-9\.].*)$', 
RELEASE).group(1)
     DIST,VERSION = LINUX_DIST.split(':', 1)
 elif SYST == "SunOS" and os.path.isfile('/etc/release'):
     (DIST,VERSION,rest) = open('/etc/release').readline().strip().split(' ',2)
@@ -2551,7 +2551,7 @@ def main(argv) :
                              stdout=process.PIPE, stderr=process.PIPE,
                              text=True)
         ruby_out, ruby_err = proc.communicate()
-        ruby_reg = re.compile("^[^ ]* ([0-9]+)\.([0-9]+)[^0-9].*$", 
re.MULTILINE)
+        ruby_reg = re.compile(r"^[^ ]* ([0-9]+)\.([0-9]+)[^0-9].*$", 
re.MULTILINE)
         ruby_ver = ruby_reg.match(ruby_out)
         if ruby_ver and \
            100 * int(ruby_ver.group(1)) + int(ruby_ver.group(2)) >= 109:
diff --git a/testing/hashstableout.py b/testing/hashstableout.py
--- a/testing/hashstableout.py
+++ b/testing/hashstableout.py
@@ -88,7 +88,7 @@ def print_result(header, values):
             print('{} values hashing to {}'.format(nvalues, h))
 
 def work(fpath):
-    hdr_rgx = re.compile('^%.*\#\s*type$')
+    hdr_rgx = re.compile(r'^%.*\#\s*type$')
     values_rgx = re.compile('^\[.*\]$')
     with open(fpath, 'r') as f:
         header = None
diff --git a/testing/mktest.py b/testing/mktest.py
--- a/testing/mktest.py
+++ b/testing/mktest.py
@@ -245,7 +245,7 @@ def main():
                 incomment = False
             else:
                 continue
-        line = re.sub('/\*.*?\*/', ' ', line)
+        line = re.sub(r'/\*.*?\*/', ' ', line)
         if '/*' in line:
             line = line[:line.find('/*')]
             incomment = True
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to