[Python-bugs-list] [Bug #110859] Environment dependency in re parser (PR#290)
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 7 Sep 2000 15:05:29 -0700
Bug #110859, was updated on 2000-Aug-01 14:38
Here is a current snapshot of the bug.
Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: Not a Bug
Priority: 3
Summary: Environment dependency in re parser (PR#290)
Details: Jitterbug-Id: 290
Submitted-By: nmm1@cam.ac.uk
Date: Wed, 12 Apr 2000 07:44:54 -0400 (EDT)
Version: 1.5.2
OS: Irix 6.5
The following code works perfectly when used interactively:
from re import match
if match(r'"([^\"]|\?""|\\?)*"','"abc"') :
print "Hello"
When run non-interactively (e.g. 'python junk.py'), it fails:
File "junk.py", line 3, in ?
if match(r'"([^\"]|\?""|\\?)*"','"abc"') :
File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 40, in match
return _cachecompile(pattern, flags).match(string)
File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 33, in _cachecompile
value = compile(pattern, flags)
File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 79, in compile
code=pcre_compile(pattern, flags, groupindex)
pcre.error: ('operand of unlimited repeat could match the empty string', 17)
====================================================================
Audit trail:
Tue Jul 11 08:29:16 2000 guido moved from incoming to open
Thu Jul 13 20:37:02 2000 fdrake changed notes
Thu Jul 13 20:37:02 2000 fdrake moved from open to irreproducible
Follow-Ups:
Date: 2000-Aug-01 14:38
By: none
Comment:
From: "Tim Peters" <tim_one@email.msn.com>
Subject: RE: [Python-bugs-list] Environment dependency in re parser (PR#290)
Date: Wed, 12 Apr 2000 22:30:46 -0400
> Full_Name: Nick Maclaren
> Version: 1.5.2
> OS: Irix 6.5
> Submission from: posh.mcc.wwwcache.ja.net (194.83.240.29)
>
>
> The following code works perfectly when used interactively:
>
> from re import match
>
> if match(r'"([^\"]|\?""|\\?)*"','"abc"') :
> print "Hello"
>
> When run non-interactively (e.g. 'python junk.py'), it fails:
>
> File "junk.py", line 3, in ?
> if match(r'"([^\"]|\?""|\\?)*"','"abc"') :
> File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 40, in match
> return _cachecompile(pattern, flags).match(string)
> File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 33, in
> _cachecompile
> value = compile(pattern, flags)
> File "/usr/local/Python-1.5.2/lib/python1.5/re.py", line 79, in compile
> code=pcre_compile(pattern, flags, groupindex)
> pcre.error: ('operand of unlimited repeat could match the empty
> string', 17)
It yields the same error for me whether run interactively or from file,
under the released 1.5.2 for Windows, here run from a DOS box:
D:\Python>python
Python 1.5.42 (#0, Jan 31 2000, 14:05:14) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from re import match
>>> if match(r'"([^\"]|\?""|\\?)*"','"abc"') :
... print "Hello"
...
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "D:\Python\Lib\re.py", line 40, in match
return _cachecompile(pattern, flags).match(string)
File "D:\Python\Lib\re.py", line 33, in _cachecompile
value = compile(pattern, flags)
File "D:\Python\Lib\re.py", line 79, in compile
code=pcre_compile(pattern, flags, groupindex)
pcre.error: ('operand of unlimited repeat could match the empty string', 17)
>>>
The error msg is appropriate, since the third branch of the alternative
matches 0 or 1 backslashes, so the alternative as a whole can match the
empty string -- the error msg means exactly what it says. This is
functioning correctly as designed.
Perhaps you're using an interactive shell with a filter (readline?) that's
chewing up some of the backslashes itself?
-------------------------------------------------------
Date: 2000-Aug-01 14:38
By: none
Comment:
Something from outside of Python appears to causing this.
-------------------------------------------------------
Date: 2000-Sep-07 15:05
By: jhylton
Comment:
Please do triage on this bug.
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110859&group_id=5470