From: Zac Medico Date: Wed, 15 Feb 2012 22:17:38 +0000 (-0800) Subject: treewalk: handle EAGAIN from listdir for PyPy 1.8 X-Git-Tag: v2.2.0_alpha87~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fb89e5a829dfe0083b921c8c3958a3341d055cf8;p=portage.git treewalk: handle EAGAIN from listdir for PyPy 1.8 --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index a86170c1a..96c2530bb 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3402,6 +3402,7 @@ class dblink(object): while True: unicode_error = False + eagain_error = False myfilelist = [] mylinklist = [] @@ -3409,7 +3410,19 @@ class dblink(object): srcroot_len = len(srcroot) def onerror(e): raise - for parent, dirs, files in os.walk(srcroot, onerror=onerror): + walk_iter = os.walk(srcroot, onerror=onerror) + while True: + try: + parent, dirs, files = next(walk_iter) + except StopIteration: + break + except OSError as e: + if e.errno != errno.EAGAIN: + raise + # Observed with PyPy 1.8. + eagain_error = True + break + try: parent = _unicode_decode(parent, encoding=_encodings['merge'], errors='strict') @@ -3464,7 +3477,7 @@ class dblink(object): if unicode_error: break - if not unicode_error: + if not (unicode_error or eagain_error): break if unicode_errors: