Skip to content

Commit

Permalink
Revert "Fix a crash when inferring a typing.TypeVar call. (pylint-d…
Browse files Browse the repository at this point in the history
…ev#2239)"

This reverts commit 89dfb48.
  • Loading branch information
mbyrnepr2 committed Sep 25, 2023
1 parent 74b5a7a commit bf31af2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 40 deletions.
6 changes: 1 addition & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ What's New in astroid 2.15.7?
=============================
Release date: 2023-09-23

* Fix a crash when inferring a ``typing.TypeVar`` call.

Closes pylint-dev/pylint#8802

* Infer user-defined enum classes by checking if the class is a subtype of ``enum.Enum``.

Closes pylint-dev/pylint#8897
Expand All @@ -248,7 +244,7 @@ Release date: 2023-09-23

What's New in astroid 2.15.6?
=============================
Release date: 2023-07-08
Release date: TBA

* Harden ``get_module_part()`` against ``"."``.

Expand Down
13 changes: 2 additions & 11 deletions astroid/brain/brain_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ def looks_like_typing_typevar_or_newtype(node) -> bool:
return False


def infer_typing_typevar_or_newtype(
node: Call, context_itton: context.InferenceContext | None = None
) -> Iterator[ClassDef]:
def infer_typing_typevar_or_newtype(node, context_itton=None):
"""Infer a typing.TypeVar(...) or typing.NewType(...) call."""
try:
func = next(node.func.infer(context=context_itton))
Expand All @@ -136,14 +134,7 @@ def infer_typing_typevar_or_newtype(
raise UseInferenceDefault

typename = node.args[0].as_string().strip("'")
node = ClassDef(
name=typename,
lineno=node.lineno,
col_offset=node.col_offset,
parent=node.parent,
end_lineno=node.end_lineno,
end_col_offset=node.end_col_offset,
)
node = extract_node(TYPING_TYPE_TEMPLATE.format(typename))
return node.infer(context=context_itton)


Expand Down
24 changes: 0 additions & 24 deletions tests/brain/test_typing.py

This file was deleted.

0 comments on commit bf31af2

Please sign in to comment.