diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-03-12 11:01:10 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-03-12 11:01:10 (GMT) |
commit | 2681beb23e3a8d9d905d99f9e67bb0389264f44f (patch) | |
tree | 56814b2addc67a85ff972fbe7664b2b5095bf84b | |
parent | eb62357a2e8c18fc014e9e977acf1e2026e5d9cf (diff) | |
download | cpython-2681beb23e3a8d9d905d99f9e67bb0389264f44f.zip cpython-2681beb23e3a8d9d905d99f9e67bb0389264f44f.tar.gz cpython-2681beb23e3a8d9d905d99f9e67bb0389264f44f.tar.bz2 |
Patch #1677862: Require a space or tab after import in .pth files.
-rw-r--r-- | Doc/lib/libsite.tex | 17 | ||||
-rw-r--r-- | Lib/site.py | 2 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/Doc/lib/libsite.tex b/Doc/lib/libsite.tex index c079790..11858d1 100644 --- a/Doc/lib/libsite.tex +++ b/Doc/lib/libsite.tex @@ -28,12 +28,17 @@ the newly added path for configuration files. A path configuration file is a file whose name has the form \file{\var{package}.pth} and exists in one of the four directories -mentioned above; its contents are additional items (one -per line) to be added to \code{sys.path}. Non-existing items are -never added to \code{sys.path}, but no check is made that the item -refers to a directory (rather than a file). No item is added to -\code{sys.path} more than once. Blank lines and lines beginning with -\code{\#} are skipped. Lines starting with \code{import} are executed. +mentioned above; its contents are additional items (one per line) to +be added to \code{sys.path}. Non-existing items are never added to +\code{sys.path}, but no check is made that the item refers to a +directory (rather than a file). No item is added to \code{sys.path} +more than once. Blank lines and lines beginning with \code{\#} are +skipped. Lines starting with \code{import} (followed by space or tab) +are executed. + +\versionchanged[A space or tab is now required after the import +keyword]{2.6} + \index{package} \indexiii{path}{configuration}{file} diff --git a/Lib/site.py b/Lib/site.py index 113f221..5033f8a 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -134,7 +134,7 @@ def addpackage(sitedir, name, known_paths): for line in f: if line.startswith("#"): continue - if line.startswith("import"): + if line.startswith("import ") or line.startswith("import\t"): exec line continue line = line.rstrip() @@ -158,6 +158,8 @@ Core and builtins Library ------- +- Patch #1677862: Require a space or tab after import in .pth files. + - Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number. |