summaryrefslogtreecommitdiffstats
path: root/library/python
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-12-11 13:14:15 +0300
committerrobot-piglet <[email protected]>2025-12-11 13:40:18 +0300
commit7e1db797b1995acdc4537126b584c62fa22a7bea (patch)
treeeb916293caa616c67d88e70734746047fb12ed6b /library/python
parentbec3a4c44a7038be22d2bb47ec4ba7302ee1e191 (diff)
Intermediate changes
commit_hash:cdbde42da0108f2cdced18af7de26fda46c8cce9
Diffstat (limited to 'library/python')
-rw-r--r--library/python/cyson/cyson/_cyson.pyx15
-rw-r--r--library/python/cyson/pymodule/ya.make6
-rw-r--r--library/python/cyson/ya.make6
3 files changed, 24 insertions, 3 deletions
diff --git a/library/python/cyson/cyson/_cyson.pyx b/library/python/cyson/cyson/_cyson.pyx
index ff538b121fc..edc23c2abbb 100644
--- a/library/python/cyson/cyson/_cyson.pyx
+++ b/library/python/cyson/cyson/_cyson.pyx
@@ -25,7 +25,10 @@ from cpython.bytes cimport (
PyBytes_GET_SIZE,
)
from cpython.dict cimport PyDict_Next, PyDict_Copy, PyDict_Check
-from cpython.int cimport PyInt_FromLong
+IF PYTHON2:
+ from cpython.int cimport PyInt_FromLong
+ELSE:
+ from cpython.long cimport PyLong_FromLong
from cpython.long cimport PyLong_AsUnsignedLong
from cpython.list cimport PyList_GET_SIZE, PyList_GET_ITEM
from cpython.object cimport (
@@ -901,7 +904,10 @@ cdef object _c_yson_reader_get_scalar(C.yson_reader* c_reader):
elif scalar_type == C.YSON_SCALAR_BOOLEAN:
return C.yson_reader_get_boolean(c_reader)
elif scalar_type == C.YSON_SCALAR_INT64:
- return PyInt_FromLong(C.yson_reader_get_int64(c_reader))
+ IF PYTHON2:
+ return PyInt_FromLong(C.yson_reader_get_int64(c_reader))
+ ELSE:
+ return PyLong_FromLong(C.yson_reader_get_int64(c_reader))
elif scalar_type == C.YSON_SCALAR_UINT64:
return ConstructPyNumberFromUint(C.yson_reader_get_uint64(c_reader))
elif scalar_type == C.YSON_SCALAR_FLOAT64:
@@ -1109,7 +1115,10 @@ cdef object _c_yson_unicode_reader_get_scalar(C.yson_reader* c_reader):
elif scalar_type == C.YSON_SCALAR_BOOLEAN:
return C.yson_reader_get_boolean(c_reader)
elif scalar_type == C.YSON_SCALAR_INT64:
- return PyInt_FromLong(C.yson_reader_get_int64(c_reader))
+ IF PYTHON2:
+ return PyInt_FromLong(C.yson_reader_get_int64(c_reader))
+ ELSE:
+ return PyLong_FromLong(C.yson_reader_get_int64(c_reader))
elif scalar_type == C.YSON_SCALAR_UINT64:
return ConstructPyNumberFromUint(C.yson_reader_get_uint64(c_reader))
elif scalar_type == C.YSON_SCALAR_FLOAT64:
diff --git a/library/python/cyson/pymodule/ya.make b/library/python/cyson/pymodule/ya.make
index dd308bd8a0e..941d1bf9a94 100644
--- a/library/python/cyson/pymodule/ya.make
+++ b/library/python/cyson/pymodule/ya.make
@@ -18,4 +18,10 @@ SRCS(
library/python/cyson/cyson/unsigned_long.cpp
)
+IF (PYTHON2)
+ CYTHON_FLAGS(-EPYTHON2=1)
+ELSE()
+ CYTHON_FLAGS(-EPYTHON2=0)
+ENDIF()
+
END()
diff --git a/library/python/cyson/ya.make b/library/python/cyson/ya.make
index 3a664559041..fb444d725f8 100644
--- a/library/python/cyson/ya.make
+++ b/library/python/cyson/ya.make
@@ -17,6 +17,12 @@ PY_SRCS(
cyson/__init__.py
)
+IF (PYTHON2)
+ CYTHON_FLAGS(-EPYTHON2=1)
+ELSE()
+ CYTHON_FLAGS(-EPYTHON2=0)
+ENDIF()
+
END()
RECURSE(