Rev 4780: More cleanups and clarifications. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-chk-map
John Arbash Meinel
john at arbash-meinel.com
Wed Oct 21 22:27:38 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-chk-map
------------------------------------------------------------
revno: 4780
revision-id: john at arbash-meinel.com-20091021212719-05zh4t7oo5kaird3
parent: john at arbash-meinel.com-20091021211941-3kldzti7r77q9q74
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-static-tuple-chk-map
timestamp: Wed 2009-10-21 16:27:19 -0500
message:
More cleanups and clarifications.
-------------- next part --------------
=== modified file 'bzrlib/_chk_map_py.py'
--- a/bzrlib/_chk_map_py.py 2009-10-20 22:13:23 +0000
+++ b/bzrlib/_chk_map_py.py 2009-10-21 21:27:19 +0000
@@ -95,7 +95,7 @@
value_lines = lines[pos:pos+num_value_lines]
pos += num_value_lines
value = '\n'.join(value_lines)
- items[StaticTuple(*elements[:-1])] = value
+ items[StaticTuple.from_sequence(elements[:-1])] = value
if len(items) != length:
raise AssertionError("item count (%d) mismatch for key %s,"
" bytes %r" % (length, key, bytes))
=== modified file 'bzrlib/_chk_map_pyx.pyx'
--- a/bzrlib/_chk_map_pyx.pyx 2009-10-21 20:53:21 +0000
+++ b/bzrlib/_chk_map_pyx.pyx 2009-10-21 21:27:19 +0000
@@ -51,15 +51,15 @@
char *PyString_AS_STRING_ptr "PyString_AS_STRING" (PyObject *s)
object PyString_FromStringAndSize(char*, Py_ssize_t)
-# It seems we need to import the definitions so that the pyrex compiler has
-# local names to access them.
+# cimport all of the definitions we will need to access
from _static_tuple_c cimport StaticTuple,\
import_static_tuple_c, StaticTuple_New, \
StaticTuple_Intern, StaticTuple_SET_ITEM, StaticTuple_CheckExact
cdef extern from "_static_tuple_c.h":
- # Defined explicitly rathert than cimport ing. Using cimport the type for
- # PyObject is a different class that happens to have the same name...
+ # Defined explicitly rather than cimport-ing. Trying to use cimport, the
+ # type for PyObject is a different class that happens to have the same
+ # name...
PyObject * StaticTuple_GET_ITEM_ptr "StaticTuple_GET_ITEM" (StaticTuple,
Py_ssize_t)
@@ -71,8 +71,7 @@
uLong crc32(uLong crc, Bytef *buf, uInt len)
-
-# This sets up the StaticTuple C_API functionality
+# Set up the StaticTuple C_API functionality
import_static_tuple_c()
cdef object _LeafNode
=== modified file 'bzrlib/_static_tuple_c.pxd'
--- a/bzrlib/_static_tuple_c.pxd 2009-10-21 19:43:05 +0000
+++ b/bzrlib/_static_tuple_c.pxd 2009-10-21 21:27:19 +0000
@@ -36,9 +36,9 @@
# Steals a reference and val must be a valid type, no checking is done
void StaticTuple_SET_ITEM(StaticTuple key, Py_ssize_t offset, object val)
- # This isn't particularly useful. Namely because Pyrex doesn't think of
- # this PyObject* to be the same type as a PyObject* defined in another
- # pyrex file... However, because we don't INCREF, we don't want to define
- # it as returning a regular 'object'.
- PyObject * StaticTuple_GET_ITEM(StaticTuple key, Py_ssize_t offset)
+ # We would normally use PyObject * here. However it seems that cython/pyrex
+ # treat the PyObject defined in this header as something different than one
+ # defined in a .pyx file. And since we don't INCREF, we need a raw pointer,
+ # not an 'object' return value.
+ void *StaticTuple_GET_ITEM(StaticTuple key, Py_ssize_t offset)
int StaticTuple_CheckExact(object)
More information about the bazaar-commits
mailing list