FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148641: Implement PEP 829 - startup configuration files by warsaw · Pull Request #149109 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f05e9f6
Prototype of package.site.toml files
warsaw Apr 1, 2026
1f697e6
Merge branch 'main' into pth2toml
warsaw Apr 1, 2026
594f347
Validate [metadata].schema_version
warsaw Apr 1, 2026
ca6e4ed
Added PEP 829 draft
warsaw Apr 1, 2026
508f493
Update and refine PEP 829
warsaw Apr 1, 2026
72b4d9a
Merge branch 'main' into pth2toml
warsaw Apr 14, 2026
390de9f
Checkpointing reference implementation updates
warsaw Apr 15, 2026
8454716
Fix phase ordering
warsaw Apr 15, 2026
3e99f25
Fix docs and tests for PEP 829
warsaw Apr 15, 2026
e1eaffb
Trim the out-of-date site.py docstring
warsaw Apr 15, 2026
caab85c
Fix some tests
warsaw Apr 15, 2026
e393af0
A couple more improvements
warsaw Apr 15, 2026
bc92325
Merge branch 'main' into pth2toml
warsaw Apr 15, 2026
9b0b977
Remove unused import
warsaw Apr 16, 2026
1804f68
Blurb It
warsaw Apr 16, 2026
1bc0ac4
Merge branch 'main' into pth2toml
warsaw Apr 16, 2026
cdcd9cd
Add a migration guide for pth->start files
warsaw Apr 16, 2026
88465c1
Merge branch 'main' into pth2toml
warsaw Apr 16, 2026
d969ae6
Update site.rst documentation
warsaw Apr 17, 2026
d5eb74d
Merge branch 'python:main' into pth2toml
warsaw Apr 23, 2026
981d42b
Merge branch 'pth2toml' into warsaw/829
warsaw Apr 27, 2026
6eb25da
Implement PEP 829 - startup configuration files
warsaw Apr 28, 2026
77e73c2
Add comment for the future
warsaw Apr 28, 2026
c6c4252
Merge branch 'main' into warsaw/829
warsaw Apr 28, 2026
e3be2af
Remove accidental PEP file
warsaw Apr 28, 2026
95f5f68
Fix empty .start file logic bug
warsaw Apr 28, 2026
b36a16a
Fix another test: line numbers are suppressed
warsaw Apr 28, 2026
9a017f2
Add resolve_name(name, *, strict=False)
warsaw Apr 28, 2026
261088d
Defer entry point syntax check to execution time
warsaw Apr 28, 2026
ab8f926
Add optional exc=None to _trace()
warsaw Apr 28, 2026
27cb819
main() should use the flush_pth_start() helper
warsaw Apr 28, 2026
cc61acd
Improve some documentation wording
warsaw Apr 28, 2026
6e34cbc
Add a test to ensure site.addsitedir() works end-to-end
warsaw Apr 28, 2026
133b1a5
Add tests to validate the encoding constraints for .start and .pth files
warsaw Apr 28, 2026
eb6ddef
Add tests to ensure error verbosity with and without -v
warsaw Apr 28, 2026
cb61374
Split the blurb entry into site.py and pkgutil.resolve_name() descrip…
warsaw Apr 28, 2026
9d37c8a
Respond to PR review:
warsaw Apr 28, 2026
3a8db6d
Remove unused cross-reference anchor
warsaw Apr 28, 2026
30f38b0
Two more review fixes
warsaw Apr 28, 2026
618af20
List PEP 829 in whatsnew for 3.15
warsaw Apr 28, 2026
9007fa2
Merge branch 'main' into warsaw/829
warsaw Apr 28, 2026
d32a82d
Inline future deprecation warnings
warsaw Apr 29, 2026
f85e959
Merge branch 'main' into warsaw/829
warsaw Apr 29, 2026
ccb75a4
Merge branch 'main' into warsaw/829
warsaw Apr 29, 2026
760fb81
Use of "i.e." is discouraged
warsaw Apr 29, 2026
b7b22d6
Merge branch 'main' into warsaw/829
warsaw Apr 30, 2026
9292522
Merge branch 'main' into warsaw/829
warsaw Apr 30, 2026
e3ef09b
In version-related markup, use `next` instead of `3.15`
warsaw Apr 30, 2026
35ca4ac
Update Doc/library/site.rst
warsaw May 1, 2026
195601b
Respond to brettcannon's review comments.
warsaw May 2, 2026
148776d
Merge branch 'main' into warsaw/829
warsaw May 2, 2026
e4a1271
Merge branch 'main' into warsaw/829
warsaw May 2, 2026
615c6e6
Checkpointing review changes
warsaw May 3, 2026
7b7795a
Clean up some tests since the semantics have been updated
warsaw May 3, 2026
e8edb52
Make PthFile.create() a context manager for cleaner code
warsaw May 3, 2026
92d4fab
Clean up some comments
warsaw May 3, 2026
e34dd6f
Merge branch 'main' into warsaw/829
warsaw May 3, 2026
5019131
Merge branch 'main' into warsaw/829
warsaw May 3, 2026
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Add tests to ensure error verbosity with and without -v
  • Loading branch information
warsaw committed Apr 28, 2026
commit eb6ddeff97980140482941b811a0a3f6ce6ae4c2
31 changes: 31 additions & 0 deletions Lib/test/test_site.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import sysconfig
import tempfile
from textwrap import dedent
from types import SimpleNamespace
import urllib.error
import urllib.request
from unittest import mock
Expand Down Expand Up @@ -1127,6 +1128,36 @@ def test_read_pth_file_bad_line_continues(self):
fullname = os.path.join(self.sitedir, 'foo.pth')
self.assertIn(subdir, site._pending_syspaths.get(fullname, []))

def _flags_with_verbose(self, verbose):
# Build a sys.flags clone with verbose overridden but every
# other field preserved, so unrelated reads like
# sys.flags.optimize during io.open_code() continue to work.
attrs = {name: getattr(sys.flags, name)
for name in sys.flags.__match_args__}
attrs['verbose'] = verbose
return SimpleNamespace(**attrs)

def test_read_pth_file_parse_error_silent_by_default(self):
# PEP 829: parse-time errors are silent unless -v is given.
# Force the error path by making makepath() raise.
self._make_pth("badline\n", name='foo')
with mock.patch('site.makepath', side_effect=ValueError("boom")), \
mock.patch('sys.flags', self._flags_with_verbose(False)), \
captured_stderr() as err:
site._read_pth_file(self.sitedir, 'foo.pth', set())
self.assertEqual(err.getvalue(), "")

def test_read_pth_file_parse_error_reported_under_verbose(self):
# PEP 829: parse-time errors are reported when -v is given.
self._make_pth("badline\n", name='foo')
with mock.patch('site.makepath', side_effect=ValueError("boom")), \
mock.patch('sys.flags', self._flags_with_verbose(True)), \
captured_stderr() as err:
site._read_pth_file(self.sitedir, 'foo.pth', set())
out = err.getvalue()
self.assertIn('Error in', out)
self.assertIn('foo.pth', out)

def test_read_pth_file_locale_fallback(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't see a test for utf-8-sig for .pth files when that isn't the locale.

# PEP 829: .pth files that fail UTF-8 decoding fall back to the
# locale encoding for backward compatibility (deprecated in
Expand Down

Back | FazBrowse Home | New Git URL