Rev 4723: Change 'no except' to 'cannot_raise' in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-pyrex-propagation

John Arbash Meinel john at arbash-meinel.com
Tue Jan 5 05:00:12 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-pyrex-propagation

------------------------------------------------------------
revno: 4723
revision-id: john at arbash-meinel.com-20100105045957-e7nahale20jrhvbk
parent: john at arbash-meinel.com-20100105045352-ihgrq3yzl0e3uzje
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-pyrex-propagation
timestamp: Mon 2010-01-04 22:59:57 -0600
message:
  Change 'no except' to 'cannot_raise'
-------------- next part --------------
=== modified file 'bzrlib/_annotator_pyx.pyx'
--- a/bzrlib/_annotator_pyx.pyx	2010-01-04 23:02:07 +0000
+++ b/bzrlib/_annotator_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -83,7 +83,7 @@
     return 0
 
 
-cdef PyObject *_next_tuple_entry(object tpl, Py_ssize_t *pos): # no except
+cdef PyObject *_next_tuple_entry(object tpl, Py_ssize_t *pos): # cannot_raise
     """Return the next entry from this tuple.
 
     :param tpl: The tuple we are investigating, *must* be a PyTuple

=== modified file 'bzrlib/_btree_serializer_pyx.pyx'
--- a/bzrlib/_btree_serializer_pyx.pyx	2010-01-04 23:13:20 +0000
+++ b/bzrlib/_btree_serializer_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -54,7 +54,7 @@
 
 
 # TODO: Find some way to import this from _dirstate_helpers
-cdef void* _my_memrchr(void *s, int c, size_t n): # no except
+cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise
     # memrchr seems to be a GNU extension, so we have to implement it ourselves
     # It is not present in any win32 standard library
     cdef char *pos

=== modified file 'bzrlib/_chk_map_pyx.pyx'
--- a/bzrlib/_chk_map_pyx.pyx	2010-01-04 23:13:20 +0000
+++ b/bzrlib/_chk_map_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -65,7 +65,7 @@
 _unknown = None
 
 # We shouldn't just copy this from _dirstate_helpers_pyx
-cdef void* _my_memrchr(void *s, int c, size_t n): # no except
+cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise
     # memrchr seems to be a GNU extension, so we have to implement it ourselves
     cdef char *pos
     cdef char *start

=== modified file 'bzrlib/_dirstate_helpers_pyx.pyx'
--- a/bzrlib/_dirstate_helpers_pyx.pyx	2010-01-04 23:13:20 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -119,7 +119,7 @@
     # void *memrchr(void *s, int c, size_t len)
 
 
-cdef void* _my_memrchr(void *s, int c, size_t n): # no except
+cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise
     # memrchr seems to be a GNU extension, so we have to implement it ourselves
     cdef char *pos
     cdef char *start
@@ -165,7 +165,7 @@
     return PyString_FromStringAndSize(s, size)
 
 
-cdef int _is_aligned(void *ptr): # no except
+cdef int _is_aligned(void *ptr): # cannot_raise
     """Is this pointer aligned to an integer size offset?
 
     :return: 1 if this pointer is aligned, 0 otherwise.
@@ -173,7 +173,7 @@
     return ((<intptr_t>ptr) & ((sizeof(int))-1)) == 0
 
 
-cdef int _cmp_by_dirs(char *path1, int size1, char *path2, int size2): # no except
+cdef int _cmp_by_dirs(char *path1, int size1, char *path2, int size2): # cannot_raise
     cdef unsigned char *cur1
     cdef unsigned char *cur2
     cdef unsigned char *end1
@@ -295,7 +295,7 @@
 
 
 cdef int _cmp_path_by_dirblock_intern(char *path1, int path1_len,
-                                      char *path2, int path2_len): # no except
+                                      char *path2, int path2_len): # cannot_raise
     """Compare two paths by what directory they are in.
 
     see ``_cmp_path_by_dirblock`` for details.
@@ -768,7 +768,7 @@
     state._dirblock_state = DirState.IN_MEMORY_UNMODIFIED
 
 
-cdef int minikind_from_mode(int mode): # no except
+cdef int minikind_from_mode(int mode): # cannot_raise
     # in order of frequency:
     if S_ISREG(mode):
         return c"f"
@@ -954,7 +954,7 @@
     raise KeyError(PyString_FromStringAndSize(_minikind, 1))
 
 
-cdef int _versioned_minikind(char minikind): # no except
+cdef int _versioned_minikind(char minikind): # cannot_raise
     """Return non-zero if minikind is in fltd"""
     return (minikind == c'f' or
             minikind == c'd' or

=== modified file 'bzrlib/_groupcompress_pyx.pyx'
--- a/bzrlib/_groupcompress_pyx.pyx	2010-01-04 23:13:20 +0000
+++ b/bzrlib/_groupcompress_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -276,7 +276,7 @@
 
 
 cdef unsigned char *_decode_copy_instruction(unsigned char *bytes,
-    unsigned char cmd, unsigned int *offset, unsigned int *length): # no except
+    unsigned char cmd, unsigned int *offset, unsigned int *length): # cannot_raise
     """Decode a copy instruction from the next few bytes.
 
     A copy instruction is a variable number of bytes, so we will parse the

=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2010-01-05 04:51:53 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -594,7 +594,7 @@
             self._revno_first, self._revno_second, self._revno_last,
             self.is_first_child, self.seen_by_child)
 
-    cdef int has_pending_parents(self): # no except
+    cdef int has_pending_parents(self): # cannot_raise
         if self.left_pending_parent is not None or self.pending_parents:
             return 1
         return 0

=== modified file 'bzrlib/_rio_pyx.pyx'
--- a/bzrlib/_rio_pyx.pyx	2010-01-05 04:53:52 +0000
+++ b/bzrlib/_rio_pyx.pyx	2010-01-05 04:59:57 +0000
@@ -49,7 +49,7 @@
 
 from bzrlib.rio import Stanza
 
-cdef int _valid_tag_char(char c): # no except
+cdef int _valid_tag_char(char c): # cannot_raise
     return (c == c'_' or c == c'-' or 
             (c >= c'a' and c <= c'z') or
             (c >= c'A' and c <= c'Z') or

=== modified file 'bzrlib/_walkdirs_win32.pyx'
--- a/bzrlib/_walkdirs_win32.pyx	2010-01-05 04:53:52 +0000
+++ b/bzrlib/_walkdirs_win32.pyx	2010-01-05 04:59:57 +0000
@@ -109,7 +109,7 @@
                                  wcslen(data.cFileName))
 
 
-cdef int _get_mode_bits(WIN32_FIND_DATAW *data): # no except
+cdef int _get_mode_bits(WIN32_FIND_DATAW *data): # cannot_raise
     cdef int mode_bits
 
     mode_bits = 0100666 # writeable file, the most common
@@ -121,13 +121,13 @@
     return mode_bits
 
 
-cdef __int64 _get_size(WIN32_FIND_DATAW *data): # no except
+cdef __int64 _get_size(WIN32_FIND_DATAW *data): # cannot_raise
     # Pyrex casts a DWORD into a PyLong anyway, so it is safe to do << 32
     # on a DWORD
     return ((<__int64>data.nFileSizeHigh) << 32) + data.nFileSizeLow
 
 
-cdef double _ftime_to_timestamp(FILETIME *ft): # no except
+cdef double _ftime_to_timestamp(FILETIME *ft): # cannot_raise
     """Convert from a FILETIME struct into a floating point timestamp.
 
     The fields of a FILETIME structure are the hi and lo part
@@ -147,7 +147,7 @@
     return (val * 1.0e-7) - 11644473600.0
 
 
-cdef int _should_skip(WIN32_FIND_DATAW *data): # no except
+cdef int _should_skip(WIN32_FIND_DATAW *data): # cannot_raise
     """Is this '.' or '..' so we should skip it?"""
     if (data.cFileName[0] != c'.'):
         return 0

=== modified file 'bzrlib/tests/test_source.py'
--- a/bzrlib/tests/test_source.py	2010-01-05 04:51:53 +0000
+++ b/bzrlib/tests/test_source.py	2010-01-05 04:59:57 +0000
@@ -374,7 +374,7 @@
         """Extension functions should propagate exceptions.
 
         Either they should return an object, have an 'except' clause, or have a
-        #no except to indicate that we've audited them and defined them as not
+        "# cannot_raise" to indicate that we've audited them and defined them as not
         raising exceptions.
         """
         both_exc_and_no_exc = []
@@ -385,7 +385,7 @@
                                r'(\w+)\s*\(' # the function name
                                r'[^)]*\)\s*' # parameters
                                r'(.*)\s*:' # the except clause
-                               r'\s*(#\s*no except)?' # no except comment
+                               r'\s*(#\s*cannot[- _]raise)?' # cannot raise comment
                               )
         for fname, text in self.get_source_file_contents(
                 extensions=('.pyx',)):
@@ -400,7 +400,7 @@
                     missing_except.append((fname, func))
         error_msg = []
         if both_exc_and_no_exc:
-            error_msg.append('The following functions had no except comments'
+            error_msg.append('The following functions had "cannot raise" comments'
                              ' but did have an except clause set:')
             for fname, func in both_exc_and_no_exc:
                 error_msg.append('%s:%s' % (fname, func))
@@ -408,7 +408,7 @@
         if missing_except:
             error_msg.append('The following functions have fixed return types,'
                              ' but no except clause.')
-            error_msg.append('Either add an except or append "# no except".')
+            error_msg.append('Either add an except or append "# cannot_raise".')
             for fname, func in missing_except:
                 error_msg.append('%s:%s' % (fname, func))
             error_msg.extend(('', ''))



More information about the bazaar-commits mailing list