Rev 4529: Avoid using PyFrozenSet_New in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Tue Jul 14 17:10:40 BST 2009


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 4529
revision-id: john at arbash-meinel.com-20090714161032-evzphbn9t15lay6j
parent: pqm at pqm.ubuntu.com-20090714100845-hvon0uo2poeoxr29
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Tue 2009-07-14 11:10:32 -0500
message:
  Avoid using PyFrozenSet_New
  
  it seems it wasn't defined in python2.4
  The 'frozenset()' object is available, just not its C api.
  However, we don't really need the function call, though
  I would expect it to be slightly faster.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-06-19 20:35:35 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-07-14 16:10:32 +0000
@@ -25,8 +25,6 @@
     ctypedef struct PyObject:
         pass
 
-    object PyFrozenSet_New(object)
-
     object PyTuple_New(Py_ssize_t n)
     Py_ssize_t PyTuple_GET_SIZE(object t)
     PyObject * PyTuple_GET_ITEM(object t, Py_ssize_t o)
@@ -267,7 +265,7 @@
         cdef Py_ssize_t pos, last_item
         cdef long min_gdfo
 
-        heads_key = PyFrozenSet_New(keys)
+        heads_key = frozenset(keys)
         maybe_heads = PyDict_GetItem(self._known_heads, heads_key)
         if maybe_heads != NULL:
             return <object>maybe_heads
@@ -285,7 +283,7 @@
             if not candidate_nodes:
                 return frozenset([NULL_REVISION])
             # The keys changed, so recalculate heads_key
-            heads_key = PyFrozenSet_New(candidate_nodes)
+            heads_key = frozenset(candidate_nodes)
         if PyDict_Size(candidate_nodes) < 2:
             return heads_key
 
@@ -330,7 +328,7 @@
             node = <_KnownGraphNode>temp_node
             if not node.seen:
                 PyList_Append(heads, node.key)
-        heads = PyFrozenSet_New(heads)
+        heads = frozenset(heads)
         for pos from 0 <= pos < PyList_GET_SIZE(cleanup):
             node = _get_list_node(cleanup, pos)
             node.seen = 0



More information about the bazaar-commits mailing list