Commit Graph

757 Commits

Author SHA1 Message Date
Tim Peters 15d4929ae4 Implement an old idea of Christian Tismer's: use polynomial division
instead of multiplication to generate the probe sequence.  The idea is
recorded in Python-Dev for Dec 2000, but that version is prone to rare
infinite loops.

The value is in getting *all* the bits of the hash code to participate;
and, e.g., this speeds up querying every key in a dict with keys
 [i << 16 for i in range(20000)] by a factor of 500.  Should be equally
valuable in any bad case where the high-order hash bits were getting
ignored.

Also wrote up some of the motivations behind Python's ever-more-subtle
hash table strategy.
2001-05-27 07:39:22 +00:00
Tim Peters 1af03e98d9 Change list.extend() error msgs and NEWS to reflect that list.extend()
now takes any iterable argument, not only sequences.

NEEDS DOC CHANGES -- but I don't think we settled on a concise way to
say this stuff.
2001-05-26 19:37:54 +00:00
Barry Warsaw ffd674d400 - calendar.py uses month and day names based on the current locale. 2001-05-22 16:00:10 +00:00
Marc-André Lemburg 12e74b3cf2 Added NEWS item for the UTF-16 change. 2001-05-22 08:58:23 +00:00
Marc-André Lemburg fab96cc2ff Add NEWS item for new string methods. 2001-05-15 18:38:45 +00:00
Guido van Rossum 2e0a654f6e Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.
2001-05-15 02:14:44 +00:00
Tim Peters 58e0a8c130 SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. 2001-05-14 22:32:33 +00:00
Tim Peters 95b3f78622 pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
2001-05-14 18:39:41 +00:00
Guido van Rossum 1bd797a257 Fix a typo, consistently spell ASCII in all caps, and insert blank
lines between paragraphs in Mark Hammond's news item about the default
encoding in posixmodule.  Resist the temptation to reflow paragraphs.
2001-05-14 13:53:38 +00:00
Tim Peters a814db579d SF bug[ #423781: pprint.isrecursive() broken. 2001-05-14 07:05:58 +00:00
Mark Hammond 2a0af79269 Add mention of the default file system encoding for Windows. 2001-05-14 03:09:36 +00:00
Tim Peters 2f228e75e4 Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints <sigh>, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) & mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash & mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

>>> d = {}
>>> for i in range(10):
...    d[i] = i
...
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
2001-05-13 00:19:31 +00:00
Tim Peters d85e102337 Variant of patch #423262: Change module attribute get & set
Allow module getattr and setattr to exploit string interning, via the
previously null module object tp_getattro and tp_setattro slots.   Yields
a very nice speedup for things like random.random and os.path etc.
2001-05-11 21:51:48 +00:00
Tim Peters 95bf9390a4 SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Bugfix candidate.
2001-05-10 08:32:44 +00:00
Tim Peters 61dff2b285 Blurb about the increased precision of float literals in .pyc/.pyo files. 2001-05-08 15:43:37 +00:00
Tim Peters e63415ead8 SF patch #421922: Implement rich comparison for dicts.
d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2
don't support comparisons other than ==, and testing dicts for equality
is faster now (especially when inequality obtains).
2001-05-08 04:38:29 +00:00
Tim Peters 8572b4fedf Generalize zip() to work with iterators.
NEEDS DOC CHANGES.
More AttributeErrors transmuted into TypeErrors, in test_b2.py, and,
again, this strikes me as a good thing.
This checkin completes the iterator generalization work that obviously
needed to be done.  Can anyone think of others that should be changed?
2001-05-06 01:05:02 +00:00
Tim Peters 75f8e35ef4 Generalize PySequence_Count() (operator.countOf) to work with iterators. 2001-05-05 11:33:43 +00:00
Tim Peters 1434299a99 Remove redundant line. 2001-05-05 10:14:34 +00:00
Tim Peters de9725f135 Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
NEEDS DOC CHANGES
A few more AttributeErrors turned into TypeErrors, but in test_contains
this time.
The full story for instance objects is pretty much unexplainable, because
instance_contains() tries its own flavor of iteration-based containment
testing first, and PySequence_Contains doesn't get a chance at it unless
instance_contains() blows up.  A consequence is that
    some_complex_number in some_instance
