Revision: 4651
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4651&view=rev
Author: mdboom
Date: 2007-12-06 10:47:50 -0800 (Thu, 06 Dec 2007)
Log Message:
-----------
Fix saving to a file-like object.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2007-12-06 18:38:55 UTC (rev
4650)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-12-06 18:47:50 UTC (rev
4651)
@@ -214,7 +214,7 @@
return 1
def is_writable_file_like(obj):
- return hasattr(filename, 'write') and callable(filename.write)
+ return hasattr(obj, 'write') and callable(obj.write)
def is_scalar(obj):
return is_string_like(obj) or not iterable(obj)
@@ -891,7 +891,7 @@
return x, self._mem[i0:self._n:isub]
def plot(self, i0=0, isub=1, fig=None):
- if fig is None:
+ if fig is None:
from pylab import figure, show
fig = figure()
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2007-12-06 18:38:55 UTC (rev
4650)
+++ trunk/matplotlib/src/_backend_agg.cpp 2007-12-06 18:47:50 UTC (rev
4651)
@@ -2293,11 +2293,9 @@
throw Py::RuntimeError( Printf("Could not open file %s",
file_name).str() );
}
else {
- if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) {
- PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(),
"write");
- if (!(write_method && PyCallable_Check(write_method)))
- throw Py::TypeError("Object does not appear to be a path or a Python
file-like object");
- }
+ PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write");
+ if (!(write_method && PyCallable_Check(write_method)))
+ throw Py::TypeError("Object does not appear to be a path or a Python
file-like object");
}
png_bytep *row_pointers = NULL;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins