mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0916: with Python 3.7 "find_module" is not made available
Problem: With Python 3.7 "find_module" is not made available. Solution: Also add "find_module" with Python 3.7. (Joel Frederico, closes #3954)
This commit is contained in:
@@ -87,9 +87,9 @@ static PyObject *vim_special_path_object;
|
|||||||
#if PY_VERSION_HEX >= 0x030700f0
|
#if PY_VERSION_HEX >= 0x030700f0
|
||||||
static PyObject *py_find_spec;
|
static PyObject *py_find_spec;
|
||||||
#else
|
#else
|
||||||
static PyObject *py_find_module;
|
|
||||||
static PyObject *py_load_module;
|
static PyObject *py_load_module;
|
||||||
#endif
|
#endif
|
||||||
|
static PyObject *py_find_module;
|
||||||
|
|
||||||
static PyObject *VimError;
|
static PyObject *VimError;
|
||||||
|
|
||||||
@@ -759,7 +759,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
|
|||||||
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
||||||
ret = PyString_FromString((char *)buf);
|
ret = PyString_FromString((char *)buf);
|
||||||
}
|
}
|
||||||
# ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
else if (our_tv->v_type == VAR_FLOAT)
|
else if (our_tv->v_type == VAR_FLOAT)
|
||||||
{
|
{
|
||||||
char buf[NUMBUFLEN];
|
char buf[NUMBUFLEN];
|
||||||
@@ -767,7 +767,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
|
|||||||
sprintf(buf, "%f", our_tv->vval.v_float);
|
sprintf(buf, "%f", our_tv->vval.v_float);
|
||||||
ret = PyString_FromString((char *)buf);
|
ret = PyString_FromString((char *)buf);
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
else if (our_tv->v_type == VAR_LIST)
|
else if (our_tv->v_type == VAR_LIST)
|
||||||
{
|
{
|
||||||
list_T *list = our_tv->vval.v_list;
|
list_T *list = our_tv->vval.v_list;
|
||||||
@@ -6093,18 +6093,18 @@ convert_dl(PyObject *obj, typval_T *tv,
|
|||||||
|
|
||||||
sprintf(hexBuf, "%p", (void *)obj);
|
sprintf(hexBuf, "%p", (void *)obj);
|
||||||
|
|
||||||
# ifdef PY_USE_CAPSULE
|
#ifdef PY_USE_CAPSULE
|
||||||
capsule = PyDict_GetItemString(lookup_dict, hexBuf);
|
capsule = PyDict_GetItemString(lookup_dict, hexBuf);
|
||||||
# else
|
#else
|
||||||
capsule = (PyObject *)PyDict_GetItemString(lookup_dict, hexBuf);
|
capsule = (PyObject *)PyDict_GetItemString(lookup_dict, hexBuf);
|
||||||
# endif
|
#endif
|
||||||
if (capsule == NULL)
|
if (capsule == NULL)
|
||||||
{
|
{
|
||||||
# ifdef PY_USE_CAPSULE
|
#ifdef PY_USE_CAPSULE
|
||||||
capsule = PyCapsule_New(tv, NULL, NULL);
|
capsule = PyCapsule_New(tv, NULL, NULL);
|
||||||
# else
|
#else
|
||||||
capsule = PyCObject_FromVoidPtr(tv, NULL);
|
capsule = PyCObject_FromVoidPtr(tv, NULL);
|
||||||
# endif
|
#endif
|
||||||
if (PyDict_SetItemString(lookup_dict, hexBuf, capsule))
|
if (PyDict_SetItemString(lookup_dict, hexBuf, capsule))
|
||||||
{
|
{
|
||||||
Py_DECREF(capsule);
|
Py_DECREF(capsule);
|
||||||
@@ -6130,11 +6130,11 @@ convert_dl(PyObject *obj, typval_T *tv,
|
|||||||
{
|
{
|
||||||
typval_T *v;
|
typval_T *v;
|
||||||
|
|
||||||
# ifdef PY_USE_CAPSULE
|
#ifdef PY_USE_CAPSULE
|
||||||
v = PyCapsule_GetPointer(capsule, NULL);
|
v = PyCapsule_GetPointer(capsule, NULL);
|
||||||
# else
|
#else
|
||||||
v = PyCObject_AsVoidPtr(capsule);
|
v = PyCObject_AsVoidPtr(capsule);
|
||||||
# endif
|
#endif
|
||||||
copy_tv(v, tv);
|
copy_tv(v, tv);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -6921,6 +6921,13 @@ populate_module(PyObject *m)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((py_find_module = PyObject_GetAttrString(cls, "find_module")))
|
||||||
|
{
|
||||||
|
// find_module() is deprecated, this may stop working in some later
|
||||||
|
// version.
|
||||||
|
ADD_OBJECT(m, "_find_module", py_find_module);
|
||||||
|
}
|
||||||
|
|
||||||
Py_DECREF(imp);
|
Py_DECREF(imp);
|
||||||
|
|
||||||
ADD_OBJECT(m, "_find_spec", py_find_spec);
|
ADD_OBJECT(m, "_find_spec", py_find_spec);
|
||||||
|
@@ -783,6 +783,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 */
|
||||||
|
/**/
|
||||||
|
916,
|
||||||
/**/
|
/**/
|
||||||
915,
|
915,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user