This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nicdumz
Recipients aalbrecht, barry, cjw296, djc, gagern, nicdumz, salty-horse, splorgdar
Date 2010-07-06.08:22:44
SpamBayes Score 0.00011067658
Marked as misclassified No
Message-id <1278404567.19.0.655403431058.issue1974@psf.upfronthosting.co.za>
In-reply-to
Content
Hello folks.

(stumbling on this bug with Python2.7 release, noting that a few Mercurial tests broke with 2.7)

I have no problem whatsoever with the fix itself (you know emails better than me), but you broke backwards compatibility for email.generator.Generator here, without propagating the changes to previous versions.

1) It would have been nice to flag this somewhere in the release notes, and/or the documentation for email.generator.Generator. Finding the reason of the Mercurial failures was... a bit trickier than necessary :)
2) What durable solutions can you propose for those of us that have to support several Python versions and share a similar behaviour?

In a perfect world, I would simply do this:

class CompatibleHeader(email.Header.Header.__class__):
    """
    Python2.7 introduces a backwards incompatible change
    (Python issue1974, r70772) in email.generaor.Generator code:
    pre-2.7 code passed "continuation_ws='\t'" to the Header
    constructor, and 2.7 removed this parameter.

    Default argument is continuation_ws=' ', which means that
    the behaviour is different in <2.7 and 2.7

    We consider the 2.7 behaviour to be preferable, but need
    to have an unified behaviour for versions 2.4 to 2.7
    """
    def __init__(self, **kw):
        # override continuation_ws
        kw['continuation_ws'] = ' '
        email.Header.Header.__init__(self, **kw)

email.Header.Header.__class__ = CompatibleHeader

and get over it, but you'll notice that Header is still an old-style class... so that's not possible.

Any suggestions?

Thanks!
History
Date User Action Args
2010-07-06 08:22:47nicdumzsetrecipients: + nicdumz, barry, gagern, salty-horse, aalbrecht, cjw296, djc, splorgdar
2010-07-06 08:22:47nicdumzsetmessageid: <1278404567.19.0.655403431058.issue1974@psf.upfronthosting.co.za>
2010-07-06 08:22:45nicdumzlinkissue1974 messages
2010-07-06 08:22:44nicdumzcreate