[issue46285] protocol_version in http.server.test can be ignored

Hugo Almeida report at bugs.python.org
Thu Jan 27 02:32:59 EST 2022


Hugo Almeida <sudo.xiangqian at gmail.com> added the comment:

Hi Éric, thank you so much.

I know only a little usage of closure and functools.partial but not the historical/relative knowledge of their design/feature, I mean this issue have 2 visual, the partical object not working as it expected or we are not calling the partical as it expected:

1) partial is not working as its feature or design said, assume I guessed right, thus partial object behaviors should be totally equal to its wrapper/inside class called with properties applied in a standalone/outside way which we usually used, the use of partical at http.server.test should be okey.

"""
import functools

class Obj:
    pass

obj = Obj(); obj.foo = bar  # usually used
jbo = functools.partial(Obj, foo=bar)

# if jbo totally equal to obj in anywhere
# (the so called Duck Type or
# maybe the LSP rule, Liskov
# Substitution Principle)
# the use of partical in http.server
# should also be ok
#
# I used the partical times the same
# as http.server's author did
# and I told myself I know its usage
# but now I do not think so
"""

2) solve this issue itself, to pass handler class directly to ignore partial object caused problem, this is a coding logic shelter/fixing because the way we used functools.partical is not as it expected. This is what cpython at github PR30701 already done. (so the use of partical in http.server is not ok, not welcome at least, so based what I said above, the feature/design of partical now confused me, unless its a bug of partical itself which I am not sure.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46285>
_______________________________________


More information about the Python-bugs-list mailing list