Typping issue with Python 3.10 syntax

Bug #2079018 reported by Stéphane Brunner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

When I run:
```
from lxml import etree

a: etree.Element | None=None
```
I get:
```
TypeError: unsupported operand type(s) for |: '_cython_3_0_11.cython_function_or_method' and 'NoneType'
```

System information:
```
>>> print("%-20s: %s" % ('Python', sys.version_info))
Python : sys.version_info(major=3, minor=10, micro=14, releaselevel='final', serial=0)
>>> print("%-20s: %s" % ('lxml.etree', etree.LXML_VERSION))
lxml.etree : (5, 3, 0, 0)
>>> print("%-20s: %s" % ('libxml used', etree.LIBXML_VERSION))
libxml used : (2, 12, 9)
>>> print("%-20s: %s" % ('libxml compiled', etree.LIBXML_COMPILED_VERSION))
libxml compiled : (2, 12, 9)
>>> print("%-20s: %s" % ('libxslt used', etree.LIBXSLT_VERSION))
libxslt used : (1, 1, 42)
>>> print("%-20s: %s" % ('libxslt compiled', etree.LIBXSLT_COMPILED_VERSION))
libxslt compiled : (1, 1, 42)
```

Revision history for this message
scoder (scoder) wrote :

This is one of the things that https://github.com/lxml/lxml/pull/405 might solve.

Revision history for this message
Stéphane Brunner (stephane-brunner) wrote :

Hello,

Effectively, I confirm that is fixing my issue :-)

CU
Stéphane

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.