py3: conditionalize access to socketserver.ForkingMixIn
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 25 Sep 2018 21:39:42 -0400
changeset 39834 d1e0b905c59d
parent 39833 28626957395a
child 39835 91d63fd58e7d
py3: conditionalize access to socketserver.ForkingMixIn This is no longer exported on platforms that don't support forking, as of 3.6. https://github.com/python/cpython/commit/aadff9bea61a2fc9f4cf0f213f0ee50fc54d6574
mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py	Tue Sep 25 22:46:18 2018 -0400
+++ b/mercurial/hgweb/server.py	Tue Sep 25 21:39:42 2018 -0400
@@ -174,8 +174,12 @@
         env[r'wsgi.errors'] = _error_logger(self)
         env[r'wsgi.multithread'] = isinstance(self.server,
                                              socketserver.ThreadingMixIn)
-        env[r'wsgi.multiprocess'] = isinstance(self.server,
-                                              socketserver.ForkingMixIn)
+        if util.safehasattr(socketserver, 'ForkingMixIn'):
+            env[r'wsgi.multiprocess'] = isinstance(self.server,
+                                                   socketserver.ForkingMixIn)
+        else:
+            env[r'wsgi.multiprocess'] = False
+
         env[r'wsgi.run_once'] = 0
 
         wsgiref.validate.check_environ(env)