bpo-33456: site.py: fix wrong default for key in pyvenv.cfg by meribold · Pull Request #6755 · python/cpython
PEP 405 says this:
By default, a virtual environment is entirely isolated from the system-level site-packages directories.
If the
pyvenv.cfgfile also contains a keyinclude-system-site-packageswith a value oftrue(not case sensitive), thesitemodule will also add the system site directories tosys.pathafter the virtual environment site directories.
The documentation of the site module says (emphasis added):
If "pyvenv.cfg" […] contains the key "include-system-site-packages" set to anything other than "false" (case-insensitive), the system-level prefixes will still also be searched for site-packages; otherwise they won’t.
However, what actually happens in site.py is different: see https://github.com/python/cpython/blob/3.6/Lib/site.py#L447. The system_site variable is initialized to "true" and doesn't change unless the key include-system-site-packages exists in pyvenv.cfg.
I think system_site should be initialized to "false" so the actual behavior matches the documented behavior.