You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug arises under somewhat odd conditions. My original code was trying to patch around python/cpython#28714 with:
fromgraphlibimportTopologicalSorterfromtypingimportTYPE_CHECKINGifTYPE_CHECKING:
print("do some stuff")
else:
fromtypesimportGenericAliasTopologicalSorter.__class_getitem__=classmethod(GenericAlias)
I've tried to reduce as much as possible and the key parts seem to be:
in the else block after if TYPE_CHECKING (if not TYPE_CHECKING doesn't seem to trigger)
when referencing an import within the block (doesn't have to be GenericAlias and moving import to top fixes)
when assigning an attribute (doesn't have to be TopologicalSorter nor __class_getitem__)
Configuration
No response
Command used
pylint min_repro.py
Pylint output
************* Module min_repro
min_repro.py:1:0: C0114: Missing module docstring (missing-module-docstring)
Exception on node <Name.GenericAlias l.9 at 0x10dae0580>in file '/private/tmp/min_repro.py'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 75, in walk
callback(astroid)
File "/usr/local/lib/python3.9/site-packages/pylint/checkers/variables.py", line 1106, in visit_name
) = self._is_variable_violation(
File "/usr/local/lib/python3.9/site-packages/pylint/checkers/variables.py", line 1533, in _is_variable_violation
defined_in_or_else = any(
File "/usr/local/lib/python3.9/site-packages/pylint/checkers/variables.py", line 1534, in<genexpr>
target.name == name fortargetin definition.targets
AttributeError: 'AssignAttr' object has no attribute 'name'
min_repro.py:1:0: F0001: Fatal error while checking 'min_repro.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in'/Users/jacobhayes/Library/Caches/pylint/pylint-crash-2021-10-03-18.txt'. (fatal)
------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)
Expected behavior
************* Module min_repro
min_repro.py:1:0: C0114: Missing module docstring (missing-module-docstring)
------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)
Bug description
This bug arises under somewhat odd conditions. My original code was trying to patch around python/cpython#28714 with:
I've tried to reduce as much as possible and the key parts seem to be:
else
block afterif TYPE_CHECKING
(if not TYPE_CHECKING
doesn't seem to trigger)GenericAlias
and moving import to top fixes)TopologicalSorter
nor__class_getitem__
)Configuration
No response
Command used
Pylint output
Expected behavior
************* Module min_repro min_repro.py:1:0: C0114: Missing module docstring (missing-module-docstring) ------------------------------------------------------------------ Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)
Pylint version
OS / Environment
macOS
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: