Skip to content

Commit 8dce37f

Browse files
committed
Fix regular expression warnings on Python 3.12
1 parent 85ed46f commit 8dce37f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
dropped when pasting in larger amounts of text. This makes it possible
66
to paste programs into EhBASIC and Taliforth. Patch by SamCoVT.
77

8+
- Fixed regular expression warnings on Python 3.12.
9+
810
- The ``fill`` command in the monitor now shows an error message if an
911
address or value is out of range.
1012

py65/monitor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def _preprocess_line(self, line):
239239
line = command
240240
break
241241

242-
pattern = '^%s\s+' % re.escape(shortcut)
242+
pattern = r'^%s\s+' % re.escape(shortcut)
243243
matches = re.match(pattern, line)
244244
if matches:
245245
start, end = matches.span()
@@ -580,7 +580,7 @@ def do_registers(self, args):
580580
if args == '':
581581
return
582582

583-
pairs = re.findall('([^=,\s]*)=([^=,\s]*)', args)
583+
pairs = re.findall(r'([^=,\s]*)=([^=,\s]*)', args)
584584
if pairs == []:
585585
return self._output("Syntax error: %s" % args)
586586

py65/utils/addressing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def number(self, num):
6161
return self.labels[num]
6262

6363
else:
64-
matches = re.match('^([^\s+-]+)\s*([+\-])\s*([$+%]?\d+)$', num)
64+
matches = re.match(r'^([^\s+-]+)\s*([+\-])\s*([$+%]?\d+)$', num)
6565
if matches:
6666
label, sign, offset = matches.groups()
6767

@@ -88,7 +88,7 @@ def range(self, addresses):
8888
"""Parse a string containing an address or a range of addresses
8989
into a tuple of (start address, end address)
9090
"""
91-
matches = re.match('^([^:,]+)\s*[:,]+\s*([^:,]+)$', addresses)
91+
matches = re.match(r'^([^:,]+)\s*[:,]+\s*([^:,]+)$', addresses)
9292
if matches:
9393
start, end = map(self.number, matches.groups(0))
9494
else:

0 commit comments

Comments
 (0)