Jeremy Hylton [Wed, 3 Jan 2001 23:52:36 +0000 (23:52 +0000)]
Revised implementation of CALL_FUNCTION and friends.
More revision still needed.
Much of the code that was in the mainloop was moved to a series of
helper functions. PyEval_CallObjectWithKeywords was split into two
parts. The first part now only does argument handling. The second
part is now named call_object and delegates the call to a
call_(function,method,etc.) helper.
XXX The call_XXX helper functions should be replaced with tp_call
functions for the respective types.
The CALL_FUNCTION implementation contains three kinds of optimization:
1. fast_cfunction and fast_function are called when the arguments on
the stack can be passed directly to eval_code2() without copying
them into a tuple.
2. PyCFunction objects are dispatched immediately, because they are
presumed to occur more often than anything else.
3. Bound methods are dispatched inline. The method object contains a
pointer to the function object that will be called. The function
is called from within the mainloop, which may allow optimization #1
to be used, too.
The extened call implementation -- f(*args) and f(**kw) -- are
implemented as a separate case in the mainloop. This allows the
common case of normal function calls to execute without wasting time
on checks for extended calls, although it does introduce a small
amount of code duplication.
Also, the unused final argument of eval_code2() was removed. This is
probably the last trace of the access statement :-).
This patch changes the default behaviour of the builtin charmap
codec to not apply Latin-1 mappings for keys which are not found
in the mapping dictionaries, but instead treat them as undefined
mappings.
The patch was originally written by Martin v. Loewis with some
additional (cosmetic) changes and an updated test script
by Marc-Andre Lemburg.
The standard codecs were recreated from the most current files
available at the Unicode.org site using the Tools/scripts/gencodec.py
tool.
Patch by kragen@pobox.com: When tracing is turned on, lines shorter
than a pixel don't get drawn at all. If you're building long curves
made of such lines, this is a bad thing.
Thomas Wouters [Sun, 31 Dec 2000 22:52:59 +0000 (22:52 +0000)]
Change documentation of 'else' clause of 'try/except' to make clear that it
doesn't get triggered by 'return', 'break' or 'continue'. If the
'try-inside-continue' patch does not get accepted before next release, the
'or continue' should be removed ;P
Tim Peters [Sat, 30 Dec 2000 22:21:22 +0000 (22:21 +0000)]
Christmas present to myself: changed regrtest in two ways:
1. When running in verbose mode, if any test happens to pass, print
a warning that the apparent success may be bogus (stdout isn't
compared in verbose mode). Been fooled by that too often.
2. When a test fails because the expected stdout doesn't match the
actual stdout, print as much of stdout as did match before the
first failing write. Else we get failures of the form "expected
'a', got 'b'" and a glance at the expected output file shows
500 instances of 'a' -- no idea where it failed, and, as in #1,
trying to run in verbose mode instead doesn't help because
stdout isn't compared then.
Tim Peters [Fri, 29 Dec 2000 02:17:56 +0000 (02:17 +0000)]
getopt used to sort the long option names, in an attempt to simplify
the logic. That resulted in a bug. My previous getopt checkin repaired
the bug but left the sorting. The solution is significantly simpler if
we don't bother sorting at all, so this checkin gets rid of the sort and
the code that relied on it.
Tim Peters [Fri, 29 Dec 2000 02:06:45 +0000 (02:06 +0000)]
Fred, THIS NEEDS DOCS! The function docstrings tell the tale.
Christmas present to myself: the bisect module didn't define what
happened if the new element was already in the list. It so happens
that it inserted the new element "to the right" of all equal elements.
Since it wasn't defined, among other bad implications it was a mystery
how to use bisect to determine whether an element was already in the
list (I've seen code that *assumed* "to the right" without justification).
Added new methods bisect_left and insort_left that insert "to the left"
instead; made the old names bisect and insort aliases for the new names
bisect_right and insort_right; beefed up docstrings to explain what
these actually do; and added a std test for the bisect module.
Martin v. Löwis [Thu, 28 Dec 2000 18:40:56 +0000 (18:40 +0000)]
Merge changes up to 1.10 from PyXML:
- implement hasAttribute and hasAttributeNS (1.7)
- Node.replaceChild(): Update the sibling nodes to point to newChild. Set
the .nextSibling attribute on oldChild instead of adding a .newChild
attribute (1.9).
Barry Warsaw [Wed, 27 Dec 2000 17:41:47 +0000 (17:41 +0000)]
(python-font-lock-keywords): Add highlighting of `as' as a keyword,
but only in "import foo as bar" statements (including optional
preceding `from' clause).
Tim Peters [Wed, 27 Dec 2000 08:05:05 +0000 (08:05 +0000)]
Fix for SF bug
https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
"getopt long option handling broken". Tossed the excruciating logic in
long_has_args in favor of something obviously correct.
Fred Drake [Sat, 23 Dec 2000 22:12:07 +0000 (22:12 +0000)]
The "context" parameter to the ExternalEntityRefParameter exposes internal
information from the Expat library that is not part of its public API.
Do not print this information as the format of the string may (and will)
change as Expat evolves.
Add additional tests to make sure the ParserCreate() function raises the
right exceptions on illegal parameters.
Choose the smallest value of x,y for the clock's radius (instead of just taking the
y coordinate), and change radius of second indicator to compensate
Remove redundant setting of sradius
Patch #102813: add a wrapper for the panel library included with ncurses.
Original version written by Thomas Gellekum, reshaped into a separate
module by AMK.
Patch #102492, fixing bug #116677:
give minidom.py behaviour that complies with the DOM Level 1 REC,
which says that when a node newChild is added to the tree, "if the
newChild is already in the tree, it is first removed."
pulldom.py is patched to use the public minidom interface instead
of setting .parentNode itself. Possibly this reduces pulldom's
efficiency; someone else will have to pronounce on that.
Patch #102955, fixing one of the warnings in bug #121479:
Simplifies ord()'s logic at the cost of some code duplication, removing a
" `ord' might be used uninitialized in this function" warning
Guido van Rossum [Tue, 19 Dec 2000 18:25:58 +0000 (18:25 +0000)]
Adding a warning about the regsub module. This also disables further
warnings in this same module, to prevent getting a warning about
importing regex (we *know* that it's obsolete :-).
Guido van Rossum [Tue, 19 Dec 2000 18:21:39 +0000 (18:21 +0000)]
Adding a warning about the regex module. This is the first official
use of PyErr_Warn()! This module is a good guinea pig because it's
been obsolete since 1.5.0 was released.
Guido van Rossum [Tue, 19 Dec 2000 16:48:13 +0000 (16:48 +0000)]
Be explicit about scheme_chars -- string.letters is locale dependent
so we can't use it.
While I'm at it, got rid of string module use. (Found several new
hard special cases for a hypothetical conversion tool: from string
import join, find, rfind; and a local assignment "find=string.find".)
Guido van Rossum [Tue, 19 Dec 2000 03:58:11 +0000 (03:58 +0000)]
Oops. The value "0 or +1" for the category argument of PyErr_Warn()
doesn't work. Make it 0. (Although it really *should* be 0 or +1 --
the refcount is incremented when it is raised as an exception, but not
otherwise.)