Skip to content

Commit

Permalink
use 'exec' in py3-compatible manner
Browse files Browse the repository at this point in the history
per https://docs.python.org/2/reference/simple_stmts.html ,
as exec is a function not a statement in py3, the py2 version
has been set to allow the subsequent statement to be a tuple,
so we can invoke it like this to make it both py2 and py3
compatible. Without this, byte-compiling the file fails under
py3.
  • Loading branch information
AdamWill committed Jan 22, 2016
1 parent 593afef commit 5de1bb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mwclient/ex.py
Expand Up @@ -12,7 +12,7 @@ def read_config(config_files, **predata):

def _read_config_file(_config_file, predata):
_file = open(_config_file)
exec _file in globals(), predata
exec(_file, globals(), predata)
_file.close()

for _k, _v in predata.iteritems():
Expand Down

0 comments on commit 5de1bb8

Please sign in to comment.