Issue531145
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-03-17 23:14 by calvin, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Messages (9) | |||
---|---|---|---|
msg53501 - (view) | Author: Bastian Kleineidam (calvin) | Date: 2002-03-17 23:14 | |
Python 2.1.2 (#1, Mar 16 2002, 00:56:55) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> import socket >>> socket.sslerror <class socket.sslerror at 0x809c39c> >>> try: raise socket.sslerror ... except socket.error: pass ... Traceback (most recent call last): File "<stdin>", line 1, in ? socket.sslerror >>> |
|||
msg53502 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2002-03-18 10:44 | |
Logged In: YES user_id=21627 Why is this a bug? |
|||
msg53503 - (view) | Author: Bastian Kleineidam (calvin) | Date: 2002-03-18 20:23 | |
Logged In: YES user_id=9205 The documentation says for socket.error: "This exception is raised for socket- or address-related errors." I think socket.sslerror is such an error, because then you can write try: sock.write("") # could be ssl-socket except socket.error: pass The other way would be _exceptions = [socket.error] if hasattr(socket, "sslerror"): _exceptions.append(socket.sslerror) try: sock.write("") except _exceptions: pass Anyway, I assume this is a minor "bug". |
|||
msg53504 - (view) | Author: Gerhard Häring (ghaering) * | Date: 2002-10-05 00:05 | |
Logged In: YES user_id=163326 So do you propose to make socket.sslerror a subclass of socket.error. Is this desirable? I'm not sure. Is it work? Yes. |
|||
msg53505 - (view) | Author: Bastian Kleineidam (calvin) | Date: 2002-11-11 17:12 | |
Logged In: YES user_id=9205 Yes, I want socket.sslerror to be a subclass of socket.error. It simplifies code layout (see my previous answer) and it follows the documentation. And yes, its work, but only a little :) |
|||
msg53506 - (view) | Author: Michael Stone (mbrierst) | Date: 2003-02-04 16:19 | |
Logged In: YES user_id=670441 If this behavior is desired, the patch below implements it. If it's not desired, this bug sould be closed. It isn't much work at all. test_socket and test_socket_ssl still pass fine. The following case will work after this patch, all other combinations will work as before: >>> try: raise socket.sslerror ... except socket.error: print 'caught' caught >>> patch (I cannot attach the file in sourceforge for some reason): Index: dist/src/Modules/socketmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v retrieving revision 1.8 diff -c -r1.8 socketmodule.h *** dist/src/Modules/socketmodule.h 13 Jun 2002 15:07:44 -0000 1.8 --- dist/src/Modules/socketmodule.h 4 Feb 2003 16:05:27 -0000 *************** *** 140,145 **** --- 140,146 ---- /* C API for usage by other Python modules */ typedef struct { PyTypeObject *Sock_Type; + PyObject *Sock_Error; } PySocketModule_APIObject; /* XXX The net effect of the following appears to be to define a function Index: dist/src/Modules/socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.251 diff -c -r1.251 socketmodule.c *** dist/src/Modules/socketmodule.c 6 Jan 2003 12:41:26 -0000 1.251 --- dist/src/Modules/socketmodule.c 4 Feb 2003 16:05:43 -0000 *************** *** 3117,3122 **** --- 3117,3123 ---- PySocketModule_APIObject PySocketModuleAPI = { &sock_type, + NULL, }; *************** *** 3178,3183 **** --- 3179,3185 ---- return; /* Export C API */ + PySocketModuleAPI.Sock_Error = socket_error; if (PyModule_AddObject(m, PySocket_CAPI_NAME, PyCObject_FromVoidPtr((void *)&PySocketModuleAPI, NULL) ) != 0) Index: dist/src/Modules/_ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.9 diff -c -r1.9 _ssl.c *** dist/src/Modules/_ssl.c 27 Jan 2003 22:19:21 -0000 1.9 --- dist/src/Modules/_ssl.c 4 Feb 2003 16:05:45 -0000 *************** *** 543,549 **** SSLeay_add_ssl_algorithms(); /* Add symbols to module dict */ ! PySSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); if (PySSLErrorObject == NULL) return; PyDict_SetItemString(d, "sslerror", PySSLErrorObject); --- 543,549 ---- SSLeay_add_ssl_algorithms(); /* Add symbols to module dict */ ! PySSLErrorObject = PyErr_NewException("socket.sslerror", PySocketModule.Sock_Error, NULL); if (PySSLErrorObject == NULL) return; PyDict_SetItemString(d, "sslerror", PySSLErrorObject); |
|||
msg53507 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2003-05-17 01:42 | |
Logged In: YES user_id=357491 Well, I have no issue with wanting to make socket.sslerror a subclass of socket.error, but socket.sslerror is not even documented so I don't see this as an issue until socket.sslerror is documented. So this will need a doc patch on top of any patch to make the change to socket.sslerror. |
|||
msg53508 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2004-03-23 23:30 | |
Logged In: YES user_id=357491 socket.sslerror is now a subclass of socket.error thanks to extending the socket module's C API. Done in: Misc/NEWS 1.960 Modules/socketmodule.h 1.12 Modules/socketmodule.c 1.286 Modules_ssl.c 1.16 |
|||
msg53509 - (view) | Author: Bastian Kleineidam (calvin) | Date: 2004-03-24 19:35 | |
Logged In: YES user_id=9205 Hei, thanks for patching this! It seems a new Python release is nearby when such minor loose ends get tidied up :) |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:06 | admin | set | github: 36270 |
2002-03-17 23:14:20 | calvin | create |