Bug 1547730 - Use six.moves.xrange() instead of xrange() r=glandium
authorJustin Wood <Callek@gmail.com>
Tue, 28 May 2019 14:25:49 +0000
changeset 475902 2dafc77a00b283ac6dcf51f4d11be4f79520cb69
parent 475901 d74097a6c6c52c00f034c08796a99786f7698302
child 475903 5839ef6f14c5b15e01bd70d4fe870362244f46fa
push id86529
push userjwood@mozilla.com
push dateTue, 28 May 2019 14:47:17 +0000
treeherderautoland@dbadda4e3c1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1547730
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547730 - Use six.moves.xrange() instead of xrange() r=glandium Differential Revision: https://phabricator.services.mozilla.com/D28106
python/mozbuild/mozpack/mozjar.py
python/mozbuild/mozpack/test/test_files.py
--- a/python/mozbuild/mozpack/mozjar.py
+++ b/python/mozbuild/mozpack/mozjar.py
@@ -392,17 +392,17 @@ class JarReader(object):
         '''
         if hasattr(self, '_entries'):
             return self._entries
         preload = 0
         if self.is_optimized:
             preload = JarStruct.get_data('uint32', self._data)[0]
         entries = OrderedDict()
         offset = self._cdir_end['cdir_offset']
-        for e in xrange(self._cdir_end['cdir_entries']):
+        for e in six.moves.xrange(self._cdir_end['cdir_entries']):
             entry = JarCdirEntry(self._data[offset:])
             offset += entry.size
             # Creator host system. 0 is MSDOS, 3 is Unix
             host = entry['creator_version'] >> 8
             # External attributes values depend on host above. On Unix the
             # higher bits are the stat.st_mode value. On MSDOS, the lower bits
             # are the FAT attributes.
             xattr = entry['external_attr']
--- a/python/mozbuild/mozpack/test/test_files.py
+++ b/python/mozbuild/mozpack/test/test_files.py
@@ -160,17 +160,17 @@ class TestDest(TestWithTmpDir):
         dest.write('foo')
         dest.close()
         dest.write('qux')
         self.assertEqual(dest.read(), 'qux')
 
 
 rand = b''.join(random.choice(
     b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
-                for i in xrange(131597))
+                for i in six.moves.xrange(131597))
 samples = [
     b'',
     b'test',
     b'fooo',
     b'same',
     b'same',
     b'Different and longer',
     rand,
@@ -710,17 +710,17 @@ class TestDeflatedFile(TestWithTmpDir):
         src = self.tmppath('src.jar')
         dest = self.tmppath('dest')
 
         contents = {}
         with JarWriter(src) as jar:
             for content in samples:
                 name = b''.join(random.choice(
                     b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
-                    for i in xrange(8))
+                    for i in range(8))
                 jar.add(name, content, compress=True)
                 contents[name] = content
 
         for j in JarReader(src):
             f = DeflatedFile(j)
             f.copy(dest)
             self.assertEqual(contents[j.filename], open(dest, 'rb').read())