[New-bugs-announce] [issue30347] itertools.groupby() can fail a C assert()

Armin Rigo report at bugs.python.org
Thu May 11 17:10:21 EDT 2017

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:
    print("leave:", n)
    return n != 6

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

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list