be more cautious when loading modules. spotted by naddy@.

This commit is contained in:
fgsch 2010-06-23 16:53:15 +00:00
parent f3696556fd
commit f06b38f7bb
2 changed files with 17 additions and 2 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.2 2010/06/15 17:16:13 fgsch Exp $
# $OpenBSD: Makefile,v 1.3 2010/06/23 16:53:15 fgsch Exp $
COMMENT = python network packet manipulation library
MODPY_EGG_VERSION = 1.7
DISTNAME = dpkt-${MODPY_EGG_VERSION}
PKGNAME = py-${DISTNAME}
PKGNAME = py-${DISTNAME}p0
CATEGORIES = net

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-dpkt_ip_py,v 1.1 2010/06/23 16:53:15 fgsch Exp $
--- dpkt/ip.py.orig Thu Jun 17 15:51:24 2010
+++ dpkt/ip.py Thu Jun 17 15:50:52 2010
@@ -247,9 +247,9 @@ def __load_protos():
name = k[9:].lower()
try:
mod = __import__(name, g)
- except ImportError:
+ IP.set_proto(v, getattr(mod, name.upper()))
+ except (ImportError, AttributeError):
continue
- IP.set_proto(v, getattr(mod, name.upper()))
if not IP._protosw:
__load_protos()