[issue27669] Bug in re.fullmatch() specific to Windows XP

2016-08-03 Thread Geoffrey Odhner

Geoffrey Odhner added the comment:

I'm puzzled by your inability to reproduce my result, however I have found an 
error in what I reported to you.  On the XP system the version I'm using is NOT 
3.4.3, but 3.4.0 (3.4.0:04ff714765c13, Mar 16 2014, 19:24:06) [MSC v1600 32 bit 
(Intel)], running on Windows XP version 5.1.2600.  That appeared to be the 
suggested version for XP when I downloaded it.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27669] Bug in re.fullmatch() specific to Windows XP

2016-08-02 Thread Geoffrey Odhner

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

[issue27669] Bug in re.fullmatch() specific to Windows XP

2016-08-02 Thread Geoffrey Odhner

New submission from Geoffrey Odhner:

I have found a bug in python’s re.fullmatch() function when it’s running on 
Windows XP.  On Mac OS X or Windows 7 the bug doesn’t occur.  When I use 
fullmatch() with a regular expression that ends with ‘$’ it fails to match the 
string (on XP, but it matches on Mac OS and Win 7), but when I use that same 
regular expression with match() it works.  I’m not in urgent need of a fix, 
since replacing those particular calls with match() gets around the problem and 
is giving consistent behavior across platforms, but the inconsistency in 
behavior in fullmatch() between platforms should be fixed.  I’m using python 
3.4.3 on all three platforms.

--
components: Regular Expressions
messages: 271853
nosy: ezio.melotti, ggodhner, mrabarnett
priority: normal
severity: normal
status: open
title: Bug in re.fullmatch() specific to Windows XP
type: behavior
versions: Python 3.4

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com