2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Compare commits

..

143 Commits

Author SHA1 Message Date
Daniel James
f1ed00e3a5 Use root links in quickbook.
[SVN r45364]
2008-05-14 20:38:29 +00:00
Daniel James
0c5577c99a Update 'more' links.
[SVN r44996]
2008-05-01 21:34:42 +00:00
Daniel James
21d11150fd Work around a quickbook bug which is affecting the python docs. Refs #1864.
[SVN r44590]
2008-04-19 15:38:29 +00:00
Daniel James
502fe1fdb2 Fix some links in the python docs. Refs #1684.
[SVN r44589]
2008-04-19 15:37:39 +00:00
Daniel James
5d3b58f6f7 Create a branch for documentation work.
[SVN r44584]
2008-04-19 14:48:18 +00:00
Joel de Guzman
b316819925 Andreas indexing suite patch
[SVN r44450]
2008-04-16 03:07:11 +00:00
Joel de Guzman
52245de2e5 Andreas patch
[SVN r44449]
2008-04-16 03:07:06 +00:00
Ralf W. Grosse-Kunstleve
2f1f79ce87 bogus VC8 warning C4180 disabled
[SVN r44041]
2008-04-04 18:57:27 +00:00
Beman Dawes
863bff9072 Remove per email from Dave
[SVN r43901]
2008-03-28 02:11:13 +00:00
Dave Abrahams
2213cf98c6 Work around vc9 bugs
[SVN r43845]
2008-03-24 18:27:22 +00:00
Ralf W. Grosse-Kunstleve
2dba3148ce map std::invalid_argument -> Python ValueError
[SVN r43546]
2008-03-09 04:30:13 +00:00
Daniel James
48aa6ab9a9 Fix incorrect links to copyright of the form 'http:#www.boost.org
[SVN r43423]
2008-02-27 19:22:01 +00:00
Daniel James
6ba5067e0b Point links to the pages that used to be in 'more' to the site.
[SVN r43210]
2008-02-10 15:02:17 +00:00
Daniel James
60f4f5e54c Link to people pages on the website, as they've been removed from the download.
[SVN r43209]
2008-02-10 14:56:22 +00:00
Eric Niebler
7ee9cf679b stl_iterator does better error handling
[SVN r42836]
2008-01-17 22:47:54 +00:00
Ralf W. Grosse-Kunstleve
03a72363a4 undo revision 41404; see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34238
[SVN r41986]
2007-12-12 05:39:45 +00:00
Jürgen Hunold
38cc1a0c15 Add cosmetic virtual detructors to silence compile warnings.
[SVN r41650]
2007-12-03 18:51:26 +00:00
Jürgen Hunold
ff44521920 Silence unused paramter warning in release mode.
[SVN r41649]
2007-12-03 18:47:17 +00:00
Jürgen Hunold
0ac7e3f858 Revert revisions 41544 and 41549.
See http://lists.boost.org/Archives/boost/2007/12/131116.php for details.


[SVN r41577]
2007-12-02 11:51:08 +00:00
Jürgen Hunold
5cbb539ec5 Remove unused paramters.
Add -Wextra to gcc flags to enable more warnings.


[SVN r41550]
2007-12-01 20:26:37 +00:00
Jürgen Hunold
40e4940877 Silence compiler by adding cosmetic virtual destructors.
[SVN r41549]
2007-12-01 20:24:51 +00:00
Jürgen Hunold
ab0911cf53 Silence compiler by adding cosmetic virtual destructors.
[SVN r41544]
2007-12-01 19:27:06 +00:00
Dave Abrahams
0d81eb6695 Boost.Python:
* Workarounds for many SunCC 5.9 bugs
* Suppression of many SunCC 5.9 warnings
* Improve the style of some test invocations in Jamfile


[SVN r41521]
2007-12-01 02:15:17 +00:00
Dave Abrahams
e0b535df1e Try to extend the workaround to SunPro 5.9, since we're marked as not working on 5.8
[SVN r41408]
2007-11-26 22:01:50 +00:00
Ralf W. Grosse-Kunstleve
d2517faa78 g++ 4.3.0 compatibility (4.3.0 20071125 (experimental))
[SVN r41404]
2007-11-26 20:46:28 +00:00
Beman Dawes
8cd4ff8950 Remove extra ) from prior commit
[SVN r41355]
2007-11-25 13:56:09 +00:00
Dave Abrahams
26f77691ee Attempt SunPro workaround
[SVN r41352]
2007-11-25 09:02:01 +00:00
Joel de Guzman
6e7f594027 fix for trac ticket #1450
[SVN r41164]
2007-11-17 01:51:04 +00:00
Beman Dawes
eada30f0cb Get rid of .cvsignore files
[SVN r41107]
2007-11-15 15:20:27 +00:00
Joel de Guzman
e919ffdac4 refresh docs
[SVN r41082]
2007-11-14 10:24:21 +00:00
Joel de Guzman
1cf41fd031 fix mismatch include guard
[SVN r41019]
2007-11-11 22:32:48 +00:00
Nikolay Mladenov
7b67118271 changed handle cast to downcast
[SVN r40935]
2007-11-08 16:28:44 +00:00
Nikolay Mladenov
e14c702a40 added forgotten array_object_manager_traits::get_pytype
[SVN r40889]
2007-11-07 16:06:55 +00:00
Joel de Guzman
d303ea16fc added copyright and license info for each page.
[SVN r40871]
2007-11-07 03:35:49 +00:00
Ralf W. Grosse-Kunstleve
65114d8637 reinterpret_cast -> const_cast; commented out dead code removed
[SVN r40749]
2007-11-04 18:08:28 +00:00
Joel de Guzman
597dfc586b tutorial update
[SVN r40734]
2007-11-04 00:12:29 +00:00
Dave Abrahams
6a3085ad5d Merging some of the more obvious changes from RC_1_34_0
[SVN r40714]
2007-11-03 03:25:13 +00:00
Joel de Guzman
190d0d7ea6 replacing reinterpret_cast with static_cast<PySliceObject*>(static_cast<void*>(i))
[SVN r40712]
2007-11-03 03:05:26 +00:00
Eric Niebler
8b915a15ff merge Changeset 37947
[SVN r40675]
2007-11-02 04:35:01 +00:00
Dave Abrahams
90c5c19220 Take out print statement I added for debugging purposes.
[SVN r40536]
2007-10-28 19:24:02 +00:00
Dave Abrahams
cfe6f96f69 Closes #1379, really this time. The old code would sandwich argv[1] between quotes and interpret it as a string, so backslashes in windows paths were interpreted as escape sequences.
[SVN r40535]
2007-10-28 19:22:21 +00:00
Vladimir Prus
77907c5369 Make sure every library can be installed by using
bjam stage|install

in libs/<library>/build.


[SVN r40475]
2007-10-26 09:04:25 +00:00
Rene Rivera
512b30c971 Do not refer to nonexistent target when python is not configured.
[SVN r40216]
2007-10-20 16:36:18 +00:00
Rene Rivera
f005518686 Fix build system error when Python is not configured, without preventing the BPL target from being declared. Instead the target is now unbuildable, and will be skipped when Python is not configured.
[SVN r40156]
2007-10-18 16:11:41 +00:00
Rene Rivera
274a219965 Remove BPL build conditional as it prevents normal build failures.
[SVN r39731]
2007-10-06 19:46:39 +00:00
Ralf W. Grosse-Kunstleve
abc4abf84a gcc 4.3.0 compatibility (resolves new "changes meaning" error)
[SVN r39434]
2007-09-20 23:20:45 +00:00
Nikolay Mladenov
94a3ced83a fixed cpp signature related test failure
[SVN r39372]
2007-09-18 17:51:47 +00:00
Nikolay Mladenov
7eb0c678ee epydoc friendlier formatting
[SVN r39371]
2007-09-18 17:32:06 +00:00
Nikolay Mladenov
92460adce6 tabs removes, code reformatting
[SVN r39370]
2007-09-18 17:28:23 +00:00
Nikolay Mladenov
8cfd3fb2ef epydoc friendlier formatting
[SVN r39368]
2007-09-18 17:16:31 +00:00
Nikolay Mladenov
62ef542eaf fixed problem reported by Neal Becker; added a test case
[SVN r39223]
2007-09-12 21:31:39 +00:00
Ralf W. Grosse-Kunstleve
5809078ba9 Patches by Nikolay Mladenov (nickm at sitius com): new pythonic signatures; docstring support for enums; fix unrelated Visual C++ 6 problem
[SVN r39191]
2007-09-11 16:53:50 +00:00
Vladimir Prus
04e54d670c Remove V1 Jamfiles
[SVN r38516]
2007-08-08 19:02:26 +00:00
Stefan Seefeld
dd7c0a7f3d Fix ticket #1115.
[SVN r38289]
2007-07-26 16:11:18 +00:00
Stefan Seefeld
71f54cc920 Fix ticket #1115.
[SVN r38288]
2007-07-26 14:41:41 +00:00
Ralf W. Grosse-Kunstleve
9de994c0d1 Hans Meine's extra new-line for epydoc with reST compatibility
[SVN r37906]
2007-06-06 00:00:57 +00:00
Stefan Seefeld
e9caacc428 More fixes for embedding python docs.
[SVN r37709]
2007-05-18 15:52:55 +00:00
Stefan Seefeld
5070e84f70 Enhance documentation for embedding python.
[SVN r37708]
2007-05-18 15:22:43 +00:00
Stefan Seefeld
fe23d9885f Add new eval() function.
[SVN r37560]
2007-05-02 13:11:20 +00:00
Ralf W. Grosse-Kunstleve
e7ee17b71b MIPSpro: undo Python 2.5.1 define (the define leads to many warnings)
[SVN r37502]
2007-04-25 04:45:17 +00:00
Dave Abrahams
5edb63d01c Some progress on Python build guide. Minor fixes to getting started guide.
[SVN r37418]
2007-04-11 23:35:08 +00:00
Dave Abrahams
f4b3aab7d4 Checkpoint before reorg
[SVN r37370]
2007-04-05 20:13:13 +00:00
Dave Abrahams
6af67d1a4c kill off BBv1 project archive
[SVN r37367]
2007-04-05 17:19:20 +00:00
Dave Abrahams
16d975ba5c Bringing forward BBv2/Python support and a few other things that were
obviously more up-to-date on the RC branch.

Removed the Boost.Python v1 zip archive.


[SVN r37346]
2007-04-03 17:10:53 +00:00
Dave Abrahams
4fc5cafd40 Some progress on new build/test guide.
[SVN r37333]
2007-04-02 05:24:25 +00:00
Stefan Seefeld
1b5cd10f7c Fix reference counting error.
[SVN r37312]
2007-03-28 18:12:08 +00:00
Stefan Seefeld
0f91872518 Fix import_ failure.
[SVN r37142]
2007-03-05 18:51:04 +00:00
Stefan Seefeld
dc6b2979e4 Add copyright notice.
[SVN r37132]
2007-03-02 17:16:51 +00:00
Stefan Seefeld
50034140c4 Fix boost::python::import.
[SVN r37120]
2007-03-01 15:17:29 +00:00
Dave Abrahams
08a6f35ec2 Correct testing bugs:
either changing assert(...) or BOOST_ASSERT(...) to BOOST_TEST
    (in my code only)

    or adding "return boost::report_errors();" where it was clearly
    missing (and a pure bug, in anyone's code).


[SVN r37057]
2007-02-24 22:40:59 +00:00
Dave Abrahams
67236ffbad New build instructions in progress
[SVN r36879]
2007-02-03 16:55:07 +00:00
Dave Abrahams
96ab7a80a4 Remove BBv1 for good
[SVN r36323]
2006-12-11 05:02:34 +00:00
Dave Abrahams
d8c3ff199e Remove BBv1 for good
[SVN r36321]
2006-12-11 03:35:10 +00:00
Dave Abrahams
0c4ebef579 Fix auto-link to look at the right variable.
Make boost-build.jam point at the v2 Boost.


[SVN r36318]
2006-12-11 02:54:48 +00:00
Dave Abrahams
8fe9d41b58 Cleaned out flotsam and improved comments
[SVN r36317]
2006-12-11 02:50:55 +00:00
Dave Abrahams
8a4590b2ef Enable auto-linking
[SVN r36291]
2006-12-07 17:44:05 +00:00
Ralf W. Grosse-Kunstleve
d67b040683 fixes to support pickling of enums (by Shashank Bapat)
[SVN r36256]
2006-12-03 20:43:48 +00:00
Beman Dawes
2db61657f2 Add copyright, license
[SVN r35905]
2006-11-07 19:11:57 +00:00
Dave Abrahams
6d2ee96ba3 improve error message
[SVN r35822]
2006-11-03 16:34:53 +00:00
Stefan Seefeld
a74c8e3da3 Fix symbol visibility.
[SVN r35754]
2006-10-27 21:19:47 +00:00
Ralf W. Grosse-Kunstleve
9f4d39d9fe correct trivial, obvious accident: stray line removed
[SVN r35599]
2006-10-13 22:06:17 +00:00
Dave Abrahams
31c19644ed make numpy tests portable to Darwin with older docutils
[SVN r35597]
2006-10-13 21:34:26 +00:00
Dave Abrahams
600d444136 Fix some problems with testing on old docutils installations
[SVN r35594]
2006-10-13 19:35:28 +00:00
Dave Abrahams
c3bd0fcbad Make object comparison operators return object instead of bool, to
accomodate strange beasts like numarray arrays that return arrays that
can't be used as truth values from their comparison ops.

Fix numpy test for portability with old doctest (again!)


[SVN r35572]
2006-10-12 09:07:07 +00:00
Dave Abrahams
991a7c198a Workaround vc6 bugs
[SVN r35568]
2006-10-12 06:41:55 +00:00
Dave Abrahams
9b67f0447d Suppress a couple of msvc class/struct warnings
[SVN r35567]
2006-10-12 06:41:18 +00:00
Dave Abrahams
b714f6cc23 Adjust tests to account for numarray behavior differences
[SVN r35539]
2006-10-10 22:44:09 +00:00
Dave Abrahams
479a6ba4fc Try for backward compatibility with older versions of doctest
[SVN r35535]
2006-10-10 18:12:43 +00:00
Dave Abrahams
d78836b828 Fix lots of bugs in the numeric interface and tests.
Tests:
* Coerce a result to bool to deal with Python's new Bool type
* Better reporting of mismatches in expected and received results
* Remove bogus nullary y.astype() call
* Fix all uses of trace and diagonal so they don't cause errors
* Use appropriate typecodes
* Use doctest detailed API to run just the relevant tests
* Factor out error handling from macro

API:
* Added get_module_name() function to get current numeric module
* new_(x) now returns an array instead of object
* Fixed the signatures of the factory() family of functions
* Updated docs accordingly.


[SVN r35528]
2006-10-09 04:05:25 +00:00
Dave Abrahams
7a59131d37 Fix missing #include
[SVN r35524]
2006-10-08 05:17:20 +00:00
Dave Abrahams
5ab00bc9c8 Fix long-standing misnaming of "factory" method as "array"
[SVN r35428]
2006-09-29 22:24:12 +00:00
Dave Abrahams
94500ae36d Tests and fixes for a bad interaction between wrapper<> and operators
support.  "self" arguments weren't getting unwrapped properly.


[SVN r35365]
2006-09-28 14:41:01 +00:00
Dave Abrahams
5e5d34cc36 Fixed broken links
[SVN r35329]
2006-09-26 04:23:32 +00:00
Ralf W. Grosse-Kunstleve
c6f2aa4ef2 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]
2006-09-26 00:25:07 +00:00
Dave Abrahams
c7fb2f7047 Attempt GCC-3.4.4 and 4.0.1 workarounds
[SVN r35276]
2006-09-22 15:12:04 +00:00
Vladimir Prus
afedc1cd9a Add tests
[SVN r35244]
2006-09-21 07:26:35 +00:00
Gottfried Ganßauge
070e02d7d5 Renamed from opaque_pointer_converter.html
[SVN r35242]
2006-09-21 07:07:14 +00:00
Dave Abrahams
ccc56c2a4c Apply Boost license, with permission from Prabhu Ramachandran.
[SVN r35240]
2006-09-21 03:43:59 +00:00
Dave Abrahams
e00a88ff49 Fix inspection issues
[SVN r35239]
2006-09-21 02:40:19 +00:00
Stefan Seefeld
e527bc860f Fix copyright issues.
[SVN r35236]
2006-09-20 22:30:39 +00:00
Dave Abrahams
921e306b9a Fix license/copyright
[SVN r35234]
2006-09-20 21:59:03 +00:00
Dave Abrahams
bed1d26904 Return an int, not a string, on success from
check_numeric_array_rich_slice, since that's what the tests expect.


