use contextlib.suppress

This commit is contained in:
Batuhan Taskaya 2020-05-17 01:56:05 +03:00
parent 8cdb0c4730
commit 78f11ea398
1 changed files with 3 additions and 3 deletions

View File

@ -10,6 +10,8 @@ how this parsing engine works.
"""
import contextlib
# Local imports
from . import token
@ -201,7 +203,5 @@ class Parser(object):
node[-1].append(newnode)
else:
self.rootnode = newnode
try:
with contextlib.suppress(AttributeError):
self.rootnode.used_names = self.used_names
except AttributeError:
pass # skip if an attribute can't be assigned