classification
Title: python.org Interactive interpreter linked with libedit can segfault on future OS X
Type: Stage: resolved
Components: macOS Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: interactive interpreter crashes and test_readline fails on OS X 10.9 Mavericks due to libedit update
View: 18458
Assigned To: ned.deily Nosy List: Max.Kaye, jcea, loewis, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2013-06-24 04:08 by Max.Kaye, last changed 2013-07-16 22:56 by ned.deily. This issue is now closed.

Messages (5)
msg191741 - (view) Author: Max Kaye (Max.Kaye) Date: 2013-06-24 04:08
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.
>>> print round(1.123456, 3)
1.123
>>> print round(1.123756, 3)
Segmentation fault: 11

This doesn't happen if you just do the second round, only if you do both.
`python -c "print round(1.123456, 3); print round(1.123756, 3)"` doesn't segfault.

Doesn't segfault on brew's python:
Python 2.7.3 (default, May 19 2013, 04:22:38) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print round(1.123456, 3)
1.123
>>> print round(1.123756, 3)
1.124
>>> 

Doesn't segfault on another box:
Python 2.7.2+ (default, Jul 20 2012, 22:12:53) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print round(1.123456, 3)
1.123
>>> print round(1.123756, 3)
1.124
>>> 

OSX Log File: (goes to EOF)

Process:         Python [5423]
Path:            /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         2.7.3 (2.7.3)
Code Type:       X86-64 (Native)
Parent Process:  bash [1219]
Responsible:     iTerm [442]
User ID:         501

Date/Time:       2013-06-24 13:55:56.871 +1000
OS Version:      Mac OS X 10.9 (13A476u)
Report Version:  11
Anonymous UUID:  D8CE5653-35DD-5963-C8C9-E5012E41FDEE

Sleep/Wake UUID: 9C40804C-F025-4E16-A61A-D1E9D9F68DD3

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 0000000100000000-0000000100001000 [    4K] r-x/rwx SM=COW  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   readline.so                   	0x00000001002eff97 call_readline + 647
1   org.python.python             	0x0000000100008852 PyOS_Readline + 274
2   org.python.python             	0x000000010000a0a8 tok_nextc + 104
3   org.python.python             	0x000000010000a853 PyTokenizer_Get + 147
4   org.python.python             	0x000000010000544a parsetok + 218
5   org.python.python             	0x00000001000e7722 PyParser_ASTFromFile + 146
6   org.python.python             	0x00000001000e8983 PyRun_InteractiveOneFlags + 243
7   org.python.python             	0x00000001000e8c6e PyRun_InteractiveLoopFlags + 78
8   org.python.python             	0x00000001000e9451 PyRun_AnyFileExFlags + 161
9   org.python.python             	0x000000010010006d Py_Main + 3085
10  org.python.python             	0x0000000100000f14 0x100000000 + 3860

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000100600000  rcx: 0x0000000100600000  rdx: 0x0000000000002800
  rdi: 0x0000000000000000  rsi: 0x00000001002f0254  rbp: 0x00007fff5fbff620  rsp: 0x00007fff5fbff550
   r8: 0x0000000100600000   r9: 0x0000000000000000  r10: 0x0000000000000007  r11: 0x0000000000000001
  r12: 0x0000000000000001  r13: 0x0000000000000018  r14: 0x00007fff5fbff5e0  r15: 0x00007fff5fbff560
  rip: 0x00000001002eff97  rfl: 0x0000000000010206  cr2: 0x0000000000000000
  
