[Patches] [ python-Patches-1474454 ] Allow PyArg_ParseTupleAndKeywords to unpack tuples
SourceForge.net
noreply at sourceforge.net
Sat Apr 22 21:31:53 CEST 2006
Patches item #1474454, was opened at 2006-04-21 17:10
Message generated for change (Comment added) made by rupole
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1474454&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Roger Upole (rupole)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow PyArg_ParseTupleAndKeywords to unpack tuples
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Roger Upole (rupole)
Date: 2006-04-22 14:31
Message:
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.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-04-22 08:14
Message:
Logged In: YES
user_id=21627
(Didn't mean to reject it yet)
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-04-22 08:13
Message:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1474454&group_id=5470
More information about the Patches
mailing list