https://github.com/python/cpython/commit/c7f1e184207c6b34e6cd5492bb6377cf28b1df6f
commit: c7f1e184207c6b34e6cd5492bb6377cf28b1df6f
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: ambv <[email protected]>
date: 2026-01-02T17:28:04+01:00
summary:

[3.13] gh-138897: Use `_pyrepl.pager` for `_sitebuiltins._Printer` (GH-138898) 
(GH-143365)

(cherry picked from commit 0417dabe3f560470eec63a2485b1741ba9c5e697)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Ɓukasz Langa <[email protected]>

files:
A Misc/NEWS.d/next/Library/2025-09-14-22-26-50.gh-issue-138897.vnUb_L.rst
M Lib/_sitebuiltins.py

diff --git a/Lib/_sitebuiltins.py b/Lib/_sitebuiltins.py
index c66269a571967f..81b36efc6c285f 100644
--- a/Lib/_sitebuiltins.py
+++ b/Lib/_sitebuiltins.py
@@ -36,7 +36,7 @@ def __init__(self, name, data, files=(), dirs=()):
         import os
         self.__name = name
         self.__data = data
-        self.__lines = None
+        self.__lines = []
         self.__filenames = [os.path.join(dir, filename)
                             for dir in dirs
                             for filename in files]
@@ -65,24 +65,12 @@ def __repr__(self):
             return "Type %s() to see the full %s text" % ((self.__name,)*2)
 
     def __call__(self):
+        from _pyrepl.pager import get_pager
         self.__setup()
-        prompt = 'Hit Return for more, or q (and Return) to quit: '
-        lineno = 0
-        while 1:
-            try:
-                for i in range(lineno, lineno + self.MAXLINES):
-                    print(self.__lines[i])
-            except IndexError:
-                break
-            else:
-                lineno += self.MAXLINES
-                key = None
-                while key is None:
-                    key = input(prompt)
-                    if key not in ('', 'q'):
-                        key = None
-                if key == 'q':
-                    break
+
+        pager = get_pager()
+        text = "\n".join(self.__lines)
+        pager(text, title=self.__name)
 
 
 class _Helper(object):
diff --git 
a/Misc/NEWS.d/next/Library/2025-09-14-22-26-50.gh-issue-138897.vnUb_L.rst 
b/Misc/NEWS.d/next/Library/2025-09-14-22-26-50.gh-issue-138897.vnUb_L.rst
new file mode 100644
index 00000000000000..779c886fdd94c1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-09-14-22-26-50.gh-issue-138897.vnUb_L.rst
@@ -0,0 +1,2 @@
+Improved :data:`license`/:data:`copyright`/:data:`credits` display in the
+:term:`REPL`: now uses a pager.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to