Hello, On 2023/05/30 17:04, Daniel Sahlberg wrote: > Den tis 30 maj 2023 kl 04:46 skrev Jun Omae <jun6...@gmail.com>:
>>> If I understand this correctly, the string should be declared as raw >> instead of binary: >>> [[[ >>> Index: subversion/tests/cmdline/copy_tests.py >>> =================================================================== >>> --- subversion/tests/cmdline/copy_tests.py (revision 1910111) >>> +++ subversion/tests/cmdline/copy_tests.py (working copy) >>> @@ -1421,7 +1421,7 @@ >>> if re.match(b'[^\\r]\\n', raw_contents): >>> raise svntest.Failure >>> >>> - if not re.match(b'.*\$LastChangedRevision:\s*\d+\s*\$', >> line_contents[3]): >>> + if not re.match(r'.*\$LastChangedRevision:\s*\d+\s*\$', >> line_contents[3]): >>> raise svntest.Failure >>> >>> #------------------------------------------------------------- >>> ]]] >>> >>> Maybe the previous re.match (first context line in the diff) should be >> changed as well? >> >> The literal for the regular expression should be a bytes instance because >> line_contents[3] is a bytes instance. >> If Python is 3.3 or later, we could use a raw bytes literal. >> >> [[[ >> - if not re.match(b'.*\$LastChangedRevision:\s*\d+\s*\$', >> line_contents[3]): >> + if not re.match(rb'.*\$LastChangedRevision:\s*\d+\s*\$', >> line_contents[3]): >> ]]] >> >> However, in attached patch, correct the escape sequences because "make >> check" requires at least Python 3.0. In the discussion in this list at 2019, there is no objection that we don't support Python 3.x where x < 5, both in trunk and 1.14.x. And since r1899944, we drop Python 2.7 support for make check, in trunk. So I think it can be accectable, at least trunk. However we've not drop Python 2.7 support agressively, using 'br' prefix instead of 'rb' is prefered if we want back porting this to 1.14.x. Because 'br' prefix can be also used in Python 2.7. >> [[[ >> - if not re.match(b'.*\$LastChangedRevision:\s*\d+\s*\$', >> line_contents[3]): >> + if not re.match(b'.*\\$LastChangedRevision:\\s*\\d+\\s*\\$', >> line_contents[3]): >> ]]] >> >> The patch fixes many "invalid escape sequences" which exist in also other >> Python scripts (verified unit tests with Python 3.5 and 3.12 on Ubuntu, and >> Python 3.12 on Windows). > > I checked the changes and it looks good as far as I understand. I've also > run the testsuite (make check, make davautocheck, make svnserveautocheck) > with Python 3.11.2 on Ubuntu (WSL), all seems fine. Of course, this form of literals is less incompatible between Python versions. Cheers, -- Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>