You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pyrepl help modules displays a print statement from test_sqlite3 #139743
When using pyrepl, there's a random print statement from sqlite when calling help then modules.
test_sqlite3: testing with SQLite version 3.51.0
Python 3.15.0a0 (heads/main:c53c55b6ed9, Oct 7 2025, 18:49:00) [Clang 17.0.0 (clang-1700.3.19.1)] on darwin
Type "help", "copyright", "credits" or "license"for more information.
>>> help
(snip...)
To quit this help utility and return to the interpreter,
enter "q", "quit" or "exit".
help> modules
Please wait a moment while I gather a list of all available modules...
test_sqlite3: testing with SQLite version 3.51.0
__future__ _sre ensurepip quopri
__hello__ _ssl enum random
__phello__ _stat errno re
_abc _statistics faulthandler readline
Also, it's not clear to me why all of these internal _ prefixed internal modules are being displayed.
print(f"test_sqlite3: testing with SQLite version {sqlite3.sqlite_version}")
modules will load all of the modules can load
then it load test_sqlite3 in this the verbose is 1 so will print it.
it is not because pyrepl you can run python3.12 in cpython dir
then help -> modules it will also print it
➜ cpython git:(main) python3.12
Python 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 3.12's help utility! If this is your first time using
Python, you should definitely check out the tutorial at
https://docs.python.org/3.12/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To get a list of available
modules, keywords, symbols, or topics, enter "modules", "keywords",
"symbols", or "topics".
Each module also comes with a one-line summary of what it does; to list
the modules whose name or summary contain a given string such as "spam",
enter "modules spam".
To quit this help utility and return to the interpreter,
enter "q" or "quit".
help> modules
Please wait a moment while I gather a list of all available modules...
test_sqlite3: testing with SQLite version 3.49.1
how to fix it
maybe this diff can fix it but not sure
diff --git a/Lib/test/test_sqlite3/__init__.py b/Lib/test/test_sqlite3/__init__.py
index d777fca82d..b4d95f1365 100644
--- a/Lib/test/test_sqlite3/__init__.py+++ b/Lib/test/test_sqlite3/__init__.py@@ -8,8 +8,8 @@
# Implement the unittest "load tests" protocol.
def load_tests(*args):
+ if verbose:+ print(f"test_sqlite3: testing with SQLite version {sqlite3.sqlite_version}")
pkg_dir = os.path.dirname(__file__)
return load_package_tests(pkg_dir, *args)
-if verbose:- print(f"test_sqlite3: testing with SQLite version {sqlite3.sqlite_version}")
Hi all — I reproduced this locally and it matches @yihong0618’s observation. @yihong0618 are you planning to open a PR for this fix? If not, I’m happy to open one adopting your approach (with credit).
Also, it might be worth considering a focused test for help('modules') in a separate PR to prevent regressions.
Hi all — I reproduced this locally and it matches @yihong0618’s observation. @yihong0618 are you planning to open a PR for this fix? If not, I’m happy to open one adopting your approach (with credit).
Also, it might be worth considering a focused test for help('modules') in a separate PR to prevent regressions.
After this patch the help print is fixed
but it will print the message twice in test
➜ cpython git:(main) ./python.exe -m test test_sqlite3 -v
== CPython 3.15.0a1+ (heads/main:ed73c909f2, Nov 16 2025, 15:29:51) [Clang 17.0.0 (clang-1700.0.13.5)]
== macOS-15.3.2-arm64-arm-64bit-Mach-O little-endian
== Python build: release
== cwd: /Users/yihong/repos/cpython/build/test_python_worker_36303æ
== CPU count: 10
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 610242821
0:00:00 load avg: 2.83 Run 1 test sequentially in a single process
0:00:00 load avg: 2.83 [1/1] test_sqlite3
test_sqlite3: testing with SQLite version 3.43.2
test_sqlite3: testing with SQLite version 3.43.2
test_bad_source_closed_connection (test.test_sqlite3.test_backup.BackupTests.test_bad_source_closed_connection) ... ok
Activity
yihong0618 commentedon Oct 8, 2025
this is becase this line
cpython/Lib/test/test_sqlite3/__init__.py
Line 15 in a15aeec
modules will load all of the modules can load
then it load test_sqlite3 in this the verbose is 1 so will print it.
it is not because pyrepl you can run python3.12 in cpython dir
then help -> modules it will also print it
how to fix it
maybe this diff can fix it but not sure
ttw225 commentedon Oct 8, 2025
Hi all — I reproduced this locally and it matches @yihong0618’s observation. @yihong0618 are you planning to open a PR for this fix? If not, I’m happy to open one adopting your approach (with credit).
Also, it might be worth considering a focused test for help('modules') in a separate PR to prevent regressions.
yihong0618 commentedon Oct 8, 2025
I am not planning that just go haha
gh-139743: Avoid import-time print in test_sqlite3 (GH-139746)
pythongh-139743: Avoid import-time print in test_sqlite3 (pythonGH-13…
pythongh-139743: Avoid import-time print in test_sqlite3 (pythonGH-13…
[3.13] gh-139743: Avoid import-time print in test_sqlite3 (GH-139746) (…
[3.14] gh-139743: Avoid import-time print in test_sqlite3 (GH-139746) (…
yihong0618 commentedon Nov 16, 2025
After this patch the
helpprint is fixedbut it will print the message twice in test
cc @serhiy-storchaka
gh-139743: Avoid print twice verbose version for sqlite tests (GH-142850
pythongh-139743: Avoid print twice verbose version for sqlite tests (p…
pythongh-139743: Avoid print twice verbose version for sqlite tests (p…
[3.14] gh-139743: Avoid print twice verbose version for sqlite tests (G…
[3.13] gh-139743: Avoid print twice verbose version for sqlite tests (G…