Skip to content

Commit ac8b0e9

Browse files
committed
more log fixes
svn path=/trunk/matplotlib/; revision=957
1 parent 36c8bb1 commit ac8b0e9

File tree

6 files changed

+35
-27
lines changed

6 files changed

+35
-27
lines changed

TODO

+4-1
Original file line numberDiff line numberDiff line change
@@ -642,4 +642,7 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
642642

643643
-- fix contour mappable to work under changes in clim, cmap
644644

645-
-- DONE make subplot delaxes on other subplots under it.
645+
-- DONE make subplot delaxes on other subplots under it.
646+
647+
-- fix transoffset->operator calls in _backend_agg.cpp to handle
648+
exceptions

lib/matplotlib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
Most of the other commands are from the Numeric, MLab and FFT, with
141141
the exception of those in mlab.py provided by matplotlib.
142142
"""
143-
__version__ = '0.72'
143+
__version__ = '0.72rc1'
144144
__revision__ = '$Revision$'
145145
__date__ = '$Date$'
146146

lib/matplotlib/legend.py

+1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def _get_handles(self, handles, texts):
234234
legline = Line2D(self._xdata, ydata)
235235
self._set_artist_props(legline)
236236
lw = handle.get_linewidths()[0]
237+
style = handle.get_linewidths()[0]
237238
color = handle.get_colors()[0]
238239
legline.set_color(color)
239240
legline.set_linewidth(lw)

src/_backend_agg.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
598598
try {
599599
transform->eval_scalars();
600600
}
601-
catch (std::domain_error &err) {
601+
catch(...) {
602602
throw Py::ValueError("Domain error on eval_scalars in RendererAgg::draw_poly_collection");
603603
}
604604

@@ -621,7 +621,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
621621
try {
622622
transOffset->eval_scalars();
623623
}
624-
catch (std::domain_error &err) {
624+
catch(...) {
625625
throw Py::ValueError("Domain error on transoffset eval_scalars in RendererAgg::draw_poly_collection");
626626
}
627627

@@ -779,7 +779,7 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
779779
try {
780780
transOffset->eval_scalars();
781781
}
782-
catch (std::domain_error &err) {
782+
catch(...) {
783783
throw Py::ValueError("Domain error on eval_scalars in RendererAgg::draw_regpoly_collection");
784784
}
785785

@@ -925,7 +925,7 @@ RendererAgg::draw_lines(const Py::Tuple& args) {
925925
try {
926926
mpltransform->affine_params_api(&a, &b, &c, &d, &tx, &ty);
927927
}
928-
catch (std::domain_error &err) {
928+
catch(...) {
929929
throw Py::ValueError("Domain error on affine_params_api in RendererAgg::draw_lines");
930930
}
931931

@@ -942,6 +942,7 @@ RendererAgg::draw_lines(const Py::Tuple& args) {
942942
double heightd = height;
943943

944944
double lastx(-2.0), lasty(-2.0);
945+
945946
for (size_t i=0; i<Nx; ++i) {
946947
thisx = *(double *)(xa->data + i*xa->strides[0]);
947948
thisy = *(double *)(ya->data + i*ya->strides[0]);
@@ -951,7 +952,7 @@ RendererAgg::draw_lines(const Py::Tuple& args) {
951952
try {
952953
mpltransform->nonlinear_only_api(&thisx, &thisy);
953954
}
954-
catch (std::domain_error& err) {
955+
catch (...) {
955956
moveto = true;
956957
continue;
957958
}
@@ -991,6 +992,7 @@ RendererAgg::draw_lines(const Py::Tuple& args) {
991992

992993

993994
_render_lines_path(path, gc);
995+
_VERBOSE("RendererAgg::draw_lines DONE");
994996
return Py::Object();
995997

996998
}
@@ -1070,7 +1072,7 @@ RendererAgg::draw_markers(const Py::Tuple& args) {
10701072
try {
10711073
mpltransform->affine_params_api(&a, &b, &c, &d, &tx, &ty);
10721074
}
1073-
catch (std::domain_error &err) {
1075+
catch(...) {
10741076
throw Py::ValueError("Domain error on affine_params_api in RendererAgg::draw_markers");
10751077
}
10761078

@@ -1167,7 +1169,7 @@ RendererAgg::draw_markers(const Py::Tuple& args) {
11671169
try {
11681170
mpltransform->nonlinear_only_api(&thisx, &thisy);
11691171
}
1170-
catch (std::domain_error& err) {
1172+
catch(...) {
11711173
continue;
11721174
}
11731175

@@ -1315,7 +1317,7 @@ RendererAgg::draw_markers(const Py::Tuple& args) {
13151317
if (mpltransform->need_nonlinear_api())
13161318
mpltransform->nonlinear_only_api(&thisx, &thisy);
13171319
}
1318-
catch (std::domain_error& err) {
1320+
catch (..) {
13191321
//std::cout << "caught a live one, ignoring" << std::endl;
13201322
continue;
13211323
}

src/_transforms.cpp

+15-14
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Func::map(const Py::Tuple &args) {
485485
try {
486486
xout = this->operator()(xin);
487487
}
488-
catch (std::domain_error &err) {
488+
catch(...) {
489489
throw Py::ValueError("Domain error on Func::map");
490490
}
491491

@@ -517,7 +517,7 @@ FuncXY::map(const Py::Tuple &args) {
517517
try {
518518
xy = this->operator()(xin, yin);
519519
}
520-
catch (std::domain_error &err) {
520+
catch(...) {
521521
throw Py::ValueError("Domain error on FuncXY nonlinear transform");
522522
}
523523

@@ -679,7 +679,7 @@ Transformation::inverse_xy_tup(const Py::Tuple & args) {
679679
try {
680680
if (!_frozen) eval_scalars();
681681
}
682-
catch (std::domain_error &err) {
682+
catch(...) {
683683
throw Py::ValueError("Domain error on invser_xy_tup");
684684
}
685685

@@ -700,7 +700,7 @@ Transformation::xy_tup(const Py::Tuple & args) {
700700
try {
701701
if (!_frozen) eval_scalars();
702702
}
703-
catch (std::domain_error &err) {
703+
catch(...) {
704704
throw Py::ValueError("Domain error on nonlinear transform");
705705
}
706706

@@ -714,7 +714,7 @@ Transformation::xy_tup(const Py::Tuple & args) {
714714
try {
715715
this->operator()(x, y);
716716
}
717-
catch (std::domain_error &err) {
717+
catch(...) {
718718
throw Py::ValueError("Domain error on nTransformation::xy_tup operator()(x,y)");
719719
}
720720

@@ -741,7 +741,7 @@ Transformation::seq_x_y(const Py::Tuple & args) {
741741
try {
742742
if (!_frozen) eval_scalars();
743743
}
744-
catch (std::domain_error &err) {
744+
catch(...) {
745745
throw Py::ValueError("Domain error on Transformation::seq_x_y");
746746
}
747747

@@ -756,7 +756,7 @@ Transformation::seq_x_y(const Py::Tuple & args) {
756756
try {
757757
this->operator()(thisx, thisy);
758758
}
759-
catch (std::domain_error &err) {
759+
catch(...) {
760760
throw Py::ValueError("Domain error on Transformation::seq_x_y operator()(thisx, thisy)");
761761
}
762762

@@ -801,7 +801,7 @@ Transformation::numerix_x_y(const Py::Tuple & args) {
801801
try {
802802
if (!_frozen) eval_scalars();
803803
}
804-
catch (std::domain_error &err) {
804+
catch(...) {
805805
throw Py::ValueError("Domain error on Transformation::numerix_x_y");
806806
}
807807

@@ -832,7 +832,7 @@ Transformation::numerix_x_y(const Py::Tuple & args) {
832832
try {
833833
this->operator()(thisx, thisy);
834834
}
835-
catch (std::domain_error &err) {
835+
catch(...) {
836836
throw Py::ValueError("Domain error on Transformation::numerix_x_y");
837837
}
838838

@@ -904,7 +904,7 @@ Transformation::nonlinear_only_numerix(const Py::Tuple & args) {
904904
try {
905905
this->nonlinear_only_api(&thisx, &thisy);
906906
}
907-
catch (std::domain_error &err) {
907+
catch(...) {
908908
throw Py::ValueError("Domain error on this->nonlinear_only_api(&thisx, &thisy) in Transformation::nonlinear_only_numerix");
909909
}
910910

@@ -936,7 +936,7 @@ Transformation::seq_xy_tups(const Py::Tuple & args) {
936936
try {
937937
if (!_frozen) eval_scalars();
938938
}
939-
catch (std::domain_error &err) {
939+
catch(...) {
940940
throw Py::ValueError("Domain error on Transformation::seq_xy_tups");
941941
}
942942

@@ -954,7 +954,7 @@ Transformation::seq_xy_tups(const Py::Tuple & args) {
954954
try {
955955
this->operator()(thisx, thisy);
956956
}
957-
catch (std::domain_error &err) {
957+
catch(...) {
958958
throw Py::ValueError("Domain error on nonlinear Transformation::seq_xy_tups operator()(thisx, thisy)");
959959
}
960960

@@ -1515,7 +1515,7 @@ Affine::deepcopy(const Py::Tuple &args) {
15151515
try {
15161516
eval_scalars();
15171517
}
1518-
catch (std::domain_error &err) {
1518+
catch(...) {
15191519
throw Py::ValueError("Domain error on Affine deepcopy");
15201520
}
15211521

@@ -1824,7 +1824,7 @@ Transformation::init_type()
18241824

18251825
add_varargs_method("get_funcx", &Transformation::get_funcx, "get_funcx(); return the Func instance on x\n");
18261826
add_varargs_method("get_funcy", &Transformation::get_funcy, "get_funcy(); return the Func instance on y\n");
1827-
1827+
18281828
add_varargs_method("set_funcx", &Transformation::set_funcx, "set_funcx(); set the Func instance on x\n");
18291829
add_varargs_method("set_funcy", &Transformation::set_funcy, "set_funcy(); set the Func instance on y\n");
18301830

@@ -1902,3 +1902,4 @@ DL_EXPORT(void)
19021902
d["IDENTITY"] = Py::Int((int)Func::IDENTITY);
19031903
d["POLAR"] = Py::Int((int)FuncXY::POLAR);;
19041904
};
1905+

src/_transforms.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ class Func : public Py::PythonExtension<Func> {
397397
if (_type==IDENTITY) return x;
398398
else if (_type==LOG10) {
399399
if (x<=0) {
400+
//throw Py::ValueError("test throw");
400401
throw std::domain_error("Cannot take log of nonpositive value");
401402

402403
}
@@ -487,7 +488,7 @@ class Transformation: public Py::PythonExtension<Transformation> {
487488
try {
488489
affine_params_api(&a, &b, &c, &d, &tx, &ty);
489490
}
490-
catch (std::domain_error &err) {
491+
catch(...) {
491492
throw Py::ValueError("Domain error on as_vec6_val in Transformation::as_vec6_val");
492493
}
493494

@@ -543,15 +544,15 @@ class Transformation: public Py::PythonExtension<Transformation> {
543544
try {
544545
eval_scalars();
545546
}
546-
catch (std::domain_error &err) {
547+
catch(...) {
547548
throw Py::ValueError("Domain error on eval_scalars in Transformation::freeze");
548549
}
549550

550551
if (_usingOffset) {
551552
try {
552553
_transOffset->eval_scalars();
553554
}
554-
catch (std::domain_error &err) {
555+
catch(...) {
555556
throw Py::ValueError("Domain error on eval_scalars in transoffset Transformation::eval_scalars");
556557
}
557558

0 commit comments

Comments
 (0)