Use 2/3 raise_() from future.utils
This commit is contained in:
parent
f10f4ddc98
commit
27549eca2e
2 changed files with 6 additions and 5 deletions
|
|
@ -64,6 +64,7 @@ example, you can have a 'On a boat' set, onto which you then tack on
|
|||
the 'Fishing' set. Fishing from a boat? No problem!
|
||||
"""
|
||||
from builtins import object
|
||||
from future.utils import raise_
|
||||
import sys
|
||||
from importlib import import_module
|
||||
from inspect import trace
|
||||
|
|
@ -137,7 +138,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
if len(trace()) > 2:
|
||||
# error in module, make sure to not hide it.
|
||||
exc = sys.exc_info()
|
||||
raise exc[1], None, exc[2]
|
||||
raise_(exc[1], None, exc[2])
|
||||
else:
|
||||
# try next suggested path
|
||||
errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
|
||||
|
|
@ -148,7 +149,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
if len(trace()) > 2:
|
||||
# Attribute error within module, don't hide it
|
||||
exc = sys.exc_info()
|
||||
raise exc[1], None, exc[2]
|
||||
raise_(exc[1], None, exc[2])
|
||||
else:
|
||||
errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ be of use when designing your own game.
|
|||
"""
|
||||
from __future__ import division, print_function
|
||||
from builtins import object, range
|
||||
from future.utils import viewkeys
|
||||
from future.utils import viewkeys, raise_
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -1129,7 +1129,7 @@ def class_from_module(path, defaultpaths=None):
|
|||
# this means the error happened within the called module and
|
||||
# we must not hide it.
|
||||
exc = sys.exc_info()
|
||||
raise exc[1], None, exc[2]
|
||||
raise_(exc[1], None, exc[2])
|
||||
else:
|
||||
# otherwise, try the next suggested path
|
||||
continue
|
||||
|
|
@ -1140,7 +1140,7 @@ def class_from_module(path, defaultpaths=None):
|
|||
if len(trace()) > 2:
|
||||
# AttributeError within the module, don't hide it
|
||||
exc = sys.exc_info()
|
||||
raise exc[1], None, exc[2]
|
||||
raise_(exc[1], None, exc[2])
|
||||
if not cls:
|
||||
err = "Could not load typeclass '%s'" % path
|
||||
if defaultpaths:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue