Argument Clinic: rename "self" to "module" for module-level functions.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 1f192dc..d72eca4 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -551,7 +551,6 @@
 
 /*[clinic]
 module curses
-
 class curses.window
 
 curses.window.addch
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 1eace71..91456e9 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4141,9 +4141,10 @@
 
 /*[clinic]
 module datetime
+class datetime.datetime
 
 @classmethod
-datetime.now
+datetime.datetime.now
 
     tz: object = None
         Timezone object.
@@ -4153,23 +4154,23 @@
 If no tz is specified, uses local timezone.
 [clinic]*/
 
-PyDoc_STRVAR(datetime_now__doc__,
+PyDoc_STRVAR(datetime_datetime_now__doc__,
 "Returns new datetime object representing current time local to tz.\n"
 "\n"
-"datetime.now(tz=None)\n"
+"datetime.datetime.now(tz=None)\n"
 "  tz\n"
 "    Timezone object.\n"
 "\n"
 "If no tz is specified, uses local timezone.");
 
-#define DATETIME_NOW_METHODDEF    \
-    {"now", (PyCFunction)datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_now__doc__},
+#define DATETIME_DATETIME_NOW_METHODDEF    \
+    {"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
 
 static PyObject *
-datetime_now_impl(PyObject *cls, PyObject *tz);
+datetime_datetime_now_impl(PyObject *cls, PyObject *tz);
 
 static PyObject *
-datetime_now(PyObject *cls, PyObject *args, PyObject *kwargs)
+datetime_datetime_now(PyObject *cls, PyObject *args, PyObject *kwargs)
 {
     PyObject *return_value = NULL;
     static char *_keywords[] = {"tz", NULL};
@@ -4179,15 +4180,15 @@
         "|O:now", _keywords,
         &tz))
         goto exit;
-    return_value = datetime_now_impl(cls, tz);
+    return_value = datetime_datetime_now_impl(cls, tz);
 
 exit:
     return return_value;
 }
 
 static PyObject *
-datetime_now_impl(PyObject *cls, PyObject *tz)
-/*[clinic checksum: 328b54387f4c2f8cb534997e1bd55f8cb38c4992]*/
+datetime_datetime_now_impl(PyObject *cls, PyObject *tz)
+/*[clinic checksum: cde1daca68c9b7dca6df51759db2de1d43a39774]*/
 {
     PyObject *self;
 
@@ -5037,7 +5038,7 @@
 
     /* Class methods: */
 
-    DATETIME_NOW_METHODDEF
+    DATETIME_DATETIME_NOW_METHODDEF
 
     {"utcnow",         (PyCFunction)datetime_utcnow,
      METH_NOARGS | METH_CLASS,
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 370f670..7772b49 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -415,10 +415,10 @@
     {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
 
 static PyObject *
-dbmopen_impl(PyObject *self, const char *filename, const char *flags, int mode);
+dbmopen_impl(PyObject *module, const char *filename, const char *flags, int mode);
 
 static PyObject *
-dbmopen(PyObject *self, PyObject *args)
+dbmopen(PyObject *module, PyObject *args)
 {
     PyObject *return_value = NULL;
     const char *filename;
@@ -429,15 +429,15 @@
         "s|si:open",
         &filename, &flags, &mode))
         goto exit;
-    return_value = dbmopen_impl(self, filename, flags, mode);
+    return_value = dbmopen_impl(module, filename, flags, mode);
 
 exit:
     return return_value;
 }
 
 static PyObject *
-dbmopen_impl(PyObject *self, const char *filename, const char *flags, int mode)
-/*[clinic checksum: 61007c796d38af85c8035afa769fb4bb453429ee]*/
+dbmopen_impl(PyObject *module, const char *filename, const char *flags, int mode)
+/*[clinic checksum: 2b0ec9e3c6ecd19e06d16c9f0ba33848245cb1ab]*/
 {
     int iflags;
 
diff --git a/Modules/_weakref.c b/Modules/_weakref.c
index 1e8debc..771639d 100644
--- a/Modules/_weakref.c
+++ b/Modules/_weakref.c
@@ -25,14 +25,14 @@
     {"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
 
 static Py_ssize_t
-_weakref_getweakrefcount_impl(PyObject *self, PyObject *object);
+_weakref_getweakrefcount_impl(PyObject *module, PyObject *object);
 
 static PyObject *
-_weakref_getweakrefcount(PyObject *self, PyObject *object)
+_weakref_getweakrefcount(PyObject *module, PyObject *object)
 {
     PyObject *return_value = NULL;
     Py_ssize_t _return_value;
-    _return_value = _weakref_getweakrefcount_impl(self, object);
+    _return_value = _weakref_getweakrefcount_impl(module, object);
     if ((_return_value == -1) && PyErr_Occurred())
         goto exit;
     return_value = PyLong_FromSsize_t(_return_value);
@@ -42,8 +42,8 @@
 }
 
 static Py_ssize_t
-_weakref_getweakrefcount_impl(PyObject *self, PyObject *object)
-/*[clinic checksum: 0b7e7ddd87d483719ebac0fba364fff0ed0182d9]*/
+_weakref_getweakrefcount_impl(PyObject *module, PyObject *object)
+/*[clinic checksum: 05cffbc3a4b193a0b7e645da81be281748704f69]*/
 {
     PyWeakReference **list;
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index c51c849..71b1437 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2460,10 +2460,10 @@
     {"stat", (PyCFunction)os_stat, METH_VARARGS|METH_KEYWORDS, os_stat__doc__},
 
 static PyObject *
-os_stat_impl(PyObject *self, path_t *path, int dir_fd, int follow_symlinks);
+os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks);
 
 static PyObject *
-os_stat(PyObject *self, PyObject *args, PyObject *kwargs)
+os_stat(PyObject *module, PyObject *args, PyObject *kwargs)
 {
     PyObject *return_value = NULL;
     static char *_keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
@@ -2475,7 +2475,7 @@
         "O&|$O&p:stat", _keywords,
         path_converter, &path, OS_STAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
         goto exit;
-    return_value = os_stat_impl(self, &path, dir_fd, follow_symlinks);
+    return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks);
 
 exit:
     /* Cleanup for path */
@@ -2485,8 +2485,8 @@
 }
 
 static PyObject *
-os_stat_impl(PyObject *self, path_t *path, int dir_fd, int follow_symlinks)
-/*[clinic checksum: 9d9af08e8cfafd12f94e73ea3065eb3056f99515]*/
+os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks)
+/*[clinic checksum: 89390f78327e3f045a81974d758d3996e2a71f68]*/
 {
     return posix_do_stat("stat", path, dir_fd, follow_symlinks);
 }
@@ -2600,10 +2600,10 @@
     {"access", (PyCFunction)os_access, METH_VARARGS|METH_KEYWORDS, os_access__doc__},
 
 static PyObject *
-os_access_impl(PyObject *self, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks);
+os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks);
 
 static PyObject *
-os_access(PyObject *self, PyObject *args, PyObject *kwargs)
+os_access(PyObject *module, PyObject *args, PyObject *kwargs)
 {
     PyObject *return_value = NULL;
     static char *_keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL};
@@ -2617,7 +2617,7 @@
         "O&i|$O&pp:access", _keywords,
         path_converter, &path, &mode, OS_STAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks))
         goto exit;
-    return_value = os_access_impl(self, &path, mode, dir_fd, effective_ids, follow_symlinks);
+    return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks);
 
 exit:
     /* Cleanup for path */
@@ -2627,8 +2627,8 @@
 }
 
 static PyObject *
-os_access_impl(PyObject *self, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
-/*[clinic checksum: 0147557eb43243df57ba616cc7c35f232c69bc6a]*/
+os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
+/*[clinic checksum: aa3e145816a748172e62df8e44af74169c7e1247]*/
 {
     PyObject *return_value = NULL;
 
@@ -2734,10 +2734,10 @@
     {"ttyname", (PyCFunction)os_ttyname, METH_VARARGS, os_ttyname__doc__},
 
 static char *
-os_ttyname_impl(PyObject *self, int fd);
+os_ttyname_impl(PyObject *module, int fd);
 
 static PyObject *
-os_ttyname(PyObject *self, PyObject *args)
+os_ttyname(PyObject *module, PyObject *args)
 {
     PyObject *return_value = NULL;
     int fd;
@@ -2747,7 +2747,7 @@
         "i:ttyname",
         &fd))
         goto exit;
-    _return_value = os_ttyname_impl(self, fd);
+    _return_value = os_ttyname_impl(module, fd);
     if (_return_value == NULL)
         goto exit;
     return_value = PyUnicode_DecodeFSDefault(_return_value);
@@ -2757,8 +2757,8 @@
 }
 
 static char *
-os_ttyname_impl(PyObject *self, int fd)
-/*[clinic checksum: ea680155d87bb733f542d67653eca732dd0981a8]*/
+os_ttyname_impl(PyObject *module, int fd)
+/*[clinic checksum: c742dd621ec98d0f81d37d264e1d3c89c7a5fb1a]*/
 {
     char *ret;
 
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 5097d44..62ab957 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -109,7 +109,8 @@
 
 /*[clinic]
 module unicodedata
-unicodedata.decimal
+class unicodedata.UCD
+unicodedata.UCD.decimal
 
     unichr: object(type='str')
     default: object=NULL
@@ -122,23 +123,23 @@
 not given, ValueError is raised.
 [clinic]*/
 
-PyDoc_STRVAR(unicodedata_decimal__doc__,
+PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
 "Converts a Unicode character into its equivalent decimal value.\n"
 "\n"
-"unicodedata.decimal(unichr, default=None)\n"
+"unicodedata.UCD.decimal(unichr, default=None)\n"
 "\n"
 "Returns the decimal value assigned to the Unicode character unichr\n"
 "as integer. If no such value is defined, default is returned, or, if\n"
 "not given, ValueError is raised.");
 
-#define UNICODEDATA_DECIMAL_METHODDEF    \
-    {"decimal", (PyCFunction)unicodedata_decimal, METH_VARARGS, unicodedata_decimal__doc__},
+#define UNICODEDATA_UCD_DECIMAL_METHODDEF    \
+    {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
 
 static PyObject *
-unicodedata_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value);
+unicodedata_UCD_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value);
 
 static PyObject *
-unicodedata_decimal(PyObject *self, PyObject *args)
+unicodedata_UCD_decimal(PyObject *self, PyObject *args)
 {
     PyObject *return_value = NULL;
     PyObject *unichr;
@@ -148,15 +149,15 @@
         "O!|O:decimal",
         &PyUnicode_Type, &unichr, &default_value))
         goto exit;
-    return_value = unicodedata_decimal_impl(self, unichr, default_value);
+    return_value = unicodedata_UCD_decimal_impl(self, unichr, default_value);
 
 exit:
     return return_value;
 }
 
 static PyObject *
-unicodedata_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value)
-/*[clinic checksum: 76c8d1c3dbee495d4cfd86ca6829543a3129344a]*/
+unicodedata_UCD_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value)
+/*[clinic checksum: a0980c387387287e2ac230c37d95b26f6903e0d2]*/
 {
     PyUnicodeObject *v = (PyUnicodeObject *)unichr;
     int have_old = 0;
@@ -1288,7 +1289,7 @@
 /* XXX Add doc strings. */
 
 static PyMethodDef unicodedata_functions[] = {
-    UNICODEDATA_DECIMAL_METHODDEF
+    UNICODEDATA_UCD_DECIMAL_METHODDEF
     {"digit", unicodedata_digit, METH_VARARGS, unicodedata_digit__doc__},
     {"numeric", unicodedata_numeric, METH_VARARGS, unicodedata_numeric__doc__},
     {"category", unicodedata_category, METH_VARARGS,
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 1b65eb0..b17136b 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -630,8 +630,9 @@
 /*[clinic]
 
 module zlib
+class zlib.Decompress
 
-zlib.decompress
+zlib.Decompress.decompress
 
     data: Py_buffer
         The binary data to decompress.
@@ -648,10 +649,10 @@
 Call the flush() method to clear these buffers.
 [clinic]*/
 
-PyDoc_STRVAR(zlib_decompress__doc__,
+PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
 "Return a string containing the decompressed version of the data.\n"
 "\n"
-"zlib.decompress(data, max_length=0)\n"
+"zlib.Decompress.decompress(data, max_length=0)\n"
 "  data\n"
 "    The binary data to decompress.\n"
 "  max_length\n"
@@ -663,14 +664,14 @@
 "internal buffers for later processing.\n"
 "Call the flush() method to clear these buffers.");
 
-#define ZLIB_DECOMPRESS_METHODDEF    \
-    {"decompress", (PyCFunction)zlib_decompress, METH_VARARGS, zlib_decompress__doc__},
+#define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF    \
+    {"decompress", (PyCFunction)zlib_Decompress_decompress, METH_VARARGS, zlib_Decompress_decompress__doc__},
 
 static PyObject *
-zlib_decompress_impl(PyObject *self, Py_buffer *data, int max_length);
+zlib_Decompress_decompress_impl(PyObject *self, Py_buffer *data, int max_length);
 
 static PyObject *
-zlib_decompress(PyObject *self, PyObject *args)
+zlib_Decompress_decompress(PyObject *self, PyObject *args)
 {
     PyObject *return_value = NULL;
     Py_buffer data;
@@ -680,7 +681,7 @@
         "y*|i:decompress",
         &data, &max_length))
         goto exit;
-    return_value = zlib_decompress_impl(self, &data, max_length);
+    return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
 
 exit:
     /* Cleanup for data */
@@ -690,8 +691,8 @@
 }
 
 static PyObject *
-zlib_decompress_impl(PyObject *self, Py_buffer *data, int max_length)
-/*[clinic checksum: 168d093d400739dde947cca1f4fb0f9d51cdc2c9]*/
+zlib_Decompress_decompress_impl(PyObject *self, Py_buffer *data, int max_length)
+/*[clinic checksum: bfac7a0f07e891869d87c665a76dc2611014420f]*/
 {
     compobject *zself = (compobject *)self;
     int err;
@@ -907,22 +908,23 @@
 
 /*[clinic]
 
-zlib.copy
+class zlib.Compress
+zlib.Compress.copy
 
 Return a copy of the compression object.
 [clinic]*/
 
-PyDoc_STRVAR(zlib_copy__doc__,
+PyDoc_STRVAR(zlib_Compress_copy__doc__,
 "Return a copy of the compression object.\n"
 "\n"
-"zlib.copy()");
+"zlib.Compress.copy()");
 
-#define ZLIB_COPY_METHODDEF    \
-    {"copy", (PyCFunction)zlib_copy, METH_NOARGS, zlib_copy__doc__},
+#define ZLIB_COMPRESS_COPY_METHODDEF    \
+    {"copy", (PyCFunction)zlib_Compress_copy, METH_NOARGS, zlib_Compress_copy__doc__},
 
 static PyObject *
-zlib_copy(PyObject *self)
-/*[clinic checksum: 7b648de2c1f933ba2b9fa17331ff1a44d9a4a740]*/
+zlib_Compress_copy(PyObject *self)
+/*[clinic checksum: 2551952e72329f0f2beb48a1dde3780e485a220b]*/
 {
     compobject *zself = (compobject *)self;
     compobject *retval = NULL;
@@ -1118,14 +1120,14 @@
     {"flush", (binaryfunc)PyZlib_flush, METH_VARARGS,
               comp_flush__doc__},
 #ifdef HAVE_ZLIB_COPY
-    ZLIB_COPY_METHODDEF
+    ZLIB_COMPRESS_COPY_METHODDEF
 #endif
     {NULL, NULL}
 };
 
 static PyMethodDef Decomp_methods[] =
 {
-    ZLIB_DECOMPRESS_METHODDEF
+    ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF
     {"flush", (binaryfunc)PyZlib_unflush, METH_VARARGS,
               decomp_flush__doc__},
 #ifdef HAVE_ZLIB_COPY