Patch #103279: sysconfig.py always looks for versions of files in
sys.prefix + 'config/Makefile'. When building Python for the first
time, these files aren't there, so the files from the build tree have
to be used instead; this file adds an entry point for specifying that
the build tree files should be used. (Perhaps 'set_python_build' should
should be preceded with an underscore?)
Guido van Rossum [Wed, 17 Jan 2001 15:08:37 +0000 (15:08 +0000)]
Fix a bizarre typo in the helper class ComparableException: the
__getattr__() method, which clearly (like the other methods) was
intended to pass the __getattr__() call on to the self.err object,
mistakenly returned getattr(self, self.err) rather than
getattr(self.err, attr). Since self.err is not a string, this always
raises a TypeError. Apparently that doesn't bother for the one
attribute for which __getattr__() is actually called ('__coerce__'),
but it broke the rich comparisons stuff that I'm trying to get into
shape, so I'm fixing this now. (I could also simply remove the
__getattr__() method, but fixing it seems more in the spirit of what
the ComparableException class is trying to do.)
via untabifying and shifting the real code left. Semantically the
same but made the intent of the commented-out-in-column-0 unused code
unclear. The exact same unused code appears to have gotten copied from
file to file over the years.
Eric S. Raymond [Wed, 17 Jan 2001 08:25:11 +0000 (08:25 +0000)]
Eric the half-a-wit, driven to berserk rage after repeatedly doing
builds during which he forgot to uncomment crucial library lines in
Setup, walks into Guido's East End nightclub with a tactical nuclear
weapon on his shoulder. Said nuclear weapon is promptly deployed
exactly where it will do the most good, right in the middle of
configure.in.
With this patch, the set of libraries autoconfigured in is extended to
include ndbm, gdbm, and crypt. This essentially eliminates any need to
tweak Setup for a normal Linux build.
Guido van Rossum [Wed, 17 Jan 2001 03:12:01 +0000 (03:12 +0000)]
Use __name__ instead of "test_regex" as the module name in the
warnings.filterwarnings() call. This suppresses the warning when the
module is imported with its full name (test.test_regex) too.
Guido van Rossum [Tue, 16 Jan 2001 20:53:31 +0000 (20:53 +0000)]
Rationalizing the fallback code for portable fseek -- this is all much
simpler if we use fgetpos and fsetpos, rather than trying to mess with
platform-specific TELL64 alternatives.
Of course, this hasn't been tested on a 64-bit platform, so I may have
to withdraw this -- but I'm hopeful, and Trent Mick supports this
patch!
Fix bugs with integer-valued variables when parsing Makefiles. Values
for done[n] can be integers as well as strings, but the code
concatenates them with strings (fixed by adding a str()) and calls
string.strip() on them (fixed by rearranging the logic)
(Presumably this wasn't noticed previously because parse_makefile()
was only called on Modules/Makefile, which contains no integer-valued
variables.)
Modified version of a patch from Jeremy Kloth, to make .get_outputs()
produce a list of unique filenames:
"While attempting to build an RPM using distutils on Python 2.0,
rpm complained about duplicate files. The following patch fixed
that problem.
Eric S. Raymond [Tue, 16 Jan 2001 15:01:26 +0000 (15:01 +0000)]
Make HAVE_TERMIOS_H and associated config.sh shell variable available
when configure detects the presence of termios.h; later we'll use this
for correct configuration of edline/readline.
Also, fix a bug in acconfig.h -- somebody forgot to add an undef to
cover the LIBNDBM configure symbol, which was preventing autoheader
from working properly.
Eric S. Raymond [Tue, 16 Jan 2001 14:18:55 +0000 (14:18 +0000)]
push_source() and pop_source() entry points for shlex instances.
These basically just make available to the user what userhook()
does to the source stack. Documentation included.
Added checks to prevent PyUnicode_Count() from dumping core
in case the parameters are out of bounds and fixes error handling
for .count(), .startswith() and .endswith() for the case of
mixed string/Unicode objects.
This patch adds Python style index semantics to PyUnicode_Count()
indices (including the special handling of negative indices).
The patch is an extended version of patch #103249 submitted
by Michael Hudson (mwh) on SF. It also includes new test cases.
Thomas Wouters [Tue, 16 Jan 2001 06:35:14 +0000 (06:35 +0000)]
Fix for SF bug #123625: some newsservers need 'authinfo' *before* 'mode
readers', others *after*. (Netscape Collabra for the first category,
INN-which-forks-nnrpd for the second.)
Add strip_dir argument to the single call to .object_filenames(), to
prevent creating files such as build/lib.whatever/Modules/foo.o
when given a source filename such as Modules/foo.c.
Ka-Ping Yee [Mon, 15 Jan 2001 22:14:16 +0000 (22:14 +0000)]
This patch makes sure that the function name always appears in the error
message, and tries to make the messages more consistent and helpful when
the wrong number of arguments or duplicate keyword arguments are supplied.
Comes with more tests for test_extcall.py and and an update to an error
message in test/output/test_pyexpat.
Barry Warsaw [Mon, 15 Jan 2001 20:40:19 +0000 (20:40 +0000)]
Committing PEP 232, function attribute feature, approved by Guido.
Closes SF patch #103123.
funcobject.h:
PyFunctionObject: add the func_dict slot.
funcobject.c:
PyFunction_New(): Initialize the func_dict slot to NULL.
func_getattr(): Rename to func_getattro() and change the
signature. It's more efficient to use attro methods and dig the C
string out than it is to re-convert a C string to a PyString.
Also, add support for getting the __dict__ (a.k.a. func_dict)
attribute, and for getting an arbitrary function attribute.
func_setattr(): Rename to func_setattro() and change the signature
for the same reason. Also add support for setting __dict__
(a.k.a. func_dict) and any arbitrary function attribute.
func_dealloc(): Be sure to DECREF the func_dict slot.
func_traverse(): Be sure to traverse func_dict too.
PyFunction_Type: make the necessary func_?etattro() changes.
classobject.c:
instancemethod_memberlist: Add __dict__
instancemethod_setattro(): New method to set arbitrary attributes
on methods (really the underlying im_func). Raise TypeError when
the instance is bound or when you're trying to set one of the
reserved im_* attributes.
instancemethod_getattr(): Renamed to instancemethod_getattro()
since that's what it really is. Also, added support fo getting
arbitrary attributes through the im_func.
Barry Warsaw [Mon, 15 Jan 2001 20:28:50 +0000 (20:28 +0000)]
Document function attributes for both the function type and the method
type. The method documentation also includes a new brief discussion
of `bound' vs. `unbound' and why setting an attr on a bound method is
a TypeError. Includes Skip's suggested text.
Guido van Rossum [Mon, 15 Jan 2001 18:58:56 +0000 (18:58 +0000)]
SF patch #103158 by Greg Ball: Don't do unsafe arithmetic in xrange
object.
This fixes potential overflows in xrange()'s internal calculations on
64-bit platforms. The fix is complicated because the sq_length slot
function can only return an int; we want to support
xrange(sys.maxint), which is a 64-bit quantity on most 64-bit
platforms (except Win64). The solution is hacky but the best
possible: when the range is that long, we can use it in a for loop but
we can't ask for its length (nor can we actually iterate beyond
2**31-1, because the sq_item slot function has the same restrictions
on its arguments. Fixing those restrictions is a project for another
day...
Barry Warsaw [Mon, 15 Jan 2001 17:07:21 +0000 (17:07 +0000)]
Committing patch #103216, autodetect of dbmmodule support and building
of dbmmodule dynamically by default (otherwise it can pull in
dependencies with libdb that croak pybsddb3). This change moves the
Setup line for dbmmodule to Setup.config.in.
Guido van Rossum [Mon, 15 Jan 2001 16:53:58 +0000 (16:53 +0000)]
Geoffrey Gerrietts discovered that a KeyError was caught that probably
should have been a NameError. I'm checking in a change that catches
both, just to be sure -- I can't be bothered trying to understand this
code any more. :-)
Guido van Rossum [Mon, 15 Jan 2001 16:32:49 +0000 (16:32 +0000)]
Default to passive mode. See SF bug #126851.
This is slightly controversial, but after reading the argumentation in
the bug tracker for and against, I believe this is the right solution.
Let me know if it breaks for you, and how.
Fix from Jack Jansen for the Mac and the Metrowerks compiler, posted
to the Distutils-SIG and archived at
http://mail.python.org/pipermail/distutils-sig/2000-November/001755.html
Tim Peters [Mon, 15 Jan 2001 10:36:56 +0000 (10:36 +0000)]
Speed getline_via_fgets(), by supplying two "fast paths", although one is
faster than the other. Should be faster for Mark Favas's 254-character
mail log lines, and *is* 3-4% quicker for my test case with much shorter
lines (but they're typical of *my* text files, and I'm tired of optimizing
for everyone else at my expense <wink> -- in fact, the only one who loses
here is Guido ...).
Guido van Rossum [Sun, 14 Jan 2001 23:21:25 +0000 (23:21 +0000)]
- Use mimetypes.types_map to initialize extensions_map.
- Change the default file type to application/octet-stream.
- Add support to recognize .py, .c, .h files as text/plain (this is
what I use most :-).
Guido van Rossum [Sun, 14 Jan 2001 21:03:01 +0000 (21:03 +0000)]
SF Patch #103232 by dougfort: Preserve Nonstandard Port Number in Host
Header
Dougfort's comments: httplib does not include ':port ' in the HTTP 1.1
'Host:' header. This causes problems if the server is not listening
on Port 80. The test case I use is the login to /manage under Zope,
with Zope listening on port 8080. Zope returns a <frameset> with the
<frame> source URLs lacking the :8080.
Fredrik Lundh [Sun, 14 Jan 2001 15:06:11 +0000 (15:06 +0000)]
SRE fixes for 2.1 alpha:
-- added some more docstrings
-- fixed typo in scanner class (#125531)
-- the multiline flag (?m) should't affect the \Z operator (#127259)
-- fixed non-greedy backtracking bug (#123769, #127259)
-- added sre.DEBUG flag (currently dumps the parsed pattern structure)
-- fixed a couple of glitches in groupdict (the #126587 memory leak
had already been fixed by AMK)
Guido van Rossum [Sun, 14 Jan 2001 14:08:40 +0000 (14:08 +0000)]
- Added keyword argument 'append' to filterwarnings(); if true, this
appends to list of filters instead of inserting at the front. This
is useful to add a filter with a lower priority than -W options.
- Cosmetic improvements to a docstring and an error message.
Guido van Rossum [Sat, 13 Jan 2001 22:06:05 +0000 (22:06 +0000)]
Neil discovered a bad DECREF on warnoptions, that caused repeated
re-initializing Python (Py_Finalize() followed by Py_Initialize()) to
blow up quickly. With the DECREF removed I can't get it to fail any
more. (Except it still leaks, but that's probably a separate issue.)
Guido van Rossum [Sat, 13 Jan 2001 16:55:33 +0000 (16:55 +0000)]
SF Patch #103225 by Ping: httplib: smallest Python patch ever
The ASCII-art diagram at the top of httplib contains a backslash at
the end of a line, which causes Python to remove the newline. This
one-character patch adds a space after the backslash so it will
appear at the end of the line in the docstring as intended.
Tim Peters [Sat, 13 Jan 2001 03:04:02 +0000 (03:04 +0000)]
Guido found a brand new race in tempfile on Linux, due to Linux changing
pid across threads (but in that case, it's still the same process, and so
still sharing the "template" cache in tempfile.py). Repaired that, and
added a new std test.
On Linux, someone please run that standalone with more files and/or more
threads; e.g.,