Fuzzy match hangs

Create issue
Issue #170 invalid
Former user created an issue

There is a bug that causes Python to hang indefinitely when performing fuzzy matching. This code reproduces the problem:

> import sys
> print sys.version
2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:50:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
> import regex
> print regex.__version__
2.4.85
> regex.findall("uff", "stuff", regex.BESTMATCH)
['uff']
> regex.findall("(uff){e<=2}", "stuff", regex.BESTMATCH)
# Python hangs indefinitely 

I cannot escape Python using Control+C, but Control+Z successfully sends the process to the background. Note that findall() without fuzzy matching runs without error.

The problem was fixed by downgrading to regex-2015.10.5. This version was right before the commit of a change addressing an issue regarding fuzzy match behavior. Identical code runs fine in this version:

> import regex
> print regex.__version__
2.4.83
> regex.findall("(uff){e<=2}", "stuff", regex.BESTMATCH)
['uff']

This was run on Linux on x86_64, which is little endian. Python version is 2.7.10, as given above.

Comments (6)

  1. Matthew Barnett repo owner

    I get this:

    Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print sys.version
    2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)]
    >>> import regex
    >>> print regex.__version__
    2.4.85
    >>> regex.findall("uff", "stuff", regex.BESTMATCH)
    ['uff']
    >>> regex.findall("(uff){e<=2}", "stuff", regex.BESTMATCH)
    ['uff']
    

    As I can't reproduce it, it's going to be difficult to find where the problem lies.

  2. Former user Account Deleted

    Edited the description for clarity.

    I tested the code on my other machine (OS X 64-bit), and failed to reproduce the problem:

    Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import regex
    >>> print regex.__version__
    2.4.85
    >>> regex.findall("(uff){e<=2}", "stuff", regex.BESTMATCH)
    ['uff']
    
  3. animalize

    Can't reproduce it on regex 2015.11.14.

    Python 3.4.3 (default, Apr 26 2015, 11:37:47)
    [GCC 4.6.3] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> sys.version
    '3.4.3 (default, Apr 26 2015, 11:37:47) \n[GCC 4.6.3]'
    >>> import regex
    >>> regex.__version__
    '2.4.85'
    >>> regex.findall("uff", "stuff", regex.BESTMATCH)
    ['uff']
    >>> regex.findall("(uff){e<=2}", "stuff", regex.BESTMATCH)
    ['uff']
    
  4. Matthew Barnett repo owner

    That's not the same version of Python.

    Your original report had:

    > print sys.version
    2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:50:01) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
    

    whereas your latest has:

    '3.4.3 (default, Apr 26 2015, 11:37:47) \n[GCC 4.6.3]'
    
  5. Log in to comment