Commit Graph

454 Commits

Author SHA1 Message Date
Tim Peters fd7dc5169c Typo repair. 2004-08-02 04:30:37 +00:00
Tim Peters 0c6199e8ed Completed a sentence I left dangling. 2004-08-02 04:14:10 +00:00
Tim Peters cfd575d398 PyImport_ImportModule, PyImport_ImportModuleEx, PyImport_ExecCodeModule:
in failure cases, incompletely initalized module objects are no longer
left behind in sys.modules.
2004-08-02 03:46:45 +00:00
Skip Montanaro 6d3db7000e Add missing doc for Py_True/Py_False. Use the correct macro to define
Py_RETURN_FALSE and Py_RETURN_TRUE.
2004-07-29 02:16:04 +00:00
Skip Montanaro 33ee76ae9e A little boolean music if you please, maestro... (Not sure I have the
versionadded{} args quite right).
2004-07-28 14:17:04 +00:00
Andrew M. Kuchling e03664ff22 Two typo fixes 2004-07-26 19:25:54 +00:00
Thomas Heller fe0808382b Fix an uncorrect function prototype.
Will backport to release23-maint.

BTW: Shouldn't it read PY_LONG_LONG instead of 'long long' ?
2004-07-23 14:49:52 +00:00
Tim Peters 8ff9f9f4aa Supply missing word in new datetime docs, aggravated by copy-paste-edit. 2004-07-17 01:42:26 +00:00
Tim Peters eda29306b3 Formalize that the Py_VISIT macro requires that the tp_traverse
implementation it's used in must give its arguments specific names.
2004-07-15 04:05:59 +00:00
Jim Fulton aa6389e13b Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
2004-07-14 19:08:17 +00:00
Jim Fulton 8c5aeaa277 Implemented a new Py_CLEAR macro. This macro should be used when
decrementing the refcount of variables that might be accessed as a
result of calling Python
2004-07-14 19:07:35 +00:00
Tim Peters e45d5a3b00 Claifications: visit procs are supplied by the core, users aren't
expected to write their own.  A NULL "object" must not be passed to
the visit callback.  A non-zero return from a visit proc isn't
necessarily an error return (and it doesn't matter to the tp_traverse
code *what* it might signify, their only job is to return it).
2004-07-13 17:18:10 +00:00
Tim Peters 183dabcd73 SF patch 986010: add missing doc for datetime C API, from
Anthony Tuininga.

This is a derived patch, taking the opportunity to add some organization
to the now-large pile of datetime-related macros, and to factor out
tedious repeated text.

Also improved some clumsy wording in NEWS.
2004-07-11 19:26:19 +00:00
Brett Cannon 711e7d97e4 Add PyArg_VaParseTupleAndKeywords(). Document this function and
PyArg_VaParse().

