﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17693	int_to_base36 may hang indefinitely when bad data is provided.	Keryn Knight <django@…>	nobody	"Technically, this is a (silly) user error, but it's not what I'd consider expected behaviour.

{{{
>>> from django.utils.http import int_to_base36
>>> int_to_base36(1)
'1'
>>> int_to_base36('1') # never returns.
File ""<stdin>"", line 1, in <module>
  File ""/path/to/django/utils/http.py"", line 159, in int_to_base36
    if i < 36 ** factor:
KeyboardInterrupt
>>>
}}}
A more extreme example:
{{{
>>> int_to_base36({1:2}) # hangs indefinitely.
>>> int_to_base36((4,5,6)) # same.
}}}

It would seem to me to be prudent to raise an exception (TypeError?) if the value can't reliably be used to cast to a base36 string. I came across this because I was accidently consuming an argument straight from the view, without first casting it. I'm also thinking it might be leaking memory, as both the terminal and runserver became very slow to react to KeyboardInterrupt signals.

I've marked it as a bug for 1.3, though to the best of my awareness, it exists in 1.2, and looking at the history for trunk, it doesn't seem likely to have been resolved there."	Bug	closed	Core (Other)	1.3	Normal	fixed			Unreviewed	0	0	0	0	1	0
