| 90 | } |
| 91 | |
| 92 | PyObject* DecimalFromString(PyObject* decimal_constructor, |
| 93 | const std::string& decimal_string) { |
| 94 | ARROW_DCHECK_NE(decimal_constructor, nullptr); |
| 95 | |
| 96 | auto string_size = decimal_string.size(); |
| 97 | ARROW_DCHECK_GT(string_size, 0); |
| 98 | |
| 99 | auto string_bytes = decimal_string.c_str(); |
| 100 | ARROW_DCHECK_NE(string_bytes, nullptr); |
| 101 | |
| 102 | return PyObject_CallFunction(decimal_constructor, const_cast<char*>("s#"), string_bytes, |
| 103 | static_cast<Py_ssize_t>(string_size)); |
| 104 | } |
| 105 | |
| 106 | namespace { |
| 107 |