Show More
@@ -142,6 +142,7 b' else:' | |||
|
142 | 142 | def doctest_refactor_print(func_or_str): |
|
143 | 143 | return func_or_str |
|
144 | 144 | |
|
145 | ||
|
145 | 146 | # Abstract u'abc' syntax: |
|
146 | 147 | @_modify_str_or_docstring |
|
147 | 148 | def u_format(s): |
@@ -149,3 +150,14 b' else:' | |||
|
149 | 150 | |
|
150 | 151 | Accepts a string or a function, so it can be used as a decorator.""" |
|
151 | 152 | return s.format(u='u') |
|
153 | ||
|
154 | def execfile(fname, glob, loc=None): | |
|
155 | loc = loc if (loc is not None) else glob | |
|
156 | scripttext = file(fname).read() | |
|
157 | #compile converts unicode filename to str assuming | |
|
158 | #ascii. Let's do the conversion before calling compile | |
|
159 | if isinstance(fname, unicode): | |
|
160 | filename = unicode_to_str(fname) | |
|
161 | else: | |
|
162 | filename = fname | |
|
163 | exec compile(scripttext, filename, 'exec') in glob, loc |
General Comments 0
You need to be logged in to leave comments.
Login now