dies with a TypeError unless some_instance.__class__ defines __iter__ but
does not define __getitem__.
2001-05-05 10:06:17 +00:00
Tim Peters 2cfe368283 Make unicode.join() work nice with iterators. This also required a change
to string.join(), so that when the latter figures out in midstream that
it really needs unicode.join() instead, unicode.join() can actually get
all the sequence elements (i.e., there's no guarantee that the sequence
passed to string.join() can be iterated over *again* by unicode.join(),
so string.join() must not pass on the original sequence object anymore).
2001-05-05 05:36:48 +00:00
Tim Peters 432b42aa4c Mark string.join() as done. Turns out string_join() works "for free" now,
because PySequence_Fast() started working for free as soon as
PySequence_Tuple() learned how to work with iterators.  For some reason
unicode.join() still doesn't work, though.
2001-05-05 04:24:43 +00:00
Tim Peters 6912d4ddf0 Generalize tuple() to work nicely with iterators.
NEEDS DOC CHANGES.
This one surprised me!  While I expected tuple() to be a no-brainer, turns
out it's actually dripping with consequences:
1. It will *allow* the popular PySequence_Fast() to work with any iterable
   object (code for that not yet checked in, but should be trivial).
2. It caused two std tests to fail.  This because some places used
   PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test
   whether something *is* a sequence.  But tuple() code only looked for the
   existence of sq->item to determine that, and e.g. an instance passed
   that test whether or not it supported the other operations tuple()
   needed (e.g., __len__).  So some things the tests *expected* to fail
   with an AttributeError now fail with a TypeError instead.  This looks
   like an improvement to me; e.g., test_coercion used to produce 559
   TypeErrors and 2 AttributeErrors, and now they're all TypeErrors.  The
   error details are more informative too, because the places calling this
   were *looking* for TypeErrors in order to replace the generic tuple()
   "not a sequence" msg with their own more specific text, and
   AttributeErrors snuck by that.
2001-05-05 03:56:37 +00:00
Guido van Rossum 3e360db159 Add TODO item about x in y -- this should use iterators too, IMO. 2001-05-04 13:40:18 +00:00
Tim Peters 3e067578f6 Added reminders to make some remaining functions iterator-friendly. Feel
free to do one!
2001-05-04 04:43:42 +00:00
Tim Peters 15d81efb8a Generalize reduce() to work with iterators.
NEEDS DOC CHANGES.
2001-05-04 04:39:21 +00:00
Tim Peters 4e9afdca39 Generalize map() to work with iterators.
NEEDS DOC CHANGES.
Possibly contentious:  The first time s.next() yields StopIteration (for
a given map argument s) is the last time map() *tries* s.next().  That
is, if other sequence args are longer, s will never again contribute
anything but None values to the result, even if trying s.next() again
could yield another result.  This is the same behavior map() used to have
wrt IndexError, so it's the only way to be wholly backward-compatible.
I'm not a fan of letting StopIteration mean "try again later" anyway.
2001-05-03 23:54:49 +00:00
Tim Peters c307453162 Generalize max(seq) and min(seq) to work with iterators.
NEEDS DOC CHANGES.
2001-05-03 07:00:32 +00:00
Tim Peters 0e57abf0cd Generalize filter(f, seq) to work with iterators. This also generalizes
filter() to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
2001-05-02 07:39:38 +00:00
Guido van Rossum 1031582388 Add more news about iterators. 2001-05-01 20:54:30 +00:00
Tim Peters f553f89d45 Generalize list(seq) to work with iterators. This also generalizes list()
to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
This is meant to be a model for how other functions of this ilk (max,
filter, etc) can be generalized similarly.  Feel encouraged to grab your
favorite and convert it!
Note some cute consequences:
    list(file) == file.readlines() == list(file.xreadlines())
    list(dict) == dict.keys()
    list(dict.iteritems()) = dict.items()
    list(xrange(i, j, k)) == range(i, j, k)
