This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Allow PyArg_ParseTupleAndKeywords to unpack tuples
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: loewis, rupole
Priority: normal Keywords: patch

Created on 2006-04-21 22:10 by rupole, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getargs.patch rupole, 2006-04-21 22:10 Patch for getargs.c
getargs_1.patch rupole, 2006-04-22 19:31 Handle nested tuples
Messages (5)
msg50090 - (view) Author: Roger Upole (rupole) Date: 2006-04-21 22:10
PyArg_ParseTuple will unpack tuples using a format 
string like "i(ii)i", but this is currently disallowed 
when using keywords.  This allows 
PyArg_ParseTupleAndKeywords to behave in the same way.
Diff was done against 2.4.3 release, but code works 
equally well with 2.3.5.
msg50091 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-22 13:13
Logged In: YES 
user_id=21627

The patch is wrong: It uses strchr to find a "matching"
paren; this does not take into account nested tuples.
msg50092 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-22 13:14
Logged In: YES 
user_id=21627

(Didn't mean to reject it yet)
msg50093 - (view) Author: Roger Upole (rupole) Date: 2006-04-22 19:31
Logged In: YES 
user_id=771074

Attaching patch that handles nested tuples.

However, another option would be to remove all the pre-
validation and just let the conversion functions return any 
format errors.  The max nbr of args could be determined 
from the keyword list instead of the format string, and 
avoid some duplicated logic.
The logic for checking optional args would also need to be
moved, but this could allow a fix for the bad error msg 
that's sometimes thrown.

msg68259 - (view) Author: Roger Upole (rupole) Date: 2008-06-16 03:01
This functionality is subsumed in patch 1691070 (which has since
been applied), so this can be closed.
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43259
2008-06-16 05:00:10loewissetstatus: open -> closed
resolution: out of date
2008-06-16 03:01:20rupolesetmessages: + msg68259
2006-04-21 22:10:57rupolecreate