Skip to content
Snippets Groups Projects
Commit 087e497a authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Replace reduce(operator.or_, ...) with any(...).

The any() builtin was introduced in Python 2.5. Not only is its intent
clearer, but it handles the case of zero items -- which the reduce(or_)
construct does not. Sporadically we've seen exceptions from
generate_breakpad_symbols.py when reduce(or_, ...) is given zero items. This
masks the actual error (failure to dump symbols? failure to read them?),
masquerading as a bug in the Python script.
parent 8ec4e83d
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
import collections import collections
import fnmatch import fnmatch
import itertools import itertools
import operator
import os import os
import re import re
import sys import sys
...@@ -149,7 +148,7 @@ def match_module_basename(m): ...@@ -149,7 +148,7 @@ def match_module_basename(m):
== os.path.splitext(os.path.basename(m))[0].lower() == os.path.splitext(os.path.basename(m))[0].lower()
# there must be at least one .sym file in tarfile_members that matches # there must be at least one .sym file in tarfile_members that matches
# each required module (ignoring file extensions) # each required module (ignoring file extensions)
if not reduce(operator.or_, itertools.imap(match_module_basename, tarfile_members)): if not any(itertools.imap(match_module_basename, tarfile_members)):
print >> sys.stderr, "failed to find required %s in generated %s" \ print >> sys.stderr, "failed to find required %s in generated %s" \
% (required_module, viewer_symbol_file) % (required_module, viewer_symbol_file)
os.remove(viewer_symbol_file) os.remove(viewer_symbol_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment