classification
Title: with lock fails on multiprocessing
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jnoller Nosy List: jnoller, stepheng.lynch, tim.golden
Priority: high Keywords: patch

Created on 2009-02-14 18:51 by stepheng.lynch, last changed 2009-03-30 23:30 by jnoller. This issue is now closed.

Files
File name Uploaded Description Edit
multiprocessing.patch tim.golden, 2009-02-14 20:52
Messages (6)
msg82106 - (view) Author: Stephen Lynch (stepheng.lynch) Date: 2009-02-14 18:51
the following code gives a system error under python 2.6.1

import multiprocessing

with multiprocessing.Lock(): pass


SystemError: ..\Python\getargs.c:1413: bad argument to internal function
msg82115 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2009-02-14 20:03
Reproduced on trunk r69621
msg82117 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2009-02-14 20:52
Problem seems to be in Modules/_multiprocessing/semaphore.c 
line 549 where "__enter__" is defined as an alias for 
semlock_acquire, as is "acquire" a few lines above. However,
while "acquire" specifies METH_VARARGS | METH_KEYWORDS,
"__enter__" has only METH_VARARGS.

semlock_acquire at line 60 has the signature:

  SemLockObject *self, PyObject *args, PyObject *kwds

When it is called via __enter__ kwds aren't passed in
and it gets a NULL pointer.

Suggested patch attached, defining __enter__ in the same
way as acquire. Test included.
msg84307 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2009-03-28 15:16
Can I nudge this one a bit? It causes an interpreter crash and the patch
seems good (subject to someone else's review).
msg84308 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-03-28 15:20
I will be addressing all of the MP bugs during the pycon sprints starting 
sunday
msg84717 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-03-30 23:30
Reviewed, applied in python-trunk r70783
History
Date User Action Args
2009-03-30 23:30:32jnollersetstatus: open -> closed
resolution: fixed
messages: + msg84717
2009-03-29 14:35:00jnollersetpriority: high
2009-03-28 15:20:17jnollersetmessages: + msg84308
2009-03-28 15:16:14tim.goldensetmessages: + msg84307
2009-02-15 09:56:41tim.goldensettype: crash
2009-02-14 20:52:33tim.goldensetfiles: + multiprocessing.patch
keywords: + patch
messages: + msg82117
2009-02-14 20:21:51benjamin.petersonsetassignee: jnoller
nosy: + jnoller
2009-02-14 20:03:02tim.goldensetnosy: + tim.golden
messages: + msg82115
versions: + Python 2.7
2009-02-14 18:51:14stepheng.lynchcreate