Commit Graph

29444 Commits

Author SHA1 Message Date
Armin Rigo 1515fc2a01 A 2% speed improvement with gcc on low-endian machines. My guess is that this
new pattern for NEXTARG() is detected and optimized as a single (*short)
loading.
2004-03-20 20:03:17 +00:00
Guido van Rossum 09240f65f8 GCC was complaining that 'value' in dictiter_iternextvalue() wasn't
necessarily always set before used.  Between Tim, Armin & me we
couldn't prove GCC wrong, so we decided to fix the algorithm.  This
version is Armin's.
2004-03-20 19:11:58 +00:00
Raymond Hettinger fe703e0650 SF bug #918371: hasattr()'s return type
Replace 1 and 0 with True and False.
2004-03-20 18:25:31 +00:00
Thomas Wouters 0813d76cb0 Merge in Anthony's new parser code, from the anthony-parser-branch:
> ----------------------------
> revision 1.20.4.4
> date: 2003/06/12 09:14:17;  author: anthonybaxter;  state: Exp;  lines: +13 -6
> preamble is None when missing, not ''.
> Handle a couple of bogus formatted messages - now parses my main testsuite.
> Handle message/external-body.
> ----------------------------
> revision 1.20.4.3
> date: 2003/06/12 07:16:40;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> epilogue-processing is now the same as the old parser - the newline at the
> end of the line with the --endboundary-- is included as part of the epilogue.
> Note that any whitespace after the boundary is _not_ part of the epilogue.
> ----------------------------
> revision 1.20.4.2
> date: 2003/06/12 06:39:09;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> message/delivery-status fixed.
> HeaderParser fixed.
> ----------------------------
> revision 1.20.4.1
> date: 2003/06/12 06:08:56;  author: anthonybaxter;  state: Exp;  lines: +163 -129
> A work-in-progress snapshot of the new parser. A couple of known problems:
>
> - first (blank) line of MIME epilogues is being consumed
> - message/delivery-status isn't quite right
>
> It still needs a lot of cleanup, but right now it parses a whole lot of
> badness that the old parser failed on. I also need to think about adding
> back the old 'strict' flag in some way.
> =============================================================================
2004-03-20 17:31:29 +00:00
Tim Peters d4079e1fc2 Update copyright years, and change copyright.tex to use the same spelling
as license.tex (SF patch 795531 complained about the spelling discrepancy,
although this "repairs" that flaw in a different way than the patch).
2004-03-20 17:24:51 +00:00
Fred Drake 6fd0b0d5ba commit the portion of PyXML patch #919008 that is relevant to the
standard library:
str() of xml.sax.SAXParseException should not fail if the line and/or
column number returned by the locator are None
(tests added)
2004-03-20 08:15:30 +00:00
Fred Drake 9de0a2ba9d fix two typos that turned text into markup 2004-03-20 08:13:32 +00:00
Tim Peters bd6850f6cb Ignore oodles of MSVC-generated files. 2004-03-20 05:00:56 +00:00
Tim Peters 4ae4f2658b A helper for rt.bat, copied (but with path adjustment) from PCbuild. 2004-03-20 04:57:32 +00:00
Fred Drake 086a0f79cd PyFile_WriteObject(): some of the local variables are only used when
Py_USING_UNICODE is defined
2004-03-19 15:22:36 +00:00
Skip Montanaro 8e6ad6fbe9 Expand on the semantics of reload(). Closes #919099. 2004-03-19 15:20:16 +00:00
Raymond Hettinger 0690512a7d Factor out a double lookup. 2004-03-19 10:30:00 +00:00
Hye-Shik Chang 4a7ad1a27d Add an entry for addition of the ptcp154 codec. 2004-03-19 08:11:56 +00:00
Hye-Shik Chang 5c5316f111 Add a new unicode codec: ptcp154 (Kazakh) 2004-03-19 08:06:07 +00:00
Raymond Hettinger 435bf58b7b Make iterators length transparent where possible. 2004-03-18 22:43:10 +00:00
Raymond Hettinger 1e5809ff02 Improve deque iteration.
* The default __reversed__ performed badly, so reintroduced a custom
  reverse iterator.
* Added length transparency to improve speed with map(), list(), etc.
2004-03-18 11:04:57 +00:00
Raymond Hettinger ade08ea8a8 Add news entries for the dictionary optimizations. 2004-03-18 09:48:12 +00:00
Raymond Hettinger 0ce6dc8530 Make the new dictionary iterators transparent with respect to length.
This gives another 30% speedup for operations such as
map(func, d.iteritems()) or list(d.iteritems()) which can both take
advantage of length information when provided.
2004-03-18 08:38:00 +00:00
Hye-Shik Chang 0e5e6c70e6 Ignore error status codes occurred while compiling site-packages
directory.
2004-03-18 07:51:27 +00:00
Brett Cannon d1de45f549 Fix capitalization of title for subsection 2. 2004-03-18 07:37:15 +00:00
Raymond Hettinger 019a148c72 Optimize dictionary iterators.
* Split into three separate types that share everything except the
  code for iternext.  Saves run time decision making and allows
  each iternext function to be specialized.

* Inlined PyDict_Next().  In addition to saving a function call, this
  allows a redundant test to be eliminated and further specialization
  of the code for the unique needs of each iterator type.

* Created a reusable result tuple for iteritems().  Saves the malloc
  time for tuples when the previous result was not kept by client code
  (this is the typical use case for iteritems).  If the client code
  does keep the reference, then a new tuple is created.

Results in a 20% to 30% speedup depending on the size and sparsity
of the dictionary.
2004-03-18 02:41:19 +00:00
Brett Cannon 65d63424b4 Minor grammatical fixes. 2004-03-18 01:38:11 +00:00
Brett Cannon 9b976e6636 Extremely minor typo fixed. 2004-03-18 00:49:01 +00:00
Raymond Hettinger 4344278250 Dictionary optimizations:
* Factored constant structure references out of the inner loops for
  PyDict_Next(), dict_keys(), dict_values(), and dict_items().
  Gave measurable speedups to each (the improvement varies depending
  on the sparseness of the dictionary being measured).

* Added a freelist scheme styled after that for tuples.  Saves around
  80% of the calls to malloc and free.  About 10% of the time, the
  previous dictionary was completely empty; in those cases, the
  dictionary initialization with memset() can be skipped.
2004-03-17 21:55:03 +00:00
Raymond Hettinger 969d8c0c8c Add missing decref 2004-03-17 05:24:23 +00:00
Raymond Hettinger 0faa1ca51d Speedup the inner loops for dropwhile(), islice(), ifilter(), and
ifilterfalse().
2004-03-17 04:27:44 +00:00
Skip Montanaro bdda9f389a The example files need to be opened with the "b" flag. 2004-03-17 01:24:17 +00:00
Gregory P. Smith 1281f76606 * supply a more useful error message when append() is called on the
wrong type of database in dbshelve.
* fix a typo in the exception name when checking args
2004-03-16 18:50:26 +00:00
Gregory P. Smith bce64ec086 bugfix for people executing test_all to run the test suite. (call the
correct function)
2004-03-16 07:07:06 +00:00
Gregory P. Smith 0c65771f92 fixes SF bug 914019 - DB.has_key was not honoring its txn argument 2004-03-16 06:56:58 +00:00
Kurt B. Kaiser 6e4620bfb1 1. Make builtin foreground Royal Purple instead of Barney Purple.
2. Touch up help.txt

M config-highlight.def
M help.txt
2004-03-16 03:36:41 +00:00
Raymond Hettinger 9d5c44307a Fix typos and add some elaborations 2004-03-15 15:52:22 +00:00
Walter Dörwald cd1e8a9485 Port test_binascii.py to PyUnit and enhance tests.
Code coverage for binascii.c is at 92%.
From SF patch #736962.
2004-03-15 12:07:38 +00:00
Raymond Hettinger d4ff741e78 Revert last change. Found an application that was worse off with resize
exact turned on.  The tiny space savings wasn't worth the additional time
and code.
2004-03-15 09:01:31 +00:00
Kurt B. Kaiser 0bc3d9857f 1. Bug in Patch 805830 fixed by Nigel Rowe
2. Convert 1/0 to True/False
3. Fix a couple of long lines

M ColorDelegator.py
M NEWS.txt
2004-03-15 04:26:37 +00:00
Raymond Hettinger 325d169a54 Eliminate an unnecessary test on a common code path. 2004-03-15 00:16:34 +00:00
Raymond Hettinger deb4da500b Add missing docstrings. 2004-03-14 07:54:37 +00:00
Raymond Hettinger 0e91643bd2 list_resize() now has an "exact" option for bypassing the overallocation
scheme in situations that likely won't benefit from it.  This further
improves memory utilization from Py2.3 which always over-allocates
except for PyList_New().

Situations expected to benefit from over-allocation:
    list.insert(), list.pop(), list.append(), and list.extend()

Situations deemed unlikely to benefit:
    list_inplace_repeat, list_ass_slice, list_ass_subscript

The most gray area was for listextend_internal() which only runs
when the argument is a list or a tuple.  This could be viewed as
a one-time fixed length addition or it could be viewed as wrapping
a series of appends.  I left its over-allocation turned on but
could be convinced otherwise.
2004-03-14 06:42:23 +00:00
Raymond Hettinger 49f9bd15ff SF feature request #686323: Minor array module enhancements
array.extend() now accepts iterable arguments implements as a series
of appends.  Besides being a user convenience and matching the behavior
for lists, this the saves memory and cycles that would be used to
create a temporary array object.
2004-03-14 05:43:59 +00:00
Raymond Hettinger 6e2ee866fa Update the array overallocation scheme to match the approach used for
lists.  Speeds append() operations and reduces memory requirements
(because of more conservative overallocation).

Paves the way for the feature request for array.extend() to support
arbitrary iterable arguments.
2004-03-14 04:37:50 +00:00
Jack Jansen 118e1277a6 Two issues spotted by Ronald OUssoren:
- there were no accessor functions for the global per-database fields
- packages and their dependencies were installed in order in stead
  of in reverse order.
2004-03-13 23:50:48 +00:00
Jack Jansen c32cec14b4 Don't use "dict" as a variable, it shadows the builtin. Spotted by
Bob Ippolito.
2004-03-13 23:32:47 +00:00
Skip Montanaro 6e098a15a3 compile.h and eval.h weren't being included which kept a fair bit of the
public API from being exposed by simply including Python.h (as recommended).
2004-03-13 23:11:44 +00:00
Jack Jansen 0576d0a48a Force option should be applied to a single package, not recursively
to its dependencies. Fixes #733819.
2004-03-13 23:03:38 +00:00
Raymond Hettinger 4eec95ad2a SF patch #906501: Fix typos in pystate.h comments
(Contributed by Greg Chapman.)
2004-03-13 20:45:47 +00:00
Raymond Hettinger 2d95f1ad57 SF patch #911431: robot.txt must be robots.txt
(Contributed by George Yoshida.)
2004-03-13 20:27:23 +00:00
Raymond Hettinger 3aa82c07f7 SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
2004-03-13 18:18:51 +00:00
Raymond Hettinger 42bec93e5c Make PySequence_Fast_ITEMS public. (Thanks Skip.) 2004-03-12 16:38:17 +00:00
Raymond Hettinger fba1cfc49a LIST_APPEND is predicably followed by JUMP_ABSOLUTE.
Reduces loop overhead by an additional 10%.
2004-03-12 16:33:17 +00:00
Raymond Hettinger 6e058d70ef * Eliminate duplicate call to PyObject_Size().
(Spotted by Michael Hudson.)

* Now that "selflen" is no longer inside a loop, it should not be a
  register variable.
2004-03-12 15:30:38 +00:00