Title: NPE in defaultdict
Type: crash Severity: normal
Components: Library Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: MrMeanie, amak, asmeurer, emblemparade, fwierzbicki, pjenvey, zyasoft
Priority: normal Keywords: patch

Created on 2010-11-09.03:00:22 by emblemparade, last changed 2013-02-06.23:25:47 by fwierzbicki.

File name Uploaded Description Edit Remove
Jython_r7169_Issue1676_fix_v1_20101109.patch MrMeanie, 2010-11-09.19:16:39 Patch to trunk (rev 7169)
msg6235 (view) Author: Tal (emblemparade) Date: 2010-11-09.03:00:20
Easy to reproduce:

>>> from collections import defaultdict
>>> x=defaultdict()
>>> x.pop(None,None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
	at org.python.core.PyDictionary.dict_pop(
	at org.python.core.PyDictionary$dict_pop_exposer.__call__(Unknown Source)
	at org.python.core.PyObject.__call__(
	at org.python.pycode._pyx20.f$0(<stdin>:1)
	at org.python.pycode._pyx20.call_function(<stdin>)
	at org.python.core.Py.runCode(
	at org.python.core.Py.exec(
	at org.python.util.PythonInterpreter.exec(
	at org.python.util.InteractiveInterpreter.runcode(
	at org.python.util.InteractiveInterpreter.runsource(
	at org.python.util.InteractiveInterpreter.runsource(
	at org.python.util.InteractiveConsole.push(
	at org.python.util.InteractiveConsole.interact(
	at org.python.util.jython.main(

Note: this bugs seems to have been introduced sometime after 2.5.2 beta.
msg6238 (view) Author: Geoffrey French (MrMeanie) Date: 2010-11-09.19:16:39
This problem appears to be caused by PyDictionary#dict_pop(), which accesses the 'map' member field directly, where it should go through the getMap() method instead.

Please find attached a patch that addresses this issue.
The patch has been tested against 'ant regrtest', and fixes the bug as described.
msg6299 (view) Author: Philip Jenvey (pjenvey) Date: 2010-12-24.00:40:46
This was broke when getMap() was added. It looks like there's potentially another use of map that should change to getMap in PyDictionary (in equals)
msg6705 (view) Author: Alan Kennedy (amak) Date: 2011-11-05.18:25:12
Is there anything we can do to move this one along?

It looks like a very straightforward issue and fix.

An updated patch against the mercurial tip, with tests, would be nice.
msg7633 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-06.23:25:47
Fixed, audited PyDictionary for other map->getMap needs, added a test in:
Date User Action Args
2013-02-06 23:25:47fwierzbickisetstatus: open -> closed
priority: normal
resolution: fixed
messages: + msg7633
2012-08-10 20:48:04fwierzbickisetassignee: zyasoft -> fwierzbicki
nosy: + fwierzbicki
2012-03-23 20:33:43asmeurersetnosy: + asmeurer
2011-11-05 18:25:12amaksetnosy: + amak
messages: + msg6705
2010-12-24 00:40:46pjenveysetassignee: zyasoft
messages: + msg6299
nosy: + pjenvey, zyasoft
2010-11-09 19:16:40MrMeaniesetfiles: + Jython_r7169_Issue1676_fix_v1_20101109.patch
keywords: + patch
messages: + msg6238
nosy: + MrMeanie
2010-11-09 03:00:22emblemparadecreate