[SVN r35184]
2006-09-18 22:21:50 +00:00
Dave Abrahams
41a342f026 vc6/7 workaround
[SVN r35164]
2006-09-18 18:25:12 +00:00
Dave Abrahams
cee8e07046 Checkin missing op_repr definition
[SVN r35153]
2006-09-18 02:59:31 +00:00
Dave Abrahams
0806e89964 More informative error messages
Better autoconfiguration


[SVN r35140]
2006-09-17 02:41:20 +00:00
Dave Abrahams
f5421ca6b2 Default to Python 2.4 in Unix builds
Applied contributed patches http://tinyurl.com/ndljr and
http://tinyurl.com/18r


[SVN r35138]
2006-09-16 18:43:53 +00:00
Ralf W. Grosse-Kunstleve
eea7697175 if __name__ == '__main__'
[SVN r35114]
2006-09-14 21:57:56 +00:00
Ralf W. Grosse-Kunstleve
777ce7b561 magic coding: iso-latin1 comment added to avoid Python SyntaxError
[SVN r35113]
2006-09-14 21:53:00 +00:00
Gottfried Ganßauge
864ece5539 cross module compatibility test for opaque
[SVN r35111]
2006-09-14 19:06:33 +00:00
Gottfried Ganßauge
2610eb9acb Type object for opaque initialized with PyType_Clear.
opaque is registered only if not another module has already registered
a conversion for that pointer type.
Doc update.


[SVN r35104]
2006-09-14 05:59:29 +00:00
Dave Abrahams
567a2c7b89 attempt unverified workaround for http://tinyurl.com/gvrgd
[SVN r35103]
2006-09-13 22:47:11 +00:00
Dave Abrahams
05070faf12 Attempt to capture better debugging info in output
[SVN r35079]
2006-09-12 23:58:40 +00:00
Dave Abrahams
ad8069314d Move definition of BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION back
where it belongs.


[SVN r35076]
2006-09-12 22:37:09 +00:00
Dave Abrahams
9366c48351 add missing license/copyright info
[SVN r35068]
2006-09-11 22:08:18 +00:00
Dave Abrahams
5a14319753 SunPro workarounds
[SVN r35067]
2006-09-11 10:38:14 +00:00
Joel de Guzman
279a4f7888 Update
[SVN r35006]
2006-08-31 06:01:57 +00:00
Dave Abrahams
d3418d494c Restort BOOST_PYTHON_STATIC_LIB. We don't want to create exported symbols.
[SVN r34942]
2006-08-24 19:03:35 +00:00
Dave Abrahams
c839427246 Sun workaround
[SVN r34939]
2006-08-24 13:04:59 +00:00
Dave Abrahams
dd3a136b18 Attempted Sun workaround
[SVN r34914]
2006-08-22 11:50:35 +00:00
Dave Abrahams
48696918de Try not specifying static link, to see if it makes Darwin happy
[SVN r34871]
2006-08-11 15:50:21 +00:00
Dave Abrahams
88be35ddc2 Attempt Sun-5.8 workaround
[SVN r34864]
2006-08-11 00:47:48 +00:00
Gennaro Prota
9ee0d36a1d removed tabs (inspect tool)
[SVN r34722]
2006-07-24 22:25:35 +00:00
Gennaro Prota
f240e0bab6 removed tabs (inspect tool)
[SVN r34720]
2006-07-24 22:20:25 +00:00
Gennaro Prota
4081605e4b removed tabs (inspect tool)
[SVN r34719]
2006-07-24 22:14:15 +00:00
Gennaro Prota
f332ff2d89 minor fix: violation of min/max guidelines
[SVN r34717]
2006-07-24 22:04:05 +00:00
Vladimir Prus
ec77608840 Clarify comment
[SVN r34668]
2006-07-22 12:53:49 +00:00
Vladimir Prus
f5a69a1dab Windows fix: use <library>/pytho/python_for_extensions, not <use>, so that
we actually link to Python import lib on windows.


[SVN r34666]
2006-07-22 12:28:00 +00:00
Vladimir Prus
a1e865061c Don't link Boost.Python to python library, and don't require
<threading>multi for embedding applications.

* libs/python/build/Jamfile.v2: (boost_python): Don't link
  to /python//python. Use /python//python_for_extensions.

* libs/python/test/Jamfile.v2: Remove <threading>multi project
  requirements.
  (py-run): Link to /python//python.
  (exec): Likewise.

* tools/build/v2/tools/python.jam: (pthread): Declare.
  (init-unix): Add 'pthread' to extra-libs.
  (


[SVN r34662]
2006-07-22 07:12:10 +00:00
Ralf W. Grosse-Kunstleve
596e92404a old misunderstanding corrected (L-BFGS)
[SVN r34504]
2006-07-11 04:09:41 +00:00
Joel de Guzman
2640f5af94 new css
[SVN r34426]
2006-06-29 09:35:52 +00:00
Joel de Guzman
0605e9fdcf minor tweak
[SVN r34375]
2006-06-22 13:43:09 +00:00
Joel de Guzman
cf68da0b19 added test for vector<string>
[SVN r34374]
2006-06-22 13:33:46 +00:00
Joel de Guzman
d3c474b295 terminology tweak
[SVN r34360]
2006-06-20 14:01:12 +00:00
Joel de Guzman
c9300e07c2 added custom converter test for map indexing suite
[SVN r34359]
2006-06-20 00:33:22 +00:00
Ralf W. Grosse-Kunstleve
cab94a7bba adjustments for new MIPSpro 7.4.4
[SVN r34132]
2006-06-02 05:39:50 +00:00
Ralf W. Grosse-Kunstleve
caa9cb8268 Python 2.5 compatibility
[SVN r34017]
2006-05-18 22:41:14 +00:00
Ralf W. Grosse-Kunstleve
66ac61450e avoid Visual C++ 7.1 "resolved overload was found by argument-dependent lookup" warning
[SVN r34016]
2006-05-18 22:09:20 +00:00
Ralf W. Grosse-Kunstleve
59f81def56 Python include must appear before any system include
[SVN r34010]
2006-05-18 18:47:12 +00:00
Ralf W. Grosse-Kunstleve
92862028b7 MIPSpro 7.3.1 compatibility
[SVN r34009]
2006-05-18 18:46:26 +00:00
Ralf W. Grosse-Kunstleve
b0ba7dfc50 also exercise OVERLOADS with docstring
[SVN r34006]
2006-05-18 16:15:59 +00:00
Ralf W. Grosse-Kunstleve
fe3abeda9f much more informative pickle error messages if pickling is not enabled
[SVN r34004]
2006-05-18 15:49:41 +00:00
Markus Schöpflin
3fdfb30e33 Include python first, fixes error on Tru64/CXX.
[SVN r33454]
2006-03-23 09:38:03 +00:00
Vladimir Prus
cdcf8633bb Force multithreading for Python test.
Workaround for problem described in
http://thread.gmane.org/gmane.comp.lib.boost.devel/139601


[SVN r33434]
2006-03-22 09:53:34 +00:00
51 changed files with 233 additions and 174 deletions

View File

@@ -158,8 +158,8 @@ all the parts of your Python installation. If it isn't, consider
<p>If you're still having trouble, Someone on one of the following
mailing lists may be able to help:</p>
<ul class="simple">
<li>The <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing list</a> for issues related to Boost.Build</li>
<li>The Python <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#cplussig">C++ Sig</a> for issues specifically related to Boost.Python</li>
<li>The <a class="reference external" href="http://www.boost.org/community/groups.html#jamboost">Boost.Build mailing list</a> for issues related to Boost.Build</li>
<li>The Python <a class="reference external" href="http://www.boost.org/community/groups.html#cplussig">C++ Sig</a> for issues specifically related to Boost.Python</li>
</ul>
</div>
<div class="section" id="in-case-everything-seemed-to-work">

View File

@@ -11,7 +11,7 @@
:alt: Boost C++ Libraries:
:class: boost-logo
__ ../index.htm
__ ../index.html
.. section-numbering::
@@ -177,8 +177,8 @@ mailing lists may be able to help:
* The `Boost.Build mailing list`__ for issues related to Boost.Build
* The Python `C++ Sig`__ for issues specifically related to Boost.Python
__ http://www.boost.org/more/mailing_lists.htm#jamboost
__ http://www.boost.org/more/mailing_lists.htm#cplussig
__ http://www.boost.org/community/groups.html#jamboost
__ http://www.boost.org/community/groups.html#cplussig
In Case Everything Seemed to Work
---------------------------------

View File

@@ -47,7 +47,7 @@
&nbsp;</dt>
<dt><b><a href=
"http://www.boost.org/more/mailing_lists.htm#cplussig">The Python
"http://www.boost.org/community/groups.html#cplussig">The Python
C++-sig</a></b> mailing list is a forum for discussing Python/C++
interoperability, and Boost.Python in particular. Post your
Boost.Python questions here.<br>

View File

@@ -3,17 +3,17 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter 1. python 1.0</title>
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
<link rel="start" href="index.html" title="Chapter 1. python 1.0">
<link rel="next" href="python/hello.html" title="Building Hello World">
<link rel="next" href="python/hello.html" title=" Building Hello World">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/people/people.htm">People</a></td>
<td align="center"><a href="http://www.boost.org/more/faq.htm">FAQ</a></td>
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
@@ -31,7 +31,7 @@
<div><p class="copyright">Copyright © 2002-2005 Joel
de Guzman, David Abrahams</p></div>
<div><div class="legalnotice">
<a name="id2625929"></a><p>
<a name="id455917"></a><p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">
http://www.boost.org/LICENSE_1_0.txt </a>)
@@ -93,10 +93,10 @@
code takes on the look of a kind of declarative interface definition language
(IDL).
</p>
<a name="quickstart.hello_world"></a><h3>
<a name="id2625972"></a>
<a name="quickstart.hello_world"></a><h2>
<a name="id385257"></a>
Hello World
</h3>
</h2>
<p>
Following C/C++ tradition, let's start with the "hello, world". A
C++ Function:
@@ -136,8 +136,8 @@
<p>
</p>
<p>
<span class="emphasis"><em><span class="bold"><strong>Next stop... Building your Hello World
module from start to finish...</strong></span></em></span>
<span class="emphasis"><em><span class="bold"><b>Next stop... Building your Hello World
module from start to finish...</b></span></em></span>
</p>
<p>
</p>
@@ -145,7 +145,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: March 15, 2008 at 13:46:47 GMT</small></p></td>
<td align="left"><p><small>Last revised: November 07, 2007 at 03:34:24 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@@ -40,7 +40,7 @@
Python/C API at all. So stay tuned... <span class="inlinemediaobject"><img src="../images/smiley.png" alt="smiley"></span>
</p>
<a name="embedding.building_embedded_programs"></a><h2>
<a name="id471329"></a>
<a name="id471171"></a>
Building embedded programs
</h2>
<p>
@@ -82,7 +82,7 @@ exe embedded_program # name of the executable
&lt;find-library&gt;$(PYTHON_EMBEDDED_LIBRARY) ;
</pre>
<a name="embedding.getting_started"></a><h2>
<a name="id471434"></a>
<a name="id471276"></a>
Getting started
</h2>
<p>
@@ -139,7 +139,7 @@ exe embedded_program # name of the executable
automate the process.
</p>
<a name="using_the_interpreter.running_python_code"></a><h2>
<a name="id471597"></a>
<a name="id471439"></a>
Running Python code
</h2>
<p>
@@ -190,7 +190,7 @@ exe embedded_program # name of the executable
a phrase that is well-known in programming circles.
</p>
<a name="using_the_interpreter.manipulating_python_objects"></a><h2>
<a name="id472185"></a>
<a name="id472027"></a>
Manipulating Python objects
</h2>
<p>
@@ -217,7 +217,7 @@ exe embedded_program # name of the executable
<span class="keyword">int</span> <span class="identifier">five_squared</span> <span class="special">=</span> <span class="identifier">extract</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;(</span><span class="identifier">result</span><span class="special">);</span>
</pre>
<a name="using_the_interpreter.exception_handling"></a><h2>
<a name="id472557"></a>
<a name="id472399"></a>
Exception handling
</h2>
<p>

View File

@@ -533,7 +533,7 @@
<div class="titlepage"><div><div><h3 class="title">
<a name="python.class_operators_special_functions"></a>Class Operators/Special Functions</h3></div></div></div>
<a name="class_operators_special_functions.python_operators"></a><h2>
<a name="id461481"></a>
<a name="id461460"></a>
Python Operators
</h2>
<p>
@@ -582,7 +582,7 @@
expressions".
</p>
<a name="class_operators_special_functions.special_methods"></a><h2>
<a name="id462238"></a>
<a name="id462216"></a>
Special Methods
</h2>
<p>

View File

@@ -212,7 +212,7 @@ Namespaces are one honking great idea -- let's do more of those!
<li><span class="bold"><b>BOOM!</b></span></li>
</ol></div>
<a name="call_policies.call_policies"></a><h2>
<a name="id464235"></a>
<a name="id464076"></a>
Call Policies
</h2>
<p>
@@ -415,7 +415,7 @@ Namespaces are one honking great idea -- let's do more of those!
</li>
</ul></div>
<a name="default_arguments.boost_python_function_overloads"></a><h2>
<a name="id466276"></a>
<a name="id466117"></a>
BOOST_PYTHON_FUNCTION_OVERLOADS
</h2>
<p>
@@ -445,7 +445,7 @@ Namespaces are one honking great idea -- let's do more of those!
<span class="identifier">def</span><span class="special">(</span><span class="string">"foo"</span><span class="special">,</span> <span class="identifier">foo</span><span class="special">,</span> <span class="identifier">foo_overloads</span><span class="special">());</span>
</pre>
<a name="default_arguments.boost_python_member_function_overloads"></a><h2>
<a name="id466594"></a>
<a name="id466436"></a>
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
</h2>
<p>
@@ -491,7 +491,7 @@ Namespaces are one honking great idea -- let's do more of those!
reference</a> for details.
</p>
<a name="default_arguments.init_and_optional"></a><h2>
<a name="id466958"></a>
<a name="id466799"></a>
init and optional
</h2>
<p>
@@ -565,7 +565,7 @@ Namespaces are one honking great idea -- let's do more of those!
(0) arguments and a maximum of 3 arguments.
</p>
<a name="auto_overloading.manual_wrapping"></a><h2>
<a name="id467739"></a>
<a name="id467581"></a>
Manual Wrapping
</h2>
<p>

View File

@@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="python.hello"></a> Building Hello World</h2></div></div></div>
<a name="hello.from_start_to_finish"></a><h2>
<a name="id386189"></a>
<a name="id387672"></a>
From Start To Finish
</h2>
<p>
@@ -92,7 +92,7 @@
platforms. The complete list of Bjam executables can be found <a href="http://sourceforge.net/project/showfiles.php?group_id=7586" target="_top">here</a>.
</p>
<a name="hello.let_s_jam_"></a><h2>
<a name="id386347"></a>
<a name="id386265"></a>
Let's Jam!
</h2>
<p>
@@ -108,7 +108,7 @@
you going.
</p>
<a name="hello.running_bjam"></a><h2>
<a name="id386404"></a>
<a name="id386322"></a>
Running bjam
</h2>
<p>
@@ -180,16 +180,6 @@ bjam
Or something similar. If all is well, you should now have built the DLLs and
run the Python program.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td colspan="2" align="left" valign="top"><p>
Starting from Boost 1.35, bjam erases the generated executables (e.g. pyd
file). To keep bjam from doing that, pass --preserve-test-targets to bjam.
</p></td></tr>
</table></div>
<div class="blockquote"><blockquote class="blockquote">
<p>
</p>

View File

@@ -196,7 +196,7 @@
</span><span class="identifier">d</span><span class="special">[</span><span class="char">'whatever'</span><span class="special">]</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span> <span class="comment">// modifies the copy
</span></pre>
<a name="derived_object_types.class__lt_t_gt__as_objects"></a><h2>
<a name="id469744"></a>
<a name="id469586"></a>
class_&lt;T&gt; as objects
</h2>
<p>

View File

@@ -93,7 +93,7 @@ who had to use a different tool.
We will 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 Boost.Python, check out: [@../../../building.html
building Boost.Python, check out: [@/libs/python/doc/building.html
building.html]. After this brief ['bjam] tutorial, we should have built
the DLLs and run a python program using the extension.
@@ -118,7 +118,7 @@ platforms. The complete list of Bjam executables can be found
[h2 Let's Jam!]
__jam__
[@../../../../example/tutorial/Jamroot Here] is our minimalist Jamroot
[@/libs/python/example/tutorial/Jamroot Here] is our minimalist Jamroot
file. Simply copy the file and tweak [^use-project boost] to where your
boost root directory is and your OK.
@@ -463,7 +463,7 @@ functions so that a Python override may be called:
};
Notice too that in addition to inheriting from `Base`, we also multiply-
inherited `wrapper<Base>` (See [@../../../v2/wrapper.html Wrapper]). The
inherited `wrapper<Base>` (See [@/libs/python/doc/v2/wrapper.html Wrapper]). The
`wrapper` template makes the job of wrapping classes that are meant to
overridden in Python, easier.
@@ -495,7 +495,7 @@ Methods correspond roughly to C++'s [*member functions]]
[section Virtual Functions with Default Implementations]
We've seen in the previous section how classes with pure virtual functions are
wrapped using Boost.Python's [@../../../v2/wrapper.html class wrapper]
wrapped using Boost.Python's [@/libs/python/doc/v2/wrapper.html class wrapper]
facilities. If we wish to wrap [*non]-pure-virtual functions instead, the
mechanism is a bit different.
@@ -812,7 +812,7 @@ or more policies can be composed by chaining. Here's the general syntax:
policy3<args...> > >
Here is the list of predefined call policies. A complete reference detailing
these can be found [@../../../v2/reference.html#models_of_call_policies here].
these can be found [@/libs/python/doc/v2/reference.html#models_of_call_policies here].
* [*with_custodian_and_ward]: Ties lifetimes of the arguments
* [*with_custodian_and_ward_postcall]: Ties lifetimes of the arguments and results
@@ -970,7 +970,7 @@ fourth macro argument). The thin wrappers are all enclosed in a class named
.def("wack_em", &george::wack_em, george_overloads());
See the [@../../../v2/overloads.html#BOOST_PYTHON_FUNCTION_OVERLOADS-spec overloads reference]
See the [@/libs/python/doc/v2/overloads.html#BOOST_PYTHON_FUNCTION_OVERLOADS-spec overloads reference]
for details.
[h2 init and optional]
@@ -1267,7 +1267,7 @@ associated with the C++ type passed as its first parameter.
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
[@../../../v2/scope.html here].]
[@/libs/python/doc/v2/scope.html here].]
You can access those values in Python as
@@ -1328,7 +1328,7 @@ in Boost's [^/libs/python/build/bin-stage] subdirectory. On Windows, the
variants are called [^boost_python.lib] (for release builds) and
[^boost_python_debug.lib] (for debugging). If you can't find the libraries,
you probably haven't built Boost.Python yet. See
[@../../../building.html Building and Testing] on how to do this.
[@/libs/python/doc/building.html Building and Testing] on how to do this.
Python's library can be found in the [^/libs] subdirectory of
your Python directory. On Windows it is called pythonXY.lib where X.Y is
@@ -1381,13 +1381,13 @@ interpreter. This may be fixed in a future version of boost.python.]
[section Using the interpreter]
As you probably already know, objects in Python are reference-counted.
Naturally, the [^PyObject]s of the Python/C API are also reference-counted.
Naturally, the [^PyObject]s of the Python\/C API are also reference-counted.
There is a difference however. While the reference-counting is fully
automatic in Python, the Python/C API requires you to do it
automatic in Python, the Python\/C API requires you to do it
[@http://www.python.org/doc/current/api/refcounts.html by hand]. This is
messy and especially hard to get right in the presence of C++ exceptions.
Fortunately Boost.Python provides the [@../../../v2/handle.html handle] and
[@../../../v2/object.html object] class templates to automate the process.
Fortunately Boost.Python provides the [@/libs/python/doc/v2/handle.html handle] and
[@/libs/python/doc/v2/object.html object] class templates to automate the process.
[h2 Running Python code]
@@ -1450,7 +1450,7 @@ which returns the result directly:
[h2 Exception handling]
If an exception occurs in the evaluation of the python expression,
[@../../../v2/errors.html#error_already_set-spec error_already_set] is thrown:
[@/libs/python/doc/v2/errors.html#error_already_set-spec error_already_set] is thrown:
try
{
@@ -1954,13 +1954,13 @@ This method is recommended too if you are developing the C++ library and
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.
[note If you're exporting your classes with [@../../../../pyste/index.html Pyste],
[note If you're exporting your classes with [@/libs/python/doc/pyste/index.html Pyste],
take a look at the [^--multiple] option, that generates the wrappers in
various files as demonstrated here.]
[note 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 [@../../../v2/faq.html#c1204 FAQ].]
a large source file, as explained in the [@/libs/python/doc/v2/faq.html#c1204 FAQ].]
[endsect]
[endsect] [/ General Techniques]

View File

@@ -11,8 +11,8 @@
<a href="doc/html/index.html">link</a> &nbsp;<hr>
<p>© Copyright Beman Dawes, 2001</p>
<p>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../LICENSE_1_0.txt">
accompanying file <a href="../../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>
</html>

View File

@@ -117,9 +117,9 @@ struct rvalue_from_python_data : rvalue_from_python_storage<T>
// Implementataions
//
template <class T>
inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& stage1)
inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& _stage1)
{
this->stage1 = stage1;
this->stage1 = _stage1;
}
template <class T>

View File

@@ -265,7 +265,8 @@ inline object make_getter(D const& d, Policies const& policies)
template <class D>
inline object make_getter(D& x)
{
detail::not_specified policy;
detail::not_specified policy
= detail::not_specified(); // suppress a SunPro warning
return detail::make_getter(x, policy, is_member_pointer<D>(), 0L);
}
@@ -273,7 +274,8 @@ inline object make_getter(D& x)
template <class D>
inline object make_getter(D const& d)
{
detail::not_specified policy;
detail::not_specified policy
= detail::not_specified(); // Suppress a SunPro warning
return detail::make_getter(d, policy, is_member_pointer<D>(), 0L);
}
# endif

View File

@@ -14,6 +14,16 @@
# include <boost/type_traits/cv_traits.hpp>
# include <boost/type_traits/transform_traits.hpp>
# if defined(BOOST_MSVC) && (BOOST_MSVC == 1400) /*
> warning C4180: qualifier applied to function type has no meaning; ignored
Peter Dimov wrote:
This warning is caused by an overload resolution bug in VC8 that cannot be
worked around and will probably not be fixed by MS in the VC8 line. The
problematic overload is only instantiated and never called, and the code
works correctly. */
# pragma warning(disable: 4180)
# endif
# include <boost/bind.hpp>
# include <boost/bind/protect.hpp>

View File

@@ -236,7 +236,7 @@ struct class_metadata
//
// Support for converting smart pointers to python
//
inline static void maybe_register_pointer_to_python(void*,void*,void*) {}
inline static void maybe_register_pointer_to_python(...) {}
#ifndef BOOST_PYTHON_NO_PY_SYGNATURES
inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*)

View File

@@ -127,7 +127,14 @@ void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
)
return &this->m_p;
Value* p = get_pointer(this->m_p);
Value* p
# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
= static_cast<Value*>( get_pointer(this->m_p) )
# else
= get_pointer(this->m_p)
# endif
;
if (p == 0)
return 0;

View File

@@ -10,9 +10,11 @@
# include <boost/python/object_protocol_core.hpp>
# include <boost/python/object_core.hpp>
# include <boost/detail/workaround.hpp>
namespace boost { namespace python { namespace api {
# if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
// attempt to use SFINAE to prevent functions accepting T const& from
// coming up as ambiguous with the one taking a char const* when a
// string literal is passed
@@ -22,45 +24,45 @@ namespace boost { namespace python { namespace api {
# endif
template <class Target, class Key>
object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
return getattr(object(target), object(key));
}
template <class Target, class Key, class Default>
object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(key))
object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
return getattr(object(target), object(key), object(default_));
}
template <class Key, class Value>
void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
setattr(target, object(key), object(value));
}
template <class Key>
void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
delattr(target, object(key));
}
template <class Target, class Key>
object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
return getitem(object(target), object(key));
}
template <class Key, class Value>
void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
setitem(target, object(key), object(value));
}
template <class Key>
void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
{
delitem(target, object(key));
}

View File

@@ -27,6 +27,12 @@ struct slice_policies : const_slice_policies
static void del(object const& target, key_type const& key);
};
template <class T, class U>
inline slice_policies::key_type slice_key(T x, U y)
{
return slice_policies::key_type(handle<>(x), handle<>(y));
}
//
// implementation
//
@@ -35,7 +41,7 @@ object_slice
object_operators<U>::slice(object_cref start, object_cref finish)
{
object_cref2 x = *static_cast<U*>(this);
return object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr())));
return object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr())));
}
template <class U>
@@ -43,7 +49,7 @@ const_object_slice
object_operators<U>::slice(object_cref start, object_cref finish) const
{
object_cref2 x = *static_cast<U const*>(this);
return const_object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr())));
return const_object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr())));
}
template <class U>
@@ -51,7 +57,7 @@ object_slice
object_operators<U>::slice(slice_nil, object_cref finish)
{
object_cref2 x = *static_cast<U*>(this);
return object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr())));
return object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr())));
}
template <class U>
@@ -59,7 +65,7 @@ const_object_slice
object_operators<U>::slice(slice_nil, object_cref finish) const
{
object_cref2 x = *static_cast<U const*>(this);
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr())));
return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr())));
}
template <class U>
@@ -67,7 +73,7 @@ object_slice
object_operators<U>::slice(slice_nil, slice_nil)
{
object_cref2 x = *static_cast<U*>(this);
return object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
return object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0)));
}
template <class U>
@@ -75,7 +81,7 @@ const_object_slice
object_operators<U>::slice(slice_nil, slice_nil) const
{
object_cref2 x = *static_cast<U const*>(this);
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0)));
}
template <class U>
@@ -83,7 +89,7 @@ object_slice
object_operators<U>::slice(object_cref start, slice_nil)
{
object_cref2 x = *static_cast<U*>(this);
return object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0)));
return object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0)));
}
template <class U>
@@ -91,7 +97,7 @@ const_object_slice
object_operators<U>::slice(object_cref start, slice_nil) const
{
object_cref2 x = *static_cast<U const*>(this);
return const_object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0)));
return const_object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0)));
}
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <class U>

