diff --git a/example/Jamfile b/example/Jamfile
index 10fe384e..24303a6b 100644
--- a/example/Jamfile
+++ b/example/Jamfile
@@ -1,5 +1,6 @@
-# Copyright David Abrahams 2003. See accompanying LICENSE for terms
-# and conditions of use.
+# Copyright David Abrahams 2003-2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# This is the top of our own project tree
project-root ;
diff --git a/example/Jamfile.v2 b/example/Jamfile.v2
index 7a9e5b87..0695aac2 100644
--- a/example/Jamfile.v2
+++ b/example/Jamfile.v2
@@ -1,6 +1,6 @@
-# This is the Jamfile for Boost.Build v2, which is currently in
-# prerelease. Ignore this file unless you are a bleading edge sort of
-# person.
+# Copyright David Abrahams 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
project : requirements /boost/python//boost_python ;
diff --git a/example/README b/example/README
index 97fdbc38..a9bd7941 100644
--- a/example/README
+++ b/example/README
@@ -1,3 +1,7 @@
+.. Copyright David Abrahams 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
To get started with the Boost Python Library, use the examples
getting_started1.cpp and getting_started2.cpp.
diff --git a/example/boost-build.jam b/example/boost-build.jam
index 0e94752d..2075a00f 100755
--- a/example/boost-build.jam
+++ b/example/boost-build.jam
@@ -1,5 +1,6 @@
-# Copyright David Abrahams 2003. See accompanying LICENSE for terms
-# and conditions of use.
+# Copyright David Abrahams 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# Edit this path to point at the tools/build/v1 subdirectory of your
# Boost installation. Absolute paths work, too.
diff --git a/example/test_getting_started1.py b/example/test_getting_started1.py
index cd8fb59e..32dc1f6e 100644
--- a/example/test_getting_started1.py
+++ b/example/test_getting_started1.py
@@ -1,3 +1,6 @@
+# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
r'''>>> import getting_started1
>>> print getting_started1.greet()
hello, world
diff --git a/example/test_getting_started2.py b/example/test_getting_started2.py
index ccfaa4f1..ae86017b 100644
--- a/example/test_getting_started2.py
+++ b/example/test_getting_started2.py
@@ -1,3 +1,6 @@
+# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
r'''>>> from getting_started2 import *
>>> hi = hello('California')
>>> hi.greet()
diff --git a/example/test_std_pair.py b/example/test_std_pair.py
index 89a2b8f3..64f239fe 100644
--- a/example/test_std_pair.py
+++ b/example/test_std_pair.py
@@ -1,3 +1,6 @@
+# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import std_pair_ext
assert std_pair_ext.foo() == (3, 5)
print "OK"
diff --git a/include/boost/python/detail/python22_fixed.h b/include/boost/python/detail/python22_fixed.h
index e236c2b0..32bf941f 100644
--- a/include/boost/python/detail/python22_fixed.h
+++ b/include/boost/python/detail/python22_fixed.h
@@ -4,6 +4,8 @@
// Copyright (c) 2001, 2002 Python Software Foundation; All Rights
// Reserved
//
+// boostinspect:nolicense (don't complain about the lack of a Boost license)
+//
// Changes from the original:
// 1. #includes for Python 2.2.1
// 2. Provides missing extern "C" wrapper for "iterobject.h" and "descrobject.h".
diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp
index cce01868..88597b58 100644
--- a/include/boost/python/detail/wrap_python.hpp
+++ b/include/boost/python/detail/wrap_python.hpp
@@ -48,7 +48,7 @@
#endif
# include
-# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION == 741
+# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740
# undef _POSIX_C_SOURCE
# undef _XOPEN_SOURCE
# endif
diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp
index 569c9d4e..7fad2a25 100644
--- a/include/boost/python/object/pointer_holder.hpp
+++ b/include/boost/python/object/pointer_holder.hpp
@@ -179,7 +179,7 @@ void* pointer_holder_back_reference::holds(type_info dst_t, bool
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
))
{
- python::detail::initialize_wrapper(self, &*this->m_p);
+ python::detail::initialize_wrapper(self, get_pointer(this->m_p));
}
# undef N
diff --git a/include/boost/python/opaque_pointer_converter.hpp b/include/boost/python/opaque_pointer_converter.hpp
index e54561c7..7d2e0795 100644
--- a/include/boost/python/opaque_pointer_converter.hpp
+++ b/include/boost/python/opaque_pointer_converter.hpp
@@ -1,4 +1,4 @@
-// Copyright Gottfried Ganßauge 2003.
+// Copyright Gottfried Ganßauge 2003..2006
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -11,6 +11,7 @@
# include
# include
# include
+# include
# include
# include
# include
@@ -44,9 +45,16 @@ struct opaque
{
opaque()
{
- type_object.tp_name = const_cast(type_id().name());
- converter::registry::insert(&extract, type_id());
- converter::registry::insert(&wrap, type_id());
+ if (type_object.tp_name == 0)
+ {
+ type_object.tp_name = const_cast(type_id().name());
+ if (PyType_Ready (&type_object) < 0)
+ {
+ throw error_already_set();
+ }
+
+ register_self();
+ }
}
static opaque instance;
diff --git a/include/boost/python/suite/indexing/indexing_suite.hpp b/include/boost/python/suite/indexing/indexing_suite.hpp
index 61e3593c..0ebb755a 100644
--- a/include/boost/python/suite/indexing/indexing_suite.hpp
+++ b/include/boost/python/suite/indexing/indexing_suite.hpp
@@ -18,7 +18,7 @@
namespace boost { namespace python {
- // indexing_suite class. This class is the protocol class for
+ // indexing_suite class. This class is the facade class for
// the management of C++ containers intended to be integrated
// to Python. The objective is make a C++ container look and
// feel and behave exactly as we'd expect a Python container.
diff --git a/include/boost/python/type_id.hpp b/include/boost/python/type_id.hpp
index fecf8b8d..559a38b5 100755
--- a/include/boost/python/type_id.hpp
+++ b/include/boost/python/type_id.hpp
@@ -89,7 +89,7 @@ inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
}
# if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \
- || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 741)
+ || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744)
// Older EDG-based compilers seems to mistakenly distinguish "int" from
// "signed int", etc., but only in typeid() expressions. However
// though int == signed int, the "signed" decoration is propagated
diff --git a/index.html b/index.html
index 40f1ae14..9c6acc88 100644
--- a/index.html
+++ b/index.html
@@ -1,3 +1,6 @@
+
+
+
diff --git a/pyste/NEWS b/pyste/NEWS
index aaa8e3b3..31a5ceba 100644
--- a/pyste/NEWS
+++ b/pyste/NEWS
@@ -1,3 +1,7 @@
+.. Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
25 April 2005
- Fixed bug where the code for wrappers of member functions were defined outside
the pyste namespace. Reported by Dan Haffey.
diff --git a/pyste/README b/pyste/README
index e4e3734e..c378f391 100644
--- a/pyste/README
+++ b/pyste/README
@@ -1,3 +1,7 @@
+.. Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
Pyste - Python Semi-Automatic Exporter
======================================
diff --git a/pyste/TODO b/pyste/TODO
index e0ff578b..0b3c9024 100644
--- a/pyste/TODO
+++ b/pyste/TODO
@@ -1,3 +1,7 @@
+.. Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
- Make Pyste accept already-generated xml files
- throw() declaration in virtual wrapper's member functions
diff --git a/pyste/dist/create_build.py b/pyste/dist/create_build.py
index 506426f0..a6836995 100644
--- a/pyste/dist/create_build.py
+++ b/pyste/dist/create_build.py
@@ -1,3 +1,7 @@
+# Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
import os
import sys
import shutil
diff --git a/pyste/dist/setup.py b/pyste/dist/setup.py
index eea2751f..fc7c74e2 100644
--- a/pyste/dist/setup.py
+++ b/pyste/dist/setup.py
@@ -1,3 +1,7 @@
+# Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
from distutils.core import setup
import py2exe
import sys
diff --git a/pyste/doc/adding_new_methods.html b/pyste/doc/adding_new_methods.html
index 9cd603e4..afa772bc 100644
--- a/pyste/doc/adding_new_methods.html
+++ b/pyste/doc/adding_new_methods.html
@@ -72,9 +72,8 @@ Now from Python:
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/exporting_an_entire_header.html b/pyste/doc/exporting_an_entire_header.html
index d1f22e1e..db25325c 100644
--- a/pyste/doc/exporting_an_entire_header.html
+++ b/pyste/doc/exporting_an_entire_header.html
@@ -78,9 +78,8 @@ use at you own risk.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/global_variables.html b/pyste/doc/global_variables.html
index 2170e4e8..0efd2950 100644
--- a/pyste/doc/global_variables.html
+++ b/pyste/doc/global_variables.html
@@ -42,9 +42,8 @@ functions, and export those.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/inserting_code.html b/pyste/doc/inserting_code.html
index 866e5bad..97eb70f3 100644
--- a/pyste/doc/inserting_code.html
+++ b/pyste/doc/inserting_code.html
@@ -65,9 +65,8 @@ Will generate:
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/introduction.html b/pyste/doc/introduction.html
index 352aed2e..94388493 100644
--- a/pyste/doc/introduction.html
+++ b/pyste/doc/introduction.html
@@ -66,9 +66,8 @@ Pyste supports the following features:
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/policies.html b/pyste/doc/policies.html
index 8061f9b1..3628093b 100644
--- a/pyste/doc/policies.html
+++ b/pyste/doc/policies.html
@@ -83,9 +83,8 @@ to, though.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/pyste.txt b/pyste/doc/pyste.txt
index 08eda4aa..186a31cb 100644
--- a/pyste/doc/pyste.txt
+++ b/pyste/doc/pyste.txt
@@ -1,5 +1,10 @@
[doc Pyste Documentation]
+[/ Copyright 2003 Bruno da Silva de Oliveira and Joel de Guzman.
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt) ]
+
[def GCCXML [@http://www.gccxml.org GCCXML]]
[def Boost.Python [@../../index.html Boost.Python]]
diff --git a/pyste/doc/renaming_and_excluding.html b/pyste/doc/renaming_and_excluding.html
index 185b8d7e..ce6654c4 100644
--- a/pyste/doc/renaming_and_excluding.html
+++ b/pyste/doc/renaming_and_excluding.html
@@ -80,9 +80,8 @@ C::foo that way.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/running_pyste.html b/pyste/doc/running_pyste.html
index 5f72e603..9bd9a3ae 100644
--- a/pyste/doc/running_pyste.html
+++ b/pyste/doc/running_pyste.html
@@ -193,9 +193,8 @@ created again, but no code will be generated.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/smart_pointers.html b/pyste/doc/smart_pointers.html
index 095d2482..cddc96f2 100644
--- a/pyste/doc/smart_pointers.html
+++ b/pyste/doc/smart_pointers.html
@@ -77,9 +77,8 @@ specify the smart pointer as the holder for a class, use the functions
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/templates.html b/pyste/doc/templates.html
index f2b978bb..a1c1cfef 100644
--- a/pyste/doc/templates.html
+++ b/pyste/doc/templates.html
@@ -95,9 +95,8 @@ either a string with the types separated by whitespace, or a list of strings
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/the_interface_files.html b/pyste/doc/the_interface_files.html
index 117301b4..9c020043 100644
--- a/pyste/doc/the_interface_files.html
+++ b/pyste/doc/the_interface_files.html
@@ -95,9 +95,8 @@ Note that we specify that B needs to know about A to be proper
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/doc/theme/style.css b/pyste/doc/theme/style.css
index 53a6205e..643df02a 100644
--- a/pyste/doc/theme/style.css
+++ b/pyste/doc/theme/style.css
@@ -1,3 +1,11 @@
+/*=============================================================================
+ Copyright (c) 2003 Bruno da Silva de Oliveira
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
body
{
background-image: url(bkd.gif);
diff --git a/pyste/doc/wrappers.html b/pyste/doc/wrappers.html
index 0943c0c5..534ae552 100644
--- a/pyste/doc/wrappers.html
+++ b/pyste/doc/wrappers.html
@@ -117,9 +117,8 @@ code to compile when you set a wrapper for a virtual member function.
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/index.html b/pyste/index.html
index 55b7d39f..953b37c1 100644
--- a/pyste/index.html
+++ b/pyste/index.html
@@ -83,9 +83,8 @@
-Permission to copy, use, modify, sell and distribute this document
- is granted provided this copyright notice appears in all copies. This document
- is provided "as is" without express or implied warranty, and with
- no claim as to its suitability for any purpose.
+Distributed under
+ the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/pyste/install/pyste.py b/pyste/install/pyste.py
index 9547d5f7..da926235 100644
--- a/pyste/install/pyste.py
+++ b/pyste/install/pyste.py
@@ -1,4 +1,8 @@
#!/usr/bin/env python
+# Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
from Pyste import pyste
pyste.main()
diff --git a/release_notes.txt b/release_notes.txt
index 8932a0aa..1fd0f1b1 100644
--- a/release_notes.txt
+++ b/release_notes.txt
@@ -1,3 +1,9 @@
+.. Copyright David Abrahams 2006. Distributed under the Boost
+.. Software License, Version 1.0. (See accompanying
+.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+These are old release notes for Boost.Python v1
+
2000-11-22 10:00
Ullrich fixed bug in operator_dispatcher.
diff --git a/test/Jamfile b/test/Jamfile
index 87abb096..56193772 100644
--- a/test/Jamfile
+++ b/test/Jamfile
@@ -1,3 +1,6 @@
+# Copyright David Abrahams 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# To run all tests quietly: jam test
# To run all tests with verbose output: jam -sPYTHON_TEST_ARGS=-v test
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
index 7dd3ffe0..c0498c26 100644
--- a/test/Jamfile.v2
+++ b/test/Jamfile.v2
@@ -1,3 +1,6 @@
+# Copyright David Abrahams 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
use-project /boost/python : ../build ;
project /boost/python/test ;
diff --git a/test/andreas_beyer.cpp b/test/andreas_beyer.cpp
index a39e9f04..da3aa751 100755
--- a/test/andreas_beyer.cpp
+++ b/test/andreas_beyer.cpp
@@ -1,3 +1,6 @@
+// Copyright David Abrahams 2006. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include
#include
#include
diff --git a/test/crossmod_exception.py b/test/crossmod_exception.py
index c8430849..48f849a4 100644
--- a/test/crossmod_exception.py
+++ b/test/crossmod_exception.py
@@ -1,9 +1,6 @@
# Copyright (C) 2003 Rational Discovery LLC
-# Permission to copy, use, modify, sell and distribute this software
-# is granted provided this copyright notice appears in all
-# copies. This software is provided "as is" without express or
-# implied warranty, and with no claim as to its suitability for any
-# purpose.
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
print "running..."
diff --git a/test/opaque.py b/test/opaque.py
index 6d994bd7..d10ac784 100644
--- a/test/opaque.py
+++ b/test/opaque.py
@@ -1,9 +1,8 @@
# -*- coding: iso-latin-1 -*-
-# Copyright Gottfried Ganßauge 2003. Permission to copy, use,
-# modify, sell and distribute this software is granted provided this
-# copyright notice appears in all copies. This software is provided
-# "as is" without express or implied warranty, and with no claim as
-# to its suitability for any purpose.
+# Copyright Gottfried Ganßauge 2003..2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
"""
>>> from opaque_ext import *
@@ -66,6 +65,11 @@ RuntimeError: success
>>> try: use2(get())
... except TypeError: pass
... else: print 'expected a TypeError'
+
+ This used to result in a segmentation violation
+
+>>> type(get()) != type (get2())
+1
"""
def run(args = None):
import sys
diff --git a/test/pointer_vector.cpp b/test/pointer_vector.cpp
index 4c446d1a..c1f7dbd4 100644
--- a/test/pointer_vector.cpp
+++ b/test/pointer_vector.cpp
@@ -1,3 +1,6 @@
+// Copyright Joel de Guzman 2005-2006. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include
#include
#include
From 7ba6a00617d8ed4ffbc5d26a7659cf545a1bdc9d Mon Sep 17 00:00:00 2001
From: Dave Abrahams
Date: Thu, 21 Sep 2006 03:43:59 +0000
Subject: [PATCH 27/94] Apply Boost license, with permission from Prabhu
Ramachandran.
[SVN r35240]
---
pyste/install/setup.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pyste/install/setup.py b/pyste/install/setup.py
index 6c156536..c1703981 100644
--- a/pyste/install/setup.py
+++ b/pyste/install/setup.py
@@ -1,4 +1,6 @@
-# contributed by Prabhu Ramachandran
+# Copyright Prabhu Ramachandran 2006. Distributed under the Boost
+# Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
from distutils.core import setup
import sys
From 0d57e9e808c4aa24b00cbc7d1130202a7677339c Mon Sep 17 00:00:00 2001
From: nobody
Date: Thu, 21 Sep 2006 07:07:15 +0000
Subject: [PATCH 28/94] This commit was manufactured by cvs2svn to create
branch 'RC_1_34_0'.
[SVN r35243]
---
doc/v2/opaque.html | 134 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
create mode 100644 doc/v2/opaque.html
diff --git a/doc/v2/opaque.html b/doc/v2/opaque.html
new file mode 100644
index 00000000..5f55d5c8
--- /dev/null
+++ b/doc/v2/opaque.html
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ Boost.Python - <boost/python/opaque_pointer_converter.hpp>
+
+
+
+
Registers the instance as a
+ lvalue_from_pytype
+ converter from Python objects into opaque pointers.
+
The Python Objects created are named after the type pointed to
+ by the opaque pointer being wrapped.
+
Registers the instance as a
+ to_python_converter
+ from opaque pointers to Python objects.
+
+
If there is already an instance registered by another module, this
+ instance doesn't try to register again in order to avoid warnings
+ about multiple registrations.
+
+
Note
+
Normally only a single instance of this class is created for every
+ Pointee.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt )
@@ -97,7 +97,7 @@
(IDL).
-
+
Hello World
@@ -142,7 +142,7 @@
-
Last revised: February 14, 2006 at 02:23:06 GMT
+
Last revised: August 31, 2006 at 05:59:58 GMT
diff --git a/doc/tutorial/doc/html/python/embedding.html b/doc/tutorial/doc/html/python/embedding.html
index 93129beb..79971d82 100644
--- a/doc/tutorial/doc/html/python/embedding.html
+++ b/doc/tutorial/doc/html/python/embedding.html
@@ -43,7 +43,7 @@
Python/C API at all. So stay tuned...
-
+
Building embedded programs
@@ -87,7 +87,7 @@ exe embedded_program # name of the executable
<find-library>$(PYTHON_EMBEDDED_LIBRARY) ;
-
+
Getting started
@@ -96,9 +96,7 @@ exe embedded_program # name of the executable
-
-#include
- <boost/python.hpp>
+ #include <boost/python.hpp>
Call Py_Initialize()
@@ -134,7 +132,7 @@ exe embedded_program # name of the executable
automate the process.
-
+
Reference-counting handles and objects
@@ -168,20 +166,17 @@ exe embedded_program # name of the executable
a new reference is PyRun_String
which we'll discuss in the next section.
-
-
-
Handle is a class
- template, so why haven't we been using any template
- parameters?
handle has a
- single template parameter specifying the type of the managed object.
- This type is PyObject 99% of the time, so the parameter
- was defaulted to PyObject for convenience. Therefore
- we can use the shorthand handle<> instead
- of the longer, but equivalent, handle<PyObject>.
-
-
+
+ Handle is a class template,
+ so why haven't we been using any template parameters?
+ handle has a single template parameter specifying the
+ type of the managed object. This type is PyObject 99%
+ of the time, so the parameter was defaulted to PyObject
+ for convenience. Therefore we can use the shorthand handle<>
+ instead of the longer, but equivalent, handle<PyObject>.
+
-
+
Running Python code
@@ -204,7 +199,7 @@ exe embedded_program # name of the executable
-
+Start symbols
@@ -277,18 +272,16 @@ exe embedded_program # name of the executable
This should create a file called 'hello.txt' in the current directory containing
a phrase that is well-known in programming circles.
-
-
-
Note that
- we wrap the return value of PyRun_String
- in a (nameless) handle even though we are not interested
- in it. If we didn't do this, the the returned object would be kept
- alive unnecessarily. Unless you want to be a Dr. Frankenstein, always
- wrap PyObject*s in handles.
-
-
+
+ Note that we wrap
+ the return value of PyRun_String
+ in a (nameless) handle even though we are not interested
+ in it. If we didn't do this, the the returned object would be kept alive
+ unnecessarily. Unless you want to be a Dr. Frankenstein, always wrap PyObject*s
+ in handles.
+
-
+
Beyond handles
@@ -334,17 +327,15 @@ exe embedded_program # name of the executable
intfive_squared=extract<int>(result);
-
-
-
Note that
- object's member function to return the wrapped
- PyObject* is called ptr instead
- of get. This makes sense if you take into account
- the different functions that object and handle
- perform.
-
+
+ Note that object's
+ member function to return the wrapped PyObject* is called
+ ptr instead of get. This makes sense
+ if you take into account the different functions that object
+ and handle perform.
+
-
+
Exception handling
diff --git a/doc/tutorial/doc/html/python/exposing.html b/doc/tutorial/doc/html/python/exposing.html
index c79507d1..42f188f3 100644
--- a/doc/tutorial/doc/html/python/exposing.html
+++ b/doc/tutorial/doc/html/python/exposing.html
@@ -382,13 +382,10 @@
The wrapper template makes
the job of wrapping classes that are meant to overridden in Python, easier.
-
-
-
MSVC6/7 Workaround
- If you are using Microsoft Visual C++ 6 or 7, you have to write
- f as:
BaseWrap's overridden virtual member function f
in effect calls the corresponding method of the Python object through get_override.
@@ -406,14 +403,10 @@
that the function f is a
pure virtual function.
-
-
-
member function and
- methods
Python, like many object oriented languages
- uses the term methods. Methods correspond
- roughly to C++'s member functions
-
-
+
+ member function and methods
+ Python, like many object oriented languages uses the term methods. Methods correspond roughly to C++'s member functions
+
@@ -467,12 +460,11 @@
we have to check if there is an override for f.
If none, then we call Base::f().
-
-
-
MSVC6/7 Workaround
- If you are using Microsoft Visual C++ 6 or 7, you have to rewrite
- the line with the *note* as:
returncall<charconst*>(f.ptr());.
-
+
+ MSVC6/7 Workaround
+ If you are using Microsoft Visual C++ 6 or 7, you have to rewrite
+ the line with the *note* as:
returncall<charconst*>(f.ptr());.
+
Finally, exposing:
@@ -519,7 +511,7 @@
Class Operators/Special Functions
-
+
Python Operators
@@ -568,7 +560,7 @@
expressions".
-
+
Special Methods
@@ -596,11 +588,12 @@
Need we say more?
-
-
-
What is the business of operator<<? Well, the method str requires the operator<< to do its work (i.e. operator<<
- is used by the method defined by def(str(self)).
-
+
+ What is the business of operator<<? Well, the method str
+ requires the operator<<
+ to do its work (i.e. operator<< is used by the method defined by
+ def(str(self)).
+
diff --git a/doc/tutorial/doc/html/python/functions.html b/doc/tutorial/doc/html/python/functions.html
index e5c93736..3a9b53b3 100644
--- a/doc/tutorial/doc/html/python/functions.html
+++ b/doc/tutorial/doc/html/python/functions.html
@@ -209,7 +209,7 @@ Namespaces are one honking great idea -- let's do more of those!
BOOM!
-
+
Call Policies
@@ -290,13 +290,11 @@ Namespaces are one honking great idea -- let's do more of those!
and hold the instance
-
-
-
Remember the Zen, Luke:
- "Explicit is better than implicit" "In
- the face of ambiguity, refuse the temptation to guess"
-
-
+
+ Remember the Zen, Luke:
+ "Explicit is better than implicit" "In the face
+ of ambiguity, refuse the temptation to guess"
+
@@ -407,7 +405,7 @@ Namespaces are one honking great idea -- let's do more of those!
-
+
BOOST_PYTHON_FUNCTION_OVERLOADS
@@ -437,7 +435,7 @@ Namespaces are one honking great idea -- let's do more of those!
def("foo",foo,foo_overloads());
-
+
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
@@ -483,7 +481,7 @@ Namespaces are one honking great idea -- let's do more of those!
reference for details.
-
+
init and optional
@@ -550,14 +548,14 @@ Namespaces are one honking great idea -- let's do more of those!
Then...
@@ -38,17 +38,16 @@
necessary to achieve that. We shall use the build tool that comes bundled with
every boost distribution: bjam.
-
-
-
Building without bjam
- Besides bjam, there are of course other ways to get your module
- built. What's written here should not be taken as "the one and only
- way". There are of course other build tools apart from bjam.
- Take note however that the preferred build tool for Boost.Python
- is bjam. There are so many ways to set up the build incorrectly. Experience
- shows that 90% of the "I can't build Boost.Python" problems
- come from people who had to use a different tool.
-
+
+ Building without bjam
+ Besides bjam, there are of course other ways to get your module built.
+ What's written here should not be taken as "the one and only way".
+ There are of course other build tools apart from bjam.
+ Take note however that the preferred build tool for Boost.Python is
+ bjam. There are so many ways to set up the build incorrectly. Experience shows
+ that 90% of the "I can't build Boost.Python" problems come from people
+ who had to use a different tool.
+
We shall skip over the details. Our objective will be to simply create the
hello world module and run it in Python. For a complete reference to building
@@ -102,7 +101,7 @@
platforms. The complete list of Bjam executables can be found here.
-
+
Let's Jam!
@@ -153,7 +152,7 @@ extension hello # Declare a Python extension called hello
The last part tells BJam that we are depending on the Boost Python Library.
-
+
Running bjam
@@ -181,11 +180,10 @@ set PYTHON_VERSION=2.2
The above assumes that the Python installation is in c:/dev/tools/python
and that we are using Python version 2.2. You'll have to tweak these appropriately.
-
-
-
Be sure not to include a third number, e.g. not "2.2.1", even if that's the version
- you have.
-
+
+ Be sure not to include a third number, e.g. not "2.2.1", even if that's the version you
+ have.
+
Beware the
- common pitfall of forgetting that the constructors of most of Python's
- mutable types make copies, just as in Python.
-
+
+ Beware the common
+ pitfall of forgetting that the constructors of most of Python's mutable types
+ make copies, just as in Python.
+
Python:
@@ -200,7 +199,7 @@
d['whatever']=3;// modifies the copy
-
+
class_<T> as objects
@@ -298,14 +297,12 @@
above creates a Python class derived from Python's int
type which is associated with the C++ type passed as its first parameter.
-
-
-
what is a scope?
- The scope is a class that has an associated global Python object
- which controls the Python namespace in which new extension classes
- and wrapped functions will be defined as attributes. Details can be
- found here.
-
+
+ what is a scope?
+ The scope is a class that has an associated global Python object which
+ controls the Python namespace in which new extension classes and wrapped
+ functions will be defined as attributes. Details can be found here.
+
You can access those values in Python as
diff --git a/doc/tutorial/doc/html/python/techniques.html b/doc/tutorial/doc/html/python/techniques.html
index 06d34e4d..a60b7278 100644
--- a/doc/tutorial/doc/html/python/techniques.html
+++ b/doc/tutorial/doc/html/python/techniques.html
@@ -99,13 +99,12 @@
Compiling these files will generate the following Python extensions: core.pyd,
io.pyd and filters.pyd.
-
-
-
The extension .pyd is used
- for python extension modules, which are just shared libraries. Using
- the default for your system, like .so for Unix and
- .dll for Windows, works just as well.
-
+
+ The extension .pyd is used for python
+ extension modules, which are just shared libraries. Using the default for
+ your system, like .so for Unix and .dll
+ for Windows, works just as well.
+
Now, we create this directory structure for our Python package:
@@ -428,19 +427,17 @@
exporting it to Python at the same time: changes in a class will only demand
the compilation of a single cpp, instead of the entire wrapper code.
-
-
-
If you're exporting your classes with Pyste,
- take a look at the --multiple option, that generates
- the wrappers in various files as demonstrated here.
-
-
-
-
This method is useful too if you are getting the
- error message "fatal error C1204:Compiler limit:internal
- structure overflow" when compiling a large source file,
- as explained in the FAQ.
-
+
+ If you're exporting your classes with Pyste,
+ take a look at the --multiple option, that generates the
+ wrappers in various files as demonstrated here.
+
+
+ This method is useful too if you are getting the error
+ message "fatal error C1204:Compiler limit:internal structure
+ overflow" when compiling a large source file, as explained
+ in the FAQ.
+
opaque_pointer_converter<> is derived from
-
- to_python_converter
- and registers itself as an
-
- lvalue_from_pytype converter from Python objects
- into pointers to undefined types.
- Thus it may be used as a converter from opaque pointers into
- Python objects and vice versa.
-
-
Class template
- opaque_pointer_converter synopsis
Registers the instance as a
-
- lvalue_from_pytype converter from Python objects
- into opaque pointers.
-
The name is used for the type of the Python Objects created;
- it should be printable but needn't be an
- ntbs because the object type is
- not supposed to be user constructible within python scripts.
This macro must be used to define specializations of the
- type_id function
- which can't be instantiated for incomplete types.
-
Note
-
In order for this to work in a cross-module environment the macro must
- be invoked in every translation unit which uses the
- opaque_pointer_converter.
Python 2.5 introduces a new Py_ssize_t typedef and
+ two related macros (PEP 353). The
+ <boost/python/ssize_t.hpp> header imports these
+ definitions into the boost::python namespace as
+ ssize_t, ssize_t_max, and ssize_t_min.
+ Appropriate definitions are provided for backward compatibility
+ with previous Python versions.
+
+
Typedefs
Imports
+ Py_ssize_t into the boost::python namespace if
+ available, or provides an appropriate typedef for backward
+ compatibility:
+
Imports
+ PY_SSIZE_T_MAX and PY_SSIZE_T_MIN as constants
+ into the boost::python namespace if available, or
+ provides appropriate constants for backward compatibility:
+
diff --git a/include/boost/python/converter/builtin_converters.hpp b/include/boost/python/converter/builtin_converters.hpp
index 3ae45c37..dddb154c 100644
--- a/include/boost/python/converter/builtin_converters.hpp
+++ b/include/boost/python/converter/builtin_converters.hpp
@@ -7,6 +7,7 @@
# include
# include
# include
+# include
# include
# include
# include
@@ -115,9 +116,9 @@ BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUn
BOOST_PYTHON_TO_PYTHON_BY_VALUE(char, converter::do_return_to_python(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(char const*, converter::do_return_to_python(x))
-BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast(x.size())))
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast(x.size())))
#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING)
-BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast(x.size())))
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast(x.size())))
# endif
BOOST_PYTHON_TO_PYTHON_BY_VALUE(float, ::PyFloat_FromDouble(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(double, ::PyFloat_FromDouble(x))
diff --git a/include/boost/python/list.hpp b/include/boost/python/list.hpp
index 793cd08a..0f6d1e8e 100644
--- a/include/boost/python/list.hpp
+++ b/include/boost/python/list.hpp
@@ -9,6 +9,7 @@
# include
# include
+# include
namespace boost { namespace python {
@@ -24,11 +25,11 @@ namespace detail
long index(object_cref value) const; // return index of first occurrence of value
- void insert(int index, object_cref); // insert object before index
+ void insert(ssize_t index, object_cref); // insert object before index
void insert(object const& index, object_cref);
object pop(); // remove and return item at index (default last)
- object pop(long index);
+ object pop(ssize_t index);
object pop(object const& index);
void remove(object_cref value); // remove first occurrence of value
@@ -86,7 +87,7 @@ class list : public detail::list_base
}
template
- void insert(int index, T const& x) // insert object before index
+ void insert(ssize_t index, T const& x) // insert object before index
{
base::insert(index, object(x));
}
@@ -98,7 +99,7 @@ class list : public detail::list_base
}
object pop() { return base::pop(); }
- object pop(long index) { return base::pop(index); }
+ object pop(ssize_t index) { return base::pop(index); }
template
object pop(T const& index)
diff --git a/include/boost/python/object.hpp b/include/boost/python/object.hpp
index 677ffb42..9adec90f 100755
--- a/include/boost/python/object.hpp
+++ b/include/boost/python/object.hpp
@@ -5,7 +5,7 @@
#ifndef OBJECT_DWA2002612_HPP
# define OBJECT_DWA2002612_HPP
-# include
+# include
# include
# include
# include
@@ -15,9 +15,9 @@
namespace boost { namespace python {
- inline long len(object const& obj)
+ inline ssize_t len(object const& obj)
{
- long result = PyObject_Length(obj.ptr());
+ ssize_t result = PyObject_Length(obj.ptr());
if (PyErr_Occurred()) throw_error_already_set();
return result;
}
diff --git a/src/list.cpp b/src/list.cpp
index 79f758a9..b8f31fb8 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -3,6 +3,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include
+#include
namespace boost { namespace python { namespace detail {
@@ -53,7 +54,7 @@ long list_base::index(object_cref value) const
return result;
}
-void list_base::insert(int index, object_cref item)
+void list_base::insert(ssize_t index, object_cref item)
{
if (PyList_CheckExact(this->ptr()))
{
@@ -79,7 +80,7 @@ object list_base::pop()
return this->attr("pop")();
}
-object list_base::pop(long index)
+object list_base::pop(ssize_t index)
{
return this->pop(object(index));
}
diff --git a/src/object/class.cpp b/src/object/class.cpp
index efc492c6..58234bbb 100644
--- a/src/object/class.cpp
+++ b/src/object/class.cpp
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -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(1));
- handle<> bases(PyTuple_New(num_bases));
+ assert(num_bases <= ssize_t_max);
+ handle<> bases(PyTuple_New(static_cast(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(c.release()));
+ PyTuple_SET_ITEM(bases.get(), static_cast(i - 1), upcast(c.release()));
}
// Call the class metatype to create a new class
diff --git a/src/object/function.cpp b/src/object/function.cpp
index 653343b9..1f094f42 100644
--- a/src/object/function.cpp
+++ b/src/object/function.cpp
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include
#include
@@ -64,7 +65,7 @@ function::function(
= max_arity > num_keywords ? max_arity - num_keywords : 0;
- unsigned tuple_size = num_keywords ? max_arity : 0;
+ ssize_t tuple_size = num_keywords ? max_arity : 0;
m_arg_names = object(handle<>(PyTuple_New(tuple_size)));
if (num_keywords != 0)
@@ -158,7 +159,9 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const
else
{
// build a new arg tuple, will adjust its size later
- inner_args = handle<>(PyTuple_New(max_arity));
+ assert(max_arity <= ssize_t_max);
+ inner_args = handle<>(
+ PyTuple_New(static_cast(max_arity)));
// Fill in the positional arguments
for (std::size_t i = 0; i < n_unnamed_actual; ++i)
@@ -293,7 +296,7 @@ void function::argument_error(PyObject* args, PyObject* /*keywords*/) const
% make_tuple(this->m_namespace, this->m_name);
list actual_args;
- for (int i = 0; i < PyTuple_Size(args); ++i)
+ for (ssize_t i = 0; i < PyTuple_Size(args); ++i)
{
char const* name = PyTuple_GetItem(args, i)->ob_type->tp_name;
actual_args.append(str(name));
diff --git a/src/object_protocol.cpp b/src/object_protocol.cpp
index c23b8bb3..8606fa2b 100755
--- a/src/object_protocol.cpp
+++ b/src/object_protocol.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
namespace boost { namespace python { namespace api {
@@ -106,7 +107,7 @@ namespace // slicing code copied directly out of the Python implementation
PySequenceMethods *sq = tp->tp_as_sequence;
if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) {
- int ilow = 0, ihigh = INT_MAX;
+ ssize_t ilow = 0, ihigh = ssize_t_max;
if (!_PyEval_SliceIndex(v, &ilow))
return NULL;
if (!_PyEval_SliceIndex(w, &ihigh))
@@ -133,7 +134,7 @@ namespace // slicing code copied directly out of the Python implementation
PySequenceMethods *sq = tp->tp_as_sequence;
if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) {
- int ilow = 0, ihigh = INT_MAX;
+ ssize_t ilow = 0, ihigh = ssize_t_max;
if (!_PyEval_SliceIndex(v, &ilow))
return -1;
if (!_PyEval_SliceIndex(w, &ihigh))
diff --git a/src/str.cpp b/src/str.cpp
index c452a285..5216cf54 100644
--- a/src/str.cpp
+++ b/src/str.cpp
@@ -3,6 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include
#include
+#include
namespace boost { namespace python { namespace detail {
@@ -21,10 +22,25 @@ str_base::str_base(const char* s)
: object(detail::new_reference(::PyString_FromString(s)))
{}
+namespace {
+
+ ssize_t str_size_as_py_ssize_t(std::size_t n)
+ {
+ if (n > ssize_t_max)
+ {
+ throw std::range_error("str size > ssize_t_max");
+ }
+ return static_cast(n);
+ }
+
+} // namespace
+
str_base::str_base(char const* start, char const* finish)
: object(
detail::new_reference(
- ::PyString_FromStringAndSize(start, finish - start)
+ ::PyString_FromStringAndSize(
+ start, str_size_as_py_ssize_t(finish - start)
+ )
)
)
{}
@@ -32,7 +48,9 @@ str_base::str_base(char const* start, char const* finish)
str_base::str_base(char const* start, std::size_t length) // new str
: object(
detail::new_reference(
- ::PyString_FromStringAndSize(start, length)
+ ::PyString_FromStringAndSize(
+ start, str_size_as_py_ssize_t(length)
+ )
)
)
{}
From 375cc3aa9363f3ca8c55de3f9472b8a6a5ed6bff Mon Sep 17 00:00:00 2001
From: Dave Abrahams
Date: Tue, 26 Sep 2006 04:25:49 +0000
Subject: [PATCH 40/94] Fix broken links
[SVN r35330]
---
doc/news.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/news.html b/doc/news.html
index ce4ead50..6e637a04 100644
--- a/doc/news.html
+++ b/doc/news.html
@@ -45,7 +45,7 @@
Support for converting void* to/from python,
with opaque_pointer_converter
+ href="v2/opaque.html">opaque_pointer_converter
as the return value policy. Thanks to Niall Douglas for the
initial patch.
@@ -219,7 +219,7 @@ BOOST_PYTHON_MODULE(test)
Provides access to the array types of Numerical Python's Numeric and NumArray modules. With
- the exception of the functions documented below, the semantics of the constructors and
- member functions defined below can be fully understood by reading the TypeWrapper concept
- definition. Since array is publicly derived from object, the public object
- interface applies to array instances as well.
+
Provides access to the array types of Numerical Python's Numeric and NumArray modules. With
+ the exception of the functions documented below, the semantics of the constructors and
+ member functions defined below can be fully understood by reading the
+ TypeWrapper concept
+ definition. Since array is publicly derived from
+ object, the public
+ object interface applies to array instances as well.
-
The default behavior is to use
- numarray.NDArray as the associated Python type if the
- numarray module is installed in the default location.
- Otherwise it falls back to use Numeric.ArrayType. If neither
- extension module is installed, conversions to arguments of type
- numeric::array will cause overload resolution to reject the
- overload, and other attempted uses of numeric::array will raise an appropriate Python exception.
- The associated Python type can be set manually using the set_module_and_type(...) static
- function.
+
The default behavior is
+ to use numarray.NDArray as the associated Python type if the
+ numarray module is installed in the default location.
+ Otherwise it falls back to use Numeric.ArrayType. If neither
+ extension module is installed, overloads of wrapped C++ functions with
+ numeric::array parameters will never be matched, and other
+ attempted uses of numeric::array will raise an appropriate Python exception. The
+ associated Python type can be set manually using the set_module_and_type(...) static
+ function.
object factory();
-template <class Buffer>
-object factory(Buffer const&);
-template <class Buffer, class Type>
-object factory(Buffer const&, Type const&);
-template <class Buffer, class Type, class Shape>
-object factory(Buffer const&, Type const&, Shape const&, bool copy = true, bool savespace = false);
-template <class Buffer, class Type, class Shape>
-object factory(Buffer const&, Type const&, Shape const&, bool copy, bool savespace, char typecode);
-
- These functions map to the underlying array type's array()
- function family. They are not called "array" because of the
- C++ limitation that you can't define a member function with the same name
- as its enclosing class.
-
+template <class Sequence>
+object factory(Sequence const&);
+template <class Sequence, class Typecode>
+object factory(Sequence const&, Typecode const&, bool copy = true, bool savespace = false);
+template <class Sequence, class Typecode, class Type>
+object factory(Sequence const&, Typecode const&, bool copy, bool savespace, Type const&);
+template <class Sequence, class Typecode, class Type, class Shape>
+object factory(Sequence const&, Typecode const&, bool copy, bool savespace, Type const&, Shape const&);
+
These functions map to the underlying array type's array()
+function family. They are not called "array" because of the C++
+limitation that you can't define a member function with the same name as its
+enclosing class.
+
- This function maps to the underlying array type's new()
- function. It is not called "new" because that is a keyword
- in C++.
+array new_(Type const&) const;
+
This function maps to the underlying array type's new()
+function. It is not called "new" because that is a keyword in
+C++.
-
Requires:package_path and
- type_name, if supplied, is an ntbs.
+
+
Requires:package_path and
+ type_name, if supplied, is an ntbs.
-
Effects: The first form sets the package path of the module
- which supplies the type named by type_name to
- package_path. The second form restores the default search behavior. The associated Python
- type will be searched for only the first time it is needed, and
- thereafter the first time it is needed after an invocation of
- set_module_and_type.
-
+
Effects: The first form sets the package path of the module
+ that supplies the type named by type_name to
+ package_path. The second form restores the default search behavior. The associated Python type
+ will be searched for only the first time it is needed, and thereafter the
+ first time it is needed after an invocation of
+ set_module_and_type.
+
+
+static std::string get_module_name()
+
-
Example
-
+
+
Effects: Returns the name of the module containing the class
+ that will be held by new numeric::array instances.