comparison src/if_python3.c @ 33320:a9f0f0eae10e v9.0.1925

patch 9.0.1925: if_python: still undefined behaviour with function pointer Commit: https://github.com/vim/vim/commit/02c51b1dd8e8b96e969ad7e408536fa208d90ac8 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Thu Sep 21 16:40:12 2023 +0200 patch 9.0.1925: if_python: still undefined behaviour with function pointer Problem: if_python: still undefined behaviour with function pointer Solution: fix remaining problems Fix remaining issues in the if_python code in casting incompatible function pointers leading to Clang 17 giving runtime errors during UBSAN. closes: #13140 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Sep 2023 16:45:07 +0200
parents 924e9cb09df7
children 3af53f2895dc
comparison
equal deleted inserted replaced
33319:9a3a0a22d6f7 33320:a9f0f0eae10e
1531 static int 1531 static int
1532 OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val) 1532 OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
1533 { 1533 {
1534 GET_ATTR_STRING(name, nameobj); 1534 GET_ATTR_STRING(name, nameobj);
1535 1535
1536 return OutputSetattr((OutputObject *)(self), name, val); 1536 return OutputSetattr(self, name, val);
1537 } 1537 }
1538 1538
1539 /////////////////////////////////////////////////////// 1539 ///////////////////////////////////////////////////////
1540 // 3. Implementation of the Vim module for Python 1540 // 3. Implementation of the Vim module for Python
1541 1541
1609 static int 1609 static int
1610 BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val) 1610 BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
1611 { 1611 {
1612 GET_ATTR_STRING(name, nameobj); 1612 GET_ATTR_STRING(name, nameobj);
1613 1613
1614 return BufferSetattr((BufferObject *)(self), name, val); 1614 return BufferSetattr(self, name, val);
1615 } 1615 }
1616 1616
1617 ////////////////// 1617 //////////////////
1618 1618
1619 static PyObject * 1619 static PyObject *
1835 static int 1835 static int
1836 WindowSetattro(PyObject *self, PyObject *nameobj, PyObject *val) 1836 WindowSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
1837 { 1837 {
1838 GET_ATTR_STRING(name, nameobj); 1838 GET_ATTR_STRING(name, nameobj);
1839 1839
1840 return WindowSetattr((WindowObject *)(self), name, val); 1840 return WindowSetattr(self, name, val);
1841 } 1841 }
1842 1842
1843 // Tab page list object - Definitions 1843 // Tab page list object - Definitions
1844 1844
1845 static PySequenceMethods TabListAsSeq = { 1845 static PySequenceMethods TabListAsSeq = {
1909 1909
1910 static int 1910 static int
1911 DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val) 1911 DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
1912 { 1912 {
1913 GET_ATTR_STRING(name, nameobj); 1913 GET_ATTR_STRING(name, nameobj);
1914 return DictionarySetattr((DictionaryObject *)(self), name, val); 1914 return DictionarySetattr(self, name, val);
1915 } 1915 }
1916 1916
1917 // List object - Definitions 1917 // List object - Definitions
1918 1918
1919 static PyObject * 1919 static PyObject *
1929 1929
1930 static int 1930 static int
1931 ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val) 1931 ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
1932 { 1932 {
1933 GET_ATTR_STRING(name, nameobj); 1933 GET_ATTR_STRING(name, nameobj);
1934 return ListSetattr((ListObject *)(self), name, val); 1934 return ListSetattr(self, name, val);
1935 } 1935 }
1936 1936
1937 // Function object - Definitions 1937 // Function object - Definitions
1938 1938
1939 static PyObject * 1939 static PyObject *