| 1 |
Description: Use raw strings for regular expressions with backslashes |
| 2 |
Prefix the CPU and memory specification regular expressions with r so Python |
| 3 |
no longer emits SyntaxWarning for invalid string escape sequences. |
| 4 |
Author: Alexandre Detiste <[email protected]> |
| 5 |
Forwarded: not-needed |
| 6 |
Bug-Debian: https://bugs.debian.org/1085531 |
| 7 |
Last-Update: 2025-03-15 |
| 8 |
--- a/cpuset/cset.py |
| 9 |
+++ b/cpuset/cset.py |
| 10 |
@@ -343,7 +343,7 @@ |
| 11 |
def cpuspec_check(cpuspec, usemax=True): |
| 12 |
"""check format of cpuspec for validity""" |
| 13 |
log.debug("cpuspec_check(%s)", cpuspec) |
| 14 |
|
| 15 |
+ mo = re.search(r"[^0-9,\-]", cpuspec) |
| 16 |
if mo: |
| 17 |
str = 'CPUSPEC "%s" contains invalid charaters: %s' % (cpuspec, mo.group()) |
| 18 |
log.debug(str) |
| 19 |
@@ -395,7 +395,7 @@ |
| 20 |
# information and check the memspec that way, currently we only do |
| 21 |
# a basic check |
| 22 |
log.debug("memspec_check(%s)", memspec) |
| 23 |
|
| 24 |
+ mo = re.search(r"[^0-9,\-]", memspec) |
| 25 |
if mo: |
| 26 |
str = 'MEMSPEC "%s" contains invalid charaters: %s' % (memspec, mo.group()) |
| 27 |
log.debug(str) |