summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/python/bindings/py_utils.h
blob: cfb3f7208364e6900c3864c73dbac0cbcfa383c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "py_ptr.h"

#include <util/generic/strbuf.h>

#ifdef _win_
    #define INIT_MEMBER(member, value) value // member
#else
    #define INIT_MEMBER(member, value) .member = (value)
#endif

namespace NPython {

TPyObjectPtr PyRepr(TStringBuf asciiStr, bool intern = false);

template <size_t size>
TPyObjectPtr PyRepr(const char (&str)[size]) {
    return PyRepr(TStringBuf(str, size - 1), true);
}

TString PyObjectRepr(PyObject* value);

bool HasEncodingCookie(const TString& source);

void PyCleanup();

} // namespace NPython