[Django] #23140: page_range TypeError: sequence index must be integer, not 'slice'

13 views
Skip to first unread message

Django

unread,
Jul 31, 2014, 11:54:59 PM7/31/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
--------------------------------+----------------------
Reporter: CollinAnderson | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-rc-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+----------------------
For years I've running `page.paginator.page_range[:]` to make a copy of
page_range. After #23088, I'm getting the error above. It might just be
I'm the only one who's doing this, and should instead just call
`list(page.paginator.page_range)`, though it seems to me we list this in
backwards incompatibilities and/or defer until 1.8.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 1, 2014, 3:40:05 AM8/1/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-rc-2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Keryn Knight <django@…>):

* needs_better_patch: => 0
* needs_docs: => 0
* severity: Normal => Release blocker
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

As the instigator of this, given this has technically broken public API by
changing the return type in a somewhat incompatible way (who knew that the
`range`/`xrange` classes don't support slicing!), I'm marking this as
accepted and a release blocker, so at least attention is given to it, and
a decision may be made before 1.7 final lands.

Should the decision fall on the side of keeping the efficient iterator (at
any time, even if postponed), it absolutely ought to end up in the
backwards incompatibilities list because it doesn't quack like the same
duck as one might be expecting.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:1>

Django

unread,
Aug 1, 2014, 10:16:02 AM8/1/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-rc-2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"ee0208108bd66cec04b28aca76eb506d9a2e1fd3"]:
{{{
#!CommitTicketReference repository=""
revision="ee0208108bd66cec04b28aca76eb506d9a2e1fd3"
Revert "[1.7.x] Fixed #23088 -- Used `six` `range` type in
`Paginator.page_range`."

This reverts commit ce95ab8f025cc9f35990f0c2d9a290eec1ece753.

It caused some backwards compatibility concerns (refs #23140).
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:2>

Django

unread,
Aug 1, 2014, 10:17:39 AM8/1/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: master

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timo):

* type: Uncategorized => Bug
* version: 1.7-rc-2 => master
* component: Uncategorized => Core (Other)


Comment:

I've reverted the change on the 1.7 branch for now and changed this to a
release blocker for master.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:3>

Django

unread,
Aug 1, 2014, 10:27:09 AM8/1/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by CollinAnderson):

You rock, Timo.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:4>

Django

unread,
Aug 1, 2014, 11:10:00 AM8/1/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by CollinAnderson):

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:5>

Django

unread,
Aug 3, 2014, 1:24:57 PM8/3/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by timo):

If we leave this in, there is also a documentation update needed as noted
in #23158.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:6>

Django

unread,
Aug 3, 2014, 1:31:46 PM8/3/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by merb):

btw.
https://github.com/django/django/commit/6508db2ff9fc5be95fec903b3fa7ab8204fe316a
isn't reverted on the master branch so we should either revert it or
update the ticket as closed and merge the documentation change.

Still that would be strange due to the fact that Django 1.7 wouldn't
behave as Django 1.8 without any depraction

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:7>

Django

unread,
Aug 3, 2014, 3:13:20 PM8/3/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: closed

Component: Core (Other) | Version: master
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by apollo13):

* status: new => closed
* resolution: => fixed


Comment:

Consistency is now restored on master and 1.7 with
2d542bf60cc37c59872c5a20d6af3bf826038739 and
1cb919e408d943cf2fadebb2b12517f523feb718 respectively. Closing this for
now as the issue should no longer appear.

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:8>

Django

unread,
Aug 4, 2014, 2:35:55 PM8/4/14
to django-...@googlegroups.com
#23140: page_range TypeError: sequence index must be integer, not 'slice'
---------------------------------+------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: closed
Component: Core (Other) | Version: master
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by CollinAnderson):

this ticket is fixed for 1.7, so here's a new ticket for converting to an
iterator in 1.8 #23190

--
Ticket URL: <https://code.djangoproject.com/ticket/23140#comment:9>

Reply all
Reply to author
Forward
0 new messages