/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/patches.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 
 
18
from .errors import (
 
19
    BzrError,
 
20
    )
 
21
 
 
22
import os
17
23
import re
18
24
 
19
25
 
20
 
binary_files_re = 'Binary files (.*) and (.*) differ\n'
21
 
 
22
 
 
23
 
class BinaryFiles(Exception):
 
26
binary_files_re = b'Binary files (.*) and (.*) differ\n'
 
27
 
 
28
 
 
29
class PatchSyntax(BzrError):
 
30
    """Base class for patch syntax errors."""
 
31
 
 
32
 
 
33
class BinaryFiles(BzrError):
 
34
 
 
35
    _fmt = 'Binary files section encountered.'
24
36
 
25
37
    def __init__(self, orig_name, mod_name):
26
38
        self.orig_name = orig_name
27
39
        self.mod_name = mod_name
28
 
        Exception.__init__(self, 'Binary files section encountered.')
29
 
 
30
 
 
31
 
class PatchSyntax(Exception):
32
 
    def __init__(self, msg):
33
 
        Exception.__init__(self, msg)
34
40
 
35
41
 
36
42
class MalformedPatchHeader(PatchSyntax):
37
 
    def __init__(self, desc, line):
38
 
        self.desc = desc
39
 
        self.line = line
40
 
        msg = "Malformed patch header.  %s\n%r" % (self.desc, self.line)
41
 
        PatchSyntax.__init__(self, msg)
42
 
 
43
 
 
44
 
class MalformedHunkHeader(PatchSyntax):
45
 
    def __init__(self, desc, line):
46
 
        self.desc = desc
47
 
        self.line = line
48
 
        msg = "Malformed hunk header.  %s\n%r" % (self.desc, self.line)
49
 
        PatchSyntax.__init__(self, msg)
 
43
 
 
44
    _fmt = "Malformed patch header.  %(desc)s\n%(line)r"
 
45
 
 
46
    def __init__(self, desc, line):
 
47
        self.desc = desc
 
48
        self.line = line
50
49
 
51
50
 
52
51
class MalformedLine(PatchSyntax):
 
52
 
 
53
    _fmt = "Malformed line.  %(desc)s\n%(line)r"
 
54
 
53
55
    def __init__(self, desc, line):
54
56
        self.desc = desc
55
57
        self.line = line
56
 
        msg = "Malformed line.  %s\n%s" % (self.desc, self.line)
57
 
        PatchSyntax.__init__(self, msg)
58
 
 
59
 
 
60
 
class PatchConflict(Exception):
 
58
 
 
59
 
 
60
class PatchConflict(BzrError):
 
61
 
 
62
    _fmt = ('Text contents mismatch at line %(line_no)d.  Original has '
 
63
            '"%(orig_line)s", but patch says it should be "%(patch_line)s"')
 
64
 
61
65
    def __init__(self, line_no, orig_line, patch_line):
62
 
        orig = orig_line.rstrip('\n')
63
 
        patch = str(patch_line).rstrip('\n')
64
 
        msg = 'Text contents mismatch at line %d.  Original has "%s",'\
65
 
            ' but patch says it should be "%s"' % (line_no, orig, patch)
66
 
        Exception.__init__(self, msg)
 
66
        self.line_no = line_no
 
67
        self.orig_line = orig_line.rstrip('\n')
 
68
        self.patch_line = patch_line.rstrip('\n')
 
69
 
 
70
 
 
71
class MalformedHunkHeader(PatchSyntax):
 
72
 
 
73
    _fmt = "Malformed hunk header.  %(desc)s\n%(line)r"
 
74
 
 
75
    def __init__(self, desc, line):
 
76
        self.desc = desc
 
77
        self.line = line
67
78
 
68
79
 
69
80
def get_patch_names(iter_lines):
 
81
    line = next(iter_lines)
70
82
    try:
71
 
        line = iter_lines.next()
72
83
        match = re.match(binary_files_re, line)
73
84
        if match is not None:
74
85
            raise BinaryFiles(match.group(1), match.group(2))
75
 
        if not line.startswith("--- "):
 
86
        if not line.startswith(b"--- "):
76
87
            raise MalformedPatchHeader("No orig name", line)
77
88
        else:
78
 
            orig_name = line[4:].rstrip("\n")
 
89
            orig_name = line[4:].rstrip(b"\n")
79
90
    except StopIteration:
80
91
        raise MalformedPatchHeader("No orig line", "")
81
92
    try:
82
 
        line = iter_lines.next()
83
 
        if not line.startswith("+++ "):
 
93
        line = next(iter_lines)
 
94
        if not line.startswith(b"+++ "):
84
95
            raise PatchSyntax("No mod name")
85
96
        else:
86
 
            mod_name = line[4:].rstrip("\n")
 
97
            mod_name = line[4:].rstrip(b"\n")
87
98
    except StopIteration:
88
99
        raise MalformedPatchHeader("No mod line", "")
89
100
    return (orig_name, mod_name)
97
108
    :return: the position and range, as a tuple
98
109
    :rtype: (int, int)
99
110
    """
100
 
    tmp = textrange.split(',')
 
111
    tmp = textrange.split(b',')
101
112
    if len(tmp) == 1:
102
113
        pos = tmp[0]
103
 
        range = "1"
 
114
        range = b"1"
104
115
    else:
105
116
        (pos, range) = tmp
106
117
    pos = int(pos)
110
121
 
111
122
def hunk_from_header(line):
112
123
    import re
113
 
    matches = re.match(r'\@\@ ([^@]*) \@\@( (.*))?\n', line)
 
124
    matches = re.match(br'\@\@ ([^@]*) \@\@( (.*))?\n', line)
114
125
    if matches is None:
115
126
        raise MalformedHunkHeader("Does not match format.", line)
116
127
    try:
117
 
        (orig, mod) = matches.group(1).split(" ")
118
 
    except (ValueError, IndexError), e:
 
128
        (orig, mod) = matches.group(1).split(b" ")
 
129
    except (ValueError, IndexError) as e:
119
130
        raise MalformedHunkHeader(str(e), line)
120
 
    if not orig.startswith('-') or not mod.startswith('+'):
 
131
    if not orig.startswith(b'-') or not mod.startswith(b'+'):
121
132
        raise MalformedHunkHeader("Positions don't start with + or -.", line)
122
133
    try:
123
134
        (orig_pos, orig_range) = parse_range(orig[1:])
124
135
        (mod_pos, mod_range) = parse_range(mod[1:])
125
 
    except (ValueError, IndexError), e:
 
136
    except (ValueError, IndexError) as e:
126
137
        raise MalformedHunkHeader(str(e), line)
127
138
    if mod_range < 0 or orig_range < 0:
128
139
        raise MalformedHunkHeader("Hunk range is negative", line)
130
141
    return Hunk(orig_pos, orig_range, mod_pos, mod_range, tail)
131
142
 
132
143
 
133
 
class HunkLine:
 
144
class HunkLine(object):
 
145
 
134
146
    def __init__(self, contents):
135
147
        self.contents = contents
136
148
 
137
149
    def get_str(self, leadchar):
138
 
        if self.contents == "\n" and leadchar == " " and False:
139
 
            return "\n"
140
 
        if not self.contents.endswith('\n'):
141
 
            terminator = '\n' + NO_NL
 
150
        if self.contents == b"\n" and leadchar == b" " and False:
 
151
            return b"\n"
 
152
        if not self.contents.endswith(b'\n'):
 
153
            terminator = b'\n' + NO_NL
142
154
        else:
143
 
            terminator = ''
 
155
            terminator = b''
144
156
        return leadchar + self.contents + terminator
145
157
 
 
158
    def as_bytes(self):
 
159
        raise NotImplementedError
 
160
 
146
161
 
147
162
class ContextLine(HunkLine):
 
163
 
148
164
    def __init__(self, contents):
149
165
        HunkLine.__init__(self, contents)
150
166
 
151
 
    def __str__(self):
152
 
        return self.get_str(" ")
 
167
    def as_bytes(self):
 
168
        return self.get_str(b" ")
153
169
 
154
170
 
155
171
class InsertLine(HunkLine):
156
172
    def __init__(self, contents):
157
173
        HunkLine.__init__(self, contents)
158
174
 
159
 
    def __str__(self):
160
 
        return self.get_str("+")
 
175
    def as_bytes(self):
 
176
        return self.get_str(b"+")
161
177
 
162
178
 
163
179
class RemoveLine(HunkLine):
164
180
    def __init__(self, contents):
165
181
        HunkLine.__init__(self, contents)
166
182
 
167
 
    def __str__(self):
168
 
        return self.get_str("-")
169
 
 
170
 
NO_NL = '\\ No newline at end of file\n'
171
 
__pychecker__="no-returnvalues"
 
183
    def as_bytes(self):
 
184
        return self.get_str(b"-")
 
185
 
 
186
 
 
187
NO_NL = b'\\ No newline at end of file\n'
 
188
__pychecker__ = "no-returnvalues"
 
189
 
172
190
 
173
191
def parse_line(line):
174
 
    if line.startswith("\n"):
 
192
    if line.startswith(b"\n"):
175
193
        return ContextLine(line)
176
 
    elif line.startswith(" "):
 
194
    elif line.startswith(b" "):
177
195
        return ContextLine(line[1:])
178
 
    elif line.startswith("+"):
 
196
    elif line.startswith(b"+"):
179
197
        return InsertLine(line[1:])
180
 
    elif line.startswith("-"):
 
198
    elif line.startswith(b"-"):
181
199
        return RemoveLine(line[1:])
182
200
    else:
183
201
        raise MalformedLine("Unknown line type", line)
184
 
__pychecker__=""
185
 
 
186
 
 
187
 
class Hunk:
 
202
 
 
203
 
 
204
__pychecker__ = ""
 
205
 
 
206
 
 
207
class Hunk(object):
 
208
 
188
209
    def __init__(self, orig_pos, orig_range, mod_pos, mod_range, tail=None):
189
210
        self.orig_pos = orig_pos
190
211
        self.orig_range = orig_range
195
216
 
196
217
    def get_header(self):
197
218
        if self.tail is None:
198
 
            tail_str = ''
 
219
            tail_str = b''
199
220
        else:
200
 
            tail_str = ' ' + self.tail
201
 
        return "@@ -%s +%s @@%s\n" % (self.range_str(self.orig_pos,
202
 
                                                     self.orig_range),
203
 
                                      self.range_str(self.mod_pos,
204
 
                                                     self.mod_range),
205
 
                                      tail_str)
 
221
            tail_str = b' ' + self.tail
 
222
        return b"@@ -%s +%s @@%s\n" % (self.range_str(self.orig_pos,
 
223
                                                      self.orig_range),
 
224
                                       self.range_str(self.mod_pos,
 
225
                                                      self.mod_range),
 
226
                                       tail_str)
206
227
 
207
228
    def range_str(self, pos, range):
208
229
        """Return a file range, special-casing for 1-line files.
214
235
        :return: a string in the format 1,4 except when range == pos == 1
215
236
        """
216
237
        if range == 1:
217
 
            return "%i" % pos
 
238
            return b"%i" % pos
218
239
        else:
219
 
            return "%i,%i" % (pos, range)
 
240
            return b"%i,%i" % (pos, range)
220
241
 
221
 
    def __str__(self):
 
242
    def as_bytes(self):
222
243
        lines = [self.get_header()]
223
244
        for line in self.lines:
224
 
            lines.append(str(line))
225
 
        return "".join(lines)
 
245
            lines.append(line.as_bytes())
 
246
        return b"".join(lines)
 
247
 
 
248
    __bytes__ = as_bytes
226
249
 
227
250
    def shift_to_mod(self, pos):
228
 
        if pos < self.orig_pos-1:
 
251
        if pos < self.orig_pos - 1:
229
252
            return 0
230
 
        elif pos > self.orig_pos+self.orig_range:
 
253
        elif pos > self.orig_pos + self.orig_range:
231
254
            return self.mod_range - self.orig_range
232
255
        else:
233
256
            return self.shift_to_mod_lines(pos)
234
257
 
235
258
    def shift_to_mod_lines(self, pos):
236
 
        position = self.orig_pos-1
 
259
        position = self.orig_pos - 1
237
260
        shift = 0
238
261
        for line in self.lines:
239
262
            if isinstance(line, InsertLine):
259
282
    '''
260
283
    hunk = None
261
284
    for line in iter_lines:
262
 
        if line == "\n":
 
285
        if line == b"\n":
263
286
            if hunk is not None:
264
287
                yield hunk
265
288
                hunk = None
278
301
        orig_size = 0
279
302
        mod_size = 0
280
303
        while orig_size < hunk.orig_range or mod_size < hunk.mod_range:
281
 
            hunk_line = parse_line(iter_lines.next())
 
304
            hunk_line = parse_line(next(iter_lines))
282
305
            hunk.lines.append(hunk_line)
283
306
            if isinstance(hunk_line, (RemoveLine, ContextLine)):
284
307
                orig_size += 1
289
312
 
290
313
 
291
314
class BinaryPatch(object):
 
315
 
292
316
    def __init__(self, oldname, newname):
293
317
        self.oldname = oldname
294
318
        self.newname = newname
295
319
 
296
 
    def __str__(self):
297
 
        return 'Binary files %s and %s differ\n' % (self.oldname, self.newname)
 
320
    def as_bytes(self):
 
321
        return b'Binary files %s and %s differ\n' % (self.oldname, self.newname)
298
322
 
299
323
 
300
324
class Patch(BinaryPatch):
303
327
        BinaryPatch.__init__(self, oldname, newname)
304
328
        self.hunks = []
305
329
 
306
 
    def __str__(self):
 
330
    def as_bytes(self):
307
331
        ret = self.get_header()
308
 
        ret += "".join([str(h) for h in self.hunks])
 
332
        ret += b"".join([h.as_bytes() for h in self.hunks])
309
333
        return ret
310
334
 
311
335
    def get_header(self):
312
 
        return "--- %s\n+++ %s\n" % (self.oldname, self.newname)
 
336
        return b"--- %s\n+++ %s\n" % (self.oldname, self.newname)
313
337
 
314
338
    def stats_values(self):
315
339
        """Calculate the number of inserts and removes."""
318
342
        for hunk in self.hunks:
319
343
            for line in hunk.lines:
320
344
                if isinstance(line, InsertLine):
321
 
                     inserts+=1;
 
345
                    inserts += 1
322
346
                elif isinstance(line, RemoveLine):
323
 
                     removes+=1;
 
347
                    removes += 1
324
348
        return (inserts, removes, len(self.hunks))
325
349
 
326
350
    def stats_str(self):
344
368
        :rtype: iterator of (int, InsertLine)
345
369
        """
