python 3.10 does stricter type checking

Bug #2004098 reported by Rolf Leggewie
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
anki (Debian)
New
Unknown
anki (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Confirmed
Undecided
Unassigned
Kinetic
Won't Fix
Undecided
Unassigned

Bug Description

[Impact]

python 3.10 does stricter type checking and hence anki fails in some cases, for example it is no longer possible to access the preferences of a deck.

[steps to reproduce]
- install and start anki
- choose a deck and click on the gearwheel icon to choose options
- anki crashes with a type error

[regression potential]

Currently, the program crashes for the code-paths in question. The receiving functions expect to be handed an int and casting the parameters of the function calls to int ensures the correct type.

int does not round but truncates towards zero. There is a possibility that the program was written with the assumption that non-int values would be rounded to the nearest integer. It is my understanding that lrnFactor, easyBonus, lapMult and lrnCutoff are numbers to determine how soon flash cards will be shown again for learning. The impact from any "bug" in determining this should be fairly insignificant.

Code inspection was only cursory, though.

[further information]

https://forums.ankiweb.net/t/selecting-options-or-preferences-throws-an-error/24509
https://forums.ankiweb.net/t/cant-open-settings/16644
https://www.reddit.com/r/Anki/comments/wvuc3w/trying_to_go_into_preferences_and_it_gives_me_this/

I have provided a bug-fixed package for jammy in my stable PPA, the package should be usable in later releases, too.

Rolf Leggewie (r0lf)
description: updated
Revision history for this message
Rolf Leggewie (r0lf) wrote :
Rolf Leggewie (r0lf)
description: updated
Revision history for this message
Simon Quigley (tsimonq2) wrote :

Hi Rolf! Thanks for taking the time to submit a patch for this.

Usually, if the package is in Debian Testing I like to see uploads there first. That being said, this package is not in Testing and it fixes a bug that crashes Anki otherwise, so I won't hesitate to upload this.

Please try to coordinate a fix in Debian, if possible.

Another thing I'll note is that we're working on landing Python 3.11 as the default for Lunar. Will this package require additional fixes for that transition?

Thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package anki - 2.1.15+dfsg-3ubuntu1

---------------
anki (2.1.15+dfsg-3ubuntu1) lunar; urgency=medium

  * cast to int to fix problem with python 3.10 being stricter (LP: #2004098)

 -- Rolf Leggewie <email address hidden> Sat, 28 Jan 2023 21:22:07 +0100

Changed in anki (Ubuntu):
status: New → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote :
description: updated
Revision history for this message
Rolf Leggewie (r0lf) wrote :
Changed in anki (Debian):
status: Unknown → New
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Ubuntu 22.10 (Kinetic Kudu) has reached end of life, so this bug will not be fixed for that specific release.

Changed in anki (Ubuntu Kinetic):
status: New → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anki (Ubuntu Jammy):
status: New → Confirmed
Revision history for this message
Alexander Jones (happy5214) wrote :

Please backport this fix to Jammy. The Anki package is effectively unusable on that LTS version because of this bug.

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.