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)

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

Download all attachments as: .zip

Change History (7)

by adsworth, 13 years ago

comment:1 by Andreas Pelme, 13 years ago

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 by anonymous, 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.

comment:3 by adsworth, 13 years ago

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

by adsworth, 13 years ago

comment:4 by adsworth, 13 years ago

Attached a new patch using integer division.

Does this really need a separate test case?

comment:5 by Aymeric Augustin, 12 years ago

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