diff options
| author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-11 07:41:16 +0000 |
|---|---|---|
| committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-11 07:41:16 +0000 |
| commit | 9d53457e599623fbad90833c3448835b42d7e7f9 (patch) | |
| tree | 41d37b556618eb8e831463c576d854063a33d77b /Include/pyport.h | |
| parent | 73baefd7fc86a7f8336e4142efcec74c201acf8f (diff) | |
| download | cpython-git-9d53457e599623fbad90833c3448835b42d7e7f9.tar.gz | |
Merge in release25-maint r60793:
Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
Diffstat (limited to 'Include/pyport.h')
| -rw-r--r-- | Include/pyport.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 7c684f7320..15c8644f56 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -117,6 +117,17 @@ typedef Py_intptr_t Py_ssize_t; # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif +/* Largest possible value of size_t. + SIZE_MAX is part of C99, so it might be defined on some + platforms. If it is not defined, (size_t)-1 is a portable + definition for C89, due to the way signed->unsigned + conversion is defined. */ +#ifdef SIZE_MAX +#define PY_SIZE_MAX SIZE_MAX +#else +#define PY_SIZE_MAX ((size_t)-1) +#endif + /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ |
