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

multiprocessing.Process.daemon should be typed as property instead of bool? #2361

Closed
kentavv opened this issue Aug 6, 2018 · 1 comment
Closed

Comments

@kentavv
Copy link

kentavv commented Aug 6, 2018

I'm just getting into mypy so I could be wrong, but in stdlib/3/multiprocessing/__init__.pyi bool is the expected type of multiprocessing.Process.daemon

class Process():
    name: str
    daemon: bool

but daemon is a property type

$ python3
Python 3.6.6 (default, Jul 19 2018, 14:25:17) 
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import multiprocessing
type(multiprocessing.Process.daemon)
<class 'property'>

causing the mypy error

error: Incompatible types in assignment (expression has type "property", base class "Process" defined the type as "bool")

on

class NoDaemonProcess(multiprocessing.Process):
    # make 'daemon' attribute always return False
    def _get_daemon(self):
        return False
    def _set_daemon(self, value):
        pass
    daemon = property(_get_daemon, _set_daemon)

Thank you

@srittau
Copy link
Collaborator

srittau commented Nov 19, 2018

This is a bug in mypy: python/mypy#4125. For the moment the best solution is to use # type: ignore.

@srittau srittau closed this as completed Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants