/brz/remove-bazaar

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

« back to all changes in this revision

Viewing changes to breezy/_bencode_pyx.pyx

  • Committer: Jelmer Vernooij
  • Date: 2018-08-18 19:43:40 UTC
  • mto: This revision was merged to the branch mainline in revision 7101.
  • Revision ID: jelmer@jelmer.uk-20180818194340-1xoaqiclrhu80yoh
Fix some C extensions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
 
21
from python_version cimport PY_MAJOR_VERSION
 
22
 
21
23
from cpython.bytes cimport (
22
24
    PyBytes_CheckExact,
23
25
    PyBytes_FromStringAndSize,
115
117
            raise ValueError('stream underflow')
116
118
 
117
119
        if Py_EnterRecursiveCall("_decode_object"):
118
 
            raise RuntimeError("too deeply nested")
 
120
            if PY_MAJOR_VERSION < 3:
 
121
                raise RuntimeError("too deeply nested")
 
122
            else:
 
123
                raise RecursionError("too deeply nested")
119
124
        try:
120
125
            ch = self.tail[0]
121
126
            if c'0' <= ch <= c'9':
380
385
 
381
386
    def process(self, object x):
382
387
        if Py_EnterRecursiveCall("encode"):
383
 
            raise RuntimeError("too deeply nested")
 
388
            if PY_MAJOR_VERSION < 3:
 
389
                raise RuntimeError("too deeply nested")
 
390
            else:
 
391
                raise RecursionError("too deeply nested")
384
392
        try:
385
393
            if PyBytes_CheckExact(x):
386
394
                self._encode_string(x)