New submission from Armin Rigo:

This triggers an assert() failure on debug-mode Python (or a leak in release 
Python):

from itertools import groupby

def f(n):
    print("enter:", n)
    if n == 5:
        list(b)
    print("leave:", n)
    return n != 6

for (k, b) in groupby(range(10), f):
    print(list(b))

With current trunk we get: python: ./Modules/itertoolsmodule.c:303: 
_grouper_next: Assertion `gbo->currkey == NULL' failed.

----------
components: Interpreter Core
messages: 293517
nosy: arigo
priority: normal
severity: normal
status: open
title: itertools.groupby() can fail a C assert()
type: crash
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30347>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to