File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change 6767 "has_dualstack_ipv6" , "AddressFamily" , "SocketKind" ]
6868__all__ .extend (os ._get_exports_list (_socket ))
6969
70- def __getattr__ (name ):
71- if name == "SocketType" :
72- import warnings
73- warnings ._deprecated (name , remove = (3 , 16 ))
74- return _socket .socket
75- raise AttributeError (f"module { __name__ !r} has no attribute { name !r} " )
76-
7770
7871# Set up the socket.AF_* socket.SOCK_* constants as members of IntEnums for
7972# nicer string representations.
Original file line number Diff line number Diff line change @@ -5579,16 +5579,17 @@ socket_getattr(PyObject *self, PyObject *name)
55795579{
55805580 const char * attrname = PyUnicode_AsUTF8 (name );
55815581 PyObject * sock_type = PyType_FromSpec (& sock_spec );
5582- if (sock_type == NULL ) {
5582+ if (attrname == NULL || sock_type == NULL ) {
55835583 return NULL ;
55845584 }
55855585
55865586 if (!strcmp (attrname , "SocketType" )) {
5587- PyErr_Warn (PyExc_DeprecationWarning , "Use socket.socket type instead" );
5587+ PyErr_Warn (PyExc_DeprecationWarning , "It will be removed in 3.16. "
5588+ "Use socket.socket type instead" );
55885589 return sock_type ;
55895590 }
55905591
5591- PyErr_Format (PyExc_AttributeError , "module _socket has no attribute %s " , attrname );
5592+ PyErr_Format (PyExc_AttributeError , "module _socket has no attribute '%s' " , attrname );
55925593 return NULL ;
55935594}
55945595
You can’t perform that action at this time.
0 commit comments