summaryrefslogtreecommitdiff
path: root/src/py_amount.cc
diff options
context:
space:
mode:
authorMax Nikulin <manikulin@gmail.com>2024-08-07 17:37:17 +0700
committerJohn Wiegley <johnw@newartisans.com>2024-08-07 09:45:59 -1000
commit093190e72eb7b7637085dc19b938014bfd0485cb (patch)
treea3f49393f9d99694ddcd0d08dcd38db4c479c16e /src/py_amount.cc
parentc7440397a5bd5b1b7d8d3976762663fdb65e1ada (diff)
downloadfork-ledger-093190e72eb7b7637085dc19b938014bfd0485cb.tar.gz
fork-ledger-093190e72eb7b7637085dc19b938014bfd0485cb.tar.bz2
fork-ledger-093190e72eb7b7637085dc19b938014bfd0485cb.zip
Add Python bindings for roundto
Expose `roundto` and `in_place_roundto` to `Amount`, `Balance`, and `Value` Python classes. They may be handy for debugging. The methods were added after introducing of bindings and likely it is a reason why they were missed. Closes: #2365
Diffstat (limited to 'src/py_amount.cc')
-rw-r--r--src/py_amount.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc
index ae554f58..1efa829a 100644
--- a/src/py_amount.cc
+++ b/src/py_amount.cc
@@ -207,6 +207,10 @@ internal precision."))
.def("in_place_round", &amount_t::in_place_round,
return_internal_reference<>())
+ .def("__round__", &amount_t::roundto)
+ .def("in_place_roundto", &amount_t::in_place_roundto,
+ return_internal_reference<>())
+
.def("truncated", &amount_t::truncated)
.def("in_place_truncate", &amount_t::in_place_truncate,
return_internal_reference<>())