[Bug 2061374] Re: Python SyntaxWarnings

Lupe Christoph 2061374 at bugs.launchpad.net
Sat Jun 22 15:24:17 UTC 2024


In python 3.12, the deprecation warning for backslash-character pairs in
plain strings has been changed to a syntax warning. See
https://docs.python.org/3/whatsnew/3.12.html:

A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning. For example,
re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid
escape sequence, use raw strings for regular expression:
re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning. (Contributed by Victor
Stinner in gh-98401.)

I'm attaching a patch that changes all strings passed to re methods to
raw strings. That shuts up the syntax warnings.

** Patch added: "Change all strings passed to re methods to raw strings"
   https://bugs.launchpad.net/ubuntu/+source/debian-goodies/+bug/2061374/+attachment/5791390/+files/checkrestart.patch

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to debian-goodies in Ubuntu.
https://bugs.launchpad.net/bugs/2061374

Title:
  Python SyntaxWarnings

Status in debian-goodies package in Ubuntu:
  Confirmed

Bug description:
  Hi,

  here is the problem:

  # checkrestart 
  /usr/sbin/checkrestart:222: SyntaxWarning: invalid escape sequence '\S'
    m = re.match('^diversion by (\S+) (from|to): (.*)$', line)
  /usr/sbin/checkrestart:398: SyntaxWarning: invalid escape sequence '\('
    if re.compile("DEL").search(last) or re.compile("\(deleted\)").search(data) or re.compile("\(path inode=[0-9]+\)$").search(data):
  /usr/sbin/checkrestart:398: SyntaxWarning: invalid escape sequence '\('
    if re.compile("DEL").search(last) or re.compile("\(deleted\)").search(data) or re.compile("\(path inode=[0-9]+\)$").search(data):
  /usr/sbin/checkrestart:430: SyntaxWarning: invalid escape sequence '\s'
    if re.compile("\s\(deleted\)$").search(fname):
  /usr/sbin/checkrestart:437: SyntaxWarning: invalid escape sequence '\s'
    data = re.split('\s+', output.strip('\n'), 3)
  /usr/sbin/checkrestart:440: SyntaxWarning: invalid escape sequence '\s'
    if re.compile("\s\(deleted\)$").search(f):
  /usr/sbin/checkrestart:464: SyntaxWarning: invalid escape sequence '\.'
    if ( f.startswith('/lib/') or f.startswith('/usr/lib/') ) and re.compile("\.so[\d.]+$"):
  /usr/sbin/checkrestart:468: SyntaxWarning: invalid escape sequence '\+'
    f = re.compile("\+").sub("\+", f)
  /usr/sbin/checkrestart:468: SyntaxWarning: invalid escape sequence '\+'
    f = re.compile("\+").sub("\+", f)
  /usr/sbin/checkrestart:469: SyntaxWarning: invalid escape sequence '\d'
    f = re.compile(".so[\d.]+$").sub(".so.*", f)
  /usr/sbin/checkrestart:470: SyntaxWarning: invalid escape sequence '\.'
    f = re.compile("\.").sub("\.", f)
  /usr/sbin/checkrestart:470: SyntaxWarning: invalid escape sequence '\.'
    f = re.compile("\.").sub("\.", f)
  /usr/sbin/checkrestart:594: SyntaxWarning: invalid escape sequence '\('
    if re.compile("\(path inode=[0-9]+\)$").search(f):
  /usr/sbin/checkrestart:651: SyntaxWarning: invalid escape sequence '\d'
    re_uids = re.compile('Uid:\t(\d+)\t(\d+)\t(\d+)\t(\d+)$')
  /usr/sbin/checkrestart:764: SyntaxWarning: invalid escape sequence '\('
    return re.sub('( \(deleted\)|.dpkg-new).*$','',f)
  lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
        Output information may be incomplete.
  lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
        Output information may be incomplete.
  Found 0 processes using old versions of upgraded files

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: debian-goodies 0.88.1ubuntu1
  Uname: Linux 6.8.6-060806-generic x86_64
  ApportVersion: 2.28.0-0ubuntu1
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: KDE
  Date: Mon Apr 15 11:04:17 2024
  PackageArchitecture: all
  SourcePackage: debian-goodies
  UpgradeStatus: Upgraded to noble on 2024-04-12 (3 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-goodies/+bug/2061374/+subscriptions




More information about the foundations-bugs mailing list