]> granicus.if.org Git - python/commitdiff
Patch #1677862: Require a space or tab after import in .pth files.
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 12 Mar 2007 11:01:10 +0000 (11:01 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 12 Mar 2007 11:01:10 +0000 (11:01 +0000)
Doc/lib/libsite.tex
Lib/site.py
Misc/NEWS

index c0797904b4c238824b7e7d15df513fcf55d69087..11858d1cf70d6c43462f65dc79909ee0e02aba76 100644 (file)
@@ -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}
 
index 113f2215e5f16271ca15c25877a3a53eac632ff5..5033f8abcd936cefcf3b22ac8d9402f063da3b7a 100644 (file)
@@ -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()
index f3785fb2562611c78ebff65a520e742159870b81..e34964e05b2290e73f1a8286177d5ca6ef0a2287 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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.