We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a Griffe object has its lineno attribute set to None, rendering its source will fail.
lineno
None
Add a Griffe extension that adds a member, created manually (in the extension) without a lineno. Render it in the docs. Enable show_source: true.
show_source: true
File "/home/pawamoy/data/dev/qtile/.venv/lib/python3.12/site-packages/mkdocstrings_handlers/python/templates/material/_base/function.html", line 99, in block 'source' {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} ^^^^^^^^^^^^^^^^^ File "/home/pawamoy/data/dev/qtile/.venv/lib/python3.12/site-packages/mkdocstrings/handlers/rendering.py", line 120, in highlight result = super().highlight(src, language, inline=inline, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pawamoy/data/dev/qtile/.venv/lib/python3.12/site-packages/pymdownx/highlight.py", line 385, in highlight if not linenums or linestart < 1: ^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'NoneType' and 'int'
Rendering the source shouldn't make MkDocs crash, even if lineno is None.
python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard
PYTHONPATH
/home/pawamoy/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/pep582
mkdocs
mkdocstrings
mkdocstrings-python
griffe
/
The text was updated successfully, but these errors were encountered:
lines
fix: Don't crash when rendering the source of an object whose lineno …
64df00b
…is none Issue-163: #163
pawamoy
No branches or pull requests
Description of the bug
If a Griffe object has its
lineno
attribute set toNone
, rendering its source will fail.To Reproduce
Add a Griffe extension that adds a member, created manually (in the extension) without a
lineno
.Render it in the docs. Enable
show_source: true
.Full traceback
Full traceback
Expected behavior
Rendering the source shouldn't make MkDocs crash, even if
lineno
isNone
.Environment information
python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard
PYTHONPATH
:/home/pawamoy/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/pep582
mkdocs
v1.6.0mkdocstrings
v0.25.1mkdocstrings-python
v1.10.0.1.8.1griffe
v0.45.0Additional context
/
The text was updated successfully, but these errors were encountered: