Commit Graph

8393 Commits

Author SHA1 Message Date
Raymond Hettinger c0fac96c29 SF patch #756996: Bare except in ZipFile.testzip()
(Contributed by Steven Taschuk)

Replaces a bare except that caused all errors to be mis-reported as
archive errors.

Added a related NEWS item.
2003-06-27 22:25:03 +00:00
Raymond Hettinger 6f3eaa67e5 SF patch #761519: Fixes for bugs 760703 and 757821
SF bug #760703: SocketHandler and LogRecord don't work well together
SF bug #757821: logging module docs

Applied Vinay Sajip's patch with a few minor fixups and a NEWS item.

Patched __init__.py - added new function
makeLogRecord (for bug report 760703).

Patched handlers.py - updated some docstrings and
deleted some old commented-out code.

Patched test_logging.py to make use of makeLogRecord.

Patched liblogging.tex to fill documentation gaps (both
760703 and bug 757821).
2003-06-27 21:43:39 +00:00
Tim Peters 6ebe61fa80 A hack to ease compatibility with pre-2.3 Pythons: by default, doctest
now accepts "True" when a test expects "1", and similarly for "False"
versus "0".  This is un-doctest-like, but on balance makes it much
more pleasant to write doctests that pass under 2.2 and 2.3.  I expect
it to go away again, when 2.2 is forgotten.  In the meantime, there's
a new doctest module constant that can be passed to a new optional
argument, if you want to turn this behavior off.

Note that this substitution is very simple-minded:  the expected and
actual outputs have to consist of single tokens.  No attempt is made,
e.g., to accept [True, False] when a test expects [1, 0].  This is a
simple hack for simple tests, and I intend to keep it that way.
2003-06-27 20:48:05 +00:00
Gustavo Niemeyer 6cf26195c6 Do not add extra "\n" after bang line. 2003-06-27 19:33:38 +00:00
Fred Drake 01c623b1a3 fix typo 2003-06-27 19:22:11 +00:00
Skip Montanaro a7b8ac6613 add mention of -l, --listfuncs to usage() small part of 542562 2003-06-27 19:09:33 +00:00
Jeremy Hylton c4bf5edc3a Add a trivial test of getargspec() with a method. 2003-06-27 18:43:12 +00:00
Jeremy Hylton ab91902f6f A bit o' reformatting and removal of non-_getframe currentframe(). 2003-06-27 18:41:20 +00:00
Jeremy Hylton 6496788e7a Fix for SF bug 620190: getargspec() doesn't work with methods. 2003-06-27 18:14:39 +00:00
Jeremy Hylton 7ff55e6bc5 Add tests for __nonzero__() problems. 2003-06-27 17:40:16 +00:00
Jeremy Hylton f8ecde5de0 Revert previous checkin and just add a comment about constructor_ob.
There's no point to passing it anymore, but there's a test that
expects the call to fail if you pass a non-callable object.
2003-06-27 16:58:43 +00:00
Skip Montanaro 0fe8fce7e3 (HTML|Text)Repr.repr1: Guard against objects whos types have no __name__
attribute. Patch and bug report from Geoff Talvola. Closes patch #672855.
2003-06-27 15:45:41 +00:00
Michael W. Hudson 896e5164bb Jacob Hallen cornered me here at EuroPython and got me to look at
patch:

[ 750008 ] 'compiler' module bug with 'import foo.bar as baz'

which I'm now checking in.

after import foo.bar as baz, baz would refer to foo.
2003-06-27 12:32:39 +00:00
Raymond Hettinger f69d9f6818 SF bug #761337: datetime.strftime fails on trivial format string
The interning of short strings violates the refcnt==1 assumption for
_PyString_Resize().

A simple fix is to boost the initial value of "totalnew" by 1.
Combined with an NULL argument to PyString_FromStringAndSize(),
this assures that resulting format string is not interned.
This will remain true even if the implementation of
PyString_FromStringAndSize() changes because only the uninitialized
strings that can be interned are those of zero length.

Added a test case.
2003-06-27 08:14:17 +00:00
Jeremy Hylton 7567822838 Don't call constructor() from pickle().
The constructor() call only made sense when it registered the
constructor as safe for unpickling.  We should probably remove the
module-global function, but need to worry about backwards
compatibility.
2003-06-26 23:20:20 +00:00
Raymond Hettinger f6fe4eda6e Portion of SF patch #761104. Fixes a minor docstring error.
_TemporarilyImmutableSet is in fact a subclass of BaseSet
2003-06-26 18:49:28 +00:00
Jeremy Hylton 546e34b654 Enable tracing of multi-threaded applications.
Fix bug in computation of coverage percentage: Only count a line if it
was executed or if we print the >>>>>> marker.
2003-06-26 14:56:17 +00:00
Raymond Hettinger 5f078ff7f0 SF bug #759889: Pickling of Random is broken
* Implement __reduce__() to support pickling.
* Add a test case to prove a successful roundtrip through pickle.
2003-06-24 20:29:04 +00:00
Barry Warsaw 663219a8cc _make_boundary(): A minor optimization suggested by the Timbot. 2003-06-24 20:19:34 +00:00
Greg Stein 616a58d79a Deal with a couple XXX comments which asked questions.
In response to "shouldn't the client close the file?", the answer is
"no". The original design behind HTTPConnection is that the client did
not have to worry about it. The response would close itself when you
read the last of the data from it. This closing also dealt with
allowing the connection to perform another request/response (if it was
a persistent connection).

However... the auto-close behavior broke compatibility with the
classic httplib.HTTP class' behavior when a zero-length response body
was present. In that situation, the HTTPResponse object was
auto-closing it since there was no data present, and for an HTTP/1.0
connection-close socket (or an HTTP/0.9 request) connection, that also
ended up closing the socket. When an httplib.HTTP user went to read
the socket... boom. A patch to correct the auto-close (for compat with
old httplib users) was added in rev 1.22.

