summaryrefslogtreecommitdiffstats
path: root/contrib/python/cffi/py2
diff options
context:
space:
mode:
authormaxim-yurchuk <[email protected]>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <[email protected]>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/cffi/py2
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/cffi/py2')
-rw-r--r--contrib/python/cffi/py2/.yandex_meta/yamaker.yaml29
-rw-r--r--contrib/python/cffi/py2/patches/01-arcadia.patch107
2 files changed, 136 insertions, 0 deletions
diff --git a/contrib/python/cffi/py2/.yandex_meta/yamaker.yaml b/contrib/python/cffi/py2/.yandex_meta/yamaker.yaml
new file mode 100644
index 00000000000..e550d247b75
--- /dev/null
+++ b/contrib/python/cffi/py2/.yandex_meta/yamaker.yaml
@@ -0,0 +1,29 @@
+requirements:
+ - contrib/restricted/libffi
+disable_includes:
+ - mbarrier.h
+exclude_from_macros:
+ - c/call_python.c
+ - c/cdlopen.c
+ - c/cffi1_module.c
+ - c/cglob.c
+ - c/commontypes.c
+ - c/ffi_obj.c
+ - c/lib_obj.c
+ - c/parse_c_type.c
+ - c/realize_c_type.c
+ - gen/*
+ - lsan.supp
+mark_as_resources:
+ - cffi/_cffi_errors.h
+ - cffi/_cffi_include.h
+ - cffi/_embedding.h
+ - cffi/parse_c_type.h
+exclude:
+ - c/libffi_*
+ - c/test_c.py
+copy:
+ - c/*
+keep:
+ - gen/*
+ - lsan.supp
diff --git a/contrib/python/cffi/py2/patches/01-arcadia.patch b/contrib/python/cffi/py2/patches/01-arcadia.patch
new file mode 100644
index 00000000000..2002acbe7bb
--- /dev/null
+++ b/contrib/python/cffi/py2/patches/01-arcadia.patch
@@ -0,0 +1,107 @@
+--- contrib/python/cffi/py2/c/_cffi_backend.c (index)
++++ contrib/python/cffi/py2/c/_cffi_backend.c (working tree)
+@@ -294,7 +294,6 @@ typedef union {
+ unsigned long long m_longlong;
+ float m_float;
+ double m_double;
+- long double m_longdouble;
+ } union_alignment;
+
+ typedef struct {
+--- contrib/python/cffi/py2/c/lib_obj.c (index)
++++ contrib/python/cffi/py2/c/lib_obj.c (working tree)
+@@ -15,6 +15,18 @@
+ __getattr__.
+ */
+
++#if defined(_asan_enabled_)
++void __lsan_ignore_object(const void* p);
++#endif
++
++inline static void MarkAsIntentionallyLeaked(const void* ptr) {
++#if defined(_asan_enabled_)
++ __lsan_ignore_object(ptr);
++#else
++ (void)ptr;
++#endif
++}
++
+ struct CPyExtFunc_s {
+ PyMethodDef md;
+ void *direct_fn;
+@@ -340,6 +352,7 @@ static PyObject *lib_build_and_cache_attr(LibObject *lib, PyObject *name,
+ PyErr_NoMemory();
+ return NULL;
+ }
++ MarkAsIntentionallyLeaked(data);
+ ((void(*)(char*))g->address)(data);
+ }
+ x = convert_to_object(data, ct);
+--- contrib/python/cffi/py2/c/misc_win32.h (index)
++++ contrib/python/cffi/py2/c/misc_win32.h (working tree)
+@@ -8,30 +8,6 @@
+
+ static DWORD cffi_tls_index = TLS_OUT_OF_INDEXES;
+
+-BOOL WINAPI DllMain(HINSTANCE hinstDLL,
+- DWORD reason_for_call,
+- LPVOID reserved)
+-{
+- LPVOID p;
+-
+- switch (reason_for_call) {
+-
+- case DLL_THREAD_DETACH:
+- if (cffi_tls_index != TLS_OUT_OF_INDEXES) {
+- p = TlsGetValue(cffi_tls_index);
+- if (p != NULL) {
+- TlsSetValue(cffi_tls_index, NULL);
+- cffi_thread_shutdown(p);
+- }
+- }
+- break;
+-
+- default:
+- break;
+- }
+- return TRUE;
+-}
+-
+ static void init_cffi_tls(void)
+ {
+ if (cffi_tls_index == TLS_OUT_OF_INDEXES) {
+--- contrib/python/cffi/py2/c/wchar_helper.h (index)
++++ contrib/python/cffi/py2/c/wchar_helper.h (working tree)
+@@ -20,7 +20,7 @@ static PyObject *
+ _my_PyUnicode_FromChar32(const cffi_char32_t *w, Py_ssize_t size)
+ {
+ PyObject *unicode;
+- register Py_ssize_t i;
++ Py_ssize_t i;
+ Py_ssize_t alloc;
+ const cffi_char32_t *orig_w;
+
+@@ -38,7 +38,7 @@ _my_PyUnicode_FromChar32(const cffi_char32_t *w, Py_ssize_t size)
+
+ /* Copy the wchar_t data into the new object */
+ {
+- register Py_UNICODE *u;
++ Py_UNICODE *u;
+ u = PyUnicode_AS_UNICODE(unicode);
+ for (i = size; i > 0; i--) {
+ if (*w > 0xFFFF) {
+--- contrib/python/cffi/py2/cffi/recompiler.py (index)
++++ contrib/python/cffi/py2/cffi/recompiler.py (working tree)
+@@ -287,10 +287,8 @@ class Recompiler:
+ self.write_c_source_to_f(f, preamble)
+
+ def _rel_readlines(self, filename):
+- g = open(os.path.join(os.path.dirname(__file__), filename), 'r')
+- lines = g.readlines()
+- g.close()
+- return lines
++ import pkgutil
++ return pkgutil.get_data('cffi', filename).decode('utf-8').splitlines(True)
+
+ def write_c_source_to_f(self, f, preamble):
+ self._f = f