View File

@@ -7,9 +7,12 @@
#ifndef PY_CONTAINER_UTILS_JDG20038_HPP
# define PY_CONTAINER_UTILS_JDG20038_HPP
# include <utility>
# include <boost/foreach.hpp>
# include <boost/python/object.hpp>
# include <boost/python/handle.hpp>
# include <boost/python/extract.hpp>
# include <boost/python/stl_iterator.hpp>
namespace boost { namespace python { namespace container_utils {
@@ -19,11 +22,13 @@ namespace boost { namespace python { namespace container_utils {
{
typedef typename Container::value_type data_type;
// l must be a list or some container
for (int i = 0; i < l.attr("__len__")(); i++)
// l must be iterable
BOOST_FOREACH(object elem,
std::make_pair(
boost::python::stl_input_iterator<object>(l),
boost::python::stl_input_iterator<object>()
))
{
object elem(l[i]);
extract<data_type const&> x(elem);
// try if elem is an exact data_type type
if (x.check())

View File

@@ -29,7 +29,7 @@ namespace
detail::new_reference dict_base::call(object const& arg_)
{
return (detail::new_reference)PyObject_CallFunction(
(PyObject*)&PyDict_Type, "(O)",
(PyObject*)&PyDict_Type, const_cast<char*>("(O)"),
arg_.ptr());
}

View File

@@ -41,6 +41,10 @@ BOOST_PYTHON_DECL bool handle_exception_impl(function0<void> f)
{
PyErr_SetString(PyExc_IndexError, x.what());
}
catch(const std::invalid_argument& x)
{
PyErr_SetString(PyExc_ValueError, x.what());
}
catch(const std::exception& x)
{
PyErr_SetString(PyExc_RuntimeError, x.what());

View File

@@ -39,7 +39,7 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
// should be 'char const *' but older python versions don't use 'const' yet.
char *f = python::extract<char *>(filename);
// Let python open the file to avoid potential binary incompatibilities.
PyObject *pyfile = PyFile_FromString(f, "r");
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file");
python::handle<> file(pyfile);
PyObject* result = PyRun_File(PyFile_AsFile(file.get()),

View File

@@ -13,7 +13,7 @@ detail::new_non_null_reference list_base::call(object const& arg_)
return (detail::new_non_null_reference)
(expect_non_null)(
PyObject_CallFunction(
(PyObject*)&PyList_Type, "(O)",
(PyObject*)&PyList_Type, const_cast<char*>("(O)"),
arg_.ptr()));
}

View File

@@ -9,21 +9,21 @@ namespace boost { namespace python { namespace detail {
new_non_null_reference long_base::call(object const& arg_)
{
return (detail::new_non_null_reference)PyObject_CallFunction(
(PyObject*)&PyLong_Type, "(O)",
(PyObject*)&PyLong_Type, const_cast<char*>("(O)"),
arg_.ptr());
}
new_non_null_reference long_base::call(object const& arg_, object const& base)
{
return (detail::new_non_null_reference)PyObject_CallFunction(
(PyObject*)&PyLong_Type, "(OO)",
(PyObject*)&PyLong_Type, const_cast<char*>("(OO)"),
arg_.ptr(), base.ptr());
}
long_base::long_base()
: object(
detail::new_reference(
PyObject_CallFunction((PyObject*)&PyLong_Type, "()"))
PyObject_CallFunction((PyObject*)&PyLong_Type, const_cast<char*>("()")))
)
{}

View File

@@ -74,7 +74,7 @@ extern "C"
{
propertyobject *gs = (propertyobject *)self;
return PyObject_CallFunction(gs->prop_get, "()");
return PyObject_CallFunction(gs->prop_get, const_cast<char*>("()"));
}
static int
@@ -95,9 +95,9 @@ extern "C"
return -1;
}
if (value == NULL)
res = PyObject_CallFunction(func, "()");
res = PyObject_CallFunction(func, const_cast<char*>("()"));
else
res = PyObject_CallFunction(func, "(O)", value);
res = PyObject_CallFunction(func, const_cast<char*>("(O)"), value);
if (res == NULL)
return -1;
Py_DECREF(res);
@@ -108,7 +108,7 @@ extern "C"
static PyTypeObject static_data_object = {
PyObject_HEAD_INIT(0)//&PyType_Type)
0,
"Boost.Python.StaticProperty",
const_cast<char*>("Boost.Python.StaticProperty"),
PyType_Type.tp_basicsize,
0,
0, /* tp_dealloc */
@@ -212,7 +212,7 @@ extern "C"
static PyTypeObject class_metatype_object = {
PyObject_HEAD_INIT(0)//&PyType_Type)
0,
"Boost.Python.class",
const_cast<char*>("Boost.Python.class"),
PyType_Type.tp_basicsize,
0,
0, /* tp_dealloc */
@@ -316,7 +316,7 @@ namespace objects
{
// Attempt to find the __instance_size__ attribute. If not present, no problem.
PyObject* d = type_->tp_dict;
PyObject* instance_size_obj = PyObject_GetAttrString(d, "__instance_size__");
PyObject* instance_size_obj = PyObject_GetAttrString(d, const_cast<char*>("__instance_size__"));
long instance_size = instance_size_obj ? PyInt_AsLong(instance_size_obj) : 0;
@@ -357,20 +357,20 @@ namespace objects
static PyGetSetDef instance_getsets[] = {
{"__dict__", instance_get_dict, instance_set_dict, NULL, 0},
{const_cast<char*>("__dict__"), instance_get_dict, instance_set_dict, NULL, 0},
{0, 0, 0, 0, 0}
};
static PyMemberDef instance_members[] = {
{"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0, 0},
{const_cast<char*>("__weakref__"), T_OBJECT, offsetof(instance<>, weakrefs), 0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject class_type_object = {
PyObject_HEAD_INIT(0) //&class_metatype_object)
0,
"Boost.Python.instance",
const_cast<char*>("Boost.Python.instance"),
offsetof(instance<>,storage), /* tp_basicsize */
1, /* tp_itemsize */
instance_dealloc, /* tp_dealloc */
@@ -572,7 +572,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "Osss", fget.ptr(), 0, 0, docstr));
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), 0, 0, docstr));
this->setattr(name, property);
}
@@ -582,7 +582,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "OOss", fget.ptr(), fset.ptr(), 0, docstr));
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), 0, docstr));
this->setattr(name, property);
}
@@ -591,7 +591,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction(static_data(), "O", fget.ptr()));
PyObject_CallFunction(static_data(), const_cast<char*>("O"), fget.ptr()));
this->setattr(name, property);
}
@@ -600,7 +600,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction(static_data(), "OO", fget.ptr(), fset.ptr()));
PyObject_CallFunction(static_data(), const_cast<char*>("OO"), fget.ptr(), fset.ptr()));
this->setattr(name, property);
}
@@ -615,13 +615,13 @@ namespace objects
{
extern "C" PyObject* no_init(PyObject*, PyObject*)
{
::PyErr_SetString(::PyExc_RuntimeError, "This class cannot be instantiated from Python");
::PyErr_SetString(::PyExc_RuntimeError, const_cast<char*>("This class cannot be instantiated from Python"));
return NULL;
}
static ::PyMethodDef no_init_def = {
"__init__", no_init, METH_VARARGS,
"Raises an exception\n"
"This class cannot be instantiated from Python\n"
const_cast<char*>("__init__"), no_init, METH_VARARGS,
const_cast<char*>("Raises an exception\n"
"This class cannot be instantiated from Python\n")
};
}
@@ -650,7 +650,7 @@ namespace objects
::PyErr_Format(
PyExc_TypeError
, "staticmethod expects callable object; got an object of type %s, which is not callable"
, const_cast<char*>("staticmethod expects callable object; got an object of type %s, which is not callable")
, callable->ob_type->tp_name
);

