summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/python
diff options
context:
space:
mode:
authorimunkin <[email protected]>2025-07-25 14:36:33 +0300
committerimunkin <[email protected]>2025-07-25 15:25:21 +0300
commit835b6519eb8e218bb0c84d8d7827bf9fbe7893c8 (patch)
tree24c4778644641d8c2be1aa8f1333269d683db984 /yql/essentials/udfs/common/python
parentc439c8555866bacd34054603e87433b69becd631 (diff)
YQL-20241: Use ASCIIZ strings for UdfTerminate (essential udfs)
commit_hash:1a11133ec66e71b6c798178453a5ab43cdc6761c
Diffstat (limited to 'yql/essentials/udfs/common/python')
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_callable.cpp4
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_cast.cpp8
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp102
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_lazy_mkql_list.cpp30
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_stream.cpp20
-rw-r--r--yql/essentials/udfs/common/python/python_udf/python_function_factory.h8
6 files changed, 86 insertions, 86 deletions
diff --git a/yql/essentials/udfs/common/python/bindings/py_callable.cpp b/yql/essentials/udfs/common/python/bindings/py_callable.cpp
index c60403bdca2..e9b25606ed0 100644
--- a/yql/essentials/udfs/common/python/bindings/py_callable.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_callable.cpp
@@ -188,7 +188,7 @@ private:
TPyObjectPtr resultObj =
PyObject_CallObject(Function_.Get(), pyArgs.Get());
if (!resultObj) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).c_str());
}
auto returnType = Inspector_.GetReturnType();
@@ -198,7 +198,7 @@ private:
return FromPyObject(CastCtx_, returnType, resultObj.Get());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to cast arguments or result\n" << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to cast arguments or result\n" << e.what()).c_str());
}
}
diff --git a/yql/essentials/udfs/common/python/bindings/py_cast.cpp b/yql/essentials/udfs/common/python/bindings/py_cast.cpp
index 1a90773cd45..51b68f897dc 100644
--- a/yql/essentials/udfs/common/python/bindings/py_cast.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_cast.cpp
@@ -474,7 +474,7 @@ TPyObjectPtr ToPyData(const TPyCastContext::TPtr& ctx,
if (!pyObj) {
UdfTerminate((TStringBuilder() << ctx->PyCtx->Pos <<
"Failed to convert to unicode with _yql_bytes_decode_mode='strict':\n" <<
- GetLastErrorAsString()).data()
+ GetLastErrorAsString()).c_str()
);
}
return pyObj;
@@ -487,7 +487,7 @@ TPyObjectPtr ToPyData(const TPyCastContext::TPtr& ctx,
PyTuple_SET_ITEM(pyArgs.Get(), 0, pyObj.Release());
pyObj = PyObject_CallObject(ctx->YsonConverterIn.Get(), pyArgs.Get());
if (!pyObj) {
- UdfTerminate((TStringBuilder() << ctx->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << ctx->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).c_str());
}
}
@@ -554,7 +554,7 @@ NUdf::TUnboxedValue FromPyData(
PyTuple_SET_ITEM(pyArgs.Get(), 0, input.Release());
input.ResetSteal(PyObject_CallObject(ctx->YsonConverterOut.Get(), pyArgs.Get()));
if (!input) {
- UdfTerminate((TStringBuilder() << ctx->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << ctx->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).c_str());
}
return ctx->ValueBuilder->NewString(PyCast<NUdf::TStringRef>(input.Get()));
}
@@ -927,7 +927,7 @@ TPyObjectPtr ToPyArgs(
sb << "Failed to export ";
NUdf::TTypePrinter(*ctx->PyCtx->TypeInfoHelper, argType).Out(sb.Out);
sb << " given as args[" << i << "]: ";
- UdfTerminate((sb << ctx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((sb << ctx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
PyTuple_SET_ITEM(tuple.Get(), i, arg.Release());
}
diff --git a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp
index b9d90e49f9f..1408f185a75 100644
--- a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_dict.cpp
@@ -41,12 +41,12 @@ protected:
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool Next(NUdf::TUnboxedValue& value) override try {
@@ -58,12 +58,12 @@ protected:
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& payload) override {
@@ -97,12 +97,12 @@ protected:
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& pay) override try {
@@ -115,12 +115,12 @@ protected:
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
private:
@@ -143,12 +143,12 @@ protected:
const TPyGilLocker lock;
const auto has = PyObject_IsTrue(PyObject_.Get());
if (has < 0) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return bool(has);
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
const TPyCastContext::TPtr CastCtx_;
@@ -173,11 +173,11 @@ private:
const TPyGilLocker lock;
const auto len = PyMapping_Size(PyObject_.Get());
if (len < 0) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return ui64(len);
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetKeysIterator() const override try {
@@ -187,9 +187,9 @@ private:
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, ItemType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetPayloadsIterator() const override try {
@@ -199,9 +199,9 @@ private:
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, PayType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetDictIterator() const override try {
@@ -211,9 +211,9 @@ private:
return NUdf::TUnboxedValuePod(new TPairIterator(CastCtx_, ItemType_, PayType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override try {
@@ -229,9 +229,9 @@ private:
return NUdf::TUnboxedValue();
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool Contains(const NUdf::TUnboxedValuePod& key) const override try {
@@ -246,9 +246,9 @@ private:
return bool(has);
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
private:
@@ -272,11 +272,11 @@ private:
const TPyGilLocker lock;
const auto len = PyDict_Size(PyObject_.Get());
if (len < 0) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return ui64(len);
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetKeysIterator() const override try {
@@ -286,9 +286,9 @@ private:
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, ItemType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetPayloadsIterator() const override try {
@@ -298,9 +298,9 @@ private:
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, PayType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetDictIterator() const override try {
@@ -310,9 +310,9 @@ private:
return NUdf::TUnboxedValuePod(new TPairIterator(CastCtx_, ItemType_, PayType_, std::move(pyIter)));
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override try {
@@ -324,9 +324,9 @@ private:
return NUdf::TUnboxedValue();
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool Contains(const NUdf::TUnboxedValuePod& key) const override try {
@@ -337,9 +337,9 @@ private:
return bool(has);
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
private:
@@ -363,11 +363,11 @@ private:
const TPyGilLocker lock;
const auto len = PySet_Size(PyObject_.Get());
if (len < 0) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return ui64(len);
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override {
@@ -382,9 +382,9 @@ private:
return bool(has);
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetKeysIterator() const override try {
@@ -392,9 +392,9 @@ private:
if (TPyObjectPtr pyIter = PyObject_GetIter(PyObject_.Get())) {
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, ItemType_, std::move(pyIter)));
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetPayloadsIterator() const override {
@@ -439,11 +439,11 @@ private:
const TPyGilLocker lock;
const auto len = PySequence_Size(PyObject_.Get());
if (len < 0) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return ui64(len);
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const override {
@@ -458,9 +458,9 @@ private:
return bool(has);
}
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetKeysIterator() const override try {
@@ -468,9 +468,9 @@ private:
if (TPyObjectPtr pyIter = PyObject_GetIter(PyObject_.Get())) {
return NUdf::TUnboxedValuePod(new TIterator(CastCtx_, ItemType_, std::move(pyIter)));
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetPayloadsIterator() const override {
@@ -561,7 +561,7 @@ private:
value = FromPyObject(CastCtx_, ItemType_, PySequence_Fast_GET_ITEM(PySeq_.Get(), Index_++));
return true;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool NextPair(NUdf::TUnboxedValue& key, NUdf::TUnboxedValue& pay) override try {
@@ -573,7 +573,7 @@ private:
pay = FromPyObject(CastCtx_, ItemType_, PySequence_Fast_GET_ITEM(PySeq_.Get(), Index_++));
return true;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
private:
@@ -613,10 +613,10 @@ private:
if (const auto item = PySequence_Fast_GET_ITEM(PySeq_.Get(), index >= 0 ? index : Size_ + index)) {
return FromPyObject(CastCtx_, ItemType_, item).Release().MakeOptional();
} else if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
return NUdf::TUnboxedValue();
}
@@ -699,7 +699,7 @@ NUdf::TUnboxedValue FromPySequence(
Y_ABORT("Invalid key type.");
}
}
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
} // namespace NPython
diff --git a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_list.cpp b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_list.cpp
index fe3b8892e66..ef135f3ba20 100644
--- a/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_list.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_lazy_mkql_list.cpp
@@ -28,7 +28,7 @@ static ui64 CalculateIteratorLength(PyObject* iter, const TPyCastContext::TPtr&
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return length;
@@ -41,7 +41,7 @@ static bool IsIteratorHasItems(PyObject* iter, const TPyCastContext::TPtr& castC
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
@@ -77,12 +77,12 @@ class TBaseLazyList: public NUdf::TBoxedValue
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool Next(NUdf::TUnboxedValue& value) override try {
@@ -94,12 +94,12 @@ class TBaseLazyList: public NUdf::TBoxedValue
}
if (PyErr_Occurred()) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return false;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
private:
@@ -129,7 +129,7 @@ private:
return static_cast<const TDerived*>(this)->GetIteratorImpl();
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool HasFastListLength() const override {
@@ -149,7 +149,7 @@ private:
return *Length_;
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool HasListItems() const override try {
@@ -165,7 +165,7 @@ private:
return hasItems;
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
NUdf::TUnboxedValue GetListIterator() const override try {
@@ -174,7 +174,7 @@ private:
auto* self = const_cast<TListSelf*>(this);
return NUdf::TUnboxedValuePod(new TIterator(self->CastCtx_, self->ItemType_, std::move(pyIter)));
} catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
const NUdf::TOpaqueListRepresentation* GetListRepresentation() const override {
@@ -240,7 +240,7 @@ public:
UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos
<< "Cannot get iterator from object: "
<< PyObjectRepr(PyObject_.Get()) << ", error: "
- << GetLastErrorAsString()).data());
+ << GetLastErrorAsString()).c_str());
}
private:
@@ -261,7 +261,7 @@ private:
return *Length_;
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
bool HasListItems() const override try {
@@ -280,7 +280,7 @@ private:
return hasItems;
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
};
@@ -303,7 +303,7 @@ public:
if (IteratorDrained_) {
UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos <<
"Lazy list was build under python iterator. "
- "Iterator was already used.").data());
+ "Iterator was already used.").c_str());
}
IteratorDrained_ = true;
return PyObject_;
@@ -343,7 +343,7 @@ public:
TPyObjectPtr GetIteratorImpl() const {
TPyObjectPtr generator = PyObject_CallObject(PyObject_.Get(), nullptr);
if (!generator || !PyGen_Check(generator.Get())) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Expected generator as a result of function call").data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Expected generator as a result of function call").c_str());
}
return PyObject_GetIter(generator.Get());
}
diff --git a/yql/essentials/udfs/common/python/bindings/py_stream.cpp b/yql/essentials/udfs/common/python/bindings/py_stream.cpp
index 5be78e442aa..24f7e0eb45d 100644
--- a/yql/essentials/udfs/common/python/bindings/py_stream.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_stream.cpp
@@ -215,7 +215,7 @@ private:
PyIter_.Reset();
TPyObjectPtr result(PyObject_CallObject(PyGeneratorCallable_.Get(), PyGeneratorCallableArgs_.Get()));
if (!result) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Failed to execute:\n" << GetLastErrorAsString()).c_str());
}
if (PyGen_Check(result.Get())) {
@@ -223,7 +223,7 @@ private:
} else if (PyIter_Check(result.Get())) {
iter = std::move(result);
} else {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Expected iterator or generator, but got " << PyObjectRepr(result.Get())).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << "Expected iterator or generator, but got " << PyObjectRepr(result.Get())).c_str());
}
} else {
return NUdf::EFetchStatus::Yield;
@@ -232,7 +232,7 @@ private:
if (!iter) {
iter.ResetSteal(PyObject_GetIter(iterable.Get()));
if (!iter) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
}
@@ -240,13 +240,13 @@ private:
return NUdf::EFetchStatus::Yield;
}
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return NUdf::EFetchStatus::Finish;
}
catch (const yexception& e) {
- UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).data());
+ UdfTerminate((TStringBuilder() << CastCtx_->PyCtx->Pos << e.what()).c_str());
}
}
@@ -287,7 +287,7 @@ NKikimr::NUdf::TUnboxedValue FromPyStream(
if (PyGen_Check(value.Get())) {
TPyObjectPtr iter(PyObject_GetIter(value.Get()));
if (!iter) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return NUdf::TUnboxedValuePod(new TStreamOverPyIter(castCtx, itemType, std::move(iter), nullptr,
originalCallable, originalCallableClosure, originalCallableArgs));
@@ -308,11 +308,11 @@ NKikimr::NUdf::TUnboxedValue FromPyStream(
if (PyCallable_Check(value.Get())) {
TPyObjectPtr generator(PyObject_CallObject(value.Get(), nullptr));
if (!generator || !PyGen_Check(generator.Get())) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << "Expected generator as a result of function call").data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << "Expected generator as a result of function call").c_str());
}
TPyObjectPtr iter(PyObject_GetIter(generator.Get()));
if (!iter) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
TPyObjectPtr callableClosure;
@@ -331,13 +331,13 @@ NKikimr::NUdf::TUnboxedValue FromPyStream(
if (PySequence_Check(value.Get()) || PyObject_HasAttrString(value.Get(), "__iter__")) {
TPyObjectPtr iter(PyObject_GetIter(value.Get()));
if (!iter) {
- UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << GetLastErrorAsString()).c_str());
}
return NUdf::TUnboxedValuePod(new TStreamOverPyIter(castCtx, itemType, std::move(iter), originalCallable ? value : nullptr, nullptr, nullptr, nullptr));
}
UdfTerminate((TStringBuilder() << castCtx->PyCtx->Pos << "Expected iterator, generator, generator factory, "
- "or iterable object, but got " << PyObjectRepr(value.Get())).data());
+ "or iterable object, but got " << PyObjectRepr(value.Get())).c_str());
}
} // namespace NPython
diff --git a/yql/essentials/udfs/common/python/python_udf/python_function_factory.h b/yql/essentials/udfs/common/python/python_udf/python_function_factory.h
index 657fb1f442b..7d96f67a083 100644
--- a/yql/essentials/udfs/common/python/python_udf/python_function_factory.h
+++ b/yql/essentials/udfs/common/python/python_udf/python_function_factory.h
@@ -58,23 +58,23 @@ private:
TPyGilLocker lock;
TPyObjectPtr module = CompileModule(FunctionName_, source);
if (!module) {
- UdfTerminate((TStringBuilder() << Ctx_->Pos << "Failed to compile module: " << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << Ctx_->Pos << "Failed to compile module: " << GetLastErrorAsString()).c_str());
}
TPyObjectPtr function(PyObject_GetAttrString(module.Get(), FunctionName_.data()));
if (!function) {
- UdfTerminate((TStringBuilder() << Ctx_->Pos << "Failed to find entry point: " << GetLastErrorAsString()).data());
+ UdfTerminate((TStringBuilder() << Ctx_->Pos << "Failed to find entry point: " << GetLastErrorAsString()).c_str());
}
if (!PyCallable_Check(function.Get())) {
- UdfTerminate((TStringBuilder() << Ctx_->Pos << "Entry point is not a callable").data());
+ UdfTerminate((TStringBuilder() << Ctx_->Pos << "Entry point is not a callable").c_str());
}
try {
SetupCallableSettings(castCtx, function.Get());
} catch (const yexception& e) {
UdfTerminate((TStringBuilder() << Ctx_->Pos << "Failed to setup callable settings: "
- << e.what()).data());
+ << e.what()).c_str());
}
return FromPyCallable(castCtx, FunctionType_, function.Release());
}