cpython/Doc/api
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
..
.cvsignore Updates to reflect pending changes to the XML conversion process. 2000-11-22 16:42:37 +00:00
abstract.tex Clarify the return value of PyObject_IsInstance(). 2002-04-23 18:15:44 +00:00
api.tex Break the Python/C API manual into smaller files by chapter. This manual 2001-10-12 19:01:43 +00:00
concrete.tex Repair widespread misuse of _PyString_Resize. Since it's clear people 2002-04-27 18:44:32 +00:00
exceptions.tex fix a typo in PyErr_Format table and add row for 'p' format char 2002-03-27 13:42:50 +00:00
init.tex Update to use the new \csimplemacro macro 2002-04-09 21:09:42 +00:00
intro.tex Clean up some markup cruft. A number of the macros that take no 2001-11-28 07:26:15 +00:00
memory.tex Minor clarification about what's actually promised for PyMem_Malloc(0). 2002-04-06 09:14:33 +00:00
newtypes.tex Fix a small mistake and complete some function prototypes. 2002-04-24 06:35:11 +00:00
refcounting.tex Break the Python/C API manual into smaller files by chapter. This manual 2001-10-12 19:01:43 +00:00
refcounts.dat Correct the refcount information for the PyWeakref_GetObject() function. 2002-02-20 05:07:36 +00:00
utilities.tex Move reference material on PyArg_Parse*() out of the Extending & Embedding 2002-04-05 23:01:14 +00:00
veryhigh.tex Break the Python/C API manual into smaller files by chapter. This manual 2001-10-12 19:01:43 +00:00