pyerrors.h 16.4 KB
Newer Older
1 2 3 4 5 6
#ifndef Py_ERRORS_H
#define Py_ERRORS_H
#ifdef __cplusplus
extern "C" {
#endif

7 8
/* Error objects */

9
#ifndef Py_LIMITED_API
10
/* PyException_HEAD defines the initial segment of every exception class. */
11
#define PyException_HEAD PyObject_HEAD PyObject *dict;\
12
             PyObject *args; PyObject *traceback;\
13
             PyObject *context; PyObject *cause;\
14
             char suppress_context;
15

16
typedef struct {
17
    PyException_HEAD
18 19 20
} PyBaseExceptionObject;

typedef struct {
21
    PyException_HEAD
22 23 24 25 26 27 28 29
    PyObject *msg;
    PyObject *filename;
    PyObject *lineno;
    PyObject *offset;
    PyObject *text;
    PyObject *print_file_and_line;
} PySyntaxErrorObject;

30 31 32 33 34 35 36
typedef struct {
    PyException_HEAD
    PyObject *msg;
    PyObject *name;
    PyObject *path;
} PyImportErrorObject;

37
typedef struct {
38
    PyException_HEAD
39 40
    PyObject *encoding;
    PyObject *object;
41 42
    Py_ssize_t start;
    Py_ssize_t end;
43 44 45 46
    PyObject *reason;
} PyUnicodeErrorObject;

typedef struct {
47
    PyException_HEAD
48 49 50 51
    PyObject *code;
} PySystemExitObject;

typedef struct {
52
    PyException_HEAD
53 54 55
    PyObject *myerrno;
    PyObject *strerror;
    PyObject *filename;
56
    PyObject *filename2;
57 58 59
#ifdef MS_WINDOWS
    PyObject *winerror;
#endif
60 61 62
    Py_ssize_t written;   /* only for BlockingIOError, -1 otherwise */
} PyOSErrorObject;

63 64 65 66 67
typedef struct {
    PyException_HEAD
    PyObject *value;
} PyStopIterationObject;

68 69 70 71
/* Compatibility typedefs */
typedef PyOSErrorObject PyEnvironmentErrorObject;
#ifdef MS_WINDOWS
typedef PyOSErrorObject PyWindowsErrorObject;
72
#endif
73
#endif /* !Py_LIMITED_API */
74

Guido van Rossum's avatar
Guido van Rossum committed
75 76
/* Error handling definitions */

77 78
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
79
#ifndef Py_LIMITED_API
80
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
81
#endif
82 83 84 85
PyAPI_FUNC(void) PyErr_SetString(
    PyObject *exception,
    const char *string   /* decoded from utf-8 */
    );
86 87 88 89
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
PyAPI_FUNC(void) PyErr_Clear(void);
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
90 91
PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
92 93

#if defined(__clang__) || \
94
    (defined(__GNUC_MAJOR__) && \
95 96 97 98 99 100 101
     ((__GNUC_MAJOR__ >= 3) || \
      (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
#define _Py_NO_RETURN __attribute__((__noreturn__))
#else
#define _Py_NO_RETURN
#endif

102
/* Defined in Python/pylifecycle.c */
103
PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
Guido van Rossum's avatar
Guido van Rossum committed
104

105
#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
106 107
#define _PyErr_OCCURRED() PyErr_Occurred()
#else
108
#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
109 110
#endif

111
/* Error testing and normalization */
112 113 114
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
115

116 117 118 119 120 121 122 123 124 125 126
/* Traceback manipulation (PEP 3134) */
PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);

/* Cause manipulation (PEP 3134) */
PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);
PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);

/* Context manipulation (PEP 3134) */
PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
127 128 129
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
#endif
130

131
/* */
132

133 134 135
#define PyExceptionClass_Check(x)                                       \
    (PyType_Check((x)) &&                                               \
     PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
136

137 138
#define PyExceptionInstance_Check(x)                    \
    PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
139

140
#define PyExceptionClass_Name(x) \
141
     ((char *)(((PyTypeObject*)(x))->tp_name))
142

143
#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
144

145

Guido van Rossum's avatar
Guido van Rossum committed
146
/* Predefined exceptions */
147

148
PyAPI_DATA(PyObject *) PyExc_BaseException;
149
PyAPI_DATA(PyObject *) PyExc_Exception;
150
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
151
PyAPI_DATA(PyObject *) PyExc_StopIteration;
152
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
153 154 155 156 157
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
PyAPI_DATA(PyObject *) PyExc_LookupError;

PyAPI_DATA(PyObject *) PyExc_AssertionError;
PyAPI_DATA(PyObject *) PyExc_AttributeError;
158
PyAPI_DATA(PyObject *) PyExc_BufferError;
159 160 161 162
PyAPI_DATA(PyObject *) PyExc_EOFError;
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
PyAPI_DATA(PyObject *) PyExc_OSError;
PyAPI_DATA(PyObject *) PyExc_ImportError;
163
PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError;
164 165 166 167 168 169 170
PyAPI_DATA(PyObject *) PyExc_IndexError;
PyAPI_DATA(PyObject *) PyExc_KeyError;
PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
PyAPI_DATA(PyObject *) PyExc_MemoryError;
PyAPI_DATA(PyObject *) PyExc_NameError;
PyAPI_DATA(PyObject *) PyExc_OverflowError;
PyAPI_DATA(PyObject *) PyExc_RuntimeError;
171
PyAPI_DATA(PyObject *) PyExc_RecursionError;
172 173 174 175 176 177 178 179 180 181
PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
PyAPI_DATA(PyObject *) PyExc_IndentationError;
PyAPI_DATA(PyObject *) PyExc_TabError;
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
PyAPI_DATA(PyObject *) PyExc_SystemError;
PyAPI_DATA(PyObject *) PyExc_SystemExit;
PyAPI_DATA(PyObject *) PyExc_TypeError;
PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
PyAPI_DATA(PyObject *) PyExc_UnicodeError;
182 183 184
PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
185 186
PyAPI_DATA(PyObject *) PyExc_ValueError;
PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207

PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;
PyAPI_DATA(PyObject *) PyExc_ChildProcessError;
PyAPI_DATA(PyObject *) PyExc_ConnectionError;
PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;
PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;
PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;
PyAPI_DATA(PyObject *) PyExc_FileExistsError;
PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;
PyAPI_DATA(PyObject *) PyExc_InterruptedError;
PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;
PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;
PyAPI_DATA(PyObject *) PyExc_PermissionError;
PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;
PyAPI_DATA(PyObject *) PyExc_TimeoutError;


/* Compatibility aliases */
PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
PyAPI_DATA(PyObject *) PyExc_IOError;
208
#ifdef MS_WINDOWS
209
PyAPI_DATA(PyObject *) PyExc_WindowsError;
210
#endif
211

212
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
213

214
/* Predefined warning categories */
215 216 217 218 219 220
PyAPI_DATA(PyObject *) PyExc_Warning;
PyAPI_DATA(PyObject *) PyExc_UserWarning;
PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
221
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
222
PyAPI_DATA(PyObject *) PyExc_ImportWarning;
223
PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
224
PyAPI_DATA(PyObject *) PyExc_BytesWarning;
225
PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
226

227

228 229
/* Convenience functions */

230 231 232
PyAPI_FUNC(int) PyErr_BadArgument(void);
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
233
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
234
    PyObject *, PyObject *);
235 236
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects(
    PyObject *, PyObject *, PyObject *);
Benjamin Peterson's avatar
Benjamin Peterson committed
237
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
238 239 240
    PyObject *exc,
    const char *filename   /* decoded from the filesystem encoding */
    );
