annotate Include/modsupport.h @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents 65d2d8e67da3
children 4c8e4e9311e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1 #ifndef Py_MODSUPPORT_H
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2 #define Py_MODSUPPORT_H
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
3 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
4 extern "C" {
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
5 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
6
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
7 /***********************************************************
2058
508036dbba3b Added 1995 copyright.
Guido van Rossum <guido@python.org>
parents: 1906
diff changeset
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
508036dbba3b Added 1995 copyright.
Guido van Rossum <guido@python.org>
parents: 1906
diff changeset
9 The Netherlands.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
10
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
11 All Rights Reserved
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
12
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
13 Permission to use, copy, modify, and distribute this software and its
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
14 documentation for any purpose and without fee is hereby granted,
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
15 provided that the above copyright notice appear in all copies and that
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
16 both that copyright notice and this permission notice appear in
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
17 supporting documentation, and that the names of Stichting Mathematisch
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
18 Centrum or CWI or Corporation for National Research Initiatives or
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
19 CNRI not be used in advertising or publicity pertaining to
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
20 distribution of the software without specific, written prior
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
21 permission.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
22
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
23 While CWI is the initial source for this software, a modified version
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
24 is made available by the Corporation for National Research Initiatives
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
25 (CNRI) at the Internet address ftp://ftp.python.org.
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
26
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
34 PERFORMANCE OF THIS SOFTWARE.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
35
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
36 ******************************************************************/
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
37
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 /* Module support interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
39
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
40 #ifdef HAVE_STDARG_PROTOTYPES
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
41
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
42 #include <stdarg.h>
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
43
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
44 extern int PyArg_Parse Py_PROTO((PyObject *, char *, ...));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
45 extern int PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
46 extern PyObject *Py_BuildValue Py_PROTO((char *, ...));
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
47
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
48 #else
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
49
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
50 #include <varargs.h>
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
51
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
52 /* Better to have no prototypes at all for varargs functions in this case */
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
53 extern int PyArg_Parse();
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
54 extern int PyArg_ParseTuple();
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
55 extern PyObject *Py_BuildValue();
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
56
1252
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
57 #endif
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
58
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
59 extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
60 extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
1252
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
61
4403
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
62 #define PYTHON_API_VERSION 1006
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
63 #define PYTHON_API_STRING "1006"
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
64 /* The API version is maintained (independently from the Python version)
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
65 so we can detect mismatches between the interpreter and dynamically
3831
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
66 loaded modules. These are diagnosticised by an error message but
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
67 the module is still loaded (because the mismatch can only be tested
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
68 after loading the module). The error message is intended to
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
69 explain the core dump a few seconds later.
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
70
4110
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
71 The symbol PYTHON_API_STRING defines the same value as a string
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
72 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
73
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
74 Please add a line or two to the top of this log for each API
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
75 version change:
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
76
4403
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
77 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
78
3831
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
79 30-Jul-1996 GvR Slice and ellipses syntax added
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
80
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
81 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
82
3318
8b8d60fbe3bf bump api version
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
83 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
8b8d60fbe3bf bump api version
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
84
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
85 10-Jan-1995 GvR Renamed globals to new naming scheme
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
86
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
87 9-Jan-1995 GvR Initial version (incompatible with older API)
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
88 */
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
89
4110
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
90 #ifdef MS_WINDOWS
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
91 /* Special defines for Windows versions. MS_DLL_ID is the key
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
92 used in the registry.
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
93 The full MS_DLL_VERSION_ID is imbedded in the core DLL, and
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
94 is so installers can determine incremental changes.
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
95 */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
96 #define MS_DLL_ID "1.4.0"
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
97 #define MS_DLL_VERSION_ID MS_DLL_ID "." PYTHON_API_STRING
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
98
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
99 #endif /* MS_WINDOWS */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
100
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
101 #ifdef Py_TRACE_REFS
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
102 /* When we are tracing reference counts, rename Py_InitModule4 so
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
103 modules compiled with incompatible settings will generate a
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
104 link-time error. */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
105 #define Py_InitModule4 Py_InitModule4TraceRefs
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
106 #endif
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
107
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
108 extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
109 char *, PyObject *, int));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
110 #define Py_InitModule(name, methods) \
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
111 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
112 PYTHON_API_VERSION)
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
113
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
114 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
115 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
116 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
117 #endif /* !Py_MODSUPPORT_H */