Logical CPU:     4
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x100000000 -        0x100000fff +org.python.python (2.7.3 - 2.7.3) <BE41DDF4-595E-0D6D-89DB-413749B339C3> /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
       0x100003000 -        0x10016dff7 +org.python.python (2.7.3, [c] 2004-2012 Python Software Foundation. - 2.7.3) <4F9EF48A-7D0C-0C1A-670B-3BF4E72C8696> /Library/Frameworks/Python.framework/Versions/2.7/Python
       0x1002ee000 -        0x1002f0fff +readline.so (???) <A33567B3-2793-9387-FD19-41FFD86C18E5> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
       0x1004f0000 -        0x10050effb  libedit.2.dylib (39) <24343EDB-E64F-34DC-8632-68C9E44E0FF7> /usr/lib/libedit.2.dylib
    0x7fff66a19000 -     0x7fff66a4c987  dyld (236) <B508800F-8D03-3886-A1DA-2F0C44D9B794> /usr/lib/dyld
    0x7fff8201f000 -     0x7fff82026ff3  libcopyfile.dylib (103) <7925E83E-6C96-38AD-9E53-AA9AE7C9E406> /usr/lib/system/libcopyfile.dylib
    0x7fff82062000 -     0x7fff82063ff7  libsystem_blocks.dylib (63) <FAC54B3A-C76F-33E4-8671-D4A81B39AE56> /usr/lib/system/libsystem_blocks.dylib
    0x7fff823cd000 -     0x7fff823f4ff3  libsystem_info.dylib (449) <6080681C-A561-3458-AA51-4DBE6D4E36B2> /usr/lib/system/libsystem_info.dylib
    0x7fff82460000 -     0x7fff82466fef  libsystem_platform.dylib (20.0.0.0.1) <E84062C5-5735-3708-A00F-45B6CBBDCE84> /usr/lib/system/libsystem_platform.dylib
    0x7fff82514000 -     0x7fff8251bff7  liblaunch.dylib (841) <0554A59B-30EE-3E01-A5F6-3676F4B060B2> /usr/lib/system/liblaunch.dylib
    0x7fff826d3000 -     0x7fff826d3ff7  libkeymgr.dylib (28) <C286BFEC-081D-3486-9B32-CEF54041795C> /usr/lib/system/libkeymgr.dylib
    0x7fff829d4000 -     0x7fff829d5ffb  libremovefile.dylib (33) <F1DEF2E9-8D3D-3CBD-86F7-752E6F3058EB> /usr/lib/system/libremovefile.dylib
    0x7fff83972000 -     0x7fff839b4ff7  libauto.dylib (185.4) <4B2CABC5-1F75-3225-81B4-882AEAE31ADC> /usr/lib/libauto.dylib
    0x7fff84188000 -     0x7fff8418ffff  libcompiler_rt.dylib (35) <9348DDF4-A5A7-3FDA-95E8-5018F88DC3AE> /usr/lib/system/libcompiler_rt.dylib
    0x7fff84190000 -     0x7fff84191fff  libunc.dylib (28) <34E818C3-373C-3564-8941-D9161473FD8A> /usr/lib/system/libunc.dylib
    0x7fff8478c000 -     0x7fff8478ffff  libsystem_stats.dylib (91.0.0.1.5) <E771B0BB-794C-3AB4-892E-B735ABB9C5D9> /usr/lib/system/libsystem_stats.dylib
    0x7fff84790000 -     0x7fff847b7ff7  libsystem_network.dylib (241.2) <377DF6DA-A545-3146-A2B0-69B7D4492FB2> /usr/lib/system/libsystem_network.dylib
    0x7fff85ae6000 -     0x7fff85ae9ff7  libdyld.dylib (236) <35641DC4-9D32-302F-BBE4-2B2E8A3D1D6B> /usr/lib/system/libdyld.dylib
    0x7fff86229000 -     0x7fff8624afff  libc++abi.dylib (41) <EB9D870E-F190-353A-AE6B-06611DA12EAB> /usr/lib/libc++abi.dylib
    0x7fff87095000 -     0x7fff870c4fd2  libsystem_m.dylib (3047.15) <471B9063-4C93-3157-A862-AD84E3620182> /usr/lib/system/libsystem_m.dylib
    0x7fff870c6000 -     0x7fff870d7ff7  libsystem_asl.dylib (215) <0995D278-3165-324E-8B35-936EA612ACD1> /usr/lib/system/libsystem_asl.dylib
    0x7fff88073000 -     0x7fff8808dfff  libsystem_malloc.dylib (23) <987C72AA-A2B3-3AD8-8616-D8A04B7440EF> /usr/lib/system/libsystem_malloc.dylib
    0x7fff88c56000 -     0x7fff88c58ff3  libsystem_configuration.dylib (589) <A7DF8D16-2DF5-3154-BFFE-0D0F8661542A> /usr/lib/system/libsystem_configuration.dylib
    0x7fff88ce4000 -     0x7fff88ce5ff7  libsystem_sandbox.dylib (272) <A20B280F-9171-30E0-BE6A-1D59F808278B> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff88f00000 -     0x7fff88f01ff7  libDiagnosticMessagesClient.dylib (100) <B28C426E-E826-3EC3-80AD-E69F2EABE46B> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff88f02000 -     0x7fff88f0cfff  libcommonCrypto.dylib (60047) <68F03BCA-58FD-39CC-878D-B7F6283102E5> /usr/lib/system/libcommonCrypto.dylib
    0x7fff88f82000 -     0x7fff8900bff7  libsystem_c.dylib (995) <82F1BDE9-FD58-3749-9837-15ADC6909E0A> /usr/lib/system/libsystem_c.dylib
    0x7fff89b93000 -     0x7fff89d4bffb  libicucore.A.dylib (511.13) <552A1606-39B8-3A4F-A975-73838AC1FDD6> /usr/lib/libicucore.A.dylib
    0x7fff8a265000 -     0x7fff8a267fff  libquarantine.dylib (65) <8791F59F-9F9F-3A24-83C4-BFD04CF589EA> /usr/lib/system/libquarantine.dylib
    0x7fff8a5ec000 -     0x7fff8a5f5ff3  libsystem_notify.dylib (121) <549072AF-B6C9-3F63-8027-72E70CAF91E4> /usr/lib/system/libsystem_notify.dylib
    0x7fff8a5fc000 -     0x7fff8a62cfff  libncurses.5.4.dylib (42) <DC54026B-27FB-3E1E-8015-0484C92D4970> /usr/lib/libncurses.5.4.dylib
    0x7fff8af11000 -     0x7fff8af63fff  libc++.1.dylib (118) <A91C1A57-5DEC-3DA0-8A8A-41D3CFE22C46> /usr/lib/libc++.1.dylib
    0x7fff8c7e4000 -     0x7fff8c7e8ff7  libcache.dylib (61) <D55C3D87-B518-3306-B8F0-F4F61938BE2A> /usr/lib/system/libcache.dylib
    0x7fff8d234000 -     0x7fff8d24eff7  libdispatch.dylib (338.0.0.0.1) <280908EF-A853-3653-A5B0-ED2668057F26> /usr/lib/system/libdispatch.dylib
    0x7fff8d262000 -     0x7fff8d263ff3  libSystem.B.dylib (1197) <3EE2A53C-6274-3FE4-AF73-E6BC8054D6EB> /usr/lib/libSystem.B.dylib
    0x7fff8d6d1000 -     0x7fff8d6d6ff7  libunwind.dylib (35.3) <56390AC7-A945-3A4B-9E83-305EF4828104> /usr/lib/system/libunwind.dylib
    0x7fff8e439000 -     0x7fff8e440ff7  libsystem_pthread.dylib (52) <D9483407-2FE6-3250-B236-4A70F167FD59> /usr/lib/system/libsystem_pthread.dylib
    0x7fff8e441000 -     0x7fff8e625fff  com.apple.CoreFoundation (6.9 - 839.13) <048EF287-A909-3CF5-B077-D885BCC0CE5F> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff8e9ba000 -     0x7fff8e9d5ff7  libsystem_kernel.dylib (2422.1.4.1.8) <49597BCD-66AE-3511-A739-ADCC5F15EBF5> /usr/lib/system/libsystem_kernel.dylib
    0x7fff8ea31000 -     0x7fff8ea39fff  libsystem_dnssd.dylib (519.0.71) <69EC92C2-E2E4-315E-AE65-B20E6BA117F8> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff8ea74000 -     0x7fff8eac2ff7  libcorecrypto.dylib (159) <9597C75C-2559-319C-B991-9A955C69C325> /usr/lib/system/libcorecrypto.dylib
    0x7fff8eb14000 -     0x7fff8eb36fff  libxpc.dylib (296.0.0.1.1) <4D58910D-3A78-3E94-A00F-C8184A51592B> /usr/lib/system/libxpc.dylib
    0x7fff8ebaa000 -     0x7fff8ed57f37  libobjc.A.dylib (548) <A73B4B10-C3A5-33C7-85AE-287201585D69> /usr/lib/libobjc.A.dylib
    0x7fff8efcb000 -     0x7fff8efd0fff  libmacho.dylib (845) <042598A7-4439-3CF6-8D51-FA41B43A52E7> /usr/lib/system/libmacho.dylib
    0x7fff8f2d1000 -     0x7fff8f2e2ff7  libz.1.dylib (53) <372E2641-66CA-3B13-8BE6-3A4335F861A6> /usr/lib/libz.1.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 698403
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=74.5M resident=14.9M(20%) swapped_out_or_unallocated=59.6M(80%)
Writable regions: Total=19.9M written=2144K(11%) resident=2816K(14%) swapped_out=0K(0%) unallocated=17.2M(86%)
 
