Skip to content

"_RmtreeType" not callable when passed to functools.partial on Python 3.12 #18637

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

Closed
Avasam opened this issue Feb 8, 2025 · 2 comments · Fixed by #18639
Closed

"_RmtreeType" not callable when passed to functools.partial on Python 3.12 #18637

Avasam opened this issue Feb 8, 2025 · 2 comments · Fixed by #18639
Labels
bug mypy got something wrong

Comments

@Avasam
Copy link
Contributor

Avasam commented Feb 8, 2025

Bug Report

See reproducer, it's that simple. Probably partially caused by the 3.12+ definition of _RmtreeType on typeshed overloading the __call__ definition

To Reproduce

import functools, shutil
functools.partial(shutil.rmtree)

Expected Behavior

No error

Actual Behavior

error: "_RmtreeType" not callable [misc]

Your Environment

  • Mypy version used: mypy 1.15.0 (compiled: yes)
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.12.0 and 3.13.0
@Avasam Avasam added the bug mypy got something wrong label Feb 8, 2025
@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Feb 9, 2025

Thanks, effectively a duplicate of #17585

@hauntsaninja
Copy link
Collaborator

Although this issue can be fixed to not have the bad error message and only not fully support the overload logic...

hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Feb 9, 2025
Resolves python#18637

Mypy's behaviour here is not correct (see test case), but this PR
makes mypy's behaviour match what it used to be before we added the
functools.partial plugin
@Avasam Avasam changed the title "_RmtreeType" not callable when passed to fucntools.partial on Python 3.12 "_RmtreeType" not callable when passed to functools.partial on Python 3.12 Feb 9, 2025
hauntsaninja added a commit that referenced this issue Feb 9, 2025
…#18639)

Resolves #18637

Mypy's behaviour here is not correct (see test case), but this PR makes
mypy's behaviour match what it used to be before we added the
functools.partial plugin

Support for overloads tracked in #17585
x612skm pushed a commit to x612skm/mypy-dev that referenced this issue Feb 24, 2025
…python#18639)

Resolves python#18637

Mypy's behaviour here is not correct (see test case), but this PR makes
mypy's behaviour match what it used to be before we added the
functools.partial plugin

Support for overloads tracked in python#17585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants