Gregory P. Smith [Tue, 23 Aug 2005 21:19:40 +0000 (21:19 +0000)]
Add a check for the OpenSSL version number to conditionally compile
the _hashlibopenssl module (>= 0.9.7 required) and to not compile the
sha256 and sha512 modules if OpenSSL >= 0.9.8 is found.
Fred Drake [Tue, 23 Aug 2005 04:33:29 +0000 (04:33 +0000)]
ord() documentation update; this is what remains applicable from
SF patch #1057588; other changes make the rest of the patch out of date
or otherwise unnecessary
Kurt B. Kaiser [Tue, 23 Aug 2005 02:27:23 +0000 (02:27 +0000)]
1. Mac line endings were incorrect when pasting code from some browsers
when using X11 and the Fink distribution. Python Bug 1263656.
2. Eliminate duplicated code in ScriptBinding.run_module_event()
Modified Files:
NEWS.txt ScriptBinding.py
A new hashlib module to replace the md5 and sha modules. It adds
support for additional secure hashes such as SHA-256 and SHA-512. The
hashlib module uses OpenSSL for fast platform optimized
implementations of algorithms when available. The old md5 and sha
modules still exist as wrappers around hashlib to preserve backwards
compatibility.
SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear(). The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
Results of a line-by-line comparison back to dictobject.c.
* set_merge() cannot assume that the table doesn't resize during iteration.
* convert some unnecessary tests to asserts -- they were necessary in
dictobject.c because PyDict_Next() is a public function. The same is
not true for set_next().
* re-arrange the order of functions to more closely match the order
in dictobject.c. This makes it must easier to compare the two
and ought to simplify any issues of maintaining both.
* Bring lookkey() and lookkey_string() closer to dict version.
* Use set_next() for looping in issubset() and frozenset_hash().
* Re-order the presentation of cmp and hash functions.
Phillip J. Eby [Sat, 13 Aug 2005 03:29:00 +0000 (03:29 +0000)]
Fix a too-aggressive assert (see SF#1257960). Previously, gen_iternext
was never called during interpreter shutdown GC, so the f_back!=NULL
assertion was correct. Now that generators get close()d during GC,
the assertion was being triggered because the generator close() was being
called as the top-level frame. However, nothing actually is broken by
this; it's just that the condition was unexpected in previous Python
versions.
* Fix SF #1257731. Make __contains__(), remove(), and discard() only do
a frozenset conversion when the initial search attempt fails with a
TypeError and the key is some type of set. Add a testcase.
* Fix SF #1257731. Make __contains__(), remove(), and discard() only do
a frozenset conversion when the initial search attempt fails with a
TypeError and the key is some type of set. Add a testcase.
Neil Schemenauer [Fri, 12 Aug 2005 17:34:58 +0000 (17:34 +0000)]
Change the %s format specifier for str objects so that it returns a
unicode instance if the argument is not an instance of basestring and
calling __str__ on the argument returns a unicode instance.
* Add short-circuit code for in-place operations with self (such as
s|=s, s&=s, s-=s, or s^=s). Add related tests.
* Improve names for several variables and functions.
* Provide alternate table access functions (next, contains, add, and discard)
that work with an entry argument instead of just a key. This improves
set-vs-set operations because we already have a hash value for each key
and can avoid unnecessary calls to PyObject_Hash(). Provides a 5% to 20%
speed-up for quick hashing elements like strings and integers. Provides
much more substantial improvements for slow hashing elements like tuples
or objects defining a custom __hash__() function.
* Have difference operations resize() when 1/5 of the elements are dummies.
Formerly, it was 1/6. The new ratio triggers less frequently and only
in cases that it can resize quicker and with greater benefit. The right
answer is probably either 1/4, 1/5, or 1/6. Picked the middle value for
an even trade-off between resize time and the space/time costs of dummy
entries.
* Bring in INIT_NONZERO_SET_SLOTS macro from dictionary code.
* Bring in free list from dictionary code.
* Improve several comments.
* Differencing can leave many dummy entries. If more than
1/6 are dummies, then resize them away.
* Factor-out common code with new macro, PyAnySet_CheckExact.
* set_new() doesn't need to zero the structure a second time after tp_alloc
has already done the job.
* Use a macro form of PyErr_Occurred() inside the set_lookkey() function.
* Improve a variable name: entry0 --> table.
* Give set_lookkey_string() a fast alternate path when no dummy entries
are present.
* Have set_swap_bodies() reset the hash field to -1 whenever either of
bodies is not a frozenset. Maintains the invariant of regular sets
always having -1 in the hash field; otherwise, any mutation would make
the hash value invalid.
* Use an entry pointer to simplify the code in frozenset_hash().
* Move copyright notice to top and indicate derivation from sets.py and
dictobject.c.
* Have frozenset_hash() use entry->hash instead of re-computing each
individual hash with PyObject_Hash(o);
* Finalize the dummy entry before a system exit.
Phillip J. Eby [Tue, 2 Aug 2005 00:46:46 +0000 (00:46 +0000)]
PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument. Documentation updates are needed, too.
* Improve code for the empty frozenset singleton:
- Handle both frozenset() and frozenset([]).
- Do not use singleton for frozenset subclasses.
- Finalize the singleton.
- Add test cases.
* Factor-out set_update_internal() from set_update(). Simplifies the
code for several internal callers.
* Factor constant expressions out of loop in set_merge_internal().
* Minor comment touch-ups.
Revised the set() and frozenset() implementaion to use its own internal
data structure instead of using dictionaries. Reduces memory consumption
by 1/3 and provides modest speed-ups for most set operations.
Documentation added about changes in 2.4 to basicConfig(), including documentation of the keyword arguments. A version change note was also added to the basic example.
Fix a problem in Tkinter introduced by SF patch #869468 (checked in as
1.179): delete bogus __hasattr__ and __delattr__ methods on class Tk
that were breaking Tkdnd.