REGION TYPE                      VIRTUAL
===========                      =======
Kernel Alloc Once                     4K
MALLOC                             11.6M
MALLOC (admin)                       16K
STACK GUARD                        56.0M
Stack                              8192K
VM_ALLOCATE                           8K
__DATA                             1452K
__LINKEDIT                         64.1M
__TEXT                             10.4M
__UNICODE                           544K
shared memory                         4K
===========                      =======
TOTAL                             152.1M

Model: MacBookPro10,1, BootROM MBP101.00EE.B02, 4 processors, Intel Core i7, 2.3 GHz, 8 GB, SMC 2.3f35
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In, 1024 MB
Graphics: NVIDIA GeForce GT 650M, NVIDIA GeForce GT 650M, PCIe, 1024 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54333531533642465238432D50422020
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54333531533642465238432D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xEF), Broadcom BCM43xx 1.0 (6.30.223.82.10)
Bluetooth: Version 4.2.0b3 12469, 3 services, 21 devices, 3 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM256E, 251 GB
USB Device: hub_device
USB Device: FaceTime HD Camera (Built-in)
USB Device: hub_device
USB Device: hub_device
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Apple Internal Keyboard / Trackpad
msg191743 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-06-24 04:54
The crash report indicates that the operating system is a OS X 10.9 Developer Preview (which is under NDA at the moment) and that you are using the python2.7.3 from the python.org 64-bit/32-bit 2.7.3 installer.  The readline module include with that installer dynamically links with the OS-provided libedit.dylib for terminal editing functions in the interactive interpreter. I can also reproduce a similar crash using the python.org 3.3.2 installer and just by entering "print('a')" twice; no need to use round(). The problem is not reproducible on current OS X 10.8 systems. Almost certainly this is due to some incompatible change in libedit.dylib.  You should open an issue with Apple reporting the compatibility problem.  The Homebrew Python most likely is linked with its own copy of the GNU readline library rather than the system libedit.
msg192393 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-07-06 09:30
I propose to close this issue because this is likely a bug in a beta version of OSX and that's not something we'll try to work around in the python sources.
msg192409 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2013-07-06 10:46
Ok, closing it. Should the issue resurface in the final release of the system, please submit a new bug report (possibly linking to it here).
msg193197 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-07-16 22:56
Issue18458 has been opened to track this problem.
History
Date User Action Args
2015-06-01 17:03:36ned.deilylinkissue24350 superseder
2014-01-22 16:29:34r.david.murraylinkissue20347 superseder
2013-07-16 22:56:46ned.deilysetmessages: + msg193197
2013-07-16 22:55:29ned.deilysetsuperseder: interactive interpreter crashes and test_readline fails on OS X 10.9 Mavericks due to libedit update
resolution: wont fix -> duplicate
stage: resolved
2013-07-06 10:46:02loewissetstatus: open -> closed

nosy: + loewis
messages: + msg192409

resolution: wont fix
2013-07-06 09:30:29ronaldoussorensetmessages: + msg192393
2013-06-26 14:06:18jceasetnosy: + jcea
2013-06-24 04:56:15ned.deilysetnosy: + ronaldoussoren
components: + macOS
2013-06-24 04:54:05ned.deilysettitle: Segmentation Fault using round() -> python.org Interactive interpreter linked with libedit can segfault on future OS X
nosy: + ned.deily

messages: + msg191743

assignee: ned.deily
versions: + Python 3.3
2013-06-24 04:08:37Max.Kayecreate