~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_bencode_pyx.pyx

  • Committer: Matthew Fuller
  • Date: 2009-08-18 08:10:44 UTC
  • mto: (4772.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4773.
  • Revision ID: fullermd@over-yonder.net-20090818081044-2due6ius01c4pwjl
Fix up some doctests to handle things ending up as RevisionSpec_dwim's
instead of RS_revno, and ending up as _dwim's (which may error
eventually, but won't until we try to evaluate them) instead of
insta-errors.

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)