Tim Peters [Sun, 8 Aug 2004 01:48:59 +0000 (01:48 +0000)]
Deprecated testmod's useless & confusing isprivate gimmick.
Ripped out the docs for the new DocTestFinder's namefilter argument,
and renamed it to _namefilter; this only existed to support isprivate.
Removed the new DocTestFinder's objfilter argument. No point adding
more cruft to a broken filtering design.
Tim Peters [Sun, 8 Aug 2004 01:00:47 +0000 (01:00 +0000)]
Bug 1003471: Python 1.5.2 security vulnerability still present in 2.3.4
That's the title of the report, but the hole was probably plugged since
Python 2.0. See corresponding checkin to PC/getpathp.c: a crucial
precondition for joinpath() was neither documented nor verified, and there
are so many callers with so many conditional paths that no "eyeball
analysis" is satisfactory. Now Python dies with a fatal error if the
precondition isn't satisfied, instead of allowing a buffer overrun.
NOT TESTED! The Windows version of the patch was, but not this one. I
don't feel like waiting for someone to notice the patch I attached to the
bug report. If it doesn't compile, sorry, but fix it <wink>. If it
does compile, it's "obviously correct".
Armin Rigo [Sat, 7 Aug 2004 20:58:32 +0000 (20:58 +0000)]
This was quite a dark bug in my recent in-place string concatenation
hack: it would resize *interned* strings in-place! This occurred because
their reference counts do not have their expected value -- stringobject.c
hacks them. Mea culpa.
Armin Rigo [Sat, 7 Aug 2004 20:30:03 +0000 (20:30 +0000)]
Removing tests that fail because of changes in PyString_InternInPlace(),
as discussed on IRC. The equivalent tests for the new behavior are in
test_builtin.py.
[Patch #1003861 from Dima Dorfman] Fix markup in concrete.tex:
PyObject* o -> PyObject *o to be consistent with the
rest of the file
- Correct markup for Py_True
- Remove duplicate description of PyBool_Check
[Bug #914375] Crude modulefinder docs, but the module's code is very hard to read and it's not clear which bits are public and which aren't. The module's author should really be doing this (and using docstrings in the code, too)
Jeremy Hylton [Sat, 7 Aug 2004 19:25:33 +0000 (19:25 +0000)]
Add a trivial test for the compiler package, guarded by compiler resource.
This test is insanely slow, so it requires a resource. On my machine,
it also appears to dump core. I think the problem is a stack
overflow, but haven't been able to confirm.
Jeremy Hylton [Sat, 7 Aug 2004 19:20:05 +0000 (19:20 +0000)]
Subclasses of string can no longer be interned. The semantics of
interning were not clear here -- a subclass could be mutable, for
example -- and had bugs. Explicitly interning a subclass of string
via intern() will raise a TypeError. Internal operations that attempt
to intern a string subclass will have no effect.
Added a few tests to test_builtin that includes the old buggy code and
verifies that calls like PyObject_SetAttr() don't fail. Perhaps these
tests should have gone in test_string.
Tim Peters [Sat, 7 Aug 2004 19:12:27 +0000 (19:12 +0000)]
SF bug 1003471: Python 1.5.2 security vulnerability
This was probably fixed in rev 1.32 of getpath.c, but there are so
many paths thru the code that invoke joinpath() it's not at all
obvious that it *is* fixed. It doesn't help confidence that a crucial
precondition for calling joinpath() was neither documented nor verified.
It is now, and joinpath() will barf with a fatal error now rather than
overrun the buffer, if the precondition isn't met.
Note that this patch only changes the Windows flavor. I attached another
patch to the bug report for the POSIX flavor (which I can't test
conveniently).
Jeremy Hylton [Sat, 7 Aug 2004 17:40:50 +0000 (17:40 +0000)]
Fix urllib2.urlopen() handling of chunked content encoding.
The change to use the newer httplib interface admitted the possibility
that we'd get an HTTP/1.1 chunked response, but the code didn't handle
it correctly. The raw socket object can't be pass to addinfourl(),
because it would read the undecoded response. Instead, addinfourl()
must call HTTPResponse.read(), which will handle the decoding.
One extra wrinkle is that the HTTPReponse object can't be passed to
addinfourl() either, because it doesn't implement readline() or
readlines(). As a quick hack, use socket._fileobject(), which
implements those methods on top of a read buffer. (suggested by mwh)
Finally, add some tests based on test_urllibnet.
Thanks to Andrew Sawyers for originally reporting the chunked problem.
Point out that the setdefault defaults the value to None. Inspired by
Michael Chermside's thinking about patch #748126 (the chief upshot of
which thinking was "reject it!").
Barry Warsaw [Sat, 7 Aug 2004 16:38:40 +0000 (16:38 +0000)]
Resolution of bug #997368, "strftime() backward compatibility".
Specifically, time.strftime() no longer accepts a 0 in the yday position of a
time tuple, since that can crash some platform strftime() implementations.
parsedate_tz(): Change the return value to return 1 in the yday position.
Jeremy Hylton [Sat, 7 Aug 2004 16:28:14 +0000 (16:28 +0000)]
SF bug 874842 and patch 997626: httplib bugs
Hack httplib to work with broken Akamai proxies.
Make sure that httplib doesn't add extract Accept-Encoding or
Content-Length headers if the client has already set them.
[Bug #984952] Include more material from PEP 307.
I haven't tried to include all the material on old-style classes using protocols 0,1. The details are lengthy; someone who knows
more about the pickle module should decide if they're important enough
to be in the docs or not.
Barry Warsaw [Sat, 7 Aug 2004 15:57:52 +0000 (15:57 +0000)]
Resolution of SF bug #1002475 and patch #1003693; Header lines that end in
\r\n only get the \n stripped, not the \r (unless it's the last header which
does get the \r stripped). Patch by Tony Meyer.
test_whitespace_continuation_last_header(),
test_strip_line_feed_and_carriage_return_in_headers(): New tests.
_parse_headers(): Be sure to strip \r\n from the right side of header lines.
Tim Peters [Fri, 6 Aug 2004 22:02:59 +0000 (22:02 +0000)]
Merging from tim-doctest-branch, which is now closed.
This primarily adds more powerful ways to work with unittest, including
spiffy support for building suites out of doctests in non-Python
"text files".
Brett Cannon [Fri, 6 Aug 2004 04:30:46 +0000 (04:30 +0000)]
Changes the remote address used for tests in TimeoutTestCase from google.com to
python.org . This way the delay should be great enough for
testConnectTimeout() to pass even when one has a really fast Net connection
that allows connections faster than .001 seconds.
Tim Peters [Wed, 4 Aug 2004 20:04:32 +0000 (20:04 +0000)]
Example.__init__: this cannot use assert, because that fails to trigger
in a -O run, and so test_doctest was failing under -O. Simple cause,
simple cure.
Tim Peters [Wed, 4 Aug 2004 18:46:34 +0000 (18:46 +0000)]
Edward Loper's cool and massive refactoring of doctest.py, merged from
the tim-doctest-merge-24a2 tag on the the tim-doctest-branch branch.
We did development on the branch in case it wouldn't land in time for
2.4a2, but the branch looked good: Edward's tests passed there, ditto
Python's tests, and ditto the Zope3 tests. Together, those hit doctest
heavily.
Hye-Shik Chang [Wed, 4 Aug 2004 17:36:41 +0000 (17:36 +0000)]
SF #941229: Decode source code with sys.stdin.encoding in interactive
modes like non-interactive modes. This allows for non-latin-1 users
to write unicode strings directly and sets Japanese users free from
weird manual escaping <wink> in shift_jis environments.
(Reviewed by Martin v. Loewis)
To ever run this test "you must import TestSkipped" from the right
place! (can that please be it for silly mistakes in this file? :-) I
know I started it, but...).
Hye-Shik Chang [Wed, 4 Aug 2004 07:38:35 +0000 (07:38 +0000)]
SF #989185: Drop unicode.iswide() and unicode.width() and add
unicodedata.east_asian_width(). You can still implement your own
simple width() function using it like this:
def width(u):
w = 0
for c in unicodedata.normalize('NFC', u):
cwidth = unicodedata.east_asian_width(c)
if cwidth in ('W', 'F'): w += 2
else: w += 1
return w
Hye-Shik Chang [Wed, 4 Aug 2004 06:33:51 +0000 (06:33 +0000)]
Add a workaround for a problem that UTF-8 strings can be corrupted
or broken by basic ctype functions in 4.4BSD descendants. This
will be fixed in their future development branches but they'll keep
the POSIX-incompatibility for their backward-compatiblities in near
future.