File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2146,8 +2146,10 @@ duckdb::pyarrow::RecordBatchReader DuckDBPyConnection::FetchRecordBatchReader(co
21462146case_insensitive_map_t <Value> TransformPyConfigDict (const py::dict &py_config_dict) {
21472147 case_insensitive_map_t <Value> config_dict;
21482148 for (auto kv : py_config_dict) {
2149- auto key = py::cast<std::string>(kv.first );
2150- auto val = py::cast<std::string>(kv.second );
2149+ // Config values may be int/bool/str; str-ify them (matches pybind11's py::str(value)) rather than
2150+ // requiring an actual Python str (py::cast<std::string> would throw on a non-str like 0 or False).
2151+ auto key = py::cast<std::string>(py::str (kv.first ));
2152+ auto val = py::cast<std::string>(py::str (kv.second ));
21512153 config_dict[key] = Value (val);
21522154 }
21532155 return config_dict;
Original file line number Diff line number Diff line change @@ -198,7 +198,8 @@ timestamp_t PythonFilesystem::GetLastModifiedTime(FileHandle &handle) {
198198
199199 auto last_mod = filesystem.attr (" modified" )(handle.path );
200200
201- return Timestamp::FromEpochSeconds (py::cast<int64_t >(last_mod.attr (" timestamp" )()));
201+ // datetime.timestamp() returns a float; truncate to int64 seconds (py::cast<int64_t> would reject a float)
202+ return Timestamp::FromEpochSeconds ((int64_t )py::cast<double >(last_mod.attr (" timestamp" )()));
202203}
203204void PythonFilesystem::FileSync (FileHandle &handle) {
204205 D_ASSERT (!py::gil_check ());
You can’t perform that action at this time.
0 commit comments