Fix building with Python 3.12

Freestyle was using static PyLongObject's which relied on setting the
it's integer value directly. Replace with PyLong_FromLong(..) which
is used everywhere else.

One reference to the internal integer value needed to be kept because
Nature_Type sub-classes PyLong.
This commit is contained in:
Campbell Barton
2024-01-31 08:46:27 +11:00
parent 8d48770418
commit f9729a311c
5 changed files with 30 additions and 96 deletions

View File

@@ -76,9 +76,10 @@ int Interface1D_Init(PyObject *module)
Py_INCREF(&Stroke_Type);
PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type);
PyDict_SetItemString(Stroke_Type.tp_dict, "DRY_MEDIUM", BPy_MediumType_DRY_MEDIUM);
PyDict_SetItemString(Stroke_Type.tp_dict, "HUMID_MEDIUM", BPy_MediumType_HUMID_MEDIUM);
PyDict_SetItemString(Stroke_Type.tp_dict, "OPAQUE_MEDIUM", BPy_MediumType_OPAQUE_MEDIUM);
PyDict_SetItemString(Stroke_Type.tp_dict, "DRY_MEDIUM", PyLong_FromLong(Stroke::DRY_MEDIUM));
PyDict_SetItemString(Stroke_Type.tp_dict, "HUMID_MEDIUM", PyLong_FromLong(Stroke::HUMID_MEDIUM));
PyDict_SetItemString(
Stroke_Type.tp_dict, "OPAQUE_MEDIUM", PyLong_FromLong(Stroke::OPAQUE_MEDIUM));
if (PyType_Ready(&ViewEdge_Type) < 0) {
return -1;