mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.3.1041
Problem: Python: Invalid read valgrind errors. Solution: Python patch 2: defer DICTKEY_UNREF until key is no longer needed. (ZyX)
This commit is contained in:
@@ -1603,11 +1603,10 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
flags = get_option_value_strict(key, NULL, NULL,
|
flags = get_option_value_strict(key, NULL, NULL,
|
||||||
self->opt_type, self->from);
|
self->opt_type, self->from);
|
||||||
|
|
||||||
DICTKEY_UNREF
|
|
||||||
|
|
||||||
if (flags == 0)
|
if (flags == 0)
|
||||||
{
|
{
|
||||||
PyErr_SetObject(PyExc_KeyError, keyObject);
|
PyErr_SetObject(PyExc_KeyError, keyObject);
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1617,17 +1616,20 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
_("unable to unset global option"));
|
_("unable to unset global option"));
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (!(flags & SOPT_GLOBAL))
|
else if (!(flags & SOPT_GLOBAL))
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_ValueError, _("unable to unset option "
|
PyErr_SetString(PyExc_ValueError, _("unable to unset option "
|
||||||
"without global value"));
|
"without global value"));
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unset_global_local_option(key, self->from);
|
unset_global_local_option(key, self->from);
|
||||||
|
DICTKEY_UNREF
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1639,7 +1641,8 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
int istrue = PyObject_IsTrue(valObject);
|
int istrue = PyObject_IsTrue(valObject);
|
||||||
|
|
||||||
if (istrue == -1)
|
if (istrue == -1)
|
||||||
return -1;
|
r = -1;
|
||||||
|
else
|
||||||
r = set_option_value_for(key, istrue, NULL,
|
r = set_option_value_for(key, istrue, NULL,
|
||||||
opt_flags, self->opt_type, self->from);
|
opt_flags, self->opt_type, self->from);
|
||||||
}
|
}
|
||||||
@@ -1657,6 +1660,7 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_TypeError, _("object must be integer"));
|
PyErr_SetString(PyExc_TypeError, _("object must be integer"));
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1670,9 +1674,15 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (PyString_AsStringAndSize(valObject, (char **) &val, NULL) == -1)
|
if (PyString_AsStringAndSize(valObject, (char **) &val, NULL) == -1)
|
||||||
|
{
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
|
{
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
val = vim_strsave(val);
|
val = vim_strsave(val);
|
||||||
}
|
}
|
||||||
@@ -1682,12 +1692,21 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
|
|
||||||
bytes = PyUnicode_AsEncodedString(valObject, (char *)ENC_OPT, NULL);
|
bytes = PyUnicode_AsEncodedString(valObject, (char *)ENC_OPT, NULL);
|
||||||
if (bytes == NULL)
|
if (bytes == NULL)
|
||||||
|
{
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if(PyString_AsStringAndSize(bytes, (char **) &val, NULL) == -1)
|
if(PyString_AsStringAndSize(bytes, (char **) &val, NULL) == -1)
|
||||||
|
{
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
|
{
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
val = vim_strsave(val);
|
val = vim_strsave(val);
|
||||||
Py_XDECREF(bytes);
|
Py_XDECREF(bytes);
|
||||||
@@ -1695,6 +1714,7 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_TypeError, _("object must be string"));
|
PyErr_SetString(PyExc_TypeError, _("object must be string"));
|
||||||
|
DICTKEY_UNREF
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1703,6 +1723,8 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
|
|||||||
vim_free(val);
|
vim_free(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DICTKEY_UNREF
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1041,
|
||||||
/**/
|
/**/
|
||||||
1040,
|
1040,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user