Kaydet (Commit) 8d87603e authored tarafından Eric S. Raymond's avatar Eric S. Raymond

Aha. We can remove he string import after all by using ValueError.

üst 18af564b
...@@ -40,7 +40,6 @@ Example: ...@@ -40,7 +40,6 @@ Example:
# This was modified from the Python 1.5 library HTTP lib. # This was modified from the Python 1.5 library HTTP lib.
import socket import socket
import string
import re import re
import rfc822 import rfc822
import types import types
...@@ -209,7 +208,7 @@ class SMTP: ...@@ -209,7 +208,7 @@ class SMTP:
if i >= 0: if i >= 0:
host, port = host[:i], host[i+1:] host, port = host[:i], host[i+1:]
try: port = int(port) try: port = int(port)
except string.atoi_error: except ValueError:
raise socket.error, "nonnumeric port" raise socket.error, "nonnumeric port"
if not port: port = SMTP_PORT if not port: port = SMTP_PORT
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment