Commit Graph

20525 Commits

Author SHA1 Message Date
Tim Peters 1fc240e851 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).
2001-10-26 05:06:50 +00:00
Guido van Rossum b016da3b83 Update. __dict__ assignment done. Reorder remaining "to do" items by
priority.  Add tp_cache; add some comments to others.
2001-10-26 04:31:54 +00:00
Guido van Rossum 6661be3bed Allow assignment to newinstance.__dict__. 2001-10-26 04:26:12 +00:00
Guido van Rossum 0afde13b43 Fix two typos, one noted by Noah Spurrier in SF bug #475166, the
second noted after a second's thought about what the next line should
do. :-(
2001-10-26 03:38:46 +00:00
Guido van Rossum 9f7a539afe 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().)

2.1.2 "bugfix" candidate.
2001-10-26 03:25:00 +00:00
Fred Drake af07b2c34f 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.
2001-10-26 03:09:27 +00:00
Fred Drake 7f10cce4c1 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.  ;-(
2001-10-26 03:04:23 +00:00
Fred Drake 3a2c462436 Minor textual adjustment, and style-guide conformance (no use of "iff"). 2001-10-26 03:00:39 +00:00
Barry Warsaw 2539cf5aad A fix for SF bug #472560, extra newlines returned by get_param() when
the separating semi-colon shows up on a continuation line (legal, but
weird).

Bug reported and fixed by Matthew Cowles.  Test case and sample email
included.
2001-10-25 22:43:46 +00:00
Jack Jansen e674ca737d Added various tidbits. 2001-10-25 22:26:00 +00:00
Barry Warsaw d970fe4022 I went back and figured out the release date for Python 2.2a1. 2001-10-25 21:53:30 +00:00
Barry Warsaw 107771a228 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.

Doc and unittest updates too.
2001-10-25 21:49:18 +00:00
Fred Drake 9cd0efcee9 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.
2001-10-25 21:38:59 +00:00
Fred Drake 61f794918f Typo: NamedNodeList --> NamedNodeMap 2001-10-25 20:42:57 +00:00
Guido van Rossum a0dfc8577d Fix SF bug #474538: Memory (reference) leak in poller.register (Dave Brueck)
Replace some tortuous code that was trying to be clever but forgot to
DECREF the key and value, by more longwinded but obviously correct
code.

(Inspired by but not copying the fix from SF patch #475033.)
2001-10-25 20:18:35 +00:00
Fred Drake b112481f12 Ignore the posixfile deprecation warning for the test suite. 2001-10-25 18:11:10 +00:00
Guido van Rossum 70e3688364 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.)
2001-10-25 18:07:22 +00:00
Fred Drake 847c51a181 Slightly better conformance to the Python C style guide. 2001-10-25 15:53:44 +00:00
Fred Drake af876d77e0 One more LaTeX-ism that we'd rather ignore. 2001-10-25 15:14:57 +00:00
Fred Drake a281665972 No need to run make twice here. 2001-10-25 15:13:30 +00:00
Fred Drake 0099d8f8fb Update the rules so that changes to the HTML stylesheet cause appropriate
work to be done, but do not require the HTML to be re-built.
2001-10-25 15:12:31 +00:00
Martin v. Löwis 7c4b5faa93 After discussion with itojun, it was clarified that Tru64 is in error,
and that the work-around should be restricted to that system.
2001-10-25 09:04:03 +00:00
Fredrik Lundh 703ce8122c (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.
2001-10-24 22:16:30 +00:00
Fred Drake 9242a4af17 Add a warning to the posixfile module stating that it will go away. 2001-10-24 22:03:35 +00:00
Fred Drake bc006af3d0 Make the deprecation notice use the same form as other such notices.
This has sat around in a deprecated state for a *long* time!
2001-10-24 21:56:59 +00:00
Fred Drake 0559d95fd6 Minor revision of the text. 2001-10-24 21:10:52 +00:00
Guido van Rossum 491921467c Note updated RISCOS port. Remove reference in the 2.1 release notes
to os.extsep -- that variable actually didn't exist in that release!
2001-10-24 20:51:44 +00:00
Fred Drake a768882b00 Convert getrefcount() to METH_O, and sys_excepthook() to use
PyArg_UnpackTuple().
2001-10-24 20:47:48 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Tim Peters c6ac8a78f6 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.
2001-10-24 20:22:40 +00:00
Guido van Rossum e877f8ba33 SF patch #474590 -- RISC OS support 2001-10-24 20:13:15 +00:00
Guido van Rossum 622cc03f0b SF patch #474590 -- RISC OS support 2001-10-24 20:04:51 +00:00
Fred Drake 08fd51509c 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.

Flesh out the vague reference to __import__().
2001-10-24 19:50:31 +00:00
Martin v. Löwis b8fc972100 Fix typo. Thanks to Jack Jansen for spotting it. 2001-10-24 17:35:46 +00:00
Martin v. Löwis eb9b103296 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.
2001-10-24 17:10:49 +00:00
Martin v. Löwis 861a65bc2f Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
2001-10-24 14:36:00 +00:00
Jack Jansen 6bc55c435a Oops, undo previous change, which wasn't supposed to escape from my
machine. Luckily everyone is asleep, so I didn't have to use the time
machine.
2001-10-24 08:49:59 +00:00
Jack Jansen 72af01aac6 Added missing cast. 2001-10-23 22:29:06 +00:00
Jack Jansen e54968a11a Some escaped newlines had spaces between the backslash and the newline. Also slightly changed the comment on xstat(). 2001-10-23 22:28:23 +00:00
Jack Jansen 9ca14ec7cc New URL for Joe Strouts example page. 2001-10-23 22:27:17 +00:00
Jack Jansen 963659af29 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. 2001-10-23 22:26:16 +00:00
Jack Jansen 6f1da007b9 Added _hotshot. 2001-10-23 22:23:44 +00:00
Jack Jansen a43ad368ba quit() wasn't included in the suite. This is a quick manual patch to add it. 2001-10-23 22:23:02 +00:00
Jack Jansen 5d528b787e Tweaks for MacPython 2.2b1 2001-10-23 22:22:09 +00:00
Jack Jansen 8626aeb1ce Tweaks for MacPython 2.2b1. 2001-10-23 22:18:10 +00:00
Guido van Rossum 83c3281826 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.)
2001-10-23 21:42:45 +00:00
Guido van Rossum 00ebd46dfc SF patch #474175 (Jay T Miller): file.readinto arg parsing bug
The C-code in fileobject.readinto(buffer) which parses
    the arguments assumes that size_t is interchangeable
    with int:

	    size_t ntodo, ndone, nnow;

	    if (f->f_fp == NULL)
		    return err_closed();
	    if (!PyArg_Parse(args, "w#", &ptr, &ntodo))
		    return NULL;

    This causes a problem on Alpha / Tru64 / OSF1 v5.1
    where size_t is a long and sizeof(long) != sizeof(int).

    The patch I'm proposing declares ntodo as an int.  An
    alternative might be to redefine w# to expect size_t.

[We can't change w# because there are probably third party modules
relying on it. GvR]
2001-10-23 21:25:24 +00:00
Fred Drake 0d429e8cdd Convert the ref() and proxy() implementations to use the new
PyArg_UnpackTuple() function (serves as an example and test case).
2001-10-23 21:12:47 +00:00
Fred Drake c84f2c5068 Documentation for the new PyArg_UnpackTuple() function. 2001-10-23 21:10:18 +00:00
Fred Drake e4616e6752 PyArg_UnpackTuple(): New argument unpacking function suggested by Jim
Fulton, based on code Jim supplied.
2001-10-23 21:09:29 +00:00