Mercurial > cpython-lru_cache-weakref
annotate Include/pyerrors.h @ 20737:00a581bdedeb legacy-trunk
When overriding __str__ or __repr__, set the tp_print slot to NULL.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 29 Oct 2001 14:33:44 +0000 |
| parents | 3d299b156511 |
| children | ba67b9c97b69 |
| rev | line source |
|---|---|
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
1 #ifndef Py_ERRORS_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
2 #define Py_ERRORS_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
3 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
4 extern "C" { |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
5 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
6 |
| 145 | 7 |
| 6 | 8 /* Error handling definitions */ |
| 9 | |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
10 DL_IMPORT(void) PyErr_SetNone(PyObject *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
11 DL_IMPORT(void) PyErr_SetObject(PyObject *, PyObject *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
12 DL_IMPORT(void) PyErr_SetString(PyObject *, const char *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
13 DL_IMPORT(PyObject *) PyErr_Occurred(void); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
14 DL_IMPORT(void) PyErr_Clear(void); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
15 DL_IMPORT(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
16 DL_IMPORT(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); |
| 6 | 17 |
|
6146
a2a1df0ca808
Three new C API functions:
Barry Warsaw <barry@python.org>
parents:
5230
diff
changeset
|
18 /* Error testing and normalization */ |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
19 DL_IMPORT(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
20 DL_IMPORT(int) PyErr_ExceptionMatches(PyObject *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
21 DL_IMPORT(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); |
|
6146
a2a1df0ca808
Three new C API functions:
Barry Warsaw <barry@python.org>
parents:
5230
diff
changeset
|
22 |
|
a2a1df0ca808
Three new C API functions:
Barry Warsaw <barry@python.org>
parents:
5230
diff
changeset
|
23 |
| 86 | 24 /* Predefined exceptions */ |
|
10
a71e896ed047
Made exception objects extern.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
25 |
|
6318
cdc5a40fcf97
Introduce PyExc_Exception as the conceptual root class for all exceptions.
Guido van Rossum <guido@python.org>
parents:
6191
diff
changeset
|
26 extern DL_IMPORT(PyObject *) PyExc_Exception; |
|
17597
32e7d0898eab
Iterators phase 1. This comprises:
Guido van Rossum <guido@python.org>
parents:
16849
diff
changeset
|
27 extern DL_IMPORT(PyObject *) PyExc_StopIteration; |
|
6191
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
28 extern DL_IMPORT(PyObject *) PyExc_StandardError; |
|
6323
3f8d7f74f1bc
[Py_Exc]NumberError => [Py_Exc]ArithmeticError
Barry Warsaw <barry@python.org>
parents:
6318
diff
changeset
|
29 extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; |
|
6191
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
30 extern DL_IMPORT(PyObject *) PyExc_LookupError; |
|
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
31 |
| 5230 | 32 extern DL_IMPORT(PyObject *) PyExc_AssertionError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
33 extern DL_IMPORT(PyObject *) PyExc_AttributeError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
34 extern DL_IMPORT(PyObject *) PyExc_EOFError; |
|
5117
2bb0bda1585c
Changes for Lee Busby's SIGFPE patch set.
Guido van Rossum <guido@python.org>
parents:
5106
diff
changeset
|
35 extern DL_IMPORT(PyObject *) PyExc_FloatingPointError; |
|
8703
50757465fa70
New global variables: PyExc_EnvironmentError and PyExc_OSError
Barry Warsaw <barry@python.org>
parents:
6324
diff
changeset
|
36 extern DL_IMPORT(PyObject *) PyExc_EnvironmentError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
37 extern DL_IMPORT(PyObject *) PyExc_IOError; |
|
8703
50757465fa70
New global variables: PyExc_EnvironmentError and PyExc_OSError
Barry Warsaw <barry@python.org>
parents:
6324
diff
changeset
|
38 extern DL_IMPORT(PyObject *) PyExc_OSError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
39 extern DL_IMPORT(PyObject *) PyExc_ImportError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
40 extern DL_IMPORT(PyObject *) PyExc_IndexError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
41 extern DL_IMPORT(PyObject *) PyExc_KeyError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
42 extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
43 extern DL_IMPORT(PyObject *) PyExc_MemoryError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
44 extern DL_IMPORT(PyObject *) PyExc_NameError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
45 extern DL_IMPORT(PyObject *) PyExc_OverflowError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
46 extern DL_IMPORT(PyObject *) PyExc_RuntimeError; |
|
9564
d13a60b44b45
Added PyExc_NotImplementedError
Barry Warsaw <barry@python.org>
parents:
8703
diff
changeset
|
47 extern DL_IMPORT(PyObject *) PyExc_NotImplementedError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
48 extern DL_IMPORT(PyObject *) PyExc_SyntaxError; |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
49 extern DL_IMPORT(PyObject *) PyExc_IndentationError; |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
50 extern DL_IMPORT(PyObject *) PyExc_TabError; |
|
20279
8b3ea7335c1b
weakref.ReferenceError becomes a built-in exception now that weak ref objects
Fred Drake <fdrake@acm.org>
parents:
19433
diff
changeset
|
51 extern DL_IMPORT(PyObject *) PyExc_ReferenceError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
52 extern DL_IMPORT(PyObject *) PyExc_SystemError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
53 extern DL_IMPORT(PyObject *) PyExc_SystemExit; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
54 extern DL_IMPORT(PyObject *) PyExc_TypeError; |
| 11030 | 55 extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError; |
|
11963
24199c1b9182
Marc-Andre Lemburg: add PyExc_UnicodeError
Guido van Rossum <guido@python.org>
parents:
11799
diff
changeset
|
56 extern DL_IMPORT(PyObject *) PyExc_UnicodeError; |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
57 extern DL_IMPORT(PyObject *) PyExc_ValueError; |
|
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
58 extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError; |
|
11799
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
59 #ifdef MS_WINDOWS |
|
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
60 extern DL_IMPORT(PyObject *) PyExc_WindowsError; |
|
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
61 #endif |
|
23
08562de01668
Added err_badcall() and planned new errors.
Guido van Rossum <guido@python.org>
parents:
10
diff
changeset
|
62 |
|
6191
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
63 extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst; |
|
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
64 |
|
15589
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
65 /* Predefined warning categories */ |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
66 extern DL_IMPORT(PyObject *) PyExc_Warning; |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
67 extern DL_IMPORT(PyObject *) PyExc_UserWarning; |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
68 extern DL_IMPORT(PyObject *) PyExc_DeprecationWarning; |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
69 extern DL_IMPORT(PyObject *) PyExc_SyntaxWarning; |
|
19433
5d81c6bff306
Introduce OverflowWarning -- to be issued when short int operations
Guido van Rossum <guido@python.org>
parents:
18915
diff
changeset
|
70 extern DL_IMPORT(PyObject *) PyExc_OverflowWarning; |
|
15589
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
71 extern DL_IMPORT(PyObject *) PyExc_RuntimeWarning; |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
72 |
|
6191
3a6b7a377dc3
Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents:
6146
diff
changeset
|
73 |
|
10
a71e896ed047
Made exception objects extern.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
74 /* Convenience functions */ |
|
a71e896ed047
Made exception objects extern.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
75 |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
76 extern DL_IMPORT(int) PyErr_BadArgument(void); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
77 extern DL_IMPORT(PyObject *) PyErr_NoMemory(void); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
78 extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
79 extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); |
|
20626
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
80 extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...) |
|
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
81 __attribute__((format(printf, 2, 3))); |
|
11799
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
82 #ifdef MS_WINDOWS |
|
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
83 extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); |
|
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
84 extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int); |
|
3678dd685867
Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents:
11030
diff
changeset
|
85 #endif |
|
23
08562de01668
Added err_badcall() and planned new errors.
Guido van Rossum <guido@python.org>
parents:
10
diff
changeset
|
86 |
|
14170
019265b3a856
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents:
13435
diff
changeset
|
87 /* Export the old function so that the existing API remains available: */ |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
88 extern DL_IMPORT(void) PyErr_BadInternalCall(void); |
|
14170
019265b3a856
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents:
13435
diff
changeset
|
89 extern DL_IMPORT(void) _PyErr_BadInternalCall(char *filename, int lineno); |
|
019265b3a856
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents:
13435
diff
changeset
|
90 /* Mask the old API with a call to the new API for code compiled under |
|
019265b3a856
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents:
13435
diff
changeset
|
91 Python 2.0: */ |
|
019265b3a856
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents:
13435
diff
changeset
|
92 #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) |
|
1288
9fed5726a36d
Several changes in one:
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
93 |
|
6324
20b5647a067e
New API PyErr_NewException(name, base, dict) to create simple new exceptions.
Guido van Rossum <guido@python.org>
parents:
6323
diff
changeset
|
94 /* Function to create a new exception */ |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
95 DL_IMPORT(PyObject *) PyErr_NewException(char *name, PyObject *base, |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
96 PyObject *dict); |
|
14330
6dee1985c681
refactor __del__ exception handler into PyErr_WriteUnraisable
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14170
diff
changeset
|
97 extern DL_IMPORT(void) PyErr_WriteUnraisable(PyObject *); |
|
6324
20b5647a067e
New API PyErr_NewException(name, base, dict) to create simple new exceptions.
Guido van Rossum <guido@python.org>
parents:
6323
diff
changeset
|
98 |
|
15589
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
99 /* Issue a warning or exception */ |
|
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
100 extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *); |
|
16849
a8771a52abb3
Add declaration for PyErr_WarnExplicit().
Guido van Rossum <guido@python.org>
parents:
16838
diff
changeset
|
101 extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *, |
|
a8771a52abb3
Add declaration for PyErr_WarnExplicit().
Guido van Rossum <guido@python.org>
parents:
16838
diff
changeset
|
102 char *, int, char *, PyObject *); |
|
15589
857a5400be87
Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
103 |
|
4864
a53908d09a04
Added declaration for PyErr_SetInterrupt.
Barry Warsaw <barry@python.org>
parents:
4654
diff
changeset
|
104 /* In sigcheck.c or signalmodule.c */ |
|
13435
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
105 extern DL_IMPORT(int) PyErr_CheckSignals(void); |
|
7e3cd9480f66
ANSI-fication of the sources -- remove Py_PROTO!
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
106 extern DL_IMPORT(void) PyErr_SetInterrupt(void); |
|
16838
09f6c1372056
Improve SyntaxErrors for bad future statements. Set file and location
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15589
diff
changeset
|
107 |
|
09f6c1372056
Improve SyntaxErrors for bad future statements. Set file and location
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15589
diff
changeset
|
108 /* Support for adding program text to SyntaxErrors */ |
|
09f6c1372056
Improve SyntaxErrors for bad future statements. Set file and location
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15589
diff
changeset
|
109 extern DL_IMPORT(void) PyErr_SyntaxLocation(char *, int); |
|
09f6c1372056
Improve SyntaxErrors for bad future statements. Set file and location
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15589
diff
changeset
|
110 extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); |
|
4864
a53908d09a04
Added declaration for PyErr_SetInterrupt.
Barry Warsaw <barry@python.org>
parents:
4654
diff
changeset
|
111 |
|
18908
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
112 /* These APIs aren't really part of the error implementation, but |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
113 often needed to format error messages; the native C lib APIs are |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
114 not available on all platforms, which is why we provide emulations |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
115 for those platforms in Python/mysnprintf.c */ |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
116 #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
117 # define HAVE_SNPRINTF |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
118 # define snprintf _snprintf |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
119 # define vsnprintf _vsnprintf |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
120 #endif |
|
18915
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
121 |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
122 /* Always enable the fallback solution during the 2.2.0 alpha cycle |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
123 for enhanced testing */ |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
124 #if PY_VERSION_HEX < 0x020200B0 |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
125 # undef HAVE_SNPRINTF |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
126 #endif |
|
510f7f6a877e
Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
Marc-André Lemburg <mal@egenix.com>
parents:
18909
diff
changeset
|
127 |
|
18908
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
128 #ifndef HAVE_SNPRINTF |
|
18909
9753b0269f3a
va_list is defined in stdarg.h.
Marc-André Lemburg <mal@egenix.com>
parents:
18908
diff
changeset
|
129 #include <stdarg.h> |
|
20626
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
130 extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) |
|
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
131 __attribute__((format(printf, 3, 4))); |
|
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
132 extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) |
|
3d299b156511
Add function attributes that allow GCC to check the arguments of printf-like
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
20279
diff
changeset
|
133 __attribute__((format(printf, 3, 0))); |
|
18908
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
134 #else |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
135 # define PyOS_vsnprintf vsnprintf |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
136 # define PyOS_snprintf snprintf |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17597
diff
changeset
|
137 #endif |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
138 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
139 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
140 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
141 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
142 #endif /* !Py_ERRORS_H */ |