But for non-zero-length *chunked* bodies, we should keep the
auto-close behavior. The library user is not reading the socket (they
can't cuz of the chunked response we just got done handling), so they
should be immune to the response closing the socket. In fact, I would
like to see (one day) the auto-close restored, and the HTTP subclass
would simply have a flag to disable that behavior (for back-compat
purposes).
2003-06-24 06:35:19 +00:00
Raymond Hettinger 8a99b50239 SF patch #736962. Converted test_compile to unittest format. 2003-06-23 13:36:57 +00:00
Martin v. Löwis bcc651a1f9 Idlefork patch #682347: convert Unicode strings from readline to
IOBinding.encoding. Also set sys.std{in,out,err}.encoding, for both
the local and the subprocess case.
2003-06-22 07:52:56 +00:00
Just van Rossum ac8657bb0e some old changes to this unused module 2003-06-21 14:49:14 +00:00
Just van Rossum 35b50e2683 changed 8-space indentation to 4 2003-06-21 14:41:32 +00:00
Martin v. Löwis 5b8bfdf67c Patch #755087: Deal with emptied dumbdbm files correctly. 2003-06-21 13:54:55 +00:00
Just van Rossum dc31dc02f7 - do the right thing with symlinks inside directories we're copying
- move the normpath stuff around a bit
- added dubious special case to addPythonFramework()
2003-06-20 21:43:36 +00:00
Just van Rossum 6a55242685 make sure paths to dirs don't end in a / 2003-06-20 21:26:55 +00:00
Just van Rossum 00a0b97dc5 Reworked --strip option: it will now look at _any_ file that's marked
executable in the bundle. Therefore got rid of the "binaries" attribute.
2003-06-20 21:18:22 +00:00
Just van Rossum 9e50023898 register the library inside Python.framework as eligable for stripping 2003-06-20 20:05:40 +00:00
Just van Rossum 3166f59d2a Add initial standalone support for Python.framework 2003-06-20 18:56:10 +00:00
Raymond Hettinger 4327521688 Added regression test for SF #757818 2003-06-20 18:41:26 +00:00
Gustavo Niemeyer 25fe0bf91a Many new tests, based on gcov's coverage information.
From gcov's output (based on a locally changed _sre.c):

  82.07% of 1372 source lines executed in file ./Modules/_sre.c
2003-06-20 00:25:14 +00:00
Walter Dörwald a9da5ae07a Use find() instead of looping over the string in expanduser().
From SF patch #757058.
2003-06-19 10:21:14 +00:00
Tim Peters 76ca1d428f randrange(): Repaired my overly optimistic rewrite, and added comments
explaining what's wrong with the two simpler variants.
2003-06-19 03:46:46 +00:00
Tim Peters afb8979771 randrange(): 2.3 can no longer raises OverflowError on an int() call, so
some of this code because useless, and (worse) could return a long
instead of int (in Zope that's important, because a long can't be used
as a key in an IOBTree or IIBTree).
2003-06-19 03:23:06 +00:00
Raymond Hettinger befa37dd05 Minor updates:
* Updated comment on design of imap()
* Added untraversed object in izip() structure
* Replaced the pairwise() example with a more general window() example
2003-06-18 19:25:37 +00:00
Walter Dörwald 5edd785bbb Port test_complex.py to unittest.
Move the constructor tests from test_builtin to test_complex.

Add a bunch of tests (code coverage is a 94%).

From SF patch #736962.
2003-06-18 14:26:18 +00:00
Jack Jansen 39c5d666c9 Give default _elemdict and _propdict attributes to OSA classes, so
we don't get infinite recursion for suites that don't have an application
class.

Also got rid of some tabs.
2003-06-18 14:19:08 +00:00
Jack Jansen 2cf9b956f7 An indenting error in the code made it miss some suites that have an application
class.
2003-06-18 14:17:34 +00:00
Raymond Hettinger be9715398b SF bug #753451: classmethod abuse --> SystemError
Check the argument to classmethod for callability.

Backport candidate.
2003-06-18 01:13:41 +00:00
Greg Ward 9b15878369 Remove debug print on filename with NUL byte. 2003-06-18 00:54:28 +00:00
Greg Ward 8e36d28f3c SF patch #755987 (Jim Ahlstrom):
This is a patch for Bug 755031: If a null byte appears in
a file name, Python zipfile.py retains it, but InfoZip
terminates the name. Null bytes in file names are used
as a trick by viruses. I tested WinZip, and it also
truncates the file name at the null byte.

The patch also fixes a buglet: If a zipfile incorrectly
uses a directory separator other than '/', there was an
invalid complaint that the central directory name does
not match the file header name.

I also removed my name from the top of the file. It was
there for legal reasons which I believe no longer apply.
Many people have worked on this file besides me.
2003-06-18 00:53:06 +00:00
Brett Cannon 783eaf4774 Change all header strings to be as if they were capitalize()'ed. Also call
capitalize in AbstractHTTPHandler before inserting headers into HTTP instance.

Closes bug #649742, again.
2003-06-17 21:52:34 +00:00
Walter Dörwald e8049befdf Use _PyEval_SliceIndex to handle list.index() calls with
huge start and stop arguments. Add tests.
2003-06-17 19:27:39 +00:00
Raymond Hettinger 0887c732e7 Fix docstring 2003-06-17 16:53:25 +00:00
Guido van Rossum 2743d87d79 Fix sloppy index() implementation:
- don't use min() and max()
- interpret negative start/stop argument like negative slice indices
2003-06-17 14:25:14 +00:00
Walter Dörwald 77cdeaff55 Modernize Lib/posixpath.py: Use startswith(), endswith(), rstrip(),
struct_passwd attributes and +=.

From SF patch #755245.
2003-06-17 13:13:40 +00:00
Skip Montanaro 364ca40c2a SF Patch 569574 - enhancements to cgitb for plain text display 2003-06-17 12:58:31 +00:00
Raymond Hettinger d05abdec7b SF #754014: list.index() should accept optional start, end arguments
Also, modified UserList.index() to match and expanded the related tests.
2003-06-17 05:05:49 +00:00
Raymond Hettinger c8106e1f1d test_posixpath.py now uses unittest. The output file is no longer needed. 2003-06-17 04:19:59 +00:00