Commit Graph

430 Commits

Author SHA1 Message Date
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
Fred Drake 8371e840d2 Correct the refcount information for the PyWeakref_GetObject() function.
This closes SF bug #520087.
2002-02-20 05:07:36 +00:00
Skip Montanaro ea3ceaa913 PyDict_Next: update doc to indicate that pkey and pvalue return values are
borrowed references.
2002-01-23 10:54:41 +00:00
Skip Montanaro a23bc42ad5 add missing return value info for PyDict_DelItem 2002-01-23 08:18:30 +00:00
Fred Drake 8b8fe288b3 Close an improperly-closed verbatim environment.
This closes SF patch #496215.

Add a little more detail to the example that had not been closed.

Bugfix: this should be made part of 2.2.1.
2001-12-26 16:53:48 +00:00
Fred Drake 54e6294197 A number of small adjustments. 2001-12-11 19:40:16 +00:00
Tim Peters f582b82fe9 SF bug #491415 PyDict_UpdateFromSeq2() unused
PyDict_UpdateFromSeq2():  removed it.
PyDict_MergeFromSeq2():  made it public and documented it.
PyDict_Merge() docs:  updated to reveal <wink> that the second
argument can be any mapping object.
2001-12-11 18:51:08 +00:00
Fred Drake 32a3587345 Document that PyString_FromString() cannot take NULL as a parameter.
This closes SF bug #489872.
2001-12-06 20:38:15 +00:00
Fred Drake 551ffae30c Clarify that the Python runtime may behave mysteriously when an exception
is not handled properly.
This closes SF bug #485153.
2001-12-03 17:56:09 +00:00
Fred Drake 3570551d6f Remove most references to __members__ and __methods__, leaving only one pair
of references that now state that these attributes have been removed,
directing the reader to the dir() function.
This closes SF bug #456420.
2001-12-03 17:32:27 +00:00
Fred Drake f07125ee53 PyErr_Format() does not return a new reference; it always returns NULL.
This closes SF bug #488387.
2001-12-03 16:36:43 +00:00
Fred Drake 454af89712 Update the signature of PyFile_WriteString(). 2001-11-29 22:42:59 +00:00
Fred Drake c37b65ee10 Clean up some markup cruft. A number of the macros that take no
parameters (like \UNIX) are commonly entered using an empty group to
separate the markup from a following inter-word space; this is not
needed when the next character is punctuation, or the markup is the
last thing in the enclosing group.  These cases were marked
inconsistently; the empty group is now *only* used when needed.
2001-11-28 07:26:15 +00:00
Fred Drake cd8474e6a2 Add documentation for the PyCell* APIs. 2001-11-26 21:29:17 +00:00
Fred Drake 50ecc15d05 Add omitted word for clarity. 2001-11-17 06:39:18 +00:00
Thomas Heller bfeeeee851 Fix obvious typos. 2001-11-12 07:46:31 +00:00
Fred Drake 94ead57dc3 Added version annotations, remove hard tabs. 2001-11-09 23:34:26 +00:00
Jeremy Hylton 89c3a22a27 Add PyObject_CheckReadBuffer(), which returns true if its argument
supports the single-segment readable buffer interface.

Add documentation for this and other PyObject_XXXBuffer() calls.
2001-11-09 21:59:42 +00:00
Fred Drake 1b58bff8a0 More refcount information. 2001-10-29 17:43:14 +00:00
Fred Drake b0c079e3e5 PyObject_CallFunctionObArgs() ---> PyObject_CallFunctionObjArgs()
PyObject_CallMethodObArgs() ---> PyObject_CallMethodObjArgs()
2001-10-28 02:39:03 +00:00
Fred Drake c44e9eca66 Added docs for PyObject_CallFunctionObArgs() and PyObject_CallMethodObArgs().
Minor cleanups & markup consistency fixes.
2001-10-26 16:38:38 +00:00
Fred Drake 81c7aa2c7b Added refcount data for PyObject_CallFunctionObArgs() and
PyObject_CallMethodObArgs().
2001-10-26 16:29:22 +00:00
Tim Peters 1fc240e851 Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).

dictobject.c, new functions PyDict_{Merge,Update}FromSeq2.  These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object.  For now, I left these
functions file static, so no corresponding doc changes.  It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.

Also changed the name of dictionary's keyword argument from "mapping"
to "x".  Got a better name?  "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.

abstract.h, abstract.tex:  Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.

libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
  iteration, or an iterator object" is getting to be a PITA.  Many
  months ago I suggested factoring this out into "iterable object",
  where the definition of that could include being explicit about
  generators too (as is, I'm not sure a reader outside of PythonLabs
  could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.

abstract.c, PySequence_Tuple():  When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
2001-10-26 05:06:50 +00:00
Fred Drake 847c51a181 Slightly better conformance to the Python C style guide. 2001-10-25 15:53:44 +00:00
Fred Drake c84f2c5068 Documentation for the new PyArg_UnpackTuple() function. 2001-10-23 21:10:18 +00:00
Fred Drake 5bf1ecd503 Update the description of PyTrace_EXCEPT. 2001-10-16 19:23:55 +00:00
Fred Drake 0fae49fc7b Added documentation for the functions listed in marshal.h.
Prompted by Jim Ahlstrom.  This closes SF patch #470614.
2001-10-14 04:45:51 +00:00
Fred Drake 3adf79e3e2 Break the Python/C API manual into smaller files by chapter. This manual
has grown beyond what font-lock will work with using the default (X)Emacs
settings.

Indentation of the description has been made consistent, and a number of
smaller markup adjustments have been made as well.
2001-10-12 19:01:43 +00:00
Fred Drake bf88b68f38 Add documentation for the public API for weak reference objects. 2001-10-05 22:03:58 +00:00
Fred Drake 6f3d82693a Expand the documentation of the low-level tracing/profiling interface.
This reflects what is currently in CVS, which may change before 2.2 is final.
2001-10-03 21:52:51 +00:00
Greg Ward e22871e9ed Typo fix. 2001-09-26 18:12:49 +00:00
Fred Drake f244b2e47c Add more signature information and some descriptions for the new APIs
introduced in Python 2.2.
Add documentation for the slice object interface (not complete).
Added version annotations for several of the Python 2.2 APIs already
documented.
2001-09-24 15:31:50 +00:00
Fred Drake 23a78cf1c1 Add more reference count information. 2001-09-24 15:29:47 +00:00
Fred Drake d61d0d3f6d Added API information for the PyCallIter_*() and PySeqIter_*() functions.
Added signatures for some new PyType_*() functions.
2001-09-23 02:05:26 +00:00
Fred Drake f47d8ef683 Document all the Py*_CheckExact() functions.
Document many more of the PyLong_{As,From}*() functions.
2001-09-20 19:18:52 +00:00
Fred Drake 9c75ff785a Fix parameter for PyInt_Check().
Add refcount information for other recently documented APIs.
2001-09-06 18:06:46 +00:00
Fred Drake f8d7a5d391 Document the PyMethod_* type object, functions, and macros. 2001-09-06 17:12:44 +00:00
Fred Drake 396ca574dd Document the rule that Python.h must be included before any standard
headers.  This is the final checkin for SF bug #458768.
2001-09-06 16:30:30 +00:00
Martin v. Löwis 7c82a3e0fc Patch #449815: Set filesystemencoding based on CODESET. 2001-09-05 17:09:48 +00:00
Tim Peters 7eea37e831 At Guido's suggestion, here's a new C API function, PyObject_Dir(), like
__builtin__.dir().  Moved the guts from bltinmodule.c to object.c.
2001-09-04 22:08:56 +00:00
Neil Schemenauer 55cdc88c09 Update documentation for GC API. Closes SF patch #421893. 2001-08-30 15:24:17 +00:00
Barry Warsaw 8c64a54f75 Refcount info for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.
2001-08-28 02:32:04 +00:00
Barry Warsaw c86aa57f58 Documentation for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.
2001-08-28 02:31:28 +00:00
Fred Drake 0e40c3d012 Document PyTuple_GET_SIZE(), removing confusing sentence from PyDict_Copy()
description.

This fixes SF bug #453111.
2001-08-20 16:48:59 +00:00
Martin v. Löwis e3eb1f2b23 Patch #427190: Implement and use METH_NOARGS and METH_O. 2001-08-16 13:15:00 +00:00
Fred Drake 680cabb225 Add "exceptions" to the list of fundamental modules
created by Py_Initialize().

This closes SF bug #450621.
2001-08-14 15:32:16 +00:00
Fred Drake 11ee90289c Added documentation for PyDict_Update() and PyDict_Merge(). 2001-08-10 21:31:12 +00:00
Fred Drake 024ef6f493 Remove the bogus flags parameter from the PyFile_WriteString() signature;
it has no such parameter.

This closes SF bug #449761.
2001-08-10 14:27:38 +00:00
Fred Drake 0197858f62 Added documentation for PyNumber_*FloorDivide(), PyNumber_*TrueDivide(),
PyInterpreterState_*Head(), PyInterpreterState_Next(), and
PyThreadState_Next().

Wrapped some long lines, added some others.
2001-08-08 19:14:53 +00:00
Fred Drake 03590c6bdc Reference counting information for PyNumber_*FloorDivide() and
PyNumber_*TrueDivide().
2001-08-08 18:50:18 +00:00
Fred Drake f90490ef94 Move away from apply() to using extended call syntax for some example
fragments when discussing equivalence of thhe C API to what a Python
programmer sees.

Added descriptions of PyEval_SetProfile() and PyEval_SetTrace().
2001-08-02 18:00:28 +00:00
Fred Drake 88fdaa7c9e Typo: PyArgs_ParseTuple --> PyArg_ParseTuple
Moved the PyArg_Parse*(), Py_BuildValue() functions to the Utilities
chapter, added a minimal description and reference to the Extending
manual for Py_BuildValue().
2001-07-20 20:56:11 +00:00
Fred Drake 6d988559a3 Added information on Py_BuildValue(). 2001-07-20 20:55:31 +00:00
Fred Drake 68db730324 Adding what's done of the documentation for the new profiling &
tracing interface.  Incomplete, but better to check it in since I've
been including it in my updates.
2001-07-17 19:48:30 +00:00
Fred Drake 755c23dcc4 Oops, one more caret. 2001-07-14 03:05:53 +00:00
Fred Drake 377fb1e1f6 Fix the markup of the caret charater in a couple of places; LaTeX's
special character bite us again.  ;-(

This fixes SF bug #440911.
2001-07-14 03:01:48 +00:00
Fred Drake fa774872b8 Move the section on concrete numeric objects before the section on
concrete sequence objects, since their API is simpler.

This is in response to a comment in SF bug #440037.
2001-07-11 20:35:37 +00:00
Fred Drake d854831ddd Corrected the refcount information for PyList_SET_ITEM(). 2001-07-10 16:19:13 +00:00
Fred Drake bab2965c7c Document PyObject_New(), PyObject_NewVar(), PyObject_Init(),
PyObject_InitVar(), PyObject_Del(), PyObject_NEW(),
PyObject_NEW_VAR(), and PyObject_DEL().

Add notes to PyMem_Malloc() and PyMem_New() about the memory buffers
not being initialized.

This fixes SF bug #439012.


Added explicit return value information for PyList_SetItem(),
PyDict_SetItem(), and PyDict_SetItemString().  Corrected return type
for PyList_SET_ITEM().

Fixed index entries in the descriptions of PyLong_AsLong() and
PyLong_AsUnignedLong().

This fixes the API manual portion of SF bug #440037.


Note that the headers properly declare everything as 'extern "C"' for
C++ users.

Document _Py_NoneStruct.

Added links to the Extending & Embedding manual for PyArg_ParseTuple()
and PyArg_ParseTupleAndKeywords().

Added note that PyArg_Parse() should not be used in new code.

Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
translation more difficult, as well as reading the English more
difficult for non-native speakers.
2001-07-10 16:10:08 +00:00
Thomas Wouters e30ac57038 Fix for SF bug #436525, reported by Greg Kochanski:
The block/unblock thread macros are called 'Py_BLOCK_THREADS' and
'Py_UNBLOCK_THREADS', not 'Py_BEGIN_BLOCK_THREADS' and
'Py_BEGIN_UNBLOCK_THREADS'.
2001-07-09 14:35:01 +00:00
Fred Drake 8e0c09da62 More reference count information. 2001-07-06 23:31:49 +00:00
Fred Drake 490d34dbad Move license information to a less annoying location in the document.
Add documentation for PyErr_SetFromErrnoWithFilename().
2001-06-20 21:39:12 +00:00
Fred Drake 00d0cb6ec3 Explained more differences between PyList_SetItem() and PyList_SET_ITEM().
In particular, the affect on existing list content was not sufficiently
explained.

This closes SF bug #429554.
2001-06-03 03:12:57 +00:00
Fred Drake 96a2a80065 Users of PySequence_GET_FAST() should get the length of the sequence using
PySequence_Size(), not PyObject_Size(): the later considers the mapping
methods as well as the sequence methods, which is not needed here.  Either
should be equally fast in this case, but PySequence_Size() offers a better
conceptual match.
2001-05-29 18:51:41 +00:00
Fred Drake b2625eb10e Removed information on the old third parameter to _PyTuple_Resize().
Added information on PyIter_Check(), PyIter_Next(),
PyObject_Unicode(), PyString_AsDecodedObject(),
PyString_AsEncodedObject(), and PyThreadState_GetDict().
2001-05-29 15:34:06 +00:00
Fred Drake fac312ff88 Do not start API descriptions with "Does the same, but ..." -- actually
state *which* other function the current one is like, even if the
descriptions are adjacent.

Revise the _PyTuple_Resize() description to reflect the removal of the
third parameter.
2001-05-29 15:13:00 +00:00
Fred Drake 24e621918b Add documentation for Py_Main() and PyThreadState_GetDict(). 2001-05-21 15:56:55 +00:00
Fred Drake fc43d00c17 Typo: "that" --> "than"
This closes SF bug #425320.
2001-05-21 15:03:35 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Fred Drake a8e0827614 Hmm... better add a version annotation for the Iterator Protocol section. 2001-05-07 17:47:07 +00:00
Fred Drake dbcaeda79a Added documentation for PyIter_Check() and PyIter_Next().
Wrapped a long line.
2001-05-07 17:42:18 +00:00
Marc-André Lemburg 8155e0e541 This patch originated from an idea by Martin v. Loewis who submitted a
patch for sharing single character Unicode objects.

Martin's patch had to be reworked in a number of ways to take Unicode
resizing into consideration as well. Here's what the updated patch
implements:

* Single character Unicode strings in the Latin-1 range are shared
  (not only ASCII chars as in Martin's original patch).

* The ASCII and Latin-1 codecs make use of this optimization,
  providing a noticable speedup for single character strings. Most
  Unicode methods can use the optimization as well (by virtue
  of using PyUnicode_FromUnicode()).

* Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY)

* The PyUnicode_Resize() can now also handle the case of resizing
  unicode_empty which previously resulted in an error.

* Modified the internal API _PyUnicode_Resize() and
  the public PyUnicode_Resize() API to handle references to
  shared objects correctly. The _PyUnicode_Resize() signature
  changed due to this.

* Callers of PyUnicode_FromUnicode() may now only modify the Unicode
  object contents of the returned object in case they called the API
  with NULL as content template.

Note that even though this patch passes the regression tests, there
may still be subtle bugs in the sharing code.
2001-04-23 14:44:21 +00:00
Fred Drake 8d00a0ffc3 Michael Hudson:
Update docs for PyDict_Next() based on the most recent changes to the
dictionary code.

This closes SF patch #409864.
2001-04-13 17:55:02 +00:00
Fred Drake d20d8b319c Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. 2001-04-13 14:52:39 +00:00
Greg Stein 4d4d0034c0 Correct the documentation for getreadbufferproc and getwritebufferproc.
Fixes bug #233308 from Travis Oliphant.
2001-04-07 16:14:49 +00:00
Fred Drake c6a3cb4baf Document PySequence_Size(), and describe PySequence_Length() as simply an
alternate name for the same function.
2001-04-04 01:25:17 +00:00
Fred Drake 58c8f9f631 Added documentation for PyObject_IsInstance() and PyObject_IsSubclass(). 2001-03-28 21:14:32 +00:00
Fred Drake 8f6df46d40 Strengthen the constraints on calling PyObject_GC_Fini(). 2001-03-23 17:42:09 +00:00
Fred Drake e28d8aef2d Be more clear about the specific rules for supporting the cyclic GC in an
extension object.  Also included an example showing exactly what needs to
be done and nothing else.

This closes SF bug #228591.
2001-03-22 16:30:17 +00:00
Fred Drake c392b570db Integrated an expanded version of some text from Neil Schemenauer about
supporting cyclic garbage collection.  (This is not all of it, but I'm
taking a break!)

Also fixed some markup nits.
2001-03-21 22:15:01 +00:00
Fred Drake 83e01bf6c8 Finally fill in the documentation for the PyDict_Next() function. It is
different enough to actually require an explanation.  ;-)

Fix a couple of PyDictObject* types that should be PyObject* types.
2001-03-16 15:41:29 +00:00
Guido van Rossum 1874c8f23b Document PyErr_WarnExplicit(). 2001-02-28 23:46:44 +00:00
Fred Drake a05460c148 PyTuple_*() functions take PyObject* parameters, not PyTupleObject* values.
This closes SF bug #131304.
2001-02-12 17:38:18 +00:00
Fred Drake f0e08ef9cb Remove an now-false statement about there being only one type flag
defined.
2001-02-03 01:11:26 +00:00
Fred Drake 5838d0fc84 Document the PyInstance_*() functions and data. 2001-01-28 06:39:35 +00:00
Fred Drake 5566c1ce36 Fixed a bunch of typos caught by Gilles Civario. 2001-01-19 22:48:33 +00:00
Marc-André Lemburg a544ea2354 Undoing the whitespace patches which sneaked into the earlier patch. 2001-01-17 18:04:31 +00:00
Marc-André Lemburg ad7c98e264 This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects.

A new C API PyObject_Unicode() is also provided.

This closes patch #101664.

Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
2001-01-17 17:09:53 +00:00
Fred Drake 81473b12b7 The Python/C API deals in PyObject*, not PyDictObject*. 2001-01-08 05:53:53 +00:00
Fred Drake 316ef7c574 Markup nit: Command line options should be marked with \programopt. 2001-01-04 05:56:34 +00:00
Guido van Rossum e22e4b2b59 Oops. The value "0 or +1" for the category argument of PyErr_Warn()
doesn't work.  Make it 0.  (Although it really *should* be 0 or +1 --
the refcount is incremented when it is raised as an exception, but not
otherwise.)
2000-12-19 03:58:11 +00:00
Guido van Rossum 9a18a7ed03 Document Pyerr_Warn().
Add an XXX comment at the beginning expressing disappointment over the
confusing way refcount behavior of arguments is documented.
2000-12-19 03:53:57 +00:00
Guido van Rossum 3dbb406335 Document Pyerr_Warn(). 2000-12-19 03:53:01 +00:00
Fred Drake 6b3f3f2861 In the first discussion showing how to handle exceptions from C, make the
Python equivalent actually equivalent to the C code.  Also, in the C code,
place the "goto" statements on a line by themselves for better visibility
of statements that affect control flow.

