"Cannot access member" when overloading/rewriting an inherited class method of an included module? #1991
-
Mostly unsure what's causing this, but I figured I could put it up to discussion. I have a class called The parent's def submit(self, fn, /, *args, **kwargs):
with self._shutdown_lock:
if self._broken:
raise BrokenProcessPool(self._broken)
if self._shutdown_thread:
raise RuntimeError('cannot schedule new futures after shutdown')
if _global_shutdown:
raise RuntimeError('cannot schedule new futures after '
'interpreter shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._pending_work_items[self._queue_count] = w
self._work_ids.put(self._queue_count)
self._queue_count += 1
# Wake up queue management thread
self._executor_manager_thread_wakeup.wakeup()
self._adjust_process_count()
self._start_executor_manager_thread()
return f The question is why for each variable that uses the
This error does not appear when using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Mypy wouldn't give errors here because your function doesn't have type annotations. The issue is simply that you're using private attributes that aren't present in typeshed (https://github.com/python/typeshed/blob/master/stdlib/concurrent/futures/process.pyi). Typeshed's policy is to add private attributes when a user asks for them, so feel free to submit a PR to typeshed to add what you need. |
Beta Was this translation helpful? Give feedback.
Mypy wouldn't give errors here because your function doesn't have type annotations. The issue is simply that you're using private attributes that aren't present in typeshed (https://github.com/python/typeshed/blob/master/stdlib/concurrent/futures/process.pyi). Typeshed's policy is to add private attributes when a user asks for them, so feel free to submit a PR to typeshed to add what you need.