##// END OF EJS Templates
Quick fix for #1688, traceback-unicode issue...
Quick fix for #1688, traceback-unicode issue By importing unicode_literals from __future__ and casting to unicode at two locations a simple case now works. However I have not audited the code to find other locations where casts may be necessary. No new failures were noted when running the testsuite.

File last commit:

r5882:fd2691c8
r8299:660787db
Show More
pyfile.py
23 lines | 840 B | text/x-python | PythonLexer
Thomas Kluyver
Find .py files for verbose tracebacks, rather than trying to tokenize .pyc files.
r5851 """Utilities for working with Python source files.
Exposes various functions from recent Python standard libraries, along with
equivalents for older Python versions.
"""
import os.path
try: # Python 3.2
from imp import source_from_cache, cache_from_source
except ImportError:
# Python <= 3.1: .pyc files go next to .py
def source_from_cache(path):
basename, ext = os.path.splitext(path)
Thomas
Fix syntax for Python 2.6 - no set literals.
r5882 if ext not in ('.pyc', '.pyo'):
Thomas Kluyver
Find .py files for verbose tracebacks, rather than trying to tokenize .pyc files.
r5851 raise ValueError('Not a cached Python file extension', ext)
# Should we look for .pyw files?
return basename + '.py'
def cache_from_source(path, debug_override=None):
if debug_override is None:
debug_override = __debug__
basename, ext = os.path.splitext(path)
return basename + '.pyc' if debug_override else '.pyo'