346
370
        for hunk in self.hunks:
347
 
            pos = hunk.mod_pos - 1;
 
371
            pos = hunk.mod_pos - 1
348
372
            for line in hunk.lines:
349
373
                if isinstance(line, InsertLine):
350
374
                    yield (pos, line)
362
386
    iter_lines = iter_lines_handle_nl(iter_lines)
363
387
    try:
364
388
        (orig_name, mod_name) = get_patch_names(iter_lines)
365
 
    except BinaryFiles, e:
 
389
    except BinaryFiles as e:
366
390
        return BinaryPatch(e.orig_name, e.mod_name)
367
391
    else:
368
392
        patch = Patch(orig_name, mod_name)
371
395
        return patch
372
396
 
373
397
 
374
 
def iter_file_patch(iter_lines, allow_dirty=False):
 
398
def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
375
399
    '''
376
400
    :arg iter_lines: iterable of lines to parse for patches
377
401
    :kwarg allow_dirty: If True, allow comments and other non-patch text
380
404
        first patch are stripped away in iter_hunks() if it is also passed
381
405
        allow_dirty=True.  Default False.
382
406
    '''
383
 
    ### FIXME: Docstring is not quite true.  We allow certain comments no
 
407
    # FIXME: Docstring is not quite true.  We allow certain comments no
384
408
    # matter what, If they startwith '===', '***', or '#' Someone should
385
409
    # reexamine this logic and decide if we should include those in
