[Python-checkins] r57134 - doctools/trunk/sphinx/highlighting.py
georg.brandl
python-checkins at python.org
Fri Aug 17 08:25:19 CEST 2007
Author: georg.brandl
Date: Fri Aug 17 08:24:52 2007
New Revision: 57134
Modified:
doctools/trunk/sphinx/highlighting.py
Log:
Use the "with" __future__ statement when parsing python snippets.
Modified: doctools/trunk/sphinx/highlighting.py
==============================================================================
--- doctools/trunk/sphinx/highlighting.py (original)
+++ doctools/trunk/sphinx/highlighting.py Fri Aug 17 08:24:52 2007
@@ -63,7 +63,8 @@
else:
# maybe Python -- try parsing it
try:
- parser.suite(source + '\n')
+ parser.suite('from __future__ import with_statement\n' +
+ source + '\n')
except (SyntaxError, UnicodeEncodeError):
return '<pre>' + cgi.escape(source) + '</pre>\n'
else:
More information about the Python-checkins
mailing list