Repository navigation
Minor bug in pprint module #92546
Copy link
Copy link
Closed
Labels
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on May 9, 2022 Please provide the code that triggered this problem.
@ericvsmith
_perfcheck()is called fromif __name__ == "__main__":Lines 640 to 671 in be3cdd6
def _perfcheck(object=None): import time if object is None: object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000 p = PrettyPrinter() t1 = time.perf_counter() p._safe_repr(object, {}, None, 0, True) t2 = time.perf_counter() p.pformat(object) t3 = time.perf_counter() print("_safe_repr:", t2 - t1) print("pformat:", t3 - t2) def _wrap_bytes_repr(object, width, allowance): current = b'' last = len(object) // 4 * 4 for i in range(0, len(object), 4): part = object[i: i+4] candidate = current + part if i == last: width -= allowance if len(repr(candidate)) > width: if current: yield repr(current) current = part else: current = candidate if current: yield repr(current) if __name__ == "__main__": _perfcheck() Ah, I misunderstood. Thanks.
Irit, 'git annotate' indicates that you made this change.
Reacted by Irit Katriel- added a commit that references this issue
on Jul 5, 2022 I recently started working towards becoming python core developer. I came across this issue marked as easy. Can I take up and fix this issue?
@ddurgoji It's an open project, no preliminary assignment is required. The only thing you need is to follow the contributor's manual at https://devguide.python.org/ where conventions and processes are described.
@arhadthedev , Yes I am going through it thanks.
I think this issue is no longer relevant because it is solved in #94613
Indeed. Thanks.
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32