Ticket #130: send-count.diff

File send-count.diff, 1.2 KB (added by Brian Warner, 15 years ago)

patch to include .count attribute in CopiedFailure? dict

  • foolscap/call.py

    diff -r d7346b6e518b foolscap/call.py
    a b  
    44
    55from foolscap import copyable, slicer, tokens
    66from foolscap.copyable import AttributeDictConstraint
    7 from foolscap.constraint import ByteStringConstraint
     7from foolscap.constraint import ByteStringConstraint, IntegerConstraint
    88from foolscap.slicers.list import ListConstraint
    99from tokens import BananaError, Violation
    1010from foolscap.util import AsyncAND
     
    2323                 ('value', ByteStringConstraint(1000)),
    2424                 ('traceback', ByteStringConstraint(2000)),
    2525                 ('parents', ListConstraint(ByteStringConstraint(200))),
     26                 ('count', IntegerConstraint()),
    2627                 ]
    2728        AttributeDictConstraint.__init__(self, *attrs)
    2829
     
    801802        # Exception.__repr__ returns.
    802803        state['value'] = truncate(state['value'], 1000)
    803804        state['type'] = truncate(state['type'], 200)
     805        if hasattr(obj, "count"):
     806            state["count"] = obj.count
    804807
    805808        if broker.unsafeTracebacks:
    806809            if isinstance(obj.type, str):