Bug in plot library

Eric Fahlgren <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <CAP2Qz+W6_5w2d94__TcBd_h8gfhMokafZS8jV-HdK5dxDvH8HA@mail.gmail.com>
​The PolyLine._path method is being called on occasion with a pair of numpy
arrays instead of Python list/tuple objects, causing it to raise a
TypeError, then seg fault.

> ./plotcanvasbug.py
Traceback (most recent call last):
  File "./plotcanvasbug.py", line 14, in <module>
    pl._Draw(graphics)
  File "T:\Python27\lib\site-packages\wxPhoenix\wx\lib\plot\plotcanvas.py",
line 1914, in _Draw
    graphics.draw(dc)
  File
"T:\Python27\lib\site-packages\wxPhoenix\wx\lib\plot\polyobjects.py", line
1421, in draw
    o.draw(dc, self._printerScale)
  File
"T:\Python27\lib\site-packages\wxPhoenix\wx\lib\plot\polyobjects.py", line
426, in draw
    self._path(dc, c1, c2, drawstyle)
  File
"T:\Python27\lib\site-packages\wxPhoenix\wx\lib\plot\polyobjects.py", line
481, in _path
    dc.DrawLines(line)
TypeError: DC.DrawLines(): argument 1 has unexpected type 'list'
Segmentation fault

I can "fix" it for this instance by just casting the coords to lists, but I
suspect there's something going wrong either above (don't pass in numpys)
or below (BufferedDC should handle numpy arrays)...

> cat plotcanvasbug.py
#!/bin/env python

import wx
import wx.lib.plot as WXP

app = wx.App()
mw = wx.Frame(parent=None, size=(500,500))
pl = WXP.PlotCanvas(parent=mw)

mw.Show()

curve = WXP.PolyLine(((0,0), (1,1)))
graphics = WXP.PlotGraphics([curve], 'Plot', 'x', 'y')
pl._Draw(graphics)

app.MainLoop()

#hack t:/Python27/Lib/site-packages/wxPhoenix/wx/lib/plot/polyobjects.py
#line 454 in _path
#        coord1, coord2 = list(coord1), list(coord2)

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.