Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
bpo-46581: Propagate private vars via _GenericAlias.copy_with#31061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
90bdf0d19e9207e30f7ea06bd0c32cd8199b222b3dad0431d6db57f5031c617File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -670,7 +670,9 @@ def Concatenate(self, parameters): | ||
| "ParamSpec variable.") | ||
| msg = "Concatenate[arg, ...]: each arg must be a type." | ||
| parameters = (*(_type_check(p, msg) for p in parameters[:-1]), parameters[-1]) | ||
| return _ConcatenateGenericAlias(self, parameters) | ||
| return _ConcatenateGenericAlias(self, parameters, | ||
| _typevar_types=(TypeVar, ParamSpec), | ||
| _paramspec_tvars=True) | ||
| @_SpecialForm | ||
| @@ -1339,7 +1341,9 @@ def _determine_new_args(self, args): | ||
| return tuple(new_args) | ||
| def copy_with(self, args): | ||
| return self.__class__(self.__origin__, args, name=self._name, inst=self._inst) | ||
| return self.__class__(self.__origin__, args, name=self._name, inst=self._inst, | ||
posita marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| _typevar_types=self._typevar_types, | ||
| _paramspec_tvars=self._paramspec_tvars) | ||
posita marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. posita marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| def __repr__(self): | ||
| if self._name: | ||
| @@ -1548,11 +1552,6 @@ def __hash__(self): | ||
| class _ConcatenateGenericAlias(_GenericAlias, _root=True): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs, | ||
| _typevar_types=(TypeVar, ParamSpec), | ||
| _paramspec_tvars=True) | ||
| def copy_with(self, params): | ||
| if isinstance(params[-1], (list, tuple)): | ||
| return (*params[:-1], *params[-1]) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Brings :class:`ParamSpec` propagation for :class:`GenericAlias` in line with | ||
| :class:`Concatenate` (and others). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this test was failed.