Tim Peters [Fri, 26 Oct 2001 20:57:38 +0000 (20:57 +0000)]
dict_constructor(): The last test was passing for the wrong reason (it
was intended to verify that sub-sequences of lengths 1 and 3 raise
ValueError, but was actually testing string lengths).
Fill in remaining XXX spots
- Describe UnpackTuple()
- Credit __unicode__ to MAL
Use \pep macro everywhere in body text.
(Listening to "The Great Gate of Kiev" -- appropriately triumphal
music for this check-in...)
Fred Drake [Fri, 26 Oct 2001 18:37:27 +0000 (18:37 +0000)]
Add notes pointing out that these classes are kept for backward compatibility
and suggeest that new code that does not require compatibility with older
Python versions subclass dictionary, list, or str.
Fred Drake [Fri, 26 Oct 2001 17:56:51 +0000 (17:56 +0000)]
Be smarter about clearing the weakref lists for instances, instance methods,
and functions: we only need to call PyObject_ClearWeakRefs() if the weakref
list is non-NULL. Since these objects are common but weakrefs are still
unusual, saving the call at deallocation time makes a lot of sense.
Fred Drake [Fri, 26 Oct 2001 16:21:32 +0000 (16:21 +0000)]
Added two new functions to conveniently call functions/methods from C.
PyObject_CallFunctionObArgs() and PyObject_CallMethodObArgs() have the
advantage that no format strings need to be parsed. The CallMethod
variant also avoids creating a new string object in order to retrieve
a method from an object as well.
Fred Drake [Fri, 26 Oct 2001 14:16:23 +0000 (14:16 +0000)]
Clean up the tables of child links generated by stock LaTeX2HTML so we get
consistent (lack of) vertical space between sections, and remove some of the
unnecessary cruft that was added in (finally we get to *remove* something
that got generated!).
Tim Peters [Fri, 26 Oct 2001 05:06:50 +0000 (05:06 +0000)]
Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).
dictobject.c, new functions PyDict_{Merge,Update}FromSeq2. These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object. For now, I left these
functions file static, so no corresponding doc changes. It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.
Also changed the name of dictionary's keyword argument from "mapping"
to "x". Got a better name? "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.
abstract.h, abstract.tex: Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.
libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
iteration, or an iterator object" is getting to be a PITA. Many
months ago I suggested factoring this out into "iterable object",
where the definition of that could include being explicit about
generators too (as is, I'm not sure a reader outside of PythonLabs
could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.
abstract.c, PySequence_Tuple(): When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
Guido van Rossum [Fri, 26 Oct 2001 03:25:00 +0000 (03:25 +0000)]
Add sendall() method, which loops until all data is written or an
error occurs, and doesn't return a count. (This is my second patch
from SF patch #474307, with small change to the docstring for send().)
Fred Drake [Fri, 26 Oct 2001 03:09:27 +0000 (03:09 +0000)]
Add yet more markup that let's a stylesheet pick out a small bit of the
presentation. This is acceptable since it only occurs in the formatted
output and does not affect the document markup.
Fred Drake [Fri, 26 Oct 2001 03:04:23 +0000 (03:04 +0000)]
Enforce a bit of markup consistency.
When describing a Boolean return value, use "true" and "false" instead of
"1" and "0".
Style-guide conformance: no "iff" -- to obscure for many readers. ;-(
Barry Warsaw [Thu, 25 Oct 2001 21:49:18 +0000 (21:49 +0000)]
Applying proposed patch for bug #474583, optional support for
non-standard but common types. Including Martin's suggestion to add
rejected non-standard types from patch #438790. Specifically,
guess_type(), guess_extension(): Both the functions and the methods
grow an optional "strict" flag, defaulting to true, which determines
whether to recognize non-standard, but commonly found types or not.
Also, I sorted, reformatted, and culled duplicates from the big
types_map dictionary. Note that there are a few non-equivalent
duplicates (e.g. .cdf and .xls) for which the first will just get
thrown away. I didn't remove those though.
Finally, use of the module as a script as grown the -l and -e options
to toggle strictness and to do guess_extension(), respectively.
Fred Drake [Thu, 25 Oct 2001 21:38:59 +0000 (21:38 +0000)]
Use PyDict_Copy() and PyDict_Update() instead of using PyObject_CallMethod()
to call the corresponding methods. This is not a performance improvement
since the times are still swamped by disk I/O, but cleans up the code just
a little.
Guido van Rossum [Thu, 25 Oct 2001 18:07:22 +0000 (18:07 +0000)]
complex_subtype_from_string(): move the declaration of s_buffer[] out
of the if block where it was before. The name is only used inside
that if block, but the storage is referenced outside it via the 's'
variable.
(This patch was part of SF patch #474590 -- RISC OS support.)
Fredrik Lundh [Wed, 24 Oct 2001 22:16:30 +0000 (22:16 +0000)]
(experimental) "finditer" method/function. this works pretty much
like findall, but returns an iterator (which returns match objects)
instead of a list of strings/tuples.
Tim Peters [Wed, 24 Oct 2001 20:22:40 +0000 (20:22 +0000)]
SF bug #473525 pyclbr broken
As the comments in the module implied, pyclbr was easily confused by
"strange stuff" inside single- (but not triple-) quoted strings. It
isn't anymore. Its behavior remains flaky in the presence of nested
functions and classes, though.
Bugfix candidate.
Fred Drake [Wed, 24 Oct 2001 19:50:31 +0000 (19:50 +0000)]
When describing "import *", add a level of indirection between "*" and the
set of names imported (the "public names"), adding a definition of "public
names" that describes the use of __all__.
This closes SF bug #473986.
Martin v. Löwis [Wed, 24 Oct 2001 17:10:49 +0000 (17:10 +0000)]
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
STRICT_SYSV_CURSES when compiling curses module on HP/UX. Generalize
access to _flags on systems where WINDOW is opaque. Fixes bugs
#432497, #422265, and the curses parts of #467145 and #473150.
Martin v. Löwis [Wed, 24 Oct 2001 14:36:00 +0000 (14:36 +0000)]
Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
Jack Jansen [Tue, 23 Oct 2001 22:26:16 +0000 (22:26 +0000)]
Got this to work in MacPython. The code is #ifdef macintosh style (to match the existing #ifdef MS_WINDOWS), but eventually ifdeffing on configure features is probably better.
Guido van Rossum [Tue, 23 Oct 2001 21:42:45 +0000 (21:42 +0000)]
Apply the first chunk of the second patch from SF bug #471720:
ThreadingMixIn/TCPServer forgets close (Max Neunhöffer).
This ensures that handle_error() and close_request() are called when
an error occurs in the thread.
(I am not applying the second chunk of the patch, which moved the
finish() call into the finally clause in BaseRequestHandler's __init__
method; that would be a semantic change that I cannot accept at this
point - the data would be sent even if the handler raised an
exception.)
Tim Peters [Tue, 23 Oct 2001 02:21:52 +0000 (02:21 +0000)]
SF bug [#473864] doctest expects spurios space.
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.
Fred Drake [Mon, 22 Oct 2001 21:45:25 +0000 (21:45 +0000)]
Fixed denial-of-weak-ref-support test; Jeremy changed the error message
used by the weakref code since he didn't like the word "referencable".
Is it really necessary to be more specific than to test for TypeError here,
though?
Patch #473187: Add a test script that exercises most of the functions in
the curses module. It's not run automatically; '-u curses' must be
specified as an argument to regrtest
Fred Drake [Mon, 22 Oct 2001 15:07:16 +0000 (15:07 +0000)]
Do a little bit more to try and add <link> elements to the header, not that
Mozilla 0.9.5 can make intelligent use of them. Specifically, this causes
the "Acknowledgements" and "Global Module Index" pages to acquire "up"
links in the Mozilla "Site Navigation Bar".
This partially responds to SF bug #469772.
Fred Drake [Mon, 22 Oct 2001 14:18:23 +0000 (14:18 +0000)]
Clarify that the resource module does not attempt to mask platform
differences by defining symbols not defined on particular platforms.
This closes SF bug #473433.