Message225955
| Author |
vstinner |
| Recipients |
pitrou, vstinner |
| Date |
2014年08月27日.10:07:47 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1409134067.89.0.764298356643.issue22285@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
When Python is built from source, the "Modules/" subdirectory is added to sys.path on UNIX. I don't understand why: it does not contain .py files nor .so dynamic modules. Dynamic modules are built in "build/lib.linux-x86_64-3.5-pydebug".
A side effect of adding Modules/ subdirectory to sys.path is that Modules subdirectories (ex: _sqlite, _ctypes, _io, _decimal, etc.) can be used as packages.
For example, when the _decimal module cannot be compiled, Lib/decimal.py uses Modules/_decimal as a Python package which is wrong. The decimal becomes an empty module (no symbol, because Modules/_decimal does not contain an __init__.py nor any .so file) because decimal.py uses "import _decimal" at the end (see decimal.py).
Attached patch removes Modules/ from sys.path on UNIX.
Maybe adding Modules/ to sys.path was useful before the introduction of pybuildir.txt? See issue #9589 and the changeset 4742e7aea2f5 (and the issue #586680). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年08月27日 10:07:47 | vstinner | set | recipients:
+ vstinner, pitrou |
| 2014年08月27日 10:07:47 | vstinner | set | messageid: <1409134067.89.0.764298356643.issue22285@psf.upfronthosting.co.za> |
| 2014年08月27日 10:07:47 | vstinner | link | issue22285 messages |
| 2014年08月27日 10:07:47 | vstinner | create |
|