[Python-Dev] hasattr() and Unicode strings

M.-A. Lemburg mal@lemburg.com
Fri, 08 Sep 2000 14:02:46 +0200

"Fred L. Drake, Jr." wrote:
> Andrew Kuchling writes:
>  > Is this a bug or a feature?  I'd say bug; the Unicode should be
>  > coerced using the default ASCII encoding, and an exception raised if
>  > that isn't possible.
>   I agree.
>   Marc-Andre, what do you think?

Sounds ok to me.

The only question is where to apply the patch:
1. in hasattr()
2. in PyObject_GetAttr()

I'd opt for using the second solution (it should allow string
and Unicode objects as attribute name). hasattr() would then
have to be changed to use the "O" parser marker.

What do you think ?

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/