[New-bugs-announce] [issue7414] Format code "C" is missing from skipitem() in getargs.c

Case Van Horsen report at bugs.python.org
Tue Dec 1 06:08:36 CET 2009

New submission from Case Van Horsen <casevh at gmail.com>:

An error was reported on c.l.py. The following code in a Python 3
extension module generated an error:

If I use the following C code

static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
  char a, b;
  char *kwlist[] = {"a", "b", NULL};
  if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
    return NULL;

then the following works:

>>> foo('a')
>>> foo('a','b')
>>> foo(a='a',b='b')

but the following fails:
>>> foo(b='b')

RuntimeError: impossible<bad format char>: 'CC'


I traced it down to missing case statement for "C" in skipitem() in
getargs.c. The attached patch seems to fix the issue.

components: Extension Modules
files: getargs.patch
keywords: patch
messages: 95846
nosy: casevh
severity: normal
status: open
title: Format code "C" is missing from skipitem() in getargs.c
versions: Python 3.1
Added file: http://bugs.python.org/file15421/getargs.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list