Skip to content

Commit

Permalink
Add regression test for pylint-dev#5770
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Feb 27, 2022
1 parent 90dafae commit b745a02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ Release date: TBA

Closes #5731

* Fixed a crash involving a ``NewType`` named with an f-string.

Closes #5770
Ref PyCQA/astroid#1400

* Improved ``bad-open-mode`` message when providing ``None`` to the ``mode``
argument of an ``open()`` call.

Expand Down
5 changes: 5 additions & 0 deletions doc/whatsnew/2.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ Other Changes

Closes #5731

* Fixed a crash involving a ``NewType`` named with an f-string.

Closes #5770
Ref PyCQA/astroid#1400

* Improved ``bad-open-mode`` message when providing ``None`` to the ``mode``
argument of an ``open()`` call.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Regression test for issue 5770: NewType created with f-string
See: https://github.com/PyCQA/pylint/issues/5770
"""
from typing import NewType

def make_new_type(suffix):
"""Dynamically create a NewType with `suffix`"""
new_type = NewType(f'IntRange_{suffix}', suffix)
print(new_type)

0 comments on commit b745a02

Please sign in to comment.