Skip to content

not-callable false positive for types.FunctionType #7500

Description

@Jackenmen

Bug description

# pylint: disable=missing-docstring

import types

code = compile(input(">>> "), "<stdin>", "exec")
types.FunctionType(code, {})()

A more complete example of public code constructing types.FunctionCode object can be found at:
https://github.com/python/cpython/blob/34de67c094776bdc719d87f8810e053a2acc915a/Lib/asyncio/__main__.py#L32

Configuration

No response

Command used

pylint repro.py

Pylint output

************* Module repro
repro.py:6:0: E1102: types.FunctionType(code, {}) is not callable (not-callable)

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

Expected behavior

No error.

Pylint version

pylint 2.15.3
astroid 2.12.10
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]

OS / Environment

Kubuntu 22.04.1 LTS

Additional dependencies

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeHacktoberfestHelp wanted 🙏Outside help would be appreciated, good for new contributorsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions