Skip to content

Commit 658a0a7

Browse files
committed
fix mac build
1 parent 675b17c commit 658a0a7

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

cpp_core/src/param_extractor.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
#include <Python.h>
33
#include "pyref.hpp"
44
#include "compat.hpp"
5+
#include "platform.hpp"
56
#include <cstring>
7+
#include <cstdlib>
68
#include <vector>
7-
#include <charconv>
89

910
// ══════════════════════════════════════════════════════════════════════════════
1011
// Inline param extraction — no global registry, no mutex.
@@ -41,17 +42,17 @@ static PyObject* coerce_value(PyObject* val, int type_tag) {
4142

4243
switch (type_tag) {
4344
case 1: { // int
44-
long long v;
45-
auto ec = std::from_chars(s, s + slen, v);
46-
if (LIKELY(ec.ec == std::errc{} && ec.ptr == s + slen))
45+
char* endptr;
46+
long long v = strtoll(s, &endptr, 10);
47+
if (LIKELY(endptr == s + slen))
4748
return PyLong_FromLongLong(v);
4849
Py_INCREF(val);
4950
return val;
5051
}
51-
case 2: { // float
52-
double v;
53-
auto ec = std::from_chars(s, s + slen, v);
54-
if (LIKELY(ec.ec == std::errc{} && ec.ptr == s + slen))
52+
case 2: { // float — use strtod for macOS compatibility (Apple Clang 15 lacks from_chars<double>)
53+
char* endptr;
54+
double v = strtod(s, &endptr);
55+
if (LIKELY(endptr == s + slen))
5556
return PyFloat_FromDouble(v);
5657
Py_INCREF(val);
5758
return val;

0 commit comments

Comments
 (0)