Removed _avif.HAVE_AVIF and _avif.VERSION (#11)

* Removed unused attributes

* Decrement reference count

---------

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
Andrew Murray 2024-12-16 06:48:00 +11:00 committed by GitHub
parent 4eaa6b71ef
commit bdb24f9c84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1006,36 +1006,15 @@ static PyMethodDef avifMethods[] = {
static int
setup_module(PyObject *m) {
PyObject *d = PyModule_GetDict(m);
PyObject *v = PyUnicode_FromString(avifVersion());
if (PyDict_SetItemString(d, "libavif_version", v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);
v = Py_True;
Py_INCREF(v);
if (PyDict_SetItemString(d, "HAVE_AVIF", v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);
v = Py_BuildValue(
"(iii)", AVIF_VERSION_MAJOR, AVIF_VERSION_MINOR, AVIF_VERSION_PATCH
);
if (PyDict_SetItemString(d, "VERSION", v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);
if (PyType_Ready(&AvifDecoder_Type) < 0 || PyType_Ready(&AvifEncoder_Type) < 0) {
return -1;
}
PyObject *d = PyModule_GetDict(m);
PyObject *v = PyUnicode_FromString(avifVersion());
PyDict_SetItemString(d, "libavif_version", v ? v : Py_None);
Py_XDECREF(v);
return 0;
}
@ -1052,6 +1031,7 @@ PyInit__avif(void) {
m = PyModule_Create(&module_def);
if (setup_module(m) < 0) {
Py_DECREF(m);
return NULL;
}