optional = ['test/test*.py', 'setup.cfg']
for pattern in optional:
files = filter(os.path.isfile, glob(pattern))
- if files:
- self.filelist.extend(files)
+ self.filelist.extend(files)
# build_py is used to get:
# - python modules
if ua:
env['HTTP_USER_AGENT'] = ua
co = filter(None, self.headers.get_all('cookie', []))
- if co:
- env['HTTP_COOKIE'] = ', '.join(co)
+ cookie_str = ', '.join(co)
+ if cookie_str:
+ env['HTTP_COOKIE'] = cookie_str
# XXX Other HTTP_* headers
# Since we're setting the env in the parent, provide empty
# values to override previously set values
except AttributeError:
no_os_uname = 1
- if no_os_uname or not filter(None, (system, node, release, version, machine)):
+ if no_os_uname or not list(filter(None, (system, node, release, version, machine))):
# Hmm, no there is either no uname or uname has returned
#'unknowns'... we'll have to poke around the system then.
if no_os_uname:
L = L * (n // 4)
# Force the elements to be distinct objects, else timings can be
# artificially low.
- L = map(lambda x: --x, L)
+ L = list(map(lambda x: --x, L))
doit(L) # ~sort
del L
# All equal. Again, force the elements to be distinct objects.
- L = map(abs, [-0.5] * n)
+ L = list(map(abs, [-0.5] * n))
doit(L) # =sort
del L
# for an older implementation of quicksort, which used the median
# of the first, last and middle elements as the pivot.
half = n // 2
- L = range(half - 1, -1, -1)
+ L = list(range(half - 1, -1, -1))
L.extend(range(half))
# Force to float, so that the timings are comparable. This is
# significantly faster if we leave tham as ints.
- L = map(float, L)
+ L = list(map(float, L))
doit(L) # !sort
print()
Library
-------
+- Issue #8230: Fix Lib/test/sortperf.py.
+
- Issue #7395: Fix tracebacks in pstats interactive browser.
- Issue #1713: Fix os.path.ismount(), which returned true for symbolic links