Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53721 - sandbox-branches/bhy/py3k/libs/python/src
From: divinekid_at_[hidden]
Date: 2009-06-07 10:32:57


Author: bhy
Date: 2009-06-07 10:32:57 EDT (Sun, 07 Jun 2009)
New Revision: 53721
URL: http://svn.boost.org/trac/boost/changeset/53721

Log:
change TrueDivide to FloorDivide to make the semantic conform with C/C++ '/' operator
Text files modified:
   sandbox-branches/bhy/py3k/libs/python/src/object_operators.cpp | 7 +++++--
   1 files changed, 5 insertions(+), 2 deletions(-)

Modified: sandbox-branches/bhy/py3k/libs/python/src/object_operators.cpp
==============================================================================
--- sandbox-branches/bhy/py3k/libs/python/src/object_operators.cpp (original)
+++ sandbox-branches/bhy/py3k/libs/python/src/object_operators.cpp 2009-06-07 10:32:57 EDT (Sun, 07 Jun 2009)
@@ -39,7 +39,9 @@
 BOOST_PYTHON_BINARY_OPERATOR(-, Subtract)
 BOOST_PYTHON_BINARY_OPERATOR(*, Multiply)
 #if PY_VERSION_HEX >= 0x03000000
-BOOST_PYTHON_BINARY_OPERATOR(/, TrueDivide)
+// We choose FloorDivide instead of TrueDivide to keep the semantic
+// conform with C/C++'s '/' operator
+BOOST_PYTHON_BINARY_OPERATOR(/, FloorDivide)
 #else
 BOOST_PYTHON_BINARY_OPERATOR(/, Divide)
 #endif
@@ -63,7 +65,8 @@
 BOOST_PYTHON_INPLACE_OPERATOR(-, Subtract)
 BOOST_PYTHON_INPLACE_OPERATOR(*, Multiply)
 #if PY_VERSION_HEX >= 0x03000000
-BOOST_PYTHON_INPLACE_OPERATOR(/, TrueDivide)
+// Same reason as above for choosing FloorDivide instead of TrueDivide
+BOOST_PYTHON_INPLACE_OPERATOR(/, FloorDivide)
 #else
 BOOST_PYTHON_INPLACE_OPERATOR(/, Divide)
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk