Use the new Py_ARRAY_LENGTH macro
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 2e36c73..f1eac91 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1593,7 +1593,7 @@
              {-0xfffffffL, 28, -1}};
     int i;
 
-    for (i = 0; i < sizeof(testcases) / sizeof(struct triple); ++i) {
+    for (i = 0; i < Py_ARRAY_LENGTH(testcases); ++i) {
         PyObject *plong = PyLong_FromLong(testcases[i].input);
         size_t nbits = _PyLong_NumBits(plong);
         int sign = _PyLong_Sign(plong);
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 15d6863..8ee0630 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -112,7 +112,7 @@
     {SIGSEGV, 0, "Segmentation fault", }
 };
 static const unsigned char faulthandler_nsignals = \
-    sizeof(faulthandler_handlers) / sizeof(faulthandler_handlers[0]);
+    Py_ARRAY_LENGTH(faulthandler_handlers);
 
 #ifdef HAVE_SIGALTSTACK
 static stack_t stack;
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 7e73bfe..c4cc46e 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -1435,7 +1435,7 @@
     }
 
     /* use lookup table if x is small */
-    if (x < (long)(sizeof(SmallFactorials)/sizeof(SmallFactorials[0])))
+    if (x < (long)Py_ARRAY_LENGTH(SmallFactorials))
         return PyLong_FromUnsignedLong(SmallFactorials[x]);
 
     /* else express in the form odd_part * 2**two_valuation, and compute as
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 95a23b7..bcab9da 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -530,7 +530,7 @@
     return self;
 }
 
-static PyObject * 
+static PyObject *
 oss_exit(PyObject *self, PyObject *unused)
 {
     PyObject *ret = PyObject_CallMethod(self, "close", NULL);
@@ -1061,8 +1061,8 @@
     int num_controls;
     int i;
 
-    num_controls = sizeof(control_labels) / sizeof(control_labels[0]);
-    assert(num_controls == sizeof(control_names) / sizeof(control_names[0]));
+    num_controls = Py_ARRAY_LENGTH(control_labels);
+    assert(num_controls == Py_ARRAY_LENGTH(control_names));
 
     labels = PyList_New(num_controls);
     names = PyList_New(num_controls);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 25e7f0d..c35e8a1 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2895,9 +2895,9 @@
         DWORD result;
         PyObject *v;
         result = GetFullPathNameW(wpath,
-                                  sizeof(woutbuf)/sizeof(woutbuf[0]),
+                                  Py_ARRAY_LENGTH(woutbuf),
                                   woutbuf, &wtemp);
-        if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) {
+        if (result > Py_ARRAY_LENGTH(woutbuf)) {
             woutbufp = malloc(result * sizeof(Py_UNICODE));
             if (!woutbufp)
                 return PyErr_NoMemory();
@@ -2920,7 +2920,7 @@
                            PyUnicode_FSConverter, &opath))
         return NULL;
     path = PyBytes_AsString(opath);
-    if (!GetFullPathName(path, sizeof(outbuf)/sizeof(outbuf[0]),
+    if (!GetFullPathName(path, Py_ARRAY_LENGTH(outbuf),
                          outbuf, &temp)) {
         win32_error("GetFullPathName", path);
         Py_DECREF(opath);
@@ -4903,7 +4903,7 @@
 cpu_set_repr(Py_cpu_set *set)
 {
     return PyUnicode_FromFormat("<cpu_set with %li entries>", set->ncpus);
-} 
+}
 
 static Py_ssize_t
 cpu_set_len(Py_cpu_set *set)
@@ -5656,7 +5656,7 @@
     PyObject *result = NULL;
 #ifdef MS_WINDOWS
     wchar_t user_name[UNLEN + 1];
-    DWORD num_chars = sizeof(user_name)/sizeof(user_name[0]);
+    DWORD num_chars = Py_ARRAY_LENGTH(user_name);
 
     if (GetUserNameW(user_name, &num_chars)) {
         /* num_chars is the number of unicode chars plus null terminator */
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 79ccae8..62b3fe9 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3812,7 +3812,7 @@
        version of the hostname, whereas we need a Unicode string.
        Otherwise, gethostname apparently also returns the DNS name. */
     wchar_t buf[MAX_COMPUTERNAME_LENGTH + 1];
-    DWORD size = sizeof(buf) / sizeof(wchar_t);
+    DWORD size = Py_ARRAY_LENGTH(buf);
     PyObject *result;
     if (!GetComputerNameExW(ComputerNamePhysicalDnsHostname, buf, &size)) {
         if (GetLastError() == ERROR_MORE_DATA) {
@@ -6281,7 +6281,7 @@
         DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS};
         const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS"};
         int i;
-        for(i = 0; i<sizeof(codes)/sizeof(*codes); ++i) {
+        for(i = 0; i<Py_ARRAY_LENGTH(codes); ++i) {
             PyObject *tmp;
             tmp = PyLong_FromUnsignedLong(codes[i]);
             if (tmp == NULL)
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index d917f91..f636590 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -439,7 +439,7 @@
        from Tools/unicode/makeunicodedata.py, it should not be possible
        to overflow decomp_prefix. */
     prefix_index = decomp_data[index] & 255;
-    assert(prefix_index < (sizeof(decomp_prefix)/sizeof(*decomp_prefix)));
+    assert(prefix_index < Py_ARRAY_LENGTH(decomp_prefix));
 
     /* copy prefix */
     i = strlen(decomp_prefix[prefix_index]);