Jack Jansen [Mon, 25 Mar 2002 15:32:01 +0000 (15:32 +0000)]
Due to interaction between the MSL C library and the GUSI I/O library I can get reads from sockets to work consistently either for unbuffered binary files or for buffered binary files, but not for both:-(
The workaround is to force socket.makefile() to disable buffering for binary files.
Tim Peters [Mon, 25 Mar 2002 06:55:57 +0000 (06:55 +0000)]
Remove bug.py. This is something I sent to Guido via email in or before
'94, demonstrating a thread bug that was later repaired via Python growing
an internal import lock. It's of no current interest, and the now-std
test_threaded_import.py is pretty much the same test.
Jack Jansen [Mon, 25 Mar 2002 00:32:17 +0000 (00:32 +0000)]
Weaklink most toolbox modules, improving backward compatibility. Modules will no longer fail to load if a single routine is missing on the curent OS version, in stead calling the missing routine will raise an exception.
Jack Jansen [Sun, 24 Mar 2002 23:04:18 +0000 (23:04 +0000)]
Weaklink most toolbox modules, improving backward compatibility. Modules will no longer fail to load if a single routine is missing on the curent OS version, in stead calling the missing routine will raise an exception.
Should finally fix 531398. 2.2.1 candidate.
Also blacklisted some constants with definitions that were not Python-compatible.
Jack Jansen [Sun, 24 Mar 2002 22:59:16 +0000 (22:59 +0000)]
Weaklink most toolbox modules, improving backward compatibility. Modules will no longer fail to load if a single routine is missing on the curent OS version, in stead calling the missing routine will raise an exception.
Tim Peters [Sun, 24 Mar 2002 19:25:00 +0000 (19:25 +0000)]
SF bug 480215: softspace confused in nested print
This fixes the symptom, but PRINT_ITEM has no way to know what (if
anything) PyFile_WriteObject() writes unless the object being printed
is a string. When the object isn't a string, this fix retains the
guess that softspace should be set after PyFile_WriteObject().
We might want to say that it's the job of filelike-object write methods
to leave the file's softspace in the correct state. That would probably
be better -- but everyone relies on PRINT_ITEM to guess for them now.
Tim Peters [Sun, 24 Mar 2002 00:34:21 +0000 (00:34 +0000)]
_PyMalloc_DebugRealloc(): simplify decl of "fresh".
Assorted: bump the serial number via a trivial new bumpserialno()
function. The point is to give a single place to set a breakpoint when
waiting for a specific serial number.
Neil Schemenauer [Sat, 23 Mar 2002 19:41:34 +0000 (19:41 +0000)]
Grow the string buffer at a mildly exponential rate for the getc version
of get_line. This makes test_bufio finish in 1.7 seconds instead of 57
seconds on my machine (with Py_DEBUG defined).
Also, rename the local variables n1 and n2 to used_v_size and
total_v_size.
Tim Peters [Sat, 23 Mar 2002 10:03:50 +0000 (10:03 +0000)]
Give Python a debug-mode pymalloc, much as sketched on Python-Dev.
When WITH_PYMALLOC is defined, define PYMALLOC_DEBUG to enable the debug
allocator. This can be done independent of build type (release or debug).
A debug build automatically defines PYMALLOC_DEBUG when pymalloc is
enabled. It's a detected error to define PYMALLOC_DEBUG when pymalloc
isn't enabled.
Two debugging entry points defined only under PYMALLOC_DEBUG:
+ _PyMalloc_DebugCheckAddress(const void *p) can be used (e.g., from gdb)
to sanity-check a memory block obtained from pymalloc. It sprays
info to stderr (see next) and dies via Py_FatalError if the block is
detectably damaged.
+ _PyMalloc_DebugDumpAddress(const void *p) can be used to spray info
about a debug memory block to stderr.
A tiny start at implementing "API family" checks isn't good for
anything yet.
_PyMalloc_DebugRealloc() has been optimized to do little when the new
size is <= old size. However, if the new size is larger, it really
can't call the underlying realloc() routine without either violating its
contract, or knowing something non-trivial about how the underlying
realloc() works. A memcpy is always done in this case.
This was a disaster for (and only) one of the std tests: test_bufio
creates single text file lines up to a million characters long. On
Windows, fileobject.c's get_line() uses the horridly funky
getline_via_fgets(), which keeps growing and growing a string object
hoping to find a newline. It grew the string object 1000 bytes each
time, so for a million-character string it took approximately forever
(I gave up after a few minutes).
So, also:
fileobject.c, getline_via_fgets(): When a single line is outrageously
long, grow the string object at a mildly exponential rate, instead of
just 1000 bytes at a time.
That's enough so that a debug-build test_bufio finishes in about 5 seconds
on my Win98SE box. I'm curious to try this on Win2K, because it has very
different memory behavior than Win9X, and test_bufio always took a factor
of 10 longer to complete on Win2K. It *could* be that the endless
reallocs were simply killing it on Win2K even in the release build.
Skip Montanaro [Sat, 23 Mar 2002 05:58:52 +0000 (05:58 +0000)]
Only AttributeError can be raised in this situation - on systems without
getuid or getpid. posix_getuid & posix_getpid never raise exceptions when
called with no args.
Tim Peters [Sat, 23 Mar 2002 03:26:53 +0000 (03:26 +0000)]
SF bug 533234: tm_isdst > 1 Passed to strftime.
One more time on this turkey, but duller instead of cleverer.
Curious: The docs say __getslice__ has been deprecated since 2.0, but
list.__getitem__ still doesn't work if you pass it a slice. This makes
it a lot clearer to emulate a list by *being* a list <wink>.
Bugfix candidate. Michael, just pile this patch on top of the others
that went by -- no need to try to pick these apart.
Fred Drake [Fri, 22 Mar 2002 17:22:38 +0000 (17:22 +0000)]
Fix broken HTML in the head; this was reported by a user as causing Opera 6.01
to crash. The user has reported the problem to Opera, but we still should
generate something that passes for HTML.
Neil Schemenauer [Fri, 22 Mar 2002 15:25:18 +0000 (15:25 +0000)]
Make PyObject_{NEW,New,Del,DEL} always use the standard malloc (PyMem_*)
and not pymalloc. Add the functions PyMalloc_New, PyMalloc_NewVar, and
PyMalloc_Del that will use pymalloc if it's enabled. If pymalloc is
not enabled then they use the standard malloc (PyMem_*).
Tim Peters [Fri, 22 Mar 2002 02:48:46 +0000 (02:48 +0000)]
SF bug 533198: Complex power underflow raises exception.
Konrad was too kind. Not only did it raise an exception, the specific
exception it raised made no sense. These are old bugs in complex_pow()
and friends:
1. Raising 0 to a negative power isn't a range error, it's a domain
error, so changed c_pow() to set errno to EDOM in that case instead
of ERANGE.
2. Changed complex_pow() to:
A. Used the Py_ADJUST_ERANGE2 macro to try to clear errno of a spurious
ERANGE error due to underflow in the libm pow() called by c_pow().
B. Produced different exceptions depending on the errno value:
i) For errno==EDOM, raise ZeroDivisionError instead of ValueError.
This is for consistency with the non-complex cases 0.0**-2 and
0**-2 and 0L**-2.
ii) For errno==ERANGE, raise OverflowError.
[Bug #532115] netrc module was broken
* 'macdef' (macro definition) wasn't parsed correctly
* account value not reset for a subsequent 'default' line
* typo: 'whitepace' -> 'whitespace'
Jack Jansen [Thu, 21 Mar 2002 22:36:57 +0000 (22:36 +0000)]
For reasons I don't fully understand we sometimes get unexpected events
in MachoPython. As we don't have MacOS.HandleEvent() we drop these on
the floor (with a print).
Walter Dörwald [Thu, 21 Mar 2002 10:38:40 +0000 (10:38 +0000)]
[Apply SF patch #504943]
This patch makes it possible to pass Warning instances as the first
argument to warnings.warn. In this case the category argument
will be ignored. The message text used will be str(warninginstance).
Tim Peters [Wed, 20 Mar 2002 04:02:31 +0000 (04:02 +0000)]
Arrange to export the _PyMalloc_{Malloc, Realloc, Free} entry points. On
Windows some modules are considered (by me, and I don't care what anyone
else thinks about this <wink>) to be part of "the core" despite that they
happen to be compiled into separate DLLs (the "to DLL or not to DLL?"
question on Windows is nearly arbitrary). Making the pymalloc entry
points available to them allows the Windows build to complete without
incident when WITH_PYMALLOC is #define'd.
Note that this isn't unprecedented. Other "private API" functions we
export include _PySequence_IterSearch, _PyEval_SliceIndex, _PyCodec_Lookup,
_Py_ZeroStruct, _Py_TrueStruct, _PyLong_New and _PyModule_Clear.
Fred Drake [Tue, 19 Mar 2002 03:33:33 +0000 (03:33 +0000)]
Clarify that copy_reg.pickle() is not intended for use with "classic" classes.
This was stated before, but a minor grammatical error made it difficult to be
sure of the meaning.
This closes SF bug #530143.
[Bug #531616] Make HTTPS work again by adding a sendall method to the
FakeSocket class. Without it, the sendall() call got the method on
the underlying socket object, and that messed up SSL.
Does httplib use other methods of sockets that FakeSocket doesn't support?
Someone should take a look... (I'll try to give it a once-over.)