2001-05-01 20:45:31 +00:00
Tim Peters d29abb9915 SF bug 418296: WinMain.c should use WIN32_LEAN_AND_MEAN.
I believe Kevin Rodgers here!  The old WINDOWS_LEAN_AND_MEAN has, AFAICT,
always been wrong.
2001-04-24 05:16:29 +00:00
Tim Peters 7f00deb032 SF bug #417508: 'hypot' not found with Borland C++Build. 2001-04-21 03:20:47 +00:00
Guido van Rossum ffe13be84d Noted what's new in 2.1 (final).
Hopefully this is the last checkin for 2.1!
2001-04-16 18:46:45 +00:00
Guido van Rossum 5b08f13a0c Added news for 2.1c2.
Greatly updated news for 2.1c1 (!).
2001-04-16 02:05:23 +00:00
Guido van Rossum 0aa30b0072 SF bug reporters. 2001-04-15 20:48:27 +00:00
Guido van Rossum 3024bb6e25 Another ACK. 2001-04-14 16:17:31 +00:00
Guido van Rossum 4fb60361dc Note additions to pydoc and pstats. 2001-04-13 00:46:14 +00:00
Guido van Rossum c993272786 Note that __debug__ assignments are legal again. 2001-04-12 02:31:27 +00:00
Barry Warsaw c8c1a5b7b6 (py-pdbtrack-track-stack-file): On Ken's suggestion, add "pdbtrack:"
prefix to the message lines.
2001-04-11 22:27:41 +00:00
Guido van Rossum 34d37dc5d2 Noted the improved RISCOS port and the new Unixware 7 port. 2001-04-11 21:03:32 +00:00
Barry Warsaw 11e89c72c1 Added news about the updated python-mode.el 2001-04-11 20:37:57 +00:00
Barry Warsaw 4f577d2f47 intermediate 2001-04-11 20:23:17 +00:00
Guido van Rossum 5f9f9292fb Some new names. 2001-04-10 22:22:52 +00:00
Guido van Rossum 13aa70679e Completely revamped BeOS notes, by Donn Cave (SF patch 411834). 2001-04-10 21:51:29 +00:00
Guido van Rossum 4611df0ece This is for BeOS users who want to build all the modules. It's
modified from setup.py version "1.37" to support BeOS build.