386
410
    # allow_dirty or restrict those to only being before the patch is found
387
411
    # (as allow_dirty does).
388
412
    regex = re.compile(binary_files_re)
389
413
    saved_lines = []
 
414
    dirty_head = []
390
415
    orig_range = 0
391
416
    beginning = True
 
417
 
392
418
    for line in iter_lines:
393
 
        if line.startswith('=== ') or line.startswith('*** '):
394
 
            continue
395
 
        if line.startswith('#'):
 
419
        if line.startswith(b'=== '):
 
420
            if allow_dirty and beginning:
 
421
                # Patches can have "junk" at the beginning
 
422
                # Stripping junk from the end of patches is handled when we
 
423
                # parse the patch
 
424
                pass
 
425
            elif len(saved_lines) > 0:
 
426
                if keep_dirty and len(dirty_head) > 0:
 
427
                    yield {'saved_lines': saved_lines,
 
428
                           'dirty_head': dirty_head}
 
429
                    dirty_head = []
 
430
                else:
 
431
                    yield saved_lines
 
432
                saved_lines = []
 
433
            dirty_head.append(line)
 
434
            continue
 
435
        if line.startswith(b'*** '):
 
436
            continue
 
437
        if line.startswith(b'#'):
396
438
            continue
397
439
        elif orig_range > 0:
398
 
            if line.startswith('-') or line.startswith(' '):
 
440
            if line.startswith(b'-') or line.startswith(b' '):
399
441
                orig_range -= 1
400
 
        elif line.startswith('--- ') or regex.match(line):
 
442
        elif line.startswith(b'--- ') or regex.match(line):
401
443
            if allow_dirty and beginning:
402
444
                # Patches can have "junk" at the beginning
403
445
                # Stripping junk from the end of patches is handled when we
404
446
                # parse the patch
405
447
                beginning = False
406
448
            elif len(saved_lines) > 0:
407
 
                yield saved_lines
 
449
                if keep_dirty and len(dirty_head) > 0:
 
450
                    yield {'saved_lines': saved_lines,
 
451
                           'dirty_head': dirty_head}
 
452
                    dirty_head = []
 
453
                else:
 
454
                    yield saved_lines
408
455
            saved_lines = []
409
 
        elif line.startswith('@@'):
 
456
        elif line.startswith(b'@@'):
410
457
            hunk = hunk_from_header(line)
411
458
            orig_range = hunk.orig_range
412
459
        saved_lines.append(line)
413
460
    if len(saved_lines) > 0:
414
 
        yield saved_lines
 
461
        if keep_dirty and len(dirty_head) > 0:
 
462
            yield {'saved_lines': saved_lines,
 
463
                   'dirty_head': dirty_head}
 
464
        else:
 
465
            yield saved_lines
415
466
 
416
467
 
417
468
def iter_lines_handle_nl(iter_lines):
424
475
    last_line = None
425
476
    for line in iter_lines:
426
477
        if line == NO_NL:
427
 
            if not last_line.endswith('\n'):
 
478
            if not last_line.endswith(b'\n'):
428
479
                raise AssertionError()
429
480
            last_line = last_line[:-1]
430
481
            line = None
435
486
        yield last_line
436
487
 
437
488
 
438
 
def parse_patches(iter_lines, allow_dirty=False):
 
489
def parse_patches(iter_lines, allow_dirty=False, keep_dirty=False):
439
490
    '''
440
491
    :arg iter_lines: iterable of lines to parse for patches
441
492
    :kwarg allow_dirty: If True, allow text that's not part of the patch at
442
493
        selected places.  This includes comments before and after a patch
443
494
        for instance.  Default False.
 
495
    :kwarg keep_dirty: If True, returns a dict of patches with dirty headers.
 
496
        Default False.
444
497
    '''
445
 
    return [parse_patch(f.__iter__(), allow_dirty) for f in
446
 
                        iter_file_patch(iter_lines, allow_dirty)]
 
498
    for patch_lines in iter_file_patch(iter_lines, allow_dirty, keep_dirty):
 
499
        if 'dirty_head' in patch_lines:
 
