Opened 13 years ago
Closed 12 years ago
#16942 closed Bug (fixed)
utils.htp.int_to_base36 explicit cast to int
Reported by: | adsworth | Owned by: | adsworth |
---|---|---|---|
Component: | Python 3 | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | adsworth | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
int_to_base36 uses the result of a division as an index into a string. In Python 3 division return a float not an int. So explicitly cast the result to an int.
Attachments (2)
Change History (7)
by , 13 years ago
Attachment: | fix-int_to_base36-division.patch added |
---|
comment:1 by , 13 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 13 years ago
I came across this because of the failing test: test_custom_email_subject (django.contrib.auth.tests.forms.PasswordResetFormTest)
This fails when run with Python3.
Do you still want a test case?
I'll add a patch using in the next couple of days.
by , 13 years ago
Attachment: | 16942-use-integer-divison.patch added |
---|
comment:4 by , 13 years ago
Attached a new patch using integer division.
Does this really need a separate test case?
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This was fixed in [699688dc2cfad627c5d400c6bdb681c81e932bc0].
It is also possible to use the integer division operator
//
. This could need a test case, it would be easy to test it.