mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
This commit is contained in:
parent
60d241f135
commit
3172c5d263
77 changed files with 171 additions and 217 deletions
|
@ -121,9 +121,9 @@ class Timer:
|
|||
"""Constructor. See class doc string."""
|
||||
self.timer = timer
|
||||
ns = {}
|
||||
if isinstance(stmt, basestring):
|
||||
if isinstance(stmt, str):
|
||||
stmt = reindent(stmt, 8)
|
||||
if isinstance(setup, basestring):
|
||||
if isinstance(setup, str):
|
||||
setup = reindent(setup, 4)
|
||||
src = template % {'stmt': stmt, 'setup': setup}
|
||||
elif hasattr(setup, '__call__'):
|
||||
|
@ -137,7 +137,7 @@ class Timer:
|
|||
self.inner = ns["inner"]
|
||||
elif hasattr(stmt, '__call__'):
|
||||
self.src = None
|
||||
if isinstance(setup, basestring):
|
||||
if isinstance(setup, str):
|
||||
_setup = setup
|
||||
def setup():
|
||||
exec(_setup, globals(), ns)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue