Reimplemented FunctionAlreadyExists and usage (Exceptions are not iterable in Python 3)
This commit is contained in:
parent
b8da3c7a73
commit
bd129baa0a
1 changed files with 4 additions and 2 deletions
|
|
@ -14,7 +14,9 @@ from . import shortnames as types
|
||||||
###
|
###
|
||||||
|
|
||||||
class FunctionAlreadyExists(NameError):
|
class FunctionAlreadyExists(NameError):
|
||||||
pass
|
|
||||||
|
def __init__(self, func):
|
||||||
|
self.func = func
|
||||||
|
|
||||||
def _is_int(ty):
|
def _is_int(ty):
|
||||||
return isinstance(ty, lc.IntegerType)
|
return isinstance(ty, lc.IntegerType)
|
||||||
|
|
@ -830,7 +832,7 @@ class CDefinition(object):
|
||||||
try:
|
try:
|
||||||
func = self.define(module)
|
func = self.define(module)
|
||||||
except FunctionAlreadyExists as e:
|
except FunctionAlreadyExists as e:
|
||||||
(func,) = e
|
func = e.func
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue