diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-12-29 10:48:30 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-12-29 10:48:30 -0500 |
commit | a021fc8a1aac56aa4a75c68fee5c4cb6a0e68551 (patch) | |
tree | 17c55343825e8d1fc6ca7f6f2ac6d31dac62080c /bs4/formatter.py | |
parent | 2e943e6f963524567fc101713f7f16df1a0238f3 (diff) |
Fixed an unhandled exception when formatting a Tag that had been decomposed.[bug=1857767]
Diffstat (limited to 'bs4/formatter.py')
-rw-r--r-- | bs4/formatter.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bs4/formatter.py b/bs4/formatter.py index 09d15e7..9a692ec 100644 --- a/bs4/formatter.py +++ b/bs4/formatter.py @@ -108,6 +108,8 @@ class Formatter(EntitySubstitution): behavior consistent between Python 2 and Python 3, and preserves backwards compatibility with older versions of Beautiful Soup. """ + if tag.attrs is None: + return [] return sorted(tag.attrs.items()) |