Rev 4719: Start going through the test failures. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-pyrex-propagation
John Arbash Meinel
john at arbash-meinel.com
Mon Jan 4 23:13:35 GMT 2010
At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-pyrex-propagation
------------------------------------------------------------
revno: 4719
revision-id: john at arbash-meinel.com-20100104231320-f3es4l130o48ya7t
parent: john at arbash-meinel.com-20100104230207-xcijrzo22fowu9jg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-pyrex-propagation
timestamp: Mon 2010-01-04 17:13:20 -0600
message:
Start going through the test failures.
It did catch 1 case where there should have been an exception clause.
So far, though, it doesn't seem super useful, and has some false
positives...
-------------- next part --------------
=== modified file 'bzrlib/_btree_serializer_pyx.pyx'
--- a/bzrlib/_btree_serializer_pyx.pyx 2009-10-01 20:50:36 +0000
+++ b/bzrlib/_btree_serializer_pyx.pyx 2010-01-04 23:13:20 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Canonical Ltd
+# Copyright (C) 2008, 2009 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
@@ -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):
+cdef void* _my_memrchr(void *s, int c, size_t n): # no except
# 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 2009-06-22 12:52:39 +0000
+++ b/bzrlib/_chk_map_pyx.pyx 2010-01-04 23:13:20 +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):
+cdef void* _my_memrchr(void *s, int c, size_t n): # no except
# 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 20:06:30 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.pyx 2010-01-04 23:13:20 +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):
+cdef void* _my_memrchr(void *s, int c, size_t n): # no except
# 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):
+cdef int _is_aligned(void *ptr): # no except
"""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):
+cdef int _cmp_by_dirs(char *path1, int size1, char *path2, int size2): # no except
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):
+ char *path2, int path2_len): # no except
"""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):
+cdef int minikind_from_mode(int mode): # no except
# in order of frequency:
if S_ISREG(mode):
return c"f"
@@ -915,7 +915,8 @@
return link_or_sha1
-cdef char _minikind_from_string(object string):
+# TODO: Do we want to worry about exceptions here?
+cdef char _minikind_from_string(object string) except? -1:
"""Convert a python string to a char."""
return PyString_AsString(string)[0]
@@ -953,7 +954,7 @@
raise KeyError(PyString_FromStringAndSize(_minikind, 1))
-cdef int _versioned_minikind(char minikind):
+cdef int _versioned_minikind(char minikind): # no except
"""Return non-zero if minikind is in fltd"""
return (minikind == c'f' or
minikind == c'd' or
@@ -1373,7 +1374,7 @@
def iter_changes(self):
return self
- cdef void _gather_result_for_consistency(self, result):
+ cdef int _gather_result_for_consistency(self, result) except -1:
"""Check a result we will yield to make sure we are consistent later.
This gathers result's parents into a set to output later.
@@ -1381,7 +1382,7 @@
:param result: A result tuple.
"""
if not self.partial or not result[0]:
- return
+ return 0
self.seen_ids.add(result[0])
new_path = result[1][1]
if new_path:
@@ -1391,6 +1392,7 @@
# Add the root directory which parent_directories does not
# provide.
self.search_specific_file_parents.add('')
+ return 0
cdef int _update_current_block(self) except -1:
if (self.block_index < len(self.state._dirblocks) and
=== modified file 'bzrlib/_groupcompress_pyx.pyx'
--- a/bzrlib/_groupcompress_pyx.pyx 2009-06-10 03:56:49 +0000
+++ b/bzrlib/_groupcompress_pyx.pyx 2010-01-04 23:13:20 +0000
@@ -276,7 +276,7 @@
cdef unsigned char *_decode_copy_instruction(unsigned char *bytes,
- unsigned char cmd, unsigned int *offset, unsigned int *length):
+ unsigned char cmd, unsigned int *offset, unsigned int *length): # no except
"""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/_knit_load_data_pyx.pyx'
--- a/bzrlib/_knit_load_data_pyx.pyx 2009-06-22 12:52:39 +0000
+++ b/bzrlib/_knit_load_data_pyx.pyx 2010-01-04 23:13:20 +0000
@@ -97,11 +97,12 @@
self.end_str = NULL
self.history_len = 0
- cdef void validate(self):
+ cdef int validate(self) except -1:
if not PyDict_CheckExact(self.cache):
raise TypeError('kndx._cache must be a python dict')
if not PyList_CheckExact(self.history):
raise TypeError('kndx._history must be a python list')
+ return 0
cdef object process_options(self, char *option_str, char *end):
"""Process the options string into a list."""
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx 2009-09-02 13:32:52 +0000
+++ b/bzrlib/_known_graph_pyx.pyx 2010-01-04 23:13:20 +0000
@@ -108,14 +108,14 @@
parent_keys, child_keys)
-cdef _KnownGraphNode _get_list_node(lst, Py_ssize_t pos):
+cdef _KnownGraphNode _get_list_node(lst, Py_ssize_t pos): # no except
cdef PyObject *temp_node
temp_node = PyList_GET_ITEM(lst, pos)
return <_KnownGraphNode>temp_node
-cdef _KnownGraphNode _get_tuple_node(tpl, Py_ssize_t pos):
+cdef _KnownGraphNode _get_tuple_node(tpl, Py_ssize_t pos): # no except
cdef PyObject *temp_node
temp_node = PyTuple_GET_ITEM(tpl, pos)
@@ -208,7 +208,10 @@
child = <_KnownGraphNode>temp_node
child.clear_references()
- cdef _KnownGraphNode _get_or_create_node(self, key):
+ # Note: We don't need to set an 'except clause because _KnownGraphNode is
+ # an object type. However our crude test_source parser doesn't know
+ # how to tell that
+ cdef _KnownGraphNode _get_or_create_node(self, key): # no except
cdef PyObject *temp_node
cdef _KnownGraphNode node
@@ -591,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):
+ cdef int has_pending_parents(self): # no except
if self.left_pending_parent is not None or self.pending_parents:
return 1
return 0
@@ -642,7 +645,8 @@
node = self.graph._nodes[tip_key]
self._push_node(node, 0)
- cdef _MergeSortNode _get_ms_node(self, _KnownGraphNode node):
+ # Note: _MergeSortNode is an object type so there is an implied except
+ cdef _MergeSortNode _get_ms_node(self, _KnownGraphNode node): # no except
cdef PyObject *temp_node
cdef _MergeSortNode ms_node
=== modified file 'bzrlib/tests/test_source.py'
--- a/bzrlib/tests/test_source.py 2010-01-04 23:02:07 +0000
+++ b/bzrlib/tests/test_source.py 2010-01-04 23:13:20 +0000
@@ -405,8 +405,8 @@
error_msg.extend(('', ''))
if missing_except:
error_msg.append('The following functions have fixed return types,'
- ' but no except clause. Either add an except'
- ' or append "# no except".')
+ ' but no except clause.')
+ error_msg.append(' Either add an except or append "# no except".')
for fname, func in missing_except:
error_msg.append('%s:%s' % (fname, func))
error_msg.extend(('', ''))
More information about the bazaar-commits
mailing list