lxml.etree._Attrib doesn't inherit Mapping

Bug #1981760 reported by Pekka Klärck
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Low
scoder

Bug Description

We have code that operates with various collections and when working with dictionaries it checks is the object a dictionary with `isinstance(obj, Mapping)`. That works fine in general, including with the standard ElementTree, but fails with `lxml.etree._Attrib`. To reproduce:

>>> from collections.abc import Mapping
>>> from xml.etree.ElementTree import XML
>>> isinstance(XML('<x/>').attrib, Mapping)
True
>>> from lxml.etree import XML
>>> isinstance(XML('<x/>').attrib, Mapping)
False

Required version info:

Python : sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)
lxml.etree : (4, 9, 1, 0)
libxml used : (2, 9, 14)
libxml compiled : (2, 9, 14)
libxslt used : (1, 1, 35)
libxslt compiled : (1, 1, 35)

Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
importance: Undecided → Low
status: New → Fix Committed
milestone: none → 4.9.2
description: updated
scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.