Martin v. Löwis [Sun, 2 Mar 2008 20:32:57 +0000 (20:32 +0000)]
Backport of r61180:
Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
Barry Warsaw [Tue, 25 Jul 2006 13:06:56 +0000 (13:06 +0000)]
Back port r50693 and r50754 from the trunk (and 2.4 branch):
decode_rfc2231(): Be more robust against buggy RFC 2231 encodings.
Specifically, instead of raising a ValueError when there is a single
tick in the parameter, simply return that the entire string unquoted, with
None for both the charset and the language. Also, if there are more than 2
ticks in the parameter, interpret the first three parts as the standard RFC
2231 parts, then the rest of the parts as the encoded string.
More RFC 2231 improvements for the email 4.0 package. As Mark Sapiro
rightly points out there are really two types of continued headers
defined in this RFC (i.e. "encoded" parameters with the form
"name*0*=" and unencoded parameters with the form "name*0="), but we
were were handling them both the same way and that isn't correct.
This patch should be much more RFC compliant in that only encoded
params are %-decoded and the charset/language information is only
extract if there are any encoded params in the segments. If there are
no encoded params then the RFC says that there will be no
charset/language parts.
Note however that this will change the return value for
Message.get_param() in some cases. For example, whereas before if you
had all unencoded param continuations you would have still gotten a
3-tuple back from this method (with charset and language == None), you
will now get just a string. I don't believe this is a backward
incompatible change though because the documentation for this method
already indicates that either return value is possible and that you
must do an isinstance(val, tuple) check to discriminate between the
two. (Yeah that API kind of sucks but we can't change /that/ without
breaking code.)
Test cases, some documentation updates, and a NEWS item accompany this
patch.
Barry Warsaw [Thu, 9 Feb 2006 04:03:22 +0000 (04:03 +0000)]
Resolve SF bug 1409403: email.Message should supress warning from uu.decode.
However, the patch in that tracker item is elaborated such that the newly
included unit test pass on Python 2.1 through 2.5. Note that Python 2.1's
uu.decode() does not have a 'quiet' argument, so we have to be sneaky.
Will port to email 3.0 (although without the backward compatible sneakiness).
Barry Warsaw [Wed, 8 Feb 2006 13:33:20 +0000 (13:33 +0000)]
Patches to address SF bugs 1409538 (Japanese codecs in CODEC_MAP) and 1409455
(.set_payload() gives bad .get_payload() results). Specific changes include:
Simplfy the default CODEC_MAP in Charset.py to not include the Japanese and
Korean codecs. The names of the codecs are different depending on whether
you're using Python 2.4 and 2.5, which include the codecs by default, or
earlier Python's which provide the codecs under different names as a third
party library. Now, we attempt to discover which (if either) is available and
populate the CODEC_MAP as appropriate.
Message.set_charset(): When the message does not already have a
Content-Transfer-Encoding header, instead of just adding the header, we also
encode the body as defined by the assigned Charset. As before, if the
body_encoding is callable, we just call that. If not, then we add a call to
body_encode() before setting the header. This way, we guarantee that a
message's text payload is always encoded properly.
Remove the payload encoding code from Generator._handle_text(). With the
above patch, this would cause the body to be doubly encoded. Doing this in
the Message class is better than only doing it in the Generator.
Added some new tests to ensure everything works correctly. Also changed the
way the test_email_codecs.py tests get added (using the same lookup code that
the CODEC_MAP adjustments use).
This resolves both issues for email 2.5/Python 2.3. I will patch forward to
email 3.0 for both Python 2.4 and 2.5.
Barry Warsaw [Fri, 3 Feb 2006 04:41:24 +0000 (04:41 +0000)]
parsedate_tz(): Return a 1 in the tm_yday field so that the value is
acceptable to Python 2.4's time.strftime(). This fix mirrors the behavior in
email 3.0. That field is documented as being "not useable" so it might as
well not be buggy too <wink>.
Add a test for this behavior and update a few tests that were expecting a 0 in
this field. After committing I will run the entire Python 2.3 test suite to
ensure this doesn't break any Python tests.
Barry Warsaw [Tue, 17 Jan 2006 04:34:54 +0000 (04:34 +0000)]
SF bug #1403349 solution for email 2.5; some MUAs use the 'file' parameter
name in the Content-Distribution header, so Message.get_filename() should fall
back to using that. Will port both to email 3.0 and Python 2.5 trunk.
Also, bump the email package version to 2.5.7 for eventual release. Of
course, add a test case too.
Barry Warsaw [Fri, 29 Apr 2005 12:12:02 +0000 (12:12 +0000)]
get_filename(), get_content_charset(): It's possible that the charset named in
an RFC 2231-style header could be bogus or unknown to Python. In that case,
we return the the text part of the parameter undecoded. However, in
get_content_charset(), if that is not ascii, then it is an illegal charset and
so we return failobj.
Test cases and a version bump are included.
Committing this to the Python 2.3 branch because I need to generate an email
2.5.6 release that contains these patches. I will port these fixes to Python
2.4 and 2.5 for email 3.x.
Thomas Heller [Tue, 25 Jan 2005 20:46:48 +0000 (20:46 +0000)]
Running a bdist_wininst installer, built with Python 2.3, installing
for Python 2.4 caused a segfault when post_install_script was used.
The reason was that the file handle passed to PyRun_SimpleFile() was
created with MSVCRT.DLL, but Python 2.4 uses MSVCR71.DLL.
So, I replaced PyRun_SimpleFile() with PyRun_SimpleString(). The
segfault is gone, but the output of the postinstall script doesn't
show up, because still freopen() from MSVCRT is used.
(I would be very gratefull if someone proofreads the patch, at least).
Thomas Heller [Thu, 20 Jan 2005 19:28:44 +0000 (19:28 +0000)]
At least one bug has been fixed in distutils, so increment the last part of
the version number. For the distutils version numbering scheme, see
http://mail.python.org/pipermail/distutils-sig/2005-January/004368.html
Kurt B. Kaiser [Wed, 19 Jan 2005 05:53:32 +0000 (05:53 +0000)]
Backport configDialog.py rev 1.60:
Saving a Keyset w/o making changes (by using the "Save as New Custom Key Set"
button) caused IDLE to fail on restart (no new keyset was created in
config-keys.cfg). Also true for Theme/highlights. Python Bug 1064535.
Kurt B. Kaiser [Wed, 19 Jan 2005 01:44:06 +0000 (01:44 +0000)]
Backport rpc.py rev 1.28 dating from 21Jan04
rpc.py:SocketIO - Large modules were generating large pickles when downloaded
to the execution server. The return of the OK response from the subprocess
initialization was interfering and causing the sending socket to be not
ready. Add an IO ready test to fix this. Moved the polling IO ready test
into pollpacket().
Fix typo in rpc.py, s/b "pickle.PicklingError" not "pickle.UnpicklingError".
idlever.py should be 1.0.4 to align with NEWS.txt. There was no IDLE release
at 2.3.1 which accounts for the unsync.
If $MACOSX_DEPLOYMENT_TARGET is set, and >= 10.3, during configure we
setup extensions to link with dynamic lookup. We also record the
value in the Makefile, and distutils uses the same value to build extension
modules. If MACOSX_DEPLOYMENT_TARGET is not set it defaults to the
current OSX version.
If we cannot use -undefined dynamic_lookup (such as on 10.2 or earlier)
we link extensions directly against the dynamic library in the framework in
stead of against the framework. This will fix building extensions for 2.3
after 2.4 has been installed too.
Jack Jansen [Tue, 4 Jan 2005 16:05:33 +0000 (16:05 +0000)]
Backport of 1.55 and 1.57:
- Added quotes around the destroot arguments, so empty destroot works.
- Run fixapplepython23 script to check whether Apple's Python 2.3 needs
to be patched.
Jack Jansen [Mon, 3 Jan 2005 15:46:30 +0000 (15:46 +0000)]
Backport of 1.37:
- Added an "installer" flavor, which uses the "open" command to install
something (overridable through Install-command entry)
- Hidden status is now determined by flavor == hidden, not by
missing Download-URL. Hidden packages behave like installer packages.
- Made some error messages a bit more understandable.
Because there's new functionality the version has been upped to 0.5.
Jack Jansen [Sun, 2 Jan 2005 23:17:06 +0000 (23:17 +0000)]
Added a band-aid to make this script work with the older 2.3.0
buildtools if no destroot option is given. That makes life for the
additions installer a lot simpler.
Jack Jansen [Fri, 31 Dec 2004 10:44:41 +0000 (10:44 +0000)]
Backport:
Fix for #1091468: DESTROOTed frameworkinstalls fail. Added a --destroot
option to various tools, and do the right thing when we're doing a destroot
install.
Jack Jansen [Tue, 28 Dec 2004 21:53:15 +0000 (21:53 +0000)]
Backport of 1.36:
- getDefaultDatabase wasn't listed in __all__.
- using a different database for non-final releases should only be done
for X.Y.0. Non-final micro releases can use the default database just fine,
as they are required to be backward compatible.