pyerrors.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. #ifndef Py_ERRORS_H
  2. #define Py_ERRORS_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* Error objects */
  7. #ifndef Py_LIMITED_API
  8. /* PyException_HEAD defines the initial segment of every exception class. */
  9. #define PyException_HEAD PyObject_HEAD PyObject *dict;\
  10. PyObject *args; PyObject *traceback;\
  11. PyObject *context; PyObject *cause;\
  12. char suppress_context;
  13. typedef struct {
  14. PyException_HEAD
  15. } PyBaseExceptionObject;
  16. typedef struct {
  17. PyException_HEAD
  18. PyObject *msg;
  19. PyObject *filename;
  20. PyObject *lineno;
  21. PyObject *offset;
  22. PyObject *text;
  23. PyObject *print_file_and_line;
  24. } PySyntaxErrorObject;
  25. typedef struct {
  26. PyException_HEAD
  27. PyObject *msg;
  28. PyObject *name;
  29. PyObject *path;
  30. } PyImportErrorObject;
  31. typedef struct {
  32. PyException_HEAD
  33. PyObject *encoding;
  34. PyObject *object;
  35. Py_ssize_t start;
  36. Py_ssize_t end;
  37. PyObject *reason;
  38. } PyUnicodeErrorObject;
  39. typedef struct {
  40. PyException_HEAD
  41. PyObject *code;
  42. } PySystemExitObject;
  43. typedef struct {
  44. PyException_HEAD
  45. PyObject *myerrno;
  46. PyObject *strerror;
  47. PyObject *filename;
  48. PyObject *filename2;
  49. #ifdef MS_WINDOWS
  50. PyObject *winerror;
  51. #endif
  52. Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
  53. } PyOSErrorObject;
  54. typedef struct {
  55. PyException_HEAD
  56. PyObject *value;
  57. } PyStopIterationObject;
  58. /* Compatibility typedefs */
  59. typedef PyOSErrorObject PyEnvironmentErrorObject;
  60. #ifdef MS_WINDOWS
  61. typedef PyOSErrorObject PyWindowsErrorObject;
  62. #endif
  63. #endif /* !Py_LIMITED_API */
  64. /* Error handling definitions */
  65. PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
  66. PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
  67. #ifndef Py_LIMITED_API
  68. PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
  69. #endif
  70. PyAPI_FUNC(void) PyErr_SetString(
  71. PyObject *exception,
  72. const char *string /* decoded from utf-8 */
  73. );
  74. PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
  75. PyAPI_FUNC(void) PyErr_Clear(void);
  76. PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
  77. PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
  78. PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
  79. PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
  80. #if defined(__clang__) || \
  81. (defined(__GNUC_MAJOR__) && \
  82. ((__GNUC_MAJOR__ >= 3) || \
  83. (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
  84. #define _Py_NO_RETURN __attribute__((__noreturn__))
  85. #else
  86. #define _Py_NO_RETURN
  87. #endif
  88. /* Defined in Python/pylifecycle.c */
  89. PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
  90. #if defined(Py_DEBUG) || defined(Py_LIMITED_API)
  91. #define _PyErr_OCCURRED() PyErr_Occurred()
  92. #else
  93. #define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
  94. #endif
  95. /* Error testing and normalization */
  96. PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
  97. PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
  98. PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
  99. /* Traceback manipulation (PEP 3134) */
  100. PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);
  101. PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);
  102. /* Cause manipulation (PEP 3134) */
  103. PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);
  104. PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);
  105. /* Context manipulation (PEP 3134) */
  106. PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
  107. PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
  108. #ifndef Py_LIMITED_API
  109. PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
  110. #endif
  111. /* */
  112. #define PyExceptionClass_Check(x) \
  113. (PyType_Check((x)) && \
  114. PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
  115. #define PyExceptionInstance_Check(x) \
  116. PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
  117. #define PyExceptionClass_Name(x) \
  118. ((char *)(((PyTypeObject*)(x))->tp_name))
  119. #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
  120. /* Predefined exceptions */
  121. PyAPI_DATA(PyObject *) PyExc_BaseException;
  122. PyAPI_DATA(PyObject *) PyExc_Exception;
  123. PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
  124. PyAPI_DATA(PyObject *) PyExc_StopIteration;
  125. PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
  126. PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
  127. PyAPI_DATA(PyObject *) PyExc_LookupError;
  128. PyAPI_DATA(PyObject *) PyExc_AssertionError;
  129. PyAPI_DATA(PyObject *) PyExc_AttributeError;
  130. PyAPI_DATA(PyObject *) PyExc_BufferError;
  131. PyAPI_DATA(PyObject *) PyExc_EOFError;
  132. PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
  133. PyAPI_DATA(PyObject *) PyExc_OSError;
  134. PyAPI_DATA(PyObject *) PyExc_ImportError;
  135. PyAPI_DATA(PyObject *) PyExc_IndexError;
  136. PyAPI_DATA(PyObject *) PyExc_KeyError;
  137. PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
  138. PyAPI_DATA(PyObject *) PyExc_MemoryError;
  139. PyAPI_DATA(PyObject *) PyExc_NameError;
  140. PyAPI_DATA(PyObject *) PyExc_OverflowError;
  141. PyAPI_DATA(PyObject *) PyExc_RuntimeError;
  142. PyAPI_DATA(PyObject *) PyExc_RecursionError;
  143. PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
  144. PyAPI_DATA(PyObject *) PyExc_SyntaxError;
  145. PyAPI_DATA(PyObject *) PyExc_IndentationError;
  146. PyAPI_DATA(PyObject *) PyExc_TabError;
  147. PyAPI_DATA(PyObject *) PyExc_ReferenceError;
  148. PyAPI_DATA(PyObject *) PyExc_SystemError;
  149. PyAPI_DATA(PyObject *) PyExc_SystemExit;
  150. PyAPI_DATA(PyObject *) PyExc_TypeError;
  151. PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
  152. PyAPI_DATA(PyObject *) PyExc_UnicodeError;
  153. PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
  154. PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
  155. PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
  156. PyAPI_DATA(PyObject *) PyExc_ValueError;
  157. PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
  158. PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
  159. PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;
  160. PyAPI_DATA(PyObject *) PyExc_ChildProcessError;
  161. PyAPI_DATA(PyObject *) PyExc_ConnectionError;
  162. PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;
  163. PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;
  164. PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;
  165. PyAPI_DATA(PyObject *) PyExc_FileExistsError;
  166. PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;
  167. PyAPI_DATA(PyObject *) PyExc_InterruptedError;
  168. PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;
  169. PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;
  170. PyAPI_DATA(PyObject *) PyExc_PermissionError;
  171. PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;
  172. PyAPI_DATA(PyObject *) PyExc_TimeoutError;
  173. /* Compatibility aliases */
  174. PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
  175. PyAPI_DATA(PyObject *) PyExc_IOError;
  176. #ifdef MS_WINDOWS
  177. PyAPI_DATA(PyObject *) PyExc_WindowsError;
  178. #endif
  179. PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
  180. /* Predefined warning categories */
  181. PyAPI_DATA(PyObject *) PyExc_Warning;
  182. PyAPI_DATA(PyObject *) PyExc_UserWarning;
  183. PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
  184. PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
  185. PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
  186. PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
  187. PyAPI_DATA(PyObject *) PyExc_FutureWarning;
  188. PyAPI_DATA(PyObject *) PyExc_ImportWarning;
  189. PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
  190. PyAPI_DATA(PyObject *) PyExc_BytesWarning;
  191. PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
  192. /* Convenience functions */
  193. PyAPI_FUNC(int) PyErr_BadArgument(void);
  194. PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
  195. PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
  196. PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
  197. PyObject *, PyObject *);
  198. PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects(
  199. PyObject *, PyObject *, PyObject *);
  200. PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
  201. PyObject *exc,
  202. const char *filename /* decoded from the filesystem encoding */
  203. );
  204. #if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
  205. PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
  206. PyObject *, const Py_UNICODE *);
  207. #endif /* MS_WINDOWS */
  208. PyAPI_FUNC(PyObject *) PyErr_Format(
  209. PyObject *exception,
  210. const char *format, /* ASCII-encoded string */
  211. ...
  212. );
  213. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
  214. PyAPI_FUNC(PyObject *) PyErr_FormatV(
  215. PyObject *exception,
  216. const char *format,
  217. va_list vargs);
  218. #endif
  219. #ifdef MS_WINDOWS
  220. PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
  221. int ierr,
  222. const char *filename /* decoded from the filesystem encoding */
  223. );
  224. #ifndef Py_LIMITED_API
  225. /* XXX redeclare to use WSTRING */
  226. PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
  227. int, const Py_UNICODE *);
  228. #endif
  229. PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
  230. PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
  231. PyObject *,int, PyObject *);
  232. PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects(
  233. PyObject *,int, PyObject *, PyObject *);
  234. PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
  235. PyObject *exc,
  236. int ierr,
  237. const char *filename /* decoded from the filesystem encoding */
  238. );
  239. #ifndef Py_LIMITED_API
  240. PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
  241. PyObject *,int, const Py_UNICODE *);
  242. #endif
  243. PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
  244. #endif /* MS_WINDOWS */
  245. PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *,
  246. PyObject *);
  247. PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,
  248. PyObject *);
  249. /* Export the old function so that the existing API remains available: */
  250. PyAPI_FUNC(void) PyErr_BadInternalCall(void);
  251. PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
  252. /* Mask the old API with a call to the new API for code compiled under
  253. Python 2.0: */
  254. #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
  255. /* Function to create a new exception */
  256. PyAPI_FUNC(PyObject *) PyErr_NewException(
  257. const char *name, PyObject *base, PyObject *dict);
  258. PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
  259. const char *name, const char *doc, PyObject *base, PyObject *dict);
  260. PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
  261. /* In exceptions.c */
  262. #ifndef Py_LIMITED_API
  263. /* Helper that attempts to replace the current exception with one of the
  264. * same type but with a prefix added to the exception text. The resulting
  265. * exception description looks like:
  266. *
  267. * prefix (exc_type: original_exc_str)
  268. *
  269. * Only some exceptions can be safely replaced. If the function determines
  270. * it isn't safe to perform the replacement, it will leave the original
  271. * unmodified exception in place.
  272. *
  273. * Returns a borrowed reference to the new exception (if any), NULL if the
  274. * existing exception was left in place.
  275. */
  276. PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
  277. const char *prefix_format, /* ASCII-encoded string */
  278. ...
  279. );
  280. #endif
  281. /* In sigcheck.c or signalmodule.c */
  282. PyAPI_FUNC(int) PyErr_CheckSignals(void);
  283. PyAPI_FUNC(void) PyErr_SetInterrupt(void);
  284. /* In signalmodule.c */
  285. #ifndef Py_LIMITED_API
  286. int PySignal_SetWakeupFd(int fd);
  287. #endif
  288. /* Support for adding program text to SyntaxErrors */
  289. PyAPI_FUNC(void) PyErr_SyntaxLocation(
  290. const char *filename, /* decoded from the filesystem encoding */
  291. int lineno);
  292. PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
  293. const char *filename, /* decoded from the filesystem encoding */
  294. int lineno,
  295. int col_offset);
  296. #ifndef Py_LIMITED_API
  297. PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
  298. PyObject *filename,
  299. int lineno,
  300. int col_offset);
  301. #endif
  302. PyAPI_FUNC(PyObject *) PyErr_ProgramText(
  303. const char *filename, /* decoded from the filesystem encoding */
  304. int lineno);
  305. #ifndef Py_LIMITED_API
  306. PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
  307. PyObject *filename,
  308. int lineno);
  309. #endif
  310. /* The following functions are used to create and modify unicode
  311. exceptions from C */
  312. /* create a UnicodeDecodeError object */
  313. PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
  314. const char *encoding, /* UTF-8 encoded string */
  315. const char *object,
  316. Py_ssize_t length,
  317. Py_ssize_t start,
  318. Py_ssize_t end,
  319. const char *reason /* UTF-8 encoded string */
  320. );
  321. /* create a UnicodeEncodeError object */
  322. #ifndef Py_LIMITED_API
  323. PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
  324. const char *encoding, /* UTF-8 encoded string */
  325. const Py_UNICODE *object,
  326. Py_ssize_t length,
  327. Py_ssize_t start,
  328. Py_ssize_t end,
  329. const char *reason /* UTF-8 encoded string */
  330. );
  331. #endif
  332. /* create a UnicodeTranslateError object */
  333. #ifndef Py_LIMITED_API
  334. PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
  335. const Py_UNICODE *object,
  336. Py_ssize_t length,
  337. Py_ssize_t start,
  338. Py_ssize_t end,
  339. const char *reason /* UTF-8 encoded string */
  340. );
  341. PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
  342. PyObject *object,
  343. Py_ssize_t start,
  344. Py_ssize_t end,
  345. const char *reason /* UTF-8 encoded string */
  346. );
  347. #endif
  348. /* get the encoding attribute */
  349. PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
  350. PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
  351. /* get the object attribute */
  352. PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
  353. PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
  354. PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
  355. /* get the value of the start attribute (the int * may not be NULL)
  356. return 0 on success, -1 on failure */
  357. PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
  358. PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
  359. PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
  360. /* assign a new value to the start attribute
  361. return 0 on success, -1 on failure */
  362. PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
  363. PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
  364. PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
  365. /* get the value of the end attribute (the int *may not be NULL)
  366. return 0 on success, -1 on failure */
  367. PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
  368. PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
  369. PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
  370. /* assign a new value to the end attribute
  371. return 0 on success, -1 on failure */
  372. PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
  373. PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
  374. PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
  375. /* get the value of the reason attribute */
  376. PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
  377. PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
  378. PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
  379. /* assign a new value to the reason attribute
  380. return 0 on success, -1 on failure */
  381. PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
  382. PyObject *exc,
  383. const char *reason /* UTF-8 encoded string */
  384. );
  385. PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
  386. PyObject *exc,
  387. const char *reason /* UTF-8 encoded string */
  388. );
  389. PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
  390. PyObject *exc,
  391. const char *reason /* UTF-8 encoded string */
  392. );
  393. /* These APIs aren't really part of the error implementation, but
  394. often needed to format error messages; the native C lib APIs are
  395. not available on all platforms, which is why we provide emulations
  396. for those platforms in Python/mysnprintf.c,
  397. WARNING: The return value of snprintf varies across platforms; do
  398. not rely on any particular behavior; eventually the C99 defn may
  399. be reliable.
  400. */
  401. #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
  402. # define HAVE_SNPRINTF
  403. # define snprintf _snprintf
  404. # define vsnprintf _vsnprintf
  405. #endif
  406. #include <stdarg.h>
  407. PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
  408. Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
  409. PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
  410. Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
  411. #ifdef __cplusplus
  412. }
  413. #endif
  414. #endif /* !Py_ERRORS_H */