Rev 3883: (mbp) Don't call iteritems on transport_list_registry, because it may change during iteration in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Dec 9 02:34:56 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3883
revision-id: pqm at pqm.ubuntu.com-20081209023452-12dbzcwzxrt1xee3
parent: pqm at pqm.ubuntu.com-20081205181554-ofrdnafloc43bxkh
parent: mbp at sourcefrog.net-20081209014956-mbak0aw0zrprcido
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-12-09 02:34:52 +0000
message:
  (mbp) Don't call iteritems on transport_list_registry, because it may change during iteration
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/registry.py             lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-1
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
    ------------------------------------------------------------
    revno: 3882.1.2
    revision-id: mbp at sourcefrog.net-20081209014956-mbak0aw0zrprcido
    parent: mbp at sourcefrog.net-20081209005125-t9gmzphq8np6bvti
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: 277048-transport-registry
    timestamp: Mon 2008-12-08 17:49:56 -0800
    message:
      Add Registry.items()
    modified:
      bzrlib/registry.py             lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-1
    ------------------------------------------------------------
    revno: 3882.1.1
    revision-id: mbp at sourcefrog.net-20081209005125-t9gmzphq8np6bvti
    parent: pqm at pqm.ubuntu.com-20081205181554-ofrdnafloc43bxkh
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: 277048-transport-registry
    timestamp: Mon 2008-12-08 16:51:25 -0800
    message:
      Don't call iteritems on transport_list_registry, because it may change during iteration
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
=== modified file 'NEWS'
--- a/NEWS	2008-12-05 17:26:40 +0000
+++ b/NEWS	2008-12-09 00:51:25 +0000
@@ -16,8 +16,11 @@
 
   BUG FIXES:
   
-   * Allow BzrDir implementation to implement backing up of 
-     control directory. (#139691)
+    * Allow BzrDir implementation to implement backing up of 
+      control directory. (#139691)
+
+    * Don't call iteritems on transport_list_registry, because it may
+      change during iteration.  (Martin Pool, #277048)
 
     * Fix SystemError in ``_patiencediff_c`` module by calling
       PyErr_NoMemory() before returning NULL in PatienceSequenceMatcher_new.

=== modified file 'bzrlib/registry.py'
--- a/bzrlib/registry.py	2008-03-07 11:46:20 +0000
+++ b/bzrlib/registry.py	2008-12-09 01:49:56 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006, 2008 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -216,6 +216,9 @@
         for key, getter in self._dict.iteritems():
             yield key, getter.get_obj()
 
+    def items(self):
+        return sorted(self.iteritems())
+
     def _set_default_key(self, key):
         if not self._dict.has_key(key):
             raise KeyError('No object registered under key %s.' % key)

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2008-12-01 23:20:22 +0000
+++ b/bzrlib/transport/__init__.py	2008-12-09 00:51:25 +0000
@@ -84,7 +84,7 @@
 def _get_transport_modules():
     """Return a list of the modules providing transports."""
     modules = set()
-    for prefix, factory_list in transport_list_registry.iteritems():
+    for prefix, factory_list in transport_list_registry.items():
         for factory in factory_list:
             if hasattr(factory, "_module_name"):
                 modules.add(factory._module_name)
@@ -1587,7 +1587,7 @@
                     possible_transports.append(t_same_connection)
                 return t_same_connection
 
-    for proto, factory_list in transport_list_registry.iteritems():
+    for proto, factory_list in transport_list_registry.items():
         if proto is not None and base.startswith(proto):
             transport, last_err = _try_transport_factories(base, factory_list)
             if transport:




More information about the bazaar-commits mailing list