diff options
author | dldmitry <dldmitry@yandex-team.ru> | 2022-02-10 16:47:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:18 +0300 |
commit | 7b11682e84e98d5d48de2807faa6fd392685ae7e (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/python | |
parent | 10129030876638368b8965c627671fe44be079bc (diff) | |
download | ydb-7b11682e84e98d5d48de2807faa6fd392685ae7e.tar.gz |
Restoring authorship annotation for <dldmitry@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python')
-rw-r--r-- | library/python/runtime_py3/main/ya.make | 6 | ||||
-rw-r--r-- | library/python/symbols/python/ut/test_ctypes.py | 72 | ||||
-rw-r--r-- | library/python/symbols/python/ut/ya.make | 16 | ||||
-rw-r--r-- | library/python/ya.make | 8 |
4 files changed, 51 insertions, 51 deletions
diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index 931eb93504..f308a93b28 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -5,15 +5,15 @@ OWNER( orivej ) -PEERDIR( +PEERDIR( contrib/tools/python3/src library/cpp/resource -) +) ADDINCL( contrib/tools/python3/src/Include ) - + CFLAGS( -DPy_BUILD_CORE ) diff --git a/library/python/symbols/python/ut/test_ctypes.py b/library/python/symbols/python/ut/test_ctypes.py index b1c15fa68b..253a10d8b3 100644 --- a/library/python/symbols/python/ut/test_ctypes.py +++ b/library/python/symbols/python/ut/test_ctypes.py @@ -1,37 +1,37 @@ -from ctypes import ( - byref, POINTER, c_int, c_char, c_char_p, - c_void_p, py_object, c_ssize_t, pythonapi, Structure -) - -c_ssize_p = POINTER(c_ssize_t) - - -class Py_buffer(Structure): - _fields_ = [ - ('buf', c_void_p), - ('obj', py_object), - ('len', c_ssize_t), - ('itemsize', c_ssize_t), - ('readonly', c_int), - ('ndim', c_int), - ('format', c_char_p), - ('shape', c_ssize_p), - ('strides', c_ssize_p), - ('suboffsets', c_ssize_p), - ('smalltable', c_ssize_t * 2), - ('internal', c_void_p) - ] - - -def get_buffer(obj): - buf = Py_buffer() - pythonapi.PyObject_GetBuffer(py_object(obj), byref(buf), 0) - try: - buffer_type = c_char * buf.len - return buffer_type.from_address(buf.buf) - finally: - pythonapi.PyBuffer_Release(byref(buf)) - - -def test_buffer(): +from ctypes import ( + byref, POINTER, c_int, c_char, c_char_p, + c_void_p, py_object, c_ssize_t, pythonapi, Structure +) + +c_ssize_p = POINTER(c_ssize_t) + + +class Py_buffer(Structure): + _fields_ = [ + ('buf', c_void_p), + ('obj', py_object), + ('len', c_ssize_t), + ('itemsize', c_ssize_t), + ('readonly', c_int), + ('ndim', c_int), + ('format', c_char_p), + ('shape', c_ssize_p), + ('strides', c_ssize_p), + ('suboffsets', c_ssize_p), + ('smalltable', c_ssize_t * 2), + ('internal', c_void_p) + ] + + +def get_buffer(obj): + buf = Py_buffer() + pythonapi.PyObject_GetBuffer(py_object(obj), byref(buf), 0) + try: + buffer_type = c_char * buf.len + return buffer_type.from_address(buf.buf) + finally: + pythonapi.PyBuffer_Release(byref(buf)) + + +def test_buffer(): assert get_buffer(b'test string') diff --git a/library/python/symbols/python/ut/ya.make b/library/python/symbols/python/ut/ya.make index 18c0e6bb51..2849e01b1e 100644 --- a/library/python/symbols/python/ut/ya.make +++ b/library/python/symbols/python/ut/ya.make @@ -1,14 +1,14 @@ PY23_LIBRARY() - -OWNER(orivej) - + +OWNER(orivej) + TEST_SRCS(test_ctypes.py) - -PEERDIR( + +PEERDIR( library/python/symbols/python -) - -END() +) + +END() RECURSE_FOR_TESTS( py2 diff --git a/library/python/ya.make b/library/python/ya.make index 643f74a034..2e1eb6e0e1 100644 --- a/library/python/ya.make +++ b/library/python/ya.make @@ -214,9 +214,9 @@ RECURSE( ylock/tests zipatch ) - + IF (NOT MUSL) RECURSE( - yt/example - ) -ENDIF() + yt/example + ) +ENDIF() |