From 4d0bddfee66383e746a79d60cd64e40fc1ab1df7 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Tue, 20 Jul 2004 02:28:28 +0000 Subject: [PATCH] Fix bug in addsitedir() to properly handle the lack of a second argument. Fixed to keep backwards-compatibility for the undocumented function. Closes bug #986795. --- Lib/site.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/site.py b/Lib/site.py index 241068cb4fe..2207ec59cdc 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -124,7 +124,7 @@ def addpackage(sitedir, name, known_paths): reset = 0 fullname = os.path.join(sitedir, name) try: - f = file(fullname, "rU") + f = open(fullname, "rU") except IOError: return try: @@ -149,7 +149,7 @@ def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: - d = _init_pathinfo() + known_paths = _init_pathinfo() reset = 1 else: reset = 0 @@ -162,7 +162,7 @@ def addsitedir(sitedir, known_paths=None): return names.sort() for name in names: - if name[-4:] == os.extsep + "pth": + if name.endswith(os.extsep + "pth"): addpackage(sitedir, name, known_paths) if reset: known_paths = None