annotate Include/pyerrors.h @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents 854a2cea31b9
children
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: 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
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
7 /* Error objects */
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
8
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
9 #ifndef Py_LIMITED_API
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
10 /* PyException_HEAD defines the initial segment of every exception class. */
43109
eee5bdd37158 Fix a compile error on Windows.
Collin Winter <collinw@gmail.com>
parents: 43102
diff changeset
11 #define PyException_HEAD PyObject_HEAD PyObject *dict;\
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
12 PyObject *args; PyObject *traceback;\
76942
b0eb7d2a9542 PEP 415: Implement suppression of __context__ display with an exception attribute
Benjamin Peterson <benjamin@python.org>
parents: 76418
diff changeset
13 PyObject *context; PyObject *cause;\
78468
e2df976b8a33 use char instead of int to please T_BOOL (closes #15597)
Benjamin Peterson <benjamin@python.org>
parents: 77476
diff changeset
14 char suppress_context;
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
15
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
16 typedef struct {
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
17 PyException_HEAD
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
18 } PyBaseExceptionObject;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
19
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
20 typedef struct {
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
21 PyException_HEAD
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
22 PyObject *msg;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
23 PyObject *filename;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
24 PyObject *lineno;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
25 PyObject *offset;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
26 PyObject *text;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
27 PyObject *print_file_and_line;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
28 } PySyntaxErrorObject;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
29
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
30 typedef struct {
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
31 PyException_HEAD
76283
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
32 PyObject *msg;
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
33 PyObject *name;
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
34 PyObject *path;
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
35 } PyImportErrorObject;
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
36
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
37 typedef struct {
be0ab722c43d put PyImportErrorObject with its brothers
Benjamin Peterson <benjamin@python.org>
parents: 76272
diff changeset
38 PyException_HEAD
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
39 PyObject *encoding;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
40 PyObject *object;
42110
e4f649c4f457 Merged revisions 55962-56019 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42084
diff changeset
41 Py_ssize_t start;
e4f649c4f457 Merged revisions 55962-56019 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42084
diff changeset
42 Py_ssize_t end;
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
43 PyObject *reason;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
44 } PyUnicodeErrorObject;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
45
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
46 typedef struct {
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
47 PyException_HEAD
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
48 PyObject *code;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
49 } PySystemExitObject;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
50
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
51 typedef struct {
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
52 PyException_HEAD
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
53 PyObject *myerrno;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
54 PyObject *strerror;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
55 PyObject *filename;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
56 #ifdef MS_WINDOWS
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
57 PyObject *winerror;
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
58 #endif
72879
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
59 Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
60 } PyOSErrorObject;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
61
74356
d64ac9ab4cd0 Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents: 72879
diff changeset
62 typedef struct {
d64ac9ab4cd0 Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents: 72879
diff changeset
63 PyException_HEAD
d64ac9ab4cd0 Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents: 72879
diff changeset
64 PyObject *value;
d64ac9ab4cd0 Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents: 72879
diff changeset
65 } PyStopIterationObject;
d64ac9ab4cd0 Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents: 72879
diff changeset
66
72879
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
67 /* Compatibility typedefs */
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
68 typedef PyOSErrorObject PyEnvironmentErrorObject;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
69 #ifdef MS_WINDOWS
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
70 typedef PyOSErrorObject PyWindowsErrorObject;
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
71 #endif
72879
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
72 #endif /* !Py_LIMITED_API */
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
73
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 /* Error handling definitions */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
76 PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
77 PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
85502
bfaf3a2907bd Factor-out the common code for setting a KeyError.
Raymond Hettinger <python@rcn.com>
parents: 85417
diff changeset
78 PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
65190
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
79 PyAPI_FUNC(void) PyErr_SetString(
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
80 PyObject *exception,
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
81 const char *string /* decoded from utf-8 */
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
82 );
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
83 PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
84 PyAPI_FUNC(void) PyErr_Clear(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
85 PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
86 PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
76418
9fdec1354af4 Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Martin v. Löwis <martin@v.loewis.de>
parents: 76379
diff changeset
87 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
9fdec1354af4 Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Martin v. Löwis <martin@v.loewis.de>
parents: 76379
diff changeset
88 PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
68102
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
89
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
90 #if defined(__clang__) || \
77335
696d3631a4a1 __GNUC__ does not imply gcc version is present, so just check for version (closes #14994)
Benjamin Peterson <benjamin@python.org>
parents: 76942
diff changeset
91 (defined(__GNUC_MAJOR__) && \
68102
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
92 ((__GNUC_MAJOR__ >= 3) || \
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
93 (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
94 #define _Py_NO_RETURN __attribute__((__noreturn__))
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
95 #else
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
96 #define _Py_NO_RETURN
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
97 #endif
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
98
e2f96bd29252 Issue #8914: fix various warnings from the Clang static analyzer v254.
Brett Cannon <bcannon@gmail.com>
parents: 67165
diff changeset
99 PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
100
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
101 #if defined(Py_DEBUG) || defined(Py_LIMITED_API)
35316
ce0995e01d3c * set_new() doesn't need to zero the structure a second time after tp_alloc
Raymond Hettinger <python@rcn.com>
parents: 35298
diff changeset
102 #define _PyErr_OCCURRED() PyErr_Occurred()
ce0995e01d3c * set_new() doesn't need to zero the structure a second time after tp_alloc
Raymond Hettinger <python@rcn.com>
parents: 35298
diff changeset
103 #else
86140
2aee9c41bb79 Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
Antoine Pitrou <solipsis@pitrou.net>
parents: 78468
diff changeset
104 #define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
35316
ce0995e01d3c * set_new() doesn't need to zero the structure a second time after tp_alloc
Raymond Hettinger <python@rcn.com>
parents: 35298
diff changeset
105 #endif
ce0995e01d3c * set_new() doesn't need to zero the structure a second time after tp_alloc
Raymond Hettinger <python@rcn.com>
parents: 35298
diff changeset
106
6146
a2a1df0ca808 Three new C API functions:
Barry Warsaw <barry@python.org>
parents: 5230
diff changeset
107 /* Error testing and normalization */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
108 PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
109 PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
110 PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
6146
a2a1df0ca808 Three new C API functions:
Barry Warsaw <barry@python.org>
parents: 5230
diff changeset
111
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
112 /* Traceback manipulation (PEP 3134) */
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
113 PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
114 PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
115
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
116 /* Cause manipulation (PEP 3134) */
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
117 PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
118 PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
119
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
120 /* Context manipulation (PEP 3134) */
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
121 PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
122 PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
123
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
124
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
125 /* */
6146
a2a1df0ca808 Three new C API functions:
Barry Warsaw <barry@python.org>
parents: 5230
diff changeset
126
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
127 #define PyExceptionClass_Check(x) \
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
128 (PyType_Check((x)) && \
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
129 PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
130
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
131 #define PyExceptionInstance_Check(x) \
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
132 PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
133
36988
49c6eb688906 Checkpoint. 218 tests are okay; 53 are failing. Done so far:
Guido van Rossum <guido@python.org>
parents: 36751
diff changeset
134 #define PyExceptionClass_Name(x) \
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
135 ((char *)(((PyTypeObject*)(x))->tp_name))
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
136
36988
49c6eb688906 Checkpoint. 218 tests are okay; 53 are failing. Done so far:
Guido van Rossum <guido@python.org>
parents: 36751
diff changeset
137 #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
138
43102
981ecc526703 Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Collin Winter <collinw@gmail.com>
parents: 42794
diff changeset
139
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents: 23
diff changeset
140 /* Predefined exceptions */
10
a71e896ed047 Made exception objects extern.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
141
36751
8e04de2480e4 PEP 352 implementation. Creates a new base class, BaseException, which has an
Brett Cannon <bcannon@gmail.com>
parents: 36501
diff changeset
142 PyAPI_DATA(PyObject *) PyExc_BaseException;
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
143 PyAPI_DATA(PyObject *) PyExc_Exception;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
144 PyAPI_DATA(PyObject *) PyExc_StopIteration;
35298
b2fe5f8fcfdd PEP 342 implementation. Per Guido's comments, the generator throw()
Phillip J. Eby <pje@telecommunity.com>
parents: 33256
diff changeset
145 PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
146 PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
147 PyAPI_DATA(PyObject *) PyExc_LookupError;
6191
3a6b7a377dc3 Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents: 6146
diff changeset
148
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
149 PyAPI_DATA(PyObject *) PyExc_AssertionError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
150 PyAPI_DATA(PyObject *) PyExc_AttributeError;
72879
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
151 PyAPI_DATA(PyObject *) PyExc_BufferError;
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
152 PyAPI_DATA(PyObject *) PyExc_EOFError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
153 PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
154 PyAPI_DATA(PyObject *) PyExc_OSError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
155 PyAPI_DATA(PyObject *) PyExc_ImportError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
156 PyAPI_DATA(PyObject *) PyExc_IndexError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
157 PyAPI_DATA(PyObject *) PyExc_KeyError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
158 PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
159 PyAPI_DATA(PyObject *) PyExc_MemoryError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
160 PyAPI_DATA(PyObject *) PyExc_NameError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
161 PyAPI_DATA(PyObject *) PyExc_OverflowError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
162 PyAPI_DATA(PyObject *) PyExc_RuntimeError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
163 PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
164 PyAPI_DATA(PyObject *) PyExc_SyntaxError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
165 PyAPI_DATA(PyObject *) PyExc_IndentationError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
166 PyAPI_DATA(PyObject *) PyExc_TabError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
167 PyAPI_DATA(PyObject *) PyExc_ReferenceError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
168 PyAPI_DATA(PyObject *) PyExc_SystemError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
169 PyAPI_DATA(PyObject *) PyExc_SystemExit;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
170 PyAPI_DATA(PyObject *) PyExc_TypeError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
171 PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
172 PyAPI_DATA(PyObject *) PyExc_UnicodeError;
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
173 PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
174 PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
175 PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
176 PyAPI_DATA(PyObject *) PyExc_ValueError;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
177 PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
72879
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
178
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
179 PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
180 PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
181 PyAPI_DATA(PyObject *) PyExc_ChildProcessError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
182 PyAPI_DATA(PyObject *) PyExc_ConnectionError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
183 PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
184 PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
185 PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
186 PyAPI_DATA(PyObject *) PyExc_FileExistsError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
187 PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
188 PyAPI_DATA(PyObject *) PyExc_InterruptedError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
189 PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
190 PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
191 PyAPI_DATA(PyObject *) PyExc_PermissionError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
192 PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
193 PyAPI_DATA(PyObject *) PyExc_TimeoutError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
194
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
195
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
196 /* Compatibility aliases */
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
197 PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
41a1de81ef2b PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
Antoine Pitrou <solipsis@pitrou.net>
parents: 72475
diff changeset
198 PyAPI_DATA(PyObject *) PyExc_IOError;
11799
3678dd685867 Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents: 11030
diff changeset
199 #ifdef MS_WINDOWS
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
200 PyAPI_DATA(PyObject *) PyExc_WindowsError;
11799
3678dd685867 Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents: 11030
diff changeset
201 #endif
26550
b9c912e2c3c0 Patch #614055: Support OpenVMS.
Martin v. Löwis <martin@v.loewis.de>
parents: 26318
diff changeset
202 #ifdef __VMS
29726
85e52ec85629 Use appropriate macros not the deprecated DL_IMPORT/DL_EXPORT macros
Neal Norwitz <nnorwitz@gmail.com>
parents: 26601
diff changeset
203 PyAPI_DATA(PyObject *) PyExc_VMSError;
26550
b9c912e2c3c0 Patch #614055: Support OpenVMS.
Martin v. Löwis <martin@v.loewis.de>
parents: 26318
diff changeset
204 #endif
23
08562de01668 Added err_badcall() and planned new errors.
Guido van Rossum <guido@python.org>
parents: 10
diff changeset
205
43292
876b7ef4775d Merged revisions 57778-58052 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 43109
diff changeset
206 PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
6191
3a6b7a377dc3 Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents: 6146
diff changeset
207
15589
857a5400be87 Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents: 14375
diff changeset
208 /* Predefined warning categories */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
209 PyAPI_DATA(PyObject *) PyExc_Warning;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
210 PyAPI_DATA(PyObject *) PyExc_UserWarning;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
211 PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
212 PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
213 PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
214 PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
24818
31d2860089e6 Added a FutureWarning for constructs that will change semantically in
Barry Warsaw <barry@python.org>
parents: 24752
diff changeset
215 PyAPI_DATA(PyObject *) PyExc_FutureWarning;
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 36988
diff changeset
216 PyAPI_DATA(PyObject *) PyExc_ImportWarning;
39610
3674f20ac781 Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
217 PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
43777
0d462d789b18 Merging the py3k-pep3137 branch back into the py3k branch.
Guido van Rossum <guido@python.org>
parents: 43292
diff changeset
218 PyAPI_DATA(PyObject *) PyExc_BytesWarning;
65624
39b9e9de372b Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,
Georg Brandl <georg@python.org>
parents: 65190
diff changeset
219 PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
15589
857a5400be87 Add declarations for standard warning category classes (PyExc_Warning
Guido van Rossum <guido@python.org>
parents: 14375
diff changeset
220
6191
3a6b7a377dc3 Added externs for three new exceptions PyExc_StandardError,
Barry Warsaw <barry@python.org>
parents: 6146
diff changeset
221
10
a71e896ed047 Made exception objects extern.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
222 /* Convenience functions */
a71e896ed047 Made exception objects extern.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
223
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
224 PyAPI_FUNC(int) PyErr_BadArgument(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
225 PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
226 PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
227 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
228 PyObject *, PyObject *);
54918
0704f15b4682 Merged revisions 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 54129
diff changeset
229 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
65190
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
230 PyObject *exc,
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
231 const char *filename /* decoded from the filesystem encoding */
0c4884db53e0 Issue #9738: Document PyErr_SetString() and PyErr_SetFromErrnoWithFilename()
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64859
diff changeset
232 );
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
233 #if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
234 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
235 PyObject *, const Py_UNICODE *);
54129
77cfef596d33 Merged revisions 72698-72699 via svnmerge from
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents: 50810
diff changeset
236 #endif /* MS_WINDOWS */
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
237
64639
1cfad55de5bd Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
Victor Stinner <victor.stinner@haypocalc.com>
parents: 61466
diff changeset
238 PyAPI_FUNC(PyObject *) PyErr_Format(
1cfad55de5bd Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
Victor Stinner <victor.stinner@haypocalc.com>
parents: 61466
diff changeset
239 PyObject *exception,
1cfad55de5bd Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
Victor Stinner <victor.stinner@haypocalc.com>
parents: 61466
diff changeset
240 const char *format, /* ASCII-encoded string */
1cfad55de5bd Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
Victor Stinner <victor.stinner@haypocalc.com>
parents: 61466
diff changeset
241 ...
1cfad55de5bd Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
Victor Stinner <victor.stinner@haypocalc.com>
parents: 61466
diff changeset
242 );
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
243
11799
3678dd685867 Declarations related to new WindowsError exception.
Guido van Rossum <guido@python.org>
parents: 11030
diff changeset
244 #ifdef MS_WINDOWS
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
245 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
246 int ierr,
67165
53209d00d3ab Issue #10780: Remove commas at the end of the argument list
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67163
diff changeset
247 const char *filename /* decoded from the filesystem encoding */
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
248 );
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
249 #ifndef Py_LIMITED_API
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
250 /* XXX redeclare to use WSTRING */
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
251 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
252 int, const Py_UNICODE *);
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
253 #endif
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
254 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
255 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
256 PyObject *,int, PyObject *);
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
257 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
258 PyObject *exc,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
259 int ierr,
67165
53209d00d3ab Issue #10780: Remove commas at the end of the argument list
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67163
diff changeset
260 const char *filename /* decoded from the filesystem encoding */
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
261 );
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
262 #ifndef Py_LIMITED_API
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
263 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
264 PyObject *,int, const Py_UNICODE *);
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
265 #endif
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
266 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
25535
861065256487 Patch 594001: PEP 277 - Unicode file name support for Windows NT.
Mark Hammond <mhammond@skippinet.com.au>
parents: 25276
diff changeset
267 #endif /* MS_WINDOWS */
23
08562de01668 Added err_badcall() and planned new errors.
Guido van Rossum <guido@python.org>
parents: 10
diff changeset
268
76272
6825fd9b00ed Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Brett Cannon <brett@python.org>
parents: 75292
diff changeset
269 PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *,
6825fd9b00ed Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Brett Cannon <brett@python.org>
parents: 75292
diff changeset
270 PyObject *);
76379
7a32b9380ffd Fix #14600. Correct reference handling and naming of ImportError convenience function
Brian Curtin <brian@python.org>
parents: 76283
diff changeset
271 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,
7a32b9380ffd Fix #14600. Correct reference handling and naming of ImportError convenience function
Brian Curtin <brian@python.org>
parents: 76283
diff changeset
272 PyObject *);
76272
6825fd9b00ed Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Brett Cannon <brett@python.org>
parents: 75292
diff changeset
273
14170
019265b3a856 Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents: 13435
diff changeset
274 /* Export the old function so that the existing API remains available: */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
275 PyAPI_FUNC(void) PyErr_BadInternalCall(void);
42794
84618b2064c1 Add const to some strings that are not modified
Neal Norwitz <nnorwitz@gmail.com>
parents: 42665
diff changeset
276 PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
14170
019265b3a856 Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents: 13435
diff changeset
277 /* 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
278 Python 2.0: */
019265b3a856 Improve the exceptions raised by PyErr_BadInternalCall(); adding the
Fred Drake <fdrake@acm.org>
parents: 13435
diff changeset
279 #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
1288
9fed5726a36d Several changes in one:
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
280
6324
20b5647a067e New API PyErr_NewException(name, base, dict) to create simple new exceptions.
Guido van Rossum <guido@python.org>
parents: 6323
diff changeset
281 /* Function to create a new exception */
57962
c1972eef3579 Merged revisions 77088 via svnmerge from
Georg Brandl <georg@python.org>
parents: 54918
diff changeset
282 PyAPI_FUNC(PyObject *) PyErr_NewException(
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57962
diff changeset
283 const char *name, PyObject *base, PyObject *dict);
57962
c1972eef3579 Merged revisions 77088 via svnmerge from
Georg Brandl <georg@python.org>
parents: 54918
diff changeset
284 PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57962
diff changeset
285 const char *name, const char *doc, PyObject *base, PyObject *dict);
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
286 PyAPI_FUNC(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
287
87084
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
288 /* In exceptions.c */
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
289 #ifndef Py_LIMITED_API
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
290 /* Helper that attempts to replace the current exception with one of the
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
291 * same type but with a prefix added to the exception text. The resulting
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
292 * exception description looks like:
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
293 *
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
294 * prefix (exc_type: original_exc_str)
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
295 *
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
296 * Only some exceptions can be safely replaced. If the function determines
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
297 * it isn't safe to perform the replacement, it will leave the original
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
298 * unmodified exception in place.
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
299 *
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
300 * Returns a borrowed reference to the new exception (if any), NULL if the
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
301 * existing exception was left in place.
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
302 */
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
303 PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
304 const char *prefix_format, /* ASCII-encoded string */
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
305 ...
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
306 );
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
307 #endif
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
308
854a2cea31b9 Close #17828: better handling of codec errors
Nick Coghlan <ncoghlan@gmail.com>
parents: 86141
diff changeset
309
4864
a53908d09a04 Added declaration for PyErr_SetInterrupt.
Barry Warsaw <barry@python.org>
parents: 4654
diff changeset
310 /* In sigcheck.c or signalmodule.c */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
311 PyAPI_FUNC(int) PyErr_CheckSignals(void);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
312 PyAPI_FUNC(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
313
44373
2750d531fdc0 Merged revisions 59565-59594 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 43777
diff changeset
314 /* In signalmodule.c */
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
315 #ifndef Py_LIMITED_API
44373
2750d531fdc0 Merged revisions 59565-59594 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 43777
diff changeset
316 int PySignal_SetWakeupFd(int fd);
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
317 #endif
44373
2750d531fdc0 Merged revisions 59565-59594 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 43777
diff changeset
318
16838
09f6c1372056 Improve SyntaxErrors for bad future statements. Set file and location
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15589
diff changeset
319 /* Support for adding program text to SyntaxErrors */
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
320 PyAPI_FUNC(void) PyErr_SyntaxLocation(
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
321 const char *filename, /* decoded from the filesystem encoding */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
322 int lineno);
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
323 PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
324 const char *filename, /* decoded from the filesystem encoding */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
325 int lineno,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
326 int col_offset);
85417
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
327 PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
328 PyObject *filename,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
329 int lineno,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
330 int col_offset);
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
331 PyAPI_FUNC(PyObject *) PyErr_ProgramText(
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
332 const char *filename, /* decoded from the filesystem encoding */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
333 int lineno);
85417
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
334 PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
335 PyObject *filename,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 84445
diff changeset
336 int lineno);
21070
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
337
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
338 /* The following functions are used to create and modify unicode
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
339 exceptions from C */
26318
910fa739f4a4 Fix PEP 293 related problems with --disable-unicode builds
Walter Dörwald <walter@livinglogic.de>
parents: 25535
diff changeset
340
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
341 /* create a UnicodeDecodeError object */
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
342 PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
343 const char *encoding, /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
344 const char *object,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
345 Py_ssize_t length,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
346 Py_ssize_t start,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
347 Py_ssize_t end,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
348 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
349 );
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
350
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
351 /* create a UnicodeEncodeError object */
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
352 #ifndef Py_LIMITED_API
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
353 PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
354 const char *encoding, /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
355 const Py_UNICODE *object,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
356 Py_ssize_t length,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
357 Py_ssize_t start,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
358 Py_ssize_t end,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
359 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
360 );
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
361 #endif
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
362
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
363 /* create a UnicodeTranslateError object */
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
364 #ifndef Py_LIMITED_API
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
365 PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
366 const Py_UNICODE *object,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
367 Py_ssize_t length,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
368 Py_ssize_t start,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
369 Py_ssize_t end,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
370 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
371 );
72475
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
372 PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
373 PyObject *object,
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
374 Py_ssize_t start,
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
375 Py_ssize_t end,
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
376 const char *reason /* UTF-8 encoded string */
8beaa9a37387 Implement PEP 393.
Martin v. Löwis <martin@v.loewis.de>
parents: 68780
diff changeset
377 );
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 65688
diff changeset
378 #endif
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
379
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
380 /* get the encoding attribute */
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
381 PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
382 PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
383
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
384 /* get the object attribute */
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
385 PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
386 PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
387 PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
388
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
389 /* get the value of the start attribute (the int * may not be NULL)
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
390 return 0 on success, -1 on failure */
36501
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
391 PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
392 PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
393 PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
394
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
395 /* assign a new value to the start attribute
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
396 return 0 on success, -1 on failure */
36501
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
397 PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
398 PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
399 PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
400
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
401 /* get the value of the end attribute (the int *may not be NULL)
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
402 return 0 on success, -1 on failure */
36501
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
403 PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
404 PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
405 PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
406
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
407 /* assign a new value to the end attribute
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
408 return 0 on success, -1 on failure */
36501
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
409 PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
410 PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
7fdc639bc5b4 Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents: 35316
diff changeset
411 PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
412
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
413 /* get the value of the reason attribute */
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
414 PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
415 PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
416 PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
417
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
418 /* assign a new value to the reason attribute
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
419 return 0 on success, -1 on failure */
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
420 PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
421 PyObject *exc,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
422 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
423 );
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
424 PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
425 PyObject *exc,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
426 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
427 );
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
428 PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
67149
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
429 PyObject *exc,
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
430 const char *reason /* UTF-8 encoded string */
93e95b2e1a1a Issue #9738: Document encodings of error and warning functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66664
diff changeset
431 );
25091
0337dad8403e PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
Walter Dörwald <walter@livinglogic.de>
parents: 24818
diff changeset
432
18908
79c676f9b34a This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents: 17597
diff changeset
433 /* 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
434 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
435 not available on all platforms, which is why we provide emulations
21070
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
436 for those platforms in Python/mysnprintf.c,
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
437 WARNING: The return value of snprintf varies across platforms; do
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
438 not rely on any particular behavior; eventually the C99 defn may
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
439 be reliable.
ba67b9c97b69 Removed preprocessor gimmick trying to force use of snprintf emulation
Tim Peters <tim.peters@gmail.com>
parents: 20626
diff changeset
440 */
18908
79c676f9b34a This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents: 17597
diff changeset
441 #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
442 # 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
443 # 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
444 # 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
445 #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
446
18909
9753b0269f3a va_list is defined in stdarg.h.
Marc-André Lemburg <mal@egenix.com>
parents: 18908
diff changeset
447 #include <stdarg.h>
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
448 PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
449 Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24423
diff changeset
450 PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 54129
diff changeset
451 Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
452
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
453 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
454 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
455 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
456 #endif /* !Py_ERRORS_H */