Opened 7 years ago

Closed 6 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


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)

fix-int_to_base36-division.patch (421 bytes) - added by adsworth 7 years ago.
16942-use-integer-divison.patch (417 bytes) - added by adsworth 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by adsworth

comment:1 Changed 7 years ago by Andreas Pelme

Needs tests: set
Triage Stage: UnreviewedAccepted

It is also possible to use the integer division operator //. This could need a test case, it would be easy to test it.

comment:2 Changed 7 years ago by anonymous

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.

comment:3 Changed 7 years ago by adsworth

The previous comment was from me. For some reason I wasn't logged in.

Changed 7 years ago by adsworth

comment:4 Changed 7 years ago by adsworth

Attached a new patch using integer division.

Does this really need a separate test case?

comment:5 Changed 6 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top