Closed noam-graetz closed 6 years ago
Thanks for the report and fix proposal.
That code was never nice but CherryPy isn't exposing its internals cleanly unfortunately (hence this hack).
The failing build is for Python 3.4 which I'm not is worth supporting long run.
I wonder if that fix is backward compatible with older CherryPy however.
I wonder if that fix is backward compatible with older CherryPy however.
It should be. It looks, it implies equality check + takes into account subclass instances
Alright, tried with older CherryPy versions and for some reason it only works from 9.0.0, up to 8.9.1, it fails with the error (on Python 3.6.3):
Traceback (most recent call last):
File "/home/sylvain/dev/.venvs/throwaway/lib/python3.6/site-packages/cherrypy/wsgiserver/__init__.py", line 1398, in communicate
req.parse_request()
File "/home/sylvain/dev/.venvs/throwaway/lib/python3.6/site-packages/cherrypy/wsgiserver/__init__.py", line 601, in parse_request
success = self.read_request_line()
File "/home/sylvain/dev/.venvs/throwaway/lib/python3.6/site-packages/cherrypy/wsgiserver/__init__.py", line 634, in read_request_line
request_line = self.rfile.readline()
File "/home/sylvain/dev/.venvs/throwaway/lib/python3.6/site-packages/cherrypy/wsgiserver/__init__.py", line 303, in readline
data = self.rfile.readline(256)
File "/usr/lib/python3.6/_pyio.py", line 511, in readline
b = self.read(nreadahead())
File "/usr/lib/python3.6/_pyio.py", line 495, in nreadahead
readahead = self.peek(1)
File "/usr/lib/python3.6/_pyio.py", line 1063, in peek
return self._peek_unlocked(size)
File "/usr/lib/python3.6/_pyio.py", line 1070, in _peek_unlocked
current = self.raw.read(to_read)
AttributeError: 'NoneType' object has no attribute 'read'
Scratch that.
It only failed because I had cheroot still installed and that took over the import of the cherrypy classes (which broke with CherryPy 8.9.1- that was not yet relying on cheroot).
All looks good.
I've just tried the fix on my cherrypy 8.1.0 installation and this works (on Python 2.7.9)
type() check for exact match, which failed to detect the subclass used by WS4PY