Commit aadb5251 authored by Denis Bilenko's avatar Denis Bilenko

Fix #302: "python -m gevent.monkey" sets __file__

Thanks to frostedcheerios.
parent 08096356
......@@ -244,6 +244,7 @@ MONKEY OPTIONS: --verbose %s""" % ', '.join('--[no-]%s' % m for m in modules)
if argv:
sys.argv = argv
__package__ = None
globals()['__file__'] = sys.argv[0] # issue #302
execfile(sys.argv[0])
else:
print (script_help)
import sys
if 'gevent' not in sys.modules:
from subprocess import Popen, PIPE
args = [sys.executable, '-m', 'gevent.monkey', __file__]
p = Popen(args)
code = p.wait()
assert code == 0, code
else:
import socket
assert 'gevent' in repr(socket.socket), repr(socket.socket)
assert __file__ == 'test__issue302monkey.py', repr(__file__)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment