This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Using __(get|set|del)slice__ needs a Py3K warning
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: barry, benjamin.peterson, brett.cannon, georg.brandl
Priority: release blocker Keywords: needs review, patch

Created on 2008-03-17 19:25 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
slice_methods_py3kwarn.patch benjamin.peterson, 2008-03-22 02:40 warnings on slice methods
slice_methods_py3kwarn2.patch benjamin.peterson, 2008-05-27 01:31
slice_warnings.diff brett.cannon, 2008-08-24 00:28 reworked patch
Messages (7)
msg63721 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-17 19:25
Using any of the slicing methods (e.g., __getslice__) should raise a
Py3K warning.
msg64312 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-22 02:40
Here's a patch for that. It gives warnings on use of __getslice__,
__delslice__, and __setslice__ and includes tests.
But
it only works on new style classes. I don't think this is a big problem
because users will see the warnings when they switch their classes to
new-style.
msg67404 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-05-27 01:31
Here's a much better patch that does warn with old-style classes.
msg71822 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-08-24 00:28
I reviewed the patch and made some changes (which I uploaded). Mostly
changed the punctuation of the warning, made sure that PyErr_WarnPy3k()
was used for all cases, and simplified the code for the test.

Assigning to Benjamin for him to decide if he likes the changes to his
patch (which I probably should have done in Rietveld in hindsight =).
msg71823 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-24 01:00
Those changes are great; thanks for the review! Are you happy enough
with it to let me apply?
msg71847 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-08-24 18:01
On Sat, Aug 23, 2008 at 6:00 PM, Benjamin Peterson
<report@bugs.python.org> wrote:
>
> Benjamin Peterson <musiccomposition@gmail.com> added the comment:
>
> Those changes are great; thanks for the review! Are you happy enough
> with it to let me apply?
>

Yep.
msg71848 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-24 18:10
Ok. Applied in r66013.
History
Date User Action Args
2022-04-11 14:56:32adminsetnosy: + barry
github: 46604
2008-08-24 18:10:45benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg71848
2008-08-24 18:01:54brett.cannonsetmessages: + msg71847
2008-08-24 01:00:06benjamin.petersonsetmessages: + msg71823
2008-08-24 00:28:04brett.cannonsetfiles: + slice_warnings.diff
assignee: benjamin.peterson
type: behavior
messages: + msg71822
keywords: - 26backport
2008-08-21 20:33:03brett.cannonsetkeywords: + needs review
2008-08-21 18:34:39brett.cannonsetpriority: critical -> release blocker
2008-07-01 21:09:56georg.brandlsetassignee: georg.brandl -> (no value)
2008-05-27 01:31:52benjamin.petersonsetfiles: + slice_methods_py3kwarn2.patch
assignee: georg.brandl
messages: + msg67404
nosy: + georg.brandl
2008-03-22 02:40:02benjamin.petersonsetfiles: + slice_methods_py3kwarn.patch
keywords: + patch
messages: + msg64312
nosy: + benjamin.peterson
2008-03-17 20:14:40brett.cannonsetpriority: release blocker -> critical
2008-03-17 19:25:48brett.cannoncreate