Running the test suite on Python 2.3, I get a test failure in the queries regression test:
D:\u\kmt\django\trunk\tests>d:\bin\Python2.3.5\python.exe runtests.py --settings=testsettings queries
======================================================================
FAIL: Doctest: regressiontests.queries.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
File "d:\u\kmt\django\trunk\django\test\_doctest.py", line 2180, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.queries.models.__test__.API_TESTS
File "D:\u\kmt\django\trunk\tests\regressiontests\queries\models.py", line unknown line number, in API_TESTS
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\regressiontests\queries\models.py", line ?, in regressiontests.queries.models.__test__.API_TESTS
Failed example:
LoopX.objects.all()
Expected:
Traceback (most recent call last):
...
FieldError: Infinite loop caused by ordering.
Got:
[]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\regressiontests\queries\models.py", line ?, in regressiontests.queries.models.__test__.API_TESTS
Failed example:
LoopZ.objects.all()
Expected:
Traceback (most recent call last):
...
FieldError: Infinite loop caused by ordering.
Got:
[]
----------------------------------------------------------------------
Ran 1 test in 0.591s
FAILED (failures=1)
I believe it's caused by this Python bug: http://bugs.python.org/issue1242657 which caused exceptions raised by __len__ to be silently swallowed. A traceback from when the exception is successfully raised:
>>> LoopX.objects.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "d:\u\kmt\django\trunk\django\db\models\query.py", line 143, in __repr__
return repr(list(self))
File "d:\u\kmt\django\trunk\django\db\models\query.py", line 155, in __len__
self._result_cache.extend(list(self._iter))
File "d:\u\kmt\django\trunk\django\db\models\query.py", line 268, in iterator
for row in self.query.results_iter():
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 204, in results_iter
for rows in self.execute_sql(MULTI):
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 1598, in execute_sql
sql, params = self.as_sql()
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 251, in as_sql
ordering = self.get_ordering()
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 610, in get_ordering
self.model._meta, default_order=asc):
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 663, in find_ordering_name
order, already_seen))
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 663, in find_ordering_name
order, already_seen))
File "d:\u\kmt\django\trunk\django\db\models\sql\query.py", line 657, in find_ordering_name
raise FieldError('Infinite loop caused by ordering.')
FieldError: Infinite loop caused by ordering.
shows how __len__ swallowing exceptions would cause this test failure.
Don't know that it is worth fixing (apparently you'll just get empty lists instead of exceptions in cases where this is hit) but figured it was at least worth reporting in case anyone else runs across it. (I didn't find any likely match in my tracker search.)