Commit Graph

23891 Commits

Author SHA1 Message Date
Guido van Rossum 4030714a93 For new-style classes, we can now test for tp_del instead of asking
for a __del__ attribute, to see if there's a finalizer.
2002-08-09 17:39:14 +00:00
Guido van Rossum 4aa21aa5b3 Test finalizers and GC from inside __del__ for new classes. 2002-08-09 17:38:16 +00:00
Guido van Rossum bffb2efee0 Credit to Oren for the file-iterator patch. 2002-08-09 17:17:07 +00:00
Guido van Rossum deb0936795 News about the tempfile rewrite. 2002-08-09 17:16:30 +00:00
Guido van Rossum 3b0a3293c3 Massive changes from SF 589982 (tempfile.py rewrite, by Zack
Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.
2002-08-09 16:38:32 +00:00
Guido van Rossum 830a5151c1 Doc portion of SF 589982 (tempfile.py rewrite, by Zack Weinberg).
Fred, please review!
2002-08-09 16:16:30 +00:00
Guido van Rossum 0e54871f82 Check-in of the most essential parts of SF 589982 (tempfile.py
rewrite, by Zack Weinberg).  This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.

This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
2002-08-09 16:14:33 +00:00
Guido van Rossum 0f5f0b8057 Test for Neil's fix to correctly invoke __rmul__. 2002-08-09 16:11:37 +00:00
Guido van Rossum d81a9834f7 News about Neil's fix to correctly invoke __rmul__. 2002-08-09 15:57:34 +00:00
Guido van Rossum f36921c4b0 Unicode replace() method with empty pattern argument should fail, like
it does for 8-bit strings.
2002-08-09 15:36:48 +00:00
Neil Schemenauer 3bc3f28dbe Only call sq_repeat if the object does not have a nb_multiply slot. One
example of where this changes behavior is when a new-style instance
defines '__mul__' and '__rmul__' and is multiplied by an int.  Before the
change the '__rmul__' method is never called, even if the int is the
left operand.
2002-08-09 15:20:48 +00:00
Fred Drake a350270302 New entries to track the DOM API growth. These match names exposed in
PyXML 0.8.
2002-08-09 14:57:55 +00:00
Jack Jansen 1403b9fecd When installing the "python" link in bindir also test for a pre-existing
symlink and remove it.
2002-08-09 14:42:57 +00:00
Jack Jansen 45c8e92728 - Precompile py files in Mac subtree after installing
- Pre-cache .rsrc files in Mac subtree after installing
- Fixed nameclash in Make variables
2002-08-09 14:15:46 +00:00
Jack Jansen ccd8e8d741 - Check not only that cache file exists, but also that it is newer than
the applesingle file.
- Added optional verbose option for cachersrc tool.
2002-08-09 13:44:03 +00:00
Jack Jansen b8da8d7761 Tool to pre-created cached .rsrc.df.rsrc files in the Lib directories,
similar to compileall.py.
2002-08-09 13:42:55 +00:00
Sjoerd Mullender b6434f2c2f Document that -u puts stdin, stdout, and stderr in binary mode. 2002-08-09 13:37:31 +00:00
Sjoerd Mullender 9cf424b04b On Cygwin, put stdin, stderr, and stdout in binary mode when the -u
flag is given (to mimic native Windows).
2002-08-09 13:35:18 +00:00
Jack Jansen d77f93ad81 Obsolete now that there's a python implementation of strptime in the
standard lib.
2002-08-09 10:22:11 +00:00
Jack Jansen f1148f0bb3 Patch by Russel Owen: if we have command line arguments zap pyc files
in the directories given.
2002-08-09 10:17:28 +00:00
Steve Purcell dc391a67e3 Fix to ensure consistent 'repr' and 'str' results between Python
versions, since 'repr(new_style_class) != repr(classic_class)'.
Suggested by Jeremy Hylton.
2002-08-09 09:46:23 +00:00
Jack Jansen a70ab8cd4f Depracated some non-carbon modules. 2002-08-09 09:03:31 +00:00
Jack Jansen 9536bcbfd8 This file should have gone long ago. 2002-08-09 09:02:01 +00:00
Tim Peters 671764beb0 Repaired a braino in the description of bad minrun values. 2002-08-09 05:06:44 +00:00
Neal Norwitz 90128ba22c SF bug #592645 fix memory leak in socket.getaddrinfo 2002-08-09 03:37:42 +00:00
Fred Drake 9d416a7c10 Update the text on the Expat module and library. 2002-08-09 02:39:13 +00:00
Guido van Rossum 721f62e200 Major speedup for new-style class creation. Turns out there was some
trampolining going on with the tp_new descriptor, where the inherited
PyType_GenericNew was overwritten with the much slower slot_tp_new
which would end up calling tp_new_wrapper which would eventually call
PyType_GenericNew.  Add a special case for this to update_one_slot().

XXX Hope there isn't a loophole in this.  I'll buy the first person to
point out a bug in the reasoning a beer.

Backport candidate (but I won't do it).
2002-08-09 02:14:34 +00:00
Raymond Hettinger c35491ee3a Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
2002-08-09 01:37:06 +00:00
Raymond Hettinger 48923c5533 Moved special case for tuples from iterobject.c to
tupleobject.c. Makes the code in iterobject.c cleaner
and speeds-up the general case by not checking for
tuples everytime.   SF Patch #592065.
2002-08-09 01:30:17 +00:00
Raymond Hettinger 8da9da0ccc Revised the test suite for 'contains' to use the test() function argument
rather than vereq().  While it was effectively testing regular strings, it
ignored the test() function argument when called by test_userstring.py.
2002-08-09 00:43:38 +00:00
Jack Jansen cb4321eb17 By popular demand the frameworkinstall target now installs everything:
the framework, the MacOSX apps and the unix tools.
Most of the hard work is done by Mac/OSX/Makefile.

Also, it should now be possible to install in a different directory,
such as /tmp/dist/Library/Frameworks, for building binary installers.
The fink crowd wanted this.
2002-08-09 00:18:21 +00:00
Guido van Rossum 7bed213224 Significant speedup in new-style object creation: in slot_tp_new(),
intern the string "__new__" so we can call PyObject_GetAttr() rather
than PyObject_GetAttrString().  (Though it's a mystery why slot_tp_new
is being called when a class doesn't define __new__.  I'll look into
that tomorrow.)

2.2 backport candidate (but I won't do it).
2002-08-08 21:57:53 +00:00
Jack Jansen 617e2305ee Use hex escape for non-ascii chars, now that the parser wants that.
Good thing, too: some of the characters had been mangled by OS9->CVS->OSX
roundtrips.
2002-08-08 21:16:56 +00:00
Guido van Rossum febd61dc02 A modest speedup of object deallocation. call_finalizer() did rather
a lot of work: it had to save and restore the current exception around
a call to lookup_maybe(), because that could fail in rare cases, and
most objects don't have a __del__ method, so the whole exercise was
usually a waste of time.  Changed this to cache the __del__ method in
the type object just like all other special methods, in a new slot
tp_del.  So now subtype_dealloc() can test whether tp_del is NULL and
skip the whole exercise if it is.  The new slot doesn't need a new
flag bit: subtype_dealloc() is only called if the type was dynamically
allocated by type_new(), so it's guaranteed to have all current slots.
Types defined in C cannot fill in tp_del with a function of their own,
so there's no corresponding "wrapper".  (That functionality is already
available through tp_dealloc.)
2002-08-08 20:55:20 +00:00
Guido van Rossum 12e3c710db The other half of the patches added to SF patch 555085 by A I
MacIntyre.  At least on OS/2, a subsequent connect() on a nonblocking
socket returns errno==EISCONN to indicate success.  This seems
harmless on Unix.
2002-08-08 20:39:30 +00:00
Guido van Rossum 22a97159cd Clean up some docstrings. Some docstrings didn't show their return
value; others were inconsistent in what to name the argument or return
value; a few module-global functions had "socket." in front of their
name, against convention.
2002-08-08 20:37:08 +00:00
Guido van Rossum e531e296fa testSendAll(): loop until all data is read; this was necessary at
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.
2002-08-08 20:28:34 +00:00
Tim Peters 469cdad822 Whitespace normalization. 2002-08-08 20:19:19 +00:00
Tim Peters d7e8a0dd37 Delete junk attributes left behind by _socketobject class construction. 2002-08-08 20:07:03 +00:00
Jason Tishler 4df78cddaa Patch #588561: Cygwin _hotshot patch
YA Cygwin module patch very similar to other patches
that I have submitted.  I tested under Cygwin and Red
Hat Linux 7.1.
2002-08-08 19:46:15 +00:00
Guido van Rossum 715f970969 The _socketobject class has no need for a __del__ method: all it did was
to delete the reference to self._sock, and the regular destructor will
do that just fine.  This made some hacks in close() unnecessary.

The _fileobject class still has a __del__ method, because it must flush.
2002-08-08 18:11:36 +00:00
Guido van Rossum 48b7969af8 OK, one more hack: speed up the case of readline() in unbuffered mode.
This is important IMO because httplib reads the headers this way.
2002-08-08 17:34:19 +00:00
Guido van Rossum fb3deec2fc Another refactoring of read() and readline(), this time based on the
observation that _rbuf could never have more than one string in it.
So make _rbuf a string.  The code branches for size<0 and size>=0
are completely separate now, both in read() and in readline().

I checked for tabs this time. :-)
2002-08-08 17:16:09 +00:00
Guido van Rossum de7cadec54 Extend __all__ with the exports list of the _ssl module. 2002-08-08 15:25:28 +00:00
Guido van Rossum 7c3b6347e5 Oops, stupid tabs. Sorry again. 2002-08-08 15:22:12 +00:00
Guido van Rossum c18993f84a Another refactoring. Changed 'socket' from being a factory function
to being a new-style class, to be more similar to the socket class
in the _socket module; it is now the same as the _socketobject class.
Added __slots__.  Added docstrings, copied from the real socket class
where possible.

The _fileobject class is now also a new-style class with __slots__
(though without docstrings).  The mode, name, softspace, bufsize and
closed attributes are properly supported (closed as a property; name
as a class attributes; the softspace, mode and bufsize as slots).
2002-08-08 15:16:20 +00:00
Steve Purcell 824574d3d4 Add module-wide "__metaclass__ = type", as requested by Jim Fulton.
(Synched from pyunit CVS)
2002-08-08 13:38:02 +00:00
Tim Peters 6c511e6d1c Added info about highwater heap-memory use for the sortperf.py tests; + a
couple of minor edits elsewhere.
2002-08-08 01:55:16 +00:00
Tim Peters 6063e2615f PyList_Reverse(): This was leaking a reference to Py_None on every call.
I believe I introduced this bug when I refactored the reversal code so
that the mergesort could use it too.  It's not a problem on the 2.2 branch.
2002-08-08 01:06:39 +00:00
Guido van Rossum 443fec3dd9 Major restructuring of _fileobject. Hopefully several things now work
correctly (the test at least succeed, but they don't test everything yet).

Also fix a performance problem in read(-1): in unbuffered mode, this would
read 1 byte at a time.  Since we're reading until EOF, that doesn't make
sense.  Use the default buffer size if _rbufsize is <= 1.
2002-08-08 01:02:16 +00:00