Closes patch #550732.  Thanks Greg Chapman.
2004-07-10 22:20:32 +00:00
Andrew M. Kuchling d9dfe0213f Remove a few elderly sentences 2004-07-10 13:48:54 +00:00
Andrew M. Kuchling ff8113f8d0 Replace example with simpler alternative using PyGILState_{Ensure,Require). Can someone please confirm this change is OK? 2004-07-10 13:42:52 +00:00
Andrew M. Kuchling 371d98ab15 [Bug #987835] Add documentation from PEP 311. (Untested TeX code.) 2004-07-10 13:31:18 +00:00
Andrew M. Kuchling ee5e4cd899 [Bug #984017] Incorrect prototype, fixed by Timothy Stranex 2004-07-07 13:07:47 +00:00
Brett Cannon d88471f432 Change signatures for arguments to "s" and friends to be the proper ``const
char *`` instead of just ``char *``.  Also added the mentioning of "const" in
some places where it was left out even when the signature already stated the
fact.

Closes bug #980925.
2004-07-01 20:55:42 +00:00
Andrew M. Kuchling 6d3a0d2dff [Bug #948970] Add PyExc_* symbols to index.
(I ran this through texcheck, but don't have LaTeX installed on this machine and therefore haven't
verified that the changes are accepted by LaTeX.)
2004-06-29 13:52:14 +00:00
Martin v. Löwis ef82d2fdfe Patch #923098: Share interned strings in marshal. 2004-06-27 16:51:46 +00:00
Tim Peters 9ddf40b4e1 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
The LaTeX is untested (well, so is the new API, for that matter).
Note that I also changed NULL to get spelled consistently in concrete.tex.
If that was a wrong thing to do, Fred should yell at me.
2004-06-20 22:41:32 +00:00
Neil Schemenauer d68d3ee3dd Note that memory returned by PyBuffer_New is not specifically aligned.
Closes SF bug #472568.
2004-06-08 02:58:50 +00:00
Andrew M. Kuchling 1b50b43bee [Bug #936837] Add missing word 2004-06-05 19:00:55 +00:00
Martin v. Löwis 9bc4f2def3 Drop claims that Unicode always means UCS-2. Fixes #881861. 2004-06-03 09:55:28 +00:00
Hye-Shik Chang 974ed7cfa5 - SF #962502: Add two more methods for unicode type; width() and
iswide() for east asian width manipulation. (Inspired by David
Goodger, Reviewed by Martin v. Loewis)
- Move _PyUnicode_TypeRecord.flags to the end of the struct so that
no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis)
2004-06-02 16:49:17 +00:00
Martin v. Löwis dd07e59eee Document PyModule_AddIntConstant to take a long. Fixes #962471.
Will backport to 2.3.
2004-06-02 12:45:27 +00:00
Martin v. Löwis e440e47e91 Patch #957398: Add public API for Generator Object/Type. 2004-06-01 15:22:42 +00:00
Fred Drake 043fff0881 minor wording cleanup 2004-05-12 03:20:37 +00:00
Nicholas Bastin e9c2ecfb96 Removed 'U' from the documentation for Py_BuildValue to bring it in line
with the elimination of 'U' in modsupport.c on 2000/04/28 (replaced
with 'u' and 'u#' per fdrake's comments).
2004-05-04 19:25:56 +00:00
Thomas Heller 1328b52c6f Two new public API functions, Py_IncRef and Py_DecRef. Useful for
dynamic embedders of Python.
2004-04-22 17:23:49 +00:00
Raymond Hettinger e5fced781b SF bug #936827: PyNumber_And() 's description
Fix typo.
2004-04-17 11:57:40 +00:00
Fred Drake 34c43202eb Emphasize the requirement that Python.h be included first more strongly.
Closes SF bug #837228; backporting for Python 2.3.4.
2004-03-31 07:45:46 +00:00
Fred Drake d0c3b26bd0 improve the very-high-level API docs (contributed by Jeff Epler)
Closes SF patch #798638.
2004-03-25 15:44:56 +00:00
Fred Drake 85309512ec Remove note that PyErr_SetInterrupt() is obsolete; add comment about the
fact that it was marked obsolete but is still needed.
Closes SF bug #919299.  Someone else should backport this to Python 2.3.
2004-03-25 14:25:28 +00:00
Raymond Hettinger 5232f50b19 SF bug: #921927: Fixed a typo/thinko spelling "parameter" as "paramter" 2004-03-25 08:51:36 +00:00
Nicholas Bastin c69ebe8d50 Enable the profiling of C functions (builtins and extensions) 2004-03-24 21:57:10 +00:00
Brett Cannon 65d63424b4 Minor grammatical fixes. 2004-03-18 01:38:11 +00:00
Brett Cannon 9b976e6636 Extremely minor typo fixed. 2004-03-18 00:49:01 +00:00
Raymond Hettinger c1e4f9dd92 Use a new macro, PySequence_Fast_ITEMS to factor out code common to
three recent optimizations.  Aside from reducing code volume, it
increases readability.
2004-03-12 08:04:00 +00:00
Fred Drake 70a30e8c94 markup correction 2004-02-17 04:17:36 +00:00
Martin v. Löwis d3f4a1a00a Patch #893566: Document that tp_dealloc may be called from any thread. 2004-02-15 21:01:17 +00:00
Thomas Heller 8178a22e20 Documentation for PyDescr_NewClassMethod was missing - here's at least
the function prototype.

Already backported to release23-maint.
2004-02-09 10:47:11 +00:00
Raymond Hettinger 4cd5a08d8b Fix small factual error. 2004-01-04 03:11:45 +00:00
Fred Drake 7a700b873b clean up indexing for None, NotImplemented
closes SF bug #820344
2004-01-01 05:43:53 +00:00
Andrew MacIntyre f72af655c5 At 2.2, the Py<type>_Check() family of API functions (macros) changed
semantics to include subtypes.  Most concrete object APIs then had
a Py<type>_CheckExact() macro added to test for an object's type
not including subtypes.

The PyDict_CheckExact() macro wasn't created at that time, so I've added
it for API completeness/symmetry - even though nobody has complained
about its absence in the time since 2.2 was released.

Not a backport candidate.
2003-12-26 00:07:51 +00:00
Andrew MacIntyre 13cd8898d2 The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along
with most other concrete object checks, but the docs weren't brought into
line.

PyList_CheckExact() was added at 2.2 but never documented.

backport candidate.
2003-12-25 23:57:52 +00:00
Raymond Hettinger 5469324cde Note that \var{ppos} values are not consecutive and should not be altered. 2003-12-13 19:48:41 +00:00
Raymond Hettinger 8f5cdaa784 * Added a new method flag, METH_COEXIST.
* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().
2003-12-13 11:26:12 +00:00
Raymond Hettinger e180307c10 Fix missing paren. 2003-12-07 12:49:48 +00:00
Raymond Hettinger 2619c9ec89 SF patch #838938: Typos in the docs (Extending/Embedding + Python/C API)
(Contributed by Florent Rougon.)
2003-12-07 11:40:17 +00:00
Raymond Hettinger bc0f2ab9bb Expose dict_contains() and PyDict_Contains() with is about 10% faster
than PySequence_Contains() and more clearly applicable to dicts.

Apply the new function in setobject.c where __contains__ checking is
ubiquitous.
2003-11-25 21:12:14 +00:00
Fred Drake 28eae084bf fix use of undefined markup 2003-11-10 14:48:48 +00:00
Brett Cannon 35d8360bf7 Document Py_RETURN_NONE. 2003-11-09 04:15:30 +00:00
Martin v. Löwis 5ce2fecf8e Patch #837322: Clarify owning, borrowing, stealing. Backported to 2.3. 2003-11-06 21:08:11 +00:00
Raymond Hettinger 9c7ed4c6df Document that varlist can be NULL. 2003-10-26 17:20:07 +00:00
Martin v. Löwis 01a74b2fa1 Make CObjects mutable. Fixes #477441. 2003-10-19 18:30:01 +00:00
Martin v. Löwis 95cf84a4f3 Patch #821093: Fix various typos. 2003-10-19 07:32:24 +00:00
Neal Norwitz 7decf5e5af SF #822262, Typo in Doc/api/intro.tex 2003-10-13 17:47:30 +00:00
Raymond Hettinger cb2da43db8 Extended tuple's C API to include a new function, PyTuple_Pack() that is
useful for rapidly building argument tuples without having to invoke the
more sophisticated machinery of Py_BuildValue().
2003-10-12 18:24:34 +00:00
Raymond Hettinger 92016dcc91 SF 810242. Fix doubled word errors. 2003-09-22 15:27:11 +00:00
Fred Drake 4ccf6e738e fix \NULL with following space and no {} 2003-09-07 02:32:55 +00:00
Brett Cannon 77e0212b8a Fix minor LaTeX bug of not ending a \NULL{} with the curly braces to get the
spacing correct in the output.
2003-09-07 02:22:16 +00:00
Raymond Hettinger 9bd308f67b Fix doubled word typos. 2003-08-25 04:43:53 +00:00
Raymond Hettinger f4bb1f946e Fix typo. 2003-08-23 03:38:11 +00:00
Raymond Hettinger f17d65da3a SF patch#786531 'the the' typo. Contributed by George Yoshida 2003-08-12 00:01:16 +00:00
Raymond Hettinger 12c484dab8 SF patch #783807: Clarify PySequence_Setitem ref counting
(Contributed by Jay T Miller.)
2003-08-09 04:37:14 +00:00
Fred Drake b93b3e790e Error noted in email to python-docs: PyObject corresponds to
PyObject_HEAD, not PyObject_VAR_HEAD.
2003-07-07 17:20:40 +00:00
Skip Montanaro eec26f982a Correct documentation of check interval - it's 100 by default, not 10 any
longer.  Pointed out by Alex Martelli.
2003-07-02 21:38:34 +00:00
Fred Drake 6595e15331 Document PyThreadState_SetAsyncExc(). 2003-06-29 02:14:31 +00:00
Neal Norwitz 847207acff SF bug #719367, string exceptions are deprecated
Remove references to string based exceptions in the doc.
2003-05-29 02:17:23 +00:00
Greg Ward 2748a4aa7e Typo fix. 2003-05-29 01:41:51 +00:00
Martin v. Löwis 5467d4c0e3 Patch #612627: Add encoding attribute to file objects, and determine
the terminal encoding on Windows and Unix.
2003-05-10 07:10:12 +00:00
Fred Drake c22b2999f6 fix some markup errors 2003-04-23 20:38:41 +00:00
Thomas Heller 34d7f0927b Document the new functions PyInt_AsUnsignedLongMask(), PyInt_AsUnsignedLongLongMask(),
PyLong_AsUnsignedLongMask(), PyLong_AsUnsignedLongLongMask().
2003-04-23 19:51:05 +00:00
Thomas Heller 42a1172cf4 Document the new format codes B, H, I, k, K. 2003-04-23 19:27:35 +00:00
Raymond Hettinger 2ed6dff796 As discussed on python-dev, revised docs to note that
PyObject_IsTrue() can have an error result.

Also, added missing docs for PyObject_Not().

Will backport.
2003-04-16 17:28:12 +00:00
Guido van Rossum 0fc8f00252 - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()
even farther down, to just before the call to
  _PyObject_DebugMallocStats().  This required the following changes:

- pystate.c, PyThreadState_GetDict(): changed not to raise an
  exception or issue a fatal error when no current thread state is
  available, but simply return NULL without raising an exception
  (ever).

- object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL,
  don't raise an exception but return 0.  This means that when
  printing a container that's recursive, printing will go on and on
  and on.  But that shouldn't happen in the case we care about (see
  first bullet).

- Updated Misc/NEWS and Doc/api/init.tex to reflect changes to
  PyThreadState_GetDict() definition.
2003-04-15 15:12:39 +00:00
Fred Drake 12dd7b12c6 Minor markup adjustments. 2003-04-09 18:15:57 +00:00
Guido van Rossum 6db771871e Try to discourage use of PyObject_Type(). 2003-04-09 18:02:23 +00:00
Martin v. Löwis 24b8881f61 Patch #701395: Correct documentation of PyUnicode_Splitlines. 2003-03-30 16:40:42 +00:00
Martin v. Löwis b9a0f91218 Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. 2003-03-29 10:06:18 +00:00
Ka-Ping Yee bd379e9627 PyWeakref_GetObject returns None (not NULL) when the referent is gone. 2003-03-28 18:07:16 +00:00
Fred Drake 9e1595e6e4 Minor clarification about the ob_size field. 2003-03-07 15:02:03 +00:00
Neal Norwitz 1930949a8a Fix SF bug #697256, PyMarshal_WriteShortToFile() documented, but not implemented
Remove prototype and doc.  Backport candidate.
2003-03-06 22:04:24 +00:00
Guido van Rossum 41bcbe3050 Commit MvL's doc patch for SF bug #221327. This adds an example of
calling into Python from a C thread.
2003-03-02 13:17:20 +00:00
Michael W. Hudson 1e71b04258 Update advice about __module__ and __name__ and tp_name wrt. new types.
Add \refs to GC section that were XXXed out.
2003-02-10 19:18:21 +00:00
Michael W. Hudson bbe17f50eb A typo, and desist from inaccurately describing some things as lists. 2003-02-10 19:12:42 +00:00
Michael W. Hudson 847f37543f Correct lie about METH_NOARGS functions.
Backport candidate.
2003-02-06 18:37:11 +00:00
Skip Montanaro 1ff49a7734 * Add description of PyInt_FromString.
* Correct description of PyFloat_FromString.  While ignored, the pend
  argument still has to be given.
* Typo in PyLong_FromString.
2003-02-03 05:13:24 +00:00
Skip Montanaro ae31e9b8c7 Add PyFloat_FromString. Left the char **pend argument out of the
description since while there, it is useless and ignored, according to Tim's
commen.  (PyInt_FromString is also not described, but PyLong_FromString is.
Is the former deprecated?)
2003-02-03 03:56:36 +00:00
Raymond Hettinger 89fc4f3e56 Fix typo 2003-01-31 05:44:25 +00:00
Fred Drake f536827c65 Include version annotation for PyObject_Call(). 2003-01-25 07:48:13 +00:00
Walter Dörwald d9a6ad3beb Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
supported as the second argument. This has the same meaning as
for isinstance(), i.e. issubclass(X, (A, B)) is equivalent
to issubclass(X, A) or issubclass(X, B). Compared to isinstance(),
this patch does not search the tuple recursively for classes, i.e.
any entry in the tuple that is not a class, will result in a
TypeError.

This closes SF patch #649608.
2002-12-12 16:41:44 +00:00
Thomas Heller ead60e5d1c Typo: propogate -> propagate
Bugfix candidate.
2002-12-06 22:42:13 +00:00
Walter Dörwald 6d5f30eaed Document that the second argument to PyObject_IsInstance
may be a tuple. This closes SF patch
http://www.python.org/sf/649095

Backport to release22-maint will follow.
2002-12-06 10:09:16 +00:00
Walter Dörwald f171540ab8 Change int() so that passing a string, unicode, float or long argument
that is outside the integer range no longer raises OverflowError, but
returns a long object instead.

This fixes SF bug http://www.python.org/sf/635115
2002-11-19 20:49:15 +00:00
Fred Drake 674dae245a Clarify that PyImport_AddModule() and PyImport_ExecCodeModule() don't
add any package support structure even if a dotted-name is passed for
the module.
Closes SF bug #424106.
2002-11-13 15:13:38 +00:00
Fred Drake 71f5acdd1e Minor cleanups, markup. 2002-11-05 22:19:45 +00:00
Neal Norwitz 1aca2d0cb3 Fix SF # 518775, buffer object API description truncated 2002-11-03 02:56:27 +00:00
Fred Drake 5e96f1ff1d Correct the description of PyErr_Restore().
Closes SF bug #577000.
2002-10-24 20:54:18 +00:00
Fred Drake 4b2472647a Clarified the error cases and Unicode handling of PyString_AsString(),
PyString_AsStringAndSize(), and PyString_AS_STRING().
Closes SF bug #606463.
2002-10-22 20:20:20 +00:00
Martin v. Löwis 36a4d8c20e Remove mentionings of DOS. 2002-10-10 18:24:54 +00:00
Fred Drake b915a38b6f Added refcount information for PyObject_GetIter(). 2002-10-04 18:58:58 +00:00
Fred Drake 111ee3208f Ok, read the source this time: PyErr_SetObject() does not steal a reference. 2002-09-25 02:34:27 +00:00
Fred Drake 2f93644c1d Clarify documentation for PyErr_SetObject() to describe the reference
count behavior.
2002-09-24 16:45:16 +00:00
Raymond Hettinger d3e0265373 Document type and semantics of the tp_print return value. Closes SF 606464. 2002-09-10 13:48:01 +00:00
Raymond Hettinger 513069028f Fix API typo. The write buffer is not const. Closes SF 606216. 2002-09-08 04:39:28 +00:00
Fred Drake 794643c314 Py_InitModule() and friends now accept NULL for the 'methods'
argument.  This makes sense now that extension types can support
__init__ directly rather than requiring function constructors.
2002-08-14 20:59:38 +00:00
Barry Warsaw 29ce2d7d1e Document PyExc_FutureWarning 2002-08-14 16:06:28 +00:00
Guido van Rossum 43af5b5852 Add some fine points: METH_KEYWORDS implies METH_VARARGS, and ob_size
is no longer unused in type objects.
2002-08-06 17:18:56 +00:00
Thomas Heller 085358a3e2 New functions for extension writers on Windows:
PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename().

Similar to PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetFromWindowsErr(), but they allow to specify
the exception type to raise. Available on Windows.

See SF patch #576458.
2002-07-29 14:27:41 +00:00
Neal Norwitz 4ddfd50d85 Fix SF bug 587012, doc mentions inexistent builtin unistr 2002-07-28 13:55:20 +00:00
Tim Peters 7c321a80f9 The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added
more trivial lexical helper macros so that uses of these guys expand
to nothing at all when they're not enabled.  This should help sub-
standard compilers that can't do a good job of optimizing away the
previous "(void)0" expressions.

Py_DECREF:  There's only one definition of this now.  Yay!  That
was that last one in the family defined multiple times in an #ifdef
maze.

Py_FatalError():  Changed the char* signature to const char*.

_Py_NegativeRefcount():  New helper function for the Py_REF_DEBUG
expansion of Py_DECREF.  Calling an external function cuts down on
the volume of generated code.  The previous inline expansion of abort()
didn't work as intended on Windows (the program often kept going, and
the error msg scrolled off the screen unseen).  _Py_NegativeRefcount
calls Py_FatalError instead, which captures our best knowledge of
how to abort effectively across platforms.
2002-07-09 02:57:01 +00:00
Fred Drake abe7c1a4af Minor markup adjustments, consistency changes, and shorten a long
line.
2002-07-02 16:17:58 +00:00
Fred Drake 7c1bb9c528 Add refcount info for PyErr_SetFromWindowsErr() and
PyErr_SetFromWindowsErrWithFilename().
2002-07-02 16:16:18 +00:00
Thomas Heller 4f2722ac9b Docs for PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetFromWindowsErr().
Fixes SF# 576016, with additional markup.
2002-07-02 15:47:03 +00:00
Fred Drake 1d1e1dba12 Corrected return type and value information for PyUnicode_Count() and
PyUnicode_Find().
This closes SF bug #566631.
2002-06-20 22:07:04 +00:00
Fred Drake b084017c7a Fix documentation for PyMarshal_WriteObjectToFile() and
PyMarshal_WriteObjectToFile().
This closes SF bug #533735.
2002-06-17 15:44:18 +00:00
Fred Drake a0c5e9fb74 Clean up descriptions of PyObject_RichCompare() and PyObject_RichCompareBool()
based on comments from David Abrahams.
Added refcount information for these functions.
2002-06-14 14:35:56 +00:00
Fred Drake 178153f8d6 Add documentation for PyObject_RichCompare() and PyObject_RichCompareBool(),
constributed by David Abrahams.
This closes SF patch #568081.
2002-06-13 11:51:48 +00:00
Michael W. Hudson 5efaf7eac8 This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists

somewhat spruced up and better tested than it was when I wrote it.

Includes docs & tests.  The whatsnew section needs expanding, and arrays
should support extended slices -- later.
2002-06-11 10:55:12 +00:00
Guido van Rossum 9788384d02 Explain that tp_basicsize must provide alignment for the items. 2002-05-31 21:00:18 +00:00
Fred Drake ffb294bd34 Add refcount information for PySequence_ITEM(). 2002-05-23 16:03:16 +00:00
Fred Drake 86228e4ca2 Add version annotation for PySequence_ITEM(). 2002-05-23 16:02:28 +00:00
Martin v. Löwis 01f94bda38 Patch #552433: Special-case tuples. Avoid sub-type checking for lists.
Avoid checks for negative indices and duplicate checks for support of
the sequence protocol.
2002-05-08 08:44:21 +00:00
Thomas Heller 541703b18f Typo: whcar_t should be wchar_t.
Bugfix candidate? Don't know how this is handled in the docs.
2002-04-29 17:28:43 +00:00
Fred Drake 432425e834 Small markup adjustments for consistency. 2002-04-29 15:17:16 +00:00
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
Thomas Heller 8da4b59221 Fix a small mistake and complete some function prototypes.
SF Patch #547813.
2002-04-24 06:35:11 +00:00
Fred Drake b957bc3dcc Clarify the return value of PyObject_IsInstance(). 2002-04-23 18:15:44 +00:00
Fred Drake 8d95ca4469 Add text on tp_as_buffer that refers tothe section that covers the topic.
Additional material is still needed in that section.
2002-04-17 13:44:58 +00:00
Fred Drake 121460d8cb Minor wording change. 2002-04-16 18:32:37 +00:00
Fred Drake 9ad70f9cb0 Add more text from Guido on the type structure fields.
Small additional changes.
2002-04-16 16:22:24 +00:00
Fred Drake 0e0b6180ba Add documentation for PyObject_Call().
Note that PyObject_Size() is a synonym for PyObject_Length().
This closes SF patch #544330 (contributed by Thomas Heller).
2002-04-15 20:51:19 +00:00
Fred Drake 188ecd141a Integrated more text from Guido. 2002-04-15 18:44:46 +00:00
Fred Drake 4d2a95dfe7 Integrate a bunch of new text from Guido. 2002-04-12 22:47:18 +00:00
Fred Drake f495ef7466 Warn people away from PyModule_GetDict(), but not too strongly.
(The real issue is whether modules can benefit from an alternate
implementation strategy rather than using a dictionary.  We should migrate
away from direct dictionary manipulation to allow more room for Jeremy to
flex the implementation with changes in globals lookup.)
2002-04-12 19:32:07 +00:00
Fred Drake 28de8d4b37 Add a (very) simple description of PyType_Ready(). 2002-04-12 16:15:10 +00:00
Fred Drake e3c764b6c2 Document PyType_CheckExact(), PyType_IS_GC().
Update description of PyType_Check().
2002-04-10 17:52:52 +00:00
Fred Drake 4d61775a35 Started filling in the information about some of the basic types and macros
used to define Python objects.
2002-04-09 21:22:07 +00:00
Fred Drake 375e30225e Update to use the new \csimplemacro macro 2002-04-09 21:09:42 +00:00
Tim Peters 87bbdd3085 Minor clarification about what's actually promised for PyMem_Malloc(0).
I probably didn't do a correct thing for the LaTeX spelling of the
integer 1.
2002-04-06 09:14:33 +00:00
Fred Drake 68304ccce3 Move reference material on PyArg_Parse*() out of the Extending & Embedding
document to the C API reference.  Move some instructional text from the API
reference to the Extending & Embedding manual.

Fix the descriptions of the es and es# formats for PyArg_Parse*().
This closes SF bug #536516.
2002-04-05 23:01:14 +00:00
Fred Drake 243ea71669 Correct the descriptions of the PyObject_As*Buffer() return values.
This closes SF bug #539081.
2002-04-04 04:10:36 +00:00
Fred Drake 7bf9715a8b Introduce two new flag bits that can be set in a PyMethodDef method
descriptor, as used for the tp_methods slot of a type.  These new flag
bits are both optional, and mutually exclusive.  Most methods will not
use either.  These flags are used to create special method types which
exist in the same namespace as normal methods without having to use
tedious construction code to insert the new special method objects in
the type's tp_dict after PyType_Ready() has been called.

If METH_CLASS is specified, the method will represent a class method
like that returned by the classmethod() built-in.

If METH_STATIC is specified, the method will represent a static method
like that returned by the staticmethod() built-in.

These flags may not be used in the PyMethodDef table for modules since
these special method types are not meaningful in that case; a
ValueError will be raised if these flags are found in that context.
2002-03-28 05:33:33 +00:00
Skip Montanaro 9e38c100ab fix a typo in PyErr_Format table and add row for 'p' format char
closes bug 534495
2002-03-27 13:42:50 +00:00
Neil Schemenauer 194152845c Fix example for PyErr_SetFromErrno() (need to pass exception type). 2002-03-23 20:57:11 +00:00
Fred Drake 6ccdccd35d Add a note that Py_None needs the same reference count treatment as any
other PyObject *.
This closes SF bug #494007.
2002-03-12 20:12:54 +00:00
Fred Drake 314bae50b9 Documentation for PyObject_GetIter(), contributed by Greg Chapman
(with only minor changes by Fred).
This closes SF bug #498607.
2002-03-11 18:46:29 +00:00