[Python-3000-checkins] r55551 - python/branches/py3k-struni/Lib/test/test_funcattrs.py

Walter Dörwald walter at livinglogic.de
Thu May 24 22:44:15 CEST 2007


Guido van Rossum wrote:
> No, don't revert the patch; but you could try to think of a cheap way
> to get the code attributes that are always strings to be unicode
> objects.

I've never touched Python/compile.c or any related files before, but I 
can give it a try (by blindly changing anything string related in there 
to unicode).

Things we might need:
- unicode versions of strcmp, strcpy, strchr etc. I already started 
implementing those.
- PyErr_Format() should generate a unicode string.

Servus,
    Walter

> On 5/24/07, Walter Dörwald <walter at livinglogic.de> wrote:
>> Guido van Rossum wrote:
>> > How so?
>>
>> It fixes the test.
>>
>> > Wouldn't it be better to force it to be a unicode object?
>>
>> func_name is set from code->co_name, so co_name should be a unicode
>> object etc., so this opens a can of worms. Of course this should indeed
>> be fixed eventually.
>>
>> So should I revert the patch?
>>
>> Servus,
>>    Walter
>>
>> > On 5/24/07, walter.doerwald <python-3000-checkins at python.org> wrote:
>> >> Author: walter.doerwald
>> >> Date: Thu May 24 19:34:27 2007
>> >> New Revision: 55551
>> >>
>> >> Modified:
>> >>    python/branches/py3k-struni/Lib/test/test_funcattrs.py
>> >> Log:
>> >> Fix test_funcattrs.py: __name__ attribute must be str8.
>> >>
>> >>
>> >> Modified: python/branches/py3k-struni/Lib/test/test_funcattrs.py
>> >> 
>> ============================================================================== 
>>
>> >> --- python/branches/py3k-struni/Lib/test/test_funcattrs.py      
>> (original)
>> >> +++ python/branches/py3k-struni/Lib/test/test_funcattrs.py      Thu 
>> May 24 19:34:27 2007
>> >> @@ -258,8 +258,8 @@
>> >>  def test_func_name():
>> >>      def f(): pass
>> >>      verify(f.__name__ == "f")
>> >> -    f.__name__ = "g"
>> >> -    verify(f.__name__ == "g")
>> >> +    f.__name__ = str8("g")
>> >> +    verify(f.__name__ == str8("g"))
>> >>      cantset(f, "__globals__", 1)
>> >>      cantset(f, "__name__", 1)
>> >>      # test that you can access func.__name__ in restricted mode
>> >> _______________________________________________
>> >> Python-3000-checkins mailing list
>> >> Python-3000-checkins at python.org
>> >> http://mail.python.org/mailman/listinfo/python-3000-checkins
>> >>
>> >
>> >
>>
>>
> 
> 



More information about the Python-3000-checkins mailing list