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

inconsistent bahaviour of functools.partial python and C #119177

Closed
dg-pb opened this issue May 19, 2024 · 1 comment
Closed

inconsistent bahaviour of functools.partial python and C #119177

dg-pb opened this issue May 19, 2024 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@dg-pb
Copy link
Contributor

dg-pb commented May 19, 2024

Bug report

Bug description:

    def __new__(cls, func, /, *args, **keywords):
        ...
        if hasattr(func, "func"):
static PyObject *
partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
{
    int res = PyObject_TypeCheck(func, state->partial_type);
    ...
    if (res == 1) {

I believe python implementation should do:

if isinstance(func, cls):

Or were there any good reasons to check attribute instead?

CPython versions tested on:

3.11, 3.12

Operating systems tested on:

macOS

@dg-pb dg-pb added the type-bug An unexpected behavior, bug, or error label May 19, 2024
@sobolevn
Copy link
Member

Thanks for the report!

But, I think that this is duplicate of #100242

@sobolevn sobolevn closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants