Fix some bugs when dealing with non-existent or non-PEP files.

This commit is contained in:
Guido van Rossum 2007-05-10 22:55:31 +00:00
parent c91f1215e8
commit 34ec2ad36c
1 changed files with 5 additions and 3 deletions

View File

@ -340,7 +340,7 @@ def get_input_lines(inpath):
if e.errno <> errno.ENOENT: raise if e.errno <> errno.ENOENT: raise
print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename
sys.stderr.flush() sys.stderr.flush()
return None, None return None
lines = infile.read().splitlines(1) # handles x-platform line endings lines = infile.read().splitlines(1) # handles x-platform line endings
infile.close() infile.close()
return lines return lines
@ -355,6 +355,8 @@ def find_pep(pep_str):
def make_html(inpath, verbose=0): def make_html(inpath, verbose=0):
input_lines = get_input_lines(inpath) input_lines = get_input_lines(inpath)
if input_lines is None:
return None
pep_type = get_pep_type(input_lines) pep_type = get_pep_type(input_lines)
if pep_type is None: if pep_type is None:
print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath