gh-102302 Micro-optimize `inspect.Parameter.__hash__` (#102303)

This commit is contained in:
Gouvernathor 2023-03-04 16:08:57 +01:00 committed by GitHub
parent c2bd55d26f
commit 90801e48fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -2805,7 +2805,7 @@ class Parameter:
return '<{} "{}">'.format(self.__class__.__name__, self)
def __hash__(self):
return hash((self.name, self.kind, self.annotation, self.default))
return hash((self._name, self._kind, self._annotation, self._default))
def __eq__(self, other):
if self is other:

View File

@ -0,0 +1 @@
Micro-optimise hashing of :class:`inspect.Parameter`, reducing the time it takes to hash an instance by around 40%.