~debian-bazaar/bzr/2.4

« back to all changes in this revision

Viewing changes to bzrlib/_bencode_pyx.c

  • Committer: Jelmer Vernooij
  • Date: 2011-08-13 21:53:50 UTC
  • mfrom: (3815.2547.116 upstream)
  • Revision ID: jelmer@samba.org-20110813215350-7frai9mod24c1te1
* New upstream release.
 + Suggest python-gpgme and build-depend on python-gpgme-dbg for new
   signatures features.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Generated by Pyrex 0.9.8.5 on Fri Oct  8 14:00:55 2010 */
 
1
/* Generated by Cython 0.13 on Thu Aug 11 09:45:14 2011 */
2
2
 
3
3
#define PY_SSIZE_T_CLEAN
4
4
#include "Python.h"
5
 
#include "structmember.h"
 
5
#ifndef Py_PYTHON_H
 
6
    #error Python headers needed to compile C extensions, please install development version of Python.
 
7
#else
 
8
 
 
9
#include <stddef.h> /* For offsetof */
 
10
#ifndef offsetof
 
11
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 
12
#endif
 
13
 
 
14
#if !defined(WIN32) && !defined(MS_WINDOWS)
 
15
  #ifndef __stdcall
 
16
    #define __stdcall
 
17
  #endif
 
18
  #ifndef __cdecl
 
19
    #define __cdecl
 
20
  #endif
 
21
  #ifndef __fastcall
 
22
    #define __fastcall
 
23
  #endif
 
24
#endif
 
25
 
 
26
#ifndef DL_IMPORT
 
27
  #define DL_IMPORT(t) t
 
28
#endif
 
29
#ifndef DL_EXPORT
 
30
  #define DL_EXPORT(t) t
 
31
#endif
 
32
 
6
33
#ifndef PY_LONG_LONG
7
34
  #define PY_LONG_LONG LONG_LONG
8
35
#endif
 
36
 
 
37
#if PY_VERSION_HEX < 0x02040000
 
38
  #define METH_COEXIST 0
 
39
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
 
40
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
 
41
#endif
 
42
 
9
43
#if PY_VERSION_HEX < 0x02050000
10
44
  typedef int Py_ssize_t;
11
45
  #define PY_SSIZE_T_MAX INT_MAX
12
46
  #define PY_SSIZE_T_MIN INT_MIN
 
47
  #define PY_FORMAT_SIZE_T ""
13
48
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
14
 
  #define PyInt_AsSsize_t(o)    PyInt_AsLong(o)
15
 
#endif
16
 
#if !defined(WIN32) && !defined(MS_WINDOWS)
17
 
  #ifndef __stdcall
18
 
    #define __stdcall
19
 
  #endif
20
 
  #ifndef __cdecl
21
 
    #define __cdecl
22
 
  #endif
23
 
#endif
 
49
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
 
50
  #define PyNumber_Index(o)    PyNumber_Int(o)
 
51
  #define PyIndex_Check(o)     PyNumber_Check(o)
 
52
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
 
53
#endif
 
54
 
 
55
#if PY_VERSION_HEX < 0x02060000
 
56
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
 
57
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
 
58
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
 
59
  #define PyVarObject_HEAD_INIT(type, size) \
 
60
          PyObject_HEAD_INIT(type) size,
 
61
  #define PyType_Modified(t)
 
62
 
 
63
  typedef struct {
 
64
     void *buf;
 
65
     PyObject *obj;
 
66
     Py_ssize_t len;
 
67
     Py_ssize_t itemsize;
 
68
     int readonly;
 
69
     int ndim;
 
70
     char *format;
 
71
     Py_ssize_t *shape;
 
72
     Py_ssize_t *strides;
 
73
     Py_ssize_t *suboffsets;
 
74
     void *internal;
 
75
  } Py_buffer;
 
76
 
 
77
  #define PyBUF_SIMPLE 0
 
78
  #define PyBUF_WRITABLE 0x0001
 
79
  #define PyBUF_FORMAT 0x0004
 
80
  #define PyBUF_ND 0x0008
 
81
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
 
82
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
 
83
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
 
84
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
 
85
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
 
86
 
 
87
#endif
 
88
 
 
89
#if PY_MAJOR_VERSION < 3
 
90
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
 
91
#else
 
92
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
 
93
#endif
 
94
 
 
95
#if PY_MAJOR_VERSION >= 3
 
96
  #define Py_TPFLAGS_CHECKTYPES 0
 
97
  #define Py_TPFLAGS_HAVE_INDEX 0
 
98
#endif
 
99
 
 
100
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
 
101
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 
102
#endif
 
103
 
 
104
#if PY_MAJOR_VERSION >= 3
 
105
  #define PyBaseString_Type            PyUnicode_Type
 
106
  #define PyStringObject               PyUnicodeObject
 
107
  #define PyString_Type                PyUnicode_Type
 
108
  #define PyString_Check               PyUnicode_Check
 
109
  #define PyString_CheckExact          PyUnicode_CheckExact
 
110
#endif
 
111
 
 
112
#if PY_VERSION_HEX < 0x02060000
 
113
  #define PyBytesObject                PyStringObject
 
114
  #define PyBytes_Type                 PyString_Type
 
115
  #define PyBytes_Check                PyString_Check
 
116
  #define PyBytes_CheckExact           PyString_CheckExact
 
117
  #define PyBytes_FromString           PyString_FromString
 
118
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
 
119
  #define PyBytes_FromFormat           PyString_FromFormat
 
120
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
 
121
  #define PyBytes_AsString             PyString_AsString
 
122
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
 
123
  #define PyBytes_Size                 PyString_Size
 
124
  #define PyBytes_AS_STRING            PyString_AS_STRING
 
125
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
 
126
  #define PyBytes_Repr                 PyString_Repr
 
127
  #define PyBytes_Concat               PyString_Concat
 
128
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 
129
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
 
130
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
 
131
#endif
 
132
 
 
133
#ifndef PySet_CheckExact
 
134
#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
 
135
#endif
 
136
 
 
137
#if PY_MAJOR_VERSION >= 3
 
138
  #define PyInt_Type                   PyLong_Type
 
139
  #define PyInt_Check(op)              PyLong_Check(op)
 
140
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 
141
  #define PyInt_FromString             PyLong_FromString
 
142
  #define PyInt_FromUnicode            PyLong_FromUnicode
 
143
  #define PyInt_FromLong               PyLong_FromLong
 
144
  #define PyInt_FromSize_t             PyLong_FromSize_t
 
145
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
 
146
  #define PyInt_AsLong                 PyLong_AsLong
 
147
  #define PyInt_AS_LONG                PyLong_AS_LONG
 
148
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
 
149
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
 
150
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 
151
#endif
 
152
 
 
153
#if PY_MAJOR_VERSION >= 3
 
154
  #define PyBoolObject PyLongObject
 
155
#endif
 
156
 
 
157
 
 
158
#if PY_MAJOR_VERSION >= 3
 
159
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
 
160
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
 
161
#else
 
162
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
 
163
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
 
164
#endif
 
165
 
 
166
#if PY_MAJOR_VERSION >= 3
 
167
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 
168
#endif
 
169
 
 
170
#if PY_VERSION_HEX < 0x02050000
 
171
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
 
172
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
 
173
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
 
174
#else
 
175
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
 
176
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
 
177
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 
178
#endif
 
179
 
 
180
#if PY_VERSION_HEX < 0x02050000
 
181
  #define __Pyx_NAMESTR(n) ((char *)(n))
 
182
  #define __Pyx_DOCSTR(n)  ((char *)(n))
 
183
#else
 
184
  #define __Pyx_NAMESTR(n) (n)
 
185
  #define __Pyx_DOCSTR(n)  (n)
 
186
#endif
 
187
 
24
188
#ifdef __cplusplus
25
189
#define __PYX_EXTERN_C extern "C"
26
190
#else
27
191
#define __PYX_EXTERN_C extern
28
192
#endif
 
193
 
 
194
#if defined(WIN32) || defined(MS_WINDOWS)
 
195
#define _USE_MATH_DEFINES
 
196
#endif
29
197
#include <math.h>
 
198
#define __PYX_HAVE_API__bzrlib___bencode_pyx
30
199
#include "stddef.h"
31
200
#include "stdlib.h"
32
201
#include "string.h"
34
203
#include "_bencode_pyx.h"
35
204
#include "_static_tuple_c.h"
36
205
 
37
 
 
38
 
typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
39
 
 
 
206
/* inline attribute */
 
207
#ifndef CYTHON_INLINE
 
208
  #if defined(__GNUC__)
 
209
    #define CYTHON_INLINE __inline__
 
210
  #elif defined(_MSC_VER)
 
211
    #define CYTHON_INLINE __inline
 
212
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
213
    #define CYTHON_INLINE inline
 
214
  #else
 
215
    #define CYTHON_INLINE 
 
216
  #endif
 
217
#endif
 
218
 
 
219
/* unused attribute */
 
220
#ifndef CYTHON_UNUSED
 
221
# if defined(__GNUC__)
 
222
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
 
223
#     define CYTHON_UNUSED __attribute__ ((__unused__)) 
 
224
#   else
 
225
#     define CYTHON_UNUSED
 
226
#   endif
 
227
# elif defined(__ICC) || defined(__INTEL_COMPILER)
 
228
#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
 
229
# else
 
230
#   define CYTHON_UNUSED 
 
231
# endif
 
232
#endif
 
233
 
 
234
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
 
235
 
 
236
 
 
237
/* Type Conversion Predeclarations */
 
238
 
 
239
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
 
240
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
 
241
 
 
242
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 
243
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 
244
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
 
245
 
 
246
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 
247
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 
248
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
249
 
 
250
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 
251
 
 
252
 
 
253
#ifdef __GNUC__
 
254
/* Test for GCC > 2.95 */
 
255
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
 
256
#define likely(x)   __builtin_expect(!!(x), 1)
 
257
#define unlikely(x) __builtin_expect(!!(x), 0)
 
258
#else /* __GNUC__ > 2 ... */
 
259
#define likely(x)   (x)
 
260
#define unlikely(x) (x)
 
261
#endif /* __GNUC__ > 2 ... */
 
262
#else /* __GNUC__ */
 
263
#define likely(x)   (x)
 
264
#define unlikely(x) (x)
 
265
#endif /* __GNUC__ */
 
266
    
40
267
static PyObject *__pyx_m;
41
268
static PyObject *__pyx_b;
 
269
static PyObject *__pyx_empty_tuple;
 
270
static PyObject *__pyx_empty_bytes;
42
271
static int __pyx_lineno;
43
 
static char *__pyx_filename;
44
 
static char **__pyx_f;
45
 
 
46
 
static char __pyx_mdoc[] = "Pyrex implementation for bencode coder/decoder";
47
 
 
48
 
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
49
 
 
50
 
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
51
 
 
52
 
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
53
 
 
54
 
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
55
 
 
56
 
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
57
 
 
58
 
static PyObject *__Pyx_ImportModule(char *name); /*proto*/
59
 
 
60
 
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
61
 
 
62
 
static void __Pyx_AddTraceback(char *funcname); /*proto*/
63
 
 
64
 
/* Declarations from bzrlib._static_tuple_c */
65
 
 
66
 
static PyTypeObject *__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = 0;
67
 
 
68
 
/* Declarations from bzrlib._bencode_pyx */
69
 
 
70
 
 
71
 
/* Declarations from implementation of bzrlib._bencode_pyx */
 
272
static int __pyx_clineno = 0;
 
273
static const char * __pyx_cfilenm= __FILE__;
 
274
static const char *__pyx_filename;
 
275
 
 
276
 
 
277
static const char *__pyx_f[] = {
 
278
  "_bencode_pyx.pyx",
 
279
  "_static_tuple_c.pxd",
 
280
};
 
281
 
 
282
/* Type declarations */
 
283
 
 
284
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":240
 
285
 * 
 
286
 * 
 
287
 * cdef enum:             # <<<<<<<<<<<<<<
 
288
 *     INITSIZE = 1024     # initial size for encoder buffer
 
289
 *     INT_BUF_SIZE = 32
 
290
 */
 
291
 
 
292
enum  {
 
293
  __pyx_e_6bzrlib_12_bencode_pyx_INITSIZE = 1024,
 
294
  __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE = 32
 
295
};
 
296
 
 
297
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":54
 
298
 *     int snprintf(char* buffer, size_t nsize, char* fmt, ...)
 
299
 * 
 
300
 * cdef class Decoder             # <<<<<<<<<<<<<<
 
301
 * cdef class Encoder
 
302
 * 
 
303
 */
72
304
 
73
305
struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder {
74
306
  PyObject_HEAD
79
311
  PyObject *text;
80
312
};
81
313
 
82
 
enum  {
83
 
  __pyx_e_6bzrlib_12_bencode_pyx_INITSIZE = 1024,
84
 
  __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE = 32
85
 
};
 
314
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":55
 
315
 * 
 
316
 * cdef class Decoder
 
317
 * cdef class Encoder             # <<<<<<<<<<<<<<
 
318
 * 
 
319
 * cdef extern from "_bencode_pyx.h":
 
320
 */
86
321
 
87
322
struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder {
88
323
  PyObject_HEAD
94
329
};
95
330
 
96
331
 
 
332
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":245
 
333
 * 
 
334
 * 
 
335
 * cdef class Encoder:             # <<<<<<<<<<<<<<
 
336
 *     """Bencode encoder"""
 
337
 * 
 
338
 */
 
339
 
 
340
struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder {
 
341
  int (*_ensure_buffer)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, int);
 
342
  int (*_encode_int)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, int);
 
343
  int (*_encode_long)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *);
 
344
  int (*_append_string)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *);
 
345
  int (*_encode_string)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *);
 
346
  int (*_encode_list)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *);
 
347
  int (*_encode_dict)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *);
 
348
};
 
349
static struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *__pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder;
 
350
 
 
351
 
 
352
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":69
 
353
 * 
 
354
 * 
 
355
 * cdef class Decoder:             # <<<<<<<<<<<<<<
 
356
 *     """Bencode decoder"""
 
357
 * 
 
358
 */
 
359
 
97
360
struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder {
98
361
  PyObject *(*_decode_object)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *);
99
 
  int (*_read_digits)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *,char);
 
362
  int (*_read_digits)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *, char);
100
363
  PyObject *(*_decode_int)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *);
101
364
  PyObject *(*_decode_string)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *);
102
365
  PyObject *(*_decode_list)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *);
104
367
};
105
368
static struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *__pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder;
106
369
 
107
 
 
108
 
struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder {
109
 
  int (*_ensure_buffer)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,int);
110
 
  int (*_encode_int)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,int);
111
 
  int (*_encode_long)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,PyObject *);
112
 
  int (*_append_string)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,PyObject *);
113
 
  int (*_encode_string)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,PyObject *);
114
 
  int (*_encode_list)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,PyObject *);
115
 
  int (*_encode_dict)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *,PyObject *);
116
 
};
117
 
static struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *__pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder;
 
370
#ifndef CYTHON_REFNANNY
 
371
  #define CYTHON_REFNANNY 0
 
372
#endif
 
373
 
 
374
#if CYTHON_REFNANNY
 
375
  typedef struct {
 
376
    void (*INCREF)(void*, PyObject*, int);
 
377
    void (*DECREF)(void*, PyObject*, int);
 
378
    void (*GOTREF)(void*, PyObject*, int);
 
379
    void (*GIVEREF)(void*, PyObject*, int);
 
380
    void* (*SetupContext)(const char*, int, const char*);
 
381
    void (*FinishContext)(void**);
 
382
  } __Pyx_RefNannyAPIStruct;
 
383
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
 
384
  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
 
385
    PyObject *m = NULL, *p = NULL;
 
386
    void *r = NULL;
 
387
    m = PyImport_ImportModule((char *)modname);
 
388
    if (!m) goto end;
 
389
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
 
390
    if (!p) goto end;
 
391
    r = PyLong_AsVoidPtr(p);
 
392
  end:
 
393
    Py_XDECREF(p);
 
394
    Py_XDECREF(m);
 
395
    return (__Pyx_RefNannyAPIStruct *)r;
 
396
  }
 
397
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
 
398
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
 
399
  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
 
400
  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
 
401
  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
 
402
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
 
403
  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
 
404
#else
 
405
  #define __Pyx_RefNannySetupContext(name)
 
406
  #define __Pyx_RefNannyFinishContext()
 
407
  #define __Pyx_INCREF(r) Py_INCREF(r)
 
408
  #define __Pyx_DECREF(r) Py_DECREF(r)
 
409
  #define __Pyx_GOTREF(r)
 
410
  #define __Pyx_GIVEREF(r)
 
411
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
 
412
#endif /* CYTHON_REFNANNY */
 
413
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
 
414
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
 
415
 
 
416
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
417
 
 
418
static void __Pyx_RaiseDoubleKeywordsError(
 
419
    const char* func_name, PyObject* kw_name); /*proto*/
 
420
 
 
421
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
 
422
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
423
 
 
424
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
425
 
 
426
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
427
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
428
 
 
429
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/
 
430
 
 
431
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
432
 
 
433
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
434
 
 
435
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
 
436
 
 
437
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
 
438
 
 
439
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
 
440
 
 
441
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
 
442
 
 
443
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
 
444
 
 
445
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
 
446
 
 
447
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
 
448
 
 
449
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
 
450
 
 
451
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
 
452
 
 
453
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
 
454
 
 
455
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
 
456
 
 
457
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
 
458
 
 
459
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
 
460
 
 
461
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
462
 
 
463
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
464
 
 
465
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
466
 
 
467
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict);  /*proto*/
 
468
 
 
469
static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
470
 
 
471
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
 
472
 
 
473
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
474
/* Module declarations from bzrlib._static_tuple_c */
 
475
 
 
476
/* Module declarations from bzrlib._static_tuple_c */
 
477
 
 
478
static PyTypeObject *__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = 0;
 
479
/* Module declarations from bzrlib._bencode_pyx */
118
480
 
119
481
static PyTypeObject *__pyx_ptype_6bzrlib_12_bencode_pyx_Decoder = 0;
120
482
static PyTypeObject *__pyx_ptype_6bzrlib_12_bencode_pyx_Encoder = 0;
121
 
 
122
 
static char __pyx_k1[] = "String required";
123
 
static char __pyx_k2[] = "junk in stream";
124
 
static char __pyx_k3[] = "stream underflow";
125
 
static char __pyx_k4[] = "_decode_object";
126
 
static char __pyx_k5[] = "too deeply nested";
127
 
static char __pyx_k6[] = "unknown object type identifier %r";
128
 
static char __pyx_k7[] = "Stop character %c not found: %c";
129
 
static char __pyx_k8[] = "string len not terminated by \":\"";
130
 
static char __pyx_k9[] = "leading zeros are not allowed";
131
 
static char __pyx_k10[] = "";
132
 
static char __pyx_k11[] = "string size below zero: %d";
133
 
static char __pyx_k12[] = "malformed list";
134
 
static char __pyx_k13[] = "key was not a simple string.";
135
 
static char __pyx_k14[] = "dict keys disordered";
136
 
static char __pyx_k15[] = "malformed dict";
137
 
static char __pyx_k16[] = "decode";
138
 
static char __pyx_k17[] = "bencoded";
139
 
static char __pyx_k18[] = "Not enough memory to allocate buffer for encoder";
140
 
static char __pyx_k19[] = "Cannot realloc buffer for encoder";
141
 
static char __pyx_k20[] = "i%de";
142
 
static char __pyx_k21[] = "int %d too big to encode";
143
 
static char __pyx_k22[] = "join";
144
 
static char __pyx_k23[] = "i";
145
 
static char __pyx_k24[] = "e";
146
 
static char __pyx_k25[] = "%d:";
147
 
static char __pyx_k26[] = "string %s too big to encode";
148
 
static char __pyx_k27[] = "process";
149
 
static char __pyx_k28[] = "keys";
150
 
static char __pyx_k29[] = "sort";
151
 
static char __pyx_k30[] = "key in dict should be string";
152
 
static char __pyx_k31[] = "encode";
153
 
static char __pyx_k32[] = "Bencached";
154
 
static char __pyx_k33[] = "unsupported type %r";
155
 
static char __pyx_k34[] = "object";
156
 
static char __pyx_k35[] = "__slots__";
157
 
static char __pyx_k36[] = "__init__";
158
 
 
159
 
static PyObject *__pyx_n_Bencached;
160
 
static PyObject *__pyx_n___init__;
161
 
static PyObject *__pyx_n___slots__;
162
 
static PyObject *__pyx_n_bencoded;
163
 
static PyObject *__pyx_n_decode;
164
 
static PyObject *__pyx_n_e;
165
 
static PyObject *__pyx_n_i;
166
 
static PyObject *__pyx_n_join;
167
 
static PyObject *__pyx_n_keys;
168
 
static PyObject *__pyx_n_object;
169
 
static PyObject *__pyx_n_process;
170
 
static PyObject *__pyx_n_sort;
171
 
 
172
 
static PyObject *__pyx_k1p;
173
 
static PyObject *__pyx_k2p;
174
 
static PyObject *__pyx_k3p;
175
 
static PyObject *__pyx_k5p;
176
 
static PyObject *__pyx_k6p;
177
 
static PyObject *__pyx_k7p;
178
 
static PyObject *__pyx_k8p;
179
 
static PyObject *__pyx_k9p;
180
 
static PyObject *__pyx_k10p;
181
 
static PyObject *__pyx_k11p;
182
 
static PyObject *__pyx_k12p;
183
 
static PyObject *__pyx_k13p;
184
 
static PyObject *__pyx_k14p;
185
 
static PyObject *__pyx_k15p;
186
 
static PyObject *__pyx_k18p;
187
 
static PyObject *__pyx_k19p;
188
 
static PyObject *__pyx_k21p;
189
 
static PyObject *__pyx_k26p;
190
 
static PyObject *__pyx_k30p;
191
 
static PyObject *__pyx_k33p;
192
 
 
193
 
static __Pyx_StringTabEntry __pyx_string_tab[] = {
194
 
  {&__pyx_n_Bencached, 1, __pyx_k32, sizeof(__pyx_k32)},
195
 
  {&__pyx_n___init__, 1, __pyx_k36, sizeof(__pyx_k36)},
196
 
  {&__pyx_n___slots__, 1, __pyx_k35, sizeof(__pyx_k35)},
197
 
  {&__pyx_n_bencoded, 1, __pyx_k17, sizeof(__pyx_k17)},
198
 
  {&__pyx_n_decode, 1, __pyx_k16, sizeof(__pyx_k16)},
199
 
  {&__pyx_n_e, 1, __pyx_k24, sizeof(__pyx_k24)},
200
 
  {&__pyx_n_i, 1, __pyx_k23, sizeof(__pyx_k23)},
201
 
  {&__pyx_n_join, 1, __pyx_k22, sizeof(__pyx_k22)},
202
 
  {&__pyx_n_keys, 1, __pyx_k28, sizeof(__pyx_k28)},
203
 
  {&__pyx_n_object, 1, __pyx_k34, sizeof(__pyx_k34)},
204
 
  {&__pyx_n_process, 1, __pyx_k27, sizeof(__pyx_k27)},
205
 
  {&__pyx_n_sort, 1, __pyx_k29, sizeof(__pyx_k29)},
206
 
  {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
207
 
  {&__pyx_k2p, 0, __pyx_k2, sizeof(__pyx_k2)},
208
 
  {&__pyx_k3p, 0, __pyx_k3, sizeof(__pyx_k3)},
209
 
  {&__pyx_k5p, 0, __pyx_k5, sizeof(__pyx_k5)},
210
 
  {&__pyx_k6p, 0, __pyx_k6, sizeof(__pyx_k6)},
211
 
  {&__pyx_k7p, 0, __pyx_k7, sizeof(__pyx_k7)},
212
 
  {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
213
 
  {&__pyx_k9p, 0, __pyx_k9, sizeof(__pyx_k9)},
214
 
  {&__pyx_k10p, 0, __pyx_k10, sizeof(__pyx_k10)},
215
 
  {&__pyx_k11p, 0, __pyx_k11, sizeof(__pyx_k11)},
216
 
  {&__pyx_k12p, 0, __pyx_k12, sizeof(__pyx_k12)},
217
 
  {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
218
 
  {&__pyx_k14p, 0, __pyx_k14, sizeof(__pyx_k14)},
219
 
  {&__pyx_k15p, 0, __pyx_k15, sizeof(__pyx_k15)},
220
 
  {&__pyx_k18p, 0, __pyx_k18, sizeof(__pyx_k18)},
221
 
  {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
222
 
  {&__pyx_k21p, 0, __pyx_k21, sizeof(__pyx_k21)},
223
 
  {&__pyx_k26p, 0, __pyx_k26, sizeof(__pyx_k26)},
224
 
  {&__pyx_k30p, 0, __pyx_k30, sizeof(__pyx_k30)},
225
 
  {&__pyx_k33p, 0, __pyx_k33, sizeof(__pyx_k33)},
226
 
  {0, 0, 0, 0}
227
 
};
228
 
 
229
 
static PyObject *__pyx_d1;
230
 
static int __pyx_d2;
231
 
 
 
483
#define __Pyx_MODULE_NAME "bzrlib._bencode_pyx"
 
484
int __pyx_module_is_main_bzrlib___bencode_pyx = 0;
232
485
 
233
486
/* Implementation of bzrlib._bencode_pyx */
234
 
 
235
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Decoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
236
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Decoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
487
static PyObject *__pyx_builtin_object;
 
488
static PyObject *__pyx_builtin_TypeError;
 
489
static PyObject *__pyx_builtin_ValueError;
 
490
static PyObject *__pyx_builtin_RuntimeError;
 
491
static PyObject *__pyx_builtin_MemoryError;
 
492
static char __pyx_k_1[] = "String required";
 
493
static char __pyx_k_2[] = "junk in stream";
 
494
static char __pyx_k_3[] = "stream underflow";
 
495
static char __pyx_k_4[] = "too deeply nested";
 
496
static char __pyx_k_5[] = "unknown object type identifier %r";
 
497
static char __pyx_k_6[] = "Stop character %c not found: %c";
 
498
static char __pyx_k_7[] = "string len not terminated by \":\"";
 
499
static char __pyx_k_8[] = "leading zeros are not allowed";
 
500
static char __pyx_k_9[] = "";
 
501
static char __pyx_k_10[] = "string size below zero: %d";
 
502
static char __pyx_k_11[] = "malformed list";
 
503
static char __pyx_k_12[] = "key was not a simple string.";
 
504
static char __pyx_k_13[] = "dict keys disordered";
 
505
static char __pyx_k_14[] = "malformed dict";
 
506
static char __pyx_k_16[] = "Not enough memory to allocate buffer for encoder";
 
507
static char __pyx_k_17[] = "Cannot realloc buffer for encoder";
 
508
static char __pyx_k_18[] = "i%de";
 
509
static char __pyx_k_19[] = "int %d too big to encode";
 
510
static char __pyx_k_20[] = "%d:";
 
511
static char __pyx_k_21[] = "string %s too big to encode";
 
512
static char __pyx_k_22[] = "key in dict should be string";
 
513
static char __pyx_k_23[] = "unsupported type %r";
 
514
static char __pyx_k_24[] = "Pyrex implementation for bencode coder/decoder";
 
515
static char __pyx_k_25[] = "Decoder.__init__ (line 77)";
 
516
static char __pyx_k_26[] = "bdecode (line 223)";
 
517
static char __pyx_k_27[] = "bdecode_as_tuple (line 228)";
 
518
static char __pyx_k_28[] = "Encoder.__init__ (line 253)";
 
519
static char __pyx_k_29[] = "bencode (line 396)";
 
520
static char __pyx_k__e[] = "e";
 
521
static char __pyx_k__i[] = "i";
 
522
static char __pyx_k__s[] = "s";
 
523
static char __pyx_k__join[] = "join";
 
524
static char __pyx_k__keys[] = "keys";
 
525
static char __pyx_k__self[] = "self";
 
526
static char __pyx_k__size[] = "size";
 
527
static char __pyx_k__sort[] = "sort";
 
528
static char __pyx_k__tail[] = "tail";
 
529
static char __pyx_k__text[] = "text";
 
530
static char __pyx_k__buffer[] = "buffer";
 
531
static char __pyx_k__decode[] = "decode";
 
532
static char __pyx_k__encode[] = "encode";
 
533
static char __pyx_k__object[] = "object";
 
534
static char __pyx_k__Decoder[] = "Decoder";
 
535
static char __pyx_k__Encoder[] = "Encoder";
 
536
static char __pyx_k__bdecode[] = "bdecode";
 
537
static char __pyx_k__bencode[] = "bencode";
 
538
static char __pyx_k__maxsize[] = "maxsize";
 
539
static char __pyx_k__process[] = "process";
 
540
static char __pyx_k____init__[] = "__init__";
 
541
static char __pyx_k____main__[] = "__main__";
 
542
static char __pyx_k____test__[] = "__test__";
 
543
static char __pyx_k__bencoded[] = "bencoded";
 
544
static char __pyx_k__Bencached[] = "Bencached";
 
545
static char __pyx_k__TypeError[] = "TypeError";
 
546
static char __pyx_k____slots__[] = "__slots__";
 
547
static char __pyx_k__ValueError[] = "ValueError";
 
548
static char __pyx_k__MemoryError[] = "MemoryError";
 
549
static char __pyx_k___decode_int[] = "_decode_int";
 
550
static char __pyx_k___encode_int[] = "_encode_int";
 
551
static char __pyx_k__RuntimeError[] = "RuntimeError";
 
552
static char __pyx_k___decode_dict[] = "_decode_dict";
 
553
static char __pyx_k___decode_list[] = "_decode_list";
 
554
static char __pyx_k___encode_dict[] = "_encode_dict";
 
555
static char __pyx_k___encode_list[] = "_encode_list";
 
556
static char __pyx_k___encode_long[] = "_encode_long";
 
557
static char __pyx_k___read_digits[] = "_read_digits";
 
558
static char __pyx_k__yield_tuples[] = "yield_tuples";
 
559
static char __pyx_k___yield_tuples[] = "_yield_tuples";
 
560
static char __pyx_k___append_string[] = "_append_string";
 
561
static char __pyx_k___decode_object[] = "_decode_object";
 
562
static char __pyx_k___decode_string[] = "_decode_string";
 
563
static char __pyx_k___encode_string[] = "_encode_string";
 
564
static char __pyx_k___ensure_buffer[] = "_ensure_buffer";
 
565
static char __pyx_k__bdecode_as_tuple[] = "bdecode_as_tuple";
 
566
static PyObject *__pyx_kp_s_1;
 
567
static PyObject *__pyx_kp_s_10;
 
568
static PyObject *__pyx_kp_s_11;
 
569
static PyObject *__pyx_kp_s_12;
 
570
static PyObject *__pyx_kp_s_13;
 
571
static PyObject *__pyx_kp_s_14;
 
572
static PyObject *__pyx_kp_s_16;
 
573
static PyObject *__pyx_kp_s_17;
 
574
static PyObject *__pyx_kp_s_19;
 
575
static PyObject *__pyx_kp_s_2;
 
576
static PyObject *__pyx_kp_s_21;
 
577
static PyObject *__pyx_kp_s_22;
 
578
static PyObject *__pyx_kp_s_23;
 
579
static PyObject *__pyx_kp_u_25;
 
580
static PyObject *__pyx_kp_u_26;
 
581
static PyObject *__pyx_kp_u_27;
 
582
static PyObject *__pyx_kp_u_28;
 
583
static PyObject *__pyx_kp_u_29;
 
584
static PyObject *__pyx_kp_s_3;
 
585
static PyObject *__pyx_kp_s_4;
 
586
static PyObject *__pyx_kp_s_5;
 
587
static PyObject *__pyx_kp_s_6;
 
588
static PyObject *__pyx_kp_s_7;
 
589
static PyObject *__pyx_kp_s_8;
 
590
static PyObject *__pyx_kp_s_9;
 
591
static PyObject *__pyx_n_s__Bencached;
 
592
static PyObject *__pyx_n_s__Decoder;
 
593
static PyObject *__pyx_n_s__Encoder;
 
594
static PyObject *__pyx_n_s__MemoryError;
 
595
static PyObject *__pyx_n_s__RuntimeError;
 
596
static PyObject *__pyx_n_s__TypeError;
 
597
static PyObject *__pyx_n_s__ValueError;
 
598
static PyObject *__pyx_n_s____init__;
 
599
static PyObject *__pyx_n_s____main__;
 
600
static PyObject *__pyx_n_s____slots__;
 
601
static PyObject *__pyx_n_s____test__;
 
602
static PyObject *__pyx_n_s___append_string;
 
603
static PyObject *__pyx_n_s___decode_dict;
 
604
static PyObject *__pyx_n_s___decode_int;
 
605
static PyObject *__pyx_n_s___decode_list;
 
606
static PyObject *__pyx_n_s___decode_object;
 
607
static PyObject *__pyx_n_s___decode_string;
 
608
static PyObject *__pyx_n_s___encode_dict;
 
609
static PyObject *__pyx_n_s___encode_int;
 
610
static PyObject *__pyx_n_s___encode_list;
 
611
static PyObject *__pyx_n_s___encode_long;
 
612
static PyObject *__pyx_n_s___encode_string;
 
613
static PyObject *__pyx_n_s___ensure_buffer;
 
614
static PyObject *__pyx_n_s___read_digits;
 
615
static PyObject *__pyx_n_s___yield_tuples;
 
616
static PyObject *__pyx_n_s__bdecode;
 
617
static PyObject *__pyx_n_s__bdecode_as_tuple;
 
618
static PyObject *__pyx_n_s__bencode;
 
619
static PyObject *__pyx_n_s__bencoded;
 
620
static PyObject *__pyx_n_s__buffer;
 
621
static PyObject *__pyx_n_s__decode;
 
622
static PyObject *__pyx_n_s__e;
 
623
static PyObject *__pyx_n_s__i;
 
624
static PyObject *__pyx_n_s__join;
 
625
static PyObject *__pyx_n_s__keys;
 
626
static PyObject *__pyx_n_s__maxsize;
 
627
static PyObject *__pyx_n_s__object;
 
628
static PyObject *__pyx_n_s__process;
 
629
static PyObject *__pyx_n_s__s;
 
630
static PyObject *__pyx_n_s__self;
 
631
static PyObject *__pyx_n_s__size;
 
632
static PyObject *__pyx_n_s__sort;
 
633
static PyObject *__pyx_n_s__tail;
 
634
static PyObject *__pyx_n_s__text;
 
635
static PyObject *__pyx_n_s__yield_tuples;
 
636
static PyObject *__pyx_int_0;
 
637
static int __pyx_k_15;
 
638
 
 
639
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":72
 
640
 *     """Bencode decoder"""
 
641
 * 
 
642
 *     cdef readonly char *tail             # <<<<<<<<<<<<<<
 
643
 *     cdef readonly int size
 
644
 *     cdef readonly int _yield_tuples
 
645
 */
 
646
 
 
647
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4tail___get__(PyObject *__pyx_v_self); /*proto*/
 
648
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4tail___get__(PyObject *__pyx_v_self) {
 
649
  PyObject *__pyx_r = NULL;
 
650
  PyObject *__pyx_t_1 = NULL;
 
651
  __Pyx_RefNannySetupContext("__get__");
 
652
  __Pyx_XDECREF(__pyx_r);
 
653
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
654
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
655
  __pyx_r = ((PyObject *)__pyx_t_1);
 
656
  __pyx_t_1 = 0;
 
657
  goto __pyx_L0;
 
658
 
 
659
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
660
  goto __pyx_L0;
 
661
  __pyx_L1_error:;
 
662
  __Pyx_XDECREF(__pyx_t_1);
 
663
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.tail.__get__");
 
664
  __pyx_r = NULL;
 
665
  __pyx_L0:;
 
666
  __Pyx_XGIVEREF(__pyx_r);
 
667
  __Pyx_RefNannyFinishContext();
 
668
  return __pyx_r;
 
669
}
 
670
 
 
671
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":73
 
672
 * 
 
673
 *     cdef readonly char *tail
 
674
 *     cdef readonly int size             # <<<<<<<<<<<<<<
 
675
 *     cdef readonly int _yield_tuples
 
676
 *     cdef object text
 
677
 */
 
678
 
 
679
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4size___get__(PyObject *__pyx_v_self); /*proto*/
 
680
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4size___get__(PyObject *__pyx_v_self) {
 
681
  PyObject *__pyx_r = NULL;
 
682
  PyObject *__pyx_t_1 = NULL;
 
683
  __Pyx_RefNannySetupContext("__get__");
 
684
  __Pyx_XDECREF(__pyx_r);
 
685
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
686
  __Pyx_GOTREF(__pyx_t_1);
 
687
  __pyx_r = __pyx_t_1;
 
688
  __pyx_t_1 = 0;
 
689
  goto __pyx_L0;
 
690
 
 
691
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
692
  goto __pyx_L0;
 
693
  __pyx_L1_error:;
 
694
  __Pyx_XDECREF(__pyx_t_1);
 
695
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.size.__get__");
 
696
  __pyx_r = NULL;
 
697
  __pyx_L0:;
 
698
  __Pyx_XGIVEREF(__pyx_r);
 
699
  __Pyx_RefNannyFinishContext();
 
700
  return __pyx_r;
 
701
}
 
702
 
 
703
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":74
 
704
 *     cdef readonly char *tail
 
705
 *     cdef readonly int size
 
706
 *     cdef readonly int _yield_tuples             # <<<<<<<<<<<<<<
 
707
 *     cdef object text
 
708
 * 
 
709
 */
 
710
 
 
711
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_13_yield_tuples___get__(PyObject *__pyx_v_self); /*proto*/
 
712
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_13_yield_tuples___get__(PyObject *__pyx_v_self) {
 
713
  PyObject *__pyx_r = NULL;
 
714
  PyObject *__pyx_t_1 = NULL;
 
715
  __Pyx_RefNannySetupContext("__get__");
 
716
  __Pyx_XDECREF(__pyx_r);
 
717
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->_yield_tuples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
718
  __Pyx_GOTREF(__pyx_t_1);
 
719
  __pyx_r = __pyx_t_1;
 
720
  __pyx_t_1 = 0;
 
721
  goto __pyx_L0;
 
722
 
 
723
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
724
  goto __pyx_L0;
 
725
  __pyx_L1_error:;
 
726
  __Pyx_XDECREF(__pyx_t_1);
 
727
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._yield_tuples.__get__");
 
728
  __pyx_r = NULL;
 
729
  __pyx_L0:;
 
730
  __Pyx_XGIVEREF(__pyx_r);
 
731
  __Pyx_RefNannyFinishContext();
 
732
  return __pyx_r;
 
733
}
 
734
 
 
735
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":77
 
736
 *     cdef object text
 
737
 * 
 
738
 *     def __init__(self, s, yield_tuples=0):             # <<<<<<<<<<<<<<
 
739
 *         """Initialize decoder engine.
 
740
 *         @param  s:  Python string.
 
741
 */
 
742
 
 
743
static int __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
744
static char __pyx_doc_6bzrlib_12_bencode_pyx_7Decoder___init__[] = "Initialize decoder engine.\n        @param  s:  Python string.\n        ";
 
745
struct wrapperbase __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Decoder___init__;
 
746
static int __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
237
747
  PyObject *__pyx_v_s = 0;
238
748
  PyObject *__pyx_v_yield_tuples = 0;
239
749
  int __pyx_r;
240
 
  int __pyx_1;
241
 
  PyObject *__pyx_2 = 0;
242
 
  PyObject *__pyx_3 = 0;
243
 
  char *__pyx_4;
244
 
  Py_ssize_t __pyx_5;
245
 
  static char *__pyx_argnames[] = {"s","yield_tuples",0};
246
 
  __pyx_v_yield_tuples = __pyx_d1;
247
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_s, &__pyx_v_yield_tuples)) return -1;
248
 
  Py_INCREF(__pyx_v_self);
249
 
  Py_INCREF(__pyx_v_s);
250
 
  Py_INCREF(__pyx_v_yield_tuples);
251
 
 
252
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":81 */
253
 
  __pyx_1 = (!PyString_CheckExact(__pyx_v_s));
254
 
  if (__pyx_1) {
255
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
256
 
    Py_INCREF(__pyx_k1p);
257
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k1p);
258
 
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
259
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
260
 
    __Pyx_Raise(__pyx_3, 0, 0);
261
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
262
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
263
 
    goto __pyx_L2;
264
 
  }
265
 
  __pyx_L2:;
266
 
 
267
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":84 */
268
 
  Py_INCREF(__pyx_v_s);
269
 
  Py_DECREF(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->text);
 
750
  int __pyx_t_1;
 
751
  PyObject *__pyx_t_2 = NULL;
 
752
  PyObject *__pyx_t_3 = NULL;
 
753
  char *__pyx_t_4;
 
754
  Py_ssize_t __pyx_t_5;
 
755
  int __pyx_t_6;
 
756
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__yield_tuples,0};
 
757
  __Pyx_RefNannySetupContext("__init__");
 
758
  if (unlikely(__pyx_kwds)) {
 
759
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
760
    PyObject* values[2] = {0,0};
 
761
    values[1] = ((PyObject *)__pyx_int_0);
 
762
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
763
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
764
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
765
      case  0: break;
 
766
      default: goto __pyx_L5_argtuple_error;
 
767
    }
 
768
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
769
      case  0:
 
770
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
 
771
      if (likely(values[0])) kw_args--;
 
772
      else goto __pyx_L5_argtuple_error;
 
773
      case  1:
 
774
      if (kw_args > 0) {
 
775
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yield_tuples);
 
776
        if (value) { values[1] = value; kw_args--; }
 
777
      }
 
778
    }
 
779
    if (unlikely(kw_args > 0)) {
 
780
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
781
    }
 
782
    __pyx_v_s = values[0];
 
783
    __pyx_v_yield_tuples = values[1];
 
784
  } else {
 
785
    __pyx_v_yield_tuples = ((PyObject *)__pyx_int_0);
 
786
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
787
      case  2: __pyx_v_yield_tuples = PyTuple_GET_ITEM(__pyx_args, 1);
 
788
      case  1: __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 0);
 
789
      break;
 
790
      default: goto __pyx_L5_argtuple_error;
 
791
    }
 
792
  }
 
793
  goto __pyx_L4_argument_unpacking_done;
 
794
  __pyx_L5_argtuple_error:;
 
795
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
796
  __pyx_L3_error:;
 
797
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.__init__");
 
798
  __Pyx_RefNannyFinishContext();
 
799
  return -1;
 
800
  __pyx_L4_argument_unpacking_done:;
 
801
 
 
802
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":81
 
803
 *         @param  s:  Python string.
 
804
 *         """
 
805
 *         if not PyString_CheckExact(s):             # <<<<<<<<<<<<<<
 
806
 *             raise TypeError("String required")
 
807
 * 
 
808
 */
 
809
  __pyx_t_1 = (!PyString_CheckExact(__pyx_v_s));
 
810
  if (__pyx_t_1) {
 
811
 
 
812
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":82
 
813
 *         """
 
814
 *         if not PyString_CheckExact(s):
 
815
 *             raise TypeError("String required")             # <<<<<<<<<<<<<<
 
816
 * 
 
817
 *         self.text = s
 
818
 */
 
819
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
820
    __Pyx_GOTREF(__pyx_t_2);
 
821
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
 
822
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1));
 
823
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
 
824
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
825
    __Pyx_GOTREF(__pyx_t_3);
 
826
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
827
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
828
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
829
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
830
    goto __pyx_L6;
 
831
  }
 
832
  __pyx_L6:;
 
833
 
 
834
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":84
 
835
 *             raise TypeError("String required")
 
836
 * 
 
837
 *         self.text = s             # <<<<<<<<<<<<<<
 
838
 *         self.tail = PyString_AS_STRING(s)
 
839
 *         self.size = PyString_GET_SIZE(s)
 
840
 */
 
841
  __Pyx_INCREF(__pyx_v_s);
 
842
  __Pyx_GIVEREF(__pyx_v_s);
 
843
  __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->text);
 
844
  __Pyx_DECREF(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->text);
270
845
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->text = __pyx_v_s;
271
846
 
272
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":85 */
273
 
  __pyx_4 = PyString_AS_STRING(__pyx_v_s); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
274
 
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->tail = __pyx_4;
275
 
 
276
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":86 */
277
 
  __pyx_5 = PyString_GET_SIZE(__pyx_v_s); if (__pyx_5 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
278
 
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->size = __pyx_5;
279
 
 
280
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":87 */
281
 
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
282
 
  Py_INCREF(__pyx_v_yield_tuples);
283
 
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_yield_tuples);
284
 
  __pyx_3 = PyObject_CallObject(((PyObject *)(&PyInt_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
285
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
286
 
  __pyx_1 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
287
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
288
 
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->_yield_tuples = __pyx_1;
 
847
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":85
 
848
 * 
 
849
 *         self.text = s
 
850
 *         self.tail = PyString_AS_STRING(s)             # <<<<<<<<<<<<<<
 
851
 *         self.size = PyString_GET_SIZE(s)
 
852
 *         self._yield_tuples = int(yield_tuples)
 
853
 */
 
854
  __pyx_t_4 = PyString_AS_STRING(__pyx_v_s); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
855
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->tail = __pyx_t_4;
 
856
 
 
857
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":86
 
858
 *         self.text = s
 
859
 *         self.tail = PyString_AS_STRING(s)
 
860
 *         self.size = PyString_GET_SIZE(s)             # <<<<<<<<<<<<<<
 
861
 *         self._yield_tuples = int(yield_tuples)
 
862
 * 
 
863
 */
 
864
  __pyx_t_5 = PyString_GET_SIZE(__pyx_v_s); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
865
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->size = __pyx_t_5;
 
866
 
 
867
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":87
 
868
 *         self.tail = PyString_AS_STRING(s)
 
869
 *         self.size = PyString_GET_SIZE(s)
 
870
 *         self._yield_tuples = int(yield_tuples)             # <<<<<<<<<<<<<<
 
871
 * 
 
872
 *     def decode(self):
 
873
 */
 
874
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
875
  __Pyx_GOTREF(__pyx_t_3);
 
876
  __Pyx_INCREF(__pyx_v_yield_tuples);
 
877
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_yield_tuples);
 
878
  __Pyx_GIVEREF(__pyx_v_yield_tuples);
 
879
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
880
  __Pyx_GOTREF(__pyx_t_2);
 
881
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
882
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
883
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
884
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->_yield_tuples = __pyx_t_6;
289
885
 
290
886
  __pyx_r = 0;
291
887
  goto __pyx_L0;
292
 
  __pyx_L1:;
293
 
  Py_XDECREF(__pyx_2);
294
 
  Py_XDECREF(__pyx_3);
 
888
  __pyx_L1_error:;
 
889
  __Pyx_XDECREF(__pyx_t_2);
 
890
  __Pyx_XDECREF(__pyx_t_3);
295
891
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.__init__");
296
892
  __pyx_r = -1;
297
893
  __pyx_L0:;
298
 
  Py_DECREF(__pyx_v_self);
299
 
  Py_DECREF(__pyx_v_s);
300
 
  Py_DECREF(__pyx_v_yield_tuples);
 
894
  __Pyx_RefNannyFinishContext();
301
895
  return __pyx_r;
302
896
}
303
897
 
304
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
305
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
898
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":89
 
899
 *         self._yield_tuples = int(yield_tuples)
 
900
 * 
 
901
 *     def decode(self):             # <<<<<<<<<<<<<<
 
902
 *         result = self._decode_object()
 
903
 *         if self.size != 0:
 
904
 */
 
905
 
 
906
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
 
907
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
306
908
  PyObject *__pyx_v_result;
307
 
  PyObject *__pyx_r;
308
 
  PyObject *__pyx_1 = 0;
309
 
  int __pyx_2;
310
 
  PyObject *__pyx_3 = 0;
311
 
  static char *__pyx_argnames[] = {0};
312
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
313
 
  Py_INCREF(__pyx_v_self);
314
 
  __pyx_v_result = Py_None; Py_INCREF(Py_None);
315
 
 
316
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":90 */
317
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->__pyx_vtab)->_decode_object(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
318
 
  Py_DECREF(__pyx_v_result);
319
 
  __pyx_v_result = __pyx_1;
320
 
  __pyx_1 = 0;
321
 
 
322
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":91 */
323
 
  __pyx_2 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->size != 0);
324
 
  if (__pyx_2) {
325
 
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
326
 
    Py_INCREF(__pyx_k2p);
327
 
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k2p);
328
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
329
 
    Py_DECREF(__pyx_1); __pyx_1 = 0;
330
 
    __Pyx_Raise(__pyx_3, 0, 0);
331
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
332
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
333
 
    goto __pyx_L2;
 
909
  PyObject *__pyx_r = NULL;
 
910
  PyObject *__pyx_t_1 = NULL;
 
911
  int __pyx_t_2;
 
912
  PyObject *__pyx_t_3 = NULL;
 
913
  __Pyx_RefNannySetupContext("decode");
 
914
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
 
915
 
 
916
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":90
 
917
 * 
 
918
 *     def decode(self):
 
919
 *         result = self._decode_object()             # <<<<<<<<<<<<<<
 
920
 *         if self.size != 0:
 
921
 *             raise ValueError('junk in stream')
 
922
 */
 
923
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->__pyx_vtab)->_decode_object(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
924
  __Pyx_GOTREF(__pyx_t_1);
 
925
  __Pyx_DECREF(__pyx_v_result);
 
926
  __pyx_v_result = __pyx_t_1;
 
927
  __pyx_t_1 = 0;
 
928
 
 
929
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":91
 
930
 *     def decode(self):
 
931
 *         result = self._decode_object()
 
932
 *         if self.size != 0:             # <<<<<<<<<<<<<<
 
933
 *             raise ValueError('junk in stream')
 
934
 *         return result
 
935
 */
 
936
  __pyx_t_2 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->size != 0);
 
937
  if (__pyx_t_2) {
 
938
 
 
939
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":92
 
940
 *         result = self._decode_object()
 
941
 *         if self.size != 0:
 
942
 *             raise ValueError('junk in stream')             # <<<<<<<<<<<<<<
 
943
 *         return result
 
944
 * 
 
945
 */
 
946
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
947
    __Pyx_GOTREF(__pyx_t_1);
 
948
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
 
949
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2));
 
950
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
 
951
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
952
    __Pyx_GOTREF(__pyx_t_3);
 
953
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
954
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
955
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
956
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
957
    goto __pyx_L5;
334
958
  }
335
 
  __pyx_L2:;
 
959
  __pyx_L5:;
336
960
 
337
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":93 */
338
 
  Py_INCREF(__pyx_v_result);
 
961
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":93
 
962
 *         if self.size != 0:
 
963
 *             raise ValueError('junk in stream')
 
964
 *         return result             # <<<<<<<<<<<<<<
 
965
 * 
 
966
 *     def decode_object(self):
 
967
 */
 
968
  __Pyx_XDECREF(__pyx_r);
 
969
  __Pyx_INCREF(__pyx_v_result);
339
970
  __pyx_r = __pyx_v_result;
340
971
  goto __pyx_L0;
341
972
 
342
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
973
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
343
974
  goto __pyx_L0;
344
 
  __pyx_L1:;
345
 
  Py_XDECREF(__pyx_1);
346
 
  Py_XDECREF(__pyx_3);
 
975
  __pyx_L1_error:;
 
976
  __Pyx_XDECREF(__pyx_t_1);
 
977
  __Pyx_XDECREF(__pyx_t_3);
347
978
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.decode");
348
 
  __pyx_r = 0;
 
979
  __pyx_r = NULL;
349
980
  __pyx_L0:;
350
 
  Py_DECREF(__pyx_v_result);
351
 
  Py_DECREF(__pyx_v_self);
 
981
  __Pyx_DECREF(__pyx_v_result);
 
982
  __Pyx_XGIVEREF(__pyx_r);
 
983
  __Pyx_RefNannyFinishContext();
352
984
  return __pyx_r;
353
985
}
354
986
 
355
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode_object(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
356
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode_object(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
357
 
  PyObject *__pyx_r;
358
 
  PyObject *__pyx_1 = 0;
359
 
  static char *__pyx_argnames[] = {0};
360
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
361
 
  Py_INCREF(__pyx_v_self);
362
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->__pyx_vtab)->_decode_object(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
363
 
  __pyx_r = __pyx_1;
364
 
  __pyx_1 = 0;
365
 
  goto __pyx_L0;
366
 
 
367
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
368
 
  goto __pyx_L0;
369
 
  __pyx_L1:;
370
 
  Py_XDECREF(__pyx_1);
 
987
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":95
 
988
 *         return result
 
989
 * 
 
990
 *     def decode_object(self):             # <<<<<<<<<<<<<<
 
991
 *         return self._decode_object()
 
992
 * 
 
993
 */
 
994
 
 
995
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode_object(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
 
996
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode_object(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
 
997
  PyObject *__pyx_r = NULL;
 
998
  PyObject *__pyx_t_1 = NULL;
 
999
  __Pyx_RefNannySetupContext("decode_object");
 
1000
 
 
1001
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":96
 
1002
 * 
 
1003
 *     def decode_object(self):
 
1004
 *         return self._decode_object()             # <<<<<<<<<<<<<<
 
1005
 * 
 
1006
 *     cdef object _decode_object(self):
 
1007
 */
 
1008
  __Pyx_XDECREF(__pyx_r);
 
1009
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)->__pyx_vtab)->_decode_object(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1010
  __Pyx_GOTREF(__pyx_t_1);
 
1011
  __pyx_r = __pyx_t_1;
 
1012
  __pyx_t_1 = 0;
 
1013
  goto __pyx_L0;
 
1014
 
 
1015
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
1016
  goto __pyx_L0;
 
1017
  __pyx_L1_error:;
 
1018
  __Pyx_XDECREF(__pyx_t_1);
371
1019
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder.decode_object");
372
 
  __pyx_r = 0;
 
1020
  __pyx_r = NULL;
373
1021
  __pyx_L0:;
374
 
  Py_DECREF(__pyx_v_self);
 
1022
  __Pyx_XGIVEREF(__pyx_r);
 
1023
  __Pyx_RefNannyFinishContext();
375
1024
  return __pyx_r;
376
1025
}
377
1026
 
378
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_object(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
 
1027
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":98
 
1028
 *         return self._decode_object()
 
1029
 * 
 
1030
 *     cdef object _decode_object(self):             # <<<<<<<<<<<<<<
 
1031
 *         cdef char ch
 
1032
 * 
 
1033
 */
 
1034
 
 
1035
static  PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_object(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
379
1036
  char __pyx_v_ch;
380
 
  PyObject *__pyx_r;
381
 
  int __pyx_1;
382
 
  PyObject *__pyx_2 = 0;
383
 
  PyObject *__pyx_3 = 0;
384
 
  Py_INCREF(__pyx_v_self);
385
 
 
386
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":101 */
387
 
  __pyx_1 = (0 == __pyx_v_self->size);
388
 
  if (__pyx_1) {
389
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
390
 
    Py_INCREF(__pyx_k3p);
391
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k3p);
392
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
393
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
394
 
    __Pyx_Raise(__pyx_3, 0, 0);
395
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
396
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
397
 
    goto __pyx_L2;
398
 
  }
399
 
  __pyx_L2:;
400
 
 
401
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":104 */
402
 
  __pyx_1 = Py_EnterRecursiveCall(__pyx_k4);
403
 
  if (__pyx_1) {
404
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
405
 
    Py_INCREF(__pyx_k5p);
406
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k5p);
407
 
    __pyx_3 = PyObject_CallObject(PyExc_RuntimeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
408
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
409
 
    __Pyx_Raise(__pyx_3, 0, 0);
410
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
411
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
 
1037
  PyObject *__pyx_r = NULL;
 
1038
  int __pyx_t_1;
 
1039
  PyObject *__pyx_t_2 = NULL;
 
1040
  PyObject *__pyx_t_3 = NULL;
 
1041
  int __pyx_t_4;
 
1042
  __Pyx_RefNannySetupContext("_decode_object");
 
1043
 
 
1044
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":101
 
1045
 *         cdef char ch
 
1046
 * 
 
1047
 *         if 0 == self.size:             # <<<<<<<<<<<<<<
 
1048
 *             raise ValueError('stream underflow')
 
1049
 * 
 
1050
 */
 
1051
  __pyx_t_1 = (0 == __pyx_v_self->size);
 
1052
  if (__pyx_t_1) {
 
1053
 
 
1054
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":102
 
1055
 * 
 
1056
 *         if 0 == self.size:
 
1057
 *             raise ValueError('stream underflow')             # <<<<<<<<<<<<<<
 
1058
 * 
 
1059
 *         if Py_EnterRecursiveCall("_decode_object"):
 
1060
 */
 
1061
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1062
    __Pyx_GOTREF(__pyx_t_2);
 
1063
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
 
1064
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3));
 
1065
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
 
1066
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1067
    __Pyx_GOTREF(__pyx_t_3);
 
1068
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1069
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
1070
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1071
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
412
1072
    goto __pyx_L3;
413
1073
  }
414
1074
  __pyx_L3:;
415
1075
 
416
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":106 */
 
1076
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":104
 
1077
 *             raise ValueError('stream underflow')
 
1078
 * 
 
1079
 *         if Py_EnterRecursiveCall("_decode_object"):             # <<<<<<<<<<<<<<
 
1080
 *             raise RuntimeError("too deeply nested")
 
1081
 *         try:
 
1082
 */
 
1083
  __pyx_t_4 = Py_EnterRecursiveCall(__pyx_k___decode_object);
 
1084
  if (__pyx_t_4) {
 
1085
 
 
1086
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":105
 
1087
 * 
 
1088
 *         if Py_EnterRecursiveCall("_decode_object"):
 
1089
 *             raise RuntimeError("too deeply nested")             # <<<<<<<<<<<<<<
 
1090
 *         try:
 
1091
 *             ch = self.tail[0]
 
1092
 */
 
1093
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1094
    __Pyx_GOTREF(__pyx_t_3);
 
1095
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
 
1096
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_4));
 
1097
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
 
1098
    __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1099
    __Pyx_GOTREF(__pyx_t_2);
 
1100
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1101
    __Pyx_Raise(__pyx_t_2, 0, 0);
 
1102
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1103
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1104
    goto __pyx_L4;
 
1105
  }
 
1106
  __pyx_L4:;
 
1107
 
 
1108
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":106
 
1109
 *         if Py_EnterRecursiveCall("_decode_object"):
 
1110
 *             raise RuntimeError("too deeply nested")
 
1111
 *         try:             # <<<<<<<<<<<<<<
 
1112
 *             ch = self.tail[0]
 
1113
 *             if c'0' <= ch <= c'9':
 
1114
 */
417
1115
  /*try:*/ {
418
1116
 
419
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":107 */
 
1117
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":107
 
1118
 *             raise RuntimeError("too deeply nested")
 
1119
 *         try:
 
1120
 *             ch = self.tail[0]             # <<<<<<<<<<<<<<
 
1121
 *             if c'0' <= ch <= c'9':
 
1122
 *                 return self._decode_string()
 
1123
 */
420
1124
    __pyx_v_ch = (__pyx_v_self->tail[0]);
421
1125
 
422
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":108 */
423
 
    __pyx_1 = '0' <= __pyx_v_ch;
424
 
    if (__pyx_1) {
425
 
      __pyx_1 = __pyx_v_ch <= '9';
426
 
    }
427
 
    if (__pyx_1) {
428
 
      __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_string(__pyx_v_self); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L5;}
429
 
      __pyx_r = __pyx_2;
430
 
      __pyx_2 = 0;
431
 
      goto __pyx_L4;
432
 
      goto __pyx_L7;
433
 
    }
434
 
    __pyx_1 = (__pyx_v_ch == 'l');
435
 
    if (__pyx_1) {
436
 
 
437
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":111 */
438
 
      D_UPDATE_TAIL(__pyx_v_self,1);
439
 
 
440
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":112 */
441
 
      __pyx_3 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_list(__pyx_v_self); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L5;}
442
 
      __pyx_r = __pyx_3;
443
 
      __pyx_3 = 0;
444
 
      goto __pyx_L4;
445
 
      goto __pyx_L7;
446
 
    }
447
 
    __pyx_1 = (__pyx_v_ch == 'i');
448
 
    if (__pyx_1) {
449
 
 
450
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":114 */
451
 
      D_UPDATE_TAIL(__pyx_v_self,1);
452
 
 
453
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":115 */
454
 
      __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_int(__pyx_v_self); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L5;}
455
 
      __pyx_r = __pyx_2;
456
 
      __pyx_2 = 0;
457
 
      goto __pyx_L4;
458
 
      goto __pyx_L7;
459
 
    }
460
 
    __pyx_1 = (__pyx_v_ch == 'd');
461
 
    if (__pyx_1) {
462
 
 
463
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":117 */
464
 
      D_UPDATE_TAIL(__pyx_v_self,1);
465
 
 
466
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":118 */
467
 
      __pyx_3 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_dict(__pyx_v_self); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L5;}
468
 
      __pyx_r = __pyx_3;
469
 
      __pyx_3 = 0;
470
 
      goto __pyx_L4;
471
 
      goto __pyx_L7;
 
1126
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":108
 
1127
 *         try:
 
1128
 *             ch = self.tail[0]
 
1129
 *             if c'0' <= ch <= c'9':             # <<<<<<<<<<<<<<
 
1130
 *                 return self._decode_string()
 
1131
 *             elif ch == c'l':
 
1132
 */
 
1133
    __pyx_t_1 = ('0' <= __pyx_v_ch);
 
1134
    if (__pyx_t_1) {
 
1135
      __pyx_t_1 = (__pyx_v_ch <= '9');
 
1136
    }
 
1137
    if (__pyx_t_1) {
 
1138
 
 
1139
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":109
 
1140
 *             ch = self.tail[0]
 
1141
 *             if c'0' <= ch <= c'9':
 
1142
 *                 return self._decode_string()             # <<<<<<<<<<<<<<
 
1143
 *             elif ch == c'l':
 
1144
 *                 D_UPDATE_TAIL(self, 1)
 
1145
 */
 
1146
      __Pyx_XDECREF(__pyx_r);
 
1147
      __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_string(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1148
      __Pyx_GOTREF(__pyx_t_2);
 
1149
      __pyx_r = __pyx_t_2;
 
1150
      __pyx_t_2 = 0;
 
1151
      goto __pyx_L5;
 
1152
      goto __pyx_L8;
 
1153
    }
 
1154
 
 
1155
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":110
 
1156
 *             if c'0' <= ch <= c'9':
 
1157
 *                 return self._decode_string()
 
1158
 *             elif ch == c'l':             # <<<<<<<<<<<<<<
 
1159
 *                 D_UPDATE_TAIL(self, 1)
 
1160
 *                 return self._decode_list()
 
1161
 */
 
1162
    __pyx_t_1 = (__pyx_v_ch == 'l');
 
1163
    if (__pyx_t_1) {
 
1164
 
 
1165
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":111
 
1166
 *                 return self._decode_string()
 
1167
 *             elif ch == c'l':
 
1168
 *                 D_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
1169
 *                 return self._decode_list()
 
1170
 *             elif ch == c'i':
 
1171
 */
 
1172
      D_UPDATE_TAIL(__pyx_v_self, 1);
 
1173
 
 
1174
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":112
 
1175
 *             elif ch == c'l':
 
1176
 *                 D_UPDATE_TAIL(self, 1)
 
1177
 *                 return self._decode_list()             # <<<<<<<<<<<<<<
 
1178
 *             elif ch == c'i':
 
1179
 *                 D_UPDATE_TAIL(self, 1)
 
1180
 */
 
1181
      __Pyx_XDECREF(__pyx_r);
 
1182
      __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_list(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1183
      __Pyx_GOTREF(__pyx_t_2);
 
1184
      __pyx_r = __pyx_t_2;
 
1185
      __pyx_t_2 = 0;
 
1186
      goto __pyx_L5;
 
1187
      goto __pyx_L8;
 
1188
    }
 
1189
 
 
1190
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":113
 
1191
 *                 D_UPDATE_TAIL(self, 1)
 
1192
 *                 return self._decode_list()
 
1193
 *             elif ch == c'i':             # <<<<<<<<<<<<<<
 
1194
 *                 D_UPDATE_TAIL(self, 1)
 
1195
 *                 return self._decode_int()
 
1196
 */
 
1197
    __pyx_t_1 = (__pyx_v_ch == 'i');
 
1198
    if (__pyx_t_1) {
 
1199
 
 
1200
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":114
 
1201
 *                 return self._decode_list()
 
1202
 *             elif ch == c'i':
 
1203
 *                 D_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
1204
 *                 return self._decode_int()
 
1205
 *             elif ch == c'd':
 
1206
 */
 
1207
      D_UPDATE_TAIL(__pyx_v_self, 1);
 
1208
 
 
1209
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":115
 
1210
 *             elif ch == c'i':
 
1211
 *                 D_UPDATE_TAIL(self, 1)
 
1212
 *                 return self._decode_int()             # <<<<<<<<<<<<<<
 
1213
 *             elif ch == c'd':
 
1214
 *                 D_UPDATE_TAIL(self, 1)
 
1215
 */
 
1216
      __Pyx_XDECREF(__pyx_r);
 
1217
      __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_int(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1218
      __Pyx_GOTREF(__pyx_t_2);
 
1219
      __pyx_r = __pyx_t_2;
 
1220
      __pyx_t_2 = 0;
 
1221
      goto __pyx_L5;
 
1222
      goto __pyx_L8;
 
1223
    }
 
1224
 
 
1225
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":116
 
1226
 *                 D_UPDATE_TAIL(self, 1)
 
1227
 *                 return self._decode_int()
 
1228
 *             elif ch == c'd':             # <<<<<<<<<<<<<<
 
1229
 *                 D_UPDATE_TAIL(self, 1)
 
1230
 *                 return self._decode_dict()
 
1231
 */
 
1232
    __pyx_t_1 = (__pyx_v_ch == 'd');
 
1233
    if (__pyx_t_1) {
 
1234
 
 
1235
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":117
 
1236
 *                 return self._decode_int()
 
1237
 *             elif ch == c'd':
 
1238
 *                 D_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
1239
 *                 return self._decode_dict()
 
1240
 *             else:
 
1241
 */
 
1242
      D_UPDATE_TAIL(__pyx_v_self, 1);
 
1243
 
 
1244
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":118
 
1245
 *             elif ch == c'd':
 
1246
 *                 D_UPDATE_TAIL(self, 1)
 
1247
 *                 return self._decode_dict()             # <<<<<<<<<<<<<<
 
1248
 *             else:
 
1249
 *                 raise ValueError('unknown object type identifier %r' % ch)
 
1250
 */
 
1251
      __Pyx_XDECREF(__pyx_r);
 
1252
      __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_dict(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1253
      __Pyx_GOTREF(__pyx_t_2);
 
1254
      __pyx_r = __pyx_t_2;
 
1255
      __pyx_t_2 = 0;
 
1256
      goto __pyx_L5;
 
1257
      goto __pyx_L8;
472
1258
    }
473
1259
    /*else*/ {
474
 
      __pyx_2 = PyInt_FromLong(__pyx_v_ch); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L5;}
475
 
      __pyx_3 = PyNumber_Remainder(__pyx_k6p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L5;}
476
 
      Py_DECREF(__pyx_2); __pyx_2 = 0;
477
 
      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L5;}
478
 
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
479
 
      __pyx_3 = 0;
480
 
      __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L5;}
481
 
      Py_DECREF(__pyx_2); __pyx_2 = 0;
482
 
      __Pyx_Raise(__pyx_3, 0, 0);
483
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
484
 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L5;}
 
1260
 
 
1261
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":120
 
1262
 *                 return self._decode_dict()
 
1263
 *             else:
 
1264
 *                 raise ValueError('unknown object type identifier %r' % ch)             # <<<<<<<<<<<<<<
 
1265
 *         finally:
 
1266
 *             Py_LeaveRecursiveCall()
 
1267
 */
 
1268
      __pyx_t_2 = PyInt_FromLong(__pyx_v_ch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1269
      __Pyx_GOTREF(__pyx_t_2);
 
1270
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1271
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
1272
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1273
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1274
      __Pyx_GOTREF(__pyx_t_2);
 
1275
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
 
1276
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
 
1277
      __pyx_t_3 = 0;
 
1278
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6;}
 
1279
      __Pyx_GOTREF(__pyx_t_3);
 
1280
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1281
      __Pyx_Raise(__pyx_t_3, 0, 0);
 
1282
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1283
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6;}
485
1284
    }
486
 
    __pyx_L7:;
 
1285
    __pyx_L8:;
487
1286
  }
 
1287
 
 
1288
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":122
 
1289
 *                 raise ValueError('unknown object type identifier %r' % ch)
 
1290
 *         finally:
 
1291
 *             Py_LeaveRecursiveCall()             # <<<<<<<<<<<<<<
 
1292
 * 
 
1293
 *     cdef int _read_digits(self, char stop_char) except -1:
 
1294
 */
488
1295
  /*finally:*/ {
489
1296
    int __pyx_why;
490
1297
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
491
1298
    int __pyx_exc_lineno;
492
 
    __pyx_why = 0; goto __pyx_L6;
493
 
    __pyx_L4: __pyx_why = 3; goto __pyx_L6;
494
 
    __pyx_L5: {
 
1299
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
 
1300
    __pyx_why = 0; goto __pyx_L7;
 
1301
    __pyx_L5: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
 
1302
    __pyx_why = 3; goto __pyx_L7;
 
1303
    __pyx_L6: {
495
1304
      __pyx_why = 4;
496
 
      Py_XDECREF(__pyx_2); __pyx_2 = 0;
497
 
      Py_XDECREF(__pyx_3); __pyx_3 = 0;
498
 
      PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
 
1305
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1306
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
1307
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
499
1308
      __pyx_exc_lineno = __pyx_lineno;
500
 
      goto __pyx_L6;
 
1309
      goto __pyx_L7;
501
1310
    }
502
 
    __pyx_L6:;
 
1311
    __pyx_L7:;
503
1312
    Py_LeaveRecursiveCall();
504
1313
    switch (__pyx_why) {
505
1314
      case 3: goto __pyx_L0;
506
1315
      case 4: {
507
 
        PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
 
1316
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
508
1317
        __pyx_lineno = __pyx_exc_lineno;
509
1318
        __pyx_exc_type = 0;
510
1319
        __pyx_exc_value = 0;
511
1320
        __pyx_exc_tb = 0;
512
 
        goto __pyx_L1;
 
1321
        goto __pyx_L1_error;
513
1322
      }
514
1323
    }
515
1324
  }
516
1325
 
517
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
1326
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
518
1327
  goto __pyx_L0;
519
 
  __pyx_L1:;
520
 
  Py_XDECREF(__pyx_2);
521
 
  Py_XDECREF(__pyx_3);
 
1328
  __pyx_L1_error:;
 
1329
  __Pyx_XDECREF(__pyx_t_2);
 
1330
  __Pyx_XDECREF(__pyx_t_3);
522
1331
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._decode_object");
523
1332
  __pyx_r = 0;
524
1333
  __pyx_L0:;
525
 
  Py_DECREF(__pyx_v_self);
 
1334
  __Pyx_XGIVEREF(__pyx_r);
 
1335
  __Pyx_RefNannyFinishContext();
526
1336
  return __pyx_r;
527
1337
}
528
1338
 
529
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Decoder__read_digits(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self,char __pyx_v_stop_char) {
 
1339
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":124
 
1340
 *             Py_LeaveRecursiveCall()
 
1341
 * 
 
1342
 *     cdef int _read_digits(self, char stop_char) except -1:             # <<<<<<<<<<<<<<
 
1343
 *         cdef int i
 
1344
 *         i = 0
 
1345
 */
 
1346
 
 
1347
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Decoder__read_digits(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self, char __pyx_v_stop_char) {
530
1348
  int __pyx_v_i;
531
1349
  int __pyx_r;
532
 
  int __pyx_1;
533
 
  PyObject *__pyx_2 = 0;
534
 
  PyObject *__pyx_3 = 0;
535
 
  PyObject *__pyx_4 = 0;
536
 
  Py_INCREF(__pyx_v_self);
 
1350
  int __pyx_t_1;
 
1351
  int __pyx_t_2;
 
1352
  int __pyx_t_3;
 
1353
  PyObject *__pyx_t_4 = NULL;
 
1354
  PyObject *__pyx_t_5 = NULL;
 
1355
  PyObject *__pyx_t_6 = NULL;
 
1356
  int __pyx_t_7;
 
1357
  __Pyx_RefNannySetupContext("_read_digits");
537
1358
 
538
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":126 */
 
1359
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":126
 
1360
 *     cdef int _read_digits(self, char stop_char) except -1:
 
1361
 *         cdef int i
 
1362
 *         i = 0             # <<<<<<<<<<<<<<
 
1363
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or
 
1364
 *                self.tail[i] == c'-') and i < self.size:
 
1365
 */
539
1366
  __pyx_v_i = 0;
540
1367
 
541
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":127 */
 
1368
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":127
 
1369
 *         cdef int i
 
1370
 *         i = 0
 
1371
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or             # <<<<<<<<<<<<<<
 
1372
 *                self.tail[i] == c'-') and i < self.size:
 
1373
 *             i = i + 1
 
1374
 */
542
1375
  while (1) {
543
 
    __pyx_1 = ((__pyx_v_self->tail[__pyx_v_i]) >= '0');
544
 
    if (__pyx_1) {
545
 
      __pyx_1 = ((__pyx_v_self->tail[__pyx_v_i]) <= '9');
546
 
    }
547
 
    if (!__pyx_1) {
548
 
      __pyx_1 = ((__pyx_v_self->tail[__pyx_v_i]) == '-');
549
 
    }
550
 
    if (__pyx_1) {
551
 
      __pyx_1 = (__pyx_v_i < __pyx_v_self->size);
552
 
    }
553
 
    if (!__pyx_1) break;
 
1376
 
 
1377
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":128
 
1378
 *         i = 0
 
1379
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or
 
1380
 *                self.tail[i] == c'-') and i < self.size:             # <<<<<<<<<<<<<<
 
1381
 *             i = i + 1
 
1382
 * 
 
1383
 */
 
1384
    __pyx_t_1 = ((__pyx_v_self->tail[__pyx_v_i]) >= '0');
 
1385
    if (__pyx_t_1) {
 
1386
 
 
1387
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":127
 
1388
 *         cdef int i
 
1389
 *         i = 0
 
1390
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or             # <<<<<<<<<<<<<<
 
1391
 *                self.tail[i] == c'-') and i < self.size:
 
1392
 *             i = i + 1
 
1393
 */
 
1394
      __pyx_t_2 = ((__pyx_v_self->tail[__pyx_v_i]) <= '9');
 
1395
      __pyx_t_3 = __pyx_t_2;
 
1396
    } else {
 
1397
      __pyx_t_3 = __pyx_t_1;
 
1398
    }
 
1399
    if (!__pyx_t_3) {
 
1400
 
 
1401
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":128
 
1402
 *         i = 0
 
1403
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or
 
1404
 *                self.tail[i] == c'-') and i < self.size:             # <<<<<<<<<<<<<<
 
1405
 *             i = i + 1
 
1406
 * 
 
1407
 */
 
1408
      __pyx_t_1 = ((__pyx_v_self->tail[__pyx_v_i]) == '-');
 
1409
      __pyx_t_2 = __pyx_t_1;
 
1410
    } else {
 
1411
      __pyx_t_2 = __pyx_t_3;
 
1412
    }
 
1413
    if (__pyx_t_2) {
 
1414
      __pyx_t_3 = (__pyx_v_i < __pyx_v_self->size);
 
1415
      __pyx_t_1 = __pyx_t_3;
 
1416
    } else {
 
1417
      __pyx_t_1 = __pyx_t_2;
 
1418
    }
 
1419
    if (!__pyx_t_1) break;
 
1420
 
 
1421
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":129
 
1422
 *         while ((self.tail[i] >= c'0' and self.tail[i] <= c'9') or
 
1423
 *                self.tail[i] == c'-') and i < self.size:
 
1424
 *             i = i + 1             # <<<<<<<<<<<<<<
 
1425
 * 
 
1426
 *         if self.tail[i] != stop_char:
 
1427
 */
554
1428
    __pyx_v_i = (__pyx_v_i + 1);
555
1429
  }
556
1430
 
557
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":131 */
558
 
  __pyx_1 = ((__pyx_v_self->tail[__pyx_v_i]) != __pyx_v_stop_char);
559
 
  if (__pyx_1) {
560
 
    __pyx_2 = PyInt_FromLong(__pyx_v_stop_char); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
561
 
    __pyx_3 = PyInt_FromLong((__pyx_v_self->tail[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
562
 
    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
563
 
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
564
 
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
565
 
    __pyx_2 = 0;
566
 
    __pyx_3 = 0;
567
 
    __pyx_2 = PyNumber_Remainder(__pyx_k7p, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
568
 
    Py_DECREF(__pyx_4); __pyx_4 = 0;
569
 
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
570
 
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
571
 
    __pyx_2 = 0;
572
 
    __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
573
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
574
 
    __Pyx_Raise(__pyx_4, 0, 0);
575
 
    Py_DECREF(__pyx_4); __pyx_4 = 0;
576
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
577
 
    goto __pyx_L4;
 
1431
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":131
 
1432
 *             i = i + 1
 
1433
 * 
 
1434
 *         if self.tail[i] != stop_char:             # <<<<<<<<<<<<<<
 
1435
 *             raise ValueError("Stop character %c not found: %c" %
 
1436
 *                 (stop_char, self.tail[i]))
 
1437
 */
 
1438
  __pyx_t_1 = ((__pyx_v_self->tail[__pyx_v_i]) != __pyx_v_stop_char);
 
1439
  if (__pyx_t_1) {
 
1440
 
 
1441
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":133
 
1442
 *         if self.tail[i] != stop_char:
 
1443
 *             raise ValueError("Stop character %c not found: %c" %
 
1444
 *                 (stop_char, self.tail[i]))             # <<<<<<<<<<<<<<
 
1445
 *         if (self.tail[0] == c'0' or
 
1446
 *                 (self.tail[0] == c'-' and self.tail[1] == c'0')):
 
1447
 */
 
1448
    __pyx_t_4 = PyInt_FromLong(__pyx_v_stop_char); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1449
    __Pyx_GOTREF(__pyx_t_4);
 
1450
    __pyx_t_5 = PyInt_FromLong((__pyx_v_self->tail[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1451
    __Pyx_GOTREF(__pyx_t_5);
 
1452
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1453
    __Pyx_GOTREF(__pyx_t_6);
 
1454
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
 
1455
    __Pyx_GIVEREF(__pyx_t_4);
 
1456
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
 
1457
    __Pyx_GIVEREF(__pyx_t_5);
 
1458
    __pyx_t_4 = 0;
 
1459
    __pyx_t_5 = 0;
 
1460
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1461
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
1462
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
1463
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1464
    __Pyx_GOTREF(__pyx_t_6);
 
1465
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
 
1466
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
 
1467
    __pyx_t_5 = 0;
 
1468
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1469
    __Pyx_GOTREF(__pyx_t_5);
 
1470
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
1471
    __Pyx_Raise(__pyx_t_5, 0, 0);
 
1472
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1473
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1474
    goto __pyx_L5;
578
1475
  }
579
 
  __pyx_L4:;
580
 
 
581
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":134 */
582
 
  __pyx_1 = ((__pyx_v_self->tail[0]) == '0');
583
 
  if (!__pyx_1) {
584
 
    __pyx_1 = ((__pyx_v_self->tail[0]) == '-');
585
 
    if (__pyx_1) {
586
 
      __pyx_1 = ((__pyx_v_self->tail[1]) == '0');
 
1476
  __pyx_L5:;
 
1477
 
 
1478
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":134
 
1479
 *             raise ValueError("Stop character %c not found: %c" %
 
1480
 *                 (stop_char, self.tail[i]))
 
1481
 *         if (self.tail[0] == c'0' or             # <<<<<<<<<<<<<<
 
1482
 *                 (self.tail[0] == c'-' and self.tail[1] == c'0')):
 
1483
 *             if i == 1:
 
1484
 */
 
1485
  __pyx_t_1 = ((__pyx_v_self->tail[0]) == '0');
 
1486
  if (!__pyx_t_1) {
 
1487
 
 
1488
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":135
 
1489
 *                 (stop_char, self.tail[i]))
 
1490
 *         if (self.tail[0] == c'0' or
 
1491
 *                 (self.tail[0] == c'-' and self.tail[1] == c'0')):             # <<<<<<<<<<<<<<
 
1492
 *             if i == 1:
 
1493
 *                 return i
 
1494
 */
 
1495
    __pyx_t_2 = ((__pyx_v_self->tail[0]) == '-');
 
1496
    if (__pyx_t_2) {
 
1497
      __pyx_t_3 = ((__pyx_v_self->tail[1]) == '0');
 
1498
      __pyx_t_7 = __pyx_t_3;
 
1499
    } else {
 
1500
      __pyx_t_7 = __pyx_t_2;
587
1501
    }
 
1502
    __pyx_t_2 = __pyx_t_7;
 
1503
  } else {
 
1504
    __pyx_t_2 = __pyx_t_1;
588
1505
  }
589
 
  if (__pyx_1) {
590
 
    __pyx_1 = (__pyx_v_i == 1);
591
 
    if (__pyx_1) {
 
1506
  if (__pyx_t_2) {
 
1507
 
 
1508
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":136
 
1509
 *         if (self.tail[0] == c'0' or
 
1510
 *                 (self.tail[0] == c'-' and self.tail[1] == c'0')):
 
1511
 *             if i == 1:             # <<<<<<<<<<<<<<
 
1512
 *                 return i
 
1513
 *             else:
 
1514
 */
 
1515
    __pyx_t_2 = (__pyx_v_i == 1);
 
1516
    if (__pyx_t_2) {
 
1517
 
 
1518
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":137
 
1519
 *                 (self.tail[0] == c'-' and self.tail[1] == c'0')):
 
1520
 *             if i == 1:
 
1521
 *                 return i             # <<<<<<<<<<<<<<
 
1522
 *             else:
 
1523
 *                 raise ValueError # leading zeroes are not allowed
 
1524
 */
592
1525
      __pyx_r = __pyx_v_i;
593
1526
      goto __pyx_L0;
594
 
      goto __pyx_L6;
 
1527
      goto __pyx_L7;
595
1528
    }
596
1529
    /*else*/ {
597
 
      __Pyx_Raise(PyExc_ValueError, 0, 0);
598
 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;}
 
1530
 
 
1531
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":139
 
1532
 *                 return i
 
1533
 *             else:
 
1534
 *                 raise ValueError # leading zeroes are not allowed             # <<<<<<<<<<<<<<
 
1535
 *         return i
 
1536
 * 
 
1537
 */
 
1538
      __Pyx_Raise(__pyx_builtin_ValueError, 0, 0);
 
1539
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
599
1540
    }
600
 
    __pyx_L6:;
601
 
    goto __pyx_L5;
 
1541
    __pyx_L7:;
 
1542
    goto __pyx_L6;
602
1543
  }
603
 
  __pyx_L5:;
 
1544
  __pyx_L6:;
604
1545
 
605
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":140 */
 
1546
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":140
 
1547
 *             else:
 
1548
 *                 raise ValueError # leading zeroes are not allowed
 
1549
 *         return i             # <<<<<<<<<<<<<<
 
1550
 * 
 
1551
 *     cdef object _decode_int(self):
 
1552
 */
606
1553
  __pyx_r = __pyx_v_i;
607
1554
  goto __pyx_L0;
608
1555
 
609
1556
  __pyx_r = 0;
610
1557
  goto __pyx_L0;
611
 
  __pyx_L1:;
612
 
  Py_XDECREF(__pyx_2);
613
 
  Py_XDECREF(__pyx_3);
614
 
  Py_XDECREF(__pyx_4);
 
1558
  __pyx_L1_error:;
 
1559
  __Pyx_XDECREF(__pyx_t_4);
 
1560
  __Pyx_XDECREF(__pyx_t_5);
 
1561
  __Pyx_XDECREF(__pyx_t_6);
615
1562
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._read_digits");
616
 
  __pyx_r = (-1);
 
1563
  __pyx_r = -1;
617
1564
  __pyx_L0:;
618
 
  Py_DECREF(__pyx_v_self);
 
1565
  __Pyx_RefNannyFinishContext();
619
1566
  return __pyx_r;
620
1567
}
621
1568
 
622
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_int(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
 
1569
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":142
 
1570
 *         return i
 
1571
 * 
 
1572
 *     cdef object _decode_int(self):             # <<<<<<<<<<<<<<
 
1573
 *         cdef int i
 
1574
 *         i = self._read_digits(c'e')
 
1575
 */
 
1576
 
 
1577
static  PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_int(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
623
1578
  int __pyx_v_i;
624
1579
  PyObject *__pyx_v_ret;
625
 
  PyObject *__pyx_r;
626
 
  int __pyx_1;
627
 
  PyObject *__pyx_2 = 0;
628
 
  Py_INCREF(__pyx_v_self);
629
 
  __pyx_v_ret = Py_None; Py_INCREF(Py_None);
630
 
 
631
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":144 */
632
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_read_digits(__pyx_v_self,'e'); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
633
 
  __pyx_v_i = __pyx_1;
634
 
 
635
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":145 */
 
1580
  PyObject *__pyx_r = NULL;
 
1581
  int __pyx_t_1;
 
1582
  PyObject *__pyx_t_2 = NULL;
 
1583
  __Pyx_RefNannySetupContext("_decode_int");
 
1584
  __pyx_v_ret = Py_None; __Pyx_INCREF(Py_None);
 
1585
 
 
1586
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":144
 
1587
 *     cdef object _decode_int(self):
 
1588
 *         cdef int i
 
1589
 *         i = self._read_digits(c'e')             # <<<<<<<<<<<<<<
 
1590
 *         self.tail[i] = 0
 
1591
 *         try:
 
1592
 */
 
1593
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_read_digits(__pyx_v_self, 'e'); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1594
  __pyx_v_i = __pyx_t_1;
 
1595
 
 
1596
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":145
 
1597
 *         cdef int i
 
1598
 *         i = self._read_digits(c'e')
 
1599
 *         self.tail[i] = 0             # <<<<<<<<<<<<<<
 
1600
 *         try:
 
1601
 *             ret = PyInt_FromString(self.tail, NULL, 10)
 
1602
 */
636
1603
  (__pyx_v_self->tail[__pyx_v_i]) = 0;
637
1604
 
638
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":146 */
 
1605
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":146
 
1606
 *         i = self._read_digits(c'e')
 
1607
 *         self.tail[i] = 0
 
1608
 *         try:             # <<<<<<<<<<<<<<
 
1609
 *             ret = PyInt_FromString(self.tail, NULL, 10)
 
1610
 *         finally:
 
1611
 */
639
1612
  /*try:*/ {
640
 
    __pyx_2 = PyInt_FromString(__pyx_v_self->tail,NULL,10); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L3;}
641
 
    Py_DECREF(__pyx_v_ret);
642
 
    __pyx_v_ret = __pyx_2;
643
 
    __pyx_2 = 0;
 
1613
 
 
1614
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":147
 
1615
 *         self.tail[i] = 0
 
1616
 *         try:
 
1617
 *             ret = PyInt_FromString(self.tail, NULL, 10)             # <<<<<<<<<<<<<<
 
1618
 *         finally:
 
1619
 *             self.tail[i] = c'e'
 
1620
 */
 
1621
    __pyx_t_2 = PyInt_FromString(__pyx_v_self->tail, NULL, 10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L4;}
 
1622
    __Pyx_GOTREF(__pyx_t_2);
 
1623
    __Pyx_DECREF(__pyx_v_ret);
 
1624
    __pyx_v_ret = __pyx_t_2;
 
1625
    __pyx_t_2 = 0;
644
1626
  }
 
1627
 
 
1628
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":149
 
1629
 *             ret = PyInt_FromString(self.tail, NULL, 10)
 
1630
 *         finally:
 
1631
 *             self.tail[i] = c'e'             # <<<<<<<<<<<<<<
 
1632
 *         D_UPDATE_TAIL(self, i+1)
 
1633
 *         return ret
 
1634
 */
645
1635
  /*finally:*/ {
646
1636
    int __pyx_why;
647
1637
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
648
1638
    int __pyx_exc_lineno;
649
 
    __pyx_why = 0; goto __pyx_L4;
650
 
    __pyx_L3: {
 
1639
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
 
1640
    __pyx_why = 0; goto __pyx_L5;
 
1641
    __pyx_L4: {
651
1642
      __pyx_why = 4;
652
 
      Py_XDECREF(__pyx_2); __pyx_2 = 0;
653
 
      PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
 
1643
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
1644
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
654
1645
      __pyx_exc_lineno = __pyx_lineno;
655
 
      goto __pyx_L4;
 
1646
      goto __pyx_L5;
656
1647
    }
657
 
    __pyx_L4:;
 
1648
    __pyx_L5:;
658
1649
    (__pyx_v_self->tail[__pyx_v_i]) = 'e';
659
1650
    switch (__pyx_why) {
660
1651
      case 4: {
661
 
        PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
 
1652
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
662
1653
        __pyx_lineno = __pyx_exc_lineno;
663
1654
        __pyx_exc_type = 0;
664
1655
        __pyx_exc_value = 0;
665
1656
        __pyx_exc_tb = 0;
666
 
        goto __pyx_L1;
 
1657
        goto __pyx_L1_error;
667
1658
      }
668
1659
    }
669
1660
  }
670
1661
 
671
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":150 */
672
 
  D_UPDATE_TAIL(__pyx_v_self,(__pyx_v_i + 1));
 
1662
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":150
 
1663
 *         finally:
 
1664
 *             self.tail[i] = c'e'
 
1665
 *         D_UPDATE_TAIL(self, i+1)             # <<<<<<<<<<<<<<
 
1666
 *         return ret
 
1667
 * 
 
1668
 */
 
1669
  D_UPDATE_TAIL(__pyx_v_self, (__pyx_v_i + 1));
673
1670
 
674
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":151 */
675
 
  Py_INCREF(__pyx_v_ret);
 
1671
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":151
 
1672
 *             self.tail[i] = c'e'
 
1673
 *         D_UPDATE_TAIL(self, i+1)
 
1674
 *         return ret             # <<<<<<<<<<<<<<
 
1675
 * 
 
1676
 *     cdef object _decode_string(self):
 
1677
 */
 
1678
  __Pyx_XDECREF(__pyx_r);
 
1679
  __Pyx_INCREF(__pyx_v_ret);
676
1680
  __pyx_r = __pyx_v_ret;
677
1681
  goto __pyx_L0;
678
1682
 
679
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
1683
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
680
1684
  goto __pyx_L0;
681
 
  __pyx_L1:;
682
 
  Py_XDECREF(__pyx_2);
 
1685
  __pyx_L1_error:;
 
1686
  __Pyx_XDECREF(__pyx_t_2);
683
1687
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._decode_int");
684
1688
  __pyx_r = 0;
685
1689
  __pyx_L0:;
686
 
  Py_DECREF(__pyx_v_ret);
687
 
  Py_DECREF(__pyx_v_self);
 
1690
  __Pyx_DECREF(__pyx_v_ret);
 
1691
  __Pyx_XGIVEREF(__pyx_r);
 
1692
  __Pyx_RefNannyFinishContext();
688
1693
  return __pyx_r;
689
1694
}
690
1695
 
691
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
 
1696
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":153
 
1697
 *         return ret
 
1698
 * 
 
1699
 *     cdef object _decode_string(self):             # <<<<<<<<<<<<<<
 
1700
 *         cdef int n
 
1701
 *         cdef char *next_tail
 
1702
 */
 
1703
 
 
1704
static  PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
692
1705
  int __pyx_v_n;
693
1706
  char *__pyx_v_next_tail;
694
1707
  PyObject *__pyx_v_result;
695
 
  PyObject *__pyx_r;
696
 
  int __pyx_1;
697
 
  PyObject *__pyx_2 = 0;
698
 
  PyObject *__pyx_3 = 0;
699
 
  Py_INCREF(__pyx_v_self);
700
 
  __pyx_v_result = Py_None; Py_INCREF(Py_None);
701
 
 
702
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":160 */
703
 
  __pyx_v_n = strtol(__pyx_v_self->tail,(&__pyx_v_next_tail),10);
704
 
 
705
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":161 */
706
 
  __pyx_1 = (__pyx_v_next_tail == NULL);
707
 
  if (!__pyx_1) {
708
 
    __pyx_1 = ((__pyx_v_next_tail[0]) != ':');
709
 
  }
710
 
  if (__pyx_1) {
711
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
712
 
    Py_INCREF(__pyx_k8p);
713
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k8p);
714
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
715
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
716
 
    __Pyx_Raise(__pyx_3, 0, 0);
717
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
718
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
719
 
    goto __pyx_L2;
720
 
  }
721
 
  __pyx_L2:;
722
 
 
723
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":164 */
724
 
  __pyx_1 = ((__pyx_v_self->tail[0]) == '0');
725
 
  if (__pyx_1) {
726
 
    __pyx_1 = (__pyx_v_n != 0);
727
 
    if (!__pyx_1) {
728
 
      __pyx_1 = ((__pyx_v_next_tail - __pyx_v_self->tail) != 1);
729
 
    }
730
 
  }
731
 
  if (__pyx_1) {
732
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
733
 
    Py_INCREF(__pyx_k9p);
734
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k9p);
735
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
736
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
737
 
    __Pyx_Raise(__pyx_3, 0, 0);
738
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
739
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
 
1708
  PyObject *__pyx_r = NULL;
 
1709
  int __pyx_t_1;
 
1710
  int __pyx_t_2;
 
1711
  int __pyx_t_3;
 
1712
  PyObject *__pyx_t_4 = NULL;
 
1713
  PyObject *__pyx_t_5 = NULL;
 
1714
  int __pyx_t_6;
 
1715
  __Pyx_RefNannySetupContext("_decode_string");
 
1716
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
 
1717
 
 
1718
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":160
 
1719
 *         # or they wouldn't have called _decode_string
 
1720
 *         # strtol will stop at trailing whitespace, etc
 
1721
 *         n = strtol(self.tail, &next_tail, 10)             # <<<<<<<<<<<<<<
 
1722
 *         if next_tail == NULL or next_tail[0] != c':':
 
1723
 *             raise ValueError('string len not terminated by ":"')
 
1724
 */
 
1725
  __pyx_v_n = strtol(__pyx_v_self->tail, (&__pyx_v_next_tail), 10);
 
1726
 
 
1727
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":161
 
1728
 *         # strtol will stop at trailing whitespace, etc
 
1729
 *         n = strtol(self.tail, &next_tail, 10)
 
1730
 *         if next_tail == NULL or next_tail[0] != c':':             # <<<<<<<<<<<<<<
 
1731
 *             raise ValueError('string len not terminated by ":"')
 
1732
 *         # strtol allows leading zeros, so validate that we don't have that
 
1733
 */
 
1734
  __pyx_t_1 = (__pyx_v_next_tail == NULL);
 
1735
  if (!__pyx_t_1) {
 
1736
    __pyx_t_2 = ((__pyx_v_next_tail[0]) != ':');
 
1737
    __pyx_t_3 = __pyx_t_2;
 
1738
  } else {
 
1739
    __pyx_t_3 = __pyx_t_1;
 
1740
  }
 
1741
  if (__pyx_t_3) {
 
1742
 
 
1743
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":162
 
1744
 *         n = strtol(self.tail, &next_tail, 10)
 
1745
 *         if next_tail == NULL or next_tail[0] != c':':
 
1746
 *             raise ValueError('string len not terminated by ":"')             # <<<<<<<<<<<<<<
 
1747
 *         # strtol allows leading zeros, so validate that we don't have that
 
1748
 *         if (self.tail[0] == c'0'
 
1749
 */
 
1750
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1751
    __Pyx_GOTREF(__pyx_t_4);
 
1752
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
 
1753
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_7));
 
1754
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
 
1755
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1756
    __Pyx_GOTREF(__pyx_t_5);
 
1757
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1758
    __Pyx_Raise(__pyx_t_5, 0, 0);
 
1759
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1760
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
740
1761
    goto __pyx_L3;
741
1762
  }
742
1763
  __pyx_L3:;
743
1764
 
744
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":167 */
745
 
  D_UPDATE_TAIL(__pyx_v_self,((__pyx_v_next_tail - __pyx_v_self->tail) + 1));
746
 
 
747
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":168 */
748
 
  __pyx_1 = (__pyx_v_n == 0);
749
 
  if (__pyx_1) {
750
 
    Py_INCREF(__pyx_k10p);
751
 
    __pyx_r = __pyx_k10p;
752
 
    goto __pyx_L0;
 
1765
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":164
 
1766
 *             raise ValueError('string len not terminated by ":"')
 
1767
 *         # strtol allows leading zeros, so validate that we don't have that
 
1768
 *         if (self.tail[0] == c'0'             # <<<<<<<<<<<<<<
 
1769
 *             and (n != 0 or (next_tail - self.tail != 1))):
 
1770
 *             raise ValueError('leading zeros are not allowed')
 
1771
 */
 
1772
  __pyx_t_3 = ((__pyx_v_self->tail[0]) == '0');
 
1773
  if (__pyx_t_3) {
 
1774
 
 
1775
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":165
 
1776
 *         # strtol allows leading zeros, so validate that we don't have that
 
1777
 *         if (self.tail[0] == c'0'
 
1778
 *             and (n != 0 or (next_tail - self.tail != 1))):             # <<<<<<<<<<<<<<
 
1779
 *             raise ValueError('leading zeros are not allowed')
 
1780
 *         D_UPDATE_TAIL(self, next_tail - self.tail + 1)
 
1781
 */
 
1782
    __pyx_t_1 = (__pyx_v_n != 0);
 
1783
    if (!__pyx_t_1) {
 
1784
      __pyx_t_2 = ((__pyx_v_next_tail - __pyx_v_self->tail) != 1);
 
1785
      __pyx_t_6 = __pyx_t_2;
 
1786
    } else {
 
1787
      __pyx_t_6 = __pyx_t_1;
 
1788
    }
 
1789
    __pyx_t_1 = __pyx_t_6;
 
1790
  } else {
 
1791
    __pyx_t_1 = __pyx_t_3;
 
1792
  }
 
1793
  if (__pyx_t_1) {
 
1794
 
 
1795
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":166
 
1796
 *         if (self.tail[0] == c'0'
 
1797
 *             and (n != 0 or (next_tail - self.tail != 1))):
 
1798
 *             raise ValueError('leading zeros are not allowed')             # <<<<<<<<<<<<<<
 
1799
 *         D_UPDATE_TAIL(self, next_tail - self.tail + 1)
 
1800
 *         if n == 0:
 
1801
 */
 
1802
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1803
    __Pyx_GOTREF(__pyx_t_5);
 
1804
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
 
1805
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_8));
 
1806
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
 
1807
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1808
    __Pyx_GOTREF(__pyx_t_4);
 
1809
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1810
    __Pyx_Raise(__pyx_t_4, 0, 0);
 
1811
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1812
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
753
1813
    goto __pyx_L4;
754
1814
  }
755
1815
  __pyx_L4:;
756
1816
 
757
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":170 */
758
 
  __pyx_1 = (__pyx_v_n > __pyx_v_self->size);
759
 
  if (__pyx_1) {
760
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
761
 
    Py_INCREF(__pyx_k3p);
762
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k3p);
763
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
764
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
765
 
    __Pyx_Raise(__pyx_3, 0, 0);
766
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
767
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
 
1817
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":167
 
1818
 *             and (n != 0 or (next_tail - self.tail != 1))):
 
1819
 *             raise ValueError('leading zeros are not allowed')
 
1820
 *         D_UPDATE_TAIL(self, next_tail - self.tail + 1)             # <<<<<<<<<<<<<<
 
1821
 *         if n == 0:
 
1822
 *             return ''
 
1823
 */
 
1824
  D_UPDATE_TAIL(__pyx_v_self, ((__pyx_v_next_tail - __pyx_v_self->tail) + 1));
 
1825
 
 
1826
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":168
 
1827
 *             raise ValueError('leading zeros are not allowed')
 
1828
 *         D_UPDATE_TAIL(self, next_tail - self.tail + 1)
 
1829
 *         if n == 0:             # <<<<<<<<<<<<<<
 
1830
 *             return ''
 
1831
 *         if n > self.size:
 
1832
 */
 
1833
  __pyx_t_1 = (__pyx_v_n == 0);
 
1834
  if (__pyx_t_1) {
 
1835
 
 
1836
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":169
 
1837
 *         D_UPDATE_TAIL(self, next_tail - self.tail + 1)
 
1838
 *         if n == 0:
 
1839
 *             return ''             # <<<<<<<<<<<<<<
 
1840
 *         if n > self.size:
 
1841
 *             raise ValueError('stream underflow')
 
1842
 */
 
1843
    __Pyx_XDECREF(__pyx_r);
 
1844
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
 
1845
    __pyx_r = ((PyObject *)__pyx_kp_s_9);
 
1846
    goto __pyx_L0;
768
1847
    goto __pyx_L5;
769
1848
  }
770
1849
  __pyx_L5:;
771
1850
 
772
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":172 */
773
 
  __pyx_1 = (__pyx_v_n < 0);
774
 
  if (__pyx_1) {
775
 
    __pyx_2 = PyInt_FromLong(__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
776
 
    __pyx_3 = PyNumber_Remainder(__pyx_k11p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
777
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
778
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
779
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
780
 
    __pyx_3 = 0;
781
 
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
782
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
783
 
    __Pyx_Raise(__pyx_3, 0, 0);
784
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
785
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
 
1851
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":170
 
1852
 *         if n == 0:
 
1853
 *             return ''
 
1854
 *         if n > self.size:             # <<<<<<<<<<<<<<
 
1855
 *             raise ValueError('stream underflow')
 
1856
 *         if n < 0:
 
1857
 */
 
1858
  __pyx_t_1 = (__pyx_v_n > __pyx_v_self->size);
 
1859
  if (__pyx_t_1) {
 
1860
 
 
1861
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":171
 
1862
 *             return ''
 
1863
 *         if n > self.size:
 
1864
 *             raise ValueError('stream underflow')             # <<<<<<<<<<<<<<
 
1865
 *         if n < 0:
 
1866
 *             raise ValueError('string size below zero: %d' % n)
 
1867
 */
 
1868
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1869
    __Pyx_GOTREF(__pyx_t_4);
 
1870
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
 
1871
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_3));
 
1872
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
 
1873
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1874
    __Pyx_GOTREF(__pyx_t_5);
 
1875
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1876
    __Pyx_Raise(__pyx_t_5, 0, 0);
 
1877
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1878
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
786
1879
    goto __pyx_L6;
787
1880
  }
788
1881
  __pyx_L6:;
789
1882
 
790
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":175 */
791
 
  __pyx_2 = PyString_FromStringAndSize(__pyx_v_self->tail,__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
792
 
  Py_DECREF(__pyx_v_result);
793
 
  __pyx_v_result = __pyx_2;
794
 
  __pyx_2 = 0;
795
 
 
796
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":176 */
797
 
  D_UPDATE_TAIL(__pyx_v_self,__pyx_v_n);
798
 
 
799
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":177 */
800
 
  Py_INCREF(__pyx_v_result);
 
1883
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":172
 
1884
 *         if n > self.size:
 
1885
 *             raise ValueError('stream underflow')
 
1886
 *         if n < 0:             # <<<<<<<<<<<<<<
 
1887
 *             raise ValueError('string size below zero: %d' % n)
 
1888
 * 
 
1889
 */
 
1890
  __pyx_t_1 = (__pyx_v_n < 0);
 
1891
  if (__pyx_t_1) {
 
1892
 
 
1893
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":173
 
1894
 *             raise ValueError('stream underflow')
 
1895
 *         if n < 0:
 
1896
 *             raise ValueError('string size below zero: %d' % n)             # <<<<<<<<<<<<<<
 
1897
 * 
 
1898
 *         result = PyString_FromStringAndSize(self.tail, n)
 
1899
 */
 
1900
    __pyx_t_5 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1901
    __Pyx_GOTREF(__pyx_t_5);
 
1902
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1903
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
1904
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1905
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1906
    __Pyx_GOTREF(__pyx_t_5);
 
1907
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
 
1908
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
 
1909
    __pyx_t_4 = 0;
 
1910
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1911
    __Pyx_GOTREF(__pyx_t_4);
 
1912
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
1913
    __Pyx_Raise(__pyx_t_4, 0, 0);
 
1914
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
1915
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1916
    goto __pyx_L7;
 
1917
  }
 
1918
  __pyx_L7:;
 
1919
 
 
1920
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":175
 
1921
 *             raise ValueError('string size below zero: %d' % n)
 
1922
 * 
 
1923
 *         result = PyString_FromStringAndSize(self.tail, n)             # <<<<<<<<<<<<<<
 
1924
 *         D_UPDATE_TAIL(self, n)
 
1925
 *         return result
 
1926
 */
 
1927
  __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_self->tail, __pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1928
  __Pyx_GOTREF(__pyx_t_4);
 
1929
  __Pyx_DECREF(__pyx_v_result);
 
1930
  __pyx_v_result = __pyx_t_4;
 
1931
  __pyx_t_4 = 0;
 
1932
 
 
1933
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":176
 
1934
 * 
 
1935
 *         result = PyString_FromStringAndSize(self.tail, n)
 
1936
 *         D_UPDATE_TAIL(self, n)             # <<<<<<<<<<<<<<
 
1937
 *         return result
 
1938
 * 
 
1939
 */
 
1940
  D_UPDATE_TAIL(__pyx_v_self, __pyx_v_n);
 
1941
 
 
1942
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":177
 
1943
 *         result = PyString_FromStringAndSize(self.tail, n)
 
1944
 *         D_UPDATE_TAIL(self, n)
 
1945
 *         return result             # <<<<<<<<<<<<<<
 
1946
 * 
 
1947
 *     cdef object _decode_list(self):
 
1948
 */
 
1949
  __Pyx_XDECREF(__pyx_r);
 
1950
  __Pyx_INCREF(__pyx_v_result);
801
1951
  __pyx_r = __pyx_v_result;
802
1952
  goto __pyx_L0;
803
1953
 
804
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
1954
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
805
1955
  goto __pyx_L0;
806
 
  __pyx_L1:;
807
 
  Py_XDECREF(__pyx_2);
808
 
  Py_XDECREF(__pyx_3);
 
1956
  __pyx_L1_error:;
 
1957
  __Pyx_XDECREF(__pyx_t_4);
 
1958
  __Pyx_XDECREF(__pyx_t_5);
809
1959
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._decode_string");
810
1960
  __pyx_r = 0;
811
1961
  __pyx_L0:;
812
 
  Py_DECREF(__pyx_v_result);
813
 
  Py_DECREF(__pyx_v_self);
 
1962
  __Pyx_DECREF(__pyx_v_result);
 
1963
  __Pyx_XGIVEREF(__pyx_r);
 
1964
  __Pyx_RefNannyFinishContext();
814
1965
  return __pyx_r;
815
1966
}
816
1967
 
817
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_list(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
 
1968
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":179
 
1969
 *         return result
 
1970
 * 
 
1971
 *     cdef object _decode_list(self):             # <<<<<<<<<<<<<<
 
1972
 *         result = []
 
1973
 * 
 
1974
 */
 
1975
 
 
1976
static  PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_list(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
818
1977
  PyObject *__pyx_v_result;
819
 
  PyObject *__pyx_r;
820
 
  PyObject *__pyx_1 = 0;
821
 
  int __pyx_2;
822
 
  PyObject *__pyx_3 = 0;
823
 
  Py_INCREF(__pyx_v_self);
824
 
  __pyx_v_result = Py_None; Py_INCREF(Py_None);
825
 
 
826
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":180 */
827
 
  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
828
 
  Py_DECREF(__pyx_v_result);
829
 
  __pyx_v_result = __pyx_1;
830
 
  __pyx_1 = 0;
831
 
 
832
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":182 */
 
1978
  PyObject *__pyx_r = NULL;
 
1979
  PyObject *__pyx_t_1 = NULL;
 
1980
  int __pyx_t_2;
 
1981
  int __pyx_t_3;
 
1982
  PyObject *__pyx_t_4 = NULL;
 
1983
  __Pyx_RefNannySetupContext("_decode_list");
 
1984
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
1985
 
 
1986
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":180
 
1987
 * 
 
1988
 *     cdef object _decode_list(self):
 
1989
 *         result = []             # <<<<<<<<<<<<<<
 
1990
 * 
 
1991
 *         while self.size > 0:
 
1992
 */
 
1993
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
1994
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
1995
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
1996
  __pyx_v_result = __pyx_t_1;
 
1997
  __pyx_t_1 = 0;
 
1998
 
 
1999
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":182
 
2000
 *         result = []
 
2001
 * 
 
2002
 *         while self.size > 0:             # <<<<<<<<<<<<<<
 
2003
 *             if self.tail[0] == c'e':
 
2004
 *                 D_UPDATE_TAIL(self, 1)
 
2005
 */
833
2006
  while (1) {
834
 
    __pyx_2 = (__pyx_v_self->size > 0);
835
 
    if (!__pyx_2) break;
836
 
    __pyx_2 = ((__pyx_v_self->tail[0]) == 'e');
837
 
    if (__pyx_2) {
838
 
 
839
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":184 */
840
 
      D_UPDATE_TAIL(__pyx_v_self,1);
841
 
 
842
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":185 */
843
 
      __pyx_2 = __pyx_v_self->_yield_tuples;
844
 
      if (__pyx_2) {
845
 
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
846
 
        Py_INCREF(__pyx_v_result);
847
 
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_result);
848
 
        __pyx_3 = PyObject_CallObject(((PyObject *)(&PyTuple_Type)), __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
849
 
        Py_DECREF(__pyx_1); __pyx_1 = 0;
850
 
        __pyx_r = __pyx_3;
851
 
        __pyx_3 = 0;
 
2007
    __pyx_t_2 = (__pyx_v_self->size > 0);
 
2008
    if (!__pyx_t_2) break;
 
2009
 
 
2010
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":183
 
2011
 * 
 
2012
 *         while self.size > 0:
 
2013
 *             if self.tail[0] == c'e':             # <<<<<<<<<<<<<<
 
2014
 *                 D_UPDATE_TAIL(self, 1)
 
2015
 *                 if self._yield_tuples:
 
2016
 */
 
2017
    __pyx_t_2 = ((__pyx_v_self->tail[0]) == 'e');
 
2018
    if (__pyx_t_2) {
 
2019
 
 
2020
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":184
 
2021
 *         while self.size > 0:
 
2022
 *             if self.tail[0] == c'e':
 
2023
 *                 D_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
2024
 *                 if self._yield_tuples:
 
2025
 *                     return tuple(result)
 
2026
 */
 
2027
      D_UPDATE_TAIL(__pyx_v_self, 1);
 
2028
 
 
2029
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":185
 
2030
 *             if self.tail[0] == c'e':
 
2031
 *                 D_UPDATE_TAIL(self, 1)
 
2032
 *                 if self._yield_tuples:             # <<<<<<<<<<<<<<
 
2033
 *                     return tuple(result)
 
2034
 *                 else:
 
2035
 */
 
2036
      if (__pyx_v_self->_yield_tuples) {
 
2037
 
 
2038
        /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":186
 
2039
 *                 D_UPDATE_TAIL(self, 1)
 
2040
 *                 if self._yield_tuples:
 
2041
 *                     return tuple(result)             # <<<<<<<<<<<<<<
 
2042
 *                 else:
 
2043
 *                     return result
 
2044
 */
 
2045
        __Pyx_XDECREF(__pyx_r);
 
2046
        if (unlikely(__pyx_v_result == Py_None)) {
 
2047
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
 
2048
        }
 
2049
        __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2050
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
2051
        __pyx_r = ((PyObject *)__pyx_t_1);
 
2052
        __pyx_t_1 = 0;
852
2053
        goto __pyx_L0;
853
 
        goto __pyx_L5;
 
2054
        goto __pyx_L6;
854
2055
      }
855
2056
      /*else*/ {
856
 
        Py_INCREF(__pyx_v_result);
857
 
        __pyx_r = __pyx_v_result;
 
2057
 
 
2058
        /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":188
 
2059
 *                     return tuple(result)
 
2060
 *                 else:
 
2061
 *                     return result             # <<<<<<<<<<<<<<
 
2062
 *             else:
 
2063
 *                 # As a quick shortcut, check to see if the next object is a
 
2064
 */
 
2065
        __Pyx_XDECREF(__pyx_r);
 
2066
        __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
2067
        __pyx_r = ((PyObject *)__pyx_v_result);
858
2068
        goto __pyx_L0;
859
2069
      }
860
 
      __pyx_L5:;
861
 
      goto __pyx_L4;
 
2070
      __pyx_L6:;
 
2071
      goto __pyx_L5;
862
2072
    }
863
2073
    /*else*/ {
864
 
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_object(__pyx_v_self); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
865
 
      __pyx_2 = PyList_Append(__pyx_v_result,__pyx_1); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
866
 
      Py_DECREF(__pyx_1); __pyx_1 = 0;
 
2074
 
 
2075
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":193
 
2076
 *                 # string, since we know that won't be creating recursion
 
2077
 *                 # if self.tail[0] >= c'0' and self.tail[0] <= c'9':
 
2078
 *                 PyList_Append(result, self._decode_object())             # <<<<<<<<<<<<<<
 
2079
 * 
 
2080
 *         raise ValueError('malformed list')
 
2081
 */
 
2082
      __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2083
      __Pyx_GOTREF(__pyx_t_1);
 
2084
      __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2085
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
867
2086
    }
868
 
    __pyx_L4:;
 
2087
    __pyx_L5:;
869
2088
  }
870
2089
 
871
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":195 */
872
 
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
873
 
  Py_INCREF(__pyx_k12p);
874
 
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k12p);
875
 
  __pyx_1 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
876
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
877
 
  __Pyx_Raise(__pyx_1, 0, 0);
878
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
879
 
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
 
2090
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":195
 
2091
 *                 PyList_Append(result, self._decode_object())
 
2092
 * 
 
2093
 *         raise ValueError('malformed list')             # <<<<<<<<<<<<<<
 
2094
 * 
 
2095
 *     cdef object _decode_dict(self):
 
2096
 */
 
2097
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2098
  __Pyx_GOTREF(__pyx_t_1);
 
2099
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
 
2100
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_11));
 
2101
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
 
2102
  __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2103
  __Pyx_GOTREF(__pyx_t_4);
 
2104
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2105
  __Pyx_Raise(__pyx_t_4, 0, 0);
 
2106
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
2107
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
880
2108
 
881
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
2109
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
882
2110
  goto __pyx_L0;
883
 
  __pyx_L1:;
884
 
  Py_XDECREF(__pyx_1);
885
 
  Py_XDECREF(__pyx_3);
 
2111
  __pyx_L1_error:;
 
2112
  __Pyx_XDECREF(__pyx_t_1);
 
2113
  __Pyx_XDECREF(__pyx_t_4);
886
2114
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._decode_list");
887
2115
  __pyx_r = 0;
888
2116
  __pyx_L0:;
889
 
  Py_DECREF(__pyx_v_result);
890
 
  Py_DECREF(__pyx_v_self);
 
2117
  __Pyx_DECREF(__pyx_v_result);
 
2118
  __Pyx_XGIVEREF(__pyx_r);
 
2119
  __Pyx_RefNannyFinishContext();
891
2120
  return __pyx_r;
892
2121
}
893
2122
 
894
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_dict(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
 
2123
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":197
 
2124
 *         raise ValueError('malformed list')
 
2125
 * 
 
2126
 *     cdef object _decode_dict(self):             # <<<<<<<<<<<<<<
 
2127
 *         cdef char ch
 
2128
 * 
 
2129
 */
 
2130
 
 
2131
static  PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_dict(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *__pyx_v_self) {
895
2132
  char __pyx_v_ch;
896
2133
  PyObject *__pyx_v_result;
897
2134
  PyObject *__pyx_v_lastkey;
898
2135
  PyObject *__pyx_v_key;
899
2136
  PyObject *__pyx_v_value;
900
 
  PyObject *__pyx_r;
901
 
  PyObject *__pyx_1 = 0;
902
 
  int __pyx_2;
903
 
  PyObject *__pyx_3 = 0;
904
 
  Py_INCREF(__pyx_v_self);
905
 
  __pyx_v_result = Py_None; Py_INCREF(Py_None);
906
 
  __pyx_v_lastkey = Py_None; Py_INCREF(Py_None);
907
 
  __pyx_v_key = Py_None; Py_INCREF(Py_None);
908
 
  __pyx_v_value = Py_None; Py_INCREF(Py_None);
909
 
 
910
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":200 */
911
 
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
912
 
  Py_DECREF(__pyx_v_result);
913
 
  __pyx_v_result = __pyx_1;
914
 
  __pyx_1 = 0;
915
 
 
916
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":201 */
917
 
  Py_INCREF(Py_None);
918
 
  Py_DECREF(__pyx_v_lastkey);
 
2137
  PyObject *__pyx_r = NULL;
 
2138
  PyObject *__pyx_t_1 = NULL;
 
2139
  int __pyx_t_2;
 
2140
  int __pyx_t_3;
 
2141
  int __pyx_t_4;
 
2142
  PyObject *__pyx_t_5 = NULL;
 
2143
  __Pyx_RefNannySetupContext("_decode_dict");
 
2144
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
 
2145
  __pyx_v_lastkey = Py_None; __Pyx_INCREF(Py_None);
 
2146
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
2147
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
 
2148
 
 
2149
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":200
 
2150
 *         cdef char ch
 
2151
 * 
 
2152
 *         result = {}             # <<<<<<<<<<<<<<
 
2153
 *         lastkey = None
 
2154
 * 
 
2155
 */
 
2156
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2157
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
2158
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
 
2159
  __pyx_v_result = __pyx_t_1;
 
2160
  __pyx_t_1 = 0;
 
2161
 
 
2162
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":201
 
2163
 * 
 
2164
 *         result = {}
 
2165
 *         lastkey = None             # <<<<<<<<<<<<<<
 
2166
 * 
 
2167
 *         while self.size > 0:
 
2168
 */
 
2169
  __Pyx_INCREF(Py_None);
 
2170
  __Pyx_DECREF(__pyx_v_lastkey);
919
2171
  __pyx_v_lastkey = Py_None;
920
2172
 
921
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":203 */
 
2173
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":203
 
2174
 *         lastkey = None
 
2175
 * 
 
2176
 *         while self.size > 0:             # <<<<<<<<<<<<<<
 
2177
 *             ch = self.tail[0]
 
2178
 *             if ch == c'e':
 
2179
 */
922
2180
  while (1) {
923
 
    __pyx_2 = (__pyx_v_self->size > 0);
924
 
    if (!__pyx_2) break;
 
2181
    __pyx_t_2 = (__pyx_v_self->size > 0);
 
2182
    if (!__pyx_t_2) break;
925
2183
 
926
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":204 */
 
2184
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":204
 
2185
 * 
 
2186
 *         while self.size > 0:
 
2187
 *             ch = self.tail[0]             # <<<<<<<<<<<<<<
 
2188
 *             if ch == c'e':
 
2189
 *                 D_UPDATE_TAIL(self, 1)
 
2190
 */
927
2191
    __pyx_v_ch = (__pyx_v_self->tail[0]);
928
2192
 
929
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":205 */
930
 
    __pyx_2 = (__pyx_v_ch == 'e');
931
 
    if (__pyx_2) {
932
 
 
933
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":206 */
934
 
      D_UPDATE_TAIL(__pyx_v_self,1);
935
 
 
936
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":207 */
937
 
      Py_INCREF(__pyx_v_result);
938
 
      __pyx_r = __pyx_v_result;
 
2193
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":205
 
2194
 *         while self.size > 0:
 
2195
 *             ch = self.tail[0]
 
2196
 *             if ch == c'e':             # <<<<<<<<<<<<<<
 
2197
 *                 D_UPDATE_TAIL(self, 1)
 
2198
 *                 return result
 
2199
 */
 
2200
    __pyx_t_2 = (__pyx_v_ch == 'e');
 
2201
    if (__pyx_t_2) {
 
2202
 
 
2203
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":206
 
2204
 *             ch = self.tail[0]
 
2205
 *             if ch == c'e':
 
2206
 *                 D_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
2207
 *                 return result
 
2208
 *             else:
 
2209
 */
 
2210
      D_UPDATE_TAIL(__pyx_v_self, 1);
 
2211
 
 
2212
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":207
 
2213
 *             if ch == c'e':
 
2214
 *                 D_UPDATE_TAIL(self, 1)
 
2215
 *                 return result             # <<<<<<<<<<<<<<
 
2216
 *             else:
 
2217
 *                 # keys should be strings only
 
2218
 */
 
2219
      __Pyx_XDECREF(__pyx_r);
 
2220
      __Pyx_INCREF(((PyObject *)__pyx_v_result));
 
2221
      __pyx_r = ((PyObject *)__pyx_v_result);
939
2222
      goto __pyx_L0;
940
 
      goto __pyx_L4;
 
2223
      goto __pyx_L5;
941
2224
    }
942
2225
    /*else*/ {
943
2226
 
944
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":210 */
945
 
      __pyx_2 = ((__pyx_v_self->tail[0]) < '0');
946
 
      if (!__pyx_2) {
947
 
        __pyx_2 = ((__pyx_v_self->tail[0]) > '9');
948
 
      }
949
 
      if (__pyx_2) {
950
 
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
951
 
        Py_INCREF(__pyx_k13p);
952
 
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k13p);
953
 
        __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
954
 
        Py_DECREF(__pyx_1); __pyx_1 = 0;
955
 
        __Pyx_Raise(__pyx_3, 0, 0);
956
 
        Py_DECREF(__pyx_3); __pyx_3 = 0;
957
 
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
958
 
        goto __pyx_L5;
959
 
      }
960
 
      __pyx_L5:;
961
 
 
962
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":212 */
963
 
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_string(__pyx_v_self); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
964
 
      Py_DECREF(__pyx_v_key);
965
 
      __pyx_v_key = __pyx_1;
966
 
      __pyx_1 = 0;
967
 
 
968
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":213 */
969
 
      if (PyObject_Cmp(__pyx_v_lastkey, __pyx_v_key, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
970
 
      __pyx_2 = __pyx_2 >= 0;
971
 
      if (__pyx_2) {
972
 
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
973
 
        Py_INCREF(__pyx_k14p);
974
 
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k14p);
975
 
        __pyx_1 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
976
 
        Py_DECREF(__pyx_3); __pyx_3 = 0;
977
 
        __Pyx_Raise(__pyx_1, 0, 0);
978
 
        Py_DECREF(__pyx_1); __pyx_1 = 0;
979
 
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
 
2227
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":210
 
2228
 *             else:
 
2229
 *                 # keys should be strings only
 
2230
 *                 if self.tail[0] < c'0' or self.tail[0] > c'9':             # <<<<<<<<<<<<<<
 
2231
 *                     raise ValueError('key was not a simple string.')
 
2232
 *                 key = self._decode_string()
 
2233
 */
 
2234
      __pyx_t_2 = ((__pyx_v_self->tail[0]) < '0');
 
2235
      if (!__pyx_t_2) {
 
2236
        __pyx_t_3 = ((__pyx_v_self->tail[0]) > '9');
 
2237
        __pyx_t_4 = __pyx_t_3;
 
2238
      } else {
 
2239
        __pyx_t_4 = __pyx_t_2;
 
2240
      }
 
2241
      if (__pyx_t_4) {
 
2242
 
 
2243
        /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":211
 
2244
 *                 # keys should be strings only
 
2245
 *                 if self.tail[0] < c'0' or self.tail[0] > c'9':
 
2246
 *                     raise ValueError('key was not a simple string.')             # <<<<<<<<<<<<<<
 
2247
 *                 key = self._decode_string()
 
2248
 *                 if lastkey >= key:
 
2249
 */
 
2250
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2251
        __Pyx_GOTREF(__pyx_t_1);
 
2252
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
 
2253
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_12));
 
2254
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
 
2255
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2256
        __Pyx_GOTREF(__pyx_t_5);
 
2257
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2258
        __Pyx_Raise(__pyx_t_5, 0, 0);
 
2259
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
2260
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
980
2261
        goto __pyx_L6;
981
2262
      }
 
2263
      __pyx_L6:;
 
2264
 
 
2265
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":212
 
2266
 *                 if self.tail[0] < c'0' or self.tail[0] > c'9':
 
2267
 *                     raise ValueError('key was not a simple string.')
 
2268
 *                 key = self._decode_string()             # <<<<<<<<<<<<<<
 
2269
 *                 if lastkey >= key:
 
2270
 *                     raise ValueError('dict keys disordered')
 
2271
 */
 
2272
      __pyx_t_5 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_string(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2273
      __Pyx_GOTREF(__pyx_t_5);
 
2274
      __Pyx_DECREF(__pyx_v_key);
 
2275
      __pyx_v_key = __pyx_t_5;
 
2276
      __pyx_t_5 = 0;
 
2277
 
 
2278
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":213
 
2279
 *                     raise ValueError('key was not a simple string.')
 
2280
 *                 key = self._decode_string()
 
2281
 *                 if lastkey >= key:             # <<<<<<<<<<<<<<
 
2282
 *                     raise ValueError('dict keys disordered')
 
2283
 *                 else:
 
2284
 */
 
2285
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_lastkey, __pyx_v_key, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2286
      __Pyx_GOTREF(__pyx_t_5);
 
2287
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2288
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
2289
      if (__pyx_t_4) {
 
2290
 
 
2291
        /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":214
 
2292
 *                 key = self._decode_string()
 
2293
 *                 if lastkey >= key:
 
2294
 *                     raise ValueError('dict keys disordered')             # <<<<<<<<<<<<<<
 
2295
 *                 else:
 
2296
 *                     lastkey = key
 
2297
 */
 
2298
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2299
        __Pyx_GOTREF(__pyx_t_5);
 
2300
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
 
2301
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_13));
 
2302
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
 
2303
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2304
        __Pyx_GOTREF(__pyx_t_1);
 
2305
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
2306
        __Pyx_Raise(__pyx_t_1, 0, 0);
 
2307
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2308
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2309
        goto __pyx_L7;
 
2310
      }
982
2311
      /*else*/ {
983
 
        Py_INCREF(__pyx_v_key);
984
 
        Py_DECREF(__pyx_v_lastkey);
 
2312
 
 
2313
        /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":216
 
2314
 *                     raise ValueError('dict keys disordered')
 
2315
 *                 else:
 
2316
 *                     lastkey = key             # <<<<<<<<<<<<<<
 
2317
 *                 value = self._decode_object()
 
2318
 *                 result[key] = value
 
2319
 */
 
2320
        __Pyx_INCREF(__pyx_v_key);
 
2321
        __Pyx_DECREF(__pyx_v_lastkey);
985
2322
        __pyx_v_lastkey = __pyx_v_key;
986
2323
      }
987
 
      __pyx_L6:;
988
 
 
989
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":217 */
990
 
      __pyx_3 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_object(__pyx_v_self); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
991
 
      Py_DECREF(__pyx_v_value);
992
 
      __pyx_v_value = __pyx_3;
993
 
      __pyx_3 = 0;
994
 
 
995
 
      /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":218 */
996
 
      if (PyObject_SetItem(__pyx_v_result, __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
 
2324
      __pyx_L7:;
 
2325
 
 
2326
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":217
 
2327
 *                 else:
 
2328
 *                     lastkey = key
 
2329
 *                 value = self._decode_object()             # <<<<<<<<<<<<<<
 
2330
 *                 result[key] = value
 
2331
 * 
 
2332
 */
 
2333
      __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder *)__pyx_v_self->__pyx_vtab)->_decode_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2334
      __Pyx_GOTREF(__pyx_t_1);
 
2335
      __Pyx_DECREF(__pyx_v_value);
 
2336
      __pyx_v_value = __pyx_t_1;
 
2337
      __pyx_t_1 = 0;
 
2338
 
 
2339
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":218
 
2340
 *                     lastkey = key
 
2341
 *                 value = self._decode_object()
 
2342
 *                 result[key] = value             # <<<<<<<<<<<<<<
 
2343
 * 
 
2344
 *         raise ValueError('malformed dict')
 
2345
 */
 
2346
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
997
2347
    }
998
 
    __pyx_L4:;
 
2348
    __pyx_L5:;
999
2349
  }
1000
2350
 
1001
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":220 */
1002
 
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
1003
 
  Py_INCREF(__pyx_k15p);
1004
 
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k15p);
1005
 
  __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
1006
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1007
 
  __Pyx_Raise(__pyx_3, 0, 0);
1008
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
1009
 
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
 
2351
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":220
 
2352
 *                 result[key] = value
 
2353
 * 
 
2354
 *         raise ValueError('malformed dict')             # <<<<<<<<<<<<<<
 
2355
 * 
 
2356
 * 
 
2357
 */
 
2358
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2359
  __Pyx_GOTREF(__pyx_t_1);
 
2360
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
 
2361
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_14));
 
2362
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
 
2363
  __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2364
  __Pyx_GOTREF(__pyx_t_5);
 
2365
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2366
  __Pyx_Raise(__pyx_t_5, 0, 0);
 
2367
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
2368
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1010
2369
 
1011
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
2370
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1012
2371
  goto __pyx_L0;
1013
 
  __pyx_L1:;
1014
 
  Py_XDECREF(__pyx_1);
1015
 
  Py_XDECREF(__pyx_3);
 
2372
  __pyx_L1_error:;
 
2373
  __Pyx_XDECREF(__pyx_t_1);
 
2374
  __Pyx_XDECREF(__pyx_t_5);
1016
2375
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Decoder._decode_dict");
1017
2376
  __pyx_r = 0;
1018
2377
  __pyx_L0:;
1019
 
  Py_DECREF(__pyx_v_result);
1020
 
  Py_DECREF(__pyx_v_lastkey);
1021
 
  Py_DECREF(__pyx_v_key);
1022
 
  Py_DECREF(__pyx_v_value);
1023
 
  Py_DECREF(__pyx_v_self);
 
2378
  __Pyx_DECREF(__pyx_v_result);
 
2379
  __Pyx_DECREF(__pyx_v_lastkey);
 
2380
  __Pyx_DECREF(__pyx_v_key);
 
2381
  __Pyx_DECREF(__pyx_v_value);
 
2382
  __Pyx_XGIVEREF(__pyx_r);
 
2383
  __Pyx_RefNannyFinishContext();
1024
2384
  return __pyx_r;
1025
2385
}
1026
2386
 
1027
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bdecode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
2387
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":223
 
2388
 * 
 
2389
 * 
 
2390
 * def bdecode(object s):             # <<<<<<<<<<<<<<
 
2391
 *     """Decode string x to Python object"""
 
2392
 *     return Decoder(s).decode()
 
2393
 */
 
2394
 
 
2395
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bdecode(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
1028
2396
static char __pyx_doc_6bzrlib_12_bencode_pyx_bdecode[] = "Decode string x to Python object";
1029
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bdecode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1030
 
  PyObject *__pyx_v_s = 0;
1031
 
  PyObject *__pyx_r;
1032
 
  PyObject *__pyx_1 = 0;
1033
 
  PyObject *__pyx_2 = 0;
1034
 
  static char *__pyx_argnames[] = {"s",0};
1035
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_s)) return 0;
1036
 
  Py_INCREF(__pyx_v_s);
1037
 
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
1038
 
  Py_INCREF(__pyx_v_s);
1039
 
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_s);
1040
 
  __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_12_bencode_pyx_Decoder), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
1041
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1042
 
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_decode); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
1043
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1044
 
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
1045
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1046
 
  __pyx_r = __pyx_2;
1047
 
  __pyx_2 = 0;
1048
 
  goto __pyx_L0;
1049
 
 
1050
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
1051
 
  goto __pyx_L0;
1052
 
  __pyx_L1:;
1053
 
  Py_XDECREF(__pyx_1);
1054
 
  Py_XDECREF(__pyx_2);
 
2397
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bdecode(PyObject *__pyx_self, PyObject *__pyx_v_s) {
 
2398
  PyObject *__pyx_r = NULL;
 
2399
  PyObject *__pyx_t_1 = NULL;
 
2400
  PyObject *__pyx_t_2 = NULL;
 
2401
  __Pyx_RefNannySetupContext("bdecode");
 
2402
  __pyx_self = __pyx_self;
 
2403
 
 
2404
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":225
 
2405
 * def bdecode(object s):
 
2406
 *     """Decode string x to Python object"""
 
2407
 *     return Decoder(s).decode()             # <<<<<<<<<<<<<<
 
2408
 * 
 
2409
 * 
 
2410
 */
 
2411
  __Pyx_XDECREF(__pyx_r);
 
2412
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2413
  __Pyx_GOTREF(__pyx_t_1);
 
2414
  __Pyx_INCREF(__pyx_v_s);
 
2415
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
 
2416
  __Pyx_GIVEREF(__pyx_v_s);
 
2417
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_12_bencode_pyx_Decoder)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2418
  __Pyx_GOTREF(__pyx_t_2);
 
2419
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2420
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2421
  __Pyx_GOTREF(__pyx_t_1);
 
2422
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2423
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2424
  __Pyx_GOTREF(__pyx_t_2);
 
2425
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2426
  __pyx_r = __pyx_t_2;
 
2427
  __pyx_t_2 = 0;
 
2428
  goto __pyx_L0;
 
2429
 
 
2430
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2431
  goto __pyx_L0;
 
2432
  __pyx_L1_error:;
 
2433
  __Pyx_XDECREF(__pyx_t_1);
 
2434
  __Pyx_XDECREF(__pyx_t_2);
1055
2435
  __Pyx_AddTraceback("bzrlib._bencode_pyx.bdecode");
1056
 
  __pyx_r = 0;
 
2436
  __pyx_r = NULL;
1057
2437
  __pyx_L0:;
1058
 
  Py_DECREF(__pyx_v_s);
 
2438
  __Pyx_XGIVEREF(__pyx_r);
 
2439
  __Pyx_RefNannyFinishContext();
1059
2440
  return __pyx_r;
1060
2441
}
1061
2442
 
1062
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bdecode_as_tuple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
2443
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":228
 
2444
 * 
 
2445
 * 
 
2446
 * def bdecode_as_tuple(object s):             # <<<<<<<<<<<<<<
 
2447
 *     """Decode string x to Python object, using tuples rather than lists."""
 
2448
 *     return Decoder(s, True).decode()
 
2449
 */
 
2450
 
 
2451
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bdecode_as_tuple(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
1063
2452
static char __pyx_doc_6bzrlib_12_bencode_pyx_bdecode_as_tuple[] = "Decode string x to Python object, using tuples rather than lists.";
1064
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bdecode_as_tuple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1065
 
  PyObject *__pyx_v_s = 0;
1066
 
  PyObject *__pyx_r;
1067
 
  PyObject *__pyx_1 = 0;
1068
 
  PyObject *__pyx_2 = 0;
1069
 
  static char *__pyx_argnames[] = {"s",0};
1070
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_s)) return 0;
1071
 
  Py_INCREF(__pyx_v_s);
1072
 
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1073
 
  Py_INCREF(__pyx_v_s);
1074
 
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_s);
1075
 
  Py_INCREF(Py_True);
1076
 
  PyTuple_SET_ITEM(__pyx_1, 1, Py_True);
1077
 
  __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_12_bencode_pyx_Decoder), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1078
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1079
 
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_decode); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1080
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1081
 
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1082
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1083
 
  __pyx_r = __pyx_2;
1084
 
  __pyx_2 = 0;
1085
 
  goto __pyx_L0;
1086
 
 
1087
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
1088
 
  goto __pyx_L0;
1089
 
  __pyx_L1:;
1090
 
  Py_XDECREF(__pyx_1);
1091
 
  Py_XDECREF(__pyx_2);
 
2453
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bdecode_as_tuple(PyObject *__pyx_self, PyObject *__pyx_v_s) {
 
2454
  PyObject *__pyx_r = NULL;
 
2455
  PyObject *__pyx_t_1 = NULL;
 
2456
  PyObject *__pyx_t_2 = NULL;
 
2457
  __Pyx_RefNannySetupContext("bdecode_as_tuple");
 
2458
  __pyx_self = __pyx_self;
 
2459
 
 
2460
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":230
 
2461
 * def bdecode_as_tuple(object s):
 
2462
 *     """Decode string x to Python object, using tuples rather than lists."""
 
2463
 *     return Decoder(s, True).decode()             # <<<<<<<<<<<<<<
 
2464
 * 
 
2465
 * 
 
2466
 */
 
2467
  __Pyx_XDECREF(__pyx_r);
 
2468
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2469
  __Pyx_GOTREF(__pyx_t_1);
 
2470
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2471
  __Pyx_GOTREF(__pyx_t_2);
 
2472
  __Pyx_INCREF(__pyx_v_s);
 
2473
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
 
2474
  __Pyx_GIVEREF(__pyx_v_s);
 
2475
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
 
2476
  __Pyx_GIVEREF(__pyx_t_1);
 
2477
  __pyx_t_1 = 0;
 
2478
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_12_bencode_pyx_Decoder)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2479
  __Pyx_GOTREF(__pyx_t_1);
 
2480
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2481
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2482
  __Pyx_GOTREF(__pyx_t_2);
 
2483
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
2484
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2485
  __Pyx_GOTREF(__pyx_t_1);
 
2486
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2487
  __pyx_r = __pyx_t_1;
 
2488
  __pyx_t_1 = 0;
 
2489
  goto __pyx_L0;
 
2490
 
 
2491
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2492
  goto __pyx_L0;
 
2493
  __pyx_L1_error:;
 
2494
  __Pyx_XDECREF(__pyx_t_1);
 
2495
  __Pyx_XDECREF(__pyx_t_2);
1092
2496
  __Pyx_AddTraceback("bzrlib._bencode_pyx.bdecode_as_tuple");
1093
 
  __pyx_r = 0;
 
2497
  __pyx_r = NULL;
1094
2498
  __pyx_L0:;
1095
 
  Py_DECREF(__pyx_v_s);
 
2499
  __Pyx_XGIVEREF(__pyx_r);
 
2500
  __Pyx_RefNannyFinishContext();
1096
2501
  return __pyx_r;
1097
2502
}
1098
2503
 
1099
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_9Bencached___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1100
 
static PyMethodDef __pyx_mdef_6bzrlib_12_bencode_pyx_9Bencached___init__ = {"__init__", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_9Bencached___init__, METH_VARARGS|METH_KEYWORDS, 0};
1101
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_9Bencached___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
2504
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":236
 
2505
 *     __slots__ = ['bencoded']
 
2506
 * 
 
2507
 *     def __init__(self, s):             # <<<<<<<<<<<<<<
 
2508
 *         self.bencoded = s
 
2509
 * 
 
2510
 */
 
2511
 
 
2512
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_9Bencached___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
2513
static PyMethodDef __pyx_mdef_6bzrlib_12_bencode_pyx_9Bencached___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_9Bencached___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
 
2514
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_9Bencached___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1102
2515
  PyObject *__pyx_v_self = 0;
1103
2516
  PyObject *__pyx_v_s = 0;
1104
 
  PyObject *__pyx_r;
1105
 
  static char *__pyx_argnames[] = {"self","s",0};
1106
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_self, &__pyx_v_s)) return 0;
1107
 
  Py_INCREF(__pyx_v_self);
1108
 
  Py_INCREF(__pyx_v_s);
1109
 
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_bencoded, __pyx_v_s) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
1110
 
 
1111
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
1112
 
  goto __pyx_L0;
1113
 
  __pyx_L1:;
1114
 
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Bencached.__init__");
1115
 
  __pyx_r = 0;
1116
 
  __pyx_L0:;
1117
 
  Py_DECREF(__pyx_v_self);
1118
 
  Py_DECREF(__pyx_v_s);
1119
 
  return __pyx_r;
1120
 
}
1121
 
 
1122
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1123
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
 
2517
  PyObject *__pyx_r = NULL;
 
2518
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__s,0};
 
2519
  __Pyx_RefNannySetupContext("__init__");
 
2520
  __pyx_self = __pyx_self;
 
2521
  if (unlikely(__pyx_kwds)) {
 
2522
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
2523
    PyObject* values[2] = {0,0};
 
2524
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2525
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
 
2526
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
2527
      case  0: break;
 
2528
      default: goto __pyx_L5_argtuple_error;
 
2529
    }
 
2530
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2531
      case  0:
 
2532
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
 
2533
      if (likely(values[0])) kw_args--;
 
2534
      else goto __pyx_L5_argtuple_error;
 
2535
      case  1:
 
2536
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
 
2537
      if (likely(values[1])) kw_args--;
 
2538
      else {
 
2539
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2540
      }
 
2541
    }
 
2542
    if (unlikely(kw_args > 0)) {
 
2543
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2544
    }
 
2545
    __pyx_v_self = values[0];
 
2546
    __pyx_v_s = values[1];
 
2547
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
 
2548
    goto __pyx_L5_argtuple_error;
 
2549
  } else {
 
2550
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
 
2551
    __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 1);
 
2552
  }
 
2553
  goto __pyx_L4_argument_unpacking_done;
 
2554
  __pyx_L5_argtuple_error:;
 
2555
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2556
  __pyx_L3_error:;
 
2557
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Bencached.__init__");
 
2558
  __Pyx_RefNannyFinishContext();
 
2559
  return NULL;
 
2560
  __pyx_L4_argument_unpacking_done:;
 
2561
 
 
2562
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":237
 
2563
 * 
 
2564
 *     def __init__(self, s):
 
2565
 *         self.bencoded = s             # <<<<<<<<<<<<<<
 
2566
 * 
 
2567
 * 
 
2568
 */
 
2569
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__bencoded, __pyx_v_s) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2570
 
 
2571
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2572
  goto __pyx_L0;
 
2573
  __pyx_L1_error:;
 
2574
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Bencached.__init__");
 
2575
  __pyx_r = NULL;
 
2576
  __pyx_L0:;
 
2577
  __Pyx_XGIVEREF(__pyx_r);
 
2578
  __Pyx_RefNannyFinishContext();
 
2579
  return __pyx_r;
 
2580
}
 
2581
 
 
2582
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":248
 
2583
 *     """Bencode encoder"""
 
2584
 * 
 
2585
 *     cdef readonly char *tail             # <<<<<<<<<<<<<<
 
2586
 *     cdef readonly int size
 
2587
 *     cdef readonly char *buffer
 
2588
 */
 
2589
 
 
2590
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4tail___get__(PyObject *__pyx_v_self); /*proto*/
 
2591
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4tail___get__(PyObject *__pyx_v_self) {
 
2592
  PyObject *__pyx_r = NULL;
 
2593
  PyObject *__pyx_t_1 = NULL;
 
2594
  __Pyx_RefNannySetupContext("__get__");
 
2595
  __Pyx_XDECREF(__pyx_r);
 
2596
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2597
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
2598
  __pyx_r = ((PyObject *)__pyx_t_1);
 
2599
  __pyx_t_1 = 0;
 
2600
  goto __pyx_L0;
 
2601
 
 
2602
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2603
  goto __pyx_L0;
 
2604
  __pyx_L1_error:;
 
2605
  __Pyx_XDECREF(__pyx_t_1);
 
2606
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.tail.__get__");
 
2607
  __pyx_r = NULL;
 
2608
  __pyx_L0:;
 
2609
  __Pyx_XGIVEREF(__pyx_r);
 
2610
  __Pyx_RefNannyFinishContext();
 
2611
  return __pyx_r;
 
2612
}
 
2613
 
 
2614
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":249
 
2615
 * 
 
2616
 *     cdef readonly char *tail
 
2617
 *     cdef readonly int size             # <<<<<<<<<<<<<<
 
2618
 *     cdef readonly char *buffer
 
2619
 *     cdef readonly int maxsize
 
2620
 */
 
2621
 
 
2622
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4size___get__(PyObject *__pyx_v_self); /*proto*/
 
2623
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4size___get__(PyObject *__pyx_v_self) {
 
2624
  PyObject *__pyx_r = NULL;
 
2625
  PyObject *__pyx_t_1 = NULL;
 
2626
  __Pyx_RefNannySetupContext("__get__");
 
2627
  __Pyx_XDECREF(__pyx_r);
 
2628
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2629
  __Pyx_GOTREF(__pyx_t_1);
 
2630
  __pyx_r = __pyx_t_1;
 
2631
  __pyx_t_1 = 0;
 
2632
  goto __pyx_L0;
 
2633
 
 
2634
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2635
  goto __pyx_L0;
 
2636
  __pyx_L1_error:;
 
2637
  __Pyx_XDECREF(__pyx_t_1);
 
2638
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.size.__get__");
 
2639
  __pyx_r = NULL;
 
2640
  __pyx_L0:;
 
2641
  __Pyx_XGIVEREF(__pyx_r);
 
2642
  __Pyx_RefNannyFinishContext();
 
2643
  return __pyx_r;
 
2644
}
 
2645
 
 
2646
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":250
 
2647
 *     cdef readonly char *tail
 
2648
 *     cdef readonly int size
 
2649
 *     cdef readonly char *buffer             # <<<<<<<<<<<<<<
 
2650
 *     cdef readonly int maxsize
 
2651
 * 
 
2652
 */
 
2653
 
 
2654
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_6buffer___get__(PyObject *__pyx_v_self); /*proto*/
 
2655
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_6buffer___get__(PyObject *__pyx_v_self) {
 
2656
  PyObject *__pyx_r = NULL;
 
2657
  PyObject *__pyx_t_1 = NULL;
 
2658
  __Pyx_RefNannySetupContext("__get__");
 
2659
  __Pyx_XDECREF(__pyx_r);
 
2660
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2661
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
2662
  __pyx_r = ((PyObject *)__pyx_t_1);
 
2663
  __pyx_t_1 = 0;
 
2664
  goto __pyx_L0;
 
2665
 
 
2666
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2667
  goto __pyx_L0;
 
2668
  __pyx_L1_error:;
 
2669
  __Pyx_XDECREF(__pyx_t_1);
 
2670
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.buffer.__get__");
 
2671
  __pyx_r = NULL;
 
2672
  __pyx_L0:;
 
2673
  __Pyx_XGIVEREF(__pyx_r);
 
2674
  __Pyx_RefNannyFinishContext();
 
2675
  return __pyx_r;
 
2676
}
 
2677
 
 
2678
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":251
 
2679
 *     cdef readonly int size
 
2680
 *     cdef readonly char *buffer
 
2681
 *     cdef readonly int maxsize             # <<<<<<<<<<<<<<
 
2682
 * 
 
2683
 *     def __init__(self, int maxsize=INITSIZE):
 
2684
 */
 
2685
 
 
2686
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_7maxsize___get__(PyObject *__pyx_v_self); /*proto*/
 
2687
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_7maxsize___get__(PyObject *__pyx_v_self) {
 
2688
  PyObject *__pyx_r = NULL;
 
2689
  PyObject *__pyx_t_1 = NULL;
 
2690
  __Pyx_RefNannySetupContext("__get__");
 
2691
  __Pyx_XDECREF(__pyx_r);
 
2692
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->maxsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2693
  __Pyx_GOTREF(__pyx_t_1);
 
2694
  __pyx_r = __pyx_t_1;
 
2695
  __pyx_t_1 = 0;
 
2696
  goto __pyx_L0;
 
2697
 
 
2698
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
2699
  goto __pyx_L0;
 
2700
  __pyx_L1_error:;
 
2701
  __Pyx_XDECREF(__pyx_t_1);
 
2702
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.maxsize.__get__");
 
2703
  __pyx_r = NULL;
 
2704
  __pyx_L0:;
 
2705
  __Pyx_XGIVEREF(__pyx_r);
 
2706
  __Pyx_RefNannyFinishContext();
 
2707
  return __pyx_r;
 
2708
}
 
2709
 
 
2710
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":253
 
2711
 *     cdef readonly int maxsize
 
2712
 * 
 
2713
 *     def __init__(self, int maxsize=INITSIZE):             # <<<<<<<<<<<<<<
 
2714
 *         """Initialize encoder engine
 
2715
 *         @param  maxsize:    initial size of internal char buffer
 
2716
 */
 
2717
 
 
2718
static int __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
2719
static char __pyx_doc_6bzrlib_12_bencode_pyx_7Encoder___init__[] = "Initialize encoder engine\n        @param  maxsize:    initial size of internal char buffer\n        ";
 
2720
struct wrapperbase __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Encoder___init__;
 
2721
static int __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1124
2722
  int __pyx_v_maxsize;
1125
2723
  char *__pyx_v_p;
1126
2724
  int __pyx_r;
1127
 
  int __pyx_1;
1128
 
  PyObject *__pyx_2 = 0;
1129
 
  PyObject *__pyx_3 = 0;
1130
 
  static char *__pyx_argnames[] = {"maxsize",0};
1131
 
  __pyx_v_maxsize = __pyx_d2;
1132
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|i", __pyx_argnames, &__pyx_v_maxsize)) return -1;
1133
 
  Py_INCREF(__pyx_v_self);
 
2725
  int __pyx_t_1;
 
2726
  PyObject *__pyx_t_2 = NULL;
 
2727
  PyObject *__pyx_t_3 = NULL;
 
2728
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__maxsize,0};
 
2729
  __Pyx_RefNannySetupContext("__init__");
 
2730
  if (unlikely(__pyx_kwds)) {
 
2731
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
 
2732
    PyObject* values[1] = {0};
 
2733
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2734
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
 
2735
      case  0: break;
 
2736
      default: goto __pyx_L5_argtuple_error;
 
2737
    }
 
2738
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2739
      case  0:
 
2740
      if (kw_args > 0) {
 
2741
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__maxsize);
 
2742
        if (value) { values[0] = value; kw_args--; }
 
2743
      }
 
2744
    }
 
2745
    if (unlikely(kw_args > 0)) {
 
2746
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2747
    }
 
2748
    if (values[0]) {
 
2749
      __pyx_v_maxsize = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_maxsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2750
    } else {
 
2751
      __pyx_v_maxsize = __pyx_k_15;
 
2752
    }
 
2753
  } else {
 
2754
    __pyx_v_maxsize = __pyx_k_15;
 
2755
    switch (PyTuple_GET_SIZE(__pyx_args)) {
 
2756
      case  1: __pyx_v_maxsize = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_maxsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2757
      case  0: break;
 
2758
      default: goto __pyx_L5_argtuple_error;
 
2759
    }
 
2760
  }
 
2761
  goto __pyx_L4_argument_unpacking_done;
 
2762
  __pyx_L5_argtuple_error:;
 
2763
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
 
2764
  __pyx_L3_error:;
 
2765
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.__init__");
 
2766
  __Pyx_RefNannyFinishContext();
 
2767
  return -1;
 
2768
  __pyx_L4_argument_unpacking_done:;
1134
2769
 
1135
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":259 */
 
2770
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":259
 
2771
 *         cdef char *p
 
2772
 * 
 
2773
 *         self.maxsize = 0             # <<<<<<<<<<<<<<
 
2774
 *         self.size = 0
 
2775
 *         self.tail = NULL
 
2776
 */
1136
2777
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->maxsize = 0;
1137
2778
 
1138
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":260 */
 
2779
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":260
 
2780
 * 
 
2781
 *         self.maxsize = 0
 
2782
 *         self.size = 0             # <<<<<<<<<<<<<<
 
2783
 *         self.tail = NULL
 
2784
 * 
 
2785
 */
1139
2786
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size = 0;
1140
2787
 
1141
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":261 */
 
2788
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":261
 
2789
 *         self.maxsize = 0
 
2790
 *         self.size = 0
 
2791
 *         self.tail = NULL             # <<<<<<<<<<<<<<
 
2792
 * 
 
2793
 *         p = <char*>malloc(maxsize)
 
2794
 */
1142
2795
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->tail = NULL;
1143
2796
 
1144
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":263 */
 
2797
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":263
 
2798
 *         self.tail = NULL
 
2799
 * 
 
2800
 *         p = <char*>malloc(maxsize)             # <<<<<<<<<<<<<<
 
2801
 *         if p == NULL:
 
2802
 *             raise MemoryError('Not enough memory to allocate buffer '
 
2803
 */
1145
2804
  __pyx_v_p = ((char *)malloc(__pyx_v_maxsize));
1146
2805
 
1147
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":264 */
1148
 
  __pyx_1 = (__pyx_v_p == NULL);
1149
 
  if (__pyx_1) {
1150
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
1151
 
    Py_INCREF(__pyx_k18p);
1152
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k18p);
1153
 
    __pyx_3 = PyObject_CallObject(PyExc_MemoryError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
1154
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1155
 
    __Pyx_Raise(__pyx_3, 0, 0);
1156
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1157
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
1158
 
    goto __pyx_L2;
 
2806
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":264
 
2807
 * 
 
2808
 *         p = <char*>malloc(maxsize)
 
2809
 *         if p == NULL:             # <<<<<<<<<<<<<<
 
2810
 *             raise MemoryError('Not enough memory to allocate buffer '
 
2811
 *                               'for encoder')
 
2812
 */
 
2813
  __pyx_t_1 = (__pyx_v_p == NULL);
 
2814
  if (__pyx_t_1) {
 
2815
 
 
2816
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":265
 
2817
 *         p = <char*>malloc(maxsize)
 
2818
 *         if p == NULL:
 
2819
 *             raise MemoryError('Not enough memory to allocate buffer '             # <<<<<<<<<<<<<<
 
2820
 *                               'for encoder')
 
2821
 *         self.buffer = p
 
2822
 */
 
2823
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2824
    __Pyx_GOTREF(__pyx_t_2);
 
2825
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
 
2826
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_16));
 
2827
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
 
2828
    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2829
    __Pyx_GOTREF(__pyx_t_3);
 
2830
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
2831
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
2832
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
2833
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2834
    goto __pyx_L6;
1159
2835
  }
1160
 
  __pyx_L2:;
 
2836
  __pyx_L6:;
1161
2837
 
1162
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":267 */
 
2838
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":267
 
2839
 *             raise MemoryError('Not enough memory to allocate buffer '
 
2840
 *                               'for encoder')
 
2841
 *         self.buffer = p             # <<<<<<<<<<<<<<
 
2842
 *         self.maxsize = maxsize
 
2843
 *         self.tail = p
 
2844
 */
1163
2845
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer = __pyx_v_p;
1164
2846
 
1165
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":268 */
 
2847
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":268
 
2848
 *                               'for encoder')
 
2849
 *         self.buffer = p
 
2850
 *         self.maxsize = maxsize             # <<<<<<<<<<<<<<
 
2851
 *         self.tail = p
 
2852
 * 
 
2853
 */
1166
2854
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->maxsize = __pyx_v_maxsize;
1167
2855
 
1168
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":269 */
 
2856
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":269
 
2857
 *         self.buffer = p
 
2858
 *         self.maxsize = maxsize
 
2859
 *         self.tail = p             # <<<<<<<<<<<<<<
 
2860
 * 
 
2861
 *     def __dealloc__(self):
 
2862
 */
1169
2863
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->tail = __pyx_v_p;
1170
2864
 
1171
2865
  __pyx_r = 0;
1172
2866
  goto __pyx_L0;
1173
 
  __pyx_L1:;
1174
 
  Py_XDECREF(__pyx_2);
1175
 
  Py_XDECREF(__pyx_3);
 
2867
  __pyx_L1_error:;
 
2868
  __Pyx_XDECREF(__pyx_t_2);
 
2869
  __Pyx_XDECREF(__pyx_t_3);
1176
2870
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.__init__");
1177
2871
  __pyx_r = -1;
1178
2872
  __pyx_L0:;
1179
 
  Py_DECREF(__pyx_v_self);
 
2873
  __Pyx_RefNannyFinishContext();
1180
2874
  return __pyx_r;
1181
2875
}
1182
2876
 
1183
 
static void __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(PyObject *__pyx_v_self); /*proto*/
1184
 
static void __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(PyObject *__pyx_v_self) {
1185
 
  Py_INCREF(__pyx_v_self);
1186
 
 
1187
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":272 */
 
2877
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":271
 
2878
 *         self.tail = p
 
2879
 * 
 
2880
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 
2881
 *         free(self.buffer)
 
2882
 *         self.buffer = NULL
 
2883
 */
 
2884
 
 
2885
static void __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(PyObject *__pyx_v_self); /*proto*/
 
2886
static void __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(PyObject *__pyx_v_self) {
 
2887
  __Pyx_RefNannySetupContext("__dealloc__");
 
2888
 
 
2889
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":272
 
2890
 * 
 
2891
 *     def __dealloc__(self):
 
2892
 *         free(self.buffer)             # <<<<<<<<<<<<<<
 
2893
 *         self.buffer = NULL
 
2894
 *         self.maxsize = 0
 
2895
 */
1188
2896
  free(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer);
1189
2897
 
1190
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":273 */
 
2898
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":273
 
2899
 *     def __dealloc__(self):
 
2900
 *         free(self.buffer)
 
2901
 *         self.buffer = NULL             # <<<<<<<<<<<<<<
 
2902
 *         self.maxsize = 0
 
2903
 * 
 
2904
 */
1191
2905
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer = NULL;
1192
2906
 
1193
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":274 */
 
2907
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":274
 
2908
 *         free(self.buffer)
 
2909
 *         self.buffer = NULL
 
2910
 *         self.maxsize = 0             # <<<<<<<<<<<<<<
 
2911
 * 
 
2912
 *     def __str__(self):
 
2913
 */
1194
2914
  ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->maxsize = 0;
1195
2915
 
1196
 
  Py_DECREF(__pyx_v_self);
 
2916
  __Pyx_RefNannyFinishContext();
1197
2917
}
1198
2918
 
1199
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Encoder___str__(PyObject *__pyx_v_self); /*proto*/
1200
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Encoder___str__(PyObject *__pyx_v_self) {
1201
 
  PyObject *__pyx_r;
1202
 
  int __pyx_1;
1203
 
  PyObject *__pyx_2 = 0;
1204
 
  Py_INCREF(__pyx_v_self);
1205
 
  __pyx_1 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer != NULL);
1206
 
  if (__pyx_1) {
1207
 
    __pyx_1 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size != 0);
 
2919
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":276
 
2920
 *         self.maxsize = 0
 
2921
 * 
 
2922
 *     def __str__(self):             # <<<<<<<<<<<<<<
 
2923
 *         if self.buffer != NULL and self.size != 0:
 
2924
 *             return PyString_FromStringAndSize(self.buffer, self.size)
 
2925
 */
 
2926
 
 
2927
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___str__(PyObject *__pyx_v_self); /*proto*/
 
2928
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___str__(PyObject *__pyx_v_self) {
 
2929
  PyObject *__pyx_r = NULL;
 
2930
  int __pyx_t_1;
 
2931
  int __pyx_t_2;
 
2932
  int __pyx_t_3;
 
2933
  PyObject *__pyx_t_4 = NULL;
 
2934
  __Pyx_RefNannySetupContext("__str__");
 
2935
 
 
2936
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":277
 
2937
 * 
 
2938
 *     def __str__(self):
 
2939
 *         if self.buffer != NULL and self.size != 0:             # <<<<<<<<<<<<<<
 
2940
 *             return PyString_FromStringAndSize(self.buffer, self.size)
 
2941
 *         else:
 
2942
 */
 
2943
  __pyx_t_1 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer != NULL);
 
2944
  if (__pyx_t_1) {
 
2945
    __pyx_t_2 = (((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size != 0);
 
2946
    __pyx_t_3 = __pyx_t_2;
 
2947
  } else {
 
2948
    __pyx_t_3 = __pyx_t_1;
1208
2949
  }
1209
 
  if (__pyx_1) {
1210
 
    __pyx_2 = PyString_FromStringAndSize(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer,((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
1211
 
    __pyx_r = __pyx_2;
1212
 
    __pyx_2 = 0;
 
2950
  if (__pyx_t_3) {
 
2951
 
 
2952
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":278
 
2953
 *     def __str__(self):
 
2954
 *         if self.buffer != NULL and self.size != 0:
 
2955
 *             return PyString_FromStringAndSize(self.buffer, self.size)             # <<<<<<<<<<<<<<
 
2956
 *         else:
 
2957
 *             return ''
 
2958
 */
 
2959
    __Pyx_XDECREF(__pyx_r);
 
2960
    __pyx_t_4 = PyString_FromStringAndSize(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->buffer, ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
2961
    __Pyx_GOTREF(__pyx_t_4);
 
2962
    __pyx_r = __pyx_t_4;
 
2963
    __pyx_t_4 = 0;
1213
2964
    goto __pyx_L0;
1214
 
    goto __pyx_L2;
 
2965
    goto __pyx_L5;
1215
2966
  }
1216
2967
  /*else*/ {
1217
 
    Py_INCREF(__pyx_k10p);
1218
 
    __pyx_r = __pyx_k10p;
 
2968
 
 
2969
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":280
 
2970
 *             return PyString_FromStringAndSize(self.buffer, self.size)
 
2971
 *         else:
 
2972
 *             return ''             # <<<<<<<<<<<<<<
 
2973
 * 
 
2974
 *     cdef int _ensure_buffer(self, int required) except 0:
 
2975
 */
 
2976
    __Pyx_XDECREF(__pyx_r);
 
2977
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
 
2978
    __pyx_r = ((PyObject *)__pyx_kp_s_9);
1219
2979
    goto __pyx_L0;
1220
2980
  }
1221
 
  __pyx_L2:;
 
2981
  __pyx_L5:;
1222
2982
 
1223
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
2983
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1224
2984
  goto __pyx_L0;
1225
 
  __pyx_L1:;
1226
 
  Py_XDECREF(__pyx_2);
 
2985
  __pyx_L1_error:;
 
2986
  __Pyx_XDECREF(__pyx_t_4);
1227
2987
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.__str__");
1228
 
  __pyx_r = 0;
 
2988
  __pyx_r = NULL;
1229
2989
  __pyx_L0:;
1230
 
  Py_DECREF(__pyx_v_self);
 
2990
  __Pyx_XGIVEREF(__pyx_r);
 
2991
  __Pyx_RefNannyFinishContext();
1231
2992
  return __pyx_r;
1232
2993
}
1233
2994
 
1234
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__ensure_buffer(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,int __pyx_v_required) {
 
2995
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":282
 
2996
 *             return ''
 
2997
 * 
 
2998
 *     cdef int _ensure_buffer(self, int required) except 0:             # <<<<<<<<<<<<<<
 
2999
 *         """Ensure that tail of CharTail buffer has enough size.
 
3000
 *         If buffer is not big enough then function try to
 
3001
 */
 
3002
 
 
3003
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__ensure_buffer(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, int __pyx_v_required) {
1235
3004
  char *__pyx_v_new_buffer;
1236
3005
  int __pyx_v_new_size;
1237
3006
  int __pyx_r;
1238
 
  int __pyx_1;
1239
 
  PyObject *__pyx_2 = 0;
1240
 
  PyObject *__pyx_3 = 0;
1241
 
  Py_INCREF(__pyx_v_self);
1242
 
 
1243
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":290 */
1244
 
  __pyx_1 = ((__pyx_v_self->size + __pyx_v_required) < __pyx_v_self->maxsize);
1245
 
  if (__pyx_1) {
 
3007
  int __pyx_t_1;
 
3008
  PyObject *__pyx_t_2 = NULL;
 
3009
  PyObject *__pyx_t_3 = NULL;
 
3010
  __Pyx_RefNannySetupContext("_ensure_buffer");
 
3011
 
 
3012
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":290
 
3013
 *         cdef int   new_size
 
3014
 * 
 
3015
 *         if self.size + required < self.maxsize:             # <<<<<<<<<<<<<<
 
3016
 *             return 1
 
3017
 * 
 
3018
 */
 
3019
  __pyx_t_1 = ((__pyx_v_self->size + __pyx_v_required) < __pyx_v_self->maxsize);
 
3020
  if (__pyx_t_1) {
 
3021
 
 
3022
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":291
 
3023
 * 
 
3024
 *         if self.size + required < self.maxsize:
 
3025
 *             return 1             # <<<<<<<<<<<<<<
 
3026
 * 
 
3027
 *         new_size = self.maxsize
 
3028
 */
1246
3029
    __pyx_r = 1;
1247
3030
    goto __pyx_L0;
1248
 
    goto __pyx_L2;
 
3031
    goto __pyx_L3;
1249
3032
  }
1250
 
  __pyx_L2:;
 
3033
  __pyx_L3:;
1251
3034
 
1252
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":293 */
 
3035
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":293
 
3036
 *             return 1
 
3037
 * 
 
3038
 *         new_size = self.maxsize             # <<<<<<<<<<<<<<
 
3039
 *         while new_size < self.size + required:
 
3040
 *             new_size = new_size * 2
 
3041
 */
1253
3042
  __pyx_v_new_size = __pyx_v_self->maxsize;
1254
3043
 
1255
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":294 */
 
3044
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":294
 
3045
 * 
 
3046
 *         new_size = self.maxsize
 
3047
 *         while new_size < self.size + required:             # <<<<<<<<<<<<<<
 
3048
 *             new_size = new_size * 2
 
3049
 *         new_buffer = <char*>realloc(self.buffer, <size_t>new_size)
 
3050
 */
1256
3051
  while (1) {
1257
 
    __pyx_1 = (__pyx_v_new_size < (__pyx_v_self->size + __pyx_v_required));
1258
 
    if (!__pyx_1) break;
 
3052
    __pyx_t_1 = (__pyx_v_new_size < (__pyx_v_self->size + __pyx_v_required));
 
3053
    if (!__pyx_t_1) break;
 
3054
 
 
3055
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":295
 
3056
 *         new_size = self.maxsize
 
3057
 *         while new_size < self.size + required:
 
3058
 *             new_size = new_size * 2             # <<<<<<<<<<<<<<
 
3059
 *         new_buffer = <char*>realloc(self.buffer, <size_t>new_size)
 
3060
 *         if new_buffer == NULL:
 
3061
 */
1259
3062
    __pyx_v_new_size = (__pyx_v_new_size * 2);
1260
3063
  }
1261
3064
 
1262
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":296 */
1263
 
  __pyx_v_new_buffer = ((char *)realloc(__pyx_v_self->buffer,__pyx_v_new_size));
1264
 
 
1265
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":297 */
1266
 
  __pyx_1 = (__pyx_v_new_buffer == NULL);
1267
 
  if (__pyx_1) {
1268
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
1269
 
    Py_INCREF(__pyx_k19p);
1270
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k19p);
1271
 
    __pyx_3 = PyObject_CallObject(PyExc_MemoryError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
1272
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1273
 
    __Pyx_Raise(__pyx_3, 0, 0);
1274
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1275
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
1276
 
    goto __pyx_L5;
 
3065
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":296
 
3066
 *         while new_size < self.size + required:
 
3067
 *             new_size = new_size * 2
 
3068
 *         new_buffer = <char*>realloc(self.buffer, <size_t>new_size)             # <<<<<<<<<<<<<<
 
3069
 *         if new_buffer == NULL:
 
3070
 *             raise MemoryError('Cannot realloc buffer for encoder')
 
3071
 */
 
3072
  __pyx_v_new_buffer = ((char *)realloc(__pyx_v_self->buffer, ((size_t)__pyx_v_new_size)));
 
3073
 
 
3074
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":297
 
3075
 *             new_size = new_size * 2
 
3076
 *         new_buffer = <char*>realloc(self.buffer, <size_t>new_size)
 
3077
 *         if new_buffer == NULL:             # <<<<<<<<<<<<<<
 
3078
 *             raise MemoryError('Cannot realloc buffer for encoder')
 
3079
 * 
 
3080
 */
 
3081
  __pyx_t_1 = (__pyx_v_new_buffer == NULL);
 
3082
  if (__pyx_t_1) {
 
3083
 
 
3084
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":298
 
3085
 *         new_buffer = <char*>realloc(self.buffer, <size_t>new_size)
 
3086
 *         if new_buffer == NULL:
 
3087
 *             raise MemoryError('Cannot realloc buffer for encoder')             # <<<<<<<<<<<<<<
 
3088
 * 
 
3089
 *         self.buffer = new_buffer
 
3090
 */
 
3091
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3092
    __Pyx_GOTREF(__pyx_t_2);
 
3093
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
 
3094
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_17));
 
3095
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
 
3096
    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3097
    __Pyx_GOTREF(__pyx_t_3);
 
3098
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3099
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
3100
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3101
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3102
    goto __pyx_L6;
1277
3103
  }
1278
 
  __pyx_L5:;
 
3104
  __pyx_L6:;
1279
3105
 
1280
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":300 */
 
3106
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":300
 
3107
 *             raise MemoryError('Cannot realloc buffer for encoder')
 
3108
 * 
 
3109
 *         self.buffer = new_buffer             # <<<<<<<<<<<<<<
 
3110
 *         self.maxsize = new_size
 
3111
 *         self.tail = &new_buffer[self.size]
 
3112
 */
1281
3113
  __pyx_v_self->buffer = __pyx_v_new_buffer;
1282
3114
 
1283
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":301 */
 
3115
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":301
 
3116
 * 
 
3117
 *         self.buffer = new_buffer
 
3118
 *         self.maxsize = new_size             # <<<<<<<<<<<<<<
 
3119
 *         self.tail = &new_buffer[self.size]
 
3120
 *         return 1
 
3121
 */
1284
3122
  __pyx_v_self->maxsize = __pyx_v_new_size;
1285
3123
 
1286
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":302 */
 
3124
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":302
 
3125
 *         self.buffer = new_buffer
 
3126
 *         self.maxsize = new_size
 
3127
 *         self.tail = &new_buffer[self.size]             # <<<<<<<<<<<<<<
 
3128
 *         return 1
 
3129
 * 
 
3130
 */
1287
3131
  __pyx_v_self->tail = (&(__pyx_v_new_buffer[__pyx_v_self->size]));
1288
3132
 
1289
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":303 */
 
3133
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":303
 
3134
 *         self.maxsize = new_size
 
3135
 *         self.tail = &new_buffer[self.size]
 
3136
 *         return 1             # <<<<<<<<<<<<<<
 
3137
 * 
 
3138
 *     cdef int _encode_int(self, int x) except 0:
 
3139
 */
1290
3140
  __pyx_r = 1;
1291
3141
  goto __pyx_L0;
1292
3142
 
1293
3143
  __pyx_r = 0;
1294
3144
  goto __pyx_L0;
1295
 
  __pyx_L1:;
1296
 
  Py_XDECREF(__pyx_2);
1297
 
  Py_XDECREF(__pyx_3);
 
3145
  __pyx_L1_error:;
 
3146
  __Pyx_XDECREF(__pyx_t_2);
 
3147
  __Pyx_XDECREF(__pyx_t_3);
1298
3148
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._ensure_buffer");
1299
3149
  __pyx_r = 0;
1300
3150
  __pyx_L0:;
1301
 
  Py_DECREF(__pyx_v_self);
 
3151
  __Pyx_RefNannyFinishContext();
1302
3152
  return __pyx_r;
1303
3153
}
1304
3154
 
1305
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_int(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,int __pyx_v_x) {
 
3155
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":305
 
3156
 *         return 1
 
3157
 * 
 
3158
 *     cdef int _encode_int(self, int x) except 0:             # <<<<<<<<<<<<<<
 
3159
 *         """Encode int to bencode string iNNNe
 
3160
 *         @param  x:  value to encode
 
3161
 */
 
3162
 
 
3163
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_int(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, int __pyx_v_x) {
1306
3164
  int __pyx_v_n;
1307
3165
  int __pyx_r;
1308
 
  int __pyx_1;
1309
 
  PyObject *__pyx_2 = 0;
1310
 
  PyObject *__pyx_3 = 0;
1311
 
  Py_INCREF(__pyx_v_self);
1312
 
 
1313
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":310 */
1314
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,__pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
1315
 
 
1316
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":311 */
1317
 
  __pyx_v_n = snprintf(__pyx_v_self->tail,__pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE,__pyx_k20,__pyx_v_x);
1318
 
 
1319
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":312 */
1320
 
  __pyx_1 = (__pyx_v_n < 0);
1321
 
  if (__pyx_1) {
1322
 
    __pyx_2 = PyInt_FromLong(__pyx_v_x); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
1323
 
    __pyx_3 = PyNumber_Remainder(__pyx_k21p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
1324
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1325
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
1326
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
1327
 
    __pyx_3 = 0;
1328
 
    __pyx_3 = PyObject_CallObject(PyExc_MemoryError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
1329
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1330
 
    __Pyx_Raise(__pyx_3, 0, 0);
1331
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1332
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
1333
 
    goto __pyx_L2;
 
3166
  int __pyx_t_1;
 
3167
  int __pyx_t_2;
 
3168
  PyObject *__pyx_t_3 = NULL;
 
3169
  PyObject *__pyx_t_4 = NULL;
 
3170
  __Pyx_RefNannySetupContext("_encode_int");
 
3171
 
 
3172
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":310
 
3173
 *         """
 
3174
 *         cdef int n
 
3175
 *         self._ensure_buffer(INT_BUF_SIZE)             # <<<<<<<<<<<<<<
 
3176
 *         n = snprintf(self.tail, INT_BUF_SIZE, "i%de", x)
 
3177
 *         if n < 0:
 
3178
 */
 
3179
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3180
 
 
3181
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":311
 
3182
 *         cdef int n
 
3183
 *         self._ensure_buffer(INT_BUF_SIZE)
 
3184
 *         n = snprintf(self.tail, INT_BUF_SIZE, "i%de", x)             # <<<<<<<<<<<<<<
 
3185
 *         if n < 0:
 
3186
 *             raise MemoryError('int %d too big to encode' % x)
 
3187
 */
 
3188
  __pyx_v_n = snprintf(__pyx_v_self->tail, __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE, __pyx_k_18, __pyx_v_x);
 
3189
 
 
3190
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":312
 
3191
 *         self._ensure_buffer(INT_BUF_SIZE)
 
3192
 *         n = snprintf(self.tail, INT_BUF_SIZE, "i%de", x)
 
3193
 *         if n < 0:             # <<<<<<<<<<<<<<
 
3194
 *             raise MemoryError('int %d too big to encode' % x)
 
3195
 *         E_UPDATE_TAIL(self, n)
 
3196
 */
 
3197
  __pyx_t_2 = (__pyx_v_n < 0);
 
3198
  if (__pyx_t_2) {
 
3199
 
 
3200
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":313
 
3201
 *         n = snprintf(self.tail, INT_BUF_SIZE, "i%de", x)
 
3202
 *         if n < 0:
 
3203
 *             raise MemoryError('int %d too big to encode' % x)             # <<<<<<<<<<<<<<
 
3204
 *         E_UPDATE_TAIL(self, n)
 
3205
 *         return 1
 
3206
 */
 
3207
    __pyx_t_3 = PyInt_FromLong(__pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3208
    __Pyx_GOTREF(__pyx_t_3);
 
3209
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3210
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
3211
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3212
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3213
    __Pyx_GOTREF(__pyx_t_3);
 
3214
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
 
3215
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
 
3216
    __pyx_t_4 = 0;
 
3217
    __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3218
    __Pyx_GOTREF(__pyx_t_4);
 
3219
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3220
    __Pyx_Raise(__pyx_t_4, 0, 0);
 
3221
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3222
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3223
    goto __pyx_L3;
1334
3224
  }
1335
 
  __pyx_L2:;
1336
 
 
1337
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":314 */
1338
 
  E_UPDATE_TAIL(__pyx_v_self,__pyx_v_n);
1339
 
 
1340
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":315 */
 
3225
  __pyx_L3:;
 
3226
 
 
3227
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":314
 
3228
 *         if n < 0:
 
3229
 *             raise MemoryError('int %d too big to encode' % x)
 
3230
 *         E_UPDATE_TAIL(self, n)             # <<<<<<<<<<<<<<
 
3231
 *         return 1
 
3232
 * 
 
3233
 */
 
3234
  E_UPDATE_TAIL(__pyx_v_self, __pyx_v_n);
 
3235
 
 
3236
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":315
 
3237
 *             raise MemoryError('int %d too big to encode' % x)
 
3238
 *         E_UPDATE_TAIL(self, n)
 
3239
 *         return 1             # <<<<<<<<<<<<<<
 
3240
 * 
 
3241
 *     cdef int _encode_long(self, x) except 0:
 
3242
 */
1341
3243
  __pyx_r = 1;
1342
3244
  goto __pyx_L0;
1343
3245
 
1344
3246
  __pyx_r = 0;
1345
3247
  goto __pyx_L0;
1346
 
  __pyx_L1:;
1347
 
  Py_XDECREF(__pyx_2);
1348
 
  Py_XDECREF(__pyx_3);
 
3248
  __pyx_L1_error:;
 
3249
  __Pyx_XDECREF(__pyx_t_3);
 
3250
  __Pyx_XDECREF(__pyx_t_4);
1349
3251
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._encode_int");
1350
3252
  __pyx_r = 0;
1351
3253
  __pyx_L0:;
1352
 
  Py_DECREF(__pyx_v_self);
 
3254
  __Pyx_RefNannyFinishContext();
1353
3255
  return __pyx_r;
1354
3256
}
1355
3257
 
1356
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_long(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,PyObject *__pyx_v_x) {
 
3258
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":317
 
3259
 *         return 1
 
3260
 * 
 
3261
 *     cdef int _encode_long(self, x) except 0:             # <<<<<<<<<<<<<<
 
3262
 *         return self._append_string(''.join(('i', str(x), 'e')))
 
3263
 * 
 
3264
 */
 
3265
 
 
3266
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_long(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, PyObject *__pyx_v_x) {
1357
3267
  int __pyx_r;
1358
 
  PyObject *__pyx_1 = 0;
1359
 
  PyObject *__pyx_2 = 0;
1360
 
  PyObject *__pyx_3 = 0;
1361
 
  int __pyx_4;
1362
 
  Py_INCREF(__pyx_v_self);
1363
 
  Py_INCREF(__pyx_v_x);
1364
 
  __pyx_1 = PyObject_GetAttr(__pyx_k10p, __pyx_n_join); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1365
 
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1366
 
  Py_INCREF(__pyx_v_x);
1367
 
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
1368
 
  __pyx_3 = PyObject_CallObject(((PyObject *)(&PyString_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1369
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1370
 
  __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1371
 
  Py_INCREF(__pyx_n_i);
1372
 
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_i);
1373
 
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3);
1374
 
  Py_INCREF(__pyx_n_e);
1375
 
  PyTuple_SET_ITEM(__pyx_2, 2, __pyx_n_e);
1376
 
  __pyx_3 = 0;
1377
 
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1378
 
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
1379
 
  __pyx_2 = 0;
1380
 
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1381
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1382
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
1383
 
  __pyx_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_append_string(__pyx_v_self,__pyx_2); if (__pyx_4 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
1384
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1385
 
  __pyx_r = __pyx_4;
 
3268
  PyObject *__pyx_t_1 = NULL;
 
3269
  PyObject *__pyx_t_2 = NULL;
 
3270
  PyObject *__pyx_t_3 = NULL;
 
3271
  int __pyx_t_4;
 
3272
  __Pyx_RefNannySetupContext("_encode_long");
 
3273
 
 
3274
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":318
 
3275
 * 
 
3276
 *     cdef int _encode_long(self, x) except 0:
 
3277
 *         return self._append_string(''.join(('i', str(x), 'e')))             # <<<<<<<<<<<<<<
 
3278
 * 
 
3279
 *     cdef int _append_string(self, s) except 0:
 
3280
 */
 
3281
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_9), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3282
  __Pyx_GOTREF(__pyx_t_1);
 
3283
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3284
  __Pyx_GOTREF(__pyx_t_2);
 
3285
  __Pyx_INCREF(__pyx_v_x);
 
3286
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
 
3287
  __Pyx_GIVEREF(__pyx_v_x);
 
3288
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3289
  __Pyx_GOTREF(__pyx_t_3);
 
3290
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3291
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3292
  __Pyx_GOTREF(__pyx_t_2);
 
3293
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
 
3294
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__i));
 
3295
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
 
3296
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
 
3297
  __Pyx_GIVEREF(__pyx_t_3);
 
3298
  __Pyx_INCREF(((PyObject *)__pyx_n_s__e));
 
3299
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__e));
 
3300
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__e));
 
3301
  __pyx_t_3 = 0;
 
3302
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3303
  __Pyx_GOTREF(__pyx_t_3);
 
3304
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
 
3305
  __Pyx_GIVEREF(__pyx_t_2);
 
3306
  __pyx_t_2 = 0;
 
3307
  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3308
  __Pyx_GOTREF(__pyx_t_2);
 
3309
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
3310
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3311
  __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_append_string(__pyx_v_self, __pyx_t_2); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3312
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3313
  __pyx_r = __pyx_t_4;
1386
3314
  goto __pyx_L0;
1387
3315
 
1388
3316
  __pyx_r = 0;
1389
3317
  goto __pyx_L0;
1390
 
  __pyx_L1:;
1391
 
  Py_XDECREF(__pyx_1);
1392
 
  Py_XDECREF(__pyx_2);
1393
 
  Py_XDECREF(__pyx_3);
 
3318
  __pyx_L1_error:;
 
3319
  __Pyx_XDECREF(__pyx_t_1);
 
3320
  __Pyx_XDECREF(__pyx_t_2);
 
3321
  __Pyx_XDECREF(__pyx_t_3);
1394
3322
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._encode_long");
1395
3323
  __pyx_r = 0;
1396
3324
  __pyx_L0:;
1397
 
  Py_DECREF(__pyx_v_self);
1398
 
  Py_DECREF(__pyx_v_x);
 
3325
  __Pyx_RefNannyFinishContext();
1399
3326
  return __pyx_r;
1400
3327
}
1401
3328
 
1402
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__append_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,PyObject *__pyx_v_s) {
 
3329
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":320
 
3330
 *         return self._append_string(''.join(('i', str(x), 'e')))
 
3331
 * 
 
3332
 *     cdef int _append_string(self, s) except 0:             # <<<<<<<<<<<<<<
 
3333
 *         cdef Py_ssize_t n
 
3334
 *         n = PyString_GET_SIZE(s)
 
3335
 */
 
3336
 
 
3337
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__append_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, PyObject *__pyx_v_s) {
1403
3338
  Py_ssize_t __pyx_v_n;
1404
3339
  int __pyx_r;
1405
 
  Py_ssize_t __pyx_1;
1406
 
  int __pyx_2;
1407
 
  char *__pyx_3;
1408
 
  Py_INCREF(__pyx_v_self);
1409
 
  Py_INCREF(__pyx_v_s);
1410
 
 
1411
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":322 */
1412
 
  __pyx_1 = PyString_GET_SIZE(__pyx_v_s); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; goto __pyx_L1;}
1413
 
  __pyx_v_n = __pyx_1;
1414
 
 
1415
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":323 */
1416
 
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,__pyx_v_n); if (__pyx_2 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
1417
 
 
1418
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":324 */
1419
 
  __pyx_3 = PyString_AS_STRING(__pyx_v_s); if (__pyx_3 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;}
1420
 
  memcpy(__pyx_v_self->tail,__pyx_3,__pyx_v_n);
1421
 
 
1422
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":325 */
1423
 
  E_UPDATE_TAIL(__pyx_v_self,__pyx_v_n);
1424
 
 
1425
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":326 */
 
3340
  Py_ssize_t __pyx_t_1;
 
3341
  int __pyx_t_2;
 
3342
  char *__pyx_t_3;
 
3343
  __Pyx_RefNannySetupContext("_append_string");
 
3344
 
 
3345
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":322
 
3346
 *     cdef int _append_string(self, s) except 0:
 
3347
 *         cdef Py_ssize_t n
 
3348
 *         n = PyString_GET_SIZE(s)             # <<<<<<<<<<<<<<
 
3349
 *         self._ensure_buffer(n)
 
3350
 *         memcpy(self.tail, PyString_AS_STRING(s), n)
 
3351
 */
 
3352
  __pyx_t_1 = PyString_GET_SIZE(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3353
  __pyx_v_n = __pyx_t_1;
 
3354
 
 
3355
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":323
 
3356
 *         cdef Py_ssize_t n
 
3357
 *         n = PyString_GET_SIZE(s)
 
3358
 *         self._ensure_buffer(n)             # <<<<<<<<<<<<<<
 
3359
 *         memcpy(self.tail, PyString_AS_STRING(s), n)
 
3360
 *         E_UPDATE_TAIL(self, n)
 
3361
 */
 
3362
  __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, __pyx_v_n); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3363
 
 
3364
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":324
 
3365
 *         n = PyString_GET_SIZE(s)
 
3366
 *         self._ensure_buffer(n)
 
3367
 *         memcpy(self.tail, PyString_AS_STRING(s), n)             # <<<<<<<<<<<<<<
 
3368
 *         E_UPDATE_TAIL(self, n)
 
3369
 *         return 1
 
3370
 */
 
3371
  __pyx_t_3 = PyString_AS_STRING(__pyx_v_s); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3372
  memcpy(__pyx_v_self->tail, __pyx_t_3, __pyx_v_n);
 
3373
 
 
3374
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":325
 
3375
 *         self._ensure_buffer(n)
 
3376
 *         memcpy(self.tail, PyString_AS_STRING(s), n)
 
3377
 *         E_UPDATE_TAIL(self, n)             # <<<<<<<<<<<<<<
 
3378
 *         return 1
 
3379
 * 
 
3380
 */
 
3381
  E_UPDATE_TAIL(__pyx_v_self, __pyx_v_n);
 
3382
 
 
3383
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":326
 
3384
 *         memcpy(self.tail, PyString_AS_STRING(s), n)
 
3385
 *         E_UPDATE_TAIL(self, n)
 
3386
 *         return 1             # <<<<<<<<<<<<<<
 
3387
 * 
 
3388
 *     cdef int _encode_string(self, x) except 0:
 
3389
 */
1426
3390
  __pyx_r = 1;
1427
3391
  goto __pyx_L0;
1428
3392
 
1429
3393
  __pyx_r = 0;
1430
3394
  goto __pyx_L0;
1431
 
  __pyx_L1:;
 
3395
  __pyx_L1_error:;
1432
3396
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._append_string");
1433
3397
  __pyx_r = 0;
1434
3398
  __pyx_L0:;
1435
 
  Py_DECREF(__pyx_v_self);
1436
 
  Py_DECREF(__pyx_v_s);
 
3399
  __Pyx_RefNannyFinishContext();
1437
3400
  return __pyx_r;
1438
3401
}
1439
3402
 
1440
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,PyObject *__pyx_v_x) {
 
3403
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":328
 
3404
 *         return 1
 
3405
 * 
 
3406
 *     cdef int _encode_string(self, x) except 0:             # <<<<<<<<<<<<<<
 
3407
 *         cdef int n
 
3408
 *         cdef Py_ssize_t x_len
 
3409
 */
 
3410
 
 
3411
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_string(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, PyObject *__pyx_v_x) {
1441
3412
  int __pyx_v_n;
1442
3413
  Py_ssize_t __pyx_v_x_len;
1443
3414
  int __pyx_r;
1444
 
  Py_ssize_t __pyx_1;
1445
 
  int __pyx_2;
1446
 
  PyObject *__pyx_3 = 0;
1447
 
  PyObject *__pyx_4 = 0;
1448
 
  char *__pyx_5;
1449
 
  Py_INCREF(__pyx_v_self);
1450
 
  Py_INCREF(__pyx_v_x);
1451
 
 
1452
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":331 */
1453
 
  __pyx_1 = PyString_GET_SIZE(__pyx_v_x); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
1454
 
  __pyx_v_x_len = __pyx_1;
1455
 
 
1456
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":332 */
1457
 
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,(__pyx_v_x_len + __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE)); if (__pyx_2 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}
1458
 
 
1459
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":333 */
1460
 
  __pyx_v_n = snprintf(__pyx_v_self->tail,__pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE,__pyx_k25,__pyx_v_x_len);
1461
 
 
1462
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":334 */
1463
 
  __pyx_2 = (__pyx_v_n < 0);
1464
 
  if (__pyx_2) {
1465
 
    __pyx_3 = PyNumber_Remainder(__pyx_k26p, __pyx_v_x); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}
1466
 
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}
1467
 
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
1468
 
    __pyx_3 = 0;
1469
 
    __pyx_3 = PyObject_CallObject(PyExc_MemoryError, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}
1470
 
    Py_DECREF(__pyx_4); __pyx_4 = 0;
1471
 
    __Pyx_Raise(__pyx_3, 0, 0);
1472
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1473
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}
1474
 
    goto __pyx_L2;
 
3415
  Py_ssize_t __pyx_t_1;
 
3416
  int __pyx_t_2;
 
3417
  int __pyx_t_3;
 
3418
  PyObject *__pyx_t_4 = NULL;
 
3419
  PyObject *__pyx_t_5 = NULL;
 
3420
  char *__pyx_t_6;
 
3421
  __Pyx_RefNannySetupContext("_encode_string");
 
3422
 
 
3423
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":331
 
3424
 *         cdef int n
 
3425
 *         cdef Py_ssize_t x_len
 
3426
 *         x_len = PyString_GET_SIZE(x)             # <<<<<<<<<<<<<<
 
3427
 *         self._ensure_buffer(x_len + INT_BUF_SIZE)
 
3428
 *         n = snprintf(self.tail, INT_BUF_SIZE, '%d:', x_len)
 
3429
 */
 
3430
  __pyx_t_1 = PyString_GET_SIZE(__pyx_v_x); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3431
  __pyx_v_x_len = __pyx_t_1;
 
3432
 
 
3433
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":332
 
3434
 *         cdef Py_ssize_t x_len
 
3435
 *         x_len = PyString_GET_SIZE(x)
 
3436
 *         self._ensure_buffer(x_len + INT_BUF_SIZE)             # <<<<<<<<<<<<<<
 
3437
 *         n = snprintf(self.tail, INT_BUF_SIZE, '%d:', x_len)
 
3438
 *         if n < 0:
 
3439
 */
 
3440
  __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, (__pyx_v_x_len + __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3441
 
 
3442
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":333
 
3443
 *         x_len = PyString_GET_SIZE(x)
 
3444
 *         self._ensure_buffer(x_len + INT_BUF_SIZE)
 
3445
 *         n = snprintf(self.tail, INT_BUF_SIZE, '%d:', x_len)             # <<<<<<<<<<<<<<
 
3446
 *         if n < 0:
 
3447
 *             raise MemoryError('string %s too big to encode' % x)
 
3448
 */
 
3449
  __pyx_v_n = snprintf(__pyx_v_self->tail, __pyx_e_6bzrlib_12_bencode_pyx_INT_BUF_SIZE, __pyx_k_20, __pyx_v_x_len);
 
3450
 
 
3451
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":334
 
3452
 *         self._ensure_buffer(x_len + INT_BUF_SIZE)
 
3453
 *         n = snprintf(self.tail, INT_BUF_SIZE, '%d:', x_len)
 
3454
 *         if n < 0:             # <<<<<<<<<<<<<<
 
3455
 *             raise MemoryError('string %s too big to encode' % x)
 
3456
 *         memcpy(<void *>(self.tail+n), PyString_AS_STRING(x), x_len)
 
3457
 */
 
3458
  __pyx_t_3 = (__pyx_v_n < 0);
 
3459
  if (__pyx_t_3) {
 
3460
 
 
3461
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":335
 
3462
 *         n = snprintf(self.tail, INT_BUF_SIZE, '%d:', x_len)
 
3463
 *         if n < 0:
 
3464
 *             raise MemoryError('string %s too big to encode' % x)             # <<<<<<<<<<<<<<
 
3465
 *         memcpy(<void *>(self.tail+n), PyString_AS_STRING(x), x_len)
 
3466
 *         E_UPDATE_TAIL(self, n + x_len)
 
3467
 */
 
3468
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3469
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
3470
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3471
    __Pyx_GOTREF(__pyx_t_5);
 
3472
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
 
3473
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
 
3474
    __pyx_t_4 = 0;
 
3475
    __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3476
    __Pyx_GOTREF(__pyx_t_4);
 
3477
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
3478
    __Pyx_Raise(__pyx_t_4, 0, 0);
 
3479
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3480
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3481
    goto __pyx_L3;
1475
3482
  }
1476
 
  __pyx_L2:;
1477
 
 
1478
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":336 */
1479
 
  __pyx_5 = PyString_AS_STRING(__pyx_v_x); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
1480
 
  memcpy((__pyx_v_self->tail + __pyx_v_n),__pyx_5,__pyx_v_x_len);
1481
 
 
1482
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":337 */
1483
 
  E_UPDATE_TAIL(__pyx_v_self,(__pyx_v_n + __pyx_v_x_len));
1484
 
 
1485
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":338 */
 
3483
  __pyx_L3:;
 
3484
 
 
3485
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":336
 
3486
 *         if n < 0:
 
3487
 *             raise MemoryError('string %s too big to encode' % x)
 
3488
 *         memcpy(<void *>(self.tail+n), PyString_AS_STRING(x), x_len)             # <<<<<<<<<<<<<<
 
3489
 *         E_UPDATE_TAIL(self, n + x_len)
 
3490
 *         return 1
 
3491
 */
 
3492
  __pyx_t_6 = PyString_AS_STRING(__pyx_v_x); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3493
  memcpy(((void *)(__pyx_v_self->tail + __pyx_v_n)), __pyx_t_6, __pyx_v_x_len);
 
3494
 
 
3495
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":337
 
3496
 *             raise MemoryError('string %s too big to encode' % x)
 
3497
 *         memcpy(<void *>(self.tail+n), PyString_AS_STRING(x), x_len)
 
3498
 *         E_UPDATE_TAIL(self, n + x_len)             # <<<<<<<<<<<<<<
 
3499
 *         return 1
 
3500
 * 
 
3501
 */
 
3502
  E_UPDATE_TAIL(__pyx_v_self, (__pyx_v_n + __pyx_v_x_len));
 
3503
 
 
3504
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":338
 
3505
 *         memcpy(<void *>(self.tail+n), PyString_AS_STRING(x), x_len)
 
3506
 *         E_UPDATE_TAIL(self, n + x_len)
 
3507
 *         return 1             # <<<<<<<<<<<<<<
 
3508
 * 
 
3509
 *     cdef int _encode_list(self, x) except 0:
 
3510
 */
1486
3511
  __pyx_r = 1;
1487
3512
  goto __pyx_L0;
1488
3513
 
1489
3514
  __pyx_r = 0;
1490
3515
  goto __pyx_L0;
1491
 
  __pyx_L1:;
1492
 
  Py_XDECREF(__pyx_3);
1493
 
  Py_XDECREF(__pyx_4);
 
3516
  __pyx_L1_error:;
 
3517
  __Pyx_XDECREF(__pyx_t_4);
 
3518
  __Pyx_XDECREF(__pyx_t_5);
1494
3519
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._encode_string");
1495
3520
  __pyx_r = 0;
1496
3521
  __pyx_L0:;
1497
 
  Py_DECREF(__pyx_v_self);
1498
 
  Py_DECREF(__pyx_v_x);
 
3522
  __Pyx_RefNannyFinishContext();
1499
3523
  return __pyx_r;
1500
3524
}
1501
3525
 
1502
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_list(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,PyObject *__pyx_v_x) {
 
3526
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":340
 
3527
 *         return 1
 
3528
 * 
 
3529
 *     cdef int _encode_list(self, x) except 0:             # <<<<<<<<<<<<<<
 
3530
 *         self._ensure_buffer(1)
 
3531
 *         self.tail[0] = c'l'
 
3532
 */
 
3533
 
 
3534
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_list(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, PyObject *__pyx_v_x) {
1503
3535
  PyObject *__pyx_v_i;
1504
3536
  int __pyx_r;
1505
 
  int __pyx_1;
1506
 
  PyObject *__pyx_2 = 0;
1507
 
  PyObject *__pyx_3 = 0;
1508
 
  PyObject *__pyx_4 = 0;
1509
 
  PyObject *__pyx_5 = 0;
1510
 
  Py_INCREF(__pyx_v_self);
1511
 
  Py_INCREF(__pyx_v_x);
1512
 
  __pyx_v_i = Py_None; Py_INCREF(Py_None);
1513
 
 
1514
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":341 */
1515
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,1); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; goto __pyx_L1;}
1516
 
 
1517
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":342 */
 
3537
  int __pyx_t_1;
 
3538
  Py_ssize_t __pyx_t_2;
 
3539
  PyObject *__pyx_t_3 = NULL;
 
3540
  PyObject *__pyx_t_4 = NULL;
 
3541
  PyObject *__pyx_t_5 = NULL;
 
3542
  PyObject *__pyx_t_6 = NULL;
 
3543
  __Pyx_RefNannySetupContext("_encode_list");
 
3544
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
 
3545
 
 
3546
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":341
 
3547
 * 
 
3548
 *     cdef int _encode_list(self, x) except 0:
 
3549
 *         self._ensure_buffer(1)             # <<<<<<<<<<<<<<
 
3550
 *         self.tail[0] = c'l'
 
3551
 *         E_UPDATE_TAIL(self, 1)
 
3552
 */
 
3553
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3554
 
 
3555
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":342
 
3556
 *     cdef int _encode_list(self, x) except 0:
 
3557
 *         self._ensure_buffer(1)
 
3558
 *         self.tail[0] = c'l'             # <<<<<<<<<<<<<<
 
3559
 *         E_UPDATE_TAIL(self, 1)
 
3560
 * 
 
3561
 */
1518
3562
  (__pyx_v_self->tail[0]) = 'l';
1519
3563
 
1520
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":343 */
1521
 
  E_UPDATE_TAIL(__pyx_v_self,1);
 
3564
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":343
 
3565
 *         self._ensure_buffer(1)
 
3566
 *         self.tail[0] = c'l'
 
3567
 *         E_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
3568
 * 
 
3569
 *         for i in x:
 
3570
 */
 
3571
  E_UPDATE_TAIL(__pyx_v_self, 1);
1522
3572
 
1523
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":345 */
1524
 
  __pyx_2 = PyObject_GetIter(__pyx_v_x); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
 
3573
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":345
 
3574
 *         E_UPDATE_TAIL(self, 1)
 
3575
 * 
 
3576
 *         for i in x:             # <<<<<<<<<<<<<<
 
3577
 *             self.process(i)
 
3578
 * 
 
3579
 */
 
3580
  if (PyList_CheckExact(__pyx_v_x) || PyTuple_CheckExact(__pyx_v_x)) {
 
3581
    __pyx_t_2 = 0; __pyx_t_3 = __pyx_v_x; __Pyx_INCREF(__pyx_t_3);
 
3582
  } else {
 
3583
    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3584
    __Pyx_GOTREF(__pyx_t_3);
 
3585
  }
1525
3586
  for (;;) {
1526
 
    __pyx_3 = PyIter_Next(__pyx_2);
1527
 
    if (!__pyx_3) {
1528
 
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
1529
 
      break;
 
3587
    if (likely(PyList_CheckExact(__pyx_t_3))) {
 
3588
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
 
3589
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
 
3590
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
 
3591
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
 
3592
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
 
3593
    } else {
 
3594
      __pyx_t_4 = PyIter_Next(__pyx_t_3);
 
3595
      if (!__pyx_t_4) {
 
3596
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3597
        break;
 
3598
      }
 
3599
      __Pyx_GOTREF(__pyx_t_4);
1530
3600
    }
1531
 
    Py_DECREF(__pyx_v_i);
1532
 
    __pyx_v_i = __pyx_3;
1533
 
    __pyx_3 = 0;
1534
 
    __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_process); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
1535
 
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
1536
 
    Py_INCREF(__pyx_v_i);
1537
 
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_i);
1538
 
    __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
1539
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1540
 
    Py_DECREF(__pyx_4); __pyx_4 = 0;
1541
 
    Py_DECREF(__pyx_5); __pyx_5 = 0;
 
3601
    __Pyx_DECREF(__pyx_v_i);
 
3602
    __pyx_v_i = __pyx_t_4;
 
3603
    __pyx_t_4 = 0;
 
3604
 
 
3605
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":346
 
3606
 * 
 
3607
 *         for i in x:
 
3608
 *             self.process(i)             # <<<<<<<<<<<<<<
 
3609
 * 
 
3610
 *         self._ensure_buffer(1)
 
3611
 */
 
3612
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__process); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3613
    __Pyx_GOTREF(__pyx_t_4);
 
3614
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3615
    __Pyx_GOTREF(__pyx_t_5);
 
3616
    __Pyx_INCREF(__pyx_v_i);
 
3617
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
 
3618
    __Pyx_GIVEREF(__pyx_v_i);
 
3619
    __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3620
    __Pyx_GOTREF(__pyx_t_6);
 
3621
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
3622
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
3623
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1542
3624
  }
1543
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1544
 
 
1545
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":348 */
1546
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,1); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}
1547
 
 
1548
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":349 */
 
3625
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3626
 
 
3627
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":348
 
3628
 *             self.process(i)
 
3629
 * 
 
3630
 *         self._ensure_buffer(1)             # <<<<<<<<<<<<<<
 
3631
 *         self.tail[0] = c'e'
 
3632
 *         E_UPDATE_TAIL(self, 1)
 
3633
 */
 
3634
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3635
 
 
3636
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":349
 
3637
 * 
 
3638
 *         self._ensure_buffer(1)
 
3639
 *         self.tail[0] = c'e'             # <<<<<<<<<<<<<<
 
3640
 *         E_UPDATE_TAIL(self, 1)
 
3641
 *         return 1
 
3642
 */
1549
3643
  (__pyx_v_self->tail[0]) = 'e';
1550
3644
 
1551
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":350 */
1552
 
  E_UPDATE_TAIL(__pyx_v_self,1);
 
3645
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":350
 
3646
 *         self._ensure_buffer(1)
 
3647
 *         self.tail[0] = c'e'
 
3648
 *         E_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
3649
 *         return 1
 
3650
 * 
 
3651
 */
 
3652
  E_UPDATE_TAIL(__pyx_v_self, 1);
1553
3653
 
1554
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":351 */
 
3654
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":351
 
3655
 *         self.tail[0] = c'e'
 
3656
 *         E_UPDATE_TAIL(self, 1)
 
3657
 *         return 1             # <<<<<<<<<<<<<<
 
3658
 * 
 
3659
 *     cdef int _encode_dict(self, x) except 0:
 
3660
 */
1555
3661
  __pyx_r = 1;
1556
3662
  goto __pyx_L0;
1557
3663
 
1558
3664
  __pyx_r = 0;
1559
3665
  goto __pyx_L0;
1560
 
  __pyx_L1:;
1561
 
  Py_XDECREF(__pyx_2);
1562
 
  Py_XDECREF(__pyx_3);
1563
 
  Py_XDECREF(__pyx_4);
1564
 
  Py_XDECREF(__pyx_5);
 
3666
  __pyx_L1_error:;
 
3667
  __Pyx_XDECREF(__pyx_t_3);
 
3668
  __Pyx_XDECREF(__pyx_t_4);
 
3669
  __Pyx_XDECREF(__pyx_t_5);
 
3670
  __Pyx_XDECREF(__pyx_t_6);
1565
3671
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._encode_list");
1566
3672
  __pyx_r = 0;
1567
3673
  __pyx_L0:;
1568
 
  Py_DECREF(__pyx_v_i);
1569
 
  Py_DECREF(__pyx_v_self);
1570
 
  Py_DECREF(__pyx_v_x);
 
3674
  __Pyx_DECREF(__pyx_v_i);
 
3675
  __Pyx_RefNannyFinishContext();
1571
3676
  return __pyx_r;
1572
3677
}
1573
3678
 
1574
 
static int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_dict(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self,PyObject *__pyx_v_x) {
 
3679
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":353
 
3680
 *         return 1
 
3681
 * 
 
3682
 *     cdef int _encode_dict(self, x) except 0:             # <<<<<<<<<<<<<<
 
3683
 *         self._ensure_buffer(1)
 
3684
 *         self.tail[0] = c'd'
 
3685
 */
 
3686
 
 
3687
static  int __pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_dict(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_self, PyObject *__pyx_v_x) {
1575
3688
  PyObject *__pyx_v_keys;
1576
3689
  PyObject *__pyx_v_k;
1577
3690
  int __pyx_r;
1578
 
  int __pyx_1;
1579
 
  PyObject *__pyx_2 = 0;
1580
 
  PyObject *__pyx_3 = 0;
1581
 
  PyObject *__pyx_4 = 0;
1582
 
  PyObject *__pyx_5 = 0;
1583
 
  Py_INCREF(__pyx_v_self);
1584
 
  Py_INCREF(__pyx_v_x);
1585
 
  __pyx_v_keys = Py_None; Py_INCREF(Py_None);
1586
 
  __pyx_v_k = Py_None; Py_INCREF(Py_None);
1587
 
 
1588
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":354 */
1589
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,1); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; goto __pyx_L1;}
1590
 
 
1591
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":355 */
 
3691
  int __pyx_t_1;
 
3692
  PyObject *__pyx_t_2 = NULL;
 
3693
  PyObject *__pyx_t_3 = NULL;
 
3694
  Py_ssize_t __pyx_t_4;
 
3695
  int __pyx_t_5;
 
3696
  PyObject *__pyx_t_6 = NULL;
 
3697
  PyObject *__pyx_t_7 = NULL;
 
3698
  __Pyx_RefNannySetupContext("_encode_dict");
 
3699
  __pyx_v_keys = Py_None; __Pyx_INCREF(Py_None);
 
3700
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
 
3701
 
 
3702
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":354
 
3703
 * 
 
3704
 *     cdef int _encode_dict(self, x) except 0:
 
3705
 *         self._ensure_buffer(1)             # <<<<<<<<<<<<<<
 
3706
 *         self.tail[0] = c'd'
 
3707
 *         E_UPDATE_TAIL(self, 1)
 
3708
 */
 
3709
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3710
 
 
3711
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":355
 
3712
 *     cdef int _encode_dict(self, x) except 0:
 
3713
 *         self._ensure_buffer(1)
 
3714
 *         self.tail[0] = c'd'             # <<<<<<<<<<<<<<
 
3715
 *         E_UPDATE_TAIL(self, 1)
 
3716
 * 
 
3717
 */
1592
3718
  (__pyx_v_self->tail[0]) = 'd';
1593
3719
 
1594
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":356 */
1595
 
  E_UPDATE_TAIL(__pyx_v_self,1);
1596
 
 
1597
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":358 */
1598
 
  __pyx_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_keys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
1599
 
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
1600
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1601
 
  Py_DECREF(__pyx_v_keys);
1602
 
  __pyx_v_keys = __pyx_3;
1603
 
  __pyx_3 = 0;
1604
 
 
1605
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":359 */
1606
 
  __pyx_2 = PyObject_GetAttr(__pyx_v_keys, __pyx_n_sort); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
1607
 
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; goto __pyx_L1;}
1608
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1609
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
1610
 
 
1611
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":360 */
1612
 
  __pyx_2 = PyObject_GetIter(__pyx_v_keys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
 
3720
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":356
 
3721
 *         self._ensure_buffer(1)
 
3722
 *         self.tail[0] = c'd'
 
3723
 *         E_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
3724
 * 
 
3725
 *         keys = x.keys()
 
3726
 */
 
3727
  E_UPDATE_TAIL(__pyx_v_self, 1);
 
3728
 
 
3729
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":358
 
3730
 *         E_UPDATE_TAIL(self, 1)
 
3731
 * 
 
3732
 *         keys = x.keys()             # <<<<<<<<<<<<<<
 
3733
 *         keys.sort()
 
3734
 *         for k in keys:
 
3735
 */
 
3736
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3737
  __Pyx_GOTREF(__pyx_t_2);
 
3738
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3739
  __Pyx_GOTREF(__pyx_t_3);
 
3740
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3741
  __Pyx_DECREF(__pyx_v_keys);
 
3742
  __pyx_v_keys = __pyx_t_3;
 
3743
  __pyx_t_3 = 0;
 
3744
 
 
3745
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":359
 
3746
 * 
 
3747
 *         keys = x.keys()
 
3748
 *         keys.sort()             # <<<<<<<<<<<<<<
 
3749
 *         for k in keys:
 
3750
 *             if not PyString_CheckExact(k):
 
3751
 */
 
3752
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_keys, __pyx_n_s__sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3753
  __Pyx_GOTREF(__pyx_t_3);
 
3754
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3755
  __Pyx_GOTREF(__pyx_t_2);
 
3756
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3757
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3758
 
 
3759
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":360
 
3760
 *         keys = x.keys()
 
3761
 *         keys.sort()
 
3762
 *         for k in keys:             # <<<<<<<<<<<<<<
 
3763
 *             if not PyString_CheckExact(k):
 
3764
 *                 raise TypeError('key in dict should be string')
 
3765
 */
 
3766
  if (PyList_CheckExact(__pyx_v_keys) || PyTuple_CheckExact(__pyx_v_keys)) {
 
3767
    __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_2);
 
3768
  } else {
 
3769
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3770
    __Pyx_GOTREF(__pyx_t_2);
 
3771
  }
1613
3772
  for (;;) {
1614
 
    __pyx_3 = PyIter_Next(__pyx_2);
1615
 
    if (!__pyx_3) {
1616
 
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; goto __pyx_L1;}
1617
 
      break;
1618
 
    }
1619
 
    Py_DECREF(__pyx_v_k);
1620
 
    __pyx_v_k = __pyx_3;
1621
 
    __pyx_3 = 0;
1622
 
 
1623
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":361 */
1624
 
    __pyx_1 = (!PyString_CheckExact(__pyx_v_k));
1625
 
    if (__pyx_1) {
1626
 
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
1627
 
      Py_INCREF(__pyx_k30p);
1628
 
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k30p);
1629
 
      __pyx_4 = PyObject_CallObject(PyExc_TypeError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
1630
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
1631
 
      __Pyx_Raise(__pyx_4, 0, 0);
1632
 
      Py_DECREF(__pyx_4); __pyx_4 = 0;
1633
 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
1634
 
      goto __pyx_L4;
1635
 
    }
1636
 
    __pyx_L4:;
1637
 
 
1638
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":363 */
1639
 
    __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_encode_string(__pyx_v_self,__pyx_v_k); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; goto __pyx_L1;}
1640
 
 
1641
 
    /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":364 */
1642
 
    __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_process); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
1643
 
    __pyx_4 = PyObject_GetItem(__pyx_v_x, __pyx_v_k); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
1644
 
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
1645
 
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
1646
 
    __pyx_4 = 0;
1647
 
    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
1648
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1649
 
    Py_DECREF(__pyx_5); __pyx_5 = 0;
1650
 
    Py_DECREF(__pyx_4); __pyx_4 = 0;
 
3773
    if (likely(PyList_CheckExact(__pyx_t_2))) {
 
3774
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
 
3775
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
 
3776
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
 
3777
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
 
3778
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
 
3779
    } else {
 
3780
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
 
3781
      if (!__pyx_t_3) {
 
3782
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3783
        break;
 
3784
      }
 
3785
      __Pyx_GOTREF(__pyx_t_3);
 
3786
    }
 
3787
    __Pyx_DECREF(__pyx_v_k);
 
3788
    __pyx_v_k = __pyx_t_3;
 
3789
    __pyx_t_3 = 0;
 
3790
 
 
3791
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":361
 
3792
 *         keys.sort()
 
3793
 *         for k in keys:
 
3794
 *             if not PyString_CheckExact(k):             # <<<<<<<<<<<<<<
 
3795
 *                 raise TypeError('key in dict should be string')
 
3796
 *             self._encode_string(k)
 
3797
 */
 
3798
    __pyx_t_5 = (!PyString_CheckExact(__pyx_v_k));
 
3799
    if (__pyx_t_5) {
 
3800
 
 
3801
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":362
 
3802
 *         for k in keys:
 
3803
 *             if not PyString_CheckExact(k):
 
3804
 *                 raise TypeError('key in dict should be string')             # <<<<<<<<<<<<<<
 
3805
 *             self._encode_string(k)
 
3806
 *             self.process(x[k])
 
3807
 */
 
3808
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3809
      __Pyx_GOTREF(__pyx_t_3);
 
3810
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
 
3811
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_22));
 
3812
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
 
3813
      __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3814
      __Pyx_GOTREF(__pyx_t_6);
 
3815
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3816
      __Pyx_Raise(__pyx_t_6, 0, 0);
 
3817
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
3818
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3819
      goto __pyx_L5;
 
3820
    }
 
3821
    __pyx_L5:;
 
3822
 
 
3823
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":363
 
3824
 *             if not PyString_CheckExact(k):
 
3825
 *                 raise TypeError('key in dict should be string')
 
3826
 *             self._encode_string(k)             # <<<<<<<<<<<<<<
 
3827
 *             self.process(x[k])
 
3828
 * 
 
3829
 */
 
3830
    __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_encode_string(__pyx_v_self, __pyx_v_k); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3831
 
 
3832
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":364
 
3833
 *                 raise TypeError('key in dict should be string')
 
3834
 *             self._encode_string(k)
 
3835
 *             self.process(x[k])             # <<<<<<<<<<<<<<
 
3836
 * 
 
3837
 *         self._ensure_buffer(1)
 
3838
 */
 
3839
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__process); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3840
    __Pyx_GOTREF(__pyx_t_6);
 
3841
    __pyx_t_3 = PyObject_GetItem(__pyx_v_x, __pyx_v_k); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3842
    __Pyx_GOTREF(__pyx_t_3);
 
3843
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3844
    __Pyx_GOTREF(__pyx_t_7);
 
3845
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
 
3846
    __Pyx_GIVEREF(__pyx_t_3);
 
3847
    __pyx_t_3 = 0;
 
3848
    __pyx_t_3 = PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3849
    __Pyx_GOTREF(__pyx_t_3);
 
3850
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
3851
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
3852
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1651
3853
  }
1652
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1653
 
 
1654
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":366 */
1655
 
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self,1); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; goto __pyx_L1;}
1656
 
 
1657
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":367 */
 
3854
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3855
 
 
3856
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":366
 
3857
 *             self.process(x[k])
 
3858
 * 
 
3859
 *         self._ensure_buffer(1)             # <<<<<<<<<<<<<<
 
3860
 *         self.tail[0] = c'e'
 
3861
 *         E_UPDATE_TAIL(self, 1)
 
3862
 */
 
3863
  __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self->__pyx_vtab)->_ensure_buffer(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3864
 
 
3865
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":367
 
3866
 * 
 
3867
 *         self._ensure_buffer(1)
 
3868
 *         self.tail[0] = c'e'             # <<<<<<<<<<<<<<
 
3869
 *         E_UPDATE_TAIL(self, 1)
 
3870
 *         return 1
 
3871
 */
1658
3872
  (__pyx_v_self->tail[0]) = 'e';
1659
3873
 
1660
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":368 */
1661
 
  E_UPDATE_TAIL(__pyx_v_self,1);
 
3874
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":368
 
3875
 *         self._ensure_buffer(1)
 
3876
 *         self.tail[0] = c'e'
 
3877
 *         E_UPDATE_TAIL(self, 1)             # <<<<<<<<<<<<<<
 
3878
 *         return 1
 
3879
 * 
 
3880
 */
 
3881
  E_UPDATE_TAIL(__pyx_v_self, 1);
1662
3882
 
1663
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":369 */
 
3883
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":369
 
3884
 *         self.tail[0] = c'e'
 
3885
 *         E_UPDATE_TAIL(self, 1)
 
3886
 *         return 1             # <<<<<<<<<<<<<<
 
3887
 * 
 
3888
 *     def process(self, object x):
 
3889
 */
1664
3890
  __pyx_r = 1;
1665
3891
  goto __pyx_L0;
1666
3892
 
1667
3893
  __pyx_r = 0;
1668
3894
  goto __pyx_L0;
1669
 
  __pyx_L1:;
1670
 
  Py_XDECREF(__pyx_2);
1671
 
  Py_XDECREF(__pyx_3);
1672
 
  Py_XDECREF(__pyx_4);
1673
 
  Py_XDECREF(__pyx_5);
 
3895
  __pyx_L1_error:;
 
3896
  __Pyx_XDECREF(__pyx_t_2);
 
3897
  __Pyx_XDECREF(__pyx_t_3);
 
3898
  __Pyx_XDECREF(__pyx_t_6);
 
3899
  __Pyx_XDECREF(__pyx_t_7);
1674
3900
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder._encode_dict");
1675
3901
  __pyx_r = 0;
1676
3902
  __pyx_L0:;
1677
 
  Py_DECREF(__pyx_v_keys);
1678
 
  Py_DECREF(__pyx_v_k);
1679
 
  Py_DECREF(__pyx_v_self);
1680
 
  Py_DECREF(__pyx_v_x);
 
3903
  __Pyx_DECREF(__pyx_v_keys);
 
3904
  __Pyx_DECREF(__pyx_v_k);
 
3905
  __Pyx_RefNannyFinishContext();
1681
3906
  return __pyx_r;
1682
3907
}
1683
3908
 
1684
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Encoder_process(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1685
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_7Encoder_process(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1686
 
  PyObject *__pyx_v_x = 0;
1687
 
  PyObject *__pyx_r;
1688
 
  int __pyx_1;
1689
 
  PyObject *__pyx_2 = 0;
1690
 
  PyObject *__pyx_3 = 0;
1691
 
  int __pyx_4;
1692
 
  static char *__pyx_argnames[] = {"x",0};
1693
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_x)) return 0;
1694
 
  Py_INCREF(__pyx_v_self);
1695
 
  Py_INCREF(__pyx_v_x);
1696
 
 
1697
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":372 */
1698
 
  __pyx_1 = Py_EnterRecursiveCall(__pyx_k31);
1699
 
  if (__pyx_1) {
1700
 
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; goto __pyx_L1;}
1701
 
    Py_INCREF(__pyx_k5p);
1702
 
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k5p);
1703
 
    __pyx_3 = PyObject_CallObject(PyExc_RuntimeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; goto __pyx_L1;}
1704
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1705
 
    __Pyx_Raise(__pyx_3, 0, 0);
1706
 
    Py_DECREF(__pyx_3); __pyx_3 = 0;
1707
 
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; goto __pyx_L1;}
1708
 
    goto __pyx_L2;
 
3909
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":371
 
3910
 *         return 1
 
3911
 * 
 
3912
 *     def process(self, object x):             # <<<<<<<<<<<<<<
 
3913
 *         if Py_EnterRecursiveCall("encode"):
 
3914
 *             raise RuntimeError("too deeply nested")
 
3915
 */
 
3916
 
 
3917
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_process(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
 
3918
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_process(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
 
3919
  PyObject *__pyx_r = NULL;
 
3920
  int __pyx_t_1;
 
3921
  PyObject *__pyx_t_2 = NULL;
 
3922
  PyObject *__pyx_t_3 = NULL;
 
3923
  int __pyx_t_4;
 
3924
  int __pyx_t_5;
 
3925
  int __pyx_t_6;
 
3926
  int __pyx_t_7;
 
3927
  __Pyx_RefNannySetupContext("process");
 
3928
 
 
3929
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":372
 
3930
 * 
 
3931
 *     def process(self, object x):
 
3932
 *         if Py_EnterRecursiveCall("encode"):             # <<<<<<<<<<<<<<
 
3933
 *             raise RuntimeError("too deeply nested")
 
3934
 *         try:
 
3935
 */
 
3936
  __pyx_t_1 = Py_EnterRecursiveCall(__pyx_k__encode);
 
3937
  if (__pyx_t_1) {
 
3938
 
 
3939
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":373
 
3940
 *     def process(self, object x):
 
3941
 *         if Py_EnterRecursiveCall("encode"):
 
3942
 *             raise RuntimeError("too deeply nested")             # <<<<<<<<<<<<<<
 
3943
 *         try:
 
3944
 *             if PyString_CheckExact(x):
 
3945
 */
 
3946
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3947
    __Pyx_GOTREF(__pyx_t_2);
 
3948
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
 
3949
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_4));
 
3950
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
 
3951
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3952
    __Pyx_GOTREF(__pyx_t_3);
 
3953
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
3954
    __Pyx_Raise(__pyx_t_3, 0, 0);
 
3955
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
3956
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
3957
    goto __pyx_L5;
1709
3958
  }
1710
 
  __pyx_L2:;
 
3959
  __pyx_L5:;
1711
3960
 
1712
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":374 */
 
3961
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":374
 
3962
 *         if Py_EnterRecursiveCall("encode"):
 
3963
 *             raise RuntimeError("too deeply nested")
 
3964
 *         try:             # <<<<<<<<<<<<<<
 
3965
 *             if PyString_CheckExact(x):
 
3966
 *                 self._encode_string(x)
 
3967
 */
1713
3968
  /*try:*/ {
1714
 
    __pyx_1 = PyString_CheckExact(__pyx_v_x);
1715
 
    if (__pyx_1) {
1716
 
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_string(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_v_x); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; goto __pyx_L4;}
1717
 
      goto __pyx_L6;
1718
 
    }
1719
 
    __pyx_1 = PyInt_CheckExact(__pyx_v_x);
1720
 
    if (__pyx_1) {
1721
 
      __pyx_1 = PyInt_AsLong(__pyx_v_x); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; goto __pyx_L4;}
1722
 
      __pyx_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_int(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_1); if (__pyx_4 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; goto __pyx_L4;}
1723
 
      goto __pyx_L6;
1724
 
    }
1725
 
    __pyx_1 = PyLong_CheckExact(__pyx_v_x);
1726
 
    if (__pyx_1) {
1727
 
      __pyx_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_long(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_v_x); if (__pyx_4 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; goto __pyx_L4;}
1728
 
      goto __pyx_L6;
1729
 
    }
1730
 
    __pyx_1 = PyList_CheckExact(__pyx_v_x);
1731
 
    if (!__pyx_1) {
1732
 
      __pyx_1 = PyTuple_CheckExact(__pyx_v_x);
1733
 
      if (!__pyx_1) {
1734
 
        __pyx_1 = StaticTuple_CheckExact(__pyx_v_x);
 
3969
 
 
3970
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":375
 
3971
 *             raise RuntimeError("too deeply nested")
 
3972
 *         try:
 
3973
 *             if PyString_CheckExact(x):             # <<<<<<<<<<<<<<
 
3974
 *                 self._encode_string(x)
 
3975
 *             elif PyInt_CheckExact(x):
 
3976
 */
 
3977
    __pyx_t_1 = PyString_CheckExact(__pyx_v_x);
 
3978
    if (__pyx_t_1) {
 
3979
 
 
3980
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":376
 
3981
 *         try:
 
3982
 *             if PyString_CheckExact(x):
 
3983
 *                 self._encode_string(x)             # <<<<<<<<<<<<<<
 
3984
 *             elif PyInt_CheckExact(x):
 
3985
 *                 self._encode_int(x)
 
3986
 */
 
3987
      __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_string(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_v_x); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
3988
      goto __pyx_L9;
 
3989
    }
 
3990
 
 
3991
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":377
 
3992
 *             if PyString_CheckExact(x):
 
3993
 *                 self._encode_string(x)
 
3994
 *             elif PyInt_CheckExact(x):             # <<<<<<<<<<<<<<
 
3995
 *                 self._encode_int(x)
 
3996
 *             elif PyLong_CheckExact(x):
 
3997
 */
 
3998
    __pyx_t_1 = PyInt_CheckExact(__pyx_v_x);
 
3999
    if (__pyx_t_1) {
 
4000
 
 
4001
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":378
 
4002
 *                 self._encode_string(x)
 
4003
 *             elif PyInt_CheckExact(x):
 
4004
 *                 self._encode_int(x)             # <<<<<<<<<<<<<<
 
4005
 *             elif PyLong_CheckExact(x):
 
4006
 *                 self._encode_long(x)
 
4007
 */
 
4008
      __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_x); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4009
      __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_int(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_t_1); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4010
      goto __pyx_L9;
 
4011
    }
 
4012
 
 
4013
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":379
 
4014
 *             elif PyInt_CheckExact(x):
 
4015
 *                 self._encode_int(x)
 
4016
 *             elif PyLong_CheckExact(x):             # <<<<<<<<<<<<<<
 
4017
 *                 self._encode_long(x)
 
4018
 *             elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
 
4019
 */
 
4020
    __pyx_t_4 = PyLong_CheckExact(__pyx_v_x);
 
4021
    if (__pyx_t_4) {
 
4022
 
 
4023
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":380
 
4024
 *                 self._encode_int(x)
 
4025
 *             elif PyLong_CheckExact(x):
 
4026
 *                 self._encode_long(x)             # <<<<<<<<<<<<<<
 
4027
 *             elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
 
4028
 *                   or StaticTuple_CheckExact(x)):
 
4029
 */
 
4030
      __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_long(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_v_x); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4031
      goto __pyx_L9;
 
4032
    }
 
4033
 
 
4034
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":381
 
4035
 *             elif PyLong_CheckExact(x):
 
4036
 *                 self._encode_long(x)
 
4037
 *             elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)             # <<<<<<<<<<<<<<
 
4038
 *                   or StaticTuple_CheckExact(x)):
 
4039
 *                 self._encode_list(x)
 
4040
 */
 
4041
    __pyx_t_4 = PyList_CheckExact(__pyx_v_x);
 
4042
    if (!__pyx_t_4) {
 
4043
 
 
4044
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":382
 
4045
 *                 self._encode_long(x)
 
4046
 *             elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
 
4047
 *                   or StaticTuple_CheckExact(x)):             # <<<<<<<<<<<<<<
 
4048
 *                 self._encode_list(x)
 
4049
 *             elif PyDict_CheckExact(x):
 
4050
 */
 
4051
      __pyx_t_1 = PyTuple_CheckExact(__pyx_v_x);
 
4052
      if (!__pyx_t_1) {
 
4053
        __pyx_t_5 = StaticTuple_CheckExact(__pyx_v_x);
 
4054
        __pyx_t_6 = __pyx_t_5;
 
4055
      } else {
 
4056
        __pyx_t_6 = __pyx_t_1;
1735
4057
      }
1736
 
    }
1737
 
    if (__pyx_1) {
1738
 
      __pyx_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_list(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_v_x); if (__pyx_4 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L4;}
1739
 
      goto __pyx_L6;
1740
 
    }
1741
 
    __pyx_1 = PyDict_CheckExact(__pyx_v_x);
1742
 
    if (__pyx_1) {
1743
 
      __pyx_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_dict(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_v_x); if (__pyx_4 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; goto __pyx_L4;}
1744
 
      goto __pyx_L6;
1745
 
    }
1746
 
    __pyx_1 = PyBool_Check(__pyx_v_x);
1747
 
    if (__pyx_1) {
1748
 
      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L4;}
1749
 
      Py_INCREF(__pyx_v_x);
1750
 
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
1751
 
      __pyx_3 = PyObject_CallObject(((PyObject *)(&PyInt_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L4;}
1752
 
      Py_DECREF(__pyx_2); __pyx_2 = 0;
1753
 
      __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L4;}
1754
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
1755
 
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_int(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_4); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L4;}
1756
 
      goto __pyx_L6;
1757
 
    }
1758
 
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_Bencached); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L4;}
1759
 
    __pyx_4 = PyObject_IsInstance(__pyx_v_x,__pyx_2); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L4;}
1760
 
    Py_DECREF(__pyx_2); __pyx_2 = 0;
1761
 
    if (__pyx_4) {
1762
 
      __pyx_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_bencoded); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L4;}
1763
 
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_append_string(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self),__pyx_3); if (__pyx_1 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L4;}
1764
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
1765
 
      goto __pyx_L6;
 
4058
      __pyx_t_7 = __pyx_t_6;
 
4059
    } else {
 
4060
      __pyx_t_7 = __pyx_t_4;
 
4061
    }
 
4062
    if (__pyx_t_7) {
 
4063
 
 
4064
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":383
 
4065
 *             elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
 
4066
 *                   or StaticTuple_CheckExact(x)):
 
4067
 *                 self._encode_list(x)             # <<<<<<<<<<<<<<
 
4068
 *             elif PyDict_CheckExact(x):
 
4069
 *                 self._encode_dict(x)
 
4070
 */
 
4071
      __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_list(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_v_x); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4072
      goto __pyx_L9;
 
4073
    }
 
4074
 
 
4075
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":384
 
4076
 *                   or StaticTuple_CheckExact(x)):
 
4077
 *                 self._encode_list(x)
 
4078
 *             elif PyDict_CheckExact(x):             # <<<<<<<<<<<<<<
 
4079
 *                 self._encode_dict(x)
 
4080
 *             elif PyBool_Check(x):
 
4081
 */
 
4082
    __pyx_t_4 = PyDict_CheckExact(__pyx_v_x);
 
4083
    if (__pyx_t_4) {
 
4084
 
 
4085
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":385
 
4086
 *                 self._encode_list(x)
 
4087
 *             elif PyDict_CheckExact(x):
 
4088
 *                 self._encode_dict(x)             # <<<<<<<<<<<<<<
 
4089
 *             elif PyBool_Check(x):
 
4090
 *                 self._encode_int(int(x))
 
4091
 */
 
4092
      __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_dict(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_v_x); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4093
      goto __pyx_L9;
 
4094
    }
 
4095
 
 
4096
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":386
 
4097
 *             elif PyDict_CheckExact(x):
 
4098
 *                 self._encode_dict(x)
 
4099
 *             elif PyBool_Check(x):             # <<<<<<<<<<<<<<
 
4100
 *                 self._encode_int(int(x))
 
4101
 *             elif isinstance(x, Bencached):
 
4102
 */
 
4103
    __pyx_t_4 = PyBool_Check(__pyx_v_x);
 
4104
    if (__pyx_t_4) {
 
4105
 
 
4106
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":387
 
4107
 *                 self._encode_dict(x)
 
4108
 *             elif PyBool_Check(x):
 
4109
 *                 self._encode_int(int(x))             # <<<<<<<<<<<<<<
 
4110
 *             elif isinstance(x, Bencached):
 
4111
 *                 self._append_string(x.bencoded)
 
4112
 */
 
4113
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4114
      __Pyx_GOTREF(__pyx_t_3);
 
4115
      __Pyx_INCREF(__pyx_v_x);
 
4116
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
 
4117
      __Pyx_GIVEREF(__pyx_v_x);
 
4118
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4119
      __Pyx_GOTREF(__pyx_t_2);
 
4120
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4121
      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4122
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4123
      __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_encode_int(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_t_4); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4124
      goto __pyx_L9;
 
4125
    }
 
4126
 
 
4127
    /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":388
 
4128
 *             elif PyBool_Check(x):
 
4129
 *                 self._encode_int(int(x))
 
4130
 *             elif isinstance(x, Bencached):             # <<<<<<<<<<<<<<
 
4131
 *                 self._append_string(x.bencoded)
 
4132
 *             else:
 
4133
 */
 
4134
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Bencached); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4135
    __Pyx_GOTREF(__pyx_t_2);
 
4136
    __pyx_t_7 = PyObject_IsInstance(__pyx_v_x, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4137
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4138
    if (__pyx_t_7) {
 
4139
 
 
4140
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":389
 
4141
 *                 self._encode_int(int(x))
 
4142
 *             elif isinstance(x, Bencached):
 
4143
 *                 self._append_string(x.bencoded)             # <<<<<<<<<<<<<<
 
4144
 *             else:
 
4145
 *                 raise TypeError('unsupported type %r' % x)
 
4146
 */
 
4147
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__bencoded); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4148
      __Pyx_GOTREF(__pyx_t_2);
 
4149
      __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder *)((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self)->__pyx_vtab)->_append_string(((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_v_self), __pyx_t_2); if (unlikely(__pyx_t_1 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4150
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4151
      goto __pyx_L9;
1766
4152
    }
1767
4153
    /*else*/ {
1768
 
      __pyx_2 = PyNumber_Remainder(__pyx_k33p, __pyx_v_x); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L4;}
1769
 
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L4;}
1770
 
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
1771
 
      __pyx_2 = 0;
1772
 
      __pyx_2 = PyObject_CallObject(PyExc_TypeError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L4;}
1773
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
1774
 
      __Pyx_Raise(__pyx_2, 0, 0);
1775
 
      Py_DECREF(__pyx_2); __pyx_2 = 0;
1776
 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L4;}
 
4154
 
 
4155
      /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":391
 
4156
 *                 self._append_string(x.bencoded)
 
4157
 *             else:
 
4158
 *                 raise TypeError('unsupported type %r' % x)             # <<<<<<<<<<<<<<
 
4159
 *         finally:
 
4160
 *             Py_LeaveRecursiveCall()
 
4161
 */
 
4162
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4163
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
4164
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4165
      __Pyx_GOTREF(__pyx_t_3);
 
4166
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
 
4167
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
 
4168
      __pyx_t_2 = 0;
 
4169
      __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L7;}
 
4170
      __Pyx_GOTREF(__pyx_t_2);
 
4171
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4172
      __Pyx_Raise(__pyx_t_2, 0, 0);
 
4173
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4174
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L7;}
1777
4175
    }
1778
 
    __pyx_L6:;
 
4176
    __pyx_L9:;
1779
4177
  }
 
4178
 
 
4179
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":393
 
4180
 *                 raise TypeError('unsupported type %r' % x)
 
4181
 *         finally:
 
4182
 *             Py_LeaveRecursiveCall()             # <<<<<<<<<<<<<<
 
4183
 * 
 
4184
 * 
 
4185
 */
1780
4186
  /*finally:*/ {
1781
4187
    int __pyx_why;
1782
4188
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
1783
4189
    int __pyx_exc_lineno;
1784
 
    __pyx_why = 0; goto __pyx_L5;
1785
 
    __pyx_L4: {
 
4190
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
 
4191
    __pyx_why = 0; goto __pyx_L8;
 
4192
    __pyx_L7: {
1786
4193
      __pyx_why = 4;
1787
 
      Py_XDECREF(__pyx_3); __pyx_3 = 0;
1788
 
      Py_XDECREF(__pyx_2); __pyx_2 = 0;
1789
 
      PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
 
4194
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4195
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4196
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
1790
4197
      __pyx_exc_lineno = __pyx_lineno;
1791
 
      goto __pyx_L5;
 
4198
      goto __pyx_L8;
1792
4199
    }
1793
 
    __pyx_L5:;
 
4200
    __pyx_L8:;
1794
4201
    Py_LeaveRecursiveCall();
1795
4202
    switch (__pyx_why) {
1796
4203
      case 4: {
1797
 
        PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
 
4204
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
1798
4205
        __pyx_lineno = __pyx_exc_lineno;
1799
4206
        __pyx_exc_type = 0;
1800
4207
        __pyx_exc_value = 0;
1801
4208
        __pyx_exc_tb = 0;
1802
 
        goto __pyx_L1;
 
4209
        goto __pyx_L1_error;
1803
4210
      }
1804
4211
    }
1805
4212
  }
1806
4213
 
1807
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
 
4214
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1808
4215
  goto __pyx_L0;
1809
 
  __pyx_L1:;
1810
 
  Py_XDECREF(__pyx_2);
1811
 
  Py_XDECREF(__pyx_3);
 
4216
  __pyx_L1_error:;
 
4217
  __Pyx_XDECREF(__pyx_t_2);
 
4218
  __Pyx_XDECREF(__pyx_t_3);
1812
4219
  __Pyx_AddTraceback("bzrlib._bencode_pyx.Encoder.process");
1813
 
  __pyx_r = 0;
 
4220
  __pyx_r = NULL;
1814
4221
  __pyx_L0:;
1815
 
  Py_DECREF(__pyx_v_self);
1816
 
  Py_DECREF(__pyx_v_x);
 
4222
  __Pyx_XGIVEREF(__pyx_r);
 
4223
  __Pyx_RefNannyFinishContext();
1817
4224
  return __pyx_r;
1818
4225
}
1819
4226
 
1820
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bencode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 
4227
/* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":396
 
4228
 * 
 
4229
 * 
 
4230
 * def bencode(x):             # <<<<<<<<<<<<<<
 
4231
 *     """Encode Python object x to string"""
 
4232
 *     encoder = Encoder()
 
4233
 */
 
4234
 
 
4235
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bencode(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
1821
4236
static char __pyx_doc_6bzrlib_12_bencode_pyx_bencode[] = "Encode Python object x to string";
1822
 
static PyObject *__pyx_f_6bzrlib_12_bencode_pyx_bencode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1823
 
  PyObject *__pyx_v_x = 0;
1824
 
  PyObject *__pyx_v_encoder;
1825
 
  PyObject *__pyx_r;
1826
 
  PyObject *__pyx_1 = 0;
1827
 
  PyObject *__pyx_2 = 0;
1828
 
  PyObject *__pyx_3 = 0;
1829
 
  static char *__pyx_argnames[] = {"x",0};
1830
 
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_x)) return 0;
1831
 
  Py_INCREF(__pyx_v_x);
1832
 
  __pyx_v_encoder = Py_None; Py_INCREF(Py_None);
1833
 
 
1834
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":398 */
1835
 
  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_12_bencode_pyx_Encoder), 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
1836
 
  Py_DECREF(__pyx_v_encoder);
1837
 
  __pyx_v_encoder = __pyx_1;
1838
 
  __pyx_1 = 0;
1839
 
 
1840
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":399 */
1841
 
  __pyx_1 = PyObject_GetAttr(__pyx_v_encoder, __pyx_n_process); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
1842
 
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
1843
 
  Py_INCREF(__pyx_v_x);
1844
 
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
1845
 
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
1846
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1847
 
  Py_DECREF(__pyx_2); __pyx_2 = 0;
1848
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
1849
 
 
1850
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":400 */
1851
 
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; goto __pyx_L1;}
1852
 
  Py_INCREF(__pyx_v_encoder);
1853
 
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_encoder);
1854
 
  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyString_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; goto __pyx_L1;}
1855
 
  Py_DECREF(__pyx_1); __pyx_1 = 0;
1856
 
  __pyx_r = __pyx_2;
1857
 
  __pyx_2 = 0;
1858
 
  goto __pyx_L0;
1859
 
 
1860
 
  __pyx_r = Py_None; Py_INCREF(Py_None);
1861
 
  goto __pyx_L0;
1862
 
  __pyx_L1:;
1863
 
  Py_XDECREF(__pyx_1);
1864
 
  Py_XDECREF(__pyx_2);
1865
 
  Py_XDECREF(__pyx_3);
 
4237
static PyObject *__pyx_pf_6bzrlib_12_bencode_pyx_bencode(PyObject *__pyx_self, PyObject *__pyx_v_x) {
 
4238
  struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *__pyx_v_encoder;
 
4239
  PyObject *__pyx_r = NULL;
 
4240
  PyObject *__pyx_t_1 = NULL;
 
4241
  PyObject *__pyx_t_2 = NULL;
 
4242
  PyObject *__pyx_t_3 = NULL;
 
4243
  __Pyx_RefNannySetupContext("bencode");
 
4244
  __pyx_self = __pyx_self;
 
4245
  __pyx_v_encoder = ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)Py_None); __Pyx_INCREF(Py_None);
 
4246
 
 
4247
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":398
 
4248
 * def bencode(x):
 
4249
 *     """Encode Python object x to string"""
 
4250
 *     encoder = Encoder()             # <<<<<<<<<<<<<<
 
4251
 *     encoder.process(x)
 
4252
 *     return str(encoder)
 
4253
 */
 
4254
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_12_bencode_pyx_Encoder)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4255
  __Pyx_GOTREF(__pyx_t_1);
 
4256
  __Pyx_DECREF(((PyObject *)__pyx_v_encoder));
 
4257
  __pyx_v_encoder = ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)__pyx_t_1);
 
4258
  __pyx_t_1 = 0;
 
4259
 
 
4260
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":399
 
4261
 *     """Encode Python object x to string"""
 
4262
 *     encoder = Encoder()
 
4263
 *     encoder.process(x)             # <<<<<<<<<<<<<<
 
4264
 *     return str(encoder)
 
4265
 */
 
4266
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_encoder), __pyx_n_s__process); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4267
  __Pyx_GOTREF(__pyx_t_1);
 
4268
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4269
  __Pyx_GOTREF(__pyx_t_2);
 
4270
  __Pyx_INCREF(__pyx_v_x);
 
4271
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
 
4272
  __Pyx_GIVEREF(__pyx_v_x);
 
4273
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4274
  __Pyx_GOTREF(__pyx_t_3);
 
4275
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
4276
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
4277
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4278
 
 
4279
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":400
 
4280
 *     encoder = Encoder()
 
4281
 *     encoder.process(x)
 
4282
 *     return str(encoder)             # <<<<<<<<<<<<<<
 
4283
 */
 
4284
  __Pyx_XDECREF(__pyx_r);
 
4285
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4286
  __Pyx_GOTREF(__pyx_t_3);
 
4287
  __Pyx_INCREF(((PyObject *)__pyx_v_encoder));
 
4288
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_encoder));
 
4289
  __Pyx_GIVEREF(((PyObject *)__pyx_v_encoder));
 
4290
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4291
  __Pyx_GOTREF(__pyx_t_2);
 
4292
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4293
  __pyx_r = __pyx_t_2;
 
4294
  __pyx_t_2 = 0;
 
4295
  goto __pyx_L0;
 
4296
 
 
4297
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
 
4298
  goto __pyx_L0;
 
4299
  __pyx_L1_error:;
 
4300
  __Pyx_XDECREF(__pyx_t_1);
 
4301
  __Pyx_XDECREF(__pyx_t_2);
 
4302
  __Pyx_XDECREF(__pyx_t_3);
1866
4303
  __Pyx_AddTraceback("bzrlib._bencode_pyx.bencode");
1867
 
  __pyx_r = 0;
 
4304
  __pyx_r = NULL;
1868
4305
  __pyx_L0:;
1869
 
  Py_DECREF(__pyx_v_encoder);
1870
 
  Py_DECREF(__pyx_v_x);
 
4306
  __Pyx_DECREF((PyObject *)__pyx_v_encoder);
 
4307
  __Pyx_XGIVEREF(__pyx_r);
 
4308
  __Pyx_RefNannyFinishContext();
1871
4309
  return __pyx_r;
1872
4310
}
1873
4311
static struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder;
1877
4315
  PyObject *o = (*t->tp_alloc)(t, 0);
1878
4316
  if (!o) return 0;
1879
4317
  p = ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)o);
1880
 
  *(struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Decoder **)&p->__pyx_vtab = __pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder;
 
4318
  p->__pyx_vtab = __pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder;
1881
4319
  p->text = Py_None; Py_INCREF(Py_None);
1882
4320
  return o;
1883
4321
}
1885
4323
static void __pyx_tp_dealloc_6bzrlib_12_bencode_pyx_Decoder(PyObject *o) {
1886
4324
  struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *p = (struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)o;
1887
4325
  Py_XDECREF(p->text);
1888
 
  (*o->ob_type->tp_free)(o);
 
4326
  (*Py_TYPE(o)->tp_free)(o);
1889
4327
}
1890
4328
 
1891
4329
static int __pyx_tp_traverse_6bzrlib_12_bencode_pyx_Decoder(PyObject *o, visitproc v, void *a) {
1899
4337
 
1900
4338
static int __pyx_tp_clear_6bzrlib_12_bencode_pyx_Decoder(PyObject *o) {
1901
4339
  struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *p = (struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *)o;
1902
 
  PyObject *t;
1903
 
  t = p->text; 
 
4340
  PyObject* tmp;
 
4341
  tmp = ((PyObject*)p->text);
1904
4342
  p->text = Py_None; Py_INCREF(Py_None);
1905
 
  Py_XDECREF(t);
 
4343
  Py_XDECREF(tmp);
1906
4344
  return 0;
1907
4345
}
1908
4346
 
1909
 
static struct PyMethodDef __pyx_methods_6bzrlib_12_bencode_pyx_Decoder[] = {
1910
 
  {"decode", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode, METH_VARARGS|METH_KEYWORDS, 0},
1911
 
  {"decode_object", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_7Decoder_decode_object, METH_VARARGS|METH_KEYWORDS, 0},
 
4347
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder_tail(PyObject *o, void *x) {
 
4348
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4tail___get__(o);
 
4349
}
 
4350
 
 
4351
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder_size(PyObject *o, void *x) {
 
4352
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_4size___get__(o);
 
4353
}
 
4354
 
 
4355
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder__yield_tuples(PyObject *o, void *x) {
 
4356
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_13_yield_tuples___get__(o);
 
4357
}
 
4358
 
 
4359
static PyMethodDef __pyx_methods_6bzrlib_12_bencode_pyx_Decoder[] = {
 
4360
  {__Pyx_NAMESTR("decode"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode, METH_NOARGS, __Pyx_DOCSTR(0)},
 
4361
  {__Pyx_NAMESTR("decode_object"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_7Decoder_decode_object, METH_NOARGS, __Pyx_DOCSTR(0)},
1912
4362
  {0, 0, 0, 0}
1913
4363
};
1914
4364
 
1915
 
static struct PyMemberDef __pyx_members_6bzrlib_12_bencode_pyx_Decoder[] = {
1916
 
  {"tail", T_STRING, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder, tail), READONLY, 0},
1917
 
  {"size", T_INT, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder, size), READONLY, 0},
1918
 
  {"_yield_tuples", T_INT, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder, _yield_tuples), READONLY, 0},
 
4365
static struct PyGetSetDef __pyx_getsets_6bzrlib_12_bencode_pyx_Decoder[] = {
 
4366
  {(char *)"tail", __pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder_tail, 0, 0, 0},
 
4367
  {(char *)"size", __pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder_size, 0, 0, 0},
 
4368
  {(char *)"_yield_tuples", __pyx_getprop_6bzrlib_12_bencode_pyx_7Decoder__yield_tuples, 0, 0, 0},
1919
4369
  {0, 0, 0, 0, 0}
1920
4370
};
1921
4371
 
1923
4373
  0, /*nb_add*/
1924
4374
  0, /*nb_subtract*/
1925
4375
  0, /*nb_multiply*/
 
4376
  #if PY_MAJOR_VERSION < 3
1926
4377
  0, /*nb_divide*/
 
4378
  #endif
1927
4379
  0, /*nb_remainder*/
1928
4380
  0, /*nb_divmod*/
1929
4381
  0, /*nb_power*/
1937
4389
  0, /*nb_and*/
1938
4390
  0, /*nb_xor*/
1939
4391
  0, /*nb_or*/
 
4392
  #if PY_MAJOR_VERSION < 3
1940
4393
  0, /*nb_coerce*/
 
4394
  #endif
1941
4395
  0, /*nb_int*/
 
4396
  #if PY_MAJOR_VERSION < 3
1942
4397
  0, /*nb_long*/
 
4398
  #else
 
4399
  0, /*reserved*/
 
4400
  #endif
1943
4401
  0, /*nb_float*/
 
4402
  #if PY_MAJOR_VERSION < 3
1944
4403
  0, /*nb_oct*/
 
4404
  #endif
 
4405
  #if PY_MAJOR_VERSION < 3
1945
4406
  0, /*nb_hex*/
 
4407
  #endif
1946
4408
  0, /*nb_inplace_add*/
1947
4409
  0, /*nb_inplace_subtract*/
1948
4410
  0, /*nb_inplace_multiply*/
 
4411
  #if PY_MAJOR_VERSION < 3
1949
4412
  0, /*nb_inplace_divide*/
 
4413
  #endif
1950
4414
  0, /*nb_inplace_remainder*/
1951
4415
  0, /*nb_inplace_power*/
1952
4416
  0, /*nb_inplace_lshift*/
1958
4422
  0, /*nb_true_divide*/
1959
4423
  0, /*nb_inplace_floor_divide*/
1960
4424
  0, /*nb_inplace_true_divide*/
1961
 
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
 
4425
  #if PY_VERSION_HEX >= 0x02050000
1962
4426
  0, /*nb_index*/
1963
4427
  #endif
1964
4428
};
1983
4447
};
1984
4448
 
1985
4449
static PyBufferProcs __pyx_tp_as_buffer_Decoder = {
 
4450
  #if PY_MAJOR_VERSION < 3
1986
4451
  0, /*bf_getreadbuffer*/
 
4452
  #endif
 
4453
  #if PY_MAJOR_VERSION < 3
1987
4454
  0, /*bf_getwritebuffer*/
 
4455
  #endif
 
4456
  #if PY_MAJOR_VERSION < 3
1988
4457
  0, /*bf_getsegcount*/
 
4458
  #endif
 
4459
  #if PY_MAJOR_VERSION < 3
1989
4460
  0, /*bf_getcharbuffer*/
 
4461
  #endif
 
4462
  #if PY_VERSION_HEX >= 0x02060000
 
4463
  0, /*bf_getbuffer*/
 
4464
  #endif
 
4465
  #if PY_VERSION_HEX >= 0x02060000
 
4466
  0, /*bf_releasebuffer*/
 
4467
  #endif
1990
4468
};
1991
4469
 
1992
4470
PyTypeObject __pyx_type_6bzrlib_12_bencode_pyx_Decoder = {
1993
 
  PyObject_HEAD_INIT(0)
1994
 
  0, /*ob_size*/
1995
 
  "bzrlib._bencode_pyx.Decoder", /*tp_name*/
 
4471
  PyVarObject_HEAD_INIT(0, 0)
 
4472
  __Pyx_NAMESTR("bzrlib._bencode_pyx.Decoder"), /*tp_name*/
1996
4473
  sizeof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder), /*tp_basicsize*/
1997
4474
  0, /*tp_itemsize*/
1998
4475
  __pyx_tp_dealloc_6bzrlib_12_bencode_pyx_Decoder, /*tp_dealloc*/
1999
4476
  0, /*tp_print*/
2000
4477
  0, /*tp_getattr*/
2001
4478
  0, /*tp_setattr*/
 
4479
  #if PY_MAJOR_VERSION < 3
2002
4480
  0, /*tp_compare*/
 
4481
  #else
 
4482
  0, /*reserved*/
 
4483
  #endif
2003
4484
  0, /*tp_repr*/
2004
4485
  &__pyx_tp_as_number_Decoder, /*tp_as_number*/
2005
4486
  &__pyx_tp_as_sequence_Decoder, /*tp_as_sequence*/
2010
4491
  0, /*tp_getattro*/
2011
4492
  0, /*tp_setattro*/
2012
4493
  &__pyx_tp_as_buffer_Decoder, /*tp_as_buffer*/
2013
 
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
2014
 
  "Bencode decoder", /*tp_doc*/
 
4494
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
 
4495
  __Pyx_DOCSTR("Bencode decoder"), /*tp_doc*/
2015
4496
  __pyx_tp_traverse_6bzrlib_12_bencode_pyx_Decoder, /*tp_traverse*/
2016
4497
  __pyx_tp_clear_6bzrlib_12_bencode_pyx_Decoder, /*tp_clear*/
2017
4498
  0, /*tp_richcompare*/
2019
4500
  0, /*tp_iter*/
2020
4501
  0, /*tp_iternext*/
2021
4502
  __pyx_methods_6bzrlib_12_bencode_pyx_Decoder, /*tp_methods*/
2022
 
  __pyx_members_6bzrlib_12_bencode_pyx_Decoder, /*tp_members*/
2023
 
  0, /*tp_getset*/
 
4503
  0, /*tp_members*/
 
4504
  __pyx_getsets_6bzrlib_12_bencode_pyx_Decoder, /*tp_getset*/
2024
4505
  0, /*tp_base*/
2025
4506
  0, /*tp_dict*/
2026
4507
  0, /*tp_descr_get*/
2027
4508
  0, /*tp_descr_set*/
2028
4509
  0, /*tp_dictoffset*/
2029
 
  __pyx_f_6bzrlib_12_bencode_pyx_7Decoder___init__, /*tp_init*/
 
4510
  __pyx_pf_6bzrlib_12_bencode_pyx_7Decoder___init__, /*tp_init*/
2030
4511
  0, /*tp_alloc*/
2031
4512
  __pyx_tp_new_6bzrlib_12_bencode_pyx_Decoder, /*tp_new*/
2032
4513
  0, /*tp_free*/
2036
4517
  0, /*tp_cache*/
2037
4518
  0, /*tp_subclasses*/
2038
4519
  0, /*tp_weaklist*/
 
4520
  0, /*tp_del*/
 
4521
  #if PY_VERSION_HEX >= 0x02060000
 
4522
  0, /*tp_version_tag*/
 
4523
  #endif
2039
4524
};
2040
4525
static struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder;
2041
4526
 
2044
4529
  PyObject *o = (*t->tp_alloc)(t, 0);
2045
4530
  if (!o) return 0;
2046
4531
  p = ((struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *)o);
2047
 
  *(struct __pyx_vtabstruct_6bzrlib_12_bencode_pyx_Encoder **)&p->__pyx_vtab = __pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder;
 
4532
  p->__pyx_vtab = __pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder;
2048
4533
  return o;
2049
4534
}
2050
4535
 
2052
4537
  {
2053
4538
    PyObject *etype, *eval, *etb;
2054
4539
    PyErr_Fetch(&etype, &eval, &etb);
2055
 
    ++o->ob_refcnt;
2056
 
    __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(o);
 
4540
    ++Py_REFCNT(o);
 
4541
    __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___dealloc__(o);
2057
4542
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
2058
 
    --o->ob_refcnt;
 
4543
    --Py_REFCNT(o);
2059
4544
    PyErr_Restore(etype, eval, etb);
2060
4545
  }
2061
 
  (*o->ob_type->tp_free)(o);
2062
 
}
2063
 
 
2064
 
static struct PyMethodDef __pyx_methods_6bzrlib_12_bencode_pyx_Encoder[] = {
2065
 
  {"process", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_7Encoder_process, METH_VARARGS|METH_KEYWORDS, 0},
 
4546
  (*Py_TYPE(o)->tp_free)(o);
 
4547
}
 
4548
 
 
4549
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_tail(PyObject *o, void *x) {
 
4550
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4tail___get__(o);
 
4551
}
 
4552
 
 
4553
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_size(PyObject *o, void *x) {
 
4554
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_4size___get__(o);
 
4555
}
 
4556
 
 
4557
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_buffer(PyObject *o, void *x) {
 
4558
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_6buffer___get__(o);
 
4559
}
 
4560
 
 
4561
static PyObject *__pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_maxsize(PyObject *o, void *x) {
 
4562
  return __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_7maxsize___get__(o);
 
4563
}
 
4564
 
 
4565
static PyMethodDef __pyx_methods_6bzrlib_12_bencode_pyx_Encoder[] = {
 
4566
  {__Pyx_NAMESTR("process"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_7Encoder_process, METH_O, __Pyx_DOCSTR(0)},
2066
4567
  {0, 0, 0, 0}
2067
4568
};
2068
4569
 
2069
 
static struct PyMemberDef __pyx_members_6bzrlib_12_bencode_pyx_Encoder[] = {
2070
 
  {"tail", T_STRING, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder, tail), READONLY, 0},
2071
 
  {"size", T_INT, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder, size), READONLY, 0},
2072
 
  {"buffer", T_STRING, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder, buffer), READONLY, 0},
2073
 
  {"maxsize", T_INT, offsetof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder, maxsize), READONLY, 0},
 
4570
static struct PyGetSetDef __pyx_getsets_6bzrlib_12_bencode_pyx_Encoder[] = {
 
4571
  {(char *)"tail", __pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_tail, 0, 0, 0},
 
4572
  {(char *)"size", __pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_size, 0, 0, 0},
 
4573
  {(char *)"buffer", __pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_buffer, 0, 0, 0},
 
4574
  {(char *)"maxsize", __pyx_getprop_6bzrlib_12_bencode_pyx_7Encoder_maxsize, 0, 0, 0},
2074
4575
  {0, 0, 0, 0, 0}
2075
4576
};
2076
4577
 
2078
4579
  0, /*nb_add*/
2079
4580
  0, /*nb_subtract*/
2080
4581
  0, /*nb_multiply*/
 
4582
  #if PY_MAJOR_VERSION < 3
2081
4583
  0, /*nb_divide*/
 
4584
  #endif
2082
4585
  0, /*nb_remainder*/
2083
4586
  0, /*nb_divmod*/
2084
4587
  0, /*nb_power*/
2092
4595
  0, /*nb_and*/
2093
4596
  0, /*nb_xor*/
2094
4597
  0, /*nb_or*/
 
4598
  #if PY_MAJOR_VERSION < 3
2095
4599
  0, /*nb_coerce*/
 
4600
  #endif
2096
4601
  0, /*nb_int*/
 
4602
  #if PY_MAJOR_VERSION < 3
2097
4603
  0, /*nb_long*/
 
4604
  #else
 
4605
  0, /*reserved*/
 
4606
  #endif
2098
4607
  0, /*nb_float*/
 
4608
  #if PY_MAJOR_VERSION < 3
2099
4609
  0, /*nb_oct*/
 
4610
  #endif
 
4611
  #if PY_MAJOR_VERSION < 3
2100
4612
  0, /*nb_hex*/
 
4613
  #endif
2101
4614
  0, /*nb_inplace_add*/
2102
4615
  0, /*nb_inplace_subtract*/
2103
4616
  0, /*nb_inplace_multiply*/
 
4617
  #if PY_MAJOR_VERSION < 3
2104
4618
  0, /*nb_inplace_divide*/
 
4619
  #endif
2105
4620
  0, /*nb_inplace_remainder*/
2106
4621
  0, /*nb_inplace_power*/
2107
4622
  0, /*nb_inplace_lshift*/
2113
4628
  0, /*nb_true_divide*/
2114
4629
  0, /*nb_inplace_floor_divide*/
2115
4630
  0, /*nb_inplace_true_divide*/
2116
 
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
 
4631
  #if PY_VERSION_HEX >= 0x02050000
2117
4632
  0, /*nb_index*/
2118
4633
  #endif
2119
4634
};
2138
4653
};
2139
4654
 
2140
4655
static PyBufferProcs __pyx_tp_as_buffer_Encoder = {
 
4656
  #if PY_MAJOR_VERSION < 3
2141
4657
  0, /*bf_getreadbuffer*/
 
4658
  #endif
 
4659
  #if PY_MAJOR_VERSION < 3
2142
4660
  0, /*bf_getwritebuffer*/
 
4661
  #endif
 
4662
  #if PY_MAJOR_VERSION < 3
2143
4663
  0, /*bf_getsegcount*/
 
4664
  #endif
 
4665
  #if PY_MAJOR_VERSION < 3
2144
4666
  0, /*bf_getcharbuffer*/
 
4667
  #endif
 
4668
  #if PY_VERSION_HEX >= 0x02060000
 
4669
  0, /*bf_getbuffer*/
 
4670
  #endif
 
4671
  #if PY_VERSION_HEX >= 0x02060000
 
4672
  0, /*bf_releasebuffer*/
 
4673
  #endif
2145
4674
};
2146
4675
 
2147
4676
PyTypeObject __pyx_type_6bzrlib_12_bencode_pyx_Encoder = {
2148
 
  PyObject_HEAD_INIT(0)
2149
 
  0, /*ob_size*/
2150
 
  "bzrlib._bencode_pyx.Encoder", /*tp_name*/
 
4677
  PyVarObject_HEAD_INIT(0, 0)
 
4678
  __Pyx_NAMESTR("bzrlib._bencode_pyx.Encoder"), /*tp_name*/
2151
4679
  sizeof(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder), /*tp_basicsize*/
2152
4680
  0, /*tp_itemsize*/
2153
4681
  __pyx_tp_dealloc_6bzrlib_12_bencode_pyx_Encoder, /*tp_dealloc*/
2154
4682
  0, /*tp_print*/
2155
4683
  0, /*tp_getattr*/
2156
4684
  0, /*tp_setattr*/
 
4685
  #if PY_MAJOR_VERSION < 3
2157
4686
  0, /*tp_compare*/
 
4687
  #else
 
4688
  0, /*reserved*/
 
4689
  #endif
2158
4690
  0, /*tp_repr*/
2159
4691
  &__pyx_tp_as_number_Encoder, /*tp_as_number*/
2160
4692
  &__pyx_tp_as_sequence_Encoder, /*tp_as_sequence*/
2161
4693
  &__pyx_tp_as_mapping_Encoder, /*tp_as_mapping*/
2162
4694
  0, /*tp_hash*/
2163
4695
  0, /*tp_call*/
2164
 
  __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___str__, /*tp_str*/
 
4696
  __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___str__, /*tp_str*/
2165
4697
  0, /*tp_getattro*/
2166
4698
  0, /*tp_setattro*/
2167
4699
  &__pyx_tp_as_buffer_Encoder, /*tp_as_buffer*/
2168
 
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
2169
 
  "Bencode encoder", /*tp_doc*/
 
4700
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
 
4701
  __Pyx_DOCSTR("Bencode encoder"), /*tp_doc*/
2170
4702
  0, /*tp_traverse*/
2171
4703
  0, /*tp_clear*/
2172
4704
  0, /*tp_richcompare*/
2174
4706
  0, /*tp_iter*/
2175
4707
  0, /*tp_iternext*/
2176
4708
  __pyx_methods_6bzrlib_12_bencode_pyx_Encoder, /*tp_methods*/
2177
 
  __pyx_members_6bzrlib_12_bencode_pyx_Encoder, /*tp_members*/
2178
 
  0, /*tp_getset*/
 
4709
  0, /*tp_members*/
 
4710
  __pyx_getsets_6bzrlib_12_bencode_pyx_Encoder, /*tp_getset*/
2179
4711
  0, /*tp_base*/
2180
4712
  0, /*tp_dict*/
2181
4713
  0, /*tp_descr_get*/
2182
4714
  0, /*tp_descr_set*/
2183
4715
  0, /*tp_dictoffset*/
2184
 
  __pyx_f_6bzrlib_12_bencode_pyx_7Encoder___init__, /*tp_init*/
 
4716
  __pyx_pf_6bzrlib_12_bencode_pyx_7Encoder___init__, /*tp_init*/
2185
4717
  0, /*tp_alloc*/
2186
4718
  __pyx_tp_new_6bzrlib_12_bencode_pyx_Encoder, /*tp_new*/
2187
4719
  0, /*tp_free*/
2191
4723
  0, /*tp_cache*/
2192
4724
  0, /*tp_subclasses*/
2193
4725
  0, /*tp_weaklist*/
 
4726
  0, /*tp_del*/
 
4727
  #if PY_VERSION_HEX >= 0x02060000
 
4728
  0, /*tp_version_tag*/
 
4729
  #endif
2194
4730
};
2195
4731
 
2196
 
static struct PyMethodDef __pyx_methods[] = {
2197
 
  {"bdecode", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_bdecode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_12_bencode_pyx_bdecode},
2198
 
  {"bdecode_as_tuple", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_bdecode_as_tuple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_12_bencode_pyx_bdecode_as_tuple},
2199
 
  {"bencode", (PyCFunction)__pyx_f_6bzrlib_12_bencode_pyx_bencode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_12_bencode_pyx_bencode},
 
4732
static PyMethodDef __pyx_methods[] = {
 
4733
  {__Pyx_NAMESTR("bdecode"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_bdecode, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_12_bencode_pyx_bdecode)},
 
4734
  {__Pyx_NAMESTR("bdecode_as_tuple"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_bdecode_as_tuple, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_12_bencode_pyx_bdecode_as_tuple)},
 
4735
  {__Pyx_NAMESTR("bencode"), (PyCFunction)__pyx_pf_6bzrlib_12_bencode_pyx_bencode, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_12_bencode_pyx_bencode)},
2200
4736
  {0, 0, 0, 0}
2201
4737
};
2202
4738
 
2203
 
static void __pyx_init_filenames(void); /*proto*/
2204
 
 
 
4739
#if PY_MAJOR_VERSION >= 3
 
4740
static struct PyModuleDef __pyx_moduledef = {
 
4741
    PyModuleDef_HEAD_INIT,
 
4742
    __Pyx_NAMESTR("_bencode_pyx"),
 
4743
    __Pyx_DOCSTR(__pyx_k_24), /* m_doc */
 
4744
    -1, /* m_size */
 
4745
    __pyx_methods /* m_methods */,
 
4746
    NULL, /* m_reload */
 
4747
    NULL, /* m_traverse */
 
4748
    NULL, /* m_clear */
 
4749
    NULL /* m_free */
 
4750
};
 
4751
#endif
 
4752
 
 
4753
static __Pyx_StringTabEntry __pyx_string_tab[] = {
 
4754
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
 
4755
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
 
4756
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
 
4757
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
 
4758
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
 
4759
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
 
4760
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
 
4761
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
 
4762
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
 
4763
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
 
4764
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
 
4765
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
 
4766
  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
 
4767
  {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0},
 
4768
  {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0},
 
4769
  {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0},
 
4770
  {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
 
4771
  {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
 
4772
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
 
4773
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
 
4774
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
 
4775
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
 
4776
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
 
4777
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
 
4778
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
 
4779
  {&__pyx_n_s__Bencached, __pyx_k__Bencached, sizeof(__pyx_k__Bencached), 0, 0, 1, 1},
 
4780
  {&__pyx_n_s__Decoder, __pyx_k__Decoder, sizeof(__pyx_k__Decoder), 0, 0, 1, 1},
 
4781
  {&__pyx_n_s__Encoder, __pyx_k__Encoder, sizeof(__pyx_k__Encoder), 0, 0, 1, 1},
 
4782
  {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
 
4783
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
 
4784
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
 
4785
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
 
4786
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
 
4787
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
 
4788
  {&__pyx_n_s____slots__, __pyx_k____slots__, sizeof(__pyx_k____slots__), 0, 0, 1, 1},
 
4789
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
 
4790
  {&__pyx_n_s___append_string, __pyx_k___append_string, sizeof(__pyx_k___append_string), 0, 0, 1, 1},
 
4791
  {&__pyx_n_s___decode_dict, __pyx_k___decode_dict, sizeof(__pyx_k___decode_dict), 0, 0, 1, 1},
 
4792
  {&__pyx_n_s___decode_int, __pyx_k___decode_int, sizeof(__pyx_k___decode_int), 0, 0, 1, 1},
 
4793
  {&__pyx_n_s___decode_list, __pyx_k___decode_list, sizeof(__pyx_k___decode_list), 0, 0, 1, 1},
 
4794
  {&__pyx_n_s___decode_object, __pyx_k___decode_object, sizeof(__pyx_k___decode_object), 0, 0, 1, 1},
 
4795
  {&__pyx_n_s___decode_string, __pyx_k___decode_string, sizeof(__pyx_k___decode_string), 0, 0, 1, 1},
 
4796
  {&__pyx_n_s___encode_dict, __pyx_k___encode_dict, sizeof(__pyx_k___encode_dict), 0, 0, 1, 1},
 
4797
  {&__pyx_n_s___encode_int, __pyx_k___encode_int, sizeof(__pyx_k___encode_int), 0, 0, 1, 1},
 
4798
  {&__pyx_n_s___encode_list, __pyx_k___encode_list, sizeof(__pyx_k___encode_list), 0, 0, 1, 1},
 
4799
  {&__pyx_n_s___encode_long, __pyx_k___encode_long, sizeof(__pyx_k___encode_long), 0, 0, 1, 1},
 
4800
  {&__pyx_n_s___encode_string, __pyx_k___encode_string, sizeof(__pyx_k___encode_string), 0, 0, 1, 1},
 
4801
  {&__pyx_n_s___ensure_buffer, __pyx_k___ensure_buffer, sizeof(__pyx_k___ensure_buffer), 0, 0, 1, 1},
 
4802
  {&__pyx_n_s___read_digits, __pyx_k___read_digits, sizeof(__pyx_k___read_digits), 0, 0, 1, 1},
 
4803
  {&__pyx_n_s___yield_tuples, __pyx_k___yield_tuples, sizeof(__pyx_k___yield_tuples), 0, 0, 1, 1},
 
4804
  {&__pyx_n_s__bdecode, __pyx_k__bdecode, sizeof(__pyx_k__bdecode), 0, 0, 1, 1},
 
4805
  {&__pyx_n_s__bdecode_as_tuple, __pyx_k__bdecode_as_tuple, sizeof(__pyx_k__bdecode_as_tuple), 0, 0, 1, 1},
 
4806
  {&__pyx_n_s__bencode, __pyx_k__bencode, sizeof(__pyx_k__bencode), 0, 0, 1, 1},
 
4807
  {&__pyx_n_s__bencoded, __pyx_k__bencoded, sizeof(__pyx_k__bencoded), 0, 0, 1, 1},
 
4808
  {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
 
4809
  {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
 
4810
  {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
 
4811
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
 
4812
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
 
4813
  {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1},
 
4814
  {&__pyx_n_s__maxsize, __pyx_k__maxsize, sizeof(__pyx_k__maxsize), 0, 0, 1, 1},
 
4815
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
 
4816
  {&__pyx_n_s__process, __pyx_k__process, sizeof(__pyx_k__process), 0, 0, 1, 1},
 
4817
  {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
 
4818
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
 
4819
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
 
4820
  {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1},
 
4821
  {&__pyx_n_s__tail, __pyx_k__tail, sizeof(__pyx_k__tail), 0, 0, 1, 1},
 
4822
  {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
 
4823
  {&__pyx_n_s__yield_tuples, __pyx_k__yield_tuples, sizeof(__pyx_k__yield_tuples), 0, 0, 1, 1},
 
4824
  {0, 0, 0, 0, 0, 0, 0}
 
4825
};
 
4826
static int __Pyx_InitCachedBuiltins(void) {
 
4827
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4828
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4829
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4830
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4831
  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4832
  return 0;
 
4833
  __pyx_L1_error:;
 
4834
  return -1;
 
4835
}
 
4836
 
 
4837
static int __Pyx_InitGlobals(void) {
 
4838
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4839
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4840
  return 0;
 
4841
  __pyx_L1_error:;
 
4842
  return -1;
 
4843
}
 
4844
 
 
4845
#if PY_MAJOR_VERSION < 3
2205
4846
PyMODINIT_FUNC init_bencode_pyx(void); /*proto*/
2206
 
PyMODINIT_FUNC init_bencode_pyx(void) {
2207
 
  int __pyx_1;
2208
 
  PyObject *__pyx_2 = 0;
2209
 
  PyObject *__pyx_3 = 0;
2210
 
  PyObject *__pyx_4 = 0;
2211
 
  PyObject *__pyx_5 = 0;
2212
 
  PyObject *__pyx_6 = 0;
2213
 
  __pyx_init_filenames();
2214
 
  __pyx_m = Py_InitModule4("_bencode_pyx", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
2215
 
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
4847
PyMODINIT_FUNC init_bencode_pyx(void)
 
4848
#else
 
4849
PyMODINIT_FUNC PyInit__bencode_pyx(void); /*proto*/
 
4850
PyMODINIT_FUNC PyInit__bencode_pyx(void)
 
4851
#endif
 
4852
{
 
4853
  int __pyx_t_1;
 
4854
  PyObject *__pyx_t_2 = NULL;
 
4855
  PyObject *__pyx_t_3 = NULL;
 
4856
  PyObject *__pyx_t_4 = NULL;
 
4857
  PyObject *__pyx_t_5 = NULL;
 
4858
  #if CYTHON_REFNANNY
 
4859
  void* __pyx_refnanny = NULL;
 
4860
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
 
4861
  if (!__Pyx_RefNanny) {
 
4862
      PyErr_Clear();
 
4863
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
 
4864
      if (!__Pyx_RefNanny)
 
4865
          Py_FatalError("failed to import 'refnanny' module");
 
4866
  }
 
4867
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__bencode_pyx(void)", __LINE__, __FILE__);
 
4868
  #endif
 
4869
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4870
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4871
  #ifdef __pyx_binding_PyCFunctionType_USED
 
4872
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4873
  #endif
 
4874
  /*--- Library function declarations ---*/
 
4875
  /*--- Threads initialization code ---*/
 
4876
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
 
4877
  #ifdef WITH_THREAD /* Python build with threading support? */
 
4878
  PyEval_InitThreads();
 
4879
  #endif
 
4880
  #endif
 
4881
  /*--- Module creation code ---*/
 
4882
  #if PY_MAJOR_VERSION < 3
 
4883
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_bencode_pyx"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_24), 0, PYTHON_API_VERSION);
 
4884
  #else
 
4885
  __pyx_m = PyModule_Create(&__pyx_moduledef);
 
4886
  #endif
 
4887
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4888
  #if PY_MAJOR_VERSION < 3
2216
4889
  Py_INCREF(__pyx_m);
2217
 
  __pyx_b = PyImport_AddModule("__builtin__");
2218
 
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
2219
 
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
2220
 
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
4890
  #endif
 
4891
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
 
4892
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4893
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4894
  /*--- Initialize various global constants etc. ---*/
 
4895
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4896
  if (__pyx_module_is_main_bzrlib___bencode_pyx) {
 
4897
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
 
4898
  }
 
4899
  /*--- Builtin init code ---*/
 
4900
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4901
  /*--- Global init code ---*/
 
4902
  /*--- Function export code ---*/
 
4903
  /*--- Type init code ---*/
2221
4904
  __pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder = &__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder;
 
4905
  #if PY_MAJOR_VERSION >= 3
 
4906
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_object = (PyObject *(*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_object;
 
4907
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._read_digits = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *, char))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__read_digits;
 
4908
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_int = (PyObject *(*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_int;
 
4909
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_string = (PyObject *(*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_string;
 
4910
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_list = (PyObject *(*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_list;
 
4911
  __pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_dict = (PyObject *(*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Decoder *))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_dict;
 
4912
  #else
2222
4913
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_object = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_object;
2223
4914
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._read_digits = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__read_digits;
2224
4915
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_int = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_int;
2225
4916
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_string = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_string;
2226
4917
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_list = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_list;
2227
4918
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Decoder._decode_dict = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Decoder__decode_dict;
2228
 
  __pyx_type_6bzrlib_12_bencode_pyx_Decoder.tp_free = _PyObject_GC_Del;
2229
 
  if (PyType_Ready(&__pyx_type_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
2230
 
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_12_bencode_pyx_Decoder.tp_dict, __pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
2231
 
  if (PyObject_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
 
4919
  #endif
 
4920
  if (PyType_Ready(&__pyx_type_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4921
  {
 
4922
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4923
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
 
4924
      __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
 
4925
      __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Decoder___init__.doc = __pyx_doc_6bzrlib_12_bencode_pyx_7Decoder___init__;
 
4926
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Decoder___init__;
 
4927
    }
 
4928
  }
 
4929
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_12_bencode_pyx_Decoder.tp_dict, __pyx_vtabptr_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4930
  if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2232
4931
  __pyx_ptype_6bzrlib_12_bencode_pyx_Decoder = &__pyx_type_6bzrlib_12_bencode_pyx_Decoder;
2233
4932
  __pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder = &__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder;
 
4933
  #if PY_MAJOR_VERSION >= 3
 
4934
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._ensure_buffer = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, int))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__ensure_buffer;
 
4935
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_int = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, int))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_int;
 
4936
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_long = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_long;
 
4937
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._append_string = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__append_string;
 
4938
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_string = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_string;
 
4939
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_list = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_list;
 
4940
  __pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_dict = (int (*)(struct __pyx_obj_6bzrlib_12_bencode_pyx_Encoder *, PyObject *))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_dict;
 
4941
  #else
2234
4942
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._ensure_buffer = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__ensure_buffer;
2235
4943
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_int = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_int;
2236
4944
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_long = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_long;
2238
4946
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_string = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_string;
2239
4947
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_list = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_list;
2240
4948
  *(void(**)(void))&__pyx_vtable_6bzrlib_12_bencode_pyx_Encoder._encode_dict = (void(*)(void))__pyx_f_6bzrlib_12_bencode_pyx_7Encoder__encode_dict;
2241
 
  if (PyType_Ready(&__pyx_type_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
2242
 
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_12_bencode_pyx_Encoder.tp_dict, __pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
2243
 
  if (PyObject_SetAttrString(__pyx_m, "Encoder", (PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
 
4949
  #endif
 
4950
  if (PyType_Ready(&__pyx_type_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4951
  {
 
4952
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Encoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4953
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
 
4954
      __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Encoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
 
4955
      __pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Encoder___init__.doc = __pyx_doc_6bzrlib_12_bencode_pyx_7Encoder___init__;
 
4956
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6bzrlib_12_bencode_pyx_7Encoder___init__;
 
4957
    }
 
4958
  }
 
4959
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_12_bencode_pyx_Encoder.tp_dict, __pyx_vtabptr_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4960
  if (__Pyx_SetAttrString(__pyx_m, "Encoder", (PyObject *)&__pyx_type_6bzrlib_12_bencode_pyx_Encoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2244
4961
  __pyx_ptype_6bzrlib_12_bencode_pyx_Encoder = &__pyx_type_6bzrlib_12_bencode_pyx_Encoder;
2245
 
  __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = __Pyx_ImportType("bzrlib._static_tuple_c", "StaticTuple", sizeof(StaticTuple)); if (!__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}
2246
 
 
2247
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":66 */
2248
 
  __pyx_1 = import_static_tuple_c(); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; goto __pyx_L1;}
2249
 
 
2250
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":77 */
2251
 
  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
2252
 
  __pyx_d1 = __pyx_2;
2253
 
  __pyx_2 = 0;
2254
 
 
2255
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":233 */
2256
 
  __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
2257
 
  __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_object); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
2258
 
  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
2259
 
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
2260
 
  __pyx_4 = 0;
2261
 
  __pyx_4 = __Pyx_CreateClass(__pyx_5, __pyx_3, __pyx_n_Bencached, "bzrlib._bencode_pyx"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
2262
 
  Py_DECREF(__pyx_5); __pyx_5 = 0;
2263
 
 
2264
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":234 */
2265
 
  __pyx_5 = PyList_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
2266
 
  Py_INCREF(__pyx_n_bencoded);
2267
 
  PyList_SET_ITEM(__pyx_5, 0, __pyx_n_bencoded);
2268
 
  if (PyObject_SetAttr(__pyx_4, __pyx_n___slots__, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
2269
 
  Py_DECREF(__pyx_5); __pyx_5 = 0;
2270
 
 
2271
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":236 */
2272
 
  __pyx_5 = PyCFunction_New(&__pyx_mdef_6bzrlib_12_bencode_pyx_9Bencached___init__, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
2273
 
  __pyx_6 = PyMethod_New(__pyx_5, 0, __pyx_4); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
2274
 
  Py_DECREF(__pyx_5); __pyx_5 = 0;
2275
 
  if (PyObject_SetAttr(__pyx_4, __pyx_n___init__, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
2276
 
  Py_DECREF(__pyx_6); __pyx_6 = 0;
2277
 
  if (PyObject_SetAttr(__pyx_m, __pyx_n_Bencached, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
2278
 
  Py_DECREF(__pyx_4); __pyx_4 = 0;
2279
 
  Py_DECREF(__pyx_3); __pyx_3 = 0;
2280
 
 
2281
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":253 */
2282
 
  __pyx_d2 = __pyx_e_6bzrlib_12_bencode_pyx_INITSIZE;
2283
 
 
2284
 
  /* "/home/vila/src/bzr/integration/trunk/bzrlib/_bencode_pyx.pyx":396 */
 
4962
  /*--- Type import code ---*/
 
4963
  __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = __Pyx_ImportType("bzrlib._static_tuple_c", "StaticTuple", sizeof(StaticTuple), 0); if (unlikely(!__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4964
  /*--- Function import code ---*/
 
4965
  /*--- Execution code ---*/
 
4966
 
 
4967
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":66
 
4968
 *     import_static_tuple_c
 
4969
 * 
 
4970
 * import_static_tuple_c()             # <<<<<<<<<<<<<<
 
4971
 * 
 
4972
 * 
 
4973
 */
 
4974
  __pyx_t_1 = import_static_tuple_c(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4975
 
 
4976
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":233
 
4977
 * 
 
4978
 * 
 
4979
 * class Bencached(object):             # <<<<<<<<<<<<<<
 
4980
 *     __slots__ = ['bencoded']
 
4981
 * 
 
4982
 */
 
4983
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4984
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
4985
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4986
  __Pyx_GOTREF(__pyx_t_3);
 
4987
  __Pyx_INCREF(__pyx_builtin_object);
 
4988
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
 
4989
  __Pyx_GIVEREF(__pyx_builtin_object);
 
4990
  __pyx_t_4 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_2), __pyx_n_s__Bencached, "bzrlib._bencode_pyx"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
4991
  __Pyx_GOTREF(__pyx_t_4);
 
4992
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
4993
 
 
4994
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":234
 
4995
 * 
 
4996
 * class Bencached(object):
 
4997
 *     __slots__ = ['bencoded']             # <<<<<<<<<<<<<<
 
4998
 * 
 
4999
 *     def __init__(self, s):
 
5000
 */
 
5001
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5002
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
5003
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bencoded));
 
5004
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__bencoded));
 
5005
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bencoded));
 
5006
  if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s____slots__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5007
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
5008
 
 
5009
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":236
 
5010
 *     __slots__ = ['bencoded']
 
5011
 * 
 
5012
 *     def __init__(self, s):             # <<<<<<<<<<<<<<
 
5013
 *         self.bencoded = s
 
5014
 * 
 
5015
 */
 
5016
  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_6bzrlib_12_bencode_pyx_9Bencached___init__, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5017
  __Pyx_GOTREF(__pyx_t_3);
 
5018
  __pyx_t_5 = PyMethod_New(__pyx_t_3, 0, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5019
  __Pyx_GOTREF(__pyx_t_5);
 
5020
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
5021
  if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s____init__, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5022
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5023
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Bencached, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5024
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5025
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
5026
 
 
5027
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":253
 
5028
 *     cdef readonly int maxsize
 
5029
 * 
 
5030
 *     def __init__(self, int maxsize=INITSIZE):             # <<<<<<<<<<<<<<
 
5031
 *         """Initialize encoder engine
 
5032
 *         @param  maxsize:    initial size of internal char buffer
 
5033
 */
 
5034
  __pyx_k_15 = __pyx_e_6bzrlib_12_bencode_pyx_INITSIZE;
 
5035
 
 
5036
  /* "/home/vila/src/bzr/integration/2.4.0-dev/bzrlib/_bencode_pyx.pyx":1
 
5037
 * # Copyright (C) 2007, 2009, 2010 Canonical Ltd             # <<<<<<<<<<<<<<
 
5038
 * #
 
5039
 * # This program is free software; you can redistribute it and/or modify
 
5040
 */
 
5041
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5042
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
5043
  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Decoder); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5044
  __Pyx_GOTREF(__pyx_t_4);
 
5045
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5046
  __Pyx_GOTREF(__pyx_t_5);
 
5047
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5048
  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5049
  __Pyx_GOTREF(__pyx_t_4);
 
5050
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5051
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_25), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5052
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5053
  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__bdecode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5054
  __Pyx_GOTREF(__pyx_t_4);
 
5055
  __pyx_t_5 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5056
  __Pyx_GOTREF(__pyx_t_5);
 
5057
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5058
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_26), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5059
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5060
  __pyx_t_5 = PyObject_GetAttr(__pyx_m, __pyx_n_s__bdecode_as_tuple); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5061
  __Pyx_GOTREF(__pyx_t_5);
 
5062
  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5063
  __Pyx_GOTREF(__pyx_t_4);
 
5064
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5065
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_27), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5066
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5067
  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Encoder); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5068
  __Pyx_GOTREF(__pyx_t_4);
 
5069
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5070
  __Pyx_GOTREF(__pyx_t_5);
 
5071
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5072
  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5073
  __Pyx_GOTREF(__pyx_t_4);
 
5074
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5075
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_28), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5076
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5077
  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__bencode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5078
  __Pyx_GOTREF(__pyx_t_4);
 
5079
  __pyx_t_5 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5080
  __Pyx_GOTREF(__pyx_t_5);
 
5081
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
5082
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_29), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5083
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
5084
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
5085
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
5086
  goto __pyx_L0;
 
5087
  __pyx_L1_error:;
 
5088
  __Pyx_XDECREF(__pyx_t_2);
 
5089
  __Pyx_XDECREF(__pyx_t_3);
 
5090
  __Pyx_XDECREF(__pyx_t_4);
 
5091
  __Pyx_XDECREF(__pyx_t_5);
 
5092
  if (__pyx_m) {
 
5093
    __Pyx_AddTraceback("init bzrlib._bencode_pyx");
 
5094
    Py_DECREF(__pyx_m); __pyx_m = 0;
 
5095
  } else if (!PyErr_Occurred()) {
 
5096
    PyErr_SetString(PyExc_ImportError, "init bzrlib._bencode_pyx");
 
5097
  }
 
5098
  __pyx_L0:;
 
5099
  __Pyx_RefNannyFinishContext();
 
5100
  #if PY_MAJOR_VERSION < 3
2285
5101
  return;
2286
 
  __pyx_L1:;
2287
 
  Py_XDECREF(__pyx_2);
2288
 
  Py_XDECREF(__pyx_3);
2289
 
  Py_XDECREF(__pyx_4);
2290
 
  Py_XDECREF(__pyx_5);
2291
 
  Py_XDECREF(__pyx_6);
2292
 
  __Pyx_AddTraceback("bzrlib._bencode_pyx");
 
5102
  #else
 
5103
  return __pyx_m;
 
5104
  #endif
2293
5105
}
2294
5106
 
2295
 
static char *__pyx_filenames[] = {
2296
 
  "_bencode_pyx.pyx",
2297
 
  "_static_tuple_c.pxd",
2298
 
};
2299
 
 
2300
5107
/* Runtime support code */
2301
5108
 
2302
 
static void __pyx_init_filenames(void) {
2303
 
  __pyx_f = __pyx_filenames;
2304
 
}
2305
 
 
 
5109
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
 
5110
    PyObject *result;
 
5111
    result = PyObject_GetAttr(dict, name);
 
5112
    if (!result)
 
5113
        PyErr_SetObject(PyExc_NameError, name);
 
5114
    return result;
 
5115
}
 
5116
 
 
5117
static void __Pyx_RaiseDoubleKeywordsError(
 
5118
    const char* func_name,
 
5119
    PyObject* kw_name)
 
5120
{
 
5121
    PyErr_Format(PyExc_TypeError,
 
5122
        #if PY_MAJOR_VERSION >= 3
 
5123
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
 
5124
        #else
 
5125
        "%s() got multiple values for keyword argument '%s'", func_name,
 
5126
        PyString_AS_STRING(kw_name));
 
5127
        #endif
 
5128
}
 
5129
 
 
5130
static void __Pyx_RaiseArgtupleInvalid(
 
5131
    const char* func_name,
 
5132
    int exact,
 
5133
    Py_ssize_t num_min,
 
5134
    Py_ssize_t num_max,
 
5135
    Py_ssize_t num_found)
 
5136
{
 
5137
    Py_ssize_t num_expected;
 
5138
    const char *number, *more_or_less;
 
5139
 
 
5140
    if (num_found < num_min) {
 
5141
        num_expected = num_min;
 
5142
        more_or_less = "at least";
 
5143
    } else {
 
5144
        num_expected = num_max;
 
5145
        more_or_less = "at most";
 
5146
    }
 
5147
    if (exact) {
 
5148
        more_or_less = "exactly";
 
5149
    }
 
5150
    number = (num_expected == 1) ? "" : "s";
 
5151
    PyErr_Format(PyExc_TypeError,
 
5152
        #if PY_VERSION_HEX < 0x02050000
 
5153
            "%s() takes %s %d positional argument%s (%d given)",
 
5154
        #else
 
5155
            "%s() takes %s %zd positional argument%s (%zd given)",
 
5156
        #endif
 
5157
        func_name, more_or_less, num_expected, number, num_found);
 
5158
}
 
5159
 
 
5160
static int __Pyx_ParseOptionalKeywords(
 
5161
    PyObject *kwds,
 
5162
    PyObject **argnames[],
 
5163
    PyObject *kwds2,
 
5164
    PyObject *values[],
 
5165
    Py_ssize_t num_pos_args,
 
5166
    const char* function_name)
 
5167
{
 
5168
    PyObject *key = 0, *value = 0;
 
5169
    Py_ssize_t pos = 0;
 
5170
    PyObject*** name;
 
5171
    PyObject*** first_kw_arg = argnames + num_pos_args;
 
5172
 
 
5173
    while (PyDict_Next(kwds, &pos, &key, &value)) {
 
5174
        name = first_kw_arg;
 
5175
        while (*name && (**name != key)) name++;
 
5176
        if (*name) {
 
5177
            values[name-argnames] = value;
 
5178
        } else {
 
5179
            #if PY_MAJOR_VERSION < 3
 
5180
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
 
5181
            #else
 
5182
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
 
5183
            #endif
 
5184
                goto invalid_keyword_type;
 
5185
            } else {
 
5186
                for (name = first_kw_arg; *name; name++) {
 
5187
                    #if PY_MAJOR_VERSION >= 3
 
5188
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
 
5189
                        PyUnicode_Compare(**name, key) == 0) break;
 
5190
                    #else
 
5191
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
 
5192
                        _PyString_Eq(**name, key)) break;
 
5193
                    #endif
 
5194
                }
 
5195
                if (*name) {
 
5196
                    values[name-argnames] = value;
 
5197
                } else {
 
5198
                    /* unexpected keyword found */
 
5199
                    for (name=argnames; name != first_kw_arg; name++) {
 
5200
                        if (**name == key) goto arg_passed_twice;
 
5201
                        #if PY_MAJOR_VERSION >= 3
 
5202
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
 
5203
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
 
5204
                        #else
 
5205
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
 
5206
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
 
5207
                        #endif
 
5208
                    }
 
5209
                    if (kwds2) {
 
5210
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
 
5211
                    } else {
 
5212
                        goto invalid_keyword;
 
5213
                    }
 
5214
                }
 
5215
            }
 
5216
        }
 
5217
    }
 
5218
    return 0;
 
5219
arg_passed_twice:
 
5220
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
 
5221
    goto bad;
 
5222
invalid_keyword_type:
 
5223
    PyErr_Format(PyExc_TypeError,
 
5224
        "%s() keywords must be strings", function_name);
 
5225
    goto bad;
 
5226
invalid_keyword:
 
5227
    PyErr_Format(PyExc_TypeError,
 
5228
    #if PY_MAJOR_VERSION < 3
 
5229
        "%s() got an unexpected keyword argument '%s'",
 
5230
        function_name, PyString_AsString(key));
 
5231
    #else
 
5232
        "%s() got an unexpected keyword argument '%U'",
 
5233
        function_name, key);
 
5234
    #endif
 
5235
bad:
 
5236
    return -1;
 
5237
}
 
5238
 
 
5239
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 
5240
    PyObject *tmp_type, *tmp_value, *tmp_tb;
 
5241
    PyThreadState *tstate = PyThreadState_GET();
 
5242
 
 
5243
    tmp_type = tstate->curexc_type;
 
5244
    tmp_value = tstate->curexc_value;
 
5245
    tmp_tb = tstate->curexc_traceback;
 
5246
    tstate->curexc_type = type;
 
5247
    tstate->curexc_value = value;
 
5248
    tstate->curexc_traceback = tb;
 
5249
    Py_XDECREF(tmp_type);
 
5250
    Py_XDECREF(tmp_value);
 
5251
    Py_XDECREF(tmp_tb);
 
5252
}
 
5253
 
 
5254
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
 
5255
    PyThreadState *tstate = PyThreadState_GET();
 
5256
    *type = tstate->curexc_type;
 
5257
    *value = tstate->curexc_value;
 
5258
    *tb = tstate->curexc_traceback;
 
5259
 
 
5260
    tstate->curexc_type = 0;
 
5261
    tstate->curexc_value = 0;
 
5262
    tstate->curexc_traceback = 0;
 
5263
}
 
5264
 
 
5265
 
 
5266
static PyObject *__Pyx_CreateClass(
 
5267
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
 
5268
{
 
5269
    PyObject *py_modname;
 
5270
    PyObject *result = 0;
 
5271
 
 
5272
    #if PY_MAJOR_VERSION < 3
 
5273
    py_modname = PyString_FromString(modname);
 
5274
    #else
 
5275
    py_modname = PyUnicode_FromString(modname);
 
5276
    #endif
 
5277
    if (!py_modname)
 
5278
        goto bad;
 
5279
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
 
5280
        goto bad;
 
5281
    #if PY_MAJOR_VERSION < 3
 
5282
    result = PyClass_New(bases, dict, name);
 
5283
    #else
 
5284
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
 
5285
    #endif
 
5286
bad:
 
5287
    Py_XDECREF(py_modname);
 
5288
    return result;
 
5289
}
 
5290
 
 
5291
#if PY_MAJOR_VERSION < 3
2306
5292
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
2307
5293
    Py_XINCREF(type);
2308
5294
    Py_XINCREF(value);
2343
5329
                Py_INCREF(type);
2344
5330
            }
2345
5331
            else {
 
5332
                type = 0;
2346
5333
                PyErr_SetString(PyExc_TypeError,
2347
5334
                    "raise: exception must be an old-style class or instance");
2348
5335
                goto raise_error;
2349
5336
            }
2350
5337
        #else
2351
 
            type = (PyObject*) type->ob_type;
 
5338
            type = (PyObject*) Py_TYPE(type);
2352
5339
            Py_INCREF(type);
2353
5340
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
2354
5341
                PyErr_SetString(PyExc_TypeError,
2357
5344
            }
2358
5345
        #endif
2359
5346
    }
2360
 
    PyErr_Restore(type, value, tb);
 
5347
 
 
5348
    __Pyx_ErrRestore(type, value, tb);
2361
5349
    return;
2362
5350
raise_error:
2363
5351
    Py_XDECREF(value);
2366
5354
    return;
2367
5355
}
2368
5356
 
2369
 
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
2370
 
    PyObject *result;
2371
 
    result = PyObject_GetAttr(dict, name);
2372
 
    if (!result)
2373
 
        PyErr_SetObject(PyExc_NameError, name);
2374
 
    return result;
2375
 
}
2376
 
 
2377
 
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
2378
 
    while (t->p) {
2379
 
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
2380
 
        if (!*t->p)
2381
 
            return -1;
2382
 
        if (t->i)
2383
 
            PyString_InternInPlace(t->p);
2384
 
        ++t;
2385
 
    }
2386
 
    return 0;
 
5357
#else /* Python 3+ */
 
5358
 
 
5359
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
 
5360
    if (tb == Py_None) {
 
5361
        tb = 0;
 
5362
    } else if (tb && !PyTraceBack_Check(tb)) {
 
5363
        PyErr_SetString(PyExc_TypeError,
 
5364
            "raise: arg 3 must be a traceback or None");
 
5365
        goto bad;
 
5366
    }
 
5367
    if (value == Py_None)
 
5368
        value = 0;
 
5369
 
 
5370
    if (PyExceptionInstance_Check(type)) {
 
5371
        if (value) {
 
5372
            PyErr_SetString(PyExc_TypeError,
 
5373
                "instance exception may not have a separate value");
 
5374
            goto bad;
 
5375
        }
 
5376
        value = type;
 
5377
        type = (PyObject*) Py_TYPE(value);
 
5378
    } else if (!PyExceptionClass_Check(type)) {
 
5379
        PyErr_SetString(PyExc_TypeError,
 
5380
            "raise: exception class must be a subclass of BaseException");
 
5381
        goto bad;
 
5382
    }
 
5383
 
 
5384
    PyErr_SetObject(type, value);
 
5385
 
 
5386
    if (tb) {
 
5387
        PyThreadState *tstate = PyThreadState_GET();
 
5388
        PyObject* tmp_tb = tstate->curexc_traceback;
 
5389
        if (tb != tmp_tb) {
 
5390
            Py_INCREF(tb);
 
5391
            tstate->curexc_traceback = tb;
 
5392
            Py_XDECREF(tmp_tb);
 
5393
        }
 
5394
    }
 
5395
 
 
5396
bad:
 
5397
    return;
 
5398
}
 
5399
#endif
 
5400
 
 
5401
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
 
5402
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
 
5403
    const int is_unsigned = neg_one > const_zero;
 
5404
    if (sizeof(unsigned char) < sizeof(long)) {
 
5405
        long val = __Pyx_PyInt_AsLong(x);
 
5406
        if (unlikely(val != (long)(unsigned char)val)) {
 
5407
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5408
                PyErr_SetString(PyExc_OverflowError,
 
5409
                    (is_unsigned && unlikely(val < 0)) ?
 
5410
                    "can't convert negative value to unsigned char" :
 
5411
                    "value too large to convert to unsigned char");
 
5412
            }
 
5413
            return (unsigned char)-1;
 
5414
        }
 
5415
        return (unsigned char)val;
 
5416
    }
 
5417
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
 
5418
}
 
5419
 
 
5420
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
 
5421
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
 
5422
    const int is_unsigned = neg_one > const_zero;
 
5423
    if (sizeof(unsigned short) < sizeof(long)) {
 
5424
        long val = __Pyx_PyInt_AsLong(x);
 
5425
        if (unlikely(val != (long)(unsigned short)val)) {
 
5426
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5427
                PyErr_SetString(PyExc_OverflowError,
 
5428
                    (is_unsigned && unlikely(val < 0)) ?
 
5429
                    "can't convert negative value to unsigned short" :
 
5430
                    "value too large to convert to unsigned short");
 
5431
            }
 
5432
            return (unsigned short)-1;
 
5433
        }
 
5434
        return (unsigned short)val;
 
5435
    }
 
5436
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
 
5437
}
 
5438
 
 
5439
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
 
5440
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
 
5441
    const int is_unsigned = neg_one > const_zero;
 
5442
    if (sizeof(unsigned int) < sizeof(long)) {
 
5443
        long val = __Pyx_PyInt_AsLong(x);
 
5444
        if (unlikely(val != (long)(unsigned int)val)) {
 
5445
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5446
                PyErr_SetString(PyExc_OverflowError,
 
5447
                    (is_unsigned && unlikely(val < 0)) ?
 
5448
                    "can't convert negative value to unsigned int" :
 
5449
                    "value too large to convert to unsigned int");
 
5450
            }
 
5451
            return (unsigned int)-1;
 
5452
        }
 
5453
        return (unsigned int)val;
 
5454
    }
 
5455
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
 
5456
}
 
5457
 
 
5458
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
 
5459
    const char neg_one = (char)-1, const_zero = 0;
 
5460
    const int is_unsigned = neg_one > const_zero;
 
5461
    if (sizeof(char) < sizeof(long)) {
 
5462
        long val = __Pyx_PyInt_AsLong(x);
 
5463
        if (unlikely(val != (long)(char)val)) {
 
5464
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5465
                PyErr_SetString(PyExc_OverflowError,
 
5466
                    (is_unsigned && unlikely(val < 0)) ?
 
5467
                    "can't convert negative value to char" :
 
5468
                    "value too large to convert to char");
 
5469
            }
 
5470
            return (char)-1;
 
5471
        }
 
5472
        return (char)val;
 
5473
    }
 
5474
    return (char)__Pyx_PyInt_AsLong(x);
 
5475
}
 
5476
 
 
5477
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
 
5478
    const short neg_one = (short)-1, const_zero = 0;
 
5479
    const int is_unsigned = neg_one > const_zero;
 
5480
    if (sizeof(short) < sizeof(long)) {
 
5481
        long val = __Pyx_PyInt_AsLong(x);
 
5482
        if (unlikely(val != (long)(short)val)) {
 
5483
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5484
                PyErr_SetString(PyExc_OverflowError,
 
5485
                    (is_unsigned && unlikely(val < 0)) ?
 
5486
                    "can't convert negative value to short" :
 
5487
                    "value too large to convert to short");
 
5488
            }
 
5489
            return (short)-1;
 
5490
        }
 
5491
        return (short)val;
 
5492
    }
 
5493
    return (short)__Pyx_PyInt_AsLong(x);
 
5494
}
 
5495
 
 
5496
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
 
5497
    const int neg_one = (int)-1, const_zero = 0;
 
5498
    const int is_unsigned = neg_one > const_zero;
 
5499
    if (sizeof(int) < sizeof(long)) {
 
5500
        long val = __Pyx_PyInt_AsLong(x);
 
5501
        if (unlikely(val != (long)(int)val)) {
 
5502
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5503
                PyErr_SetString(PyExc_OverflowError,
 
5504
                    (is_unsigned && unlikely(val < 0)) ?
 
5505
                    "can't convert negative value to int" :
 
5506
                    "value too large to convert to int");
 
5507
            }
 
5508
            return (int)-1;
 
5509
        }
 
5510
        return (int)val;
 
5511
    }
 
5512
    return (int)__Pyx_PyInt_AsLong(x);
 
5513
}
 
5514
 
 
5515
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
 
5516
    const signed char neg_one = (signed char)-1, const_zero = 0;
 
5517
    const int is_unsigned = neg_one > const_zero;
 
5518
    if (sizeof(signed char) < sizeof(long)) {
 
5519
        long val = __Pyx_PyInt_AsLong(x);
 
5520
        if (unlikely(val != (long)(signed char)val)) {
 
5521
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5522
                PyErr_SetString(PyExc_OverflowError,
 
5523
                    (is_unsigned && unlikely(val < 0)) ?
 
5524
                    "can't convert negative value to signed char" :
 
5525
                    "value too large to convert to signed char");
 
5526
            }
 
5527
            return (signed char)-1;
 
5528
        }
 
5529
        return (signed char)val;
 
5530
    }
 
5531
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
 
5532
}
 
5533
 
 
5534
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
 
5535
    const signed short neg_one = (signed short)-1, const_zero = 0;
 
5536
    const int is_unsigned = neg_one > const_zero;
 
5537
    if (sizeof(signed short) < sizeof(long)) {
 
5538
        long val = __Pyx_PyInt_AsLong(x);
 
5539
        if (unlikely(val != (long)(signed short)val)) {
 
5540
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5541
                PyErr_SetString(PyExc_OverflowError,
 
5542
                    (is_unsigned && unlikely(val < 0)) ?
 
5543
                    "can't convert negative value to signed short" :
 
5544
                    "value too large to convert to signed short");
 
5545
            }
 
5546
            return (signed short)-1;
 
5547
        }
 
5548
        return (signed short)val;
 
5549
    }
 
5550
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
 
5551
}
 
5552
 
 
5553
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
 
5554
    const signed int neg_one = (signed int)-1, const_zero = 0;
 
5555
    const int is_unsigned = neg_one > const_zero;
 
5556
    if (sizeof(signed int) < sizeof(long)) {
 
5557
        long val = __Pyx_PyInt_AsLong(x);
 
5558
        if (unlikely(val != (long)(signed int)val)) {
 
5559
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5560
                PyErr_SetString(PyExc_OverflowError,
 
5561
                    (is_unsigned && unlikely(val < 0)) ?
 
5562
                    "can't convert negative value to signed int" :
 
5563
                    "value too large to convert to signed int");
 
5564
            }
 
5565
            return (signed int)-1;
 
5566
        }
 
5567
        return (signed int)val;
 
5568
    }
 
5569
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
 
5570
}
 
5571
 
 
5572
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
 
5573
    const int neg_one = (int)-1, const_zero = 0;
 
5574
    const int is_unsigned = neg_one > const_zero;
 
5575
    if (sizeof(int) < sizeof(long)) {
 
5576
        long val = __Pyx_PyInt_AsLong(x);
 
5577
        if (unlikely(val != (long)(int)val)) {
 
5578
            if (!unlikely(val == -1 && PyErr_Occurred())) {
 
5579
                PyErr_SetString(PyExc_OverflowError,
 
5580
                    (is_unsigned && unlikely(val < 0)) ?
 
5581
                    "can't convert negative value to int" :
 
5582
                    "value too large to convert to int");
 
5583
            }
 
5584
            return (int)-1;
 
5585
        }
 
5586
        return (int)val;
 
5587
    }
 
5588
    return (int)__Pyx_PyInt_AsLong(x);
 
5589
}
 
5590
 
 
5591
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 
5592
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
 
5593
    const int is_unsigned = neg_one > const_zero;
 
5594
#if PY_VERSION_HEX < 0x03000000
 
5595
    if (likely(PyInt_Check(x))) {
 
5596
        long val = PyInt_AS_LONG(x);
 
5597
        if (is_unsigned && unlikely(val < 0)) {
 
5598
            PyErr_SetString(PyExc_OverflowError,
 
5599
                            "can't convert negative value to unsigned long");
 
5600
            return (unsigned long)-1;
 
5601
        }
 
5602
        return (unsigned long)val;
 
5603
    } else
 
5604
#endif
 
5605
    if (likely(PyLong_Check(x))) {
 
5606
        if (is_unsigned) {
 
5607
            if (unlikely(Py_SIZE(x) < 0)) {
 
5608
                PyErr_SetString(PyExc_OverflowError,
 
5609
                                "can't convert negative value to unsigned long");
 
5610
                return (unsigned long)-1;
 
5611
            }
 
5612
            return PyLong_AsUnsignedLong(x);
 
5613
        } else {
 
5614
            return PyLong_AsLong(x);
 
5615
        }
 
5616
    } else {
 
5617
        unsigned long val;
 
5618
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5619
        if (!tmp) return (unsigned long)-1;
 
5620
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
 
5621
        Py_DECREF(tmp);
 
5622
        return val;
 
5623
    }
 
5624
}
 
5625
 
 
5626
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
 
5627
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
 
5628
    const int is_unsigned = neg_one > const_zero;
 
5629
#if PY_VERSION_HEX < 0x03000000
 
5630
    if (likely(PyInt_Check(x))) {
 
5631
        long val = PyInt_AS_LONG(x);
 
5632
        if (is_unsigned && unlikely(val < 0)) {
 
5633
            PyErr_SetString(PyExc_OverflowError,
 
5634
                            "can't convert negative value to unsigned PY_LONG_LONG");
 
5635
            return (unsigned PY_LONG_LONG)-1;
 
5636
        }
 
5637
        return (unsigned PY_LONG_LONG)val;
 
5638
    } else
 
5639
#endif
 
5640
    if (likely(PyLong_Check(x))) {
 
5641
        if (is_unsigned) {
 
5642
            if (unlikely(Py_SIZE(x) < 0)) {
 
5643
                PyErr_SetString(PyExc_OverflowError,
 
5644
                                "can't convert negative value to unsigned PY_LONG_LONG");
 
5645
                return (unsigned PY_LONG_LONG)-1;
 
5646
            }
 
5647
            return PyLong_AsUnsignedLongLong(x);
 
5648
        } else {
 
5649
            return PyLong_AsLongLong(x);
 
5650
        }
 
5651
    } else {
 
5652
        unsigned PY_LONG_LONG val;
 
5653
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5654
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
 
5655
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
 
5656
        Py_DECREF(tmp);
 
5657
        return val;
 
5658
    }
 
5659
}
 
5660
 
 
5661
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 
5662
    const long neg_one = (long)-1, const_zero = 0;
 
5663
    const int is_unsigned = neg_one > const_zero;
 
5664
#if PY_VERSION_HEX < 0x03000000
 
5665
    if (likely(PyInt_Check(x))) {
 
5666
        long val = PyInt_AS_LONG(x);
 
5667
        if (is_unsigned && unlikely(val < 0)) {
 
5668
            PyErr_SetString(PyExc_OverflowError,
 
5669
                            "can't convert negative value to long");
 
5670
            return (long)-1;
 
5671
        }
 
5672
        return (long)val;
 
5673
    } else
 
5674
#endif
 
5675
    if (likely(PyLong_Check(x))) {
 
5676
        if (is_unsigned) {
 
5677
            if (unlikely(Py_SIZE(x) < 0)) {
 
5678
                PyErr_SetString(PyExc_OverflowError,
 
5679
                                "can't convert negative value to long");
 
5680
                return (long)-1;
 
5681
            }
 
5682
            return PyLong_AsUnsignedLong(x);
 
5683
        } else {
 
5684
            return PyLong_AsLong(x);
 
5685
        }
 
5686
    } else {
 
5687
        long val;
 
5688
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5689
        if (!tmp) return (long)-1;
 
5690
        val = __Pyx_PyInt_AsLong(tmp);
 
5691
        Py_DECREF(tmp);
 
5692
        return val;
 
5693
    }
 
5694
}
 
5695
 
 
5696
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 
5697
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
 
5698
    const int is_unsigned = neg_one > const_zero;
 
5699
#if PY_VERSION_HEX < 0x03000000
 
5700
    if (likely(PyInt_Check(x))) {
 
5701
        long val = PyInt_AS_LONG(x);
 
5702
        if (is_unsigned && unlikely(val < 0)) {
 
5703
            PyErr_SetString(PyExc_OverflowError,
 
5704
                            "can't convert negative value to PY_LONG_LONG");
 
5705
            return (PY_LONG_LONG)-1;
 
5706
        }
 
5707
        return (PY_LONG_LONG)val;
 
5708
    } else
 
5709
#endif
 
5710
    if (likely(PyLong_Check(x))) {
 
5711
        if (is_unsigned) {
 
5712
            if (unlikely(Py_SIZE(x) < 0)) {
 
5713
                PyErr_SetString(PyExc_OverflowError,
 
5714
                                "can't convert negative value to PY_LONG_LONG");
 
5715
                return (PY_LONG_LONG)-1;
 
5716
            }
 
5717
            return PyLong_AsUnsignedLongLong(x);
 
5718
        } else {
 
5719
            return PyLong_AsLongLong(x);
 
5720
        }
 
5721
    } else {
 
5722
        PY_LONG_LONG val;
 
5723
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5724
        if (!tmp) return (PY_LONG_LONG)-1;
 
5725
        val = __Pyx_PyInt_AsLongLong(tmp);
 
5726
        Py_DECREF(tmp);
 
5727
        return val;
 
5728
    }
 
5729
}
 
5730
 
 
5731
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 
5732
    const signed long neg_one = (signed long)-1, const_zero = 0;
 
5733
    const int is_unsigned = neg_one > const_zero;
 
5734
#if PY_VERSION_HEX < 0x03000000
 
5735
    if (likely(PyInt_Check(x))) {
 
5736
        long val = PyInt_AS_LONG(x);
 
5737
        if (is_unsigned && unlikely(val < 0)) {
 
5738
            PyErr_SetString(PyExc_OverflowError,
 
5739
                            "can't convert negative value to signed long");
 
5740
            return (signed long)-1;
 
5741
        }
 
5742
        return (signed long)val;
 
5743
    } else
 
5744
#endif
 
5745
    if (likely(PyLong_Check(x))) {
 
5746
        if (is_unsigned) {
 
5747
            if (unlikely(Py_SIZE(x) < 0)) {
 
5748
                PyErr_SetString(PyExc_OverflowError,
 
5749
                                "can't convert negative value to signed long");
 
5750
                return (signed long)-1;
 
5751
            }
 
5752
            return PyLong_AsUnsignedLong(x);
 
5753
        } else {
 
5754
            return PyLong_AsLong(x);
 
5755
        }
 
5756
    } else {
 
5757
        signed long val;
 
5758
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5759
        if (!tmp) return (signed long)-1;
 
5760
        val = __Pyx_PyInt_AsSignedLong(tmp);
 
5761
        Py_DECREF(tmp);
 
5762
        return val;
 
5763
    }
 
5764
}
 
5765
 
 
5766
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
 
5767
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
 
5768
    const int is_unsigned = neg_one > const_zero;
 
5769
#if PY_VERSION_HEX < 0x03000000
 
5770
    if (likely(PyInt_Check(x))) {
 
5771
        long val = PyInt_AS_LONG(x);
 
5772
        if (is_unsigned && unlikely(val < 0)) {
 
5773
            PyErr_SetString(PyExc_OverflowError,
 
5774
                            "can't convert negative value to signed PY_LONG_LONG");
 
5775
            return (signed PY_LONG_LONG)-1;
 
5776
        }
 
5777
        return (signed PY_LONG_LONG)val;
 
5778
    } else
 
5779
#endif
 
5780
    if (likely(PyLong_Check(x))) {
 
5781
        if (is_unsigned) {
 
5782
            if (unlikely(Py_SIZE(x) < 0)) {
 
5783
                PyErr_SetString(PyExc_OverflowError,
 
5784
                                "can't convert negative value to signed PY_LONG_LONG");
 
5785
                return (signed PY_LONG_LONG)-1;
 
5786
            }
 
5787
            return PyLong_AsUnsignedLongLong(x);
 
5788
        } else {
 
5789
            return PyLong_AsLongLong(x);
 
5790
        }
 
5791
    } else {
 
5792
        signed PY_LONG_LONG val;
 
5793
        PyObject *tmp = __Pyx_PyNumber_Int(x);
 
5794
        if (!tmp) return (signed PY_LONG_LONG)-1;
 
5795
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
 
5796
        Py_DECREF(tmp);
 
5797
        return val;
 
5798
    }
2387
5799
}
2388
5800
 
2389
5801
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
2390
 
    PyObject *pycobj = 0;
2391
 
    int result;
2392
 
    
2393
 
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
2394
 
    if (!pycobj)
2395
 
        goto bad;
2396
 
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
2397
 
        goto bad;
2398
 
    result = 0;
2399
 
    goto done;
2400
 
 
 
5802
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
 
5803
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
 
5804
#else
 
5805
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
 
5806
#endif
 
5807
    if (!ob)
 
5808
        goto bad;
 
5809
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
 
5810
        goto bad;
 
5811
    Py_DECREF(ob);
 
5812
    return 0;
2401
5813
bad:
2402
 
    result = -1;
2403
 
done:
2404
 
    Py_XDECREF(pycobj);
2405
 
    return result;
 
5814
    Py_XDECREF(ob);
 
5815
    return -1;
2406
5816
}
2407
5817
 
2408
5818
#ifndef __PYX_HAVE_RT_ImportType
2409
5819
#define __PYX_HAVE_RT_ImportType
2410
 
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
2411
 
    long size) 
 
5820
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
 
5821
    long size, int strict)
2412
5822
{
2413
5823
    PyObject *py_module = 0;
2414
5824
    PyObject *result = 0;
2415
 
    
 
5825
    PyObject *py_name = 0;
 
5826
    char warning[200];
 
5827
 
2416
5828
    py_module = __Pyx_ImportModule(module_name);
2417
5829
    if (!py_module)
2418
5830
        goto bad;
2419
 
    result = PyObject_GetAttrString(py_module, class_name);
 
5831
    #if PY_MAJOR_VERSION < 3
 
5832
    py_name = PyString_FromString(class_name);
 
5833
    #else
 
5834
    py_name = PyUnicode_FromString(class_name);
 
5835
    #endif
 
5836
    if (!py_name)
 
5837
        goto bad;
 
5838
    result = PyObject_GetAttr(py_module, py_name);
 
5839
    Py_DECREF(py_name);
 
5840
    py_name = 0;
 
5841
    Py_DECREF(py_module);
 
5842
    py_module = 0;
2420
5843
    if (!result)
2421
5844
        goto bad;
2422
5845
    if (!PyType_Check(result)) {
2425
5848
            module_name, class_name);
2426
5849
        goto bad;
2427
5850
    }
2428
 
    if (((PyTypeObject *)result)->tp_basicsize != size) {
 
5851
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
 
5852
        PyOS_snprintf(warning, sizeof(warning), 
 
5853
            "%s.%s size changed, may indicate binary incompatibility",
 
5854
            module_name, class_name);
 
5855
        #if PY_VERSION_HEX < 0x02050000
 
5856
        PyErr_Warn(NULL, warning);
 
5857
        #else
 
5858
        PyErr_WarnEx(NULL, warning, 0);
 
5859
        #endif
 
5860
    }
 
5861
    else if (((PyTypeObject *)result)->tp_basicsize != size) {
2429
5862
        PyErr_Format(PyExc_ValueError, 
2430
 
            "%s.%s does not appear to be the correct type object",
 
5863
            "%s.%s has the wrong size, try recompiling",
2431
5864
            module_name, class_name);
2432
5865
        goto bad;
2433
5866
    }
2434
5867
    return (PyTypeObject *)result;
2435
5868
bad:
 
5869
    Py_XDECREF(py_module);
2436
5870
    Py_XDECREF(result);
2437
5871
    return 0;
2438
5872
}
2440
5874
 
2441
5875
#ifndef __PYX_HAVE_RT_ImportModule
2442
5876
#define __PYX_HAVE_RT_ImportModule
2443
 
static PyObject *__Pyx_ImportModule(char *name) {
 
5877
static PyObject *__Pyx_ImportModule(const char *name) {
2444
5878
    PyObject *py_name = 0;
2445
 
    
 
5879
    PyObject *py_module = 0;
 
5880
 
 
5881
    #if PY_MAJOR_VERSION < 3
2446
5882
    py_name = PyString_FromString(name);
 
5883
    #else
 
5884
    py_name = PyUnicode_FromString(name);
 
5885
    #endif
2447
5886
    if (!py_name)
2448
5887
        goto bad;
2449
 
    return PyImport_Import(py_name);
 
5888
    py_module = PyImport_Import(py_name);
 
5889
    Py_DECREF(py_name);
 
5890
    return py_module;
2450
5891
bad:
2451
5892
    Py_XDECREF(py_name);
2452
5893
    return 0;
2453
5894
}
2454
5895
#endif
2455
5896
 
2456
 
static PyObject *__Pyx_CreateClass(
2457
 
    PyObject *bases, PyObject *dict, PyObject *name, char *modname)
2458
 
{
2459
 
    PyObject *py_modname;
2460
 
    PyObject *result = 0;
2461
 
    
2462
 
    py_modname = PyString_FromString(modname);
2463
 
    if (!py_modname)
2464
 
        goto bad;
2465
 
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
2466
 
        goto bad;
2467
 
    result = PyClass_New(bases, dict, name);
2468
 
bad:
2469
 
    Py_XDECREF(py_modname);
2470
 
    return result;
2471
 
}
2472
 
 
2473
5897
#include "compile.h"
2474
5898
#include "frameobject.h"
2475
5899
#include "traceback.h"
2476
5900
 
2477
 
static void __Pyx_AddTraceback(char *funcname) {
 
5901
static void __Pyx_AddTraceback(const char *funcname) {
2478
5902
    PyObject *py_srcfile = 0;
2479
5903
    PyObject *py_funcname = 0;
2480
5904
    PyObject *py_globals = 0;
2481
 
    PyObject *empty_tuple = 0;
2482
 
    PyObject *empty_string = 0;
2483
5905
    PyCodeObject *py_code = 0;
2484
5906
    PyFrameObject *py_frame = 0;
2485
 
    
 
5907
 
 
5908
    #if PY_MAJOR_VERSION < 3
2486
5909
    py_srcfile = PyString_FromString(__pyx_filename);
 
5910
    #else
 
5911
    py_srcfile = PyUnicode_FromString(__pyx_filename);
 
5912
    #endif
2487
5913
    if (!py_srcfile) goto bad;
2488
 
    py_funcname = PyString_FromString(funcname);
 
5914
    if (__pyx_clineno) {
 
5915
        #if PY_MAJOR_VERSION < 3
 
5916
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
 
5917
        #else
 
5918
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
 
5919
        #endif
 
5920
    }
 
5921
    else {
 
5922
        #if PY_MAJOR_VERSION < 3
 
5923
        py_funcname = PyString_FromString(funcname);
 
5924
        #else
 
5925
        py_funcname = PyUnicode_FromString(funcname);
 
5926
        #endif
 
5927
    }
2489
5928
    if (!py_funcname) goto bad;
2490
5929
    py_globals = PyModule_GetDict(__pyx_m);
2491
5930
    if (!py_globals) goto bad;
2492
 
    empty_tuple = PyTuple_New(0);
2493
 
    if (!empty_tuple) goto bad;
2494
 
    empty_string = PyString_FromString("");
2495
 
    if (!empty_string) goto bad;
2496
5931
    py_code = PyCode_New(
2497
5932
        0,            /*int argcount,*/
 
5933
        #if PY_MAJOR_VERSION >= 3
 
5934
        0,            /*int kwonlyargcount,*/
 
5935
        #endif
2498
5936
        0,            /*int nlocals,*/
2499
5937
        0,            /*int stacksize,*/
2500
5938
        0,            /*int flags,*/
2501
 
        empty_string, /*PyObject *code,*/
2502
 
        empty_tuple,  /*PyObject *consts,*/
2503
 
        empty_tuple,  /*PyObject *names,*/
2504
 
        empty_tuple,  /*PyObject *varnames,*/
2505
 
        empty_tuple,  /*PyObject *freevars,*/
2506
 
        empty_tuple,  /*PyObject *cellvars,*/
 
5939
        __pyx_empty_bytes, /*PyObject *code,*/
 
5940
        __pyx_empty_tuple,  /*PyObject *consts,*/
 
5941
        __pyx_empty_tuple,  /*PyObject *names,*/
 
5942
        __pyx_empty_tuple,  /*PyObject *varnames,*/
 
5943
        __pyx_empty_tuple,  /*PyObject *freevars,*/
 
5944
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
2507
5945
        py_srcfile,   /*PyObject *filename,*/
2508
5946
        py_funcname,  /*PyObject *name,*/
2509
5947
        __pyx_lineno,   /*int firstlineno,*/
2510
 
        empty_string  /*PyObject *lnotab*/
 
5948
        __pyx_empty_bytes  /*PyObject *lnotab*/
2511
5949
    );
2512
5950
    if (!py_code) goto bad;
2513
5951
    py_frame = PyFrame_New(
2514
 
        PyThreadState_Get(), /*PyThreadState *tstate,*/
 
5952
        PyThreadState_GET(), /*PyThreadState *tstate,*/
2515
5953
        py_code,             /*PyCodeObject *code,*/
2516
5954
        py_globals,          /*PyObject *globals,*/
2517
5955
        0                    /*PyObject *locals*/
2522
5960
bad:
2523
5961
    Py_XDECREF(py_srcfile);
2524
5962
    Py_XDECREF(py_funcname);
2525
 
    Py_XDECREF(empty_tuple);
2526
 
    Py_XDECREF(empty_string);
2527
5963
    Py_XDECREF(py_code);
2528
5964
    Py_XDECREF(py_frame);
2529
5965
}
 
5966
 
 
5967
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
 
5968
    while (t->p) {
 
5969
        #if PY_MAJOR_VERSION < 3
 
5970
        if (t->is_unicode) {
 
5971
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
 
5972
        } else if (t->intern) {
 
5973
            *t->p = PyString_InternFromString(t->s);
 
5974
        } else {
 
5975
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
 
5976
        }
 
5977
        #else  /* Python 3+ has unicode identifiers */
 
5978
        if (t->is_unicode | t->is_str) {
 
5979
            if (t->intern) {
 
5980
                *t->p = PyUnicode_InternFromString(t->s);
 
5981
            } else if (t->encoding) {
 
5982
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
 
5983
            } else {
 
5984
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
 
5985
            }
 
5986
        } else {
 
5987
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
 
5988
        }
 
5989
        #endif
 
5990
        if (!*t->p)
 
5991
            return -1;
 
5992
        ++t;
 
5993
    }
 
5994
    return 0;
 
5995
}
 
5996
 
 
5997
/* Type Conversion Functions */
 
5998
 
 
5999
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
 
6000
   int is_true = x == Py_True;
 
6001
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
 
6002
   else return PyObject_IsTrue(x);
 
6003
}
 
6004
 
 
6005
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
 
6006
  PyNumberMethods *m;
 
6007
  const char *name = NULL;
 
6008
  PyObject *res = NULL;
 
6009
#if PY_VERSION_HEX < 0x03000000
 
6010
  if (PyInt_Check(x) || PyLong_Check(x))
 
6011
#else
 
6012
  if (PyLong_Check(x))
 
6013
#endif
 
6014
    return Py_INCREF(x), x;
 
6015
  m = Py_TYPE(x)->tp_as_number;
 
6016
#if PY_VERSION_HEX < 0x03000000
 
6017
  if (m && m->nb_int) {
 
6018
    name = "int";
 
6019
    res = PyNumber_Int(x);
 
6020
  }
 
6021
  else if (m && m->nb_long) {
 
6022
    name = "long";
 
6023
    res = PyNumber_Long(x);
 
6024
  }
 
6025
#else
 
6026
  if (m && m->nb_int) {
 
6027
    name = "int";
 
6028
    res = PyNumber_Long(x);
 
6029
  }
 
6030
#endif
 
6031
  if (res) {
 
6032
#if PY_VERSION_HEX < 0x03000000
 
6033
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
 
6034
#else
 
6035
    if (!PyLong_Check(res)) {
 
6036
#endif
 
6037
      PyErr_Format(PyExc_TypeError,
 
6038
                   "__%s__ returned non-%s (type %.200s)",
 
6039
                   name, name, Py_TYPE(res)->tp_name);
 
6040
      Py_DECREF(res);
 
6041
      return NULL;
 
6042
    }
 
6043
  }
 
6044
  else if (!PyErr_Occurred()) {
 
6045
    PyErr_SetString(PyExc_TypeError,
 
6046
                    "an integer is required");
 
6047
  }
 
6048
  return res;
 
6049
}
 
6050
 
 
6051
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
 
6052
  Py_ssize_t ival;
 
6053
  PyObject* x = PyNumber_Index(b);
 
6054
  if (!x) return -1;
 
6055
  ival = PyInt_AsSsize_t(x);
 
6056
  Py_DECREF(x);
 
6057
  return ival;
 
6058
}
 
6059
 
 
6060
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 
6061
#if PY_VERSION_HEX < 0x02050000
 
6062
   if (ival <= LONG_MAX)
 
6063
       return PyInt_FromLong((long)ival);
 
6064
   else {
 
6065
       unsigned char *bytes = (unsigned char *) &ival;
 
6066
       int one = 1; int little = (int)*(unsigned char*)&one;
 
6067
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
 
6068
   }
 
6069
#else
 
6070
   return PyInt_FromSize_t(ival);
 
6071
#endif
 
6072
}
 
6073
 
 
6074
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
 
6075
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
 
6076
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
 
6077
       return (size_t)-1;
 
6078
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
 
6079
       PyErr_SetString(PyExc_OverflowError,
 
6080
                       "value too large to convert to size_t");
 
6081
       return (size_t)-1;
 
6082
   }
 
6083
   return (size_t)val;
 
6084
}
 
6085
 
 
6086
 
 
6087
#endif /* Py_PYTHON_H */