241
#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
242
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
243
    PyObject *, const Py_UNICODE *) Py_DEPRECATED(3.3);
244
#endif /* MS_WINDOWS */
245

246 247 248 249 250
PyAPI_FUNC(PyObject *) PyErr_Format(
    PyObject *exception,
    const char *format,   /* ASCII-encoded string  */
    ...
    );
251 252 253 254 255 256
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_FUNC(PyObject *) PyErr_FormatV(
    PyObject *exception,
    const char *format,
    va_list vargs);
#endif
257

258 259 260 261 262 263 264 265 266 267 268
#ifndef Py_LIMITED_API
/* Like PyErr_Format(), but saves current exception as __context__ and
   __cause__.
 */
PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(
    PyObject *exception,
    const char *format,   /* ASCII-encoded string  */
    ...
    );
#endif

269
#ifdef MS_WINDOWS
270
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
271
    int ierr,
272
    const char *filename        /* decoded from the filesystem encoding */
273
    );
274 275
#ifndef Py_LIMITED_API
/* XXX redeclare to use WSTRING */
276
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
277
    int, const Py_UNICODE *) Py_DEPRECATED(3.3);
278
#endif
279
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
280
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
281
    PyObject *,int, PyObject *);
282 283
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects(
    PyObject *,int, PyObject *, PyObject *);
284
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
285 286
    PyObject *exc,
    int ierr,
287
    const char *filename        /* decoded from the filesystem encoding */
288
    );
289
#ifndef Py_LIMITED_API
290
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
291
    PyObject *,int, const Py_UNICODE *) Py_DEPRECATED(3.3);
292
#endif
293
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
294
#endif /* MS_WINDOWS */
295

296 297
PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *,
    PyObject *);
298 299 300

PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *,
    PyObject *, PyObject *);
301 302
PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,
    PyObject *);
303

304
/* Export the old function so that the existing API remains available: */
305
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
306
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
307 308 309
/* Mask the old API with a call to the new API for code compiled under
   Python 2.0: */
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
310

311
/* Function to create a new exception */
312
PyAPI_FUNC(PyObject *) PyErr_NewException(
313
    const char *name, PyObject *base, PyObject *dict);
314
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
315
    const char *name, const char *doc, PyObject *base, PyObject *dict);
316
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
317

