Skip to content

Commit

Permalink
Fix crash when removing namespaces from attributes in xml_import:parse
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHammarstedt committed May 20, 2024
1 parent a039655 commit 9e3598b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Fixed Stanza which was broken for English.
- SweNER no longer hangs on (extremely) long tokens.
- Fixed config validation for `korp.context` and `korp.within`.
- Fixed crash when removing namespaces from attributes in `xml_import:parse`.

## [5.2.0] - 2023-12-07

Expand Down
2 changes: 1 addition & 1 deletion sparv/modules/xml_import/xml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def remove_namespaces(element: etree.Element):
uri, _ = get_namespace(element.tag)
if uri:
element.tag = element.tag[len("{" + uri + "}"):]
for k in element.attrib.keys():
for k in element.attrib.copy():
uri, _ = get_namespace(k)
if uri:
element.set(k[len("{" + uri + "}"):], element.attrib[k])
Expand Down

1 comment on commit 9e3598b

@ljo
Copy link
Member

@ljo ljo commented on 9e3598b May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tack, funkar!

Please sign in to comment.