Skip to content
Browse files

Make sure to explicitly close opened files.

  • Loading branch information...
1 parent c773449 commit 20a7a244d78b835473c3e4d9b86e1c991d252daf @alex alex committed with Alex Gaynor
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/core/management/
7 django/core/management/
@@ -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.
- 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):

0 comments on commit 20a7a24

Please sign in to comment.
Something went wrong with that request. Please try again.