Skip to content
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

aiohttp.ClientSession() crashes pylint #2075

Open
ppickfor opened this issue Mar 29, 2023 · 8 comments
Open

aiohttp.ClientSession() crashes pylint #2075

ppickfor opened this issue Mar 29, 2023 · 8 comments
Labels
Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@ppickfor
Copy link

ppickfor commented Mar 29, 2023

Bug description

When parsing the following file:

import aiohttp
s = aiohttp.ClientSession() 

Command used

pylint test.py

Pylint output

pylint crashed with an ``AstroidError`` and with the following stacktrace
Traceback (most recent call last):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference_tip.py", line 33, in _inference_tip_cached
    result = _cache[func, node]
             ~~~~~~^^^^^^^^^^^^
KeyError: (<function infer_named_tuple at 0x000001DCEA0F4360>, <Call l.129 at 0x1dced056950>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\checkers\utils.py", line 1371, in safe_infer
    value = next(infer_gen)
            ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 372, in infer_attribute
    yield from owner.igetattr(self.attrname, context)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 334, in infer_import_from
    module = self.do_import_module()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 173, in _post_build
    module = self._manager.visit_transforms(module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 95, in visit_transforms
    return self._transform.visit(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 89, in visit
    return self._visit(module)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 54, in _visit
    visited = self._visit_generic(value)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 61, in _visit_generic
    return [self._visit_generic(child) for child in node]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 61, in <listcomp>
    return [self._visit_generic(child) for child in node]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 67, in _visit_generic
    return self._visit(node)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 57, in _visit
    return self._transform(node)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 38, in _transform
    if predicate is None or predicate(node):
                            ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\brain\brain_namedtuple_enum.py", line 613, in _is_enum_subclass
    for klass in cls.mro()
                 ^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3058, in mro
    return self._compute_mro(context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3027, in _compute_mro
    inferred_bases = list(self._inferred_bases(context=context))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3010, in _inferred_bases
    baseobj = next(
              ^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3010, in <genexpr>
    baseobj = next(
                  ^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 430, in infer_subscript
    for index in self.slice.infer(context):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 334, in infer_import_from
    module = self.do_import_module()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 169, in _post_build
    self.delayed_assattr(delayed)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 240, in delayed_assattr
    for inferred in node.expr.infer():
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 1157, in infer_assign
    stmts = list(self.assigned_stmts(context=context))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\protocols.py", line 406, in _arguments_infer_argname
    is_metaclass = isinstance(cls, nodes.ClassDef) and cls.type == "metaclass"
                                                       ^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 1866, in _class_type
    if _is_metaclass(klass):
       ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 1837, in _is_metaclass
    for baseobj in base.infer():
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference.py", line 334, in infer_import_from
    module = self.do_import_module()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\builder.py", line 173, in _post_build
    module = self._manager.visit_transforms(module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\manager.py", line 95, in visit_transforms
    return self._transform.visit(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 89, in visit
    return self._visit(module)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 54, in _visit
    visited = self._visit_generic(value)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 61, in _visit_generic
    return [self._visit_generic(child) for child in node]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 61, in <listcomp>
    return [self._visit_generic(child) for child in node]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 67, in _visit_generic
    return self._visit(node)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 57, in _visit
    return self._transform(node)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\transforms.py", line 38, in _transform
    if predicate is None or predicate(node):
                            ^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\brain\brain_namedtuple_enum.py", line 613, in _is_enum_subclass
    for klass in cls.mro()
                 ^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3058, in mro
    return self._compute_mro(context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3027, in _compute_mro
    inferred_bases = list(self._inferred_bases(context=context))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3010, in _inferred_bases
    baseobj = next(
              ^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 3010, in <genexpr>
    baseobj = next(
                  ^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\nodes\node_ng.py", line 161, in infer
    results = list(self._explicit_inference(self, context, **kwargs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\inference_tip.py", line 40, in _inference_tip_cached
    result = _cache[func, node] = list(func(*args, **kwargs))
                                       ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\brain\brain_namedtuple_enum.py", line 216, in infer_named_tuple
    rename = next(call_site.infer_argument(func, "rename", context)).bool_value()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\astroid\arguments.py", line 180, in infer_argument
    if len(self.positional_arguments) > len(funcnode.args.args):
                                        ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'UninferableBase' has no len()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\lint\pylinter.py", line 811, in _lint_file
    check_astroid_module(module)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\lint\pylinter.py", line 1085, in check_astroid_module
    retval = self._check_astroid_module(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\lint\pylinter.py", line 1135, in _check_astroid_module
    walker.walk(node)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\utils\ast_walker.py", line 94, in walk
    self.walk(child)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\utils\ast_walker.py", line 91, in walk
    callback(astroid)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\checkers\refactoring\refactoring_checker.py", line 1524, in visit_assign
    self._append_context_managers_to_stack(node)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\checkers\refactoring\refactoring_checker.py", line 1579, in _append_context_managers_to_stack
    inferred = utils.safe_infer(value.func)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\checkers\utils.py", line 1375, in safe_infer
    raise AstroidError from e
astroid.exceptions.AstroidError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\lint\pylinter.py", line 775, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "C:\Users\admin.pp\Python\testenv\Lib\site-packages\pylint\lint\pylinter.py", line 813, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Expected behavior

not to crash

Pylint version

pylint 2.17.1
astroid 2.15.1
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]

OS / Environment

Windows

Additional dependencies

aiodns==3.0.0
aiohttp==3.8.4
aiosignal==1.3.1
astroid==2.15.1
async-timeout==4.0.2
attrs==22.2.0
autopep8==2.0.2
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
colorama==0.4.6
dill==0.3.6
frozenlist==1.3.3
idna==3.4
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
multidict==6.0.4
mypy==1.1.1
mypy-extensions==1.0.0
platformdirs==3.2.0
pycares==4.3.0
pycodestyle==2.10.0
pycparser==2.21
pylint==2.17.1
requests==2.28.2
tomlkit==0.11.7
types-requests==2.28.11.17
types-urllib3==1.26.25.10
typing_extensions==4.5.0
urllib3==1.26.15
wrapt==1.15.0
yarl==1.8.2

@DanielNoord
Copy link
Collaborator

Please copy the content of the stack trace into the issue description. Maintainers are not likely to download random files from the internet because of the apparent security risks 😄

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Mar 29, 2023
@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue :) Don't worry, I included the stacktrace in the issue.

@DanielNoord
Copy link
Collaborator

@jacobtylerwalls Are you able to reproduce this?

I can't:

cat test.py
import aiohttp

s = aiohttp.ClientSession()
❯ pylint --version
pylint 3.0.0b1
astroid 2.16.0dev0
Python 3.11.0b3 (main, Jun 12 2022, 16:13:11) [Clang 13.0.0 (clang-1300.0.29.30)]
❯ pylint test.py

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

@jacobtylerwalls
Copy link
Member

No, I can't. But the stack trace looks like something important to fix, somewhere downstream of the namedtuple/enum brain an Uninferable got attached to the .args of an Arguments node, which shouldn't have happened. We could move this to astroid, I guess.

@jacobtylerwalls jacobtylerwalls removed the Good first issue Friendly and approachable by new contributors label Apr 1, 2023
@DanielNoord
Copy link
Collaborator

Yeah, although that might also be a downstream package breaking something. Without an actual reproducer this will just stay open indefinitely..

@DanielNoord DanielNoord transferred this issue from pylint-dev/pylint Apr 1, 2023
@ppickfor
Copy link
Author

ppickfor commented Apr 3, 2023

Hello Folks,

It turns out this issue is due to using the embeded python installation (due to some restrictive admin policy on the server I'm using)

A regular installation of python does not generate this issue.

Here is a script I used to reproduce the issue with a fresh installation of python.

# expects 7zip installed at ${env:ProgramFiles}\7-Zip\7z.exe
#
# Download python embeded version 
# unzip it
# rename pythonXXX._pth to pythonXXX.pth
# get pip
# pip install virtualenv
# create virtal env
# activate virtualenv
# pip install aiohttp pylint
# create the test.py file
# lint the test.py
$version = "3.11.2"
$shortversion = "311"
$pythonurl = "https://www.python.org/ftp/python/$version/python-$version-embed-amd64.zip"
$zipfile = "$env:USERPROFILE\Downloads\python-$version-embed-amd64.zip"
$pythondir = "$env:USERPROFILE\Python"
$getpipurl = "https://bootstrap.pypa.io/get-pip.py"
Invoke-WebRequest -Uri $pythonurl -Outfile $zipfile
New-item -itemtype directory -path $pythondir
& ${env:ProgramFiles}\7-Zip\7z.exe x $zipfile "-o$($pythondir)"
Rename-Item -Path "$pythondir\python$shortversion._pth" -NewName "$pythondir\python$shortversion.pth"
Invoke-WebRequest -Uri $getpipurl -Outfile  $pythondir\get-pip.py
$env:Path = $pythondir + $env:Path
python $pythondir\get-pip.py
$env:Path = "$pythondir\Scripts" + $env:Path
pip install virtualenv
cd $env:USERPROFILE
virtualenv testenv
testenv\Scripts\activate
pip install aiohttp pylint
#update all packages
pip --disable-pip-version-check list --outdated --format=json | python -c "import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))"
New-item -itemtype directory -path "testenv\src"
New-Item -ItemType File -path "testenv\src\test.py"
Add-Content -Path "testenv\src\test.py" -Value "import aiohttp`r`n`r`na = aiohttp.ClientSession()"
# see if the lint crashes
pylint "testenv\src\test.py"

Replace the embeded python with regular python and the pylint works fine.

Is embeded python expected to work for this?
My solution is to further encourage our admins to install python properly on this server o remove the restriction on running msiexec.

@DanielNoord
Copy link
Collaborator

Sorry I don't think we support this. I don't have much experience with embedded python installations. @jacobtylerwalls do you?

@jacobtylerwalls
Copy link
Member

No I don't; reproducing in exactly the form the report takes will be difficult. Still, the reason I was tempted to put "good first issue" (which I removed once I realized we didn't have a convenient repro) is that we should identify where an Uninferable is being set on .args. We could probably construct a different reproducer that does that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

4 participants