Skip to content
New issue

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

[BUG] tuple[int, int] | None causes IndexError, but Optional[tuple[int, int]] does not #117

Closed
bczsalba opened this issue Aug 11, 2022 · 2 comments

Comments

@bczsalba
Copy link

Describe the bug
When trying to run mkdocs serve on PyTermGUI, pytermgui/ansi_interface fails to be parsed due to an IndexError.

To Reproduce
Steps to reproduce the behavior:

  1. Clone PyTermGUI and checkout new-docs
  2. Run mkdocs serve in the git root
  3. See error

Expected behavior
Things should be parsed.

Screenshots

Everything above this was Jinja template stuff, so probably not very relevant.

Screenshot 2022-08-12 at 1 04 20

System (please complete the following information):

  • pytkdocs version: Not installed when the error first occured, still happens after installing 0.16.1.
  • Python version: 3.9
  • OS: MacOS

Additional context
I initially wanted to submit this issue over at griffe, but it turned out that it could parse the module no problem. Then I looked at mkdocstrings, and was redirected over to here. Note that pytkdocs wasn't installed by PIP when this started happening, and installing it didn't do much in terms of fixing the problem.

After messing around with the griffe source for a bit, I managed to narrow it down to this return annotation:

https://github.com/bczsalba/pytermgui/blob/06f2ec78d1b31d2a059035e72e8d1b014c929b81/pytermgui/ansi_interface.py#L156

After changing it to Optional[tuple[int, int]], the error goes away.

No idea if I'm in the right place or not, or if the issue is completely up to me 🙂. I did look around for similar issues, but the one related post I found (#140) wasn't really what I was experiencing.

@bczsalba bczsalba changed the title [BUG] tuple[int, int] | None causes IndexError, but Optional[tuple[int, int]] does not [BUG] tuple[int, int] | None causes IndexError, but Optional[tuple[int, int]] does not Aug 11, 2022
@pawamoy
Copy link
Member

pawamoy commented Nov 22, 2022

Hi @bczsalba, sorry for the late reply, and thanks for the report.
This is definitely an issue in Griffe and not pytkdocs, so I'll move it over there 🙂

@pawamoy pawamoy transferred this issue from mkdocstrings/pytkdocs Nov 22, 2022
@pawamoy
Copy link
Member

pawamoy commented Nov 30, 2022

Fixed in 727456d, will try to release soon.

@pawamoy pawamoy closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants