(output, length_length)
| 39 | |
| 40 | @contextlib.contextmanager |
| 41 | def prefixed_length(output, length_length): |
| 42 | output.write(b"\00" * length_length) |
| 43 | start = output.tell() |
| 44 | yield |
| 45 | end = output.tell() |
| 46 | length = end - start |
| 47 | if length > 0: |
| 48 | try: |
| 49 | output.seek(start - length_length) |
| 50 | try: |
| 51 | output.write(length.to_bytes(length_length, "big")) |
| 52 | except OverflowError: |
| 53 | raise dns.exception.FormError |
| 54 | finally: |
| 55 | output.seek(end) |
| 56 | |
| 57 | |
| 58 | class Renderer: |
no test coverage detected
searching dependent graphs…