Commit Graph

261 Commits

Author SHA1 Message Date
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