Skip to content

Commit a484e34

Browse files
committed
Remove math C API
1 parent a93e57f commit a484e34

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

src_c/_pygame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ typedef enum {
670670
#define PYGAMEAPI_RWOBJECT_NUMSLOTS 5
671671
#define PYGAMEAPI_PIXELARRAY_NUMSLOTS 2
672672
#define PYGAMEAPI_COLOR_NUMSLOTS 5
673-
#define PYGAMEAPI_MATH_NUMSLOTS 2
674673
#define PYGAMEAPI_BASE_NUMSLOTS 30
675674
#define PYGAMEAPI_EVENT_NUMSLOTS 10
676675
#define PYGAMEAPI_WINDOW_NUMSLOTS 1

src_c/include/_pygame.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -509,26 +509,10 @@ typedef struct pgColorObject pgColorObject;
509509
#endif /* PYGAMEAPI_COLOR_INTERNAL */
510510

511511
/*
512-
* Math module
512+
* Geometry module
513513
*/
514-
#ifndef PYGAMEAPI_MATH_INTERNAL
515-
#define pgVector2_Check(x) \
516-
((x)->ob_type == (PyTypeObject *)PYGAMEAPI_GET_SLOT(math, 0))
517-
518-
#define pgVector3_Check(x) \
519-
((x)->ob_type == (PyTypeObject *)PYGAMEAPI_GET_SLOT(math, 1))
520-
/*
521-
#define pgVector2_New \
522-
(*(PyObject*(*)) \
523-
PYGAMEAPI_GET_SLOT(PyGAME_C_API, 1))
524-
*/
525-
#define import_pygame_math() IMPORT_PYGAME_MODULE(math)
526-
#endif /* PYGAMEAPI_MATH_INTERNAL */
527-
528514
#ifndef PYGAMEAPI_GEOMETRY_INTERNAL
529-
530515
#define import_pygame_geometry() IMPORT_PYGAME_MODULE(geometry)
531-
532516
#endif /* ~PYGAMEAPI_GEOMETRY_INTERNAL */
533517

534518
/*

src_c/math.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4625,9 +4625,7 @@ MODINIT_DEFINE(pg_math)
46254625
MODINIT_DEFINE(math)
46264626
#endif
46274627
{
4628-
PyObject *module, *apiobj;
4629-
static void *c_api[PYGAMEAPI_MATH_NUMSLOTS];
4630-
4628+
PyObject *module;
46314629
static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
46324630
"math",
46334631
DOC_MATH,
@@ -4667,19 +4665,5 @@ MODINIT_DEFINE(math)
46674665
return NULL;
46684666
}
46694667

4670-
/* export the C api */
4671-
c_api[0] = &pgVector2_Type;
4672-
c_api[1] = &pgVector3_Type;
4673-
/*
4674-
c_api[2] = pgVector_NEW;
4675-
c_api[3] = pgVectorCompatible_Check;
4676-
*/
4677-
apiobj = encapsulate_api(c_api, "math");
4678-
if (PyModule_AddObject(module, PYGAMEAPI_LOCAL_ENTRY, apiobj)) {
4679-
Py_XDECREF(apiobj);
4680-
Py_DECREF(module);
4681-
return NULL;
4682-
}
4683-
46844668
return module;
46854669
}

0 commit comments

Comments
 (0)