]> granicus.if.org Git - python/commitdiff
Merged revisions 77970 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 4 Feb 2010 20:23:24 +0000 (20:23 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 4 Feb 2010 20:23:24 +0000 (20:23 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77970 | antoine.pitrou | 2010-02-04 21:20:18 +0100 (jeu., 04 févr. 2010) | 6 lines

  Issue #4772: Raise a ValueError when an unknown Bluetooth protocol is
  specified, rather than fall through to AF_PACKET (in the `socket` module).
  Also, raise ValueError rather than TypeError when an unknown TIPC address
  type is specified.  Patch by Brian Curtin.
........

Misc/NEWS
Modules/socketmodule.c

index 7632762a7510c3f73151e3225e5b41db518aea33..3dd680a6355bd77a6c2c82792108ca0c965aff15 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -242,6 +242,11 @@ C-API
 Library
 -------
 
+- Issue #4772: Raise a ValueError when an unknown Bluetooth protocol is
+  specified, rather than fall through to AF_PACKET (in the `socket` module).
+  Also, raise ValueError rather than TypeError when an unknown TIPC address
+  type is specified.  Patch by Brian Curtin.
+
 - Issue #6939: Fix file I/O objects in the `io` module to keep the original
   file position when calling `truncate()`.  It would previously change the
   file position to the given argument, which goes against the tradition of
index fa543cdab9bc01e158403173baa89d117aa6a74e..e65303b2697321803e7ccd5c259e98b4ac5c3882 100644 (file)
@@ -1053,6 +1053,10 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
                }
 #endif
 
+               default:
+                       PyErr_SetString(PyExc_ValueError,
+                                       "Unknown Bluetooth protocol");
+                       return NULL;
                }
 #endif
 
@@ -1104,7 +1108,7 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
                                        0,
                                        a->scope);
                } else {
-                       PyErr_SetString(PyExc_TypeError,
+                       PyErr_SetString(PyExc_ValueError,
                                        "Invalid address type");
                        return NULL;
                }