[ 
https://issues.apache.org/jira/browse/PYLUCENE-66?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17629184#comment-17629184
 ] 

Andi Vajda edited comment on PYLUCENE-66 at 11/4/22 7:50 PM:
-------------------------------------------------------------

The installType function in jcc/jcc3/sources/functions.cpp is supposed to be

{{
void installType(PyTypeObject **type, PyType_Def *def,
                 PyObject *module, char *name, int isExtension)
{
    if (*type == NULL)
    {
        *type = makeType(def);

        if (isExtension)
        {
#if PY_VERSION_HEX >= 0x030b0000
            Py_SET_TYPE(*type, PY_TYPE(FinalizerClass));
#else
            Py_TYPE(*type) = PY_TYPE(FinalizerClass);
#endif
            Py_INCREF(PY_TYPE(FinalizerClass));
        }

        PyObject *module_name = PyModule_GetNameObject(module);

        if (module_name != NULL)
        {
            PyDict_SetItemString((*type)->tp_dict, "__module__", module_name);
            Py_DECREF(module_name);
        }

        PyModule_AddObject(module, name, (PyObject *) *type);
    }
}
}}


was (Author: vajda):
The installType function in jcc/jcc3/sources/functions.cpp is supposed to be
```
void installType(PyTypeObject **type, PyType_Def *def,
                 PyObject *module, char *name, int isExtension)
{
    if (*type == NULL)
    {
        *type = makeType(def);

        if (isExtension)
        {
#if PY_VERSION_HEX >= 0x030b0000
            Py_SET_TYPE(*type, PY_TYPE(FinalizerClass));
#else
            Py_TYPE(*type) = PY_TYPE(FinalizerClass);
#endif
            Py_INCREF(PY_TYPE(FinalizerClass));
        }

        PyObject *module_name = PyModule_GetNameObject(module);

        if (module_name != NULL)
        {
            PyDict_SetItemString((*type)->tp_dict, "__module__", module_name);
            Py_DECREF(module_name);
        }

        PyModule_AddObject(module, name, (PyObject *) *type);
    }
}
```



> JCC doesn't build with Python 3.11.
> -----------------------------------
>
>                 Key: PYLUCENE-66
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-66
>             Project: PyLucene
>          Issue Type: Bug
>         Environment: Python 3.11, PyLucene 9.4.1-rc
>            Reporter: A. Coady
>            Priority: Major
>
> {{#10 10.86 In file included from /usr/local/include/python3.11/Python.h:44,}}
> {{#10 10.86 from _jcc3/java/lang/Object.h:18,}}
> {{#10 10.86 from jcc3/sources/functions.cpp:23:}}
> {{#10 10.86 jcc3/sources/functions.cpp: In function ‘void 
> installType(PyTypeObject*{*}, PyType_Def{*}, PyObject*, char*, int)’:}}
> {{#10 10.86 /usr/local/include/python3.11/object.h:136:30: error: lvalue 
> required as left operand of assignment}}
> {{#10 10.86 136 | # define Py_TYPE(ob) Py_TYPE(_PyObject_CAST(ob))}}
> {{#10 10.86 | ~~~~~{~}{{~}}^{{~}}{~}~~~~~~~~~~~~~~~~~}}
> {{#10 10.86 jcc3/sources/functions.cpp:1742:13: note: in expansion of macro 
> ‘Py_TYPE’}}
> {{#10 10.86 1742 | Py_TYPE(*type) = PY_TYPE(FinalizerClass);}}
> {{#10 10.86 | ^~~~~~~}}
> {{#10 10.89 error: command '/usr/bin/gcc' failed with exit code 1}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to