/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/_bencode_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2009-06-12 18:05:15 UTC
  • mto: (4371.4.5 vila-better-heads)
  • mto: This revision was merged to the branch mainline in revision 4449.
  • Revision ID: john@arbash-meinel.com-20090612180515-t0cwbjsnve094oik
Add a failing test for handling nodes that are in the same linear chain.

It fails because the ancestry skipping causes us to miss the fact that the two nodes
are actually directly related. We could check at the beginning, as the 
code used to do, but I think that will be incomplete for the more-than-two
heads cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2007,2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
58
58
    void D_UPDATE_TAIL(Decoder, int n)
59
59
    void E_UPDATE_TAIL(Encoder, int n)
60
60
 
61
 
# To maintain compatibility with older versions of pyrex, we have to use the
62
 
# relative import here, rather than 'bzrlib._static_tuple_c'
63
 
from _static_tuple_c cimport StaticTuple, StaticTuple_CheckExact, \
64
 
    import_static_tuple_c
65
 
 
66
 
import_static_tuple_c()
67
 
 
68
61
 
69
62
cdef class Decoder:
70
63
    """Bencode decoder"""
268
261
        self.maxsize = maxsize
269
262
        self.tail = p
270
263
 
271
 
    def __dealloc__(self):
 
264
    def __del__(self):
272
265
        free(self.buffer)
273
266
        self.buffer = NULL
274
267
        self.maxsize = 0
378
371
                self._encode_int(x)
379
372
            elif PyLong_CheckExact(x):
380
373
                self._encode_long(x)
381
 
            elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
382
 
                  or StaticTuple_CheckExact(x)):
 
374
            elif PyList_CheckExact(x) or PyTuple_CheckExact(x):
383
375
                self._encode_list(x)
384
376
            elif PyDict_CheckExact(x):
385
377
                self._encode_dict(x)