cpython/Include
Tim Peters ddea208be9 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.
2002-03-23 10:03:50 +00:00
..
Python.h Give Python a debug-mode pymalloc, much as sketched on Python-Dev. 2002-03-23 10:03:50 +00:00
abstract.h Implement PyObject_DelItemString. Fixes #498915. 2002-01-05 10:50:30 +00:00
bitset.h
bufferobject.h
cStringIO.h
cellobject.h Cells are not VAR objects. 2002-02-28 23:46:34 +00:00
ceval.h
classobject.h PyMethodObject(): Update the comment about im_class based upon a 2001-12-07 21:54:33 +00:00
cobject.h
codecs.h
compile.h Add helper macro to get the number of free variables for a PyCodeObject. 2001-12-13 19:47:02 +00:00
complexobject.h
descrobject.h Methods of built-in types now properly check for keyword arguments 2001-10-22 00:43:43 +00:00
dictobject.h SF bug #491415 PyDict_UpdateFromSeq2() unused 2001-12-11 18:51:08 +00:00
errcode.h
eval.h
fileobject.h Patch #530105: Allow file object may to be subtyped 2002-03-15 17:42:16 +00:00
floatobject.h
frameobject.h
funcobject.h
graminit.h
grammar.h
import.h
intobject.h
intrcheck.h
iterobject.h
listobject.h
longintrepr.h For clarity, change _longobject to build directly from PyObject_VAR_HEAD 2002-03-02 04:33:09 +00:00
longobject.h
marshal.h
metagrammar.h
methodobject.h
modsupport.h PyArg_UnpackTuple(): New argument unpacking function suggested by Jim 2001-10-23 21:09:29 +00:00
moduleobject.h
node.h
object.h Patch supplied by Burton Radons for his own SF bug #487390: Modifying 2001-12-08 18:02:58 +00:00
objimpl.h Make PyObject_{NEW,New,Del,DEL} always use the standard malloc (PyMem_*) 2002-03-22 15:25:18 +00:00
opcode.h Patch #494783: Rename cmp_op enumerators. 2002-01-01 19:59:11 +00:00
osdefs.h OS/2 EMX port changes (Include part of patch #450267): 2002-02-26 11:20:01 +00:00
parsetok.h Disable the parser hacks that enabled the "yield" keyword using a future 2002-03-22 23:53:36 +00:00
patchlevel.h Change the version string from "2.2+" to "2.3a0". disutils peels off 2002-02-02 00:08:15 +00:00
pgenheaders.h Add function attributes that allow GCC to check the arguments of printf-like 2001-10-23 02:21:22 +00:00
py_curses.h Patch #477752: Drop old-style getargs from curses. 2002-01-17 23:08:27 +00:00
pydebug.h SF bug #488514: -Qnew needs work 2001-12-06 06:23:26 +00:00
pyerrors.h mysnprintf.c: Massive rewrite of PyOS_snprintf and PyOS_vsnprintf, to 2001-12-03 00:43:33 +00:00
pyfpe.h
pygetopt.h
pymactoolbox.h Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me. 2001-11-05 14:39:22 +00:00
pymem.h Give Python a debug-mode pymalloc, much as sketched on Python-Dev. 2002-03-23 10:03:50 +00:00
pyport.h SF bug 525705: [2.2] underflow raise OverflowException. 2002-03-09 04:58:24 +00:00
pystate.h
pythonrun.h
pythread.h Remove the unused & broken PyThread_*_sema() functions and related constants. 2002-01-19 22:02:55 +00:00
rangeobject.h
sliceobject.h
stringobject.h Add function attributes that allow GCC to check the arguments of printf-like 2001-10-23 02:21:22 +00:00
structmember.h Fix SF bug #486144: Uninitialized __slot__ vrbl is None. 2001-12-04 16:23:42 +00:00
structseq.h SF patch #462296: Add attributes to os.stat results; by Nick Mathewson. 2001-10-18 20:34:25 +00:00
symtable.h
sysmodule.h Add function attributes that allow GCC to check the arguments of printf-like 2001-10-23 02:21:22 +00:00
token.h
traceback.h [Bug #528914] PyTraceBack_Store/Fetch were deleted in 1997, but their 2002-03-19 16:02:35 +00:00
tupleobject.h
ucnhash.h
unicodeobject.h SF patch #470578: Fixes to synchronize unicode() and str() 2001-10-19 02:01:31 +00:00
weakrefobject.h