This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: dict({'a':'aa'},a='bb') raises segmentation fault on Mac
Type: crash Stage: resolved
Components: macOS Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Interactive interpreter linked with libedit can segfault on future OS X
View: 18289
Assigned To: Nosy List: Graham Klyne, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2015-06-01 16:33 by Graham Klyne, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg244601 - (view) Author: Graham Klyne (Graham Klyne) Date: 2015-06-01 16:33
conina:~ graham$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> dict({'a':'aa'},b='bb')
{'a': 'aa', 'b': 'bb'}
>>> dict({'a':'aa'},a='bb')
Segmentation fault: 11
conina:~ graham$

From the docs:
If keyword arguments are given, the keyword arguments and their values are added to the dictionary created from the positional argument. If a key being added is already present, the value from the keyword argument replaces the value from the positional argument.
msg244602 - (view) Author: Graham Klyne (Graham Klyne) Date: 2015-06-01 16:36
Oops, (RETURN) submitted before comments done...

I think the example interactive python script is self-explanatory.

I know my version of Python is a bit out of date, but I couldn't see anything in the issue list that indicated this problem had been seen and fixed.  I had previously experienced some segment fault crashes while doing dictionary manipulation, but could not isolate the cause.
msg244603 - (view) Author: Graham Klyne (Graham Klyne) Date: 2015-06-01 16:39
I just tried the same on a Python 2.7.5 installation and it worked as expected (no crash).  So I now assume this is fixed. Sorry for the noise.
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68538
2015-06-01 17:03:36ned.deilysetsuperseder: Interactive interpreter linked with libedit can segfault on future OS X
resolution: out of date -> duplicate
stage: resolved
2015-06-01 16:39:57Graham Klynesetstatus: open -> closed
resolution: out of date
messages: + msg244603
2015-06-01 16:36:48Graham Klynesetmessages: + msg244602
2015-06-01 16:33:07Graham Klynecreate