bpo-29592: site: skip abs_paths() when it's redundant (GH-167) · python/cpython@2e4e011 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 2e4e011
bpo-29592: site: skip abs_paths() when it's redundant (GH-167)
Call abs_paths() only if removeduppaths() changed sys.path
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -522,8 +522,13 @@ def main(): | ||
522 | 522 | """ |
523 | 523 | global ENABLE_USER_SITE |
524 | 524 | |
525 | -abs_paths() | |
525 | +orig_path = sys.path[:] | |
526 | 526 | known_paths = removeduppaths() |
527 | +if orig_path != sys.path: | |
528 | +# removeduppaths() might make sys.path absolute. | |
529 | +# fix __file__ and __cached__ of already imported modules too. | |
530 | +abs_paths() | |
531 | + | |
527 | 532 | known_paths = venv(known_paths) |
528 | 533 | if ENABLE_USER_SITE is None: |
529 | 534 | ENABLE_USER_SITE = check_enableusersite() |