Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(253527)

Side by Side Diff: Include/pyerrors.h

Issue 11682: PEP 380 reference implementation for 3.3
Patch Set: Created 8 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef Py_ERRORS_H 1 #ifndef Py_ERRORS_H
2 #define Py_ERRORS_H 2 #define Py_ERRORS_H
3 #ifdef __cplusplus 3 #ifdef __cplusplus
4 extern "C" { 4 extern "C" {
5 #endif 5 #endif
6 6
7 /* Error objects */ 7 /* Error objects */
8 8
9 #ifndef Py_LIMITED_API 9 #ifndef Py_LIMITED_API
10 /* PyException_HEAD defines the initial segment of every exception class. */ 10 /* PyException_HEAD defines the initial segment of every exception class. */
(...skipping 28 matching lines...) Expand all
39 PyException_HEAD 39 PyException_HEAD
40 PyObject *code; 40 PyObject *code;
41 } PySystemExitObject; 41 } PySystemExitObject;
42 42
43 typedef struct { 43 typedef struct {
44 PyException_HEAD 44 PyException_HEAD
45 PyObject *myerrno; 45 PyObject *myerrno;
46 PyObject *strerror; 46 PyObject *strerror;
47 PyObject *filename; 47 PyObject *filename;
48 } PyEnvironmentErrorObject; 48 } PyEnvironmentErrorObject;
49
50 typedef struct {
51 PyException_HEAD
52 PyObject *value;
53 } PyStopIterationObject;
49 54
50 #ifdef MS_WINDOWS 55 #ifdef MS_WINDOWS
51 typedef struct { 56 typedef struct {
52 PyException_HEAD 57 PyException_HEAD
53 PyObject *myerrno; 58 PyObject *myerrno;
54 PyObject *strerror; 59 PyObject *strerror;
55 PyObject *filename; 60 PyObject *filename;
56 PyObject *winerror; 61 PyObject *winerror;
57 } PyWindowsErrorObject; 62 } PyWindowsErrorObject;
58 #endif 63 #endif
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 ); 354 );
350 PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( 355 PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
351 PyObject *exc, 356 PyObject *exc,
352 const char *reason /* UTF-8 encoded string */ 357 const char *reason /* UTF-8 encoded string */
353 ); 358 );
354 PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( 359 PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
355 PyObject *exc, 360 PyObject *exc,
356 const char *reason /* UTF-8 encoded string */ 361 const char *reason /* UTF-8 encoded string */
357 ); 362 );
358 363
364 /* create a StopIteration exception with the given value */
365 PyAPI_FUNC(PyObject *) PyStopIteration_New(PyObject *);
Benjamin Peterson 2011/07/09 18:41:14 PyStopIteraiton_Create would be more consistent wi
Nick Coghlan 2011/09/20 13:24:23 Done.
359 366
360 /* These APIs aren't really part of the error implementation, but 367 /* These APIs aren't really part of the error implementation, but
361 often needed to format error messages; the native C lib APIs are 368 often needed to format error messages; the native C lib APIs are
362 not available on all platforms, which is why we provide emulations 369 not available on all platforms, which is why we provide emulations
363 for those platforms in Python/mysnprintf.c, 370 for those platforms in Python/mysnprintf.c,
364 WARNING: The return value of snprintf varies across platforms; do 371 WARNING: The return value of snprintf varies across platforms; do
365 not rely on any particular behavior; eventually the C99 defn may 372 not rely on any particular behavior; eventually the C99 defn may
366 be reliable. 373 be reliable.
367 */ 374 */
368 #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) 375 #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
369 # define HAVE_SNPRINTF 376 # define HAVE_SNPRINTF
370 # define snprintf _snprintf 377 # define snprintf _snprintf
371 # define vsnprintf _vsnprintf 378 # define vsnprintf _vsnprintf
372 #endif 379 #endif
373 380
374 #include <stdarg.h> 381 #include <stdarg.h>
375 PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) 382 PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
376 Py_GCC_ATTRIBUTE((format(printf, 3, 4))); 383 Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
377 PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_l ist va) 384 PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_l ist va)
378 Py_GCC_ATTRIBUTE((format(printf, 3, 0))); 385 Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
379 386
380 #ifdef __cplusplus 387 #ifdef __cplusplus
381 } 388 }
382 #endif 389 #endif
383 #endif /* !Py_ERRORS_H */ 390 #endif /* !Py_ERRORS_H */
OLDNEW
« no previous file with comments | « Include/opcode.h ('k') | Include/Python-ast.h » ('j') | Lib/test/test_pep380.py » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+