'{}' matches nonempty namespaces in objectify

Bug #1402433 reported by KT on 2014-12-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Empty namespace acts as a wildcard when using numbered indices. Both lookup and assignment are affected.


    <aaa:Parent xmlns:aaa="urn:aaa" xmlns:bbb="urn:bbb">



Expected result:

    IndexError: 1

Actual result:


Python : (2, 7, 6, 0)
lxml.etree : (3, 4, 1, 0)
libxml used : (2, 9, 0)
libxml compiled : (2, 9, 0)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)

scoder (scoder) wrote :

Yes, looks wrong. Would be a regression, though - it was supposed to be fixed in 2.3.



Changed in lxml:
importance: Undecided → Medium
status: New → Triaged
KT (bintoro) wrote :

It's a different scenario. The case addressed by the 2.3 fix still works:

  <aaa:Parent xmlns:aaa="urn:aaa" xmlns:bbb="urn:bbb">

  >>> root['{}Child']

This bug is about '{}' matching *too many things* (i.e., all namespaces) when using the numeric index notation. The bug reported in the newsgroup thread was about '{}' forcing the parent namespace and matching that only.

Compare the above result with this:

  >>> root['{}Child'][0]

Of course, index 0 should return 'foox' just like when the index is omitted.

By contrast, bug 1402432 (now marked as a dupe) was indeed the __setitem__ parallel of the old bug (forcing the parent namespace). Because of that I reported these two separately, not knowing whether these share the same root cause.

scoder (scoder) on 2017-08-13
Changed in lxml:
status: Triaged → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers