Fred Drake [Fri, 3 May 2002 04:54:20 +0000 (04:54 +0000)]
Integrated SF patch #539487 by Matthias Klose:
This patch adds Milan Zamazal's conversion script and
modifies the mkinfo script to build the info doc files
from the LaTeX sources. Currently, the mac, doc and
inst TeX files are not handled.
Explicitly checks for GNU Emacs 21.
Fred Drake [Thu, 2 May 2002 18:13:48 +0000 (18:13 +0000)]
Add a regression test that was removed prematurely. This tests deprecated
(but not removed!) features of the xrange object. This test should be
maintained for all of 2.2.x to avoid regression failures.
Fred Drake [Thu, 2 May 2002 16:05:40 +0000 (16:05 +0000)]
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.
Anthony Baxter [Tue, 30 Apr 2002 04:05:33 +0000 (04:05 +0000)]
backport tim_one's patch:
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.
Original patch(es):
python/dist/src/Python/bltinmodule.c:2.253
Anthony Baxter [Tue, 30 Apr 2002 03:41:53 +0000 (03:41 +0000)]
backport tim_one's patch:
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.
Original patch(es):
python/dist/src/Objects/fileobject.c:2.161
python/dist/src/Objects/stringobject.c:2.161
python/dist/src/Objects/unicodeobject.c:2.147
Anthony Baxter [Tue, 30 Apr 2002 03:24:12 +0000 (03:24 +0000)]
backport tim_one's patch:
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.
Original patch(es):
python/dist/src/Doc/api/concrete.tex:1.13
Fred Drake [Tue, 30 Apr 2002 02:21:32 +0000 (02:21 +0000)]
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.
Anthony Baxter [Fri, 26 Apr 2002 06:31:22 +0000 (06:31 +0000)]
backport gvanrossum's patch:
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.
(trivial change in backport: "freefunc" -> "destructor")
Original patch(es):
python/dist/src/Objects/intobject.c:2.82
Anthony Baxter [Tue, 23 Apr 2002 04:02:55 +0000 (04:02 +0000)]
backport some warnings filters to shut up complaints about complex
divmod &c. Should probably be cleaned up properly so that the tests
don't call that.
Walter Dörwald [Mon, 22 Apr 2002 18:42:45 +0000 (18:42 +0000)]
Backport checkin:
Apply patch diff.txt from SF feature request
http://www.python.org/sf/444708
This adds the optional argument for str.strip
to unicode.strip too and makes it possible
to call str.strip with a unicode argument
and unicode.strip with a str argument.
Fred Drake [Fri, 19 Apr 2002 04:06:06 +0000 (04:06 +0000)]
Clean up the use of version numbers in filenames; always use an "abstract"
version number, and explain what it is at the top of the chapter.
This closes SF bug #225003.
Anthony Baxter [Thu, 18 Apr 2002 05:37:51 +0000 (05:37 +0000)]
backport gvanrossum's patch:
SF bug #543387.
Complex numbers implement divmod() and //, neither of which makes one
lick of sense. Unfortunately this is documented, so I'm adding a
deprecation warning now, so we can delete this silliness, oh, around
2005 or so.
Bugfix candidate (At least for 2.2.2, I think.)
Original patches were:
python/dist/src/Objects/complexobject.c:2.58
Anthony Baxter [Thu, 18 Apr 2002 05:08:28 +0000 (05:08 +0000)]
backport gvanrossum's patch:
Provisional fix for writefile() [SF bug # 541730].
The problem was that an exception can occur in the text.get() call or
in the write() call, when the text buffer contains non-ASCII
characters. This causes the previous contents of the file to be lost.
The provisional fix is to call str(self.text.get(...)) *before*
opening the file, so that if the exception occurs, we never open the
file.
Two orthogonal better solutions have to wait for policy decisions:
1. We could try to encode the data as Latin-1 or as UTF-8; but that
would require IDLE to grow a notion of file encoding which requires
more thought.
2. We could make backups before overwriting a file. This requires
more thought because it needs to be fast and cross-platform and
configurable.
Original patches were:
python/dist/src/Tools/idle/IOBinding.py:1.6
Anthony Baxter [Thu, 18 Apr 2002 04:52:10 +0000 (04:52 +0000)]
backport tim_one's patch:
resetwarnings(): change the docstring to reflect what the code
actually does. Note that the description in the Library Reference
manual is already accurate.
Anthony Baxter [Thu, 18 Apr 2002 04:46:49 +0000 (04:46 +0000)]
backport gvanrossum's patch:
SF bug 544647.
PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it
existed, even if nb_inplace_multiply also existed and the arguments
weren't right for sq_inplace_repeat. Change this to only use
sq_inplace_repeat if nb_inplace_multiply isn't defined.
Anthony Baxter [Thu, 18 Apr 2002 04:40:05 +0000 (04:40 +0000)]
backport gvanrossum's patch:
SF bug 544647.
PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it
existed, even if nb_inplace_multiply also existed and the arguments
weren't right for sq_inplace_repeat. Change this to only use
sq_inplace_repeat if nb_inplace_multiply isn't defined.
Anthony Baxter [Thu, 18 Apr 2002 02:32:25 +0000 (02:32 +0000)]
corrected backport. 'patch' made me sad, it got it horribly wrong
(no idea why, or how)
backport theller's patch
Set the warn_dir option to 0 before running the install command.
This suppresses bogus warnings about modules installed into a directory
not in sys.path.
Anthony Baxter [Thu, 18 Apr 2002 02:19:46 +0000 (02:19 +0000)]
backport tim_one's patch:
SF bug 543840: complex(string) accepts strings with \0
complex_subtype_from_string(): this stopped parsing at the first 0
byte, as if that were the end of the input string.
Backport rev 2.132 (note: some earlier bugfix candidates still TBD).
SF bug 542984.
Change type_get_doc (the get function for __doc__) to look in tp_dict
more often, and if it finds a descriptor in tp_dict, to call it (with
a NULL instance). This means you can add a __doc__ descriptor to a
new-style class that returns instance docs when called on an instance,
and class docs when called on a class -- or the same docs in either
case, but lazily computed.
I'll also check this into the 2.2 maintenance branch.
Backport rev 2.143 (note: some earlier bugfix candidates still TBD).
SF bug 542984.
Change type_get_doc (the get function for __doc__) to look in tp_dict
more often, and if it finds a descriptor in tp_dict, to call it (with
a NULL instance). This means you can add a __doc__ descriptor to a
new-style class that returns instance docs when called on an instance,
and class docs when called on a class -- or the same docs in either
case, but lazily computed.
I'll also check this into the 2.2 maintenance branch.
Tim Peters [Wed, 17 Apr 2002 04:36:35 +0000 (04:36 +0000)]
Windows installer: disabled Wise's "delete in-use files" uninstall
option. It was the cause of at least one way UNWISE.EXE could vanish
(install a python; uninstall it; install it again; reboot the machine;
abracadabra the uinstaller is gone).
Fred Drake [Wed, 17 Apr 2002 01:42:58 +0000 (01:42 +0000)]
Changed last two remaining uses of "./" to "index.html" when referring to the
index file for the top-level directory. This makes it easier to use an
unpacked version of the documentation via file: URLs.
This closes SF bug #541257.
Tim Peters [Mon, 8 Apr 2002 04:19:50 +0000 (04:19 +0000)]
SF bug 538827: Python open w/ MSVC6: bad error msgs.
open_the_file: Some (not all) flavors of Windows set errno to EINVAL
when passed a syntactically invalid filename. Python turned that into an
incomprehensible complaint about the mode string. Fixed by special-casing
MSVC.
- A type can now inherit its metatype from its base type. Previously,
when PyType_Ready() was called, if ob_type was found to be NULL, it
was always set to &PyType_Type; now it is set to base->ob_type,
where base is tp_base, defaulting to &PyObject_Type.
Some more news. (There's also a fix to _localemodule.c that I don't
dare describe, and of course lots of jiggling of the docs and the
Windows installer metadata.)