[Python-checkins] r54860 - sandbox/trunk/pep0/pep0/parse.py

brett.cannon python-checkins at python.org
Wed Apr 18 05:02:17 CEST 2007


Author: brett.cannon
Date: Wed Apr 18 05:02:13 2007
New Revision: 54860
Modified:
 sandbox/trunk/pep0/pep0/parse.py
Log:
Add an assert to catch PEPs that are malformed.
Modified: sandbox/trunk/pep0/pep0/parse.py
==============================================================================
--- sandbox/trunk/pep0/pep0/parse.py	(original)
+++ sandbox/trunk/pep0/pep0/parse.py	Wed Apr 18 05:02:13 2007
@@ -32,6 +32,7 @@
 def consume_pep(path):
 """Consume the specified file as a PEP to get its metadata."""
 metadata = {}
+ field = None
 with open(path, 'rU') as pep_file:
 try:
 for line in pep_file:
@@ -39,6 +40,7 @@
 # Found end of metadata.
 break
 elif line[0].isspace():
+ assert field is not None
 # Whitespace indent signifies multi-line field data.
 field, data = split_metadata(line, field)
 else:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /