[SCM] python-pyo/master: Fix segfault when rendering.

tiago at users.alioth.debian.org tiago at users.alioth.debian.org
Fri Jan 29 19:29:28 UTC 2016


The following commit has been merged in the master branch:
commit 68c5496a924afb7ca4c69adc159fb7b643f43b3b
Author: Tiago Bortoletto Vaz <tiago at debian.org>
Date:   Fri Jan 29 14:04:25 2016 -0500

    Fix segfault when rendering.

diff --git a/debian/changelog b/debian/changelog
index 5f475f5..93f2b18 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-pyo (0.7.8+git20160129-1) unstable; urgency=medium
+
+  * Fix segfault when rendering.
+
+ -- Tiago Bortoletto Vaz <tiago at debian.org>  Fri, 29 Jan 2016 14:03:47 -0500
+
 python-pyo (0.7.8-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/include/pyomodule.h b/include/pyomodule.h
index fea78b9..b5ba8b5 100644
--- a/include/pyomodule.h
+++ b/include/pyomodule.h
@@ -587,8 +587,7 @@ extern PyTypeObject ExprType;
 
 #define pyo_CLEAR \
     if (self->server != NULL) { \
-        Py_INCREF(self->server); \
-        Py_CLEAR(self->server); \
+        self->server = NULL; \
     } \
     if (self->stream != NULL) \
         Py_CLEAR(self->stream); \
@@ -599,16 +598,14 @@ extern PyTypeObject ExprType;
 
 #define pyo_table_CLEAR \
     if (self->server != NULL) { \
-        Py_INCREF(self->server); \
-        Py_CLEAR(self->server); \
+        self->server = NULL; \
     } \
     if (self->tablestream != NULL) \
         Py_CLEAR(self->tablestream); \
 
 #define pyo_matrix_CLEAR \
     if (self->server != NULL) { \
-        Py_INCREF(self->server); \
-        Py_CLEAR(self->server); \
+        self->server = NULL; \
     } \
     if (self->matrixstream != NULL) \
         Py_CLEAR(self->matrixstream); \
@@ -618,6 +615,12 @@ extern PyTypeObject ExprType;
         Server_removeStream((Server *)self->server, Stream_getStreamId(self->stream)); \
     free(self->data); \
 
+#define ASSERT_ARG_NOT_NULL \
+	if (arg == NULL) { \
+		Py_INCREF(Py_None); \
+		return Py_None; \
+	}
+
 /* INIT INPUT STREAM */
 #define INIT_INPUT_STREAM \
     if ( PyObject_HasAttrString((PyObject *)inputtmp, "server") == 0 ) { \
diff --git a/pyolib/expression.py b/pyolib/expression.py
index 4a8e8c0..87369ca 100644
--- a/pyolib/expression.py
+++ b/pyolib/expression.py
@@ -509,6 +509,22 @@ class Expr(PyoObject):
         return x
 
     def editor(self, title="Expr Editor", wxnoserver=False):
+        """
+        Opens the text editor for this object.
+
+        :Args:
+
+            title : string, optional
+                Title of the window. If none is provided, the name of the
+                class is used.
+            wxnoserver : boolean, optional
+                With wxPython graphical toolkit, if True, tells the
+                interpreter that there will be no server window.
+
+        If `wxnoserver` is set to True, the interpreter will not wait for
+        the server GUI before showing the controller window.
+
+        """
         createExprEditorWindow(self, title, wxnoserver)
 
     @property
diff --git a/src/engine/servermodule.c b/src/engine/servermodule.c
index 9ede3de..a7b8e31 100644
--- a/src/engine/servermodule.c
+++ b/src/engine/servermodule.c
@@ -1227,6 +1227,7 @@ Server_offline_start(Server *self)
         offline_process_block((Server *) self);
     }
     self->server_started = 0;
+    self->server_stopped = 1;
     self->record = 0;
     sf_close(self->recfile);
     Server_message(self,"Offline Server rendering finished.\n");
@@ -2006,11 +2007,7 @@ Server_setAmpCallable(Server *self, PyObject *arg)
     int i;
     PyObject *tmp;
 
-    if (arg == NULL) {
-        Server_error(self,"The amplitude callable attribute must be a method.\n");
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     tmp = arg;
     Py_XDECREF(self->GUI);
@@ -2041,11 +2038,7 @@ Server_setTimeCallable(Server *self, PyObject *arg)
     int i;
     PyObject *tmp;
 
-    if (arg == NULL) {
-        Server_error(self,"The time callable attribute must be a method.\n");
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     tmp = arg;
     Py_XDECREF(self->TIME);
@@ -2644,8 +2637,9 @@ Server_removeStream(Server *self, int id)
 {
     int i, sid;
     Stream *stream_tmp;
-
-    if (PyObject_HasAttrString((PyObject *)self, "streams")) {
+    PyGILState_STATE s = PyGILState_Ensure();
+    //if (PyObject_HasAttrString((PyObject *)self, "streams")) {
+    if (PySequence_Size(self->streams) != -1) {
         for (i=0; i<self->stream_count; i++) {
             stream_tmp = (Stream *)PyList_GetItem(self->streams, i);
             if (stream_tmp != NULL) {
@@ -2659,6 +2653,7 @@ Server_removeStream(Server *self, int id)
             }
         }
     }
+    PyGILState_Release(s);
 
     Py_INCREF(Py_None);
     return Py_None;
diff --git a/src/objects/analysismodule.c b/src/objects/analysismodule.c
index 3bb24de..944570b 100644
--- a/src/objects/analysismodule.c
+++ b/src/objects/analysismodule.c
@@ -252,10 +252,7 @@ Follower_setFreq(Follower *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -723,10 +720,7 @@ Follower2_setRisetime(Follower2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -757,10 +751,7 @@ Follower2_setFalltime(Follower2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1074,10 +1065,7 @@ static PyObject * ZCross_inplace_div(ZCross *self, PyObject *arg) { INPLACE_DIV
 static PyObject *
 ZCross_setThresh(ZCross *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1463,10 +1451,7 @@ static PyObject * Yin_inplace_div(Yin *self, PyObject *arg) { INPLACE_DIV };
 static PyObject *
 Yin_setTolerance(Yin *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1480,10 +1465,7 @@ Yin_setTolerance(Yin *self, PyObject *arg)
 static PyObject *
 Yin_setMinfreq(Yin *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1497,10 +1479,7 @@ Yin_setMinfreq(Yin *self, PyObject *arg)
 static PyObject *
 Yin_setMaxfreq(Yin *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1514,10 +1493,7 @@ Yin_setMaxfreq(Yin *self, PyObject *arg)
 static PyObject *
 Yin_setCutoff(Yin *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2234,10 +2210,7 @@ static PyObject * AttackDetector_inplace_div(AttackDetector *self, PyObject *arg
 static PyObject *
 AttackDetector_setDeltime(AttackDetector *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2254,10 +2227,7 @@ AttackDetector_setDeltime(AttackDetector *self, PyObject *arg)
 static PyObject *
 AttackDetector_setCutoff(AttackDetector *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2274,10 +2244,7 @@ AttackDetector_setCutoff(AttackDetector *self, PyObject *arg)
 static PyObject *
 AttackDetector_setMaxthresh(AttackDetector *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2293,10 +2260,7 @@ AttackDetector_setMaxthresh(AttackDetector *self, PyObject *arg)
 static PyObject *
 AttackDetector_setMinthresh(AttackDetector *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2312,10 +2276,7 @@ AttackDetector_setMinthresh(AttackDetector *self, PyObject *arg)
 static PyObject *
 AttackDetector_setReltime(AttackDetector *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/arithmeticmodule.c b/src/objects/arithmeticmodule.c
index 6bfc398..443925a 100644
--- a/src/objects/arithmeticmodule.c
+++ b/src/objects/arithmeticmodule.c
@@ -2402,10 +2402,7 @@ M_Pow_setBase(M_Pow *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2436,10 +2433,7 @@ M_Pow_setExponent(M_Pow *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2805,10 +2799,7 @@ M_Atan2_setB(M_Atan2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2839,10 +2830,7 @@ M_Atan2_setA(M_Atan2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/bandsplitmodule.c b/src/objects/bandsplitmodule.c
index 304de37..1703f89 100644
--- a/src/objects/bandsplitmodule.c
+++ b/src/objects/bandsplitmodule.c
@@ -271,10 +271,7 @@ BandSplitter_setQ(BandSplitter *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -915,10 +912,7 @@ FourBandMain_setFreq1(FourBandMain *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -947,10 +941,7 @@ FourBandMain_setFreq2(FourBandMain *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -979,10 +970,7 @@ FourBandMain_setFreq3(FourBandMain *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/chorusmodule.c b/src/objects/chorusmodule.c
index e70e1d4..662a00c 100644
--- a/src/objects/chorusmodule.c
+++ b/src/objects/chorusmodule.c
@@ -522,10 +522,7 @@ Chorus_setDepth(Chorus *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -556,10 +553,7 @@ Chorus_setFeedback(Chorus *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -590,10 +584,7 @@ Chorus_setMix(Chorus *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/compressmodule.c b/src/objects/compressmodule.c
index b65373d..01e7f54 100644
--- a/src/objects/compressmodule.c
+++ b/src/objects/compressmodule.c
@@ -347,10 +347,7 @@ Compress_setThresh(Compress *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -379,10 +376,7 @@ Compress_setRatio(Compress *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -411,10 +405,7 @@ Compress_setRiseTime(Compress *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -443,10 +434,7 @@ Compress_setFallTime(Compress *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -475,10 +463,7 @@ Compress_setLookAhead(Compress *self, PyObject *arg)
 {
     MYFLT tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyNumber_Check(arg)) {
 		tmp = PyFloat_AsDouble(arg);
@@ -497,10 +482,7 @@ Compress_setKnee(Compress *self, PyObject *arg)
 {
     MYFLT tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyNumber_Check(arg)) {
 		tmp = PyFloat_AsDouble(arg);
@@ -1338,10 +1320,7 @@ Gate_setThresh(Gate *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1372,10 +1351,7 @@ Gate_setRiseTime(Gate *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1406,10 +1382,7 @@ Gate_setFallTime(Gate *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1440,10 +1413,7 @@ Gate_setLookAhead(Gate *self, PyObject *arg)
 {
     MYFLT tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyNumber_Check(arg)) {
 		tmp = PyFloat_AsDouble(arg);
@@ -1825,10 +1795,7 @@ Balance_setFreq(Balance *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/convolvemodule.c b/src/objects/convolvemodule.c
index d0f2c8e..424f8c0 100644
--- a/src/objects/convolvemodule.c
+++ b/src/objects/convolvemodule.c
@@ -232,10 +232,7 @@ Convolve_setTable(Convolve *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -705,10 +702,7 @@ IRWinSinc_setFreq(IRWinSinc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -737,10 +731,7 @@ IRWinSinc_setBandwidth(IRWinSinc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -767,11 +758,7 @@ IRWinSinc_setBandwidth(IRWinSinc *self, PyObject *arg)
 static PyObject *
 IRWinSinc_setType(IRWinSinc *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1578,10 +1565,7 @@ IRPulse_setFreq(IRPulse *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1610,10 +1594,7 @@ IRPulse_setBandwidth(IRPulse *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1641,10 +1622,7 @@ static PyObject *
 IRPulse_setType(IRPulse *self, PyObject *arg)
 {
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -2075,10 +2053,7 @@ IRFM_setCarrier(IRFM *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2107,10 +2082,7 @@ IRFM_setRatio(IRFM *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2139,10 +2111,7 @@ IRFM_setIndex(IRFM *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/delaymodule.c b/src/objects/delaymodule.c
index f17cc9f..0566768 100644
--- a/src/objects/delaymodule.c
+++ b/src/objects/delaymodule.c
@@ -394,10 +394,7 @@ Delay_setDelay(Delay *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -428,10 +425,7 @@ Delay_setFeedback(Delay *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -832,10 +826,7 @@ SDelay_setDelay(SDelay *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1538,10 +1529,7 @@ Waveguide_setFreq(Waveguide *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1572,10 +1560,7 @@ Waveguide_setDur(Waveguide *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2559,10 +2544,7 @@ AllpassWG_setFreq(AllpassWG *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2593,10 +2575,7 @@ AllpassWG_setFeed(AllpassWG *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2627,10 +2606,7 @@ AllpassWG_setDetune(AllpassWG *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3546,10 +3522,7 @@ SmoothDelay_setDelay(SmoothDelay *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3580,10 +3553,7 @@ SmoothDelay_setFeedback(SmoothDelay *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3612,10 +3582,7 @@ SmoothDelay_setFeedback(SmoothDelay *self, PyObject *arg)
 static PyObject *
 SmoothDelay_setCrossfade(SmoothDelay *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/distomodule.c b/src/objects/distomodule.c
index 67bca8c..4782382 100644
--- a/src/objects/distomodule.c
+++ b/src/objects/distomodule.c
@@ -317,10 +317,7 @@ Disto_setDrive(Disto *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -351,10 +348,7 @@ Disto_setSlope(Disto *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -762,10 +756,7 @@ Clip_setMin(Clip *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -796,10 +787,7 @@ Clip_setMax(Clip *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1237,10 +1225,7 @@ Mirror_setMin(Mirror *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1271,10 +1256,7 @@ Mirror_setMax(Mirror *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1736,10 +1718,7 @@ Wrap_setMin(Wrap *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1770,10 +1749,7 @@ Wrap_setMax(Wrap *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2226,10 +2202,7 @@ Degrade_setBitdepth(Degrade *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2260,10 +2233,7 @@ Degrade_setSrscale(Degrade *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2595,10 +2565,7 @@ Min_setComp(Min *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2928,10 +2895,7 @@ Max_setComp(Max *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/fadermodule.c b/src/objects/fadermodule.c
index 29e6560..4049c59 100644
--- a/src/objects/fadermodule.c
+++ b/src/objects/fadermodule.c
@@ -1113,10 +1113,7 @@ Linseg_setList(Linseg *self, PyObject *value)
 static PyObject *
 Linseg_setLoop(Linseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
@@ -1534,10 +1531,7 @@ Expseg_setList(Expseg *self, PyObject *value)
 static PyObject *
 Expseg_setLoop(Expseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
@@ -1548,10 +1542,7 @@ Expseg_setLoop(Expseg *self, PyObject *arg)
 static PyObject *
 Expseg_setExp(Expseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyNumber_Check(arg))
         self->exp_tmp = PyFloat_AsDouble(arg);
@@ -1563,10 +1554,7 @@ Expseg_setExp(Expseg *self, PyObject *arg)
 static PyObject *
 Expseg_setInverse(Expseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyNumber_Check(arg))
         self->inverse_tmp = PyInt_AsLong(PyNumber_Int(arg));
diff --git a/src/objects/fftmodule.c b/src/objects/fftmodule.c
index ff84c37..9b16b6e 100644
--- a/src/objects/fftmodule.c
+++ b/src/objects/fftmodule.c
@@ -2827,10 +2827,7 @@ VectralMain_setUp(VectralMain *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2859,10 +2856,7 @@ VectralMain_setDown(VectralMain *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2891,10 +2885,7 @@ VectralMain_setDamp(VectralMain *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -3674,10 +3665,7 @@ CvlVerb_setBal(CvlVerb *self, PyObject *arg)
 {
     PyObject *tmp, *streamtmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/filtremodule.c b/src/objects/filtremodule.c
index 5d77198..5795a0f 100644
--- a/src/objects/filtremodule.c
+++ b/src/objects/filtremodule.c
@@ -422,10 +422,7 @@ Biquad_setFreq(Biquad *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -456,10 +453,7 @@ Biquad_setQ(Biquad *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -488,11 +482,7 @@ Biquad_setQ(Biquad *self, PyObject *arg)
 static PyObject *
 Biquad_setType(Biquad *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1053,10 +1043,7 @@ Biquadx_setFreq(Biquadx *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1087,10 +1074,7 @@ Biquadx_setQ(Biquadx *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1119,11 +1103,7 @@ Biquadx_setQ(Biquadx *self, PyObject *arg)
 static PyObject *
 Biquadx_setType(Biquadx *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1140,11 +1120,7 @@ Biquadx_setType(Biquadx *self, PyObject *arg)
 static PyObject *
 Biquadx_setStages(Biquadx *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1483,8 +1459,7 @@ Biquada_setB0(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -1499,8 +1474,7 @@ Biquada_setB1(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -1515,8 +1489,7 @@ Biquada_setB2(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -1531,8 +1504,7 @@ Biquada_setA0(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -1547,8 +1519,7 @@ Biquada_setA1(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -1563,8 +1534,7 @@ Biquada_setA2(Biquada *self, PyObject *arg)
 {
 	PyObject *streamtmp;
 
-	if (arg == NULL)
-		Py_RETURN_NONE;
+    ASSERT_ARG_NOT_NULL
 
     streamtmp = PyObject_CallMethod((PyObject *)arg, "_getStream", NULL);
     Py_INCREF(streamtmp);
@@ -2199,10 +2169,7 @@ EQ_setFreq(EQ *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2233,10 +2200,7 @@ EQ_setQ(EQ *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2267,10 +2231,7 @@ EQ_setBoost(EQ *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2299,11 +2260,7 @@ EQ_setBoost(EQ *self, PyObject *arg)
 static PyObject *
 EQ_setType(EQ *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -2723,10 +2680,7 @@ Port_setRiseTime(Port *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2757,10 +2711,7 @@ Port_setFallTime(Port *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3131,10 +3082,7 @@ Tone_setFreq(Tone *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3501,10 +3449,7 @@ Atone_setFreq(Atone *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4269,10 +4214,7 @@ Allpass_setDelay(Allpass *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4303,10 +4245,7 @@ Allpass_setFeedback(Allpass *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4749,10 +4688,7 @@ Allpass2_setFreq(Allpass2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4783,10 +4719,7 @@ Allpass2_setBw(Allpass2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5528,10 +5461,7 @@ Phaser_setFreq(Phaser *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5562,10 +5492,7 @@ Phaser_setSpread(Phaser *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5596,10 +5523,7 @@ Phaser_setQ(Phaser *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5630,10 +5554,7 @@ Phaser_setFeedback(Phaser *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6775,10 +6696,7 @@ Vocoder_setFreq(Vocoder *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6809,10 +6727,7 @@ Vocoder_setSpread(Vocoder *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6843,10 +6758,7 @@ Vocoder_setQ(Vocoder *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6877,10 +6789,7 @@ Vocoder_setSlope(Vocoder *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6909,11 +6818,7 @@ Vocoder_setSlope(Vocoder *self, PyObject *arg)
 static PyObject *
 Vocoder_setStages(Vocoder *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -7646,10 +7551,7 @@ SVF_setFreq(SVF *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7680,10 +7582,7 @@ SVF_setQ(SVF *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7714,10 +7613,7 @@ SVF_setType(SVF *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -8070,10 +7966,8 @@ static PyObject *
 Average_setSize(Average *self, PyObject *arg)
 {
 	int i;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -8521,10 +8415,7 @@ Reson_setFreq(Reson *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -8555,10 +8446,7 @@ Reson_setQ(Reson *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9054,10 +8942,7 @@ Resonx_setFreq(Resonx *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9088,10 +8973,7 @@ Resonx_setQ(Resonx *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9120,11 +9002,7 @@ Resonx_setQ(Resonx *self, PyObject *arg)
 static PyObject *
 Resonx_setStages(Resonx *self, PyObject *arg)
 {
-
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -9503,10 +9381,7 @@ ButLP_setFreq(ButLP *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9895,10 +9770,7 @@ ButHP_setFreq(ButHP *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10359,10 +10231,7 @@ ButBP_setFreq(ButBP *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10393,10 +10262,7 @@ ButBP_setQ(ButBP *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10859,10 +10725,7 @@ ButBR_setFreq(ButBR *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10893,10 +10756,7 @@ ButBR_setQ(ButBR *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -11366,10 +11226,7 @@ ComplexRes_setFreq(ComplexRes *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -11400,10 +11257,7 @@ ComplexRes_setDecay(ComplexRes *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/freeverbmodule.c b/src/objects/freeverbmodule.c
index 2558d79..e2ef257 100644
--- a/src/objects/freeverbmodule.c
+++ b/src/objects/freeverbmodule.c
@@ -722,10 +722,7 @@ Freeverb_setSize(Freeverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -756,10 +753,7 @@ Freeverb_setDamp(Freeverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -790,10 +784,7 @@ Freeverb_setMix(Freeverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/granulatormodule.c b/src/objects/granulatormodule.c
index 3d49171..4470e82 100644
--- a/src/objects/granulatormodule.c
+++ b/src/objects/granulatormodule.c
@@ -794,10 +794,7 @@ Granulator_setPitch(Granulator *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -828,10 +825,7 @@ Granulator_setPos(Granulator *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -862,10 +856,7 @@ Granulator_setDur(Granulator *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -903,10 +894,7 @@ Granulator_setTable(Granulator *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -928,10 +916,7 @@ Granulator_setEnv(Granulator *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->env);
@@ -1857,10 +1842,7 @@ Looper_setPitch(Looper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1891,10 +1873,7 @@ Looper_setStart(Looper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1923,10 +1902,7 @@ Looper_setDur(Looper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1955,10 +1931,7 @@ Looper_setXfade(Looper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1994,10 +1967,7 @@ Looper_setTable(Looper *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -2010,10 +1980,7 @@ Looper_setTable(Looper *self, PyObject *arg)
 static PyObject *
 Looper_setStartFromLoop(Looper *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isInt = PyInt_Check(arg);
 
@@ -2028,10 +1995,7 @@ Looper_setStartFromLoop(Looper *self, PyObject *arg)
 static PyObject *
 Looper_setXfadeShape(Looper *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isInt = PyInt_Check(arg);
 
@@ -2047,10 +2011,8 @@ static PyObject *
 Looper_setMode(Looper *self, PyObject *arg)
 {
     int tmp;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
     int isInt = PyInt_Check(arg);
 
@@ -2067,10 +2029,7 @@ Looper_setMode(Looper *self, PyObject *arg)
 static PyObject *
 Looper_setInterp(Looper *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2087,10 +2046,7 @@ Looper_setInterp(Looper *self, PyObject *arg)
 static PyObject *
 Looper_setAutoSmooth(Looper *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isInt = PyInt_Check(arg);
 
@@ -2674,10 +2630,7 @@ Granule_setDens(Granule *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2708,10 +2661,7 @@ Granule_setPitch(Granule *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2740,10 +2690,7 @@ Granule_setPos(Granule *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2772,10 +2719,7 @@ Granule_setDur(Granule *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2811,10 +2755,7 @@ Granule_setTable(Granule *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -2836,10 +2777,7 @@ Granule_setEnv(Granule *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->env);
@@ -3702,10 +3640,7 @@ MainParticle_setDens(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3736,10 +3671,7 @@ MainParticle_setPitch(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3768,10 +3700,7 @@ MainParticle_setPos(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3800,10 +3729,7 @@ MainParticle_setDur(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3832,10 +3758,7 @@ MainParticle_setDev(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3864,10 +3787,7 @@ MainParticle_setPan(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3903,10 +3823,7 @@ MainParticle_setTable(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -3929,10 +3846,7 @@ MainParticle_setEnv(MainParticle *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->env);
diff --git a/src/objects/harmonizermodule.c b/src/objects/harmonizermodule.c
index 2b1a24b..ca4214d 100644
--- a/src/objects/harmonizermodule.c
+++ b/src/objects/harmonizermodule.c
@@ -513,10 +513,7 @@ Harmonizer_setTranspo(Harmonizer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -547,10 +544,7 @@ Harmonizer_setFeedback(Harmonizer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -581,10 +575,7 @@ Harmonizer_setWinsize(Harmonizer *self, PyObject *arg)
 {
 	MYFLT wintmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/lfomodule.c b/src/objects/lfomodule.c
index 0e399e2..ef9be04 100644
--- a/src/objects/lfomodule.c
+++ b/src/objects/lfomodule.c
@@ -993,10 +993,7 @@ LFO_setFreq(LFO *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1027,10 +1024,7 @@ LFO_setSharp(LFO *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1061,10 +1055,7 @@ LFO_setType(LFO *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
diff --git a/src/objects/matrixmodule.c b/src/objects/matrixmodule.c
index 46671e7..851e002 100644
--- a/src/objects/matrixmodule.c
+++ b/src/objects/matrixmodule.c
@@ -638,10 +638,7 @@ MatrixRec_setMatrix(MatrixRec *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -831,10 +828,7 @@ MatrixRecLoop_setMatrix(MatrixRecLoop *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -1043,10 +1037,7 @@ MatrixMorph_setMatrix(MatrixMorph *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -1060,10 +1051,7 @@ MatrixMorph_setMatrix(MatrixMorph *self, PyObject *arg)
 static PyObject *
 MatrixMorph_setSources(MatrixMorph *self, PyObject *arg)
 {
-    if (arg == NULL) {
-        PyErr_SetString(PyExc_TypeError, "Cannot delete the list attribute.");
-        return PyInt_FromLong(-1);
-    }
+    ASSERT_ARG_NOT_NULL
 
     if (! PyList_Check(arg)) {
         PyErr_SetString(PyExc_TypeError, "The amplitude list attribute value must be a list.");
diff --git a/src/objects/matrixprocessmodule.c b/src/objects/matrixprocessmodule.c
index 78a51f7..e00446a 100644
--- a/src/objects/matrixprocessmodule.c
+++ b/src/objects/matrixprocessmodule.c
@@ -219,10 +219,7 @@ MatrixPointer_setMatrix(MatrixPointer *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     if ( PyObject_HasAttrString((PyObject *)tmp, "getMatrixStream") == 0 ) {
@@ -242,10 +239,7 @@ MatrixPointer_setX(MatrixPointer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 
@@ -272,10 +266,7 @@ MatrixPointer_setY(MatrixPointer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 
diff --git a/src/objects/metromodule.c b/src/objects/metromodule.c
index a07505b..4913b0b 100644
--- a/src/objects/metromodule.c
+++ b/src/objects/metromodule.c
@@ -246,10 +246,7 @@ Metro_setTime(Metro *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -610,10 +607,7 @@ Seqer_setTime(Seqer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -644,10 +638,7 @@ Seqer_setSeq(Seqer *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isList = PyList_Check(arg);
 
@@ -1141,10 +1132,7 @@ Clouder_setDensity(Clouder *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2268,10 +2256,7 @@ Beater_setTime(Beater *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/midimodule.c b/src/objects/midimodule.c
index 3997a13..6849296 100644
--- a/src/objects/midimodule.c
+++ b/src/objects/midimodule.c
@@ -632,10 +632,7 @@ Midictl_setInterpolation(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyInt_Check(arg);
 
@@ -656,10 +653,7 @@ Midictl_setValue(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -677,10 +671,7 @@ Midictl_setMinScale(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -698,10 +689,7 @@ Midictl_setMaxScale(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -719,10 +707,7 @@ Midictl_setCtlNumber(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -741,10 +726,7 @@ Midictl_setChannel(Midictl *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1072,10 +1054,7 @@ Bendin_setBrange(Bendin *self, PyObject *arg)
 {
     MYFLT tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -1094,10 +1073,7 @@ Bendin_setChannel(Bendin *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1116,10 +1092,7 @@ Bendin_setScale(Bendin *self, PyObject *arg)
 {
     int tmp;
 
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     int isInt = PyInt_Check(arg);
 
@@ -1439,10 +1412,7 @@ Touchin_setMinScale(Touchin *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -1460,10 +1430,7 @@ Touchin_setMaxScale(Touchin *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNum = PyNumber_Check(arg);
 
@@ -1481,10 +1448,7 @@ Touchin_setChannel(Touchin *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -1790,10 +1754,7 @@ Programin_setChannel(Programin *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -2162,10 +2123,7 @@ MidiNote_setChannel(MidiNote *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -2184,10 +2142,7 @@ MidiNote_setCentralKey(MidiNote *self, PyObject *arg)
 {
     int tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -2204,10 +2159,7 @@ MidiNote_setCentralKey(MidiNote *self, PyObject *arg)
 static PyObject *
 MidiNote_setStealing(MidiNote *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
diff --git a/src/objects/noisemodule.c b/src/objects/noisemodule.c
index 2245fad..728e3b8 100644
--- a/src/objects/noisemodule.c
+++ b/src/objects/noisemodule.c
@@ -198,10 +198,7 @@ static PyObject * Noise_inplace_div(Noise *self, PyObject *arg) { INPLACE_DIV };
 static PyObject *
 Noise_setType(Noise *self, PyObject *arg)
 {
-    if (arg == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
+    ASSERT_ARG_NOT_NULL
 
     if (PyInt_AS_LONG(arg) == 0)
         self->type = 0;
diff --git a/src/objects/oscbankmodule.c b/src/objects/oscbankmodule.c
index b8a8f3f..bc0bee1 100644
--- a/src/objects/oscbankmodule.c
+++ b/src/objects/oscbankmodule.c
@@ -548,10 +548,7 @@ OscBank_setTable(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -566,10 +563,7 @@ OscBank_setFreq(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -598,10 +592,7 @@ OscBank_setSpread(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -630,10 +621,7 @@ OscBank_setSlope(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -662,10 +650,7 @@ OscBank_setFrndf(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -694,10 +679,7 @@ OscBank_setFrnda(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -726,10 +708,7 @@ OscBank_setArndf(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -758,10 +737,7 @@ OscBank_setArnda(OscBank *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/oscilmodule.c b/src/objects/oscilmodule.c
index aac2444..6753138 100644
--- a/src/objects/oscilmodule.c
+++ b/src/objects/oscilmodule.c
@@ -330,10 +330,7 @@ Sine_setFreq(Sine *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -364,10 +361,7 @@ Sine_setPhase(Sine *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -778,10 +772,7 @@ SineLoop_setFreq(SineLoop *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -812,10 +803,7 @@ SineLoop_setFeedback(SineLoop *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1270,10 +1258,7 @@ Osc_setTable(Osc *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -1288,10 +1273,7 @@ Osc_setFreq(Osc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1322,10 +1304,7 @@ Osc_setPhase(Osc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1354,10 +1333,7 @@ Osc_setPhase(Osc *self, PyObject *arg)
 static PyObject *
 Osc_setInterp(Osc *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -1800,10 +1776,7 @@ OscLoop_setTable(OscLoop *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -1818,10 +1791,7 @@ OscLoop_setFreq(OscLoop *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1852,10 +1822,7 @@ OscLoop_setFeedback(OscLoop *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2329,10 +2296,7 @@ OscTrig_setTable(OscTrig *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -2347,10 +2311,7 @@ OscTrig_setTrig(OscTrig *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2378,10 +2339,7 @@ OscTrig_setFreq(OscTrig *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2412,10 +2370,7 @@ OscTrig_setPhase(OscTrig *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2444,10 +2399,7 @@ OscTrig_setPhase(OscTrig *self, PyObject *arg)
 static PyObject *
 OscTrig_setInterp(OscTrig *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2874,10 +2826,7 @@ Phasor_setFreq(Phasor *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2908,10 +2857,7 @@ Phasor_setPhase(Phasor *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3244,10 +3190,7 @@ Pointer_setTable(Pointer *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -3262,10 +3205,7 @@ Pointer_setIndex(Pointer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -3619,10 +3559,7 @@ Pointer2_setTable(Pointer2 *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -3637,10 +3574,7 @@ Pointer2_setIndex(Pointer2 *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -3664,10 +3598,7 @@ Pointer2_setIndex(Pointer2 *self, PyObject *arg)
 static PyObject *
 Pointer2_setInterp(Pointer2 *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -3684,10 +3615,7 @@ Pointer2_setInterp(Pointer2 *self, PyObject *arg)
 static PyObject *
 Pointer2_setAutoSmooth(Pointer2 *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -4001,10 +3929,7 @@ TableIndex_setTable(TableIndex *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -4019,10 +3944,7 @@ TableIndex_setIndex(TableIndex *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -4351,10 +4273,7 @@ Lookup_setTable(Lookup *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -4369,10 +4288,7 @@ Lookup_setIndex(Lookup *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -5099,10 +5015,7 @@ Pulsar_setTable(Pulsar *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -5117,10 +5030,7 @@ Pulsar_setEnv(Pulsar *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->env);
@@ -5135,10 +5045,7 @@ Pulsar_setFreq(Pulsar *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5169,10 +5076,7 @@ Pulsar_setPhase(Pulsar *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5203,10 +5107,7 @@ Pulsar_setFrac(Pulsar *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5235,10 +5136,7 @@ Pulsar_setFrac(Pulsar *self, PyObject *arg)
 static PyObject *
 Pulsar_setInterp(Pulsar *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -5685,10 +5583,7 @@ TableRead_setTable(TableRead *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -5703,10 +5598,7 @@ TableRead_setFreq(TableRead *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5735,10 +5627,7 @@ TableRead_setFreq(TableRead *self, PyObject *arg)
 static PyObject *
 TableRead_setLoop(TableRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
@@ -5749,10 +5638,7 @@ TableRead_setLoop(TableRead *self, PyObject *arg)
 static PyObject *
 TableRead_setInterp(TableRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -6336,10 +6222,7 @@ Fm_setCarrier(Fm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6370,10 +6253,7 @@ Fm_setRatio(Fm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6404,10 +6284,7 @@ Fm_setIndex(Fm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6829,10 +6706,7 @@ CrossFm_setCarrier(CrossFm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6863,10 +6737,7 @@ CrossFm_setRatio(CrossFm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6897,10 +6768,7 @@ CrossFm_setInd1(CrossFm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6931,10 +6799,7 @@ CrossFm_setInd2(CrossFm *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7371,10 +7236,7 @@ Blit_setFreq(Blit *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7405,10 +7267,7 @@ Blit_setHarms(Blit *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7895,10 +7754,7 @@ Rossler_setPitch(Rossler *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7929,10 +7785,7 @@ Rossler_setChaos(Rossler *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -8676,10 +8529,7 @@ Lorenz_setPitch(Lorenz *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -8710,10 +8560,7 @@ Lorenz_setChaos(Lorenz *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9645,10 +9492,7 @@ SumOsc_setFreq(SumOsc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9679,10 +9523,7 @@ SumOsc_setRatio(SumOsc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -9713,10 +9554,7 @@ SumOsc_setIndex(SumOsc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10507,10 +10345,7 @@ SuperSaw_setFreq(SuperSaw *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10541,10 +10376,7 @@ SuperSaw_setDetune(SuperSaw *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -10575,10 +10407,7 @@ SuperSaw_setBal(SuperSaw *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -11014,10 +10843,7 @@ RCOsc_setFreq(RCOsc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -11048,10 +10874,7 @@ RCOsc_setSharp(RCOsc *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -11411,10 +11234,7 @@ TableScale_setTable(TableScale *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -11436,10 +11256,7 @@ TableScale_setOuttable(TableScale *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->outtable);
diff --git a/src/objects/oscmodule.c b/src/objects/oscmodule.c
index c7417a0..9f28225 100644
--- a/src/objects/oscmodule.c
+++ b/src/objects/oscmodule.c
@@ -402,10 +402,7 @@ OscReceive_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 static PyObject *
 OscReceive_setInterpolation(OscReceive *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->interpolation = PyInt_AsLong(arg);
 
@@ -643,10 +640,7 @@ OscSend_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 static PyObject *
 OscSend_setBufferRate(OscSend *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->bufrate = PyInt_AsLong(arg);
     if (self->bufrate < 1)
@@ -890,10 +884,7 @@ OscDataSend_send(OscDataSend *self, PyObject *arg)
 {
     PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     if (PyList_Check(arg)) {
         tmp = arg;
@@ -1630,10 +1621,7 @@ OscListReceive_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 static PyObject *
 OscListReceive_setInterpolation(OscListReceive *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->interpolation = PyInt_AsLong(arg);
 
diff --git a/src/objects/panmodule.c b/src/objects/panmodule.c
index 3136b6a..3482505 100644
--- a/src/objects/panmodule.c
+++ b/src/objects/panmodule.c
@@ -327,10 +327,7 @@ Panner_setPan(Panner *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -361,10 +358,7 @@ Panner_setSpread(Panner *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -985,10 +979,7 @@ SPanner_setPan(SPanner *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1534,10 +1525,7 @@ Switcher_setVoice(Switcher *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2373,10 +2361,7 @@ Mixer_setTime(Mixer *self, PyObject *arg)
     int i, j, num;
 	PyObject *tmp, *keys, *key, *list_of_time_counts;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3075,10 +3060,7 @@ Selector_setVoice(Selector *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/patternmodule.c b/src/objects/patternmodule.c
index 49bcfae..956760e 100644
--- a/src/objects/patternmodule.c
+++ b/src/objects/patternmodule.c
@@ -212,10 +212,7 @@ Pattern_setTime(Pattern *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/phasevocmodule.c b/src/objects/phasevocmodule.c
index e90a232..fbf19d3 100644
--- a/src/objects/phasevocmodule.c
+++ b/src/objects/phasevocmodule.c
@@ -1151,10 +1151,7 @@ PVAddSynth_setPitch(PVAddSynth *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1631,10 +1628,7 @@ PVTranspose_setTranspo(PVTranspose *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2153,10 +2147,7 @@ PVVerb_setRevtime(PVVerb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2187,10 +2178,7 @@ PVVerb_setDamp(PVVerb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2643,10 +2631,7 @@ PVGate_setThresh(PVGate *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2677,10 +2662,7 @@ PVGate_setDamp(PVGate *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3070,10 +3052,7 @@ PVCross_setFade(PVCross *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3773,10 +3752,7 @@ PVMorph_setFade(PVMorph *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4182,10 +4158,7 @@ PVFilter_setGain(PVFilter *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4223,10 +4196,7 @@ PVFilter_setTable(PVFilter *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -4671,10 +4641,7 @@ PVDelay_setDeltable(PVDelay *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->deltable);
@@ -4696,10 +4663,7 @@ PVDelay_setFeedtable(PVDelay *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->feedtable);
@@ -5129,10 +5093,7 @@ PVBuffer_setIndex(PVBuffer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -5158,10 +5119,7 @@ PVBuffer_setPitch(PVBuffer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5526,10 +5484,7 @@ PVShift_setShift(PVShift *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6010,10 +5965,7 @@ PVAmpMod_setBasefreq(PVAmpMod *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6044,10 +5996,7 @@ PVAmpMod_setSpread(PVAmpMod *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6619,10 +6568,7 @@ PVFreqMod_setBasefreq(PVFreqMod *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6653,10 +6599,7 @@ PVFreqMod_setSpread(PVFreqMod *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6687,10 +6630,7 @@ PVFreqMod_setDepth(PVFreqMod *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7161,10 +7101,7 @@ PVBufLoops_setLow(PVBufLoops *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7193,10 +7130,7 @@ PVBufLoops_setHigh(PVBufLoops *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -7224,10 +7158,8 @@ static PyObject *
 PVBufLoops_setMode(PVBufLoops *self, PyObject *arg)
 {
     int tmp;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -7585,10 +7517,7 @@ PVBufTabLoops_setSpeed(PVBufTabLoops *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->speed);
diff --git a/src/objects/randommodule.c b/src/objects/randommodule.c
index 02756ee..aa3e085 100644
--- a/src/objects/randommodule.c
+++ b/src/objects/randommodule.c
@@ -442,10 +442,7 @@ Randi_setMin(Randi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -476,10 +473,7 @@ Randi_setMax(Randi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -510,10 +504,7 @@ Randi_setFreq(Randi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1051,10 +1042,7 @@ Randh_setMin(Randh *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1085,10 +1073,7 @@ Randh_setMax(Randh *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1119,10 +1104,7 @@ Randh_setFreq(Randh *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1500,10 +1482,7 @@ Choice_setFreq(Choice *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1906,10 +1885,7 @@ RandInt_setMax(RandInt *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1940,10 +1916,7 @@ RandInt_setFreq(RandInt *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2386,10 +2359,7 @@ RandDur_setMin(RandDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2420,10 +2390,7 @@ RandDur_setMax(RandDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3244,10 +3211,7 @@ static PyObject * Xnoise_inplace_div(Xnoise *self, PyObject *arg) { INPLACE_DIV
 static PyObject *
 Xnoise_setType(Xnoise *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -3265,10 +3229,7 @@ Xnoise_setX1(Xnoise *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3299,10 +3260,7 @@ Xnoise_setX2(Xnoise *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3333,10 +3291,7 @@ Xnoise_setFreq(Xnoise *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4204,10 +4159,7 @@ static PyObject * XnoiseMidi_inplace_div(XnoiseMidi *self, PyObject *arg) { INPL
 static PyObject *
 XnoiseMidi_setType(XnoiseMidi *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -4224,10 +4176,8 @@ static PyObject *
 XnoiseMidi_setScale(XnoiseMidi *self, PyObject *arg)
 {
     int tmp;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -4268,10 +4218,7 @@ XnoiseMidi_setX1(XnoiseMidi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4302,10 +4249,7 @@ XnoiseMidi_setX2(XnoiseMidi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4336,10 +4280,7 @@ XnoiseMidi_setFreq(XnoiseMidi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5031,10 +4972,7 @@ static PyObject * XnoiseDur_inplace_div(XnoiseDur *self, PyObject *arg) { INPLAC
 static PyObject *
 XnoiseDur_setType(XnoiseDur *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -5052,10 +4990,7 @@ XnoiseDur_setX1(XnoiseDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5086,10 +5021,7 @@ XnoiseDur_setX2(XnoiseDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5120,10 +5052,7 @@ XnoiseDur_setMin(XnoiseDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5154,10 +5083,7 @@ XnoiseDur_setMax(XnoiseDur *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5586,10 +5512,7 @@ Urn_setFreq(Urn *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/recordmodule.c b/src/objects/recordmodule.c
index 00c0fd8..1fd0e1d 100644
--- a/src/objects/recordmodule.c
+++ b/src/objects/recordmodule.c
@@ -739,10 +739,7 @@ ControlRead_setValues(ControlRead *self, PyObject *arg)
 {
     Py_ssize_t i;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->size = PyList_Size(arg);
     self->values = (MYFLT *)realloc(self->values, self->size * sizeof(MYFLT));
@@ -757,10 +754,7 @@ ControlRead_setValues(ControlRead *self, PyObject *arg)
 static PyObject *
 ControlRead_setRate(ControlRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->rate = PyInt_AsLong(arg);
     self->modulo = (int)(self->sr / self->rate);
@@ -772,10 +766,7 @@ ControlRead_setRate(ControlRead *self, PyObject *arg)
 static PyObject *
 ControlRead_setLoop(ControlRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
@@ -786,10 +777,7 @@ ControlRead_setLoop(ControlRead *self, PyObject *arg)
 static PyObject *
 ControlRead_setInterp(ControlRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -1353,10 +1341,7 @@ NoteinRead_setValues(NoteinRead *self, PyObject *arg)
 {
     Py_ssize_t i;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->size = PyList_Size(arg);
     self->values = (MYFLT *)realloc(self->values, self->size * sizeof(MYFLT));
@@ -1373,10 +1358,7 @@ NoteinRead_setTimestamps(NoteinRead *self, PyObject *arg)
 {
     Py_ssize_t i;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->size = PyList_Size(arg);
     self->timestamps = (long *)realloc(self->timestamps, self->size * sizeof(long));
@@ -1391,10 +1373,7 @@ NoteinRead_setTimestamps(NoteinRead *self, PyObject *arg)
 static PyObject *
 NoteinRead_setLoop(NoteinRead *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
diff --git a/src/objects/selectmodule.c b/src/objects/selectmodule.c
index aa423d2..3d084d4 100644
--- a/src/objects/selectmodule.c
+++ b/src/objects/selectmodule.c
@@ -198,10 +198,7 @@ static PyObject * Select_inplace_div(Select *self, PyObject *arg) { INPLACE_DIV
 static PyObject *
 Select_setValue(Select *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyLong_Check(arg) || PyInt_Check(arg)) {
 		self->value = PyLong_AsLong(arg);
diff --git a/src/objects/sfplayermodule.c b/src/objects/sfplayermodule.c
index 80d94bf..f9f332a 100644
--- a/src/objects/sfplayermodule.c
+++ b/src/objects/sfplayermodule.c
@@ -383,10 +383,7 @@ SfPlayer_setSpeed(SfPlayer *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -415,11 +412,10 @@ SfPlayer_setSpeed(SfPlayer *self, PyObject *arg)
 static PyObject *
 SfPlayer_setSound(SfPlayer *self, PyObject *arg)
 {
-    /* Need to perform a check to be sure that the new sound is of the same number of channels */
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    /* Need to perform a check to be sure that the new 
+       sound is of the same number of channels. */
+
+    ASSERT_ARG_NOT_NULL
 
     self->path = PyString_AsString(arg);
 
@@ -449,10 +445,7 @@ SfPlayer_setSound(SfPlayer *self, PyObject *arg)
 static PyObject *
 SfPlayer_setLoop(SfPlayer *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->loop = PyInt_AsLong(arg);
 
@@ -463,10 +456,7 @@ SfPlayer_setLoop(SfPlayer *self, PyObject *arg)
 static PyObject *
 SfPlayer_setOffset(SfPlayer *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -483,10 +473,7 @@ SfPlayer_setOffset(SfPlayer *self, PyObject *arg)
 static PyObject *
 SfPlayer_setInterp(SfPlayer *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -1179,10 +1166,7 @@ SfMarkerShuffler_setSpeed(SfMarkerShuffler *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1211,10 +1195,7 @@ SfMarkerShuffler_setSpeed(SfMarkerShuffler *self, PyObject *arg)
 static PyObject *
 SfMarkerShuffler_setInterp(SfMarkerShuffler *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -1933,10 +1914,7 @@ SfMarkerLooper_setSpeed(SfMarkerLooper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1965,10 +1943,7 @@ SfMarkerLooper_setMark(SfMarkerLooper *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1995,10 +1970,7 @@ SfMarkerLooper_setMark(SfMarkerLooper *self, PyObject *arg)
 static PyObject *
 SfMarkerLooper_setInterp(SfMarkerLooper *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/sigmodule.c b/src/objects/sigmodule.c
index d9cf4f6..2b53071 100644
--- a/src/objects/sigmodule.c
+++ b/src/objects/sigmodule.c
@@ -172,10 +172,7 @@ Sig_setValue(Sig *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -547,10 +544,7 @@ SigTo_setValue(SigTo *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -579,10 +573,7 @@ SigTo_setTime(SigTo *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -949,10 +940,7 @@ VarPort_setValue(VarPort *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -972,10 +960,7 @@ VarPort_setTime(VarPort *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/tablemodule.c b/src/objects/tablemodule.c
index d7f9ee4..683f3f5 100644
--- a/src/objects/tablemodule.c
+++ b/src/objects/tablemodule.c
@@ -4221,10 +4221,7 @@ SndTable_getEnvelope(SndTable *self, PyObject *arg) {
     MYFLT absin, last;
     PyObject *samples;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isInt = PyInt_Check(arg);
 
@@ -5407,10 +5404,7 @@ TableRec_setTable(TableRec *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -5875,10 +5869,7 @@ TableMorph_setTable(TableMorph *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -5892,10 +5883,7 @@ TableMorph_setTable(TableMorph *self, PyObject *arg)
 static PyObject *
 TableMorph_setSources(TableMorph *self, PyObject *arg)
 {
-    if (arg == NULL) {
-        PyErr_SetString(PyExc_TypeError, "Cannot delete the list attribute.");
-        return PyInt_FromLong(-1);
-    }
+    ASSERT_ARG_NOT_NULL
 
     if (! PyList_Check(arg)) {
         PyErr_SetString(PyExc_TypeError, "The amplitude list attribute value must be a list.");
@@ -6206,10 +6194,7 @@ TrigTableRec_setTable(TrigTableRec *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -6662,10 +6647,7 @@ TablePut_setTable(TablePut *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
@@ -6852,10 +6834,7 @@ TableWrite_setPos(TableWrite *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	if (PyObject_HasAttrString((PyObject *)tmp, "server") == 0) {
@@ -6881,10 +6860,7 @@ TableWrite_setTable(TableWrite *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
     Py_INCREF(tmp);
diff --git a/src/objects/trigmodule.c b/src/objects/trigmodule.c
index 1c20d7b..df50c6d 100644
--- a/src/objects/trigmodule.c
+++ b/src/objects/trigmodule.c
@@ -236,10 +236,7 @@ TrigRandInt_setMax(TrigRandInt *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -701,10 +698,7 @@ TrigRand_setMin(TrigRand *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -735,10 +729,7 @@ TrigRand_setMax(TrigRand *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -769,10 +760,7 @@ TrigRand_setPort(TrigRand *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1128,10 +1116,7 @@ TrigChoice_setPort(TrigChoice *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1761,10 +1746,7 @@ TrigEnv_setTable(TrigEnv *self, PyObject *arg)
 {
 	PyObject *tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	tmp = arg;
 	Py_DECREF(self->table);
@@ -1779,10 +1761,7 @@ TrigEnv_setDur(TrigEnv *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1811,10 +1790,7 @@ TrigEnv_setDur(TrigEnv *self, PyObject *arg)
 static PyObject *
 TrigEnv_setInterp(TrigEnv *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     int isNumber = PyNumber_Check(arg);
 
@@ -2617,10 +2593,7 @@ TrigExpseg_setList(TrigExpseg *self, PyObject *value)
 static PyObject *
 TrigExpseg_setExp(TrigExpseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     // TODO: PyNumber_Check()
     self->exp_tmp = PyFloat_AsDouble(arg);
@@ -2632,10 +2605,7 @@ TrigExpseg_setExp(TrigExpseg *self, PyObject *arg)
 static PyObject *
 TrigExpseg_setInverse(TrigExpseg *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
     self->inverse_tmp = PyInt_AsLong(PyNumber_Int(arg));
 
@@ -3308,10 +3278,7 @@ static PyObject * TrigXnoise_inplace_div(TrigXnoise *self, PyObject *arg) { INPL
 static PyObject *
 TrigXnoise_setType(TrigXnoise *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -3329,10 +3296,7 @@ TrigXnoise_setX1(TrigXnoise *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3363,10 +3327,7 @@ TrigXnoise_setX2(TrigXnoise *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4100,10 +4061,7 @@ static PyObject * TrigXnoiseMidi_inplace_div(TrigXnoiseMidi *self, PyObject *arg
 static PyObject *
 TrigXnoiseMidi_setType(TrigXnoiseMidi *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -4120,10 +4078,8 @@ static PyObject *
 TrigXnoiseMidi_setScale(TrigXnoiseMidi *self, PyObject *arg)
 {
     int tmp;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -4164,10 +4120,7 @@ TrigXnoiseMidi_setX1(TrigXnoiseMidi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4198,10 +4151,7 @@ TrigXnoiseMidi_setX2(TrigXnoiseMidi *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -4540,10 +4490,7 @@ static PyObject * Counter_inplace_div(Counter *self, PyObject *arg) { INPLACE_DI
 static PyObject *
 Counter_setMin(Counter *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyLong_Check(arg) || PyInt_Check(arg)) {
 		self->min = PyLong_AsLong(arg);
@@ -4556,10 +4503,7 @@ Counter_setMin(Counter *self, PyObject *arg)
 static PyObject *
 Counter_setMax(Counter *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyLong_Check(arg) || PyInt_Check(arg)) {
 		self->max = PyLong_AsLong(arg);
@@ -4572,10 +4516,7 @@ Counter_setMax(Counter *self, PyObject *arg)
 static PyObject *
 Counter_setDir(Counter *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyInt_Check(arg)) {
 		self->dir = PyInt_AsLong(arg);
@@ -4979,10 +4920,7 @@ Thresh_setThreshold(Thresh *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5011,10 +4949,7 @@ Thresh_setThreshold(Thresh *self, PyObject *arg)
 static PyObject *
 Thresh_setDir(Thresh *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (PyInt_Check(arg)) {
 		self->dir = PyInt_AsLong(arg);
@@ -5338,10 +5273,7 @@ Percent_setPercent(Percent *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -6888,10 +6820,7 @@ TrigVal_setValue(TrigVal *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/utilsmodule.c b/src/objects/utilsmodule.c
index 1225c49..390622d 100644
--- a/src/objects/utilsmodule.c
+++ b/src/objects/utilsmodule.c
@@ -167,10 +167,7 @@ static PyObject * Print_stop(Print *self) { STOP };
 static PyObject *
 Print_setMethod(Print *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -186,10 +183,7 @@ Print_setMethod(Print *self, PyObject *arg)
 static PyObject *
 Print_setInterval(Print *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -204,10 +198,7 @@ Print_setInterval(Print *self, PyObject *arg)
 static PyObject *
 Print_setMessage(Print *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isString = PyString_Check(arg);
 
@@ -530,10 +521,8 @@ static PyObject *
 Snap_setScale(Snap *self, PyObject *arg)
 {
     int tmp;
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyInt_Check(arg);
 
@@ -882,10 +871,7 @@ Interp_setInterp(Interp *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1255,10 +1241,7 @@ SampHold_setValue(SampHold *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1632,10 +1615,7 @@ TrackHold_setValue(TrackHold *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2006,9 +1986,7 @@ Compare_setComp(Compare *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_RETURN_NONE;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2037,9 +2015,7 @@ Compare_setComp(Compare *self, PyObject *arg)
 static PyObject *
 Compare_setMode(Compare *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_RETURN_NONE;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	if (! PyInt_Check(arg)) {
         printf("mode should be a comparison operator as a string\n");
@@ -2432,10 +2408,7 @@ Between_setMin(Between *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -2466,10 +2439,7 @@ Between_setMax(Between *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3779,10 +3749,7 @@ Scale_setInMin(Scale *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3813,10 +3780,7 @@ Scale_setInMax(Scale *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3847,10 +3811,7 @@ Scale_setOutMin(Scale *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3881,10 +3842,7 @@ Scale_setOutMax(Scale *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -3915,10 +3873,7 @@ Scale_setExp(Scale *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -5316,10 +5271,7 @@ MToT_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 static PyObject *
 MToT_setCentralKey(MToT *self, PyObject *arg)
 {
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
diff --git a/src/objects/wgverbmodule.c b/src/objects/wgverbmodule.c
index 0b9dba5..3b55070 100644
--- a/src/objects/wgverbmodule.c
+++ b/src/objects/wgverbmodule.c
@@ -577,10 +577,7 @@ WGVerb_setFeedback(WGVerb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -611,10 +608,7 @@ WGVerb_setCutoff(WGVerb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -645,10 +639,7 @@ WGVerb_setMix(WGVerb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1579,10 +1570,7 @@ STReverb_setInpos(STReverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1613,10 +1601,7 @@ STReverb_setRevtime(STReverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1647,10 +1632,7 @@ STReverb_setCutoff(STReverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1681,10 +1663,7 @@ STReverb_setMix(STReverb *self, PyObject *arg)
 {
 	PyObject *tmp, *streamtmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1717,10 +1696,7 @@ STReverb_setRoomSize(STReverb *self, PyObject *arg)
     long maxsize;
 	MYFLT roomSize;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 
@@ -1769,10 +1745,7 @@ STReverb_setFirstRefGain(STReverb *self, PyObject *arg)
 {
 	MYFLT tmp;
 
-	if (arg == NULL) {
-		Py_INCREF(Py_None);
-		return Py_None;
-	}
+    ASSERT_ARG_NOT_NULL
 
 	int isNumber = PyNumber_Check(arg);
 

-- 
python-pyo packaging



More information about the pkg-multimedia-commits mailing list