This closes bug #123398.
2000-11-29 15:48:22 +00:00
Fred Drake ee814bf2c9 Added documentation for the Py_InitModule*() family of functions. 2000-11-28 22:34:32 +00:00
Fred Drake 0ac000cd54 Updates to reflect pending changes to the XML conversion process. 2000-11-22 16:42:37 +00:00
Fred Drake 8902442e2f Added exception to the rule that the buffer returned by PyString_AsString()
and PyString_AsStringAndSize() for strings that were just created using
PyString_FromStringAndSize(NULL, n).

This closes bug #117377.

Added warning about passing NULL to the concrete object functions; many of
them use the appropriate Py<Type>_Check() test, but do not check for NULL.

"de-allocated" --> "deallocated"
2000-10-23 16:00:54 +00:00
Fred Drake 89fb035248 For PyErr_Format(), note that the exception parameter can be a string or
class, but not an instance (since an instance will be created using the
formatted message string as the constructor parameter).
2000-10-14 05:49:30 +00:00
Fred Drake 5d64421c23 Fix a couple of places where the descriptions of *_GET_SIZE() macros said
they were similar to *_GetSize(); should be similar to *_Size().

Error noted by William Park <parkw@better.net>.
2000-10-07 12:31:50 +00:00
Neil Schemenauer 410cb6be8f The _PyTuple_Resize() last_is_sticky flag must now always be false. 2000-10-05 19:38:24 +00:00
Fred Drake ffe58ca6ef Reversely --> Conversely
This closes SourceForge bug #115673.
2000-09-29 17:31:54 +00:00
Fred Drake 0b71ceaeff Note that including Python.h includes limits.h when available. 2000-09-26 05:51:50 +00:00
Fred Drake 891150bdf2 Added documentation for the new PyModule_*() convenience functions.
This closes SourceForge patch #101233.
2000-09-23 03:25:42 +00:00
Fred Drake 1fa9365066 Added refcount information for the *_InPlace*() API series.
This closes SourceForge bug #114287.
2000-09-22 18:19:37 +00:00
Fred Drake c0e6c5beb2 PyNumber_Coerce() returns an int, not a PyObject *. 2000-09-22 18:17:49 +00:00
Fred Drake ed773ef78d Include the new text on reporting bugs in a few useful places.
This closes SourceForge bug #114792.
2000-09-21 21:35:22 +00:00
Marc-André Lemburg d1ba443206 This patch adds a new Python C API called PyString_AsStringAndSize()
which implements the automatic conversion from Unicode to a string
object using the default encoding.

The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.

As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.
2000-09-19 21:04:18 +00:00
Guido van Rossum c96ec6ef2b Document new APIs PyOS_getsig() and PyOS_setsig().
(Is there no macro to document a typedef?)

Fred, please check my latex!
2000-09-16 16:30:48 +00:00
Fred Drake d5d0435617 Use \shortversion in a number of places.
This partially addresses SourceForge bug #114318.
2000-09-14 20:24:17 +00:00
Fred Drake 933f0c38ef Avoid reference to specific versions of Python where possible.
This partially addresses SourceForge bug #114318.
2000-09-14 18:12:48 +00:00
Fred Drake 7740a01096 Thomas Wouters <thomas@xs4all.net>:
Fix up some of the PyNumber_*() documentation.
Add documentation for the InPlace API calls.
2000-09-12 20:27:05 +00:00
Fred Drake f913e542be Vladimir Marangozov <Vladimir.Marangozov@inrialpes.fr>:
Here are some changes to the C API docs. The memory examples & API have
been updated because one malloc family is gone (Py_Malloc).
You'll see other small additions to the "building new types" section
for completeness and some cleanup at the end of the memory section.
2000-09-12 20:17:17 +00:00
Fred Drake 81cccb7563 Added documentation for PySequence_Fast() and PySequence_Fast_GET_ITEM(). 2000-09-12 15:22:05 +00:00
Moshe Zadka 57a5932f13 Update documentation for PyErr_Format, because the function has changed.
Connected to patch 100895
2000-09-01 09:47:20 +00:00
Fred Drake e0d9a83bea Document PyImport_AppendInittab(), PyImport_ExtendInittab(), and
struct _inittab.

This closes SourceForge bug #111499.
2000-09-01 05:30:00 +00:00
Jeremy Hylton b709df3810 refactor __del__ exception handler into PyErr_WriteUnraisable
add sanity check to gc: if an exception occurs during GC, call
PyErr_WriteUnraisable and then call Py_FatalEror.
2000-09-01 02:47:25 +00:00
Fred Drake 17e6343d2d Document PyOS_CheckStack().
Fix a couple of really minor markup nits.
2000-08-31 05:50:40 +00:00
Fred Drake 34c391d743 Correct the reference count information for the parameters of
PyErr_Restore().
2000-08-15 04:36:16 +00:00
Fred Drake 510d08bfe4 In the section on the "Very High Level Layer", address concerns brought up
by Edward K. Ream <edream@users.sourceforge.net> about FILE* values and
incompatible C libraries in dynamically linked extensions.  It is not clear
(to me) how realistic the issue is, but it is better documented than not.

This closes SourceForge bug #111520.
2000-08-14 02:50:21 +00:00
Fred Drake 4ca744c70e Added information for PyEval_EvalCode().
Fixed a couple of typos (new references are represented by "+1", not "1").
2000-08-12 03:39:47 +00:00
Fred Drake a8d7341f63 PyRun_InteractiveOne(),
PyRun_InteractiveLoop():  Added descriptions.

PyExc_WindowsError:  Added to list of standard exceptions and added note
                     about the right preprocessor symbol to use to protect
                     code that uses it.
2000-08-11 20:39:29 +00:00
Fred Drake 7d45d34ed7 ANY becomes void, to reflect the requirement for ANSI C. 2000-08-11 17:07:32 +00:00
Andrew M. Kuchling 8c46b30e0a Document PyObject_AsFileDescriptor 2000-07-13 23:58:16 +00:00
Marc-André Lemburg 4707320566 Added new APIs and fixed some other Unicode ones (missing * or
extra ' ').
2000-07-07 15:48:54 +00:00
Marc-André Lemburg 5a20b21fb1 Added docs for the new Unicode and string APIs. 2000-07-07 15:47:06 +00:00