Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Segfault when calling show() after using Popen (test code inside) #6429

Closed
Labels
@cmey

Description

@cmey

Hi, please consider the following SSCCE:

import matplotlibmatplotlib.use('MacOSX')  # Segfault in backend from call to pyplot.show().# matplotlib.use('TkAgg')  # This backend does not reproduce the segfault.import matplotlib.pyplot as pltimport numpy as npimport signalfrom subprocess import Popen, PIPEdef mplayer_view(img):    mplayer = Popen(        ['mplayer', '-',         '-demuxer', 'rawvideo',         '-rawvideo', 'w={}:h={}:format={}'.format(            img.shape[1], img.shape[0], 'y8')],        stdin=PIPE    )    tmp = img.astype('int8').tostring('C')    # Writing twice is important to reproduce the segfault (no flush needed).    mplayer.stdin.write(tmp)    mplayer.stdin.write(tmp)    mplayer.kill()if __name__ == "__main__":    img = np.zeros((512,512))  # Need to write enough bytes.    mplayer_view(img)    plt.figure()    plt.show()  # <-- segfault here

Running that withpython I getSegmentation fault: 11

Using faulthandler, the backtrace traces it to matplotlib's macosx backend from the call to show():

Fatal Python error: Segmentation faultCurrent thread 0x00007fff7a0c4000 (most recent call first):  File "/Users/cmey/.pyenv/versions/chips-3.4.3/lib/python3.4/site-packages/matplotlib/backends/backend_macosx.py", line 29 in mainloop  File "/Users/cmey/.pyenv/versions/chips-3.4.3/lib/python3.4/site-packages/matplotlib/backend_bases.py", line 192 in __call__  File "/Users/cmey/.pyenv/versions/chips-3.4.3/lib/python3.4/site-packages/matplotlib/pyplot.py", line 244 in show  File "/Users/cmey/Code/python/test_matplotlib_segfault.py", line 35 in <module>Segmentation fault: 11

I checked the return code from mplayer (withmplayer.wait()), it is-9 as it should (I kill it). If it was mplayer that segfaulted,wait() would return -11. Even if mplayer segfaults, that should not produce a segfault from matplotlib/Python.

I couldn't find another program than mplayer to pipe to, that reproduces the segfault.

Christophe
-- OSX, matplotlib version 1.5.1 from pip 8.1.2, Python 3.4.3 from pyenv, MPlayer 1.3.0-4.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp