2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

ssize_t patches merged from HEAD

[SVN r35327]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2006-09-26 00:48:44 +00:00
parent a824230155
commit 4eb286a034
9 changed files with 57 additions and 20 deletions

View File

@@ -20,6 +20,7 @@
#include <boost/python/self.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/str.hpp>
#include <boost/python/ssize_t.hpp>
#include <functional>
#include <vector>
#include <cstddef>
@@ -506,13 +507,14 @@ namespace objects
// were declared, we'll use our class_type() as the single base
// class.
std::size_t const num_bases = (std::max)(num_types - 1, static_cast<std::size_t>(1));
handle<> bases(PyTuple_New(num_bases));
assert(num_bases <= ssize_t_max);
handle<> bases(PyTuple_New(static_cast<ssize_t>(num_bases)));
for (std::size_t i = 1; i <= num_bases; ++i)
{
type_handle c = (i >= num_types) ? class_type() : get_class(types[i]);
// PyTuple_SET_ITEM steals this reference
PyTuple_SET_ITEM(bases.get(), i - 1, upcast<PyObject>(c.release()));
PyTuple_SET_ITEM(bases.get(), static_cast<ssize_t>(i - 1), upcast<PyObject>(c.release()));
}
// Call the class metatype to create a new class