Geoffrey Odhner added the comment:
I'm quite sure it's the same regular expression with the same code. It was a
puzzling bug, and I thought it might take more to track it down than it did. I
tried changing the file encoding on both the code and the data, and found that
the problem didn't arise from that, or at least couldn't be fixed that way. I
copied the files to the XP machine via a flash drive, and every copy warned me
that the properties for the files were being lost. Otherwise the files were
directly copied between machines. Are strings stored identically on Windows XP
and Windows 7? If there is some variation in what the ends of strings look
like on the two platforms, that might explain the discrepancy.
Since Matthew Barnett reports being unable to reproduce the problem, I'll
provide you with the full code and data I've used as a demonstration of the
problem. The INCLUDE and DEFINE lines produce output for both match() and
fullmatch() calls on Windows 7, but only for match() calls on Windows XP.
My command line for running this code was: .\test.py
This was run in the directory in which both files are saved.
Of course it's possible that I've missed some other bug in my code that causes
these regular expressions to match differently between platforms, but match()
and fullmatch() are working the same on both Mac OS and Windows 7. I will
appreciate your comments.
Best regards,
Geoff Odhner
> -Original Message-
> From: Zachary Ware [mailto:rep...@bugs.python.org]
> Sent: Tuesday, August 02, 2016 5:21 PM
> To: geoff...@odhner.net
> Subject: [issue27669] Bug in re.fullmatch() specific to Windows XP
>
>
> Zachary Ware added the comment:
>
> Since this is not a security issue, 3.4 is in security fix only mode,
> and Windows XP is no longer supported in Python 3.5+, this will not be
> fixed. Thus, I'm closing the issue.
>
> However, this is bizarre :). There is no Windows-version-specific code
> in the re module, so the behavior should be exactly the same between XP
> and 7. Are you absolutely certain you're using exactly the same
> regular expression with exactly the same input on all three platforms?
>
> --
> nosy: +zach.ware
> resolution: -> out of date
> stage: -> resolved
> status: open -> closed
>
> ___
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue27669>
> ___
--
Added file: http://bugs.python.org/file43981/test.py
Added file: http://bugs.python.org/file43982/test.txt
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27669>
___#! /usr/local/bin/python3
import sys, os, argparse, time, re, shutil, socket
class Box:
pass
def main(argv):
global errors
errors = False
regexes = Box()
regexes.define = re.compile('^[\t ]*DEFINE:[\t ]*'
'\$(?P\{)?(?P[A-Z0-9_.]+)(?(brace)\})'
'[\t ]*=[\t ]*'
'(?P((?P-)|([#A-Z]))?[.0-9]+)'
'[ \t\r]*(;.*|\(.*\))?$', flags=re.IGNORECASE)
regexes.include = re.compile('^[\t ]*INCLUDE:[\t ]*'
'((?P[\'"])(?P[^\'"]+)'
'(?P=quote)|(?P[^\t ]+))'
'[ \t\r]*(;.*|\(.*\))?$', flags=re.IGNORECASE)
def process_file(filename):
nonlocal regexes
infile = open(filename, encoding='utf-8')
if not infile:
log_error(0, "Input file couldn't be opened ", filename)
return
file_contents = infile.read()
lines = file_contents.split('\n')
for lineno in range(0, len(lines)):
line = lines[lineno].strip()
lines[lineno] = line
found = regexes.include.fullmatch(line)
if found:
print('Include line fullmatch: ', line, file=sys.stderr)
found = regexes.include.match(line)
if found:
print('Include line match: ', line, file=sys.stderr)
found = regexes.define.fullmatch(line)
if found:
print('Define line fullmatch: ', line, file=sys.stderr)
found = regexes.define.match(line)
if found:
print('Define line match: ', line, file=sys.stderr)
process_file('test.txt')
if __name__ == "__main__":
global errors
main(sys.argv[1:])
sys.exit(errors)
INCLUDE:Constants.cnc
DEFINE: $Version.Number = #500
;; Shared Variables:
DEFINE: $Configured.Head.Thickne