[New-bugs-announce] [issue45211] Useful (expensive) information is discarded in getpath.c.

Eric Snow report at bugs.python.org
Wed Sep 15 13:19:45 EDT 2021


New submission from Eric Snow <ericsnowcurrently at gmail.com>:

Currently we calculate a number of filesystem paths during runtime initialization in Modules/getpath.c (with the key goal of producing what will end up in sys.path).  Some of those paths are preserved and some are not.  In cases where the discarded data comes from filesystem access, we should preserve as much as possible.

The most notable info is location of the stdlib source files.  We would store this as PyConfig.stdlib_dir (and _PyPathConfig.stdlib_dir).  We'd expose it with sys.stdlibdir (or sys.get_stdlib_dir() if we might need to calculate lazily), similar to sys.platlibdir, sys.home, and sys.prefix.

sys.stdlibdir would allow us to avoid filesystem access, for example:

* in site.py
* in sysconfig.py
* detect if python is running out of the source tree (needed for bpo-45020)

FYI, I have a branch that mostly does what I'm suggesting here.

----------
assignee: eric.snow
components: Interpreter Core
messages: 401860
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: Useful (expensive) information is discarded in getpath.c.
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45211>
_______________________________________


More information about the New-bugs-announce mailing list