The patch removes the basestring type from Python 3.0. PyString and
PyUnicode are subclasses of PyBaseObject_Type. Each occurrence of
basestring was replaces with str, mostly isinstance(egg, basestring)
with a few exceptions. PyObject_TypeCheck(args, &PyBaseString_Type) is
replaced with a check for PyUnicode and PyString.

test_ctypes: works for me
test_email: need some help from an email expoert
test_httplib: __file__ has a wrong type str8. I'm looking into it.
test_inspect: same issue as httplib
test_os: same issue
test_re: I had the failing test before my changes
File "Lib/test/test_re.py", line 622, in test_empty_array
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)
test_subprocess: I don't understand why it fails. The traceback is
missing a line
test_sys: related to __file__
test_xml_etree / test_xml_etree_c: a str8 / io error that may be related
to __file__

On 10/10/07, Christian Heimes <report@bugs.python.org> wrote:
>
> Christian Heimes added the comment:
>
> test_ctypes: works for me
Did you svn up, make clean and rebuild?
> test_email: need some help from an email expoert
Which test is failing?
> test_httplib: __file__ has a wrong type str8. I'm looking into it.
Yes, __file__ always has that type. Fixing it is messy because it
requires using the default filesystem encoding. Can you try that as a
separate patch?
> test_inspect: same issue as httplib
> test_os: same issue
> test_re: I had the failing test before my changes
But it passes for me.
> File "Lib/test/test_re.py", line 622, in test_empty_array
> ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)
Hm. It passes for me.
> test_subprocess: I don't understand why it fails. The traceback is
> missing a line
> test_sys: related to __file__
> test_xml_etree / test_xml_etree_c: a str8 / io error that may be related
> to __file__
Thanks for looking into these!!

Guido van Rossum wrote:
> Did you svn up, make clean and rebuild?
The ctypes package didn't change since my last rebuild an hour ago. I'm
on Linux (Ubuntu i386)
>
>> test_email: need some help from an email expoert
>
> Which test is failing?
test_decoded_generator()
The generator tries to print a str8 to a text file.
> Yes, __file__ always has that type. Fixing it is messy because it
> requires using the default filesystem encoding. Can you try that as a
> separate patch?
I'm already working on it. Can I introduce a new function
_PyUnicode_AsDefaultFSEncodedString that encodes unicode using
Py_FileSystemDefaultEncoding or UTF-8?
>> File "Lib/test/test_re.py", line 622, in test_empty_array
>> ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)
>
> Hm. It passes for me.
I'm going to look into the issue later.

On 10/10/07, Christian Heimes <report@bugs.python.org> wrote:
>
> Christian Heimes added the comment:
>
> Guido van Rossum wrote:
> > Did you svn up, make clean and rebuild?
>
> The ctypes package didn't change since my last rebuild an hour ago. I'm
> on Linux (Ubuntu i386)
Odd. I'll investigate when I have more time.
> >> test_email: need some help from an email expoert
> >
> > Which test is failing?
>
> test_decoded_generator()
> The generator tries to print a str8 to a text file.
Thought so. I have a tentative fix that I want approved by Barry
Warsaw before checking; you can see if it works for you too:
--- Lib/email/generator.py (revision 58412)
+++ Lib/email/generator.py (working copy)
@@ -288,7 +288,7 @@
for part in msg.walk():
maintype = part.get_content_maintype()
if maintype == 'text':
- print(part.get_payload(decode=True), file=self)
+ print(part.get_payload(decode=False), file=self)
elif maintype == 'multipart':
# Just skip this
pass
> > Yes, __file__ always has that type. Fixing it is messy because it
> > requires using the default filesystem encoding. Can you try that as a
> > separate patch?
>
> I'm already working on it. Can I introduce a new function
> _PyUnicode_AsDefaultFSEncodedString that encodes unicode using
> Py_FileSystemDefaultEncoding or UTF-8?
That's a rather long name... I don't think it needs a leading
underscore. How about
PyUnicode_AsFSString()?

Here is an updated patch which applies cleanly and fixes some additional
unit tests and removes one that doesn't make sense any more (re.compile
doesn't accept bytes).
The unit tests profile, cProfile and doctest fail w/ and w/o this patch.
They seem to suffer from the latest changes of our previous patch and
additional calls to utf_8_decode().

Hm? This is a one-word patch to email/generator.py.
On 10/15/07, Christian Heimes <report@bugs.python.org> wrote:
>
> Christian Heimes added the comment:
>
> Here is an updated patch which applies cleanly and fixes some additional
> unit tests and removes one that doesn't make sense any more (re.compile
> doesn't accept bytes).
>
> The unit tests profile, cProfile and doctest fail w/ and w/o this patch.
> They seem to suffer from the latest changes of our previous patch and
> additional calls to utf_8_decode().

> Hm? This is a one-word patch to email/generator.py.
Yes, I already noticed it and I'm creating a new patch now. I saw your
fix for the email generator problem in the bug report and wanted to add
it to my patch. I accidentally replaced the patch with the one liner.
Here is the new patch

> The unit tests profile, cProfile and doctest fail w/ and w/o this patch.
> They seem to suffer from the latest changes of our previous patch and
> additional calls to utf_8_decode().
Any details on those? They don't fail for me.

Guido van Rossum wrote:
> BTW we need a 2to3 fixer for this. Should be trivial -- just replace
> *all* occurrences of basestring with str.
I believe you that it's trivial for *you* but I've never dealt with the
fixers or the grammar. Fortunately for me I was able to copy the fixer
for standarderror. It toke just some minor tweaks :)
Let's see if the mail interface can handle attachments.

2007/10/15, Christian Heimes <report@bugs.python.org>:
>
> Christian Heimes added the comment:
>
> Guido van Rossum wrote:
> > BTW we need a 2to3 fixer for this. Should be trivial -- just replace
> > *all* occurrences of basestring with str.
>
> I believe you that it's trivial for *you* but I've never dealt with the
> fixers or the grammar. Fortunately for me I was able to copy the fixer
> for standarderror. It toke just some minor tweaks :)
>
> Let's see if the mail interface can handle attachments.
It did. :-) I renamed it to fix_basestring and submitted it. See:
Committed revision 58644.