classification
Title: Missing parameter "n" on multiprocessing.Condition.notify()
Type: compile error Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: davin Nosy List: Victor de la Fuente, davin, haypo, josh.r, pitrou
Priority: normal Keywords:

Created on 2017-01-17 08:43 by Victor de la Fuente, last changed 2017-07-05 13:44 by haypo. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2480 merged pitrou, 2017-06-28 20:47
Messages (5)
msg285623 - (view) Author: Victor de la Fuente (Victor de la Fuente) Date: 2017-01-17 08:43
Versions:
Darwin MacBook-Pro-de-Victor.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

import multiprocessing as mp

condition = mp.Condition()

with condition:
    condition.notify(2) #Docs show notify(n=1)
#TypeError: notify() takes 1 positional argument but 2 were given

#Replacing the call with condition.notify(2):
#TypeError: notify() got an unexpected keyword argument 'n'


# Docs show signature: def notify(self, n=1)
# But found this debugging:
 
# multiprocessing/synchronize.py
# line 211: class Condition(object):
# .....
# line 271:     def notify(self): #<-- ┬┐There is no n paramater?
# .....
msg285625 - (view) Author: Victor de la Fuente (Victor de la Fuente) Date: 2017-01-17 08:45
Sorry for the typo, I meant:

#Replacing the call with condition.notify(n=2):
#TypeError: notify() got an unexpected keyword argument 'n'
msg285767 - (view) Author: Josh Rosenberg (josh.r) * Date: 2017-01-19 04:19
Looks like, despite what the multiprocessing.Condition docs say (claiming it's an alias for threading.Condition), at least in Python 3.5, it's a completely separate animal from multiprocessing.synchronize, and the notify method on it doesn't take any parameters.

Seems like an obvious thing to fix; the parameter is defaulted anyway, so existing code should continue to work, and it makes multiprocessing swap in for threading more seamlessly.
msg297628 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-07-04 06:59
New changeset 48350412b70c76fa51f488cfc736c80d59b5e8eb by Antoine Pitrou in branch 'master':
bpo-29293: multiprocessing.Condition.notify() lacks parameter `n` (#2480)
https://github.com/python/cpython/commit/48350412b70c76fa51f488cfc736c80d59b5e8eb
msg297750 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-07-05 13:44
New changeset 8207c17486baece8ed0ac42d9f8d69ecec4ba7e4 by Victor Stinner in branch 'master':
Revert "bpo-30822: Fix testing of datetime module." (#2588)
https://github.com/python/cpython/commit/8207c17486baece8ed0ac42d9f8d69ecec4ba7e4
History
Date User Action Args
2017-07-05 13:44:56hayposetnosy: + haypo
messages: + msg297750
2017-07-04 06:59:42pitrousetstatus: open -> closed
resolution: fixed
stage: resolved
2017-07-04 06:59:24pitrousetnosy: + pitrou
messages: + msg297628
2017-06-28 20:47:01pitrousetpull_requests: + pull_request2538
2017-06-28 20:46:34pitrousetversions: + Python 3.7, - Python 3.6
2017-01-19 04:19:05josh.rsetnosy: + josh.r
messages: + msg285767
2017-01-17 08:48:45rhettingersetassignee: davin

nosy: + davin
2017-01-17 08:45:03Victor de la Fuentesetmessages: + msg285625
2017-01-17 08:43:56Victor de la Fuentecreate