Skip to content

Commit 549c633

Browse files
committed
hopefully fixed compiling in Unix-based systems
1 parent 5deeb79 commit 549c633

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ def build() -> None:
2121

2222
cmd = ["clang-format", "-i"] + c_files + h_files
2323
print(shlex.join(cmd))
24-
sys.exit(subprocess.call(cmd))
24+
subprocess.call(cmd)
25+
26+
cmd = ["black", "."]
27+
print(shlex.join(cmd))
28+
subprocess.call(cmd)
29+
30+
sys.exit(0)
2531

2632
build()

src_c/circle.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "include/collisions.h"
44

55
#include <limits.h>
6+
#include <float.h>
7+
#include <stddef.h>
68
#include <math.h>
79

810
static PyTypeObject pgCircle_Type;
@@ -379,7 +381,7 @@ pg_circle_richcompare(PyObject *o1, PyObject *o2, int opid)
379381
self->circle.name = val; \
380382
return 0; \
381383
} \
382-
RAISE(PyExc_TypeError, "Expected a number"); \
384+
PyErr_SetString(PyExc_TypeError, "Expected a number"); \
383385
return -1; \
384386
}
385387

@@ -402,7 +404,7 @@ pg_circle_setr(pgCircleObject *self, PyObject *value, void *closure)
402404
DEL_ATTR_NOT_SUPPORTED_CHECK_NO_NAME(value);
403405

404406
if (!pg_DoubleFromObj(value, &val) || val < 0) {
405-
RAISE(PyExc_TypeError, "Expected a positive number");
407+
PyErr_SetString(PyExc_TypeError, "Expected a positive number");
406408
return -1;
407409
}
408410

@@ -424,7 +426,7 @@ pg_circle_setr_sqr(pgCircleObject *self, PyObject *value, void *closure)
424426
DEL_ATTR_NOT_SUPPORTED_CHECK_NO_NAME(value);
425427

426428
if (!pg_DoubleFromObj(value, &val) || val < 0) {
427-
RAISE(PyExc_TypeError, "Expected a positive number");
429+
PyErr_SetString(PyExc_TypeError, "Expected a positive number");
428430
return -1;
429431
}
430432

src_c/geometry.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,3 @@ MODINIT_DEFINE(geometry)
9494
}
9595
return module;
9696
}
97-
98-
99-
100-
101-
102-
103-

src_c/include/pygame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ typedef struct {
154154

155155
#include "base.h"
156156

157-
158157
#ifndef PySequence_FAST_CHECK
159158
#define PySequence_FAST_CHECK(o) (PyList_Check(o) || PyTuple_Check(o))
160159
#endif /* ~PySequence_FAST_CHECK */

src_c/line.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "include/collisions.h"
44

55
#include <limits.h>
6+
#include <float.h>
7+
#include <stddef.h>
68
#include <math.h>
79

810
static PyTypeObject pgLine_Type;
@@ -209,7 +211,7 @@ pg_line_copy(pgLineObject *self, PyObject *_null)
209211
}
210212

211213
static PyObject *
212-
pg_line_raycast(pgLineObject *self, PyObject* const* args, Py_ssize_t nargs)
214+
pg_line_raycast(pgLineObject *self, PyObject *const *args, Py_ssize_t nargs)
213215
{
214216
PyObject **farr;
215217
Py_ssize_t loop;
@@ -267,9 +269,8 @@ pg_line_collideline(pgLineObject *self, PyObject *const *args,
267269
pgLineBase B;
268270

269271
if (!pgLine_FromObjectFastcall(args, nargs, &B)) {
270-
RAISE(PyExc_TypeError,
271-
"Line.collideline requires a line or LineLike object");
272-
return NULL;
272+
return RAISE(PyExc_TypeError,
273+
"Line.collideline requires a line or LineLike object");
273274
}
274275

275276
return PyBool_FromLong(pgCollision_LineLine(&self->line, &B));
@@ -386,9 +387,8 @@ static PyObject *
386387
pg_line_update(pgLineObject *self, PyObject *const *args, Py_ssize_t nargs)
387388
{
388389
if (!pgLine_FromObjectFastcall(args, nargs, &(self->line))) {
389-
RAISE(PyExc_TypeError,
390-
"Line.update requires a line or LineLike object");
391-
return NULL;
390+
return RAISE(PyExc_TypeError,
391+
"Line.update requires a line or LineLike object");
392392
}
393393
Py_RETURN_NONE;
394394
}
@@ -463,9 +463,9 @@ pg_line_contains_seq(pgLineObject *self, PyObject *arg)
463463

464464
pgLineBase B;
465465
if (!pgLine_FromObject(arg, &B)) {
466-
RAISE(PyExc_TypeError,
467-
"'in <pygame.Line>' requires line style object"
468-
" or int as left operand");
466+
PyErr_SetString(PyExc_TypeError,
467+
"'in <pygame.Line>' requires line style object"
468+
" or int as left operand");
469469
return 0;
470470
}
471471

@@ -586,7 +586,7 @@ pg_line_ass_subscript(pgLineObject *self, PyObject *op, PyObject *value)
586586
if (!pg_DoubleFromObj(item, values + i)) {
587587
PyErr_Format(PyExc_TypeError,
588588
"Expected a number between %lf and %lf",
589-
DBL_TRUE_MIN, DBL_MAX);
589+
DBL_MIN, DBL_MAX);
590590
}
591591
}
592592
self->line.x1 = values[0];
@@ -632,7 +632,7 @@ pg_line_ass_subscript(pgLineObject *self, PyObject *op, PyObject *value)
632632
if (!pg_DoubleFromObj(item, values + i)) {
633633
PyErr_Format(PyExc_TypeError,
634634
"Expected a number between %lf and %lf",
635-
DBL_TRUE_MIN, DBL_MAX);
635+
DBL_MIN, DBL_MAX);
636636
}
637637
}
638638
for (i = 0; i < slicelen; ++i) {
@@ -757,7 +757,7 @@ pg_line_iterator(pgLineObject *self)
757757
self->line.name = val; \
758758
return 0; \
759759
} \
760-
RAISE(PyExc_TypeError, "Expected a number"); \
760+
PyErr_SetString(PyExc_TypeError, "Expected a number"); \
761761
return -1; \
762762
}
763763

0 commit comments

Comments
 (0)