Skip to content

Commit d4a8c98

Browse files
committed
patch 8.0.1846: Python interface is incompatible with lldb
Problem: Python interface is incompatible with lldb. Solution: For OutputType set the base to be PyFile_Type. (Boxu Zhang) Partly disabled to avoid a crash.
1 parent 259f26a commit d4a8c98

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/if_py_both.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6333,9 +6333,12 @@ init_structs(void)
63336333
OutputType.tp_alloc = call_PyType_GenericAlloc;
63346334
OutputType.tp_new = call_PyType_GenericNew;
63356335
OutputType.tp_free = call_PyObject_Free;
6336+
OutputType.tp_base = &PyStdPrinter_Type;
63366337
#else
63376338
OutputType.tp_getattr = (getattrfunc)OutputGetattr;
63386339
OutputType.tp_setattr = (setattrfunc)OutputSetattr;
6340+
// Disabled, because this causes a crash in test86
6341+
// OutputType.tp_base = &PyFile_Type;
63396342
#endif
63406343

63416344
vim_memset(&IterType, 0, sizeof(IterType));

src/if_python.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ struct PyMethodDef { Py_ssize_t a; };
247247
# define PySys_GetObject dll_PySys_GetObject
248248
# define PySys_SetArgv dll_PySys_SetArgv
249249
# define PyType_Type (*dll_PyType_Type)
250+
# define PyFile_Type (*dll_PyFile_Type)
250251
# define PySlice_Type (*dll_PySlice_Type)
251252
# define PyType_Ready (*dll_PyType_Ready)
252253
# define PyType_GenericAlloc dll_PyType_GenericAlloc
@@ -395,6 +396,7 @@ static int(*dll_PySys_SetObject)(char *, PyObject *);
395396
static PyObject *(*dll_PySys_GetObject)(char *);
396397
static int(*dll_PySys_SetArgv)(int, char **);
397398
static PyTypeObject* dll_PyType_Type;
399+
static PyTypeObject* dll_PyFile_Type;
398400
static PyTypeObject* dll_PySlice_Type;
399401
static int (*dll_PyType_Ready)(PyTypeObject *type);
400402
static PyObject* (*dll_PyType_GenericAlloc)(PyTypeObject *type, PyInt nitems);
@@ -580,6 +582,7 @@ static struct
580582
{"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject},
581583
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
582584
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
585+
{"PyFile_Type", (PYTHON_PROC*)&dll_PyFile_Type},
583586
{"PySlice_Type", (PYTHON_PROC*)&dll_PySlice_Type},
584587
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
585588
{"PyType_GenericAlloc", (PYTHON_PROC*)&dll_PyType_GenericAlloc},

src/if_python3.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ typedef PySliceObject PySliceObject_T;
231231
# define PyFloat_AsDouble py3_PyFloat_AsDouble
232232
# define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr
233233
# define PyType_Type (*py3_PyType_Type)
234+
# define PyStdPrinter_Type (*py3_PyStdPrinter_Type)
234235
# define PySlice_Type (*py3_PySlice_Type)
235236
# define PyFloat_Type (*py3_PyFloat_Type)
236237
# define PyNumber_Check (*py3_PyNumber_Check)
@@ -388,6 +389,7 @@ static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
388389
static PyObject* (*py3_PyType_GenericAlloc)(PyTypeObject *type, Py_ssize_t nitems);
389390
static PyObject* (*py3_PyType_GenericNew)(PyTypeObject *type, PyObject *args, PyObject *kwds);
390391
static PyTypeObject* py3_PyType_Type;
392+
static PyTypeObject* py3_PyStdPrinter_Type;
391393
static PyTypeObject* py3_PySlice_Type;
392394
static PyTypeObject* py3_PyFloat_Type;
393395
static PyTypeObject* py3_PyBool_Type;
@@ -548,6 +550,7 @@ static struct
548550
{"PyType_GenericAlloc", (PYTHON_PROC*)&py3_PyType_GenericAlloc},
549551
{"PyType_GenericNew", (PYTHON_PROC*)&py3_PyType_GenericNew},
550552
{"PyType_Type", (PYTHON_PROC*)&py3_PyType_Type},
553+
{"PyStdPrinter_Type", (PYTHON_PROC*)&py3_PyStdPrinter_Type},
551554
{"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
552555
{"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
553556
{"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type},

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1846,
764766
/**/
765767
1845,
766768
/**/

0 commit comments

Comments
 (0)