fix need for py import

--HG--
branch : trunk
This commit is contained in:
Benjamin Peterson 2009-08-29 14:16:54 -05:00
parent ee1747fcb4
commit 45a9aa536f
2 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import traceback
import atexit
import weakref
import __future__
import sys
# note that the whole code of this module (as well as some
# other modules) execute not only on the local side but
@ -23,6 +24,13 @@ if 'ThreadOut' not in globals():
from py.__.execnet.message import Message
ThreadOut = py._thread.ThreadOut
if sys.version_info > (3, 0):
exec """def do_exec(co, loc):
exec(co, loc)"""
else:
exec """def do_exec(co, loc):
exec co in loc"""
import os
debug = 0 # open('/tmp/execnet-debug-%d' % os.getpid() , 'wa')
@ -237,7 +245,7 @@ class Gateway(object):
try:
co = compile(source+'\n', '', 'exec',
__future__.CO_GENERATOR_ALLOWED)
py.test.exec_(co, loc)
do_exec(co, loc)
finally:
close()
self._trace("execution finished:", repr(source)[:50])

View File

@ -30,7 +30,7 @@ if sys.version_info > (3, 0):
exec(source, locs)""")
else:
exec("""def exec_(source, locs):
exec source, locs""")
exec source in locs""")
def exec_from_one_connection(serversock):
print_(progname, 'Entering Accept loop', serversock.getsockname())