Rev 4749: Workaround a bug (#582656) in recent versions of Pyrex. in http://bazaar.launchpad.net/~jameinel/bzr/pyrex_099_bug_582656

John Arbash Meinel john at arbash-meinel.com
Wed May 19 18:06:41 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/pyrex_099_bug_582656

------------------------------------------------------------
revno: 4749
revision-id: john at arbash-meinel.com-20100519170638-l82bqgaw2hp03cwm
parent: pqm at pqm.ubuntu.com-20100429032512-v295m1mj9kcnamqs
fixes bug(s): https://launchpad.net/bugs/582656
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pyrex_099_bug_582656
timestamp: Wed 2010-05-19 12:06:38 -0500
message:
  Workaround a bug (#582656) in recent versions of Pyrex.
  
  It seems that if you use:
    except Exception: 
  Recent versions of Pyrex (0.9.8.6? and 0.9.9) leave the exception state set.
  Which means that if in the except: clause you have something like object comparison
  it checks PyErr_Occurred and then re-raises the exception you were trapping.
  The workaround is to always use:
    except Exception, e:
  style syntax.
  
  I used 'except Exception, _:' to make it clear we weren't touching the error,
  and because there was a place or two where we *were* making use of a variable
  named 'e' (caught by a different exception path).
-------------- next part --------------
=== modified file 'bzrlib/_dirstate_helpers_pyx.pyx'
--- a/bzrlib/_dirstate_helpers_pyx.pyx	2010-01-05 04:59:57 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.pyx	2010-05-19 17:06:38 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, 2008 Canonical Ltd
+# Copyright (C) 2007-2010 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
@@ -1219,7 +1219,7 @@
             else:
                 try:
                     source_parent_id = self.old_dirname_to_file_id[old_dirname]
-                except KeyError:
+                except KeyError, _:
                     source_parent_entry = self.state._get_entry(self.source_index,
                                                            path_utf8=old_dirname)
                     source_parent_id = source_parent_entry[0][2]
@@ -1236,7 +1236,7 @@
             else:
                 try:
                     target_parent_id = self.new_dirname_to_file_id[new_dirname]
-                except KeyError:
+                except KeyError, _:
                     # TODO: We don't always need to do the lookup, because the
                     #       parent entry will be the same as the source entry.
                     target_parent_entry = self.state._get_entry(self.target_index,
@@ -1478,7 +1478,7 @@
             # interface doesn't require it.
             try:
                 self.current_root = self.search_specific_files.pop()
-            except KeyError:
+            except KeyError, _:
                 raise StopIteration()
             self.searched_specific_files.add(self.current_root)
             # process the entries for this containing directory: the rest will be
@@ -1567,7 +1567,7 @@
                         #            and e.winerror == ERROR_DIRECTORY
                         try:
                             e_winerror = e.winerror
-                        except AttributeError:
+                        except AttributeError, _:
                             e_winerror = None
                         win_errors = (ERROR_DIRECTORY, ERROR_PATH_NOT_FOUND)
                         if (e.errno in win_errors or e_winerror in win_errors):
@@ -1656,7 +1656,7 @@
                     try:
                         self.current_dir_info = self.dir_iterator.next()
                         self.current_dir_list = self.current_dir_info[1]
-                    except StopIteration:
+                    except StopIteration, _:
                         self.current_dir_info = None
                 else: #(dircmp > 0)
                     # We have a dirblock entry for this location, but there
@@ -1803,7 +1803,7 @@
                                 and stat.S_IEXEC & current_path_info[3].st_mode)
                             try:
                                 relpath_unicode = self.utf8_decode(current_path_info[0])[0]
-                            except UnicodeDecodeError:
+                            except UnicodeDecodeError, _:
                                 raise errors.BadFilenameEncoding(
                                     current_path_info[0], osutils._fs_enc)
                             if changed is not None:
@@ -1851,7 +1851,7 @@
                 try:
                     self.current_dir_info = self.dir_iterator.next()
                     self.current_dir_list = self.current_dir_info[1]
-                except StopIteration:
+                except StopIteration, _:
                     self.current_dir_info = None
 
     cdef object _next_consistent_entries(self):



More information about the bazaar-commits mailing list