py3: don't depend on map() iterating over its input
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 12 Jul 2019 23:19:50 -0700
changeset 4740 f8ef6d5f56f2
parent 4739 ce6e69b2f759
child 4741 e8727a27e380
py3: don't depend on map() iterating over its input map(some_generator()) in py2 returns a list, while in py3 it returns a generator, so the passed-in generator won't be called unless the returned one is.
hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Thu Jul 11 16:49:01 2019 -0700
+++ b/hgext3rd/evolve/__init__.py	Fri Jul 12 23:19:50 2019 -0700
@@ -1322,7 +1322,8 @@
             markers.append(m)
         ui.write(_('Old store is version %d, will rewrite in version %d\n') % (
             repo.obsstore._version, new_format))
-        map(f.write, obsolete.encodemarkers(markers, True, new_format))
+        for data in obsolete.encodemarkers(markers, True, new_format):
+            f.write(data)
         f.close()
     ui.write(_('Done!\n'))