Commit Graph

22472 Commits

Author SHA1 Message Date
Fred Drake a030c768af Many minor markup adjustments for consistency. 2002-05-02 17:55:26 +00:00
Fred Drake 4d707a5d08 Remove extra period produced by previous change. 2002-05-02 17:54:18 +00:00
Martin v. Löwis a066f46b9b Patch 550804: Make os.environ.copy() return a copy. 2002-05-02 17:39:19 +00:00
Fred Drake e0e890a4da Added regression tests for xrange object attributes.
See SF bug #551285.
2002-05-02 16:07:44 +00:00
Fred Drake edb51bb7e8 Fix attribute access for the xrange objects. The tp_getattr and tp_getattro
handlers were both set, but were not compatible.  This change uses only the
tp_getattro handler with a more "modern" approach.
This fixes SF bug #551285.
2002-05-02 16:05:27 +00:00
Andrew M. Kuchling 9546772ccd Correct Moshe's e-mail address
Point to PEP 100 for MAL's Unicode proposal
Fix URL for XML HOWTO
Bump version number
2002-05-02 14:48:26 +00:00
Andrew M. Kuchling 2a1598035d Note that NameError's message also changed in 2.0 2002-05-02 14:37:14 +00:00
Andrew M. Kuchling e7bd876f9d Message for NameError has changed 2002-05-02 14:31:55 +00:00
Skip Montanaro 71390a9a94 clarify message when raising TypeError to indicate that float() accepts
strings or numbers
2002-05-02 13:03:22 +00:00
Martin v. Löwis c6a7d7ef49 Guard gettext and friends with HAVE_LIBINTL_H. Fixes #549907. 2002-05-02 12:16:29 +00:00
Fred Drake 4b270518b7 Correct information on support for repietition & concatenation for buffer
and xrange objects.
This closes SF bug #550555.
2002-05-02 05:56:04 +00:00
Fred Drake 485f340d52 Buffer-object repitition and concatenation has worked all along; add a test
to make avoid regression.
2002-05-02 04:27:20 +00:00
Fred Drake eb2b8334d5 Added some notes on setting up the documentation tools on Cygwin. 2002-05-01 22:05:30 +00:00
Fred Drake 5a55c49c8c Added more style for major warnings. 2002-05-01 22:03:40 +00:00
Fred Drake 0ebacc8b38 Pickler_clear_memo(): convert to METH_NOARGS. 2002-05-01 20:36:39 +00:00
Fred Drake 7f781c9aab Add Pickler.clear_memo() so the pickle and cPickle modules are more similar. 2002-05-01 20:33:53 +00:00
Fred Drake 56aa6280f6 list_documented_items(): Basic implementation.
This still does not work well since ctags does not do a good job with the
Python headers, appearantly due to the DL_IMPORT macro.  ;-(
2002-05-01 17:25:04 +00:00
Fred Drake a65375c3e3 Explain what os.read() returns at end of file.
This closes SF bug #550409.  Applying to release21-maint & release22-maint.
2002-05-01 03:31:42 +00:00
Fred Drake 7938fab285 Add missing right-parenthesis. 2002-05-01 03:23:03 +00:00
Barry Warsaw 5dfc7afff9 Watch out for older XEmacsen for which requiring info-look doesn't
define info-lookup-maybe-add-help.
2002-04-30 18:58:52 +00:00
Skip Montanaro d268183044 moved from Tools/scripts (was only at rev 1.1 - no changes yet - so I simply
removed it from there and added it here)
2002-04-30 16:25:37 +00:00
Skip Montanaro 8c5763f3ea moving into the Doc/tools directory 2002-04-30 16:23:42 +00:00
Fred Drake 52cc670711 Add a note about when the "%r" formatting code was added. 2002-04-30 14:54:47 +00:00
Andrew MacIntyre 07c639f577 add enumobject.c to build machinery 2002-04-30 13:06:32 +00:00
Andrew MacIntyre e41abab33b Fred's recent changes to support "-u all" resulted in subset resource
selections (eg "-u network") being ignored.
2002-04-30 12:11:04 +00:00
Andrew MacIntyre 63c9d50a84 add enumobject.c to build machinery 2002-04-30 12:06:23 +00:00
Fred Drake af93c4c8d9 Added a missing "|" in the grammar productions used in the reference manual
(reported by François Pinard).
Added some missing "_" characters in the same cluster of productions.
Added missing floor division operator in m_expr production, and mention
floor division in the relevant portion of the text.
2002-04-30 02:18:51 +00:00
Tim Peters 67d687a114 builtin_zip(): Take a good guess at how big the result list will be,
and allocate it in one gulp.

This isn't a bugfix, it's just a minor optimization that may or may not
pay off.
2002-04-29 21:27:32 +00:00
Thomas Heller 541703b18f Typo: whcar_t should be wchar_t.
Bugfix candidate? Don't know how this is handled in the docs.
2002-04-29 17:28:43 +00:00
Andrew M. Kuchling b803f7013c Add some items, and remove a note to myself 2002-04-29 15:42:16 +00:00
Fred Drake 432425e834 Small markup adjustments for consistency. 2002-04-29 15:17:16 +00:00
Guido van Rossum a883a3d5fd See discussion at SF bug 547537.
Unicode objects are currently taken as binary data by the write()
method.  This is not what Unicode users expect, nor what the
StringIO.py code does.  Until somebody adds a way to specify binary or
text mode for cStringIO objects, change the format string to use "t#"
instead of "s#", so that it will request the "text buffer" version.
This will try the default encoding for Unicode objects.

This is *not* a 2.2 bugfix (since it *is* a semantic change).
2002-04-29 13:54:48 +00:00
Tim Peters 81b9251d59 Mostly in SequenceMatcher.{__chain_b, find_longest_match}:
This now does a dynamic analysis of which elements are so frequently
repeated as to constitute noise.  The primary benefit is an enormous
speedup in find_longest_match, as the innermost loop can have factors
of 100s less potential matches to worry about, in cases where the
sequences have many duplicate elements.  In effect, this zooms in on
sequences of non-ubiquitous elements now.

While I like what I've seen of the effects so far, I still consider
this experimental.  Please give it a try!
2002-04-29 01:37:32 +00:00
Tim Peters 29c0afcfec Just added comments, and cleared some XXX questions, related to int
memory management.
2002-04-28 16:57:34 +00:00
Tim Peters 449b5a8da1 _PyObject_DebugCheckAddress(): If the leading pad bytes are corrupt,
display a msg warning that the count of bytes requested may be bogus,
and that a segfault may happen next.
2002-04-28 06:14:45 +00:00
Tim Peters 8b078f95e0 Moving pymalloc along.
As threatened, PyMem_{Free, FREE} also invoke the object deallocator now
when pymalloc is enabled (well, it does when pymalloc isn't enabled too,
but in that case "the object deallocator" is plain free()).

This is maximally backward-compatible, but it leaves a bitter aftertaste.

Also massive reworking of comments.
2002-04-28 04:11:46 +00:00
Tim Peters fa8efab30f _PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar:  Could call PyObject_INIT_VAR likewise.

Bugfix candidate.
2002-04-28 01:57:25 +00:00
Tim Peters 5de9842b34 Repair widespread misuse of _PyString_Resize. Since it's clear people
don't understand how this function works, also beefed up the docs.  The
most common usage error is of this form (often spread out across gotos):

	if (_PyString_Resize(&s, n) < 0) {
		Py_DECREF(s);
		s = NULL;
		goto outtahere;
	}

The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL.  So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s):  s is already
NULL!  A correct way to write the above is the simpler (and intended)

	if (_PyString_Resize(&s, n) < 0)
		goto outtahere;

Bugfix candidate.
2002-04-27 18:44:32 +00:00
Tim Peters 602f740bc2 SF patch 549375: Compromise PyUnicode_EncodeUTF8
This implements ideas from Marc-Andre, Martin, Guido and me on Python-Dev.

"Short" Unicode strings are encoded into a "big enough" stack buffer,
then exactly as much string space as they turn out to need is allocated
at the end.  This should have speed benefits akin to Martin's "measure
once, allocate once" strategy, but without needing a distinct measuring
pass.

"Long" Unicode strings allocate as much heap space as they could possibly
need (4 x # Unicode chars), and do a realloc at the end to return the
untouched excess.  Since the overallocation is likely to be substantial,
this shouldn't burden the platform realloc with unusably small excess
blocks.

Also simplified uses of the PyString_xyz functions.  Also added a release-
build check that 4*size doesn't overflow a C int.  Sooner or later, that's
going to happen.
2002-04-27 18:03:26 +00:00
Tim Peters 73364e64e5 Teach the Windows build about the new enumobject.c file. 2002-04-26 21:20:02 +00:00
Fred Drake d3e6678713 Slightly expand and clarify the differences between getegid(), getgid(),
getpgrp(), and setpgid().
This closes SF bug #547939.
2002-04-26 20:59:40 +00:00
Fred Drake a7bb2b9b30 Be more consistent, both internally and with recommended practice.
This closes SF bug #547953.
2002-04-26 20:44:14 +00:00
Fred Drake 38f71973e5 Documentation for the enumerate() function/type.
This closes SF patch #547162.
2002-04-26 20:29:44 +00:00
Guido van Rossum 26dd830123 Clarify that the strip changes also apply to Unicode. 2002-04-26 20:11:29 +00:00
Guido van Rossum 7dab2426ca - New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
  The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00
Barry Warsaw 17afa13a9f (py-comint-output-filter-function): Put the pop-to-buffer call inside
the `when' condition so other non-Python shell comint changes won't
cause random buffers to pop.
2002-04-26 15:49:52 +00:00
Guido van Rossum 517c7d4fd3 PyNumber_CoerceEx: this took a shortcut (not doing anything) when the
left and right type were of the same type and not classic instances.

This shortcut is dangerous for proxy types, because it means that
coerce(Proxy(1), Proxy(2.1)) leaves Proxy(1) unchanged rather than
turning it into Proxy(1.0).

In an ever-so-slight change of semantics, I now only take the shortcut
when the left and right types are of the same type and don't have the
CHECKTYPES feature.  It so happens that classic instances have this
flag, so the shortcut is still skipped in this case (i.e. nothing
changes for classic instances).  Proxies also have this flag set
(otherwise implementing numeric operations on proxies would become
nightmarish) and this means that the shortcut is also skipped there,
as desired.  It so happens that int, long and float also have this
flag set; that means that e.g. coerce(1, 1) will now invoke
int_coerce().  This is fine: int_coerce() can deal with this, and I'm
not worried about the performance; int_coerce() is only invoked when
the user explicitly calls coerce(), which should be rarer than rare.
2002-04-26 02:49:14 +00:00
Fred Drake d451ec1cdb Clean up uses of some deprecated features.
Reported by Neal Norwitz on python-dev.
2002-04-26 02:29:55 +00:00
Neil Schemenauer 89e3ee0ccf If Py_OptimizeFlag is false then always evaluate assert conditions, don't
test __debug__ at runtime.  Closes SF patch #548833.
2002-04-26 01:58:53 +00:00
Guido van Rossum 9364698101 Make sure that tp_free frees the int the same way as tp_dealloc would.
This fixes the problem that Barry reported on python-dev:
   >>> 23000 .__class__ = bool
crashes in the deallocator.  This was because int inherited tp_free
from object, which uses the default allocator.

2.2. Bugfix candidate.
2002-04-26 00:53:34 +00:00