Skip to content

Commit fb8c30c

Browse files
committed
Use PyModule_AddType in math.c
1 parent a484e34 commit fb8c30c

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src_c/math.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4636,14 +4636,6 @@ MODINIT_DEFINE(math)
46364636
NULL,
46374637
NULL};
46384638

4639-
/* initialize the extension types */
4640-
if ((PyType_Ready(&pgVector2_Type) < 0) ||
4641-
(PyType_Ready(&pgVector3_Type) < 0) ||
4642-
(PyType_Ready(&pgVectorIter_Type) < 0) ||
4643-
(PyType_Ready(&pgVectorElementwiseProxy_Type) < 0)) {
4644-
return NULL;
4645-
}
4646-
46474639
/* initialize the module */
46484640
module = PyModule_Create(&_module);
46494641

@@ -4652,15 +4644,10 @@ MODINIT_DEFINE(math)
46524644
}
46534645

46544646
/* add extension types to module */
4655-
if ((PyModule_AddObjectRef(module, "Vector2",
4656-
(PyObject *)&pgVector2_Type) < 0) ||
4657-
(PyModule_AddObjectRef(module, "Vector3",
4658-
(PyObject *)&pgVector3_Type) < 0) ||
4659-
(PyModule_AddObjectRef(module, "VectorElementwiseProxy",
4660-
(PyObject *)&pgVectorElementwiseProxy_Type) <
4661-
0) ||
4662-
(PyModule_AddObjectRef(module, "VectorIterator",
4663-
(PyObject *)&pgVectorIter_Type) < 0)) {
4647+
if ((PyModule_AddType(module, &pgVector2_Type) < 0) ||
4648+
(PyModule_AddType(module, &pgVector3_Type) < 0) ||
4649+
(PyModule_AddType(module, &pgVectorElementwiseProxy_Type) < 0) ||
4650+
(PyModule_AddType(module, &pgVectorIter_Type) < 0)) {
46644651
Py_DECREF(module);
46654652
return NULL;
46664653
}

0 commit comments

Comments
 (0)