01-arcadia.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. --- contrib/python/cffi/py2/c/_cffi_backend.c (index)
  2. +++ contrib/python/cffi/py2/c/_cffi_backend.c (working tree)
  3. @@ -294,7 +294,6 @@ typedef union {
  4. unsigned long long m_longlong;
  5. float m_float;
  6. double m_double;
  7. - long double m_longdouble;
  8. } union_alignment;
  9. typedef struct {
  10. --- contrib/python/cffi/py2/c/lib_obj.c (index)
  11. +++ contrib/python/cffi/py2/c/lib_obj.c (working tree)
  12. @@ -15,6 +15,18 @@
  13. __getattr__.
  14. */
  15. +#if defined(_asan_enabled_)
  16. +void __lsan_ignore_object(const void* p);
  17. +#endif
  18. +
  19. +inline static void MarkAsIntentionallyLeaked(const void* ptr) {
  20. +#if defined(_asan_enabled_)
  21. + __lsan_ignore_object(ptr);
  22. +#else
  23. + (void)ptr;
  24. +#endif
  25. +}
  26. +
  27. struct CPyExtFunc_s {
  28. PyMethodDef md;
  29. void *direct_fn;
  30. @@ -340,6 +352,7 @@ static PyObject *lib_build_and_cache_attr(LibObject *lib, PyObject *name,
  31. PyErr_NoMemory();
  32. return NULL;
  33. }
  34. + MarkAsIntentionallyLeaked(data);
  35. ((void(*)(char*))g->address)(data);
  36. }
  37. x = convert_to_object(data, ct);
  38. --- contrib/python/cffi/py2/c/misc_win32.h (index)
  39. +++ contrib/python/cffi/py2/c/misc_win32.h (working tree)
  40. @@ -8,30 +8,6 @@
  41. static DWORD cffi_tls_index = TLS_OUT_OF_INDEXES;
  42. -BOOL WINAPI DllMain(HINSTANCE hinstDLL,
  43. - DWORD reason_for_call,
  44. - LPVOID reserved)
  45. -{
  46. - LPVOID p;
  47. -
  48. - switch (reason_for_call) {
  49. -
  50. - case DLL_THREAD_DETACH:
  51. - if (cffi_tls_index != TLS_OUT_OF_INDEXES) {
  52. - p = TlsGetValue(cffi_tls_index);
  53. - if (p != NULL) {
  54. - TlsSetValue(cffi_tls_index, NULL);
  55. - cffi_thread_shutdown(p);
  56. - }
  57. - }
  58. - break;
  59. -
  60. - default:
  61. - break;
  62. - }
  63. - return TRUE;
  64. -}
  65. -
  66. static void init_cffi_tls(void)
  67. {
  68. if (cffi_tls_index == TLS_OUT_OF_INDEXES) {
  69. --- contrib/python/cffi/py2/c/wchar_helper.h (index)
  70. +++ contrib/python/cffi/py2/c/wchar_helper.h (working tree)
  71. @@ -20,7 +20,7 @@ static PyObject *
  72. _my_PyUnicode_FromChar32(const cffi_char32_t *w, Py_ssize_t size)
  73. {
  74. PyObject *unicode;
  75. - register Py_ssize_t i;
  76. + Py_ssize_t i;
  77. Py_ssize_t alloc;
  78. const cffi_char32_t *orig_w;
  79. @@ -38,7 +38,7 @@ _my_PyUnicode_FromChar32(const cffi_char32_t *w, Py_ssize_t size)
  80. /* Copy the wchar_t data into the new object */
  81. {
  82. - register Py_UNICODE *u;
  83. + Py_UNICODE *u;
  84. u = PyUnicode_AS_UNICODE(unicode);
  85. for (i = size; i > 0; i--) {
  86. if (*w > 0xFFFF) {
  87. --- contrib/python/cffi/py2/cffi/recompiler.py (index)
  88. +++ contrib/python/cffi/py2/cffi/recompiler.py (working tree)
  89. @@ -287,10 +287,8 @@ class Recompiler:
  90. self.write_c_source_to_f(f, preamble)
  91. def _rel_readlines(self, filename):
  92. - g = open(os.path.join(os.path.dirname(__file__), filename), 'r')
  93. - lines = g.readlines()
  94. - g.close()
  95. - return lines
  96. + import pkgutil
  97. + return pkgutil.get_data('cffi', filename).decode('utf-8').splitlines(True)
  98. def write_c_source_to_f(self, f, preamble):
  99. self._f = f