This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bug in re.fullmatch() specific to Windows XP
Type: behavior Stage: resolved
Components: Regular Expressions Versions: Python 3.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, ggodhner, mrabarnett, zach.ware
Priority: normal Keywords:

Created on 2016-08-02 21:10 by ggodhner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py ggodhner, 2016-08-02 22:41
test.txt ggodhner, 2016-08-02 22:41
output.txt mrabarnett, 2016-08-02 23:31
Messages (8)
msg271853 - (view) Author: Geoffrey Odhner (ggodhner) Date: 2016-08-02 21:10
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.
msg271854 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-08-02 21:21
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?
msg271861 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2016-08-02 22:02
FTR, I can't reproduce it. This is what I get on Windows XP (32-bit):

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.fullmatch('abc$', 'abc')
<_sre.SRE_Match object; span=(0, 3), match='abc'>
>>>
msg271864 - (view) Author: Geoffrey Odhner (ggodhner) Date: 2016-08-02 22:41
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:report@bugs.python.org]
> Sent: Tuesday, August 02, 2016 5:21 PM
> To: geoffrey@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 <report@bugs.python.org>
> <http://bugs.python.org/issue27669>
> _______________________________________
msg271866 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2016-08-02 23:31
When I tried it, I got matches for both 'match' and 'fullmatch' (output attached as 'output.txt') as expected.
msg271907 - (view) Author: Geoffrey Odhner (ggodhner) Date: 2016-08-03 14:32
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.
msg271916 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2016-08-03 17:44
Are you using the same version on the other systems?

I've had a quick look through the bug tracker and found some fixes for fullmatch that postdate Python 3.4.0, so I'll suggest you just update to a more recent version of Python 3.4.
msg271917 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-08-03 17:48
Use 3.4.4 on Windows XP, it's the latest available (without building it yourself).
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71856
2016-08-03 17:48:51zach.waresetmessages: + msg271917
2016-08-03 17:44:41mrabarnettsetmessages: + msg271916
2016-08-03 14:32:34ggodhnersetmessages: + msg271907
2016-08-02 23:31:41mrabarnettsetfiles: + output.txt

messages: + msg271866
2016-08-02 22:41:52ggodhnersetfiles: + test.py, test.txt

messages: + msg271864
2016-08-02 22:02:32mrabarnettsetmessages: + msg271861
2016-08-02 21:21:13zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg271854

resolution: out of date
stage: resolved
2016-08-02 21:10:41ggodhnercreate