]> git.ipfire.org Git - thirdparty/starlette.git/commit
Fix `routing.get_name()` not to assume all routines have `__name__` (#2648)
authorMichał Górny <mgorny@gentoo.org>
Wed, 24 Jul 2024 08:23:59 +0000 (10:23 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Jul 2024 08:23:59 +0000 (02:23 -0600)
commit07427f86474b15d648497014eb19c41f01317f15
tree1c23cb1138b42afe43c7fe43967b0374e7c94a23
parent921f13722fdcaf6f48d6adc16ab2cb549f3d750b
Fix `routing.get_name()` not to assume all routines have `__name__` (#2648)

Fix `routing.get_name()` to use the `__name__` attribute only if it is
actually present, rather than assuming that all routine and class types
have it, and use the fallback to class name otherwise.  This is
necessary for `functools.partial()` that doesn't have a `__name__`
attribute, but is recognized as a routine starting with Python 3.13.0b3.
Since for older versions of Python, it would have used the fallback
anyway, this doesn't really change the behavior there.

Fixes #2638
starlette/routing.py