classification
Title: Format code "C" is missing from skipitem() in getargs.c
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: casevh, mark.dickinson
Priority: normal Keywords: patch

Created on 2009-12-01 05:08 by casevh, last changed 2009-12-03 11:02 by mark.dickinson. This issue is now closed.

Files
File name Uploaded Description Edit
getargs.patch casevh, 2009-12-01 05:08 Add "C" to skipitem() in getargs.c
Messages (2)
msg95846 - (view) Author: Case Van Horsen (casevh) Date: 2009-12-01 05:08
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,
&b))
    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.
msg95925 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-03 11:02
Thanks!  Fixed in r76646 (py3k) and r76647 (release31-maint).
History
Date User Action Args
2009-12-03 11:02:27mark.dickinsonsetstatus: open -> closed

type: behavior
versions: + Python 3.2
nosy: + mark.dickinson

messages: + msg95925
resolution: fixed
stage: resolved
2009-12-01 05:08:35casevhcreate