318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
/* In exceptions.c */
#ifndef Py_LIMITED_API
/* Helper that attempts to replace the current exception with one of the
 * same type but with a prefix added to the exception text. The resulting
 * exception description looks like:
 *
 *     prefix (exc_type: original_exc_str)
 *
 * Only some exceptions can be safely replaced. If the function determines
 * it isn't safe to perform the replacement, it will leave the original
 * unmodified exception in place.
 *
 * Returns a borrowed reference to the new exception (if any), NULL if the
 * existing exception was left in place.
 */
PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
    const char *prefix_format,   /* ASCII-encoded string  */
    ...
    );
#endif


340
/* In sigcheck.c or signalmodule.c */
341 342
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
343

344
/* In signalmodule.c */
345
#ifndef Py_LIMITED_API
346
int PySignal_SetWakeupFd(int fd);
347
#endif
348

349
/* Support for adding program text to SyntaxErrors */
350 351 352 353 354 355 356
PyAPI_FUNC(void) PyErr_SyntaxLocation(
    const char *filename,       /* decoded from the filesystem encoding */
    int lineno);
PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
    const char *filename,       /* decoded from the filesystem encoding */
    int lineno,
    int col_offset);
357
#ifndef Py_LIMITED_API
358 359 360 361
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
    PyObject *filename,
    int lineno,
    int col_offset);
362
#endif
363 364 365
PyAPI_FUNC(PyObject *) PyErr_ProgramText(
    const char *filename,       /* decoded from the filesystem encoding */
    int lineno);
366
#ifndef Py_LIMITED_API
367 368 369
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
    PyObject *filename,
    int lineno);
370
#endif
371

372 373
/* The following functions are used to create and modify unicode
   exceptions from C */
374

375 376
/* create a UnicodeDecodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
377 378 379 380 381 382 383
    const char *encoding,       /* UTF-8 encoded string */
    const char *object,
    Py_ssize_t length,
    Py_ssize_t start,
    Py_ssize_t end,
    const char *reason          /* UTF-8 encoded string */
    );
384 385

/* create a UnicodeEncodeError object */
386
#ifndef Py_LIMITED_API
387
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
388 389 390 391 392 393
    const char *encoding,       /* UTF-8 encoded string */
    const Py_UNICODE *object,
    Py_ssize_t length,
    Py_ssize_t start,
    Py_ssize_t end,
    const char *reason          /* UTF-8 encoded string */
394
    ) Py_DEPRECATED(3.3);
395
#endif
396 397

/* create a UnicodeTranslateError object */
398
#ifndef Py_LIMITED_API
399
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
400 401 402 403 404
    const Py_UNICODE *object,
    Py_ssize_t length,
    Py_ssize_t start,
    Py_ssize_t end,
    const char *reason          /* UTF-8 encoded string */
405
    ) Py_DEPRECATED(3.3);
Martin v. Löwis's avatar
Martin v. Löwis committed
406 407 408 409 410 411
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
    PyObject *object,
    Py_ssize_t start,
    Py_ssize_t end,
    const char *reason          /* UTF-8 encoded string */
    );
412
#endif
413 414 415 416 417 418 419 420 421 422 423 424

/* get the encoding attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);

/* get the object attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);

/* get the value of the start attribute (the int * may not be NULL)
   return 0 on success, -1 on failure */
Martin v. Löwis's avatar
Martin v. Löwis committed
425 426 427
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
428 429 430

/* assign a new value to the start attribute
   return 0 on success, -1 on failure */
Martin v. Löwis's avatar
Martin v. Löwis committed
431 432 433
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
434 435 436

/* get the value of the end attribute (the int *may not be NULL)
 return 0 on success, -1 on failure */
Martin v. Löwis's avatar
Martin v. Löwis committed
437 438 439
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
440 441 442

/* assign a new value to the end attribute
   return 0 on success, -1 on failure */
Martin v. Löwis's avatar
Martin v. Löwis committed
443 444 445
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
446 447 448 449 450 451 452 453 454

/* get the value of the reason attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);

/* assign a new value to the reason attribute
   return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
455 456 457
    PyObject *exc,
    const char *reason          /* UTF-8 encoded string */
    );
458
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
459 460 461
    PyObject *exc,
    const char *reason          /* UTF-8 encoded string */
    );
462
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
463 464 465
    PyObject *exc,
    const char *reason          /* UTF-8 encoded string */
    );
466

467 468 469
/* These APIs aren't really part of the error implementation, but
   often needed to format error messages; the native C lib APIs are
   not available on all platforms, which is why we provide emulations
470 471 472 473 474
   for those platforms in Python/mysnprintf.c,
   WARNING:  The return value of snprintf varies across platforms; do
   not rely on any particular behavior; eventually the C99 defn may
   be reliable.
*/
475 476 477 478 479
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
# define HAVE_SNPRINTF
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#endif
480

481
#include <stdarg.h>
482
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)
483
                        Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
484
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)
485
                        Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
486

487 488 489 490
#ifdef __cplusplus
}
#endif
#endif /* !Py_ERRORS_H */