summaryrefslogtreecommitdiff
path: root/src/py_amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/py_amount.cc')
-rw-r--r--src/py_amount.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc
index 2d99ddec..f1096363 100644
--- a/src/py_amount.cc
+++ b/src/py_amount.cc
@@ -33,7 +33,9 @@
#include "pyinterp.h"
#include "pyutils.h"
+#if PY_MAJOR_VERSION < 3
#include "pyfstream.h"
+#endif
#include "commodity.h"
#include "annotate.h"
#include "pool.h"
@@ -62,6 +64,7 @@ namespace {
return amount.value(datetime_t(moment), in_terms_of);
}
+#if PY_MAJOR_VERSION < 3
void py_parse_2(amount_t& amount, object in, unsigned char flags) {
if (PyFile_Check(in.ptr())) {
pyifstream instr(reinterpret_cast<PyFileObject *>(in.ptr()));
@@ -74,6 +77,7 @@ namespace {
void py_parse_1(amount_t& amount, object in) {
py_parse_2(amount, in, 0);
}
+#endif
void py_parse_str_1(amount_t& amount, const string& str) {
amount.parse(str);
@@ -286,8 +290,10 @@ internal precision."))
.def("strip_annotations", py_strip_annotations_0)
.def("strip_annotations", py_strip_annotations_1)
+#if PY_MAJOR_VERSION < 3
.def("parse", py_parse_1)
.def("parse", py_parse_2)
+#endif
.def("parse", py_parse_str_1)
.def("parse", py_parse_str_2)