8000 Update pprint.py and test_pprint.py to 3.12 (#5195) · RustPython/RustPython@4e7b3bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e7b3bc

Browse files
authored
Update pprint.py and test_pprint.py to 3.12 (#5195)
1 parent 83d1ad8 commit 4e7b3bc

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

Lib/pprint.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,6 @@ def _recursion(object):
637637
% (type(object).__name__, id(object)))
638638

639639

640-
def _perfcheck(object=None):
641-
import time
642-
if object is None:
643-
object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
644-
p = PrettyPrinter()
645-
t1 = time.perf_counter()
646-
p._safe_repr(object, {}, None, 0, True)
647-
t2 = time.perf_counter()
648-
p.pformat(object)
649-
t3 = time.perf_counter()
650-
print("_safe_repr:", t2 - t1)
651-
print("pformat:", t3 - t2)
652-
653640
def _wrap_bytes_repr(object, width, allowance):
654641
current = b''
655642
last = len(object) // 4 * 4
@@ -666,6 +653,3 @@ def _wrap_bytes_repr(object, width, allowance):
666653
current = candidate
667654
if current:
668655
yield repr(current)
669-
670-
if __name__ == "__main__":
671-
_perfcheck()

Lib/test/test_pprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_knotted(self):
203203
def test_unreadable(self):
204204
# Not recursive but not readable anyway
205205
pp = pprint.PrettyPrinter()
206-
for unreadable in type(3), pprint, pprint.isrecursive:
206+
for unreadable in object(), int, pprint, pprint.isrecursive:
207207
# module-level convenience functions
208208
self.assertFalse(pprint.isrecursive(unreadable),
209209
"expected not isrecursive for %r" % (unreadable,))

0 commit comments

Comments
 (0)
0