OK, so I've released the first iteration of the email6 package on pypi
as email-6.0.0a1. After install you import it as email6. This will
allow anyone curious and/or motivated to test it out under Python 3.2.
I'm especially interested in anyone with a working program that uses
email in 3.2: it should be completely backward compatible, and if it
isn't I want to know ASAP.[*]
I've also opened issue 12586 for review of the delta between default
and the code that is in the release. I'd like to check the code in
to default and continue to work on it from there. As I said in the
issue comments: "When we originally planned out email6 we thought we'd
be making a "compatibility break" with backward compatibility shims.
As things have turned out the work is more a matter of incremental
improvement of the API while maintaining the old API, and thus it seems
reasonable to me to work on it directly in default rather than continue
to work on it in a separate feature branch." Assuming, that is, that
the general approach represented by *this* delta is accepted.
What this delta adds to email is a conversion to handling all headers as
full blown objects (as opposed to strings, tuples of strings, or Header
objects, depending on context). The object type is a subclass of str,
so the headers act like strings if you don't use their additional API.
The basic additional API is that a 'source' attribute contains the
text the generator read from the input source, and a 'value' attribute
that contains the value with all the Content-Transfer-Encoding stuff
undone so that you have a real unicode string. By changing a policy
setting, you can have that value as the string value of the header.
You can also assign a string with non-ASCII characters to a header, and
the right thing will happen. (Well, eventually it will happen...right
now it only works correctly for unstructured headers). Further, Date
headers have a datetime attribute (and accept being set to a datetime),
and address headers have attributes for accessing the individual addresses
in the header. Other structured headers will eventually grow additional
attributes as well.
The general approach has been discussed with and approved by the email-sig,
but all comments are welcome. I know there's room for bikeshedding
on some aspects of the API; in some cases I've dome some "placeholder"
stuff pending a more complete solution to certain design goals.
I have a big project in the offing over the next couple months. QNX is
still fully behind the funding for email6 development, but I probably
won't be able to complete it until the fall. So I'd like to get this
chunk (the biggest chunk of new code, considering the size of the parser)
reviewed and checked in if possible. I'll keep working on the bits of
functionality that aren't quite complete and the bugs that I know are
there until my big project kicks off, but I wanted to release/post now
so that there might be a chance of some review happening while I still
have time to respond quickly to the feedback.
R. David Murray http://www.bitdance.com
[*] I believe that if you try to use an email6 Message object with the 3.2
mailbox module you will run in to some trouble, but I think it ought to
be possible to make it work with the right magic :)
PS: I don't have much experience writing parsers, so I'm expecting some
critical comments about my parser design. It had to be a custom parser
since otherwise I'd be blocked on waiting for some other software to
get accepted into the stdlib, but it certainly wound up being a bigger
chunk of code than I expected when I started writing it.
On Tue, 02 Aug 2011 01:22:03 +0200, stefan.krah <python-checkins(a)python.org> wrote:
> changeset: 71683:68b5f87566fb
> branch: 3.2
> parent: 71679:1f9ca1819d7c
> user: Stefan Krah <skrah(a)bytereef.org>
> date: Tue Aug 02 01:06:16 2011 +0200
> Skip test_getsetlocale_issue1813() on Fedora due to setlocale() bug.
> See: https://bugzilla.redhat.com/show_bug.cgi?id=726536
> Lib/test/test_locale.py | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
> diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
> --- a/Lib/test/test_locale.py
> +++ b/Lib/test/test_locale.py
> @@ -1,4 +1,5 @@
> from test.support import run_unittest, verbose
> +from platform import linux_distribution
> import unittest
> import locale
> import sys
> @@ -391,6 +392,8 @@
> # crasher from bug #7419
> self.assertRaises(locale.Error, locale.setlocale, 12345)
> + @unittest.skipIf(linux_distribution() == 'Fedora', "Fedora setlocale() "
> + "bug: https://bugzilla.redhat.com/show_bug.cgi?id=726536")
> def test_getsetlocale_issue1813(self):
> # Issue #1813: setting and getting the locale under a Turkish locale
> oldlocale = locale.setlocale(locale.LC_CTYPE)
Why 'Fedora'? This bug affects more than just Fedora: as I reported on
the issue, I'm seeing it on Gentoo as well. (Also, including the issue
number in the commit message is helpful).
Note that since the bug report says that "Gentoo has been including this
fix for two years", the fact that it is failing on my Gentoo system
would seem to indicate that something about the fix is not right.
So, I'm not sure this skip is even valid. I'm not sure we've finished
diagnosing the bug.
If there are any helpful tests I can run on Gentoo, please let me know.
R. David Murray http://www.bitdance.com