home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.992 < prev    next >
Encoding:
Internet Message Format  |  2013-05-20  |  68.7 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.992
  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.992
  11. Problem:    Python: Too many type casts.
  12. Solution:   Change argument types. (ZyX)
  13. Files:        src/if_py_both.h, src/if_python3.c, src/if_python.c
  14.  
  15.  
  16. *** ../vim-7.3.991/src/if_py_both.h    2013-05-21 18:19:33.000000000 +0200
  17. --- src/if_py_both.h    2013-05-21 18:22:03.000000000 +0200
  18. ***************
  19. *** 76,82 ****
  20.   } OutputObject;
  21.   
  22.       static int
  23. ! OutputSetattr(PyObject *self, char *name, PyObject *val)
  24.   {
  25.       if (val == NULL)
  26.       {
  27. --- 76,82 ----
  28.   } OutputObject;
  29.   
  30.       static int
  31. ! OutputSetattr(OutputObject *self, char *name, PyObject *val)
  32.   {
  33.       if (val == NULL)
  34.       {
  35. ***************
  36. *** 93,99 ****
  37.           return -1;
  38.       }
  39.   
  40. !     ((OutputObject *)(self))->softspace = PyInt_AsLong(val);
  41.       return 0;
  42.       }
  43.   
  44. --- 93,99 ----
  45.           return -1;
  46.       }
  47.   
  48. !     self->softspace = PyInt_AsLong(val);
  49.       return 0;
  50.       }
  51.   
  52. ***************
  53. *** 152,162 ****
  54.   }
  55.   
  56.       static PyObject *
  57. ! OutputWrite(PyObject *self, PyObject *args)
  58.   {
  59.       Py_ssize_t len = 0;
  60.       char *str = NULL;
  61. !     int error = ((OutputObject *)(self))->error;
  62.   
  63.       if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
  64.       return NULL;
  65. --- 152,162 ----
  66.   }
  67.   
  68.       static PyObject *
  69. ! OutputWrite(OutputObject *self, PyObject *args)
  70.   {
  71.       Py_ssize_t len = 0;
  72.       char *str = NULL;
  73. !     int error = self->error;
  74.   
  75.       if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
  76.       return NULL;
  77. ***************
  78. *** 173,184 ****
  79.   }
  80.   
  81.       static PyObject *
  82. ! OutputWritelines(PyObject *self, PyObject *args)
  83.   {
  84.       PyInt n;
  85.       PyInt i;
  86.       PyObject *list;
  87. !     int error = ((OutputObject *)(self))->error;
  88.   
  89.       if (!PyArg_ParseTuple(args, "O", &list))
  90.       return NULL;
  91. --- 173,184 ----
  92.   }
  93.   
  94.       static PyObject *
  95. ! OutputWritelines(OutputObject *self, PyObject *args)
  96.   {
  97.       PyInt n;
  98.       PyInt i;
  99.       PyObject *list;
  100. !     int error = self->error;
  101.   
  102.       if (!PyArg_ParseTuple(args, "O", &list))
  103.       return NULL;
  104. ***************
  105. *** 220,226 ****
  106.   }
  107.   
  108.       static PyObject *
  109. ! OutputFlush(PyObject *self UNUSED, PyObject *args UNUSED)
  110.   {
  111.       /* do nothing */
  112.       Py_INCREF(Py_None);
  113. --- 220,226 ----
  114.   }
  115.   
  116.       static PyObject *
  117. ! OutputFlush(PyObject *self UNUSED)
  118.   {
  119.       /* do nothing */
  120.       Py_INCREF(Py_None);
  121. ***************
  122. *** 230,240 ****
  123.   /***************/
  124.   
  125.   static struct PyMethodDef OutputMethods[] = {
  126. !     /* name,        function,        calling,    documentation */
  127. !     {"write",        OutputWrite,    1,        ""},
  128. !     {"writelines",  OutputWritelines,    1,        ""},
  129. !     {"flush",        OutputFlush,    1,        ""},
  130. !     { NULL,        NULL,        0,        NULL}
  131.   };
  132.   
  133.   static OutputObject Output =
  134. --- 230,240 ----
  135.   /***************/
  136.   
  137.   static struct PyMethodDef OutputMethods[] = {
  138. !     /* name,        function,                calling,    doc */
  139. !     {"write",        (PyCFunction)OutputWrite,        METH_VARARGS,    ""},
  140. !     {"writelines",  (PyCFunction)OutputWritelines,    METH_VARARGS,    ""},
  141. !     {"flush",        (PyCFunction)OutputFlush,        METH_NOARGS,    ""},
  142. !     { NULL,        NULL,                0,        NULL}
  143.   };
  144.   
  145.   static OutputObject Output =
  146. ***************
  147. *** 533,544 ****
  148.    */
  149.   
  150.   static struct PyMethodDef VimMethods[] = {
  151. !     /* name,         function,        calling,    documentation */
  152. !     {"command",         VimCommand,    1,        "Execute a Vim ex-mode command" },
  153. !     {"eval",         VimEval,        1,        "Evaluate an expression using Vim evaluator" },
  154. !     {"bindeval",     VimEvalPy,        1,        "Like eval(), but returns objects attached to vim ones"},
  155. !     {"strwidth",     VimStrwidth,    1,        "Screen string width, counts <Tab> as having width 1"},
  156. !     { NULL,         NULL,        0,        NULL }
  157.   };
  158.   
  159.   /*
  160. --- 533,544 ----
  161.    */
  162.   
  163.   static struct PyMethodDef VimMethods[] = {
  164. !     /* name,         function,        calling,    documentation */
  165. !     {"command",         VimCommand,    METH_VARARGS,    "Execute a Vim ex-mode command" },
  166. !     {"eval",         VimEval,        METH_VARARGS,    "Evaluate an expression using Vim evaluator" },
  167. !     {"bindeval",     VimEvalPy,        METH_VARARGS,    "Like eval(), but returns objects attached to vim ones"},
  168. !     {"strwidth",     VimStrwidth,    METH_VARARGS,    "Screen string width, counts <Tab> as having width 1"},
  169. !     { NULL,         NULL,        0,        NULL }
  170.   };
  171.   
  172.   /*
  173. ***************
  174. *** 583,604 ****
  175.   }
  176.   
  177.       static void
  178. ! IterDestructor(PyObject *self)
  179.   {
  180. !     IterObject *this = (IterObject *)(self);
  181. !     this->destruct(this->cur);
  182.   
  183.       DESTRUCTOR_FINISH(self);
  184.   }
  185.   
  186.       static int
  187. ! IterTraverse(PyObject *self, visitproc visit, void *arg)
  188.   {
  189. !     IterObject *this = (IterObject *)(self);
  190. !     if (this->traverse != NULL)
  191. !     return this->traverse(this->cur, visit, arg);
  192.       else
  193.       return 0;
  194.   }
  195. --- 583,600 ----
  196.   }
  197.   
  198.       static void
  199. ! IterDestructor(IterObject *self)
  200.   {
  201. !     self->destruct(self->cur);
  202.   
  203.       DESTRUCTOR_FINISH(self);
  204.   }
  205.   
  206.       static int
  207. ! IterTraverse(IterObject *self, visitproc visit, void *arg)
  208.   {
  209. !     if (self->traverse != NULL)
  210. !     return self->traverse(self->cur, visit, arg);
  211.       else
  212.       return 0;
  213.   }
  214. ***************
  215. *** 609,630 ****
  216.   #endif
  217.   
  218.       static int
  219. ! IterClear(PyObject *self)
  220.   {
  221. !     IterObject *this = (IterObject *)(self);
  222. !     if (this->clear != NULL)
  223. !     return this->clear(&this->cur);
  224.       else
  225.       return 0;
  226.   }
  227.   
  228.       static PyObject *
  229. ! IterNext(PyObject *self)
  230.   {
  231. !     IterObject *this = (IterObject *)(self);
  232. !     return this->next(&this->cur);
  233.   }
  234.   
  235.       static PyObject *
  236. --- 605,622 ----
  237.   #endif
  238.   
  239.       static int
  240. ! IterClear(IterObject *self)
  241.   {
  242. !     if (self->clear != NULL)
  243. !     return self->clear(&self->cur);
  244.       else
  245.       return 0;
  246.   }
  247.   
  248.       static PyObject *
  249. ! IterNext(IterObject *self)
  250.   {
  251. !     return self->next(&self->cur);
  252.   }
  253.   
  254.       static PyObject *
  255. ***************
  256. *** 711,731 ****
  257.   }
  258.   
  259.       static void
  260. ! DictionaryDestructor(PyObject *self)
  261.   {
  262. !     DictionaryObject    *this = ((DictionaryObject *) (self));
  263. !     pyll_remove(&this->ref, &lastdict);
  264. !     dict_unref(this->dict);
  265.   
  266.       DESTRUCTOR_FINISH(self);
  267.   }
  268.   
  269.       static int
  270. ! DictionarySetattr(PyObject *self, char *name, PyObject *val)
  271.   {
  272. -     DictionaryObject *this = (DictionaryObject *)(self);
  273.       if (val == NULL)
  274.       {
  275.       PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
  276. --- 703,719 ----
  277.   }
  278.   
  279.       static void
  280. ! DictionaryDestructor(DictionaryObject *self)
  281.   {
  282. !     pyll_remove(&self->ref, &lastdict);
  283. !     dict_unref(self->dict);
  284.   
  285.       DESTRUCTOR_FINISH(self);
  286.   }
  287.   
  288.       static int
  289. ! DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
  290.   {
  291.       if (val == NULL)
  292.       {
  293.       PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
  294. ***************
  295. *** 734,740 ****
  296.   
  297.       if (strcmp(name, "locked") == 0)
  298.       {
  299. !     if (this->dict->dv_lock == VAR_FIXED)
  300.       {
  301.           PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary"));
  302.           return -1;
  303. --- 722,728 ----
  304.   
  305.       if (strcmp(name, "locked") == 0)
  306.       {
  307. !     if (self->dict->dv_lock == VAR_FIXED)
  308.       {
  309.           PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary"));
  310.           return -1;
  311. ***************
  312. *** 745,753 ****
  313.           if (istrue == -1)
  314.           return -1;
  315.           else if (istrue)
  316. !         this->dict->dv_lock = VAR_LOCKED;
  317.           else
  318. !         this->dict->dv_lock = 0;
  319.       }
  320.       return 0;
  321.       }
  322. --- 733,741 ----
  323.           if (istrue == -1)
  324.           return -1;
  325.           else if (istrue)
  326. !         self->dict->dv_lock = VAR_LOCKED;
  327.           else
  328. !         self->dict->dv_lock = 0;
  329.       }
  330.       return 0;
  331.       }
  332. ***************
  333. *** 759,771 ****
  334.   }
  335.   
  336.       static PyInt
  337. ! DictionaryLength(PyObject *self)
  338.   {
  339. !     return ((PyInt) ((((DictionaryObject *)(self))->dict->dv_hashtab.ht_used)));
  340.   }
  341.   
  342.       static PyObject *
  343. ! DictionaryItem(PyObject *self, PyObject *keyObject)
  344.   {
  345.       char_u    *key;
  346.       dictitem_T    *di;
  347. --- 747,759 ----
  348.   }
  349.   
  350.       static PyInt
  351. ! DictionaryLength(DictionaryObject *self)
  352.   {
  353. !     return ((PyInt) (self->dict->dv_hashtab.ht_used));
  354.   }
  355.   
  356.       static PyObject *
  357. ! DictionaryItem(DictionaryObject *self, PyObject *keyObject)
  358.   {
  359.       char_u    *key;
  360.       dictitem_T    *di;
  361. ***************
  362. *** 773,779 ****
  363.   
  364.       DICTKEY_GET_NOTEMPTY(NULL)
  365.   
  366. !     di = dict_find(((DictionaryObject *) (self))->dict, key, -1);
  367.   
  368.       DICTKEY_UNREF
  369.   
  370. --- 761,767 ----
  371.   
  372.       DICTKEY_GET_NOTEMPTY(NULL)
  373.   
  374. !     di = dict_find(self->dict, key, -1);
  375.   
  376.       DICTKEY_UNREF
  377.   
  378. ***************
  379. *** 787,797 ****
  380.   }
  381.   
  382.       static PyInt
  383. ! DictionaryAssItem(PyObject *self, PyObject *keyObject, PyObject *valObject)
  384.   {
  385.       char_u    *key;
  386.       typval_T    tv;
  387. !     dict_T    *d = ((DictionaryObject *)(self))->dict;
  388.       dictitem_T    *di;
  389.       DICTKEY_DECL
  390.   
  391. --- 775,785 ----
  392.   }
  393.   
  394.       static PyInt
  395. ! DictionaryAssItem(DictionaryObject *self, PyObject *keyObject, PyObject *valObject)
  396.   {
  397.       char_u    *key;
  398.       typval_T    tv;
  399. !     dict_T    *d = self->dict;
  400.       dictitem_T    *di;
  401.       DICTKEY_DECL
  402.   
  403. ***************
  404. *** 852,860 ****
  405.   }
  406.   
  407.       static PyObject *
  408. ! DictionaryListKeys(PyObject *self UNUSED)
  409.   {
  410. !     dict_T    *dict = ((DictionaryObject *)(self))->dict;
  411.       long_u    todo = dict->dv_hashtab.ht_used;
  412.       Py_ssize_t    i = 0;
  413.       PyObject    *r;
  414. --- 840,848 ----
  415.   }
  416.   
  417.       static PyObject *
  418. ! DictionaryListKeys(DictionaryObject *self)
  419.   {
  420. !     dict_T    *dict = self->dict;
  421.       long_u    todo = dict->dv_hashtab.ht_used;
  422.       Py_ssize_t    i = 0;
  423.       PyObject    *r;
  424. ***************
  425. *** 880,887 ****
  426.   };
  427.   
  428.   static struct PyMethodDef DictionaryMethods[] = {
  429. !     {"keys", (PyCFunction)DictionaryListKeys, METH_NOARGS, ""},
  430. !     { NULL,        NULL,        0,        NULL }
  431.   };
  432.   
  433.   static PyTypeObject ListType;
  434. --- 868,875 ----
  435.   };
  436.   
  437.   static struct PyMethodDef DictionaryMethods[] = {
  438. !     {"keys",    (PyCFunction)DictionaryListKeys,    METH_NOARGS,    ""},
  439. !     { NULL,    NULL,                    0,        NULL }
  440.   };
  441.   
  442.   static PyTypeObject ListType;
  443. ***************
  444. *** 912,923 ****
  445.   }
  446.   
  447.       static void
  448. ! ListDestructor(PyObject *self)
  449.   {
  450. !     ListObject *this = (ListObject *)(self);
  451. !     pyll_remove(&this->ref, &lastlist);
  452. !     list_unref(this->list);
  453.   
  454.       DESTRUCTOR_FINISH(self);
  455.   }
  456. --- 900,909 ----
  457.   }
  458.   
  459.       static void
  460. ! ListDestructor(ListObject *self)
  461.   {
  462. !     pyll_remove(&self->ref, &lastlist);
  463. !     list_unref(self->list);
  464.   
  465.       DESTRUCTOR_FINISH(self);
  466.   }
  467. ***************
  468. *** 952,973 ****
  469.   }
  470.   
  471.       static PyInt
  472. ! ListLength(PyObject *self)
  473.   {
  474. !     return ((PyInt) (((ListObject *) (self))->list->lv_len));
  475.   }
  476.   
  477.       static PyObject *
  478. ! ListItem(PyObject *self, Py_ssize_t index)
  479.   {
  480.       listitem_T    *li;
  481.   
  482. !     if (index>=ListLength(self))
  483.       {
  484.       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  485.       return NULL;
  486.       }
  487. !     li = list_find(((ListObject *) (self))->list, (long) index);
  488.       if (li == NULL)
  489.       {
  490.       PyErr_SetVim(_("internal error: failed to get vim list item"));
  491. --- 938,959 ----
  492.   }
  493.   
  494.       static PyInt
  495. ! ListLength(ListObject *self)
  496.   {
  497. !     return ((PyInt) (self->list->lv_len));
  498.   }
  499.   
  500.       static PyObject *
  501. ! ListItem(ListObject *self, Py_ssize_t index)
  502.   {
  503.       listitem_T    *li;
  504.   
  505. !     if (index >= ListLength(self))
  506.       {
  507.       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  508.       return NULL;
  509.       }
  510. !     li = list_find(self->list, (long) index);
  511.       if (li == NULL)
  512.       {
  513.       PyErr_SetVim(_("internal error: failed to get vim list item"));
  514. ***************
  515. *** 991,997 ****
  516.       last = size;
  517.   
  518.       static PyObject *
  519. ! ListSlice(PyObject *self, Py_ssize_t first, Py_ssize_t last)
  520.   {
  521.       PyInt    i;
  522.       PyInt    size = ListLength(self);
  523. --- 977,983 ----
  524.       last = size;
  525.   
  526.       static PyObject *
  527. ! ListSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last)
  528.   {
  529.       PyInt    i;
  530.       PyInt    size = ListLength(self);
  531. ***************
  532. *** 1058,1067 ****
  533.   }
  534.   
  535.       static PyObject *
  536. ! ListIter(PyObject *self)
  537.   {
  538.       listiterinfo_T    *lii;
  539. !     list_T    *l = ((ListObject *) (self))->list;
  540.   
  541.       if (!(lii = PyMem_New(listiterinfo_T, 1)))
  542.       {
  543. --- 1044,1053 ----
  544.   }
  545.   
  546.       static PyObject *
  547. ! ListIter(ListObject *self)
  548.   {
  549.       listiterinfo_T    *lii;
  550. !     list_T    *l = self->list;
  551.   
  552.       if (!(lii = PyMem_New(listiterinfo_T, 1)))
  553.       {
  554. ***************
  555. *** 1079,1088 ****
  556.   }
  557.   
  558.       static int
  559. ! ListAssItem(PyObject *self, Py_ssize_t index, PyObject *obj)
  560.   {
  561.       typval_T    tv;
  562. !     list_T    *l = ((ListObject *) (self))->list;
  563.       listitem_T    *li;
  564.       Py_ssize_t    length = ListLength(self);
  565.   
  566. --- 1065,1074 ----
  567.   }
  568.   
  569.       static int
  570. ! ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj)
  571.   {
  572.       typval_T    tv;
  573. !     list_T    *l = self->list;
  574.       listitem_T    *li;
  575.       Py_ssize_t    length = ListLength(self);
  576.   
  577. ***************
  578. *** 1127,1133 ****
  579.   }
  580.   
  581.       static int
  582. ! ListAssSlice(PyObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
  583.   {
  584.       PyInt    size = ListLength(self);
  585.       Py_ssize_t    i;
  586. --- 1113,1119 ----
  587.   }
  588.   
  589.       static int
  590. ! ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
  591.   {
  592.       PyInt    size = ListLength(self);
  593.       Py_ssize_t    i;
  594. ***************
  595. *** 1136,1142 ****
  596.       listitem_T    *li;
  597.       listitem_T    *next;
  598.       typval_T    v;
  599. !     list_T    *l = ((ListObject *) (self))->list;
  600.   
  601.       if (l->lv_lock)
  602.       {
  603. --- 1122,1128 ----
  604.       listitem_T    *li;
  605.       listitem_T    *next;
  606.       typval_T    v;
  607. !     list_T    *l = self->list;
  608.   
  609.       if (l->lv_lock)
  610.       {
  611. ***************
  612. *** 1196,1204 ****
  613.   }
  614.   
  615.       static PyObject *
  616. ! ListConcatInPlace(PyObject *self, PyObject *obj)
  617.   {
  618. !     list_T    *l = ((ListObject *) (self))->list;
  619.       PyObject    *lookup_dict;
  620.   
  621.       if (l->lv_lock)
  622. --- 1182,1190 ----
  623.   }
  624.   
  625.       static PyObject *
  626. ! ListConcatInPlace(ListObject *self, PyObject *obj)
  627.   {
  628. !     list_T    *l = self->list;
  629.       PyObject    *lookup_dict;
  630.   
  631.       if (l->lv_lock)
  632. ***************
  633. *** 1222,1235 ****
  634.       Py_DECREF(lookup_dict);
  635.   
  636.       Py_INCREF(self);
  637. !     return self;
  638.   }
  639.   
  640.       static int
  641. ! ListSetattr(PyObject *self, char *name, PyObject *val)
  642.   {
  643. -     ListObject *this = (ListObject *)(self);
  644.       if (val == NULL)
  645.       {
  646.       PyErr_SetString(PyExc_AttributeError,
  647. --- 1208,1219 ----
  648.       Py_DECREF(lookup_dict);
  649.   
  650.       Py_INCREF(self);
  651. !     return (PyObject *)(self);
  652.   }
  653.   
  654.       static int
  655. ! ListSetattr(ListObject *self, char *name, PyObject *val)
  656.   {
  657.       if (val == NULL)
  658.       {
  659.       PyErr_SetString(PyExc_AttributeError,
  660. ***************
  661. *** 1239,1245 ****
  662.   
  663.       if (strcmp(name, "locked") == 0)
  664.       {
  665. !     if (this->list->lv_lock == VAR_FIXED)
  666.       {
  667.           PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
  668.           return -1;
  669. --- 1223,1229 ----
  670.   
  671.       if (strcmp(name, "locked") == 0)
  672.       {
  673. !     if (self->list->lv_lock == VAR_FIXED)
  674.       {
  675.           PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
  676.           return -1;
  677. ***************
  678. *** 1250,1258 ****
  679.           if (istrue == -1)
  680.           return -1;
  681.           else if (istrue)
  682. !         this->list->lv_lock = VAR_LOCKED;
  683.           else
  684. !         this->list->lv_lock = 0;
  685.       }
  686.       return 0;
  687.       }
  688. --- 1234,1242 ----
  689.           if (istrue == -1)
  690.           return -1;
  691.           else if (istrue)
  692. !         self->list->lv_lock = VAR_LOCKED;
  693.           else
  694. !         self->list->lv_lock = 0;
  695.       }
  696.       return 0;
  697.       }
  698. ***************
  699. *** 1264,1271 ****
  700.   }
  701.   
  702.   static struct PyMethodDef ListMethods[] = {
  703. !     {"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
  704. !     { NULL,        NULL,        0,        NULL }
  705.   };
  706.   
  707.   typedef struct
  708. --- 1248,1255 ----
  709.   }
  710.   
  711.   static struct PyMethodDef ListMethods[] = {
  712. !     {"extend",    (PyCFunction)ListConcatInPlace,    METH_O,    ""},
  713. !     { NULL,    NULL,                0,    NULL }
  714.   };
  715.   
  716.   typedef struct
  717. ***************
  718. *** 1296,1316 ****
  719.   }
  720.   
  721.       static void
  722. ! FunctionDestructor(PyObject *self)
  723.   {
  724. !     FunctionObject    *this = (FunctionObject *) (self);
  725. !     func_unref(this->name);
  726. !     PyMem_Free(this->name);
  727.   
  728.       DESTRUCTOR_FINISH(self);
  729.   }
  730.   
  731.       static PyObject *
  732. ! FunctionCall(PyObject *self, PyObject *argsObject, PyObject *kwargs)
  733.   {
  734. !     FunctionObject    *this = (FunctionObject *)(self);
  735. !     char_u    *name = this->name;
  736.       typval_T    args;
  737.       typval_T    selfdicttv;
  738.       typval_T    rettv;
  739. --- 1280,1297 ----
  740.   }
  741.   
  742.       static void
  743. ! FunctionDestructor(FunctionObject *self)
  744.   {
  745. !     func_unref(self->name);
  746. !     PyMem_Free(self->name);
  747.   
  748.       DESTRUCTOR_FINISH(self);
  749.   }
  750.   
  751.       static PyObject *
  752. ! FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs)
  753.   {
  754. !     char_u    *name = self->name;
  755.       typval_T    args;
  756.       typval_T    selfdicttv;
  757.       typval_T    rettv;
  758. ***************
  759. *** 1368,1375 ****
  760.   }
  761.   
  762.   static struct PyMethodDef FunctionMethods[] = {
  763. !     {"__call__",    (PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
  764. !     { NULL,        NULL,        0,        NULL }
  765.   };
  766.   
  767.   /*
  768. --- 1349,1356 ----
  769.   }
  770.   
  771.   static struct PyMethodDef FunctionMethods[] = {
  772. !     {"__call__",    (PyCFunction)FunctionCall,    METH_VARARGS|METH_KEYWORDS, ""},
  773. !     { NULL,        NULL,            0,               NULL}
  774.   };
  775.   
  776.   /*
  777. ***************
  778. *** 1415,1443 ****
  779.   }
  780.   
  781.       static void
  782. ! OptionsDestructor(PyObject *self)
  783.   {
  784. !     if (((OptionsObject *)(self))->fromObj)
  785. !     Py_DECREF(((OptionsObject *)(self))->fromObj);
  786.       DESTRUCTOR_FINISH(self);
  787.   }
  788.   
  789.       static int
  790. ! OptionsTraverse(PyObject *self, visitproc visit, void *arg)
  791.   {
  792. !     Py_VISIT(((OptionsObject *)(self))->fromObj);
  793.       return 0;
  794.   }
  795.   
  796.       static int
  797. ! OptionsClear(PyObject *self)
  798.   {
  799. !     Py_CLEAR(((OptionsObject *)(self))->fromObj);
  800.       return 0;
  801.   }
  802.   
  803.       static PyObject *
  804. ! OptionsItem(OptionsObject *this, PyObject *keyObject)
  805.   {
  806.       char_u    *key;
  807.       int        flags;
  808. --- 1396,1424 ----
  809.   }
  810.   
  811.       static void
  812. ! OptionsDestructor(OptionsObject *self)
  813.   {
  814. !     if (self->fromObj)
  815. !     Py_DECREF(self->fromObj);
  816.       DESTRUCTOR_FINISH(self);
  817.   }
  818.   
  819.       static int
  820. ! OptionsTraverse(OptionsObject *self, visitproc visit, void *arg)
  821.   {
  822. !     Py_VISIT(self->fromObj);
  823.       return 0;
  824.   }
  825.   
  826.       static int
  827. ! OptionsClear(OptionsObject *self)
  828.   {
  829. !     Py_CLEAR(self->fromObj);
  830.       return 0;
  831.   }
  832.   
  833.       static PyObject *
  834. ! OptionsItem(OptionsObject *self, PyObject *keyObject)
  835.   {
  836.       char_u    *key;
  837.       int        flags;
  838. ***************
  839. *** 1445,1457 ****
  840.       char_u    *stringval;
  841.       DICTKEY_DECL
  842.   
  843. !     if (this->Check(this->from))
  844.       return NULL;
  845.   
  846.       DICTKEY_GET_NOTEMPTY(NULL)
  847.   
  848.       flags = get_option_value_strict(key, &numval, &stringval,
  849. !                     this->opt_type, this->from);
  850.   
  851.       DICTKEY_UNREF
  852.   
  853. --- 1426,1438 ----
  854.       char_u    *stringval;
  855.       DICTKEY_DECL
  856.   
  857. !     if (self->Check(self->from))
  858.       return NULL;
  859.   
  860.       DICTKEY_GET_NOTEMPTY(NULL)
  861.   
  862.       flags = get_option_value_strict(key, &numval, &stringval,
  863. !                     self->opt_type, self->from);
  864.   
  865.       DICTKEY_UNREF
  866.   
  867. ***************
  868. *** 1532,1538 ****
  869.   }
  870.   
  871.       static int
  872. ! OptionsAssItem(OptionsObject *this, PyObject *keyObject, PyObject *valObject)
  873.   {
  874.       char_u    *key;
  875.       int        flags;
  876. --- 1513,1519 ----
  877.   }
  878.   
  879.       static int
  880. ! OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
  881.   {
  882.       char_u    *key;
  883.       int        flags;
  884. ***************
  885. *** 1540,1552 ****
  886.       int        r = 0;
  887.       DICTKEY_DECL
  888.   
  889. !     if (this->Check(this->from))
  890.       return -1;
  891.   
  892.       DICTKEY_GET_NOTEMPTY(-1)
  893.   
  894.       flags = get_option_value_strict(key, NULL, NULL,
  895. !                     this->opt_type, this->from);
  896.   
  897.       DICTKEY_UNREF
  898.   
  899. --- 1521,1533 ----
  900.       int        r = 0;
  901.       DICTKEY_DECL
  902.   
  903. !     if (self->Check(self->from))
  904.       return -1;
  905.   
  906.       DICTKEY_GET_NOTEMPTY(-1)
  907.   
  908.       flags = get_option_value_strict(key, NULL, NULL,
  909. !                     self->opt_type, self->from);
  910.   
  911.       DICTKEY_UNREF
  912.   
  913. ***************
  914. *** 1558,1564 ****
  915.   
  916.       if (valObject == NULL)
  917.       {
  918. !     if (this->opt_type == SREQ_GLOBAL)
  919.       {
  920.           PyErr_SetString(PyExc_ValueError,
  921.               _("unable to unset global option"));
  922. --- 1539,1545 ----
  923.   
  924.       if (valObject == NULL)
  925.       {
  926. !     if (self->opt_type == SREQ_GLOBAL)
  927.       {
  928.           PyErr_SetString(PyExc_ValueError,
  929.               _("unable to unset global option"));
  930. ***************
  931. *** 1572,1583 ****
  932.       }
  933.       else
  934.       {
  935. !         unset_global_local_option(key, this->from);
  936.           return 0;
  937.       }
  938.       }
  939.   
  940. !     opt_flags = (this->opt_type ? OPT_LOCAL : OPT_GLOBAL);
  941.   
  942.       if (flags & SOPT_BOOL)
  943.       {
  944. --- 1553,1564 ----
  945.       }
  946.       else
  947.       {
  948. !         unset_global_local_option(key, self->from);
  949.           return 0;
  950.       }
  951.       }
  952.   
  953. !     opt_flags = (self->opt_type ? OPT_LOCAL : OPT_GLOBAL);
  954.   
  955.       if (flags & SOPT_BOOL)
  956.       {
  957. ***************
  958. *** 1585,1591 ****
  959.       if (istrue == -1)
  960.           return -1;
  961.       r = set_option_value_for(key, istrue, NULL,
  962. !                 opt_flags, this->opt_type, this->from);
  963.       }
  964.       else if (flags & SOPT_NUM)
  965.       {
  966. --- 1566,1572 ----
  967.       if (istrue == -1)
  968.           return -1;
  969.       r = set_option_value_for(key, istrue, NULL,
  970. !                 opt_flags, self->opt_type, self->from);
  971.       }
  972.       else if (flags & SOPT_NUM)
  973.       {
  974. ***************
  975. *** 1605,1611 ****
  976.       }
  977.   
  978.       r = set_option_value_for(key, val, NULL, opt_flags,
  979. !                 this->opt_type, this->from);
  980.       }
  981.       else
  982.       {
  983. --- 1586,1592 ----
  984.       }
  985.   
  986.       r = set_option_value_for(key, val, NULL, opt_flags,
  987. !                 self->opt_type, self->from);
  988.       }
  989.       else
  990.       {
  991. ***************
  992. *** 1643,1649 ****
  993.       }
  994.   
  995.       r = set_option_value_for(key, 0, val, opt_flags,
  996. !                 this->opt_type, this->from);
  997.       vim_free(val);
  998.       }
  999.   
  1000. --- 1624,1630 ----
  1001.       }
  1002.   
  1003.       r = set_option_value_for(key, 0, val, opt_flags,
  1004. !                 self->opt_type, self->from);
  1005.       vim_free(val);
  1006.       }
  1007.   
  1008. ***************
  1009. *** 1670,1678 ****
  1010.   static PyTypeObject TabPageType;
  1011.   
  1012.       static int
  1013. ! CheckTabPage(TabPageObject *this)
  1014.   {
  1015. !     if (this->tab == INVALID_TABPAGE_VALUE)
  1016.       {
  1017.       PyErr_SetVim(_("attempt to refer to deleted tab page"));
  1018.       return -1;
  1019. --- 1651,1659 ----
  1020.   static PyTypeObject TabPageType;
  1021.   
  1022.       static int
  1023. ! CheckTabPage(TabPageObject *self)
  1024.   {
  1025. !     if (self->tab == INVALID_TABPAGE_VALUE)
  1026.       {
  1027.       PyErr_SetVim(_("attempt to refer to deleted tab page"));
  1028.       return -1;
  1029. ***************
  1030. *** 1704,1754 ****
  1031.   }
  1032.   
  1033.       static void
  1034. ! TabPageDestructor(PyObject *self)
  1035.   {
  1036. !     TabPageObject *this = (TabPageObject *)(self);
  1037. !     if (this->tab && this->tab != INVALID_TABPAGE_VALUE)
  1038. !     TAB_PYTHON_REF(this->tab) = NULL;
  1039.   
  1040.       DESTRUCTOR_FINISH(self);
  1041.   }
  1042.   
  1043.       static PyObject *
  1044. ! TabPageAttr(TabPageObject *this, char *name)
  1045.   {
  1046.       if (strcmp(name, "windows") == 0)
  1047. !     return WinListNew(this);
  1048.       else if (strcmp(name, "number") == 0)
  1049. !     return PyLong_FromLong((long) get_tab_number(this->tab));
  1050.       else if (strcmp(name, "vars") == 0)
  1051. !     return DictionaryNew(this->tab->tp_vars);
  1052.       else if (strcmp(name, "window") == 0)
  1053.       {
  1054.       /* For current tab window.c does not bother to set or update tp_curwin
  1055.        */
  1056. !     if (this->tab == curtab)
  1057.           return WindowNew(curwin, curtab);
  1058.       else
  1059. !         return WindowNew(this->tab->tp_curwin, this->tab);
  1060.       }
  1061.       return NULL;
  1062.   }
  1063.   
  1064.       static PyObject *
  1065. ! TabPageRepr(PyObject *self)
  1066.   {
  1067.       static char repr[100];
  1068. -     TabPageObject *this = (TabPageObject *)(self);
  1069.   
  1070. !     if (this->tab == INVALID_TABPAGE_VALUE)
  1071.       {
  1072.       vim_snprintf(repr, 100, _("<tabpage object (deleted) at %p>"), (self));
  1073.       return PyString_FromString(repr);
  1074.       }
  1075.       else
  1076.       {
  1077. !     int    t = get_tab_number(this->tab);
  1078.   
  1079.       if (t == 0)
  1080.           vim_snprintf(repr, 100, _("<tabpage object (unknown) at %p>"),
  1081. --- 1685,1732 ----
  1082.   }
  1083.   
  1084.       static void
  1085. ! TabPageDestructor(TabPageObject *self)
  1086.   {
  1087. !     if (self->tab && self->tab != INVALID_TABPAGE_VALUE)
  1088. !     TAB_PYTHON_REF(self->tab) = NULL;
  1089.   
  1090.       DESTRUCTOR_FINISH(self);
  1091.   }
  1092.   
  1093.       static PyObject *
  1094. ! TabPageAttr(TabPageObject *self, char *name)
  1095.   {
  1096.       if (strcmp(name, "windows") == 0)
  1097. !     return WinListNew(self);
  1098.       else if (strcmp(name, "number") == 0)
  1099. !     return PyLong_FromLong((long) get_tab_number(self->tab));
  1100.       else if (strcmp(name, "vars") == 0)
  1101. !     return DictionaryNew(self->tab->tp_vars);
  1102.       else if (strcmp(name, "window") == 0)
  1103.       {
  1104.       /* For current tab window.c does not bother to set or update tp_curwin
  1105.        */
  1106. !     if (self->tab == curtab)
  1107.           return WindowNew(curwin, curtab);
  1108.       else
  1109. !         return WindowNew(self->tab->tp_curwin, self->tab);
  1110.       }
  1111.       return NULL;
  1112.   }
  1113.   
  1114.       static PyObject *
  1115. ! TabPageRepr(TabPageObject *self)
  1116.   {
  1117.       static char repr[100];
  1118.   
  1119. !     if (self->tab == INVALID_TABPAGE_VALUE)
  1120.       {
  1121.       vim_snprintf(repr, 100, _("<tabpage object (deleted) at %p>"), (self));
  1122.       return PyString_FromString(repr);
  1123.       }
  1124.       else
  1125.       {
  1126. !     int    t = get_tab_number(self->tab);
  1127.   
  1128.       if (t == 0)
  1129.           vim_snprintf(repr, 100, _("<tabpage object (unknown) at %p>"),
  1130. ***************
  1131. *** 1818,1826 ****
  1132.   static PyTypeObject WindowType;
  1133.   
  1134.       static int
  1135. ! CheckWindow(WindowObject *this)
  1136.   {
  1137. !     if (this->win == INVALID_WINDOW_VALUE)
  1138.       {
  1139.       PyErr_SetVim(_("attempt to refer to deleted window"));
  1140.       return -1;
  1141. --- 1796,1804 ----
  1142.   static PyTypeObject WindowType;
  1143.   
  1144.       static int
  1145. ! CheckWindow(WindowObject *self)
  1146.   {
  1147. !     if (self->win == INVALID_WINDOW_VALUE)
  1148.       {
  1149.       PyErr_SetVim(_("attempt to refer to deleted window"));
  1150.       return -1;
  1151. ***************
  1152. *** 1869,1882 ****
  1153.   }
  1154.   
  1155.       static void
  1156. ! WindowDestructor(PyObject *self)
  1157.   {
  1158. !     WindowObject *this = (WindowObject *)(self);
  1159. !     if (this->win && this->win != INVALID_WINDOW_VALUE)
  1160. !     WIN_PYTHON_REF(this->win) = NULL;
  1161.   
  1162. !     Py_DECREF(((PyObject *)(this->tabObject)));
  1163.   
  1164.       DESTRUCTOR_FINISH(self);
  1165.   }
  1166. --- 1847,1858 ----
  1167.   }
  1168.   
  1169.       static void
  1170. ! WindowDestructor(WindowObject *self)
  1171.   {
  1172. !     if (self->win && self->win != INVALID_WINDOW_VALUE)
  1173. !     WIN_PYTHON_REF(self->win) = NULL;
  1174.   
  1175. !     Py_DECREF(((PyObject *)(self->tabObject)));
  1176.   
  1177.       DESTRUCTOR_FINISH(self);
  1178.   }
  1179. ***************
  1180. *** 1899,1956 ****
  1181.       return firstwin;
  1182.   }
  1183.       static int
  1184. ! WindowTraverse(PyObject *self, visitproc visit, void *arg)
  1185.   {
  1186. !     Py_VISIT(((PyObject *)(((WindowObject *)(self))->tabObject)));
  1187.       return 0;
  1188.   }
  1189.   
  1190.       static int
  1191. ! WindowClear(PyObject *self)
  1192.   {
  1193. !     Py_CLEAR((((WindowObject *)(self))->tabObject));
  1194.       return 0;
  1195.   }
  1196.   
  1197.       static PyObject *
  1198. ! WindowAttr(WindowObject *this, char *name)
  1199.   {
  1200.       if (strcmp(name, "buffer") == 0)
  1201. !     return (PyObject *)BufferNew(this->win->w_buffer);
  1202.       else if (strcmp(name, "cursor") == 0)
  1203.       {
  1204. !     pos_T *pos = &this->win->w_cursor;
  1205.   
  1206.       return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
  1207.       }
  1208.       else if (strcmp(name, "height") == 0)
  1209. !     return PyLong_FromLong((long)(this->win->w_height));
  1210.   #ifdef FEAT_WINDOWS
  1211.       else if (strcmp(name, "row") == 0)
  1212. !     return PyLong_FromLong((long)(this->win->w_winrow));
  1213.   #endif
  1214.   #ifdef FEAT_VERTSPLIT
  1215.       else if (strcmp(name, "width") == 0)
  1216. !     return PyLong_FromLong((long)(W_WIDTH(this->win)));
  1217.       else if (strcmp(name, "col") == 0)
  1218. !     return PyLong_FromLong((long)(W_WINCOL(this->win)));
  1219.   #endif
  1220.       else if (strcmp(name, "vars") == 0)
  1221. !     return DictionaryNew(this->win->w_vars);
  1222.       else if (strcmp(name, "options") == 0)
  1223. !     return OptionsNew(SREQ_WIN, this->win, (checkfun) CheckWindow,
  1224. !             (PyObject *) this);
  1225.       else if (strcmp(name, "number") == 0)
  1226.       {
  1227. !     if (CheckTabPage(this->tabObject))
  1228.           return NULL;
  1229.       return PyLong_FromLong((long)
  1230. !         get_win_number(this->win, get_firstwin(this->tabObject)));
  1231.       }
  1232.       else if (strcmp(name, "tabpage") == 0)
  1233.       {
  1234. !     Py_INCREF(this->tabObject);
  1235. !     return (PyObject *)(this->tabObject);
  1236.       }
  1237.       else if (strcmp(name,"__members__") == 0)
  1238.       return Py_BuildValue("[sssssssss]", "buffer", "cursor", "height",
  1239. --- 1875,1932 ----
  1240.       return firstwin;
  1241.   }
  1242.       static int
  1243. ! WindowTraverse(WindowObject *self, visitproc visit, void *arg)
  1244.   {
  1245. !     Py_VISIT(((PyObject *)(self->tabObject)));
  1246.       return 0;
  1247.   }
  1248.   
  1249.       static int
  1250. ! WindowClear(WindowObject *self)
  1251.   {
  1252. !     Py_CLEAR(self->tabObject);
  1253.       return 0;
  1254.   }
  1255.   
  1256.       static PyObject *
  1257. ! WindowAttr(WindowObject *self, char *name)
  1258.   {
  1259.       if (strcmp(name, "buffer") == 0)
  1260. !     return (PyObject *)BufferNew(self->win->w_buffer);
  1261.       else if (strcmp(name, "cursor") == 0)
  1262.       {
  1263. !     pos_T *pos = &self->win->w_cursor;
  1264.   
  1265.       return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
  1266.       }
  1267.       else if (strcmp(name, "height") == 0)
  1268. !     return PyLong_FromLong((long)(self->win->w_height));
  1269.   #ifdef FEAT_WINDOWS
  1270.       else if (strcmp(name, "row") == 0)
  1271. !     return PyLong_FromLong((long)(self->win->w_winrow));
  1272.   #endif
  1273.   #ifdef FEAT_VERTSPLIT
  1274.       else if (strcmp(name, "width") == 0)
  1275. !     return PyLong_FromLong((long)(W_WIDTH(self->win)));
  1276.       else if (strcmp(name, "col") == 0)
  1277. !     return PyLong_FromLong((long)(W_WINCOL(self->win)));
  1278.   #endif
  1279.       else if (strcmp(name, "vars") == 0)
  1280. !     return DictionaryNew(self->win->w_vars);
  1281.       else if (strcmp(name, "options") == 0)
  1282. !     return OptionsNew(SREQ_WIN, self->win, (checkfun) CheckWindow,
  1283. !             (PyObject *) self);
  1284.       else if (strcmp(name, "number") == 0)
  1285.       {
  1286. !     if (CheckTabPage(self->tabObject))
  1287.           return NULL;
  1288.       return PyLong_FromLong((long)
  1289. !         get_win_number(self->win, get_firstwin(self->tabObject)));
  1290.       }
  1291.       else if (strcmp(name, "tabpage") == 0)
  1292.       {
  1293. !     Py_INCREF(self->tabObject);
  1294. !     return (PyObject *)(self->tabObject);
  1295.       }
  1296.       else if (strcmp(name,"__members__") == 0)
  1297.       return Py_BuildValue("[sssssssss]", "buffer", "cursor", "height",
  1298. ***************
  1299. *** 1960,1970 ****
  1300.   }
  1301.   
  1302.       static int
  1303. ! WindowSetattr(PyObject *self, char *name, PyObject *val)
  1304.   {
  1305. !     WindowObject *this = (WindowObject *)(self);
  1306. !     if (CheckWindow(this))
  1307.       return -1;
  1308.   
  1309.       if (strcmp(name, "buffer") == 0)
  1310. --- 1936,1944 ----
  1311.   }
  1312.   
  1313.       static int
  1314. ! WindowSetattr(WindowObject *self, char *name, PyObject *val)
  1315.   {
  1316. !     if (CheckWindow(self))
  1317.       return -1;
  1318.   
  1319.       if (strcmp(name, "buffer") == 0)
  1320. ***************
  1321. *** 1980,1986 ****
  1322.       if (!PyArg_Parse(val, "(ll)", &lnum, &col))
  1323.           return -1;
  1324.   
  1325. !     if (lnum <= 0 || lnum > this->win->w_buffer->b_ml.ml_line_count)
  1326.       {
  1327.           PyErr_SetVim(_("cursor position outside buffer"));
  1328.           return -1;
  1329. --- 1954,1960 ----
  1330.       if (!PyArg_Parse(val, "(ll)", &lnum, &col))
  1331.           return -1;
  1332.   
  1333. !     if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
  1334.       {
  1335.           PyErr_SetVim(_("cursor position outside buffer"));
  1336.           return -1;
  1337. ***************
  1338. *** 1990,2002 ****
  1339.       if (VimErrorCheck())
  1340.           return -1;
  1341.   
  1342. !     this->win->w_cursor.lnum = lnum;
  1343. !     this->win->w_cursor.col = col;
  1344.   #ifdef FEAT_VIRTUALEDIT
  1345. !     this->win->w_cursor.coladd = 0;
  1346.   #endif
  1347.       /* When column is out of range silently correct it. */
  1348. !     check_cursor_col_win(this->win);
  1349.   
  1350.       update_screen(VALID);
  1351.       return 0;
  1352. --- 1964,1976 ----
  1353.       if (VimErrorCheck())
  1354.           return -1;
  1355.   
  1356. !     self->win->w_cursor.lnum = lnum;
  1357. !     self->win->w_cursor.col = col;
  1358.   #ifdef FEAT_VIRTUALEDIT
  1359. !     self->win->w_cursor.coladd = 0;
  1360.   #endif
  1361.       /* When column is out of range silently correct it. */
  1362. !     check_cursor_col_win(self->win);
  1363.   
  1364.       update_screen(VALID);
  1365.       return 0;
  1366. ***************
  1367. *** 2013,2019 ****
  1368.       need_mouse_correct = TRUE;
  1369.   #endif
  1370.       savewin = curwin;
  1371. !     curwin = this->win;
  1372.       win_setheight(height);
  1373.       curwin = savewin;
  1374.   
  1375. --- 1987,1993 ----
  1376.       need_mouse_correct = TRUE;
  1377.   #endif
  1378.       savewin = curwin;
  1379. !     curwin = self->win;
  1380.       win_setheight(height);
  1381.       curwin = savewin;
  1382.   
  1383. ***************
  1384. *** 2036,2042 ****
  1385.       need_mouse_correct = TRUE;
  1386.   #endif
  1387.       savewin = curwin;
  1388. !     curwin = this->win;
  1389.       win_setwidth(width);
  1390.       curwin = savewin;
  1391.   
  1392. --- 2010,2016 ----
  1393.       need_mouse_correct = TRUE;
  1394.   #endif
  1395.       savewin = curwin;
  1396. !     curwin = self->win;
  1397.       win_setwidth(width);
  1398.       curwin = savewin;
  1399.   
  1400. ***************
  1401. *** 2055,2073 ****
  1402.   }
  1403.   
  1404.       static PyObject *
  1405. ! WindowRepr(PyObject *self)
  1406.   {
  1407.       static char repr[100];
  1408. -     WindowObject *this = (WindowObject *)(self);
  1409.   
  1410. !     if (this->win == INVALID_WINDOW_VALUE)
  1411.       {
  1412.       vim_snprintf(repr, 100, _("<window object (deleted) at %p>"), (self));
  1413.       return PyString_FromString(repr);
  1414.       }
  1415.       else
  1416.       {
  1417. !     int    w = get_win_number(this->win, firstwin);
  1418.   
  1419.       if (w == 0)
  1420.           vim_snprintf(repr, 100, _("<window object (unknown) at %p>"),
  1421. --- 2029,2046 ----
  1422.   }
  1423.   
  1424.       static PyObject *
  1425. ! WindowRepr(WindowObject *self)
  1426.   {
  1427.       static char repr[100];
  1428.   
  1429. !     if (self->win == INVALID_WINDOW_VALUE)
  1430.       {
  1431.       vim_snprintf(repr, 100, _("<window object (deleted) at %p>"), (self));
  1432.       return PyString_FromString(repr);
  1433.       }
  1434.       else
  1435.       {
  1436. !     int    w = get_win_number(self->win, firstwin);
  1437.   
  1438.       if (w == 0)
  1439.           vim_snprintf(repr, 100, _("<window object (unknown) at %p>"),
  1440. ***************
  1441. *** 2110,2118 ****
  1442.   }
  1443.   
  1444.       static void
  1445. ! WinListDestructor(PyObject *self)
  1446.   {
  1447. !     TabPageObject    *tabObject = ((WinListObject *)(self))->tabObject;
  1448.   
  1449.       if (tabObject)
  1450.       Py_DECREF((PyObject *)(tabObject));
  1451. --- 2083,2091 ----
  1452.   }
  1453.   
  1454.       static void
  1455. ! WinListDestructor(WinListObject *self)
  1456.   {
  1457. !     TabPageObject    *tabObject = self->tabObject;
  1458.   
  1459.       if (tabObject)
  1460.       Py_DECREF((PyObject *)(tabObject));
  1461. ***************
  1462. *** 2121,2132 ****
  1463.   }
  1464.   
  1465.       static PyInt
  1466. ! WinListLength(PyObject *self)
  1467.   {
  1468.       win_T    *w;
  1469.       PyInt    n = 0;
  1470.   
  1471. !     if (!(w = get_firstwin(((WinListObject *)(self))->tabObject)))
  1472.       return -1;
  1473.   
  1474.       while (w != NULL)
  1475. --- 2094,2105 ----
  1476.   }
  1477.   
  1478.       static PyInt
  1479. ! WinListLength(WinListObject *self)
  1480.   {
  1481.       win_T    *w;
  1482.       PyInt    n = 0;
  1483.   
  1484. !     if (!(w = get_firstwin(self->tabObject)))
  1485.       return -1;
  1486.   
  1487.       while (w != NULL)
  1488. ***************
  1489. *** 2139,2155 ****
  1490.   }
  1491.   
  1492.       static PyObject *
  1493. ! WinListItem(PyObject *self, PyInt n)
  1494.   {
  1495. -     WinListObject    *this = ((WinListObject *)(self));
  1496.       win_T *w;
  1497.   
  1498. !     if (!(w = get_firstwin(this->tabObject)))
  1499.       return NULL;
  1500.   
  1501.       for (; w != NULL; w = W_NEXT(w), --n)
  1502.       if (n == 0)
  1503. !         return WindowNew(w, this->tabObject? this->tabObject->tab: curtab);
  1504.   
  1505.       PyErr_SetString(PyExc_IndexError, _("no such window"));
  1506.       return NULL;
  1507. --- 2112,2127 ----
  1508.   }
  1509.   
  1510.       static PyObject *
  1511. ! WinListItem(WinListObject *self, PyInt n)
  1512.   {
  1513.       win_T *w;
  1514.   
  1515. !     if (!(w = get_firstwin(self->tabObject)))
  1516.       return NULL;
  1517.   
  1518.       for (; w != NULL; w = W_NEXT(w), --n)
  1519.       if (n == 0)
  1520. !         return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
  1521.   
  1522.       PyErr_SetString(PyExc_IndexError, _("no such window"));
  1523.       return NULL;
  1524. ***************
  1525. *** 2721,2729 ****
  1526.   } BufferObject;
  1527.   
  1528.       static int
  1529. ! CheckBuffer(BufferObject *this)
  1530.   {
  1531. !     if (this->buf == INVALID_BUFFER_VALUE)
  1532.       {
  1533.       PyErr_SetVim(_("attempt to refer to deleted buffer"));
  1534.       return -1;
  1535. --- 2693,2701 ----
  1536.   } BufferObject;
  1537.   
  1538.       static int
  1539. ! CheckBuffer(BufferObject *self)
  1540.   {
  1541. !     if (self->buf == INVALID_BUFFER_VALUE)
  1542.       {
  1543.       PyErr_SetVim(_("attempt to refer to deleted buffer"));
  1544.       return -1;
  1545. ***************
  1546. *** 2922,2975 ****
  1547.   }
  1548.   
  1549.       static void
  1550. ! RangeDestructor(PyObject *self)
  1551.   {
  1552. !     Py_DECREF(((RangeObject *)(self))->buf);
  1553.       DESTRUCTOR_FINISH(self);
  1554.   }
  1555.   
  1556.       static PyInt
  1557. ! RangeLength(PyObject *self)
  1558.   {
  1559.       /* HOW DO WE SIGNAL AN ERROR FROM THIS FUNCTION? */
  1560. !     if (CheckBuffer(((RangeObject *)(self))->buf))
  1561.       return -1; /* ??? */
  1562.   
  1563. !     return (((RangeObject *)(self))->end - ((RangeObject *)(self))->start + 1);
  1564.   }
  1565.   
  1566.       static PyObject *
  1567. ! RangeItem(PyObject *self, PyInt n)
  1568.   {
  1569. !     return RBItem(((RangeObject *)(self))->buf, n,
  1570. !           ((RangeObject *)(self))->start,
  1571. !           ((RangeObject *)(self))->end);
  1572.   }
  1573.   
  1574.       static PyObject *
  1575. ! RangeSlice(PyObject *self, PyInt lo, PyInt hi)
  1576.   {
  1577. !     return RBSlice(((RangeObject *)(self))->buf, lo, hi,
  1578. !            ((RangeObject *)(self))->start,
  1579. !            ((RangeObject *)(self))->end);
  1580.   }
  1581.   
  1582.       static PyObject *
  1583. ! RangeAppend(PyObject *self, PyObject *args)
  1584.   {
  1585. !     return RBAppend(((RangeObject *)(self))->buf, args,
  1586. !             ((RangeObject *)(self))->start,
  1587. !             ((RangeObject *)(self))->end,
  1588. !             &((RangeObject *)(self))->end);
  1589.   }
  1590.   
  1591.       static PyObject *
  1592. ! RangeRepr(PyObject *self)
  1593.   {
  1594.       static char repr[100];
  1595. -     RangeObject *this = (RangeObject *)(self);
  1596.   
  1597. !     if (this->buf->buf == INVALID_BUFFER_VALUE)
  1598.       {
  1599.       vim_snprintf(repr, 100, "<range object (for deleted buffer) at %p>",
  1600.                                         (self));
  1601. --- 2894,2939 ----
  1602.   }
  1603.   
  1604.       static void
  1605. ! RangeDestructor(RangeObject *self)
  1606.   {
  1607. !     Py_DECREF(self->buf);
  1608.       DESTRUCTOR_FINISH(self);
  1609.   }
  1610.   
  1611.       static PyInt
  1612. ! RangeLength(RangeObject *self)
  1613.   {
  1614.       /* HOW DO WE SIGNAL AN ERROR FROM THIS FUNCTION? */
  1615. !     if (CheckBuffer(self->buf))
  1616.       return -1; /* ??? */
  1617.   
  1618. !     return (self->end - self->start + 1);
  1619.   }
  1620.   
  1621.       static PyObject *
  1622. ! RangeItem(RangeObject *self, PyInt n)
  1623.   {
  1624. !     return RBItem(self->buf, n, self->start, self->end);
  1625.   }
  1626.   
  1627.       static PyObject *
  1628. ! RangeSlice(RangeObject *self, PyInt lo, PyInt hi)
  1629.   {
  1630. !     return RBSlice(self->buf, lo, hi, self->start, self->end);
  1631.   }
  1632.   
  1633.       static PyObject *
  1634. ! RangeAppend(RangeObject *self, PyObject *args)
  1635.   {
  1636. !     return RBAppend(self->buf, args, self->start, self->end, &self->end);
  1637.   }
  1638.   
  1639.       static PyObject *
  1640. ! RangeRepr(RangeObject *self)
  1641.   {
  1642.       static char repr[100];
  1643.   
  1644. !     if (self->buf->buf == INVALID_BUFFER_VALUE)
  1645.       {
  1646.       vim_snprintf(repr, 100, "<range object (for deleted buffer) at %p>",
  1647.                                         (self));
  1648. ***************
  1649. *** 2977,2983 ****
  1650.       }
  1651.       else
  1652.       {
  1653. !     char *name = (char *)this->buf->buf->b_fname;
  1654.       int len;
  1655.   
  1656.       if (name == NULL)
  1657. --- 2941,2947 ----
  1658.       }
  1659.       else
  1660.       {
  1661. !     char *name = (char *)self->buf->buf->b_fname;
  1662.       int len;
  1663.   
  1664.       if (name == NULL)
  1665. ***************
  1666. *** 2989,3004 ****
  1667.   
  1668.       vim_snprintf(repr, 100, "<range %s%s (%d:%d)>",
  1669.           len > 45 ? "..." : "", name,
  1670. !         this->start, this->end);
  1671.   
  1672.       return PyString_FromString(repr);
  1673.       }
  1674.   }
  1675.   
  1676.   static struct PyMethodDef RangeMethods[] = {
  1677. !     /* name,        function,        calling,    documentation */
  1678. !     {"append",        RangeAppend,    1,        "Append data to the Vim range" },
  1679. !     { NULL,        NULL,        0,        NULL }
  1680.   };
  1681.   
  1682.   static PyTypeObject BufferType;
  1683. --- 2953,2968 ----
  1684.   
  1685.       vim_snprintf(repr, 100, "<range %s%s (%d:%d)>",
  1686.           len > 45 ? "..." : "", name,
  1687. !         self->start, self->end);
  1688.   
  1689.       return PyString_FromString(repr);
  1690.       }
  1691.   }
  1692.   
  1693.   static struct PyMethodDef RangeMethods[] = {
  1694. !     /* name,    function,            calling,    documentation */
  1695. !     {"append",    (PyCFunction)RangeAppend,    METH_VARARGS,    "Append data to the Vim range" },
  1696. !     { NULL,    NULL,                0,        NULL }
  1697.   };
  1698.   
  1699.   static PyTypeObject BufferType;
  1700. ***************
  1701. *** 3045,3094 ****
  1702.   }
  1703.   
  1704.       static void
  1705. ! BufferDestructor(PyObject *self)
  1706.   {
  1707. !     BufferObject *this = (BufferObject *)(self);
  1708. !     if (this->buf && this->buf != INVALID_BUFFER_VALUE)
  1709. !     BUF_PYTHON_REF(this->buf) = NULL;
  1710.   
  1711.       DESTRUCTOR_FINISH(self);
  1712.   }
  1713.   
  1714.       static PyInt
  1715. ! BufferLength(PyObject *self)
  1716.   {
  1717.       /* HOW DO WE SIGNAL AN ERROR FROM THIS FUNCTION? */
  1718. !     if (CheckBuffer((BufferObject *)(self)))
  1719.       return -1; /* ??? */
  1720.   
  1721. !     return (PyInt)(((BufferObject *)(self))->buf->b_ml.ml_line_count);
  1722.   }
  1723.   
  1724.       static PyObject *
  1725. ! BufferItem(PyObject *self, PyInt n)
  1726.   {
  1727. !     return RBItem((BufferObject *)(self), n, 1, -1);
  1728.   }
  1729.   
  1730.       static PyObject *
  1731. ! BufferSlice(PyObject *self, PyInt lo, PyInt hi)
  1732.   {
  1733. !     return RBSlice((BufferObject *)(self), lo, hi, 1, -1);
  1734.   }
  1735.   
  1736.       static PyObject *
  1737. ! BufferAttr(BufferObject *this, char *name)
  1738.   {
  1739.       if (strcmp(name, "name") == 0)
  1740. !     return Py_BuildValue("s", this->buf->b_ffname);
  1741.       else if (strcmp(name, "number") == 0)
  1742. !     return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
  1743.       else if (strcmp(name, "vars") == 0)
  1744. !     return DictionaryNew(this->buf->b_vars);
  1745.       else if (strcmp(name, "options") == 0)
  1746. !     return OptionsNew(SREQ_BUF, this->buf, (checkfun) CheckBuffer,
  1747. !             (PyObject *) this);
  1748.       else if (strcmp(name,"__members__") == 0)
  1749.       return Py_BuildValue("[ssss]", "name", "number", "vars", "options");
  1750.       else
  1751. --- 3009,3056 ----
  1752.   }
  1753.   
  1754.       static void
  1755. ! BufferDestructor(BufferObject *self)
  1756.   {
  1757. !     if (self->buf && self->buf != INVALID_BUFFER_VALUE)
  1758. !     BUF_PYTHON_REF(self->buf) = NULL;
  1759.   
  1760.       DESTRUCTOR_FINISH(self);
  1761.   }
  1762.   
  1763.       static PyInt
  1764. ! BufferLength(BufferObject *self)
  1765.   {
  1766.       /* HOW DO WE SIGNAL AN ERROR FROM THIS FUNCTION? */
  1767. !     if (CheckBuffer(self))
  1768.       return -1; /* ??? */
  1769.   
  1770. !     return (PyInt)(self->buf->b_ml.ml_line_count);
  1771.   }
  1772.   
  1773.       static PyObject *
  1774. ! BufferItem(BufferObject *self, PyInt n)
  1775.   {
  1776. !     return RBItem(self, n, 1, -1);
  1777.   }
  1778.   
  1779.       static PyObject *
  1780. ! BufferSlice(BufferObject *self, PyInt lo, PyInt hi)
  1781.   {
  1782. !     return RBSlice(self, lo, hi, 1, -1);
  1783.   }
  1784.   
  1785.       static PyObject *
  1786. ! BufferAttr(BufferObject *self, char *name)
  1787.   {
  1788.       if (strcmp(name, "name") == 0)
  1789. !     return Py_BuildValue("s", self->buf->b_ffname);
  1790.       else if (strcmp(name, "number") == 0)
  1791. !     return Py_BuildValue(Py_ssize_t_fmt, self->buf->b_fnum);
  1792.       else if (strcmp(name, "vars") == 0)
  1793. !     return DictionaryNew(self->buf->b_vars);
  1794.       else if (strcmp(name, "options") == 0)
  1795. !     return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
  1796. !             (PyObject *) self);
  1797.       else if (strcmp(name,"__members__") == 0)
  1798.       return Py_BuildValue("[ssss]", "name", "number", "vars", "options");
  1799.       else
  1800. ***************
  1801. *** 3096,3122 ****
  1802.   }
  1803.   
  1804.       static PyObject *
  1805. ! BufferAppend(PyObject *self, PyObject *args)
  1806.   {
  1807. !     return RBAppend((BufferObject *)(self), args, 1, -1, NULL);
  1808.   }
  1809.   
  1810.       static PyObject *
  1811. ! BufferMark(PyObject *self, PyObject *args)
  1812.   {
  1813.       pos_T    *posp;
  1814.       char    *pmark;
  1815.       char    mark;
  1816.       buf_T    *savebuf;
  1817.   
  1818. !     if (CheckBuffer((BufferObject *)(self)))
  1819.       return NULL;
  1820.   
  1821.       if (!PyArg_ParseTuple(args, "s", &pmark))
  1822.       return NULL;
  1823.       mark = *pmark;
  1824.   
  1825. !     switch_buffer(&savebuf, ((BufferObject *)(self))->buf);
  1826.       posp = getmark(mark, FALSE);
  1827.       restore_buffer(savebuf);
  1828.   
  1829. --- 3058,3084 ----
  1830.   }
  1831.   
  1832.       static PyObject *
  1833. ! BufferAppend(BufferObject *self, PyObject *args)
  1834.   {
  1835. !     return RBAppend(self, args, 1, -1, NULL);
  1836.   }
  1837.   
  1838.       static PyObject *
  1839. ! BufferMark(BufferObject *self, PyObject *args)
  1840.   {
  1841.       pos_T    *posp;
  1842.       char    *pmark;
  1843.       char    mark;
  1844.       buf_T    *savebuf;
  1845.   
  1846. !     if (CheckBuffer(self))
  1847.       return NULL;
  1848.   
  1849.       if (!PyArg_ParseTuple(args, "s", &pmark))
  1850.       return NULL;
  1851.       mark = *pmark;
  1852.   
  1853. !     switch_buffer(&savebuf, self->buf);
  1854.       posp = getmark(mark, FALSE);
  1855.       restore_buffer(savebuf);
  1856.   
  1857. ***************
  1858. *** 3141,3174 ****
  1859.   }
  1860.   
  1861.       static PyObject *
  1862. ! BufferRange(PyObject *self, PyObject *args)
  1863.   {
  1864.       PyInt start;
  1865.       PyInt end;
  1866.   
  1867. !     if (CheckBuffer((BufferObject *)(self)))
  1868.       return NULL;
  1869.   
  1870.       if (!PyArg_ParseTuple(args, "nn", &start, &end))
  1871.       return NULL;
  1872.   
  1873. !     return RangeNew(((BufferObject *)(self))->buf, start, end);
  1874.   }
  1875.   
  1876.       static PyObject *
  1877. ! BufferRepr(PyObject *self)
  1878.   {
  1879.       static char repr[100];
  1880. -     BufferObject *this = (BufferObject *)(self);
  1881.   
  1882. !     if (this->buf == INVALID_BUFFER_VALUE)
  1883.       {
  1884.       vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
  1885.       return PyString_FromString(repr);
  1886.       }
  1887.       else
  1888.       {
  1889. !     char *name = (char *)this->buf->b_fname;
  1890.       PyInt len;
  1891.   
  1892.       if (name == NULL)
  1893. --- 3103,3135 ----
  1894.   }
  1895.   
  1896.       static PyObject *
  1897. ! BufferRange(BufferObject *self, PyObject *args)
  1898.   {
  1899.       PyInt start;
  1900.       PyInt end;
  1901.   
  1902. !     if (CheckBuffer(self))
  1903.       return NULL;
  1904.   
  1905.       if (!PyArg_ParseTuple(args, "nn", &start, &end))
  1906.       return NULL;
  1907.   
  1908. !     return RangeNew(self->buf, start, end);
  1909.   }
  1910.   
  1911.       static PyObject *
  1912. ! BufferRepr(BufferObject *self)
  1913.   {
  1914.       static char repr[100];
  1915.   
  1916. !     if (self->buf == INVALID_BUFFER_VALUE)
  1917.       {
  1918.       vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
  1919.       return PyString_FromString(repr);
  1920.       }
  1921.       else
  1922.       {
  1923. !     char *name = (char *)self->buf->b_fname;
  1924.       PyInt len;
  1925.   
  1926.       if (name == NULL)
  1927. ***************
  1928. *** 3185,3198 ****
  1929.   }
  1930.   
  1931.   static struct PyMethodDef BufferMethods[] = {
  1932. !     /* name,        function,        calling,    documentation */
  1933. !     {"append",        BufferAppend,    1,        "Append data to Vim buffer" },
  1934. !     {"mark",        BufferMark,        1,        "Return (row,col) representing position of named mark" },
  1935. !     {"range",        BufferRange,    1,        "Return a range object which represents the part of the given buffer between line numbers s and e" },
  1936.   #if PY_VERSION_HEX >= 0x03000000
  1937. !     {"__dir__",        BufferDir,        4,        "List its attributes" },
  1938.   #endif
  1939. !     { NULL,        NULL,        0,        NULL }
  1940.   };
  1941.   
  1942.   /*
  1943. --- 3146,3159 ----
  1944.   }
  1945.   
  1946.   static struct PyMethodDef BufferMethods[] = {
  1947. !     /* name,        function,            calling,    documentation */
  1948. !     {"append",        (PyCFunction)BufferAppend,    METH_VARARGS,    "Append data to Vim buffer" },
  1949. !     {"mark",        (PyCFunction)BufferMark,    METH_VARARGS,    "Return (row,col) representing position of named mark" },
  1950. !     {"range",        (PyCFunction)BufferRange,    METH_VARARGS,    "Return a range object which represents the part of the given buffer between line numbers s and e" },
  1951.   #if PY_VERSION_HEX >= 0x03000000
  1952. !     {"__dir__",        (PyCFunction)BufferDir,    METH_NOARGS,    "List buffer attributes" },
  1953.   #endif
  1954. !     { NULL,        NULL,            0,        NULL }
  1955.   };
  1956.   
  1957.   /*
  1958. ***************
  1959. *** 4021,4034 ****
  1960.       OutputType.tp_doc = "vim message object";
  1961.       OutputType.tp_methods = OutputMethods;
  1962.   #if PY_MAJOR_VERSION >= 3
  1963. !     OutputType.tp_getattro = OutputGetattro;
  1964. !     OutputType.tp_setattro = OutputSetattro;
  1965.       OutputType.tp_alloc = call_PyType_GenericAlloc;
  1966.       OutputType.tp_new = call_PyType_GenericNew;
  1967.       OutputType.tp_free = call_PyObject_Free;
  1968.   #else
  1969. !     OutputType.tp_getattr = OutputGetattr;
  1970. !     OutputType.tp_setattr = OutputSetattr;
  1971.   #endif
  1972.   
  1973.       vim_memset(&IterType, 0, sizeof(IterType));
  1974. --- 3982,3995 ----
  1975.       OutputType.tp_doc = "vim message object";
  1976.       OutputType.tp_methods = OutputMethods;
  1977.   #if PY_MAJOR_VERSION >= 3
  1978. !     OutputType.tp_getattro = (getattrofunc)OutputGetattro;
  1979. !     OutputType.tp_setattro = (setattrofunc)OutputSetattro;
  1980.       OutputType.tp_alloc = call_PyType_GenericAlloc;
  1981.       OutputType.tp_new = call_PyType_GenericNew;
  1982.       OutputType.tp_free = call_PyObject_Free;
  1983.   #else
  1984. !     OutputType.tp_getattr = (getattrfunc)OutputGetattr;
  1985. !     OutputType.tp_setattr = (setattrfunc)OutputSetattr;
  1986.   #endif
  1987.   
  1988.       vim_memset(&IterType, 0, sizeof(IterType));
  1989. ***************
  1990. *** 4036,4102 ****
  1991.       IterType.tp_basicsize = sizeof(IterObject);
  1992.       IterType.tp_flags = Py_TPFLAGS_DEFAULT;
  1993.       IterType.tp_doc = "generic iterator object";
  1994. !     IterType.tp_iter = IterIter;
  1995. !     IterType.tp_iternext = IterNext;
  1996. !     IterType.tp_dealloc = IterDestructor;
  1997. !     IterType.tp_traverse = IterTraverse;
  1998. !     IterType.tp_clear = IterClear;
  1999.   
  2000.       vim_memset(&BufferType, 0, sizeof(BufferType));
  2001.       BufferType.tp_name = "vim.buffer";
  2002.       BufferType.tp_basicsize = sizeof(BufferType);
  2003. !     BufferType.tp_dealloc = BufferDestructor;
  2004. !     BufferType.tp_repr = BufferRepr;
  2005.       BufferType.tp_as_sequence = &BufferAsSeq;
  2006.       BufferType.tp_as_mapping = &BufferAsMapping;
  2007.       BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
  2008.       BufferType.tp_doc = "vim buffer object";
  2009.       BufferType.tp_methods = BufferMethods;
  2010.   #if PY_MAJOR_VERSION >= 3
  2011. !     BufferType.tp_getattro = BufferGetattro;
  2012.       BufferType.tp_alloc = call_PyType_GenericAlloc;
  2013.       BufferType.tp_new = call_PyType_GenericNew;
  2014.       BufferType.tp_free = call_PyObject_Free;
  2015.   #else
  2016. !     BufferType.tp_getattr = BufferGetattr;
  2017.   #endif
  2018.   
  2019.       vim_memset(&WindowType, 0, sizeof(WindowType));
  2020.       WindowType.tp_name = "vim.window";
  2021.       WindowType.tp_basicsize = sizeof(WindowObject);
  2022. !     WindowType.tp_dealloc = WindowDestructor;
  2023. !     WindowType.tp_repr = WindowRepr;
  2024.       WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
  2025.       WindowType.tp_doc = "vim Window object";
  2026.       WindowType.tp_methods = WindowMethods;
  2027. !     WindowType.tp_traverse = WindowTraverse;
  2028. !     WindowType.tp_clear = WindowClear;
  2029.   #if PY_MAJOR_VERSION >= 3
  2030. !     WindowType.tp_getattro = WindowGetattro;
  2031. !     WindowType.tp_setattro = WindowSetattro;
  2032.       WindowType.tp_alloc = call_PyType_GenericAlloc;
  2033.       WindowType.tp_new = call_PyType_GenericNew;
  2034.       WindowType.tp_free = call_PyObject_Free;
  2035.   #else
  2036. !     WindowType.tp_getattr = WindowGetattr;
  2037. !     WindowType.tp_setattr = WindowSetattr;
  2038.   #endif
  2039.   
  2040.       vim_memset(&TabPageType, 0, sizeof(TabPageType));
  2041.       TabPageType.tp_name = "vim.tabpage";
  2042.       TabPageType.tp_basicsize = sizeof(TabPageObject);
  2043. !     TabPageType.tp_dealloc = TabPageDestructor;
  2044. !     TabPageType.tp_repr = TabPageRepr;
  2045.       TabPageType.tp_flags = Py_TPFLAGS_DEFAULT;
  2046.       TabPageType.tp_doc = "vim tab page object";
  2047.       TabPageType.tp_methods = TabPageMethods;
  2048.   #if PY_MAJOR_VERSION >= 3
  2049. !     TabPageType.tp_getattro = TabPageGetattro;
  2050.       TabPageType.tp_alloc = call_PyType_GenericAlloc;
  2051.       TabPageType.tp_new = call_PyType_GenericNew;
  2052.       TabPageType.tp_free = call_PyObject_Free;
  2053.   #else
  2054. !     TabPageType.tp_getattr = TabPageGetattr;
  2055.   #endif
  2056.   
  2057.       vim_memset(&BufMapType, 0, sizeof(BufMapType));
  2058. --- 3997,4063 ----
  2059.       IterType.tp_basicsize = sizeof(IterObject);
  2060.       IterType.tp_flags = Py_TPFLAGS_DEFAULT;
  2061.       IterType.tp_doc = "generic iterator object";
  2062. !     IterType.tp_iter = (getiterfunc)IterIter;
  2063. !     IterType.tp_iternext = (iternextfunc)IterNext;
  2064. !     IterType.tp_dealloc = (destructor)IterDestructor;
  2065. !     IterType.tp_traverse = (traverseproc)IterTraverse;
  2066. !     IterType.tp_clear = (inquiry)IterClear;
  2067.   
  2068.       vim_memset(&BufferType, 0, sizeof(BufferType));
  2069.       BufferType.tp_name = "vim.buffer";
  2070.       BufferType.tp_basicsize = sizeof(BufferType);
  2071. !     BufferType.tp_dealloc = (destructor)BufferDestructor;
  2072. !     BufferType.tp_repr = (reprfunc)BufferRepr;
  2073.       BufferType.tp_as_sequence = &BufferAsSeq;
  2074.       BufferType.tp_as_mapping = &BufferAsMapping;
  2075.       BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
  2076.       BufferType.tp_doc = "vim buffer object";
  2077.       BufferType.tp_methods = BufferMethods;
  2078.   #if PY_MAJOR_VERSION >= 3
  2079. !     BufferType.tp_getattro = (getattrofunc)BufferGetattro;
  2080.       BufferType.tp_alloc = call_PyType_GenericAlloc;
  2081.       BufferType.tp_new = call_PyType_GenericNew;
  2082.       BufferType.tp_free = call_PyObject_Free;
  2083.   #else
  2084. !     BufferType.tp_getattr = (getattrfunc)BufferGetattr;
  2085.   #endif
  2086.   
  2087.       vim_memset(&WindowType, 0, sizeof(WindowType));
  2088.       WindowType.tp_name = "vim.window";
  2089.       WindowType.tp_basicsize = sizeof(WindowObject);
  2090. !     WindowType.tp_dealloc = (destructor)WindowDestructor;
  2091. !     WindowType.tp_repr = (reprfunc)WindowRepr;
  2092.       WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
  2093.       WindowType.tp_doc = "vim Window object";
  2094.       WindowType.tp_methods = WindowMethods;
  2095. !     WindowType.tp_traverse = (traverseproc)WindowTraverse;
  2096. !     WindowType.tp_clear = (inquiry)WindowClear;
  2097.   #if PY_MAJOR_VERSION >= 3
  2098. !     WindowType.tp_getattro = (getattrofunc)WindowGetattro;
  2099. !     WindowType.tp_setattro = (setattrofunc)WindowSetattro;
  2100.       WindowType.tp_alloc = call_PyType_GenericAlloc;
  2101.       WindowType.tp_new = call_PyType_GenericNew;
  2102.       WindowType.tp_free = call_PyObject_Free;
  2103.   #else
  2104. !     WindowType.tp_getattr = (getattrfunc)WindowGetattr;
  2105. !     WindowType.tp_setattr = (setattrfunc)WindowSetattr;
  2106.   #endif
  2107.   
  2108.       vim_memset(&TabPageType, 0, sizeof(TabPageType));
  2109.       TabPageType.tp_name = "vim.tabpage";
  2110.       TabPageType.tp_basicsize = sizeof(TabPageObject);
  2111. !     TabPageType.tp_dealloc = (destructor)TabPageDestructor;
  2112. !     TabPageType.tp_repr = (reprfunc)TabPageRepr;
  2113.       TabPageType.tp_flags = Py_TPFLAGS_DEFAULT;
  2114.       TabPageType.tp_doc = "vim tab page object";
  2115.       TabPageType.tp_methods = TabPageMethods;
  2116.   #if PY_MAJOR_VERSION >= 3
  2117. !     TabPageType.tp_getattro = (getattrofunc)TabPageGetattro;
  2118.       TabPageType.tp_alloc = call_PyType_GenericAlloc;
  2119.       TabPageType.tp_new = call_PyType_GenericNew;
  2120.       TabPageType.tp_free = call_PyObject_Free;
  2121.   #else
  2122. !     TabPageType.tp_getattr = (getattrfunc)TabPageGetattr;
  2123.   #endif
  2124.   
  2125.       vim_memset(&BufMapType, 0, sizeof(BufMapType));
  2126. ***************
  2127. *** 4113,4119 ****
  2128.       WinListType.tp_as_sequence = &WinListAsSeq;
  2129.       WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
  2130.       WinListType.tp_doc = "vim window list";
  2131. !     WinListType.tp_dealloc = WinListDestructor;
  2132.   
  2133.       vim_memset(&TabListType, 0, sizeof(TabListType));
  2134.       TabListType.tp_name = "vim.tabpagelist";
  2135. --- 4074,4080 ----
  2136.       WinListType.tp_as_sequence = &WinListAsSeq;
  2137.       WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
  2138.       WinListType.tp_doc = "vim window list";
  2139. !     WinListType.tp_dealloc = (destructor)WinListDestructor;
  2140.   
  2141.       vim_memset(&TabListType, 0, sizeof(TabListType));
  2142.       TabListType.tp_name = "vim.tabpagelist";
  2143. ***************
  2144. *** 4125,4144 ****
  2145.       vim_memset(&RangeType, 0, sizeof(RangeType));
  2146.       RangeType.tp_name = "vim.range";
  2147.       RangeType.tp_basicsize = sizeof(RangeObject);
  2148. !     RangeType.tp_dealloc = RangeDestructor;
  2149. !     RangeType.tp_repr = RangeRepr;
  2150.       RangeType.tp_as_sequence = &RangeAsSeq;
  2151.       RangeType.tp_as_mapping = &RangeAsMapping;
  2152.       RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
  2153.       RangeType.tp_doc = "vim Range object";
  2154.       RangeType.tp_methods = RangeMethods;
  2155.   #if PY_MAJOR_VERSION >= 3
  2156. !     RangeType.tp_getattro = RangeGetattro;
  2157.       RangeType.tp_alloc = call_PyType_GenericAlloc;
  2158.       RangeType.tp_new = call_PyType_GenericNew;
  2159.       RangeType.tp_free = call_PyObject_Free;
  2160.   #else
  2161. !     RangeType.tp_getattr = RangeGetattr;
  2162.   #endif
  2163.   
  2164.       vim_memset(&CurrentType, 0, sizeof(CurrentType));
  2165. --- 4086,4105 ----
  2166.       vim_memset(&RangeType, 0, sizeof(RangeType));
  2167.       RangeType.tp_name = "vim.range";
  2168.       RangeType.tp_basicsize = sizeof(RangeObject);
  2169. !     RangeType.tp_dealloc = (destructor)RangeDestructor;
  2170. !     RangeType.tp_repr = (reprfunc)RangeRepr;
  2171.       RangeType.tp_as_sequence = &RangeAsSeq;
  2172.       RangeType.tp_as_mapping = &RangeAsMapping;
  2173.       RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
  2174.       RangeType.tp_doc = "vim Range object";
  2175.       RangeType.tp_methods = RangeMethods;
  2176.   #if PY_MAJOR_VERSION >= 3
  2177. !     RangeType.tp_getattro = (getattrofunc)RangeGetattro;
  2178.       RangeType.tp_alloc = call_PyType_GenericAlloc;
  2179.       RangeType.tp_new = call_PyType_GenericNew;
  2180.       RangeType.tp_free = call_PyObject_Free;
  2181.   #else
  2182. !     RangeType.tp_getattr = (getattrfunc)RangeGetattr;
  2183.   #endif
  2184.   
  2185.       vim_memset(&CurrentType, 0, sizeof(CurrentType));
  2186. ***************
  2187. *** 4147,4205 ****
  2188.       CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
  2189.       CurrentType.tp_doc = "vim current object";
  2190.   #if PY_MAJOR_VERSION >= 3
  2191. !     CurrentType.tp_getattro = CurrentGetattro;
  2192. !     CurrentType.tp_setattro = CurrentSetattro;
  2193.   #else
  2194. !     CurrentType.tp_getattr = CurrentGetattr;
  2195. !     CurrentType.tp_setattr = CurrentSetattr;
  2196.   #endif
  2197.   
  2198.       vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
  2199.       DictionaryType.tp_name = "vim.dictionary";
  2200.       DictionaryType.tp_basicsize = sizeof(DictionaryObject);
  2201. !     DictionaryType.tp_dealloc = DictionaryDestructor;
  2202.       DictionaryType.tp_as_mapping = &DictionaryAsMapping;
  2203.       DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
  2204.       DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
  2205.       DictionaryType.tp_methods = DictionaryMethods;
  2206.   #if PY_MAJOR_VERSION >= 3
  2207. !     DictionaryType.tp_getattro = DictionaryGetattro;
  2208. !     DictionaryType.tp_setattro = DictionarySetattro;
  2209.   #else
  2210. !     DictionaryType.tp_getattr = DictionaryGetattr;
  2211. !     DictionaryType.tp_setattr = DictionarySetattr;
  2212.   #endif
  2213.   
  2214.       vim_memset(&ListType, 0, sizeof(ListType));
  2215.       ListType.tp_name = "vim.list";
  2216. !     ListType.tp_dealloc = ListDestructor;
  2217.       ListType.tp_basicsize = sizeof(ListObject);
  2218.       ListType.tp_as_sequence = &ListAsSeq;
  2219.       ListType.tp_as_mapping = &ListAsMapping;
  2220.       ListType.tp_flags = Py_TPFLAGS_DEFAULT;
  2221.       ListType.tp_doc = "list pushing modifications to vim structure";
  2222.       ListType.tp_methods = ListMethods;
  2223. !     ListType.tp_iter = ListIter;
  2224.   #if PY_MAJOR_VERSION >= 3
  2225. !     ListType.tp_getattro = ListGetattro;
  2226. !     ListType.tp_setattro = ListSetattro;
  2227.   #else
  2228. !     ListType.tp_getattr = ListGetattr;
  2229. !     ListType.tp_setattr = ListSetattr;
  2230.   #endif
  2231.   
  2232.       vim_memset(&FunctionType, 0, sizeof(FunctionType));
  2233.       FunctionType.tp_name = "vim.function";
  2234.       FunctionType.tp_basicsize = sizeof(FunctionObject);
  2235. !     FunctionType.tp_dealloc = FunctionDestructor;
  2236. !     FunctionType.tp_call = FunctionCall;
  2237.       FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
  2238.       FunctionType.tp_doc = "object that calls vim function";
  2239.       FunctionType.tp_methods = FunctionMethods;
  2240.   #if PY_MAJOR_VERSION >= 3
  2241. !     FunctionType.tp_getattro = FunctionGetattro;
  2242.   #else
  2243. !     FunctionType.tp_getattr = FunctionGetattr;
  2244.   #endif
  2245.   
  2246.       vim_memset(&OptionsType, 0, sizeof(OptionsType));
  2247. --- 4108,4166 ----
  2248.       CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
  2249.       CurrentType.tp_doc = "vim current object";
  2250.   #if PY_MAJOR_VERSION >= 3
  2251. !     CurrentType.tp_getattro = (getattrofunc)CurrentGetattro;
  2252. !     CurrentType.tp_setattro = (setattrofunc)CurrentSetattro;
  2253.   #else
  2254. !     CurrentType.tp_getattr = (getattrfunc)CurrentGetattr;
  2255. !     CurrentType.tp_setattr = (setattrfunc)CurrentSetattr;
  2256.   #endif
  2257.   
  2258.       vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
  2259.       DictionaryType.tp_name = "vim.dictionary";
  2260.       DictionaryType.tp_basicsize = sizeof(DictionaryObject);
  2261. !     DictionaryType.tp_dealloc = (destructor)DictionaryDestructor;
  2262.       DictionaryType.tp_as_mapping = &DictionaryAsMapping;
  2263.       DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
  2264.       DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
  2265.       DictionaryType.tp_methods = DictionaryMethods;
  2266.   #if PY_MAJOR_VERSION >= 3
  2267. !     DictionaryType.tp_getattro = (getattrofunc)DictionaryGetattro;
  2268. !     DictionaryType.tp_setattro = (setattrofunc)DictionarySetattro;
  2269.   #else
  2270. !     DictionaryType.tp_getattr = (getattrfunc)DictionaryGetattr;
  2271. !     DictionaryType.tp_setattr = (setattrfunc)DictionarySetattr;
  2272.   #endif
  2273.   
  2274.       vim_memset(&ListType, 0, sizeof(ListType));
  2275.       ListType.tp_name = "vim.list";
  2276. !     ListType.tp_dealloc = (destructor)ListDestructor;
  2277.       ListType.tp_basicsize = sizeof(ListObject);
  2278.       ListType.tp_as_sequence = &ListAsSeq;
  2279.       ListType.tp_as_mapping = &ListAsMapping;
  2280.       ListType.tp_flags = Py_TPFLAGS_DEFAULT;
  2281.       ListType.tp_doc = "list pushing modifications to vim structure";
  2282.       ListType.tp_methods = ListMethods;
  2283. !     ListType.tp_iter = (getiterfunc)ListIter;
  2284.   #if PY_MAJOR_VERSION >= 3
  2285. !     ListType.tp_getattro = (getattrofunc)ListGetattro;
  2286. !     ListType.tp_setattro = (setattrofunc)ListSetattro;
  2287.   #else
  2288. !     ListType.tp_getattr = (getattrfunc)ListGetattr;
  2289. !     ListType.tp_setattr = (setattrfunc)ListSetattr;
  2290.   #endif
  2291.   
  2292.       vim_memset(&FunctionType, 0, sizeof(FunctionType));
  2293.       FunctionType.tp_name = "vim.function";
  2294.       FunctionType.tp_basicsize = sizeof(FunctionObject);
  2295. !     FunctionType.tp_dealloc = (destructor)FunctionDestructor;
  2296. !     FunctionType.tp_call = (ternaryfunc)FunctionCall;
  2297.       FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
  2298.       FunctionType.tp_doc = "object that calls vim function";
  2299.       FunctionType.tp_methods = FunctionMethods;
  2300.   #if PY_MAJOR_VERSION >= 3
  2301. !     FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
  2302.   #else
  2303. !     FunctionType.tp_getattr = (getattrfunc)FunctionGetattr;
  2304.   #endif
  2305.   
  2306.       vim_memset(&OptionsType, 0, sizeof(OptionsType));
  2307. ***************
  2308. *** 4208,4216 ****
  2309.       OptionsType.tp_flags = Py_TPFLAGS_DEFAULT;
  2310.       OptionsType.tp_doc = "object for manipulating options";
  2311.       OptionsType.tp_as_mapping = &OptionsAsMapping;
  2312. !     OptionsType.tp_dealloc = OptionsDestructor;
  2313. !     OptionsType.tp_traverse = OptionsTraverse;
  2314. !     OptionsType.tp_clear = OptionsClear;
  2315.   
  2316.   #if PY_MAJOR_VERSION >= 3
  2317.       vim_memset(&vimmodule, 0, sizeof(vimmodule));
  2318. --- 4169,4177 ----
  2319.       OptionsType.tp_flags = Py_TPFLAGS_DEFAULT;
  2320.       OptionsType.tp_doc = "object for manipulating options";
  2321.       OptionsType.tp_as_mapping = &OptionsAsMapping;
  2322. !     OptionsType.tp_dealloc = (destructor)OptionsDestructor;
  2323. !     OptionsType.tp_traverse = (traverseproc)OptionsTraverse;
  2324. !     OptionsType.tp_clear = (inquiry)OptionsClear;
  2325.   
  2326.   #if PY_MAJOR_VERSION >= 3
  2327.       vim_memset(&vimmodule, 0, sizeof(vimmodule));
  2328. *** ../vim-7.3.991/src/if_python3.c    2013-05-21 18:19:33.000000000 +0200
  2329. --- src/if_python3.c    2013-05-21 18:22:03.000000000 +0200
  2330. ***************
  2331. *** 68,75 ****
  2332.   # define PY_SSIZE_T_CLEAN
  2333.   #endif
  2334.   
  2335. - static void init_structs(void);
  2336.   /* The "surrogateescape" error handler is new in Python 3.1 */
  2337.   #if PY_VERSION_HEX >= 0x030100f0
  2338.   # define CODEC_ERROR_HANDLER "surrogateescape"
  2339. --- 68,73 ----
  2340. ***************
  2341. *** 610,617 ****
  2342.   }
  2343.   #endif /* DYNAMIC_PYTHON3 */
  2344.   
  2345. - static PyObject *BufferDir(PyObject *, PyObject *);
  2346.   static int py3initialised = 0;
  2347.   
  2348.   #define PYINITIALISED py3initialised
  2349. --- 608,613 ----
  2350. ***************
  2351. *** 670,675 ****
  2352. --- 666,672 ----
  2353.       return PyType_GenericAlloc(type,nitems);
  2354.   }
  2355.   
  2356. + static PyObject *BufferDir(PyObject *);
  2357.   static PyObject *OutputGetattro(PyObject *, PyObject *);
  2358.   static int OutputSetattro(PyObject *, PyObject *, PyObject *);
  2359.   static PyObject *BufferGetattro(PyObject *, PyObject *);
  2360. ***************
  2361. *** 1008,1014 ****
  2362.   {
  2363.       GET_ATTR_STRING(name, nameobj);
  2364.   
  2365. !     return OutputSetattr(self, name, val);
  2366.   }
  2367.   
  2368.   /***************/
  2369. --- 1005,1011 ----
  2370.   {
  2371.       GET_ATTR_STRING(name, nameobj);
  2372.   
  2373. !     return OutputSetattr((OutputObject *)(self), name, val);
  2374.   }
  2375.   
  2376.   /***************/
  2377. ***************
  2378. *** 1036,1047 ****
  2379.   
  2380.   #define BufferType_Check(obj) ((obj)->ob_base.ob_type == &BufferType)
  2381.   
  2382. - static Py_ssize_t BufferLength(PyObject *);
  2383. - static PyObject *BufferItem(PyObject *, Py_ssize_t);
  2384.   static PyObject* BufferSubscript(PyObject *self, PyObject *idx);
  2385.   static Py_ssize_t BufferAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
  2386.   
  2387.   /* Line range type - Implementation functions
  2388.    * --------------------------------------
  2389.    */
  2390. --- 1033,1041 ----
  2391. ***************
  2392. *** 1097,1103 ****
  2393.   }
  2394.   
  2395.       static PyObject *
  2396. ! BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
  2397.   {
  2398.       return Py_BuildValue("[sssss]", "name", "number",
  2399.                              "append", "mark", "range");
  2400. --- 1091,1097 ----
  2401.   }
  2402.   
  2403.       static PyObject *
  2404. ! BufferDir(PyObject *self UNUSED)
  2405.   {
  2406.       return Py_BuildValue("[sssss]", "name", "number",
  2407.                              "append", "mark", "range");
  2408. ***************
  2409. *** 1111,1117 ****
  2410.       if (PyLong_Check(idx))
  2411.       {
  2412.       long _idx = PyLong_AsLong(idx);
  2413. !     return BufferItem(self,_idx);
  2414.       } else if (PySlice_Check(idx))
  2415.       {
  2416.       Py_ssize_t start, stop, step, slicelen;
  2417. --- 1105,1111 ----
  2418.       if (PyLong_Check(idx))
  2419.       {
  2420.       long _idx = PyLong_AsLong(idx);
  2421. !     return BufferItem((BufferObject *)(self), _idx);
  2422.       } else if (PySlice_Check(idx))
  2423.       {
  2424.       Py_ssize_t start, stop, step, slicelen;
  2425. ***************
  2426. *** 1126,1132 ****
  2427.       {
  2428.           return NULL;
  2429.       }
  2430. !     return BufferSlice(self, start, stop);
  2431.       }
  2432.       else
  2433.       {
  2434. --- 1120,1126 ----
  2435.       {
  2436.           return NULL;
  2437.       }
  2438. !     return BufferSlice((BufferObject *)(self), start, stop);
  2439.       }
  2440.       else
  2441.       {
  2442. ***************
  2443. *** 1230,1236 ****
  2444.       if (PyLong_Check(idx))
  2445.       {
  2446.       long _idx = PyLong_AsLong(idx);
  2447. !     return RangeItem(self,_idx);
  2448.       } else if (PySlice_Check(idx))
  2449.       {
  2450.       Py_ssize_t start, stop, step, slicelen;
  2451. --- 1224,1230 ----
  2452.       if (PyLong_Check(idx))
  2453.       {
  2454.       long _idx = PyLong_AsLong(idx);
  2455. !     return RangeItem((RangeObject *)(self), _idx);
  2456.       } else if (PySlice_Check(idx))
  2457.       {
  2458.       Py_ssize_t start, stop, step, slicelen;
  2459. ***************
  2460. *** 1242,1248 ****
  2461.       {
  2462.           return NULL;
  2463.       }
  2464. !     return RangeSlice(self, start, stop);
  2465.       }
  2466.       else
  2467.       {
  2468. --- 1236,1242 ----
  2469.       {
  2470.           return NULL;
  2471.       }
  2472. !     return RangeSlice((RangeObject *)(self), start, stop);
  2473.       }
  2474.       else
  2475.       {
  2476. ***************
  2477. *** 1323,1329 ****
  2478.   {
  2479.       GET_ATTR_STRING(name, nameobj);
  2480.   
  2481. !     return WindowSetattr(self, name, val);
  2482.   }
  2483.   
  2484.   /* Tab page list object - Definitions
  2485. --- 1317,1323 ----
  2486.   {
  2487.       GET_ATTR_STRING(name, nameobj);
  2488.   
  2489. !     return WindowSetattr((WindowObject *)(self), name, val);
  2490.   }
  2491.   
  2492.   /* Tab page list object - Definitions
  2493. ***************
  2494. *** 1377,1384 ****
  2495.   /* Dictionary object - Definitions
  2496.    */
  2497.   
  2498. - static PyInt DictionaryLength(PyObject *);
  2499.       static PyObject *
  2500.   DictionaryGetattro(PyObject *self, PyObject *nameobj)
  2501.   {
  2502. --- 1371,1376 ----
  2503. ***************
  2504. *** 1398,1412 ****
  2505.   DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
  2506.   {
  2507.       GET_ATTR_STRING(name, nameobj);
  2508. !     return DictionarySetattr(self, name, val);
  2509.   }
  2510.   
  2511.   /* List object - Definitions
  2512.    */
  2513.   
  2514. - static PyInt ListLength(PyObject *);
  2515. - static PyObject *ListItem(PyObject *, Py_ssize_t);
  2516.   static PySequenceMethods ListAsSeq = {
  2517.       (lenfunc)        ListLength,     /* sq_length,      len(x)   */
  2518.       (binaryfunc)    0,         /* RangeConcat, sq_concat,  x+y   */
  2519. --- 1390,1401 ----
  2520.   DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
  2521.   {
  2522.       GET_ATTR_STRING(name, nameobj);
  2523. !     return DictionarySetattr((DictionaryObject *)(self), name, val);
  2524.   }
  2525.   
  2526.   /* List object - Definitions
  2527.    */
  2528.   
  2529.   static PySequenceMethods ListAsSeq = {
  2530.       (lenfunc)        ListLength,     /* sq_length,      len(x)   */
  2531.       (binaryfunc)    0,         /* RangeConcat, sq_concat,  x+y   */
  2532. ***************
  2533. *** 1430,1450 ****
  2534.   };
  2535.   
  2536.       static PyObject *
  2537. ! ListSubscript(PyObject *self, PyObject* idxObject)
  2538.   {
  2539. !     if (PyLong_Check(idxObject))
  2540.       {
  2541. !     long idx = PyLong_AsLong(idxObject);
  2542. !     return ListItem(self, idx);
  2543.       }
  2544. !     else if (PySlice_Check(idxObject))
  2545.       {
  2546.       Py_ssize_t start, stop, step, slicelen;
  2547.   
  2548. !     if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
  2549. !                  &step, &slicelen) < 0)
  2550.           return NULL;
  2551. !     return ListSlice(self, start, stop);
  2552.       }
  2553.       else
  2554.       {
  2555. --- 1419,1439 ----
  2556.   };
  2557.   
  2558.       static PyObject *
  2559. ! ListSubscript(PyObject *self, PyObject* idx)
  2560.   {
  2561. !     if (PyLong_Check(idx))
  2562.       {
  2563. !     long _idx = PyLong_AsLong(idx);
  2564. !     return ListItem((ListObject *)(self), _idx);
  2565.       }
  2566. !     else if (PySlice_Check(idx))
  2567.       {
  2568.       Py_ssize_t start, stop, step, slicelen;
  2569.   
  2570. !     if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
  2571. !                  &start, &stop, &step, &slicelen) < 0)
  2572.           return NULL;
  2573. !     return ListSlice((ListObject *)(self), start, stop);
  2574.       }
  2575.       else
  2576.       {
  2577. ***************
  2578. *** 1454,1474 ****
  2579.   }
  2580.   
  2581.       static Py_ssize_t
  2582. ! ListAsSubscript(PyObject *self, PyObject *idxObject, PyObject *obj)
  2583.   {
  2584. !     if (PyLong_Check(idxObject))
  2585.       {
  2586. !     long idx = PyLong_AsLong(idxObject);
  2587. !     return ListAssItem(self, idx, obj);
  2588.       }
  2589. !     else if (PySlice_Check(idxObject))
  2590.       {
  2591.       Py_ssize_t start, stop, step, slicelen;
  2592.   
  2593. !     if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
  2594. !                  &step, &slicelen) < 0)
  2595.           return -1;
  2596. !     return ListAssSlice(self, start, stop, obj);
  2597.       }
  2598.       else
  2599.       {
  2600. --- 1443,1463 ----
  2601.   }
  2602.   
  2603.       static Py_ssize_t
  2604. ! ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj)
  2605.   {
  2606. !     if (PyLong_Check(idx))
  2607.       {
  2608. !     long _idx = PyLong_AsLong(idx);
  2609. !     return ListAssItem((ListObject *)(self), _idx, obj);
  2610.       }
  2611. !     else if (PySlice_Check(idx))
  2612.       {
  2613.       Py_ssize_t start, stop, step, slicelen;
  2614.   
  2615. !     if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
  2616. !                  &start, &stop, &step, &slicelen) < 0)
  2617.           return -1;
  2618. !     return ListAssSlice((ListObject *)(self), start, stop, obj);
  2619.       }
  2620.       else
  2621.       {
  2622. ***************
  2623. *** 1492,1498 ****
  2624.   ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
  2625.   {
  2626.       GET_ATTR_STRING(name, nameobj);
  2627. !     return ListSetattr(self, name, val);
  2628.   }
  2629.   
  2630.   /* Function object - Definitions
  2631. --- 1481,1487 ----
  2632.   ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
  2633.   {
  2634.       GET_ATTR_STRING(name, nameobj);
  2635. !     return ListSetattr((ListObject *)(self), name, val);
  2636.   }
  2637.   
  2638.   /* Function object - Definitions
  2639. *** ../vim-7.3.991/src/if_python.c    2013-05-21 18:19:33.000000000 +0200
  2640. --- src/if_python.c    2013-05-21 18:22:03.000000000 +0200
  2641. ***************
  2642. *** 56,63 ****
  2643.   # define PY_SSIZE_T_CLEAN
  2644.   #endif
  2645.   
  2646. - static void init_structs(void);
  2647.   #define PyBytes_FromString PyString_FromString
  2648.   #define PyBytes_Check PyString_Check
  2649.   
  2650. --- 56,61 ----
  2651. ***************
  2652. *** 659,674 ****
  2653.    * Internal function prototypes.
  2654.    */
  2655.   
  2656. - static void PythonIO_Flush(void);
  2657.   static int PythonIO_Init(void);
  2658.   static int PythonMod_Init(void);
  2659.   
  2660. - /* Utility functions for the vim/python interface
  2661. -  * ----------------------------------------------
  2662. -  */
  2663. - static int SetBufferLineList(buf_T *, PyInt, PyInt, PyObject *, PyInt *);
  2664.   
  2665.   /******************************************************
  2666.    * 1. Python interpreter main program.
  2667. --- 657,665 ----
  2668. ***************
  2669. *** 1017,1025 ****
  2670.    * 3. Implementation of the Vim module for Python
  2671.    */
  2672.   
  2673. - static PyObject *ConvertToPyObject(typval_T *);
  2674. - static int ConvertFromPyObject(PyObject *, typval_T *);
  2675.   /* Window type - Implementation functions
  2676.    * --------------------------------------
  2677.    */
  2678. --- 1008,1013 ----
  2679. *** ../vim-7.3.991/src/version.c    2013-05-21 18:19:33.000000000 +0200
  2680. --- src/version.c    2013-05-21 18:28:18.000000000 +0200
  2681. ***************
  2682. *** 730,731 ****
  2683. --- 730,733 ----
  2684.   {   /* Add new patch number below this line */
  2685. + /**/
  2686. +     992,
  2687.   /**/
  2688.  
  2689. -- 
  2690. We apologise again for the fault in the subtitles.  Those responsible for
  2691. sacking the people who have just been sacked have been sacked.
  2692.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  2693.  
  2694.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  2695. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  2696. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  2697.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  2698.