2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 17:52:17 +00:00

new boost/python/ssize_t.hpp; avoids potential clash of Py_ssize_t typedef and PY_SSIZE_T_MIN/MAX macros with definitions from other libraries

[SVN r35325]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2006-09-26 00:25:07 +00:00
parent c7fb2f7047
commit c6f2aa4ef2
12 changed files with 166 additions and 30 deletions

View File

@@ -3,6 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python/str.hpp>
#include <boost/python/extract.hpp>
#include <boost/python/ssize_t.hpp>
namespace boost { namespace python { namespace detail {
@@ -23,13 +24,13 @@ str_base::str_base(const char* s)
namespace {
Py_ssize_t str_size_as_py_ssize_t(std::size_t n)
ssize_t str_size_as_py_ssize_t(std::size_t n)
{
if (n > PY_SSIZE_T_MAX)
if (n > ssize_t_max)
{
throw std::range_error("str size > PY_SSIZE_T_MAX");
throw std::range_error("str size > ssize_t_max");
}
return static_cast<Py_ssize_t>(n);
return static_cast<ssize_t>(n);
}
} // namespace <anonymous>