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.
This commit is contained in:
Brett Cannon 2004-07-20 02:28:28 +00:00
parent ad00913cf0
commit 4d0bddfee6
1 changed files with 3 additions and 3 deletions

View File

@ -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