-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[multiprocessing] fixes some stubtest cases for Value and Array #4282
Conversation
Second note is that |
Ooo, there are some easy fixes in that issue, but this is a tricky one. There are several improvements to be made to the stubs here, that are separate from stubtest's actual (but minor to the end user) complaint. I can explain a little more (and forgive me if I over-explain): So the core issue is that these class-looking things in multiprocessing are actually functions returning ctypes objects.
Why does stubtest complain here? stubtest sees that the stubs define a class, and so tries to confirm that the runtime object is an instance of
What should we do? I would do the following:
This isn't all or nothing either, even just making a Also this turned out to be a hefty wall of text, I hope it makes sense!! |
Thanks for the detailed feedback, @hauntsaninja. I've added what I think is the right way to approach this.
One thing I'm not sure about - it seems like |
Ah I derped on 3, the context is from the sharedctypes method and not the |
This looks great! It's too bad pytype doesn't seem to understand the bound method :-( (pytype is often less sophisticated than mypy). I guess we can just duplicate the definition from |
Heh, I just came across typeshed/stdlib/2and3/turtle.pyi Lines 284 to 291 in ac234f2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, hopefully this gets everything green!
Sweet! Thanks for the help |
I wanted to get my toes a little more wet into stubtests so I tried to take a stab at #4266. I believe this fixes two test cases:
I'm still not sure I understand why this works. The only reason I arrived at this solution is by following the pattern for line 44 defined in the same file which uses a function for
Semaphore
despite it also being a class according to the docs. Does this have to do with mp having a dynamic nature? Is this the correct solution?Test Plan: