Message11041

Author stefan.richthofer
Recipients progval, stefan.richthofer
Date 2017-01-28.16:42:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485621777.16.0.999137891896.issue2511@psf.upfronthosting.co.za>
In-reply-to
Content
This one boils down to the following code snippet in PyString.java:

// Not a tuple, but possibly still some kind of container: use special argIndex values.
            argIndex = -1;
            if (args instanceof AbstractDict
                    || (!(args instanceof PySequence) && args.__findattr__("__getitem__") != null)) {
                dict = args;
                argIndex = -3;
            }

Here

args.__findattr__("__getitem__")

is used for mapping-detection. A possible solution would be to change it into

args.object___findattr__("__getitem__")

I don't think this fix would break anything. Overriding __getattr__ to sneak in a custom __getitem__ sounds insane. And it doesn't look like CPython would fall for this kind of manipulation in %-string-format-sense.

This fix also passes regrtests. So far it looks good to me. Opinions?
History
Date User Action Args
2017-01-28 16:42:57stefan.richthofersetmessageid: <1485621777.16.0.999137891896.issue2511@psf.upfronthosting.co.za>
2017-01-28 16:42:57stefan.richthofersetrecipients: + stefan.richthofer, progval
2017-01-28 16:42:57stefan.richthoferlinkissue2511 messages
2017-01-28 16:42:56stefan.richthofercreate