~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_bencode_pyx.pyx

Rework test_script a little bit.


Don't allow someone to request a stdin request to echo.
Echo never reads from stdin, it just echos its arguments.
You use 'cat' if you want to read from stdin.

A few other fixes because the tests were using filenames
that are actually illegal on Windows, rather than just
nonexistant.


Change the exception handling for commands so that
unknown errors don't get silently squashed and then
turn into hard-to-debug errors later.

test_script now passes on Windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
61
68
 
62
69
cdef class Decoder:
63
70
    """Bencode decoder"""
261
268
        self.maxsize = maxsize
262
269
        self.tail = p
263
270
 
264
 
    def __dealloc__(self):
 
271
    def __del__(self):
265
272
        free(self.buffer)
266
273
        self.buffer = NULL
267
274
        self.maxsize = 0
371
378
                self._encode_int(x)
372
379
            elif PyLong_CheckExact(x):
373
380
                self._encode_long(x)
374
 
            elif PyList_CheckExact(x) or PyTuple_CheckExact(x):
 
381
            elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
 
382
                  or StaticTuple_CheckExact(x)):
375
383
                self._encode_list(x)
376
384
            elif PyDict_CheckExact(x):
377
385
                self._encode_dict(x)