Jack Jansen [Sun, 4 Jan 2004 22:33:33 +0000 (22:33 +0000)]
Allow passing NULL pointers by passing None. This also works for the
factory functions, so you can call quicktime functions that are implemented
as methods on NULL too.
Still don't allow quicktime functions to return NULL pointers, though: I
think this always signals an error condition.
Apply pre-sizing optimization to a broader class of objects.
Formerly, the length was only fetched from sequence objects.
Now, any object that reports its length can benefit from pre-sizing.
Apply map/zip pre-sizing optimization to a broader class of objects.
Formerly, the length was only fetched from sequence objects.
Now, any object that reports its length can benefit from pre-sizing.
Apply tuple/list pre-sizing optimization to a broader class of objects.
Formerly, length data fetched from sequence objects.
Now, any object that reports its length can benefit from pre-sizing.
On one sample timing, it gave a threefold speedup for list(s) where s
was a set object.
Tim Peters [Sun, 4 Jan 2004 02:00:47 +0000 (02:00 +0000)]
Getting closer (but not yet there) to being able to compile under VC6
again. Removed the following subprojects and folded them into pythoncore,
to match what's being done under VC7. We *can* build the core DLL
under VC6 again after this:
Barry Warsaw [Sun, 4 Jan 2004 01:12:26 +0000 (01:12 +0000)]
Added more complete RFC 3548 support for Base64, Base32, and Base16
encoding and decoding, including optional case folding and optional
alternative alphabets.
[Bug #812325 ] tarfile.close() can write out more bytes to the output
than are specified by the buffer size. The patch calls .__write()
to ensure that any full blocks are written out.
Fred Drake [Thu, 1 Jan 2004 07:21:14 +0000 (07:21 +0000)]
in the section "The interpreter stack":
- rearranged a bit to avoid duplicated information
- provide more complete (and hopefully less confusing) descriptions of
the return values for most of these functions
(close SF bug #563298)
Various fixups:
* Add comment on the future of the sets module.
* Change a variable from "input" to "data" to avoid shadowing a builtin.
* Added possible applications for str.rsplit() and itertools.tee().
* Repaired the example for sorted().
* Cleaned-up the example for operator.itemgetter().
Barry Warsaw [Tue, 30 Dec 2003 16:52:25 +0000 (16:52 +0000)]
Fixes to support CJKCodecs as per SF bug #852347. Actually, this
patch removes dependencies on the old unsupported KoreanCodecs package
and the alternative JapaneseCodecs package. Since both of those
provide aliases for their codecs, this removal just makes the generic
codec names work.
We needed to make slight changes to __init__() as well.
This will be backported to Python 2.3 when its branch freeze is over.
Jeremy Hylton [Fri, 26 Dec 2003 19:05:04 +0000 (19:05 +0000)]
Revert previous two checkins to repair test failure.
The special-case code that was removed could return a value indicating
success but leave an exception set. test_fileinput failed in a debug
build as a result.
Andrew MacIntyre [Fri, 26 Dec 2003 00:20:53 +0000 (00:20 +0000)]
At 2.2, the Py<type>_Check() family of API functions (macros) changed
semantics to include subtypes. Most concrete object APIs then had
a Py<type>_CheckExact() macro added to test for an object's type
not including subtypes.
The PyDict_CheckExact() macro wasn't created at that time, so I've added
it for API completeness/symmetry - even though nobody has complained
about its absence in the time since 2.2 was released.
Andrew MacIntyre [Fri, 26 Dec 2003 00:07:51 +0000 (00:07 +0000)]
At 2.2, the Py<type>_Check() family of API functions (macros) changed
semantics to include subtypes. Most concrete object APIs then had
a Py<type>_CheckExact() macro added to test for an object's type
not including subtypes.
The PyDict_CheckExact() macro wasn't created at that time, so I've added
it for API completeness/symmetry - even though nobody has complained
about its absence in the time since 2.2 was released.
Andrew MacIntyre [Fri, 26 Dec 2003 00:02:23 +0000 (00:02 +0000)]
The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along
with most other concrete object checks, but the docs weren't brought into
line.
PyList_CheckExact() was added at 2.2 but never documented.
Andrew MacIntyre [Thu, 25 Dec 2003 23:57:52 +0000 (23:57 +0000)]
The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along
with most other concrete object checks, but the docs weren't brought into
line.
PyList_CheckExact() was added at 2.2 but never documented.
Andrew MacIntyre [Thu, 25 Dec 2003 13:28:48 +0000 (13:28 +0000)]
Performance of list([]) in 2.3 came up in a thread on comp.lang.python,
which can be reviewed via
http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html
Duncan Booth investigated, and discovered that an "optimisation" was
in fact a pessimisation for small numbers of elements in a source list,
compared to not having the optimisation, although with large numbers
of elements in the source list the optimisation was quite beneficial.
He posted his change to comp.lang.python (but not to SF).
Further research has confirmed his assessment that the optimisation only
becomes a net win when the source list has more than 100 elements.
I also found that the optimisation could apply to tuples as well,
but the gains only arrive with source tuples larger than about 320
elements and are nowhere near as significant as the gains with lists,
(~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for
tuples) so I haven't proceeded with this.
The code as it was applied the optimisation to list subclasses as
well, and this also appears to be a net loss for all reasonable sized
sources (~80-100% for up to 100 elements, ~20% for more than 500
elements; I tested up to 10000 elements).
Duncan also suggested special casing empty lists, which I've extended
to all empty sequences.
On the basis that list_fill() is only ever called with a list for the
result argument, testing for the source being the destination has
now happens before testing source types.
[Bug #829532] Invoking os.makedirs() with an argument that contains a
directory name with a single dot fails. The patch skips creating
directories named os.curdir. (Patch by Bram Moolenaar)
Tim Peters [Mon, 22 Dec 2003 18:10:51 +0000 (18:10 +0000)]
Changed the UCHAR_MAX error msg a bit: we don't really assume anything
about "characters", we assume something about C's char type (which is
an integral type).
Skip Montanaro [Mon, 22 Dec 2003 16:31:41 +0000 (16:31 +0000)]
There are places in Python which assume bytes have 8-bits. Formalize that a
bit by checking the value of UCHAR_MAX in Include/Python.h. There was a
check in Objects/stringobject.c. Remove that. (Note that we don't define
UCHAR_MAX if it's not defined as the old test did.)