Opened 11 years ago

Closed 11 years ago

Last modified 7 years ago

#20094 closed Bug (fixed)

Models with `next` method on python 2.6

Reported by: Marc Tamlyn Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords:
Cc: Claude Paroz Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've identified a problem with the following commit https://github.com/django/django/commit/df7a65ac4ba36dd155e80b8bcfe607390976ad47

The behaviour of isinstance(foo, collections.Iterable) is different between python 2.6 and python 2.7/3.X

This gist https://gist.github.com/mjtamlyn/5203598 will demonstrate the problem

The end result is that any model which defines a next method fails on python 2.6/django1.5 when used in a foreign key, as it has a next method but is not iterable.

Change History (5)

comment:1 by Claude Paroz, 11 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 829dc3c5a64d3fa203b8cc0055e83cf23addfee3:

Fixed #20094 - Be more careful when checking for Iterator

Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).

comment:4 by Claude Paroz <claude@…>, 11 years ago

In dd897e4eeb20cab9ac708c46f34c5f09758205c8:

[1.5.x] Fixed #20094 - Be more careful when checking for Iterator

Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).
Backport of 829dc3c5 from master.

comment:5 by GitHub <noreply@…>, 7 years ago

In 309c10c:

Refs #20094 -- Removed obsolete tests/utils_tests/test_itercompat.py

The is_iterator() function was removed in 2456ffa42c33d63b54579eae0f5b9cf2a8cd3714.

Note: See TracTickets for help on using tickets.
Back to Top