Original file line numberDiff line numberDiff line change@@ -1990,8 +1990,32 @@ buffer_info(PyObject *self, PyObject *arg)
19901990}
19911991199219921993+staticPyObject*
1994+_ctypes_getattr(PyObject*Py_UNUSED(self), PyObject*args)
1995+{
1996+PyObject*name;
1997+if (!PyArg_UnpackTuple(args, "__getattr__", 1, 1, &name)) {
1998+returnNULL;
1999+ }
2000+2001+if (PyUnicode_Check(name) &&PyUnicode_EqualToUTF8(name, "__version__")) {
2002+if (PyErr_WarnEx(PyExc_DeprecationWarning,
2003+"'__version__' is deprecated and slated for "
2004+"removal in Python 3.20",
2005+1) <0) {
2006+returnNULL;
2007+ }
2008+returnPyUnicode_FromString("1.1.0"); // Do not change
2009+ }
2010+2011+PyErr_Format(PyExc_AttributeError,
2012+"module '_ctypes' has no attribute %R", name);
2013+returnNULL;
2014+}
2015+1993201619942017PyMethodDef_ctypes_module_methods[] = {
2018+ {"__getattr__", _ctypes_getattr, METH_VARARGS},
19952019 {"get_errno", get_errno, METH_NOARGS},
19962020 {"set_errno", set_errno, METH_VARARGS},
19972021 {"_unpickle", unpickle, METH_VARARGS },