python: fix fd leak in generator.py

This commit is contained in:
Guannan Ren 2013-02-28 18:03:46 +08:00
parent 2387fdb7d0
commit 20fa62414c

View File

@ -806,6 +806,7 @@ def buildStubs(module):
try: try:
f = open(os.path.join(srcPref,api_xml)) f = open(os.path.join(srcPref,api_xml))
data = f.read() data = f.read()
f.close()
(parser, target) = getparser() (parser, target) = getparser()
parser.feed(data) parser.feed(data)
parser.close() parser.close()
@ -813,6 +814,7 @@ def buildStubs(module):
try: try:
f = open(os.path.join(srcPref,"..","docs",api_xml)) f = open(os.path.join(srcPref,"..","docs",api_xml))
data = f.read() data = f.read()
f.close()
(parser, target) = getparser() (parser, target) = getparser()
parser.feed(data) parser.feed(data)
parser.close() parser.close()
@ -830,6 +832,7 @@ def buildStubs(module):
try: try:
f = open(os.path.join(srcPref, override_api_xml)) f = open(os.path.join(srcPref, override_api_xml))
data = f.read() data = f.read()
f.close()
(parser, target) = getparser() (parser, target) = getparser()
parser.feed(data) parser.feed(data)
parser.close() parser.close()