[Python-bugs-list] [ python-Bugs-635969 ] No error "not all arguments converted"
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 11 Nov 2002 02:29:26 -0800
Bugs item #635969, was opened at 2002-11-09 17:53
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=635969&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin v. Löwis (loewis)
>Assigned to: Neal Norwitz (nnorwitz)
>Summary: No error "not all arguments converted"
Initial Comment:
The expression
r'.po$' % "hallo"
used to give an error, but now succeeds and gives the
string '.po'. I think producing the error should be
restored.
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2002-11-11 10:29
Message:
Logged In: YES
user_id=6656
You're right. Please do add a test! Also note that
unicode's are mappings too.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-10 16:35
Message:
Logged In: YES
user_id=33168
The problem is that string is a mapping (also changed in
2.166). The patch below fixes the problem. Michael, do you
have any problem with this change? If not, I'll check it in
with a test (unless you beat me to it).
- if (args->ob_type->tp_as_mapping && !PyTuple_Check(args))
+ if (args->ob_type->tp_as_mapping && !PyTuple_Check(args)
&& !PyString_Check(args))
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-10 15:49
Message:
Logged In: YES
user_id=33168
Let me try that again: r'.po$' % ("hallo",)
The line was changed in rev 2.166 by mwh for extended slicing.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-10 15:45
Message:
Logged In: YES
user_id=33168
I'm pretty sure this change (between 2.2.2 and 2.3) in
stringobject.c is the problem:
@@ -3320,7 +3623,7 @@
arglen = -1;
argidx = -2;
}
- if (args->ob_type->tp_as_mapping)
+ if (args->ob_type->tp_as_mapping &&
!PyTuple_Check(args))
dict = args;
Now for non-tuples, dict is set. dict is used later on to
determine if an exception should be set.
This still works, ie produces the exception: (r'.po$' %
"hallo",)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=635969&group_id=5470