1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
To: vim_dev@googlegroups.com
Subject: Patch 7.3.584
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.584
Problem: PyCObject is not always defined.
Solution: Use PyObject instead.
Files: src/if_py_both.h, src/if_python.c
*** ../vim-7.3.583/src/if_py_both.h 2012-06-29 17:51:58.000000000 +0200
--- src/if_py_both.h 2012-06-30 13:25:24.000000000 +0200
***************
*** 2432,2463 ****
convert_dl(PyObject *obj, typval_T *tv,
pytotvfunc py_to_tv, PyObject *lookupDict)
{
- # ifdef PY_USE_CAPSULE
PyObject *capsule;
- # else
- PyCObject *cobject;
- # endif
char hexBuf[sizeof(void *) * 2 + 3];
sprintf(hexBuf, "%p", obj);
# ifdef PY_USE_CAPSULE
capsule = PyDict_GetItemString(lookupDict, hexBuf);
- if (capsule == NULL)
# else
! cobject = (PyCObject *)PyDict_GetItemString(lookupDict, hexBuf);
! if (cobject == NULL)
# endif
{
# ifdef PY_USE_CAPSULE
capsule = PyCapsule_New(tv, NULL, NULL);
- PyDict_SetItemString(lookupDict, hexBuf, capsule);
- Py_DECREF(capsule);
# else
! cobject = PyCObject_FromVoidPtr(tv, NULL);
! PyDict_SetItemString(lookupDict, hexBuf, cobject);
! Py_DECREF(cobject);
# endif
if (py_to_tv(obj, tv, lookupDict) == -1)
{
tv->v_type = VAR_UNKNOWN;
--- 2432,2456 ----
convert_dl(PyObject *obj, typval_T *tv,
pytotvfunc py_to_tv, PyObject *lookupDict)
{
PyObject *capsule;
char hexBuf[sizeof(void *) * 2 + 3];
sprintf(hexBuf, "%p", obj);
# ifdef PY_USE_CAPSULE
capsule = PyDict_GetItemString(lookupDict, hexBuf);
# else
! capsule = (PyObject *)PyDict_GetItemString(lookupDict, hexBuf);
# endif
+ if (capsule == NULL)
{
# ifdef PY_USE_CAPSULE
capsule = PyCapsule_New(tv, NULL, NULL);
# else
! capsule = PyCObject_FromVoidPtr(tv, NULL);
# endif
+ PyDict_SetItemString(lookupDict, hexBuf, capsule);
+ Py_DECREF(capsule);
if (py_to_tv(obj, tv, lookupDict) == -1)
{
tv->v_type = VAR_UNKNOWN;
***************
*** 2478,2484 ****
# ifdef PY_USE_CAPSULE
v = PyCapsule_GetPointer(capsule, NULL);
# else
! v = PyCObject_AsVoidPtr(cobject);
# endif
copy_tv(v, tv);
}
--- 2471,2477 ----
# ifdef PY_USE_CAPSULE
v = PyCapsule_GetPointer(capsule, NULL);
# else
! v = PyCObject_AsVoidPtr(capsule);
# endif
copy_tv(v, tv);
}
*** ../vim-7.3.583/src/if_python.c 2012-06-30 13:21:03.000000000 +0200
--- src/if_python.c 2012-06-30 13:23:22.000000000 +0200
***************
*** 327,334 ****
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
# else
! static PyCObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
! static void* (*dll_PyCObject_AsVoidPtr)(PyCObject *);
# endif
static HINSTANCE hinstPython = 0; /* Instance of python.dll */
--- 327,334 ----
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
# else
! static PyObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
! static void* (*dll_PyCObject_AsVoidPtr)(PyObject *);
# endif
static HINSTANCE hinstPython = 0; /* Instance of python.dll */
*** ../vim-7.3.583/src/version.c 2012-06-30 13:21:03.000000000 +0200
--- src/version.c 2012-06-30 13:33:08.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
{ /* Add new patch number below this line */
+ /**/
+ 584,
/**/
--
hundred-and-one symptoms of being an internet addict:
91. It's Saturday afternoon in the middle of May and you
are on computer.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|