Contributed by Donn Cave (SF patch 411830).
2001-04-10 21:50:09 +00:00
Moshe Zadka a36f4a0cd6 Fixing Itamar's name, as per his request. 2001-04-09 15:23:46 +00:00
Tim Peters 3664111fb1 Get rid of useless string import, as reported by Neal Norwitz's PyChecker.py
on c.l.py.
2001-04-08 00:38:42 +00:00
Andrew M. Kuchling 88717f4825 Mention pydoc in the man page 2001-04-05 14:50:40 +00:00
Andrew M. Kuchling 68ad64af87 Remove the backed-out version requirement 2001-03-31 02:42:42 +00:00
Guido van Rossum 0d01787c13 Add Robin Thomas (author of the slice() comparability hack). 2001-03-27 17:04:37 +00:00
Jeremy Hylton f626db77df News items for my recent checkins 2001-03-23 14:18:27 +00:00
Fred Drake 4e262a9631 A small change to the C API for weakly-referencable types: Such types
must now initialize the extra field used by the weak-ref machinery to
NULL themselves, to avoid having to require PyObject_INIT() to check
if the type supports weak references and do it there.  This causes less
work to be done for all objects (the type object does not need to be
consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
2001-03-22 18:26:47 +00:00
Andrew M. Kuchling 8e9972c215 Added news items for the Distutils 2001-03-22 15:42:08 +00:00
Guido van Rossum 053ae3502c Add some news for 2.1b2. I'd still like someone else to add news
about these packages:

- distutils

- xml
2001-03-22 14:17:21 +00:00
Guido van Rossum d76f0f7a04 Added Gordon McMillan. He should've been in there ages ago. Thanks
Moshe for noticing!
2001-03-22 13:43:25 +00:00
Martin v. Löwis 0411f6f135 Add section on 2.1b2.
Report the addition of the Tix module.
2001-03-21 08:01:39 +00:00
Guido van Rossum e3955a8ce2 Add some more info about pydoc. (Can you see I'm excited?) 2001-03-02 14:05:59 +00:00
Guido van Rossum 9d0fbdeaf7 Add big news item about nested scopes, __future__, and compile-time
warnings.
2001-03-02 14:00:32 +00:00
Guido van Rossum b87df3d0ab Itamar S.T. 2001-03-02 13:37:42 +00:00
Guido van Rossum 9089b2769e ROSCOS change. 2001-03-02 06:49:50 +00:00
Guido van Rossum fb872a7c75 Dietmar Schwertberger; shuffled a bunch of Sch* names in alphabetical
order.
2001-03-02 06:48:06 +00:00
Tim Peters 03bd26dd24 Added William Tanksley. 2001-03-02 02:54:27 +00:00
Tim Peters 2fe289a21b Thank Jason Tishler and Steven Majewski for their help in the Cygwin and
MacOS X ports.  Change section header to beta 1.
2001-03-01 22:19:38 +00:00
Guido van Rossum 4a2261aee5 Add Samuele Pedroni 2001-03-01 20:36:48 +00:00
Tim Peters 1eff79674b Added blurbs about difflib, doctest and Windows import (PEP 235). 2001-03-01 02:31:33 +00:00
Andrew M. Kuchling d6a1d79d16 Mention pydoc 2001-02-28 21:05:42 +00:00
Neil Schemenauer a35c688055 Add Vladimir Marangozov's object allocator. It is disabled by default. This
closes SF patch #401229.
2001-02-27 04:45:05 +00:00
Martin v. Löwis 2a5130ed20 Document XML changes. 2001-02-27 04:21:58 +00:00
Barry Warsaw 68d486c8f4 (py-parse-state): Teach python-mode how to scan code which follows
multi-line list comprehensions.
2001-02-24 00:09:17 +00:00
Andrew M. Kuchling debc352e9c Mention the removal of soundex.c 2001-02-22 15:53:21 +00:00
Andrew M. Kuchling c5032194be Add Donovan Baarda for fixing a tortuous zlibmodule bug (but aren't they all?) 2001-02-21 02:19:44 +00:00
Barry Warsaw 715346060a (py-execute-region): This one's easy... kill the temporary file's
buffer after executing its contents.
2001-02-20 23:07:56 +00:00
Tim Peters 25a9ce371c Take a tour of hell's seedier neighborhoods to try to make winsound.Beep()
do something non-useless on Win9X boxes.  WinME unknown to me.  Someone with
NT/2000 make sure it still works there!
2001-02-19 07:06:36 +00:00
Tim Peters 3389f1999a Fixed misspelling. 2001-02-18 08:48:49 +00:00
Tim Peters 1449585529 Bug #132921: None treated differently in cmp() / sort() in 2.1a2.
Just mentioning that in the NEWS file.
2001-02-18 08:28:33 +00:00
Neil Schemenauer 6e0e91af18 Remove outdated information. Merge now dead BeOS/README-readline. I'm not
sure if that information is still relevant though.
2001-02-16 04:35:20 +00:00
Neil Schemenauer bd3e88893e Moved BeOS/README to Misc/BeOS-NOTES. 2001-02-16 03:23:11 +00:00
Neil Schemenauer d2c1abe5ed Update for install-sh (SF #103717). 2001-02-10 20:10:52 +00:00
Marc-André Lemburg 9f8cdf58a2 Patches for AIX. Checked by Benjamin Collar. 2001-02-09 09:59:06 +00:00
Tim Peters 909bc1cf63 SF bug #131225: sys.winver is still '2.0' in python 2.1a2.
SF patch #103683: Alternative dll version resources.
Changes similar to the patch.  MarkH should review.
File version and Product version text strings now 2.1a2.
64-bit file and product version numbers are now
    PY_MAJOR_VERSION, PY_MINOR_VERSION, messy, PYTHON_API_VERSION
where
    messy = PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL
Updated company name to "Digital Creations 2".
Copyright now lists Guido; "C in a circle" symbol used instead of (C).
Comments added so this is less likely to get flubbed again, and
#if/#error guys added to trigger if the version number manipulations
above overflow.
2001-02-09 07:02:22 +00:00
Jeremy Hylton 0872d9d2c2 Fixed UnboundLocalError for nested scopes 2001-02-05 17:36:46 +00:00
Martin v. Löwis e214baa209 Fix binfmt_register documentation to always register the right magic. 2001-02-04 22:37:56 +00:00
Tim Peters d66595fe42 Renamed _testXXX to _testcapiXXX. Jack is my hero -- good call! 2001-02-04 03:09:53 +00:00
Neil Schemenauer 693291ba23 Superseded by $(srcdir)/Makefile.pre.in. 2001-02-03 17:18:21 +00:00
Guido van Rossum ba38123b75 Clarify the news item about "from M import X" if "M is not a real
module" after a complaint from Tim.
2001-02-03 15:06:40 +00:00
Tim Peters b16c56f0ba Teach Windows build and installer about new _symtable module/DLL. 2001-02-02 21:24:51 +00:00
Jeremy Hylton d6b1cf9a55 Fix spelling errors.
Add note about _symtable.
Add note that 'from ... import *' restriction may go away -- and move
the whole entry closer to the top, because it might bite people.
2001-02-02 20:06:28 +00:00
Tim Peters 9ea17ac595 Patch derived from Trent's 101162: a Python/C API testing framework.
STILL NEEDS UNIX BUILD CHANGES.
2001-02-02 05:57:15 +00:00
Jeremy Hylton 4c4fda0f57 add info about Grant Edwards' raw packet support 2001-02-02 03:29:24 +00:00
Jeremy Hylton 0072d5aa33 continue now allowed in try block 2001-02-01 22:53:15 +00:00
Jeremy Hylton 4589bd82da Add item about nested scopes.
Revise item about restriction on 'from ... import *'.  It was in the
wrong section and the section restriction was removed.
2001-02-01 20:38:45 +00:00
Fred Drake fb9d712721 Added comments about the weak reference support. 2001-02-01 20:00:40 +00:00
Tim Peters 0de88fc4b1 Change random.seed() so that it can get at the full range of possible
internal states.  Put the old .seed() (which could only get at about
the square root of the # of possibilities) under the new name .whseed(),
for bit-level compatibility with older versions.  This occurred to me
while reviewing effbot's book (he found himself stumbling over .seed()
more than once there ...).
2001-02-01 04:59:18 +00:00
Barry Warsaw 30dbd1429a Document the two changes to the mailbox.py module:
- All constructors grow an optional argument `factory' which is a
  callable used when new message instances are created by the next()
  methods.  Defaults to the rfc822.Message class.

- A new subclass of UnixMailbox is added, called PortableUnixMailbox.
  It's identical to UnixMailbox, but uses a more portable test for
  From_ delimiter lines.  With PortableUnixMailbox, any line that
  starts with "From " is considered a delimiter (this should really
  check for two newlines before the F, but it doesn't.
2001-01-31 22:14:01 +00:00
Tim Peters ee826f88c9 Docs for new Windows zlib build procedure. 2001-01-31 19:39:44 +00:00
Jeremy Hylton 69c327988a add note about two kinds of illegal imports that are now checked 2001-01-30 01:27:28 +00:00
Moshe Zadka 6af0ce0501 Added news of function comparison and hashing by identity 2001-01-29 06:41:00 +00:00
Tim Peters 0149e84af2 SF bug #130306: statcache.py full of thread problems.
Fixed the thread races.  Function forget_dir was also utterly Unix-specific.
2001-01-28 05:07:00 +00:00
Tim Peters 547397c45b SF bug http://sourceforge.net/bugs/?func=detailbug&bug_id=130242&group_id=5470
SF patch http://sourceforge.net/patch/?func=detailpatch&patch_id=103453&group_id=5470
PyMember_Set of T_CHAR always raises exception.
Unfortunately, this is a use of a C API function that Python itself never makes, so
there's no .py test I can check in to verify this stays fixed.  But the fault in the
code is obvious, and Dave Cole's patch just as obviously fixes it.
2001-01-27 06:20:08 +00:00