View File

@@ -23,7 +23,7 @@ struct enum_object
};
static PyMemberDef enum_members[] = {
{"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0},
{const_cast<char*>("name"), T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0},
{0, 0, 0, 0, 0}
};
@@ -32,7 +32,7 @@ extern "C"
{
static PyObject* enum_repr(PyObject* self_)
{
const char *mod = PyString_AsString(PyObject_GetAttrString( self_, "__module__"));
const char *mod = PyString_AsString(PyObject_GetAttrString( self_, const_cast<char*>("__module__")));
enum_object* self = downcast<enum_object>(self_);
if (!self->name)
{
@@ -65,7 +65,7 @@ extern "C"
static PyTypeObject enum_type_object = {
PyObject_HEAD_INIT(0) // &PyType_Type
0,
"Boost.Python.enum",
const_cast<char*>("Boost.Python.enum"),
sizeof(enum_object), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */

View File

@@ -297,7 +297,7 @@ object function::signatures(bool show_return_type) const
void function::argument_error(PyObject* args, PyObject* /*keywords*/) const
{
static handle<> exception(
PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0));
PyErr_NewException(const_cast<char*>("Boost.Python.ArgumentError"), PyExc_TypeError, 0));
object message = "Python argument types in\n %s.%s("
% make_tuple(this->m_namespace, this->m_name);
@@ -440,7 +440,7 @@ void function::add_to_namespace(
else if (PyType_Check(ns))
dict = ((PyTypeObject*)ns)->tp_dict;
else
dict = PyObject_GetAttrString(ns, "__dict__");
dict = PyObject_GetAttrString(ns, const_cast<char*>("__dict__"));
if (dict == 0)
throw_error_already_set();
@@ -487,7 +487,7 @@ void function::add_to_namespace(
new_func->m_name = name;
handle<> name_space_name(
allow_null(::PyObject_GetAttrString(name_space.ptr(), "__name__")));
allow_null(::PyObject_GetAttrString(name_space.ptr(), const_cast<char*>("__name__"))));
if (name_space_name)
new_func->m_namespace = object(name_space_name);
@@ -656,18 +656,18 @@ extern "C"
}
static PyGetSetDef function_getsetlist[] = {
{"__name__", (getter)function_get_name, 0, 0, 0 },
{"func_name", (getter)function_get_name, 0, 0, 0 },
{"__class__", (getter)function_get_class, 0, 0, 0 }, // see note above
{"__doc__", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
{"func_doc", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
{const_cast<char*>("__name__"), (getter)function_get_name, 0, 0, 0 },
{const_cast<char*>("func_name"), (getter)function_get_name, 0, 0, 0 },
{const_cast<char*>("__class__"), (getter)function_get_class, 0, 0, 0 }, // see note above
{const_cast<char*>("__doc__"), (getter)function_get_doc, (setter)function_set_doc, 0, 0},
{const_cast<char*>("func_doc"), (getter)function_get_doc, (setter)function_set_doc, 0, 0},
{NULL, 0, 0, 0, 0} /* Sentinel */
};
PyTypeObject function_type = {
PyObject_HEAD_INIT(0)
0,
"Boost.Python.function",
const_cast<char*>("Boost.Python.function"),
sizeof(function),
0,
(destructor)function_dealloc, /* tp_dealloc */
@@ -753,7 +753,8 @@ namespace detail
}
void BOOST_PYTHON_DECL pure_virtual_called()
{
PyErr_SetString(PyExc_RuntimeError, "Pure virtual function called");
PyErr_SetString(
PyExc_RuntimeError, const_cast<char*>("Pure virtual function called"));
throw_error_already_set();
}
}

View File

@@ -38,7 +38,7 @@ extern "C"
PyTypeObject life_support_type = {
PyObject_HEAD_INIT(0)//(&PyType_Type)
0,
"Boost.Python.life_support",
const_cast<char*>("Boost.Python.life_support"),
sizeof(life_support),
0,
life_support_dealloc, /* tp_dealloc */

View File

@@ -2,6 +2,10 @@
// 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)
//
// Credits:
// Andreas Kl\:ockner for fixing increment() to handle
// error conditions.
#include <boost/python/object.hpp>
#include <boost/python/handle.hpp>
@@ -27,6 +31,8 @@ void stl_input_iterator_impl::increment()
{
this->ob_ = boost::python::handle<>(
boost::python::allow_null(PyIter_Next(this->it_.ptr())));
if (PyErr_Occurred())
throw boost::python::error_already_set();
}
bool stl_input_iterator_impl::equal(stl_input_iterator_impl const &that) const

View File

@@ -10,7 +10,7 @@ namespace boost { namespace python { namespace detail {
detail::new_reference str_base::call(object const& arg_)
{
return (detail::new_reference)PyObject_CallFunction(
(PyObject*)&PyString_Type, "(O)",
(PyObject*)&PyString_Type, const_cast<char*>("(O)"),
arg_.ptr());
}
@@ -68,8 +68,9 @@ str str_base:: name ( BOOST_PP_ENUM_PARAMS(arity, object_cref x) ) const
return str(new_reference( \
expect_non_null( \
PyObject_CallMethod( \
this->ptr(), #name, \
"(" BOOST_PP_REPEAT(arity, BOOST_PYTHON_FORMAT_OBJECT, _) ")" \
this->ptr(), const_cast<char*>( #name ), \
const_cast<char*>( \
"(" BOOST_PP_REPEAT(arity, BOOST_PYTHON_FORMAT_OBJECT, _) ")") \
BOOST_PP_REPEAT_1(arity, BOOST_PYTHON_OBJECT_PTR, _))))); \
}

View File

@@ -9,7 +9,7 @@ namespace boost { namespace python { namespace detail {
detail::new_reference tuple_base::call(object const& arg_)
{
return (detail::new_reference)PyObject_CallFunction(
(PyObject*)&PyTuple_Type, "(O)",
(PyObject*)&PyTuple_Type, const_cast<char*>("(O)"),
arg_.ptr());
}

View File

@@ -42,7 +42,7 @@ test-suite python
:
[
run exec.cpp ../build//boost_python/<link>static $(PY)
run exec.cpp /boost/python//boost_python/<link>static $(PY)
: # program args
: exec.py # input files
: # requirements
@@ -171,7 +171,8 @@ bpl-test crossmod_opaque
/boost/python//boost_python ]
[ bpl-test
map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ]
[ py-run import_.cpp : import_.py ]
[ run import_.cpp /boost/python//boost_python $(PY) : : import_.py ]
# if $(TEST_BIENSTMAN_NON_BUGS)
# {

View File

@@ -25,8 +25,8 @@ class B {
B() {
a = A::A_ptr(new A());
}
void set(A::A_ptr a) {
this->a = a;
void set(A::A_ptr _a) {
this->a = _a;
}
A::A_ptr get() {
return a;

View File

@@ -14,7 +14,7 @@
using namespace boost::python;
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
# define make_tuple boost::python::make_tuple
#endif

View File

@@ -27,7 +27,7 @@ struct X
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; }
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
static int count() { return counter; }
private:

View File

@@ -34,7 +34,7 @@ struct X
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; }
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
static int count() { return counter; }
private:

View File

@@ -19,10 +19,10 @@ struct complicated
int n;
};
inline complicated::complicated(simple const&s, int n)
: s(s.s), n(n)
inline complicated::complicated(simple const&s, int _n)
: s(s.s), n(_n)
{
std::cout << "constructing complicated: " << this->s << ", " << n << std::endl;
std::cout << "constructing complicated: " << this->s << ", " << _n << std::endl;
}
inline complicated::~complicated()

View File

@@ -59,7 +59,7 @@ void eval_test()
void exec_test()
{
// Register the module with the interpreter
if (PyImport_AppendInittab("embedded_hello", initembedded_hello) == -1)
if (PyImport_AppendInittab(const_cast<char*>("embedded_hello"), initembedded_hello) == -1)
throw std::runtime_error("Failed to add embedded_hello to the interpreter's "
"builtin modules");
// Retrieve the main module

View File

@@ -34,7 +34,7 @@ struct NoddyObject : PyObject
PyTypeObject NoddyType = {
PyObject_HEAD_INIT(NULL)
0,
"Noddy",
const_cast<char*>("Noddy"),
sizeof(NoddyObject),
0,
dealloc, /* tp_dealloc */
@@ -106,7 +106,7 @@ struct extract_simple_object
PyTypeObject SimpleType = {
PyObject_HEAD_INIT(NULL)
0,
"Simple",
const_cast<char*>("Simple"),
sizeof(SimpleObject),
0,
dealloc, /* tp_dealloc */
@@ -159,7 +159,7 @@ PyTypeObject SimpleType = {
PyObject* new_simple()
{
SimpleObject* simple = PyObject_New(SimpleObject, &SimpleType);
simple->x.s = "hello, world";
simple->x.s = const_cast<char*>("hello, world");
return (PyObject*)simple;
}

View File

@@ -10,19 +10,16 @@
#include <boost/python/str.hpp>
using namespace boost::python;
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
# define make_tuple boost::python::make_tuple
#endif
namespace py = boost::python;
// See if we can invoke array() from C++
numeric::array new_array()
{
return numeric::array(
make_tuple(
make_tuple(1,2,3)
, make_tuple(4,5,6)
, make_tuple(7,8,9)
py::make_tuple(
py::make_tuple(1,2,3)
, py::make_tuple(4,5,6)
, py::make_tuple(7,8,9)
)
);
}
@@ -51,7 +48,7 @@ namespace
str format("exception type: %sn");
format += "exception value: %sn";
format += "traceback:n%s" ;
object ret = format % boost::python::make_tuple(ty, v, tr);
object ret = format % py::make_tuple(ty, v, tr);
return ret;
}
}
@@ -71,7 +68,7 @@ namespace
// inherits that behavior from object.
void exercise(numeric::array& y, object check)
{
y[make_tuple(2,1)] = 3;
y[py::make_tuple(2,1)] = 3;
CHECK(y);
CHECK(y.astype('D'));
CHECK(y.copy());
@@ -116,12 +113,12 @@ void exercise_numarray(numeric::array& y, object check)
CHECK(y);
CHECK(y.type());
CHECK(y.factory(make_tuple(1.2, 3.4)));
CHECK(y.factory(make_tuple(1.2, 3.4), "f8"));
CHECK(y.factory(make_tuple(1.2, 3.4), "f8", true));
CHECK(y.factory(make_tuple(1.2, 3.4), "f8", true, false));
CHECK(y.factory(make_tuple(1.2, 3.4), "f8", true, false, object()));
CHECK (y.factory(make_tuple(1.2, 3.4), "f8", true, false, object(), make_tuple(1,2,1)));
CHECK(y.factory(py::make_tuple(1.2, 3.4)));
CHECK(y.factory(py::make_tuple(1.2, 3.4), "f8"));
CHECK(y.factory(py::make_tuple(1.2, 3.4), "f8", true));
CHECK(y.factory(py::make_tuple(1.2, 3.4), "f8", true, false));
CHECK(y.factory(py::make_tuple(1.2, 3.4), "f8", true, false, object()));
CHECK (y.factory(py::make_tuple(1.2, 3.4), "f8", true, false, object(), py::make_tuple(1,2,1)));
}

View File

@@ -27,8 +27,8 @@ namespace boost_python_test {
private:
std::string country;
public:
world(const std::string& country) {
this->country = country;
world(const std::string& _country) {
this->country = _country;
}
std::string greet() const { return "Hello from " + country + "!"; }
std::string get_country() const { return country; }

View File

@@ -34,8 +34,8 @@ namespace boost_python_test {
class world
{
public:
world(const std::string& country) : secret_number(0) {
this->country = country;
world(const std::string& _country) : secret_number(0) {
this->country = _country;
}
std::string greet() const { return "Hello from " + country + "!"; }
std::string get_country() const { return country; }

View File

@@ -25,7 +25,7 @@
#include <boost/python/extract.hpp>
#include <boost/python/back_reference.hpp>
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
# define make_tuple boost::python::make_tuple
#endif
@@ -35,8 +35,8 @@ namespace boost_python_test {
class world
{
public:
world(const std::string& country) : secret_number(0) {
this->country = country;
world(const std::string& _country) : secret_number(0) {
this->country = _country;
}
std::string greet() const { return "Hello from " + country + "!"; }
std::string get_country() const { return country; }

View File

@@ -23,8 +23,8 @@ namespace boost_python_test {
private:
std::string country;
public:
world(const std::string& country) {
this->country = country;
world(const std::string& _country) {
this->country = _country;
}
std::string greet() const { return "Hello from " + country + "!"; }
std::string get_country() const { return country; }

View File

@@ -10,7 +10,7 @@
using namespace boost::python;
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
# define make_tuple boost::python::make_tuple
#endif
@@ -100,7 +100,11 @@ bool accept_slice( slice) { return true; }
|| BOOST_WORKAROUND( BOOST_INTEL_WIN, == 710)
int check_slice_get_indicies(slice index);
#endif
int check_slice_get_indicies(const slice index)
int check_slice_get_indicies(
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
const
#endif
slice index)
{
// A vector of integers from [-5, 5].
std::vector<int> coll(11);

View File

@@ -20,7 +20,7 @@ struct X
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; }
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
static int count() { return counter; }
private:

View File

@@ -12,6 +12,16 @@
3
4
5
>>> def generator():
... yield 1
... yield 2
... raise RuntimeError, "oops"
>>> try:
... x.assign(iter(generator()))
... print "NOT OK"
... except RuntimeError:
... print "OK"
OK
'''
def run(args = None):
import sys

View File

@@ -13,7 +13,7 @@ struct test_class
test_class(test_class const& rhs) : x(rhs.x), magic(7654321 + n) { ++counter; }
virtual ~test_class() { BOOST_TEST(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; }
void set(int x) { BOOST_TEST(magic == 7654321 + n); this->x = x; }
void set(int _x) { BOOST_TEST(magic == 7654321 + n); this->x = _x; }
int value() const { BOOST_TEST(magic == 7654321 + n); return x; }
operator int() const { return x; }
static int count() { return counter; }

View File

@@ -65,7 +65,7 @@ struct B
B() : x(0) {}
B(A* x_) : x(x_) {}
inner const* adopt(A* x) { this->x = x; return &x->get_inner(); }
inner const* adopt(A* _x) { this->x = _x; return &_x->get_inner(); }
std::string a_content()
{

View File

@@ -321,6 +321,19 @@ e
>>> print_xvec(v)
[ a b c d e f g h i j ]
#####################################################################
# extend using a generator expression
#####################################################################
>>> v[:] = ['a','b','c','d','e'] # reset again
>>> def generator():
... addlist = ['f','g','h','i','j']
... for i in addlist:
... if i != 'g':
... yield i
>>> v.extend(generator())
>>> print_xvec(v)
[ a b c d e f h i j ]
#####################################################################
# vector of strings
#####################################################################

View File

@@ -22,7 +22,7 @@ struct X
X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; }
virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; }
void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; }
void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; }
int value() const { BOOST_ASSERT(magic == 7654321); return x; }
static int count() { return counter; }
private: