You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Partly done in 0.6.1 by #73, which took the part that was actually wrong:
the package now ships the PEP 561 py.typed marker, without which type
checkers ignored its hints once installed, whatever the source said
the hints that were lying are fixed. _do_classdesc() and _read_content() are declared optional, which is what they return on TC_NULL, and writing that down showed 4 places using the result without
checking it: reading an object, a class or an array with a null class
description crashed on a missing attribute, and now reports a clear ValueError. IJavaStreamParser._read_content() had no body at all and
returned None instead of raising NotImplementedError like its
neighbours
mypy runs in the CI (types job), configured in pyproject.toml, and
is green over the 25 modules
What is left is the bulk of it: about 160 functions still have no hints,
mostly in the beans, transformers and unmarshaller of v1 and v2.
Module
Functions
v2/transformers.py
29
v2/beans.py
27
v1/transformers.py
26
v1/unmarshaller.py
21
v1/beans.py
20
v1/marshaller.py
18
modifiedutf8.py
7
They have to stay comments, since v1 and v2 must keep importing on Python
2.7, and each one makes mypy check the body of its function, which surfaces
more work in turn. Better done module by module than in a release fixing
four parser bugs, so this stays open for 0.7. check_untyped_defs and disallow_untyped_defs are set to false in [tool.mypy] on purpose:
turning them on is the measure of that progress.
Activity
First pass on type hints + some fixes
tcalmant commentedon Aug 12, 2026
Partly done in 0.6.1 by #73, which took the part that was actually wrong:
py.typedmarker, without which typecheckers ignored its hints once installed, whatever the source said
_do_classdesc()and_read_content()are declared optional, which is what they return onTC_NULL, and writing that down showed 4 places using the result withoutchecking it: reading an object, a class or an array with a null class
description crashed on a missing attribute, and now reports a clear
ValueError.IJavaStreamParser._read_content()had no body at all andreturned
Noneinstead of raisingNotImplementedErrorlike itsneighbours
mypyruns in the CI (typesjob), configured inpyproject.toml, andis green over the 25 modules
What is left is the bulk of it: about 160 functions still have no hints,
mostly in the beans, transformers and unmarshaller of v1 and v2.
v2/transformers.pyv2/beans.pyv1/transformers.pyv1/unmarshaller.pyv1/beans.pyv1/marshaller.pymodifiedutf8.pyThey have to stay comments, since v1 and v2 must keep importing on Python
2.7, and each one makes mypy check the body of its function, which surfaces
more work in turn. Better done module by module than in a release fixing
four parser bugs, so this stays open for 0.7.
check_untyped_defsanddisallow_untyped_defsare set tofalsein[tool.mypy]on purpose:turning them on is the measure of that progress.