[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-27 Thread Ronny Pfannschmidt

New submission from Ronny Pfannschmidt :

the problem manifests when calling with negative counts

when the c versions are used, a empty list is returned,
however if the pure python version is called islice errors out

--
components: Library (Lib)
messages: 146483
nosy: Ronny.Pfannschmidt
priority: normal
severity: normal
status: open
title: heapq pure python version uses islice without guarding for negative 
counts
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-27 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
nosy: +petri.lehtinen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-27 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-27 Thread Éric Araujo

Changes by Éric Araujo :


--
stage:  -> test needed
versions:  -Python 2.6, Python 3.1, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

The behavior is undefined for negative inputs, so implementations are free to 
the most expedient choices.

--
priority: normal -> low

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-29 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

however some basic consistency between the cpython and pure python versions 
within the stdlib would be nice

since it basically implicitly breaks unaware code on non cpython

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-29 Thread Alex Gaynor

Changes by Alex Gaynor :


--
nosy: +alex

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-29 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-30 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 57f73b0f921c by Raymond Hettinger in branch '2.7':
Issue 13274:  Make the pure python code for heapq more closely match the C 
implementation for an undefined corner case.
http://hg.python.org/cpython/rev/57f73b0f921c

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-30 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 155e57a449b5 by Raymond Hettinger in branch '3.2':
Issue 13274:  Make the pure python code for heapq more closely match the C 
implementation for an undefined corner case.
http://hg.python.org/cpython/rev/155e57a449b5

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13274] heapq pure python version uses islice without guarding for negative counts

2011-10-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I went ahead an added the guards to the pure python code.

Still disagree with your assertion that non-cpython implementations were 
somehow broken when an undefined behavior was implemented in a different way -- 
nsmallest() and nlargest() have no guaranteed meaning for negative numbers.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com