From a3bdaeceae44ec51e3c20fff3933a471f7b2c8f8 Mon Sep 17 00:00:00 2001 From: Andreas Pelme Date: Sat, 17 Dec 2016 12:55:35 +0100 Subject: [PATCH] Avoid using py.std to import fnmatch. fnmatch is used from the pytest ast hook which may trigger an import from the import hook. This leads to endless recursion. Avoiding py.std avoids the problem. See https://github.com/pytest-dev/pytest/issues/2121 for more information. --- py/_path/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/_path/common.py b/py/_path/common.py index bf42ed50..4af88dcd 100644 --- a/py/_path/common.py +++ b/py/_path/common.py @@ -1,6 +1,7 @@ """ """ import os, sys, posixpath +import fnmatch import py # Moved from local.py. @@ -436,4 +437,4 @@ def __call__(self, path): name = str(path) # path.strpath # XXX svn? if not os.path.isabs(pattern): pattern = '*' + path.sep + pattern - return py.std.fnmatch.fnmatch(name, pattern) + return fnmatch.fnmatch(name, pattern)