500
            yield ({'patch': parse_patch(patch_lines['saved_lines'], allow_dirty),
 
501
                    'dirty_head': patch_lines['dirty_head']})
 
502
        else:
 
503
            yield parse_patch(patch_lines, allow_dirty)
447
504
 
448
505
 
449
506
def difference_index(atext, btext):
461
518
        length = len(btext)
462
519
    for i in range(length):
463
520
        if atext[i] != btext[i]:
464
 
            return i;
 
521
            return i
465
522
    return None
466
523
 
467
524
 
487
544
        orig_lines = iter(orig_lines)
488
545
    for hunk in hunks:
489
546
        while line_no < hunk.orig_pos:
490
 
            orig_line = orig_lines.next()
 
547
            orig_line = next(orig_lines)
491
548
            yield orig_line
492
549
            line_no += 1
493
550
        for hunk_line in hunk.lines:
494
 
            seen_patch.append(str(hunk_line))
 
551
            seen_patch.append(hunk_line.contents)
495
552
            if isinstance(hunk_line, InsertLine):
496
553
                yield hunk_line.contents
497
554
            elif isinstance(hunk_line, (ContextLine, RemoveLine)):
498
 
                orig_line = orig_lines.next()
 
555
                orig_line = next(orig_lines)
499
556
                if orig_line != hunk_line.contents:
500
 
                    raise PatchConflict(line_no, orig_line, "".join(seen_patch))
 
557
                    raise PatchConflict(line_no, orig_line,
 
558
                                        b''.join(seen_patch))
501
559
                if isinstance(hunk_line, ContextLine):
502
560
                    yield orig_line
503
561
                else:
507
565
    if orig_lines is not None:
508
566
        for line in orig_lines:
509
567
            yield line
 
568
 
 
569
 
 
570
def apply_patches(tt, patches, prefix=1):
 
571
    """Apply patches to a TreeTransform.
 
572
 
 
573
    :param tt: TreeTransform instance
 
574
    :param patches: List of patches
 
575
    :param prefix: Number leading path segments to strip
 
576
    """
 
577
    def strip_prefix(p):
 
578
        return '/'.join(p.split('/')[1:])
 
579
 
 
580
    from breezy.bzr.generate_ids import gen_file_id
 
581
    # TODO(jelmer): Extract and set mode
 
582
    for patch in patches:
 
583
        if patch.oldname == b'/dev/null':
 
584
            trans_id = None
 
585
            orig_contents = b''
 
586
        else:
 
587
            oldname = strip_prefix(patch.oldname.decode())
 
588
            trans_id = tt.trans_id_tree_path(oldname)
 
589
            orig_contents = tt._tree.get_file_text(oldname)
 
590
            tt.delete_contents(trans_id)
 
591
 
 
592
        if patch.newname != b'/dev/null':
 
593
            newname = strip_prefix(patch.newname.decode())
 
594
            new_contents = iter_patched_from_hunks(
 
595
                orig_contents.splitlines(True), patch.hunks)
 
596
            if trans_id is None:
 
597
                parts = os.path.split(newname)
 
598
                trans_id = tt.root
 
599
                for part in parts[1:-1]:
 
600
                    trans_id = tt.new_directory(part, trans_id)
 
601
                tt.new_file(
 
602
                    parts[-1], trans_id, new_contents,
 
603
                    file_id=gen_file_id(newname))
 
604
            else:
 
605
                tt.create_file(new_contents, trans_id)
 
606
 
 
607
 
 
608
class AppliedPatches(object):
 
609
    """Context that provides access to a tree with patches applied.
 
610
    """
 
611
 
 
612
    def __init__(self, tree, patches, prefix=1):
 
613
        self.tree = tree
 
614
        self.patches = patches
 
615
        self.prefix = prefix
 
616
 
 
617
    def __enter__(self):
 
618
        self._tt = self.tree.preview_transform()
 
619
        apply_patches(self._tt, self.patches, prefix=self.prefix)
 
620
        return self._tt.get_preview_tree()
 
621
 
 
622
    def __exit__(self, exc_type, exc_value, exc_tb):
 
623
        self._tt.finalize()
 
624
        return False