use contextlib.suppress
This commit is contained in:
parent
8cdb0c4730
commit
78f11ea398
|
@ -10,6 +10,8 @@ how this parsing engine works.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import contextlib
|
||||||
|
|
||||||
# Local imports
|
# Local imports
|
||||||
from . import token
|
from . import token
|
||||||
|
|
||||||
|
@ -201,7 +203,5 @@ class Parser(object):
|
||||||
node[-1].append(newnode)
|
node[-1].append(newnode)
|
||||||
else:
|
else:
|
||||||
self.rootnode = newnode
|
self.rootnode = newnode
|
||||||
try:
|
with contextlib.suppress(AttributeError):
|
||||||
self.rootnode.used_names = self.used_names
|
self.rootnode.used_names = self.used_names
|
||||||
except AttributeError:
|
|
||||||
pass # skip if an attribute can't be assigned
|
|
||||||
|
|
Loading…
Reference in New Issue