1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Description: Fix re expression SyntaxWarning in cache.py
The regular expression in lib/python/mod_python/cache.py contains invalid
escape sequences. The escape character (\ aka backslash) of regular
expressions collides with the escape character (also \ aka backslash) of
Python string literals.
.
Since Python 3.12 any invalid escape sequences in Python's usage of the
backslash in string literals now generate a SyntaxWarning and in the future
this will become a SyntaxError. Previous Python versions also noted similar
future deprecation warnings. See https://docs.python.org/3.12/library/re.html
for more details.
Author: Dominik Viererbe <dominik.viererbe@canonical.com>
Origin: vendor
Forwarded: https://github.com/grisha/mod_python/pull/133
Applied-Upstream: https://github.com/grisha/mod_python/commit/70fe7d5f655d1ea706f192f3d19fccfa6eb97173
Reviewed-by: Gregory Trubetskoy <grisha@modpython.org>
Last-Update: 2024-03-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/python/mod_python/cache.py
+++ b/lib/python/mod_python/cache.py
@@ -280,7 +280,7 @@
def parseRFC822Time(t):
return mktime(parsedate(t))
-re_max_age=re.compile('max-age\s*=\s*(\d+)', re.I)
+re_max_age=re.compile(r'max-age\s*=\s*(\d+)', re.I)
class HTTPEntity(object):
def __init__(self, entity, metadata):
|