python: do not always import socket_server
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 25 May 2020 23:33:42 +0000 (11:33 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 13 Jun 2020 05:25:31 +0000 (05:25 +0000)
This cost around 10ms for every Python script, and was only used in one
test.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/compat.py
python/samba/tests/dns_forwarder_helpers/server.py

index 603cb08fe526be4b4b72ab10893670f77638e2c1..3762ca441e1f24e6b19298b5ddc9713ebb2d6f59 100644 (file)
@@ -70,7 +70,6 @@ if PY3:
         return (x > y) - (x < y)
     # compat functions
     from functools import cmp_to_key as cmp_to_key_fn
-    import socketserver as SocketServer
 
     # compat types
     integer_types = int,
@@ -145,8 +144,6 @@ else:
             return K
     else:
         from functools import cmp_to_key as cmp_to_key_fn
-    # compat functions
-    import SocketServer as SocketServer
 
     # compat types
     integer_types = (int, long)
index 32b0ffe052a782ad37d994784047b211409ba47d..803372f73c1e135b28fd9d6310a253faa1e0f338 100644 (file)
@@ -18,7 +18,7 @@
 #
 # Based on the EchoServer example from python docs
 from __future__ import print_function
-from samba.compat import SocketServer
+import socketserver as SocketServer
 import sys
 from threading import Timer
 from samba.dcerpc import dns