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