Backport of [2303], [2310], [2311] from python3 to trunk.
Backport of [2303], [2310], [2311] from python3 to trunk.

cherrypy/cherrypy,cherrypy/cherrypy,cherrypy/cheroot,Safihre/cherrypy,Safihre/cherrypy