Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure to explicitly close opened files.

  • Loading branch information...
commit 20a7a244d78b835473c3e4d9b86e1c991d252daf 1 parent c773449
@alex alex authored Alex Gaynor committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/core/management/__init__.py
View
7 django/core/management/__init__.py
@@ -51,14 +51,19 @@ def find_management_module(app_name):
# module, we need look for the case where the project name is part
# of the app_name but the project directory itself isn't on the path.
try:
- f, path, descr = imp.find_module(part,path)
+ f, path, descr = imp.find_module(part, path)
except ImportError as e:
if os.path.basename(os.getcwd()) != part:
raise e
+ finally:
+ if f:
+ f.close()
while parts:
part = parts.pop()
f, path, descr = imp.find_module(part, path and [path] or None)
+ if f:
+ f.close()
return path
def load_command_class(app_name, name):
Please sign in to comment.
Something went wrong with that request. Please try again.