AnonymouX47 / term-image

Display images in the terminal with python
https://term-image.readthedocs.io
MIT License
206 stars 9 forks source link

Initialize variables correctly in utils.py get_cell_size #104

Closed danschwarz closed 6 months ago

danschwarz commented 6 months ago

I am using term-image within toot

Without this PR applied, there are code paths through get_cell_size(...) that reference uninitialized variables.

AnonymouX47 commented 6 months ago

Hello!

Thanks for spotting this and the fix. Interestingly, I also just spotted and fixed it some days ago but the containing PR is yet to be merged. The linked commit also fixes another critical bug [^*] within the same function.

Ultimately, these bugs occurred and survived due to the lack of tests for utilities, which is among what #103 is intended to take care of. Even the "over-hyped" static typing which I just introduced in #100 was of no good in this case, or maybe it's just mypy.

Anyways, I'll go ahead and pull the commit referenced earlier, along with a couple other fixes into a branch off v0.7.0 and make a patch release from there.

Thanks so much. :bowing_man:

[^*]: Turns out the other bug was introduced after v0.7.0.

AnonymouX47 commented 6 months ago

Fixed and released in v0.7.1.

Kindly test with the new version and let me know the results.