@@ -1524,8 +1524,10 @@ _path_module::convert_to_svg(const Py::Tuple& args)
1524
1524
1525
1525
int precision = Py::Int (args[4 ]);
1526
1526
1527
+ #if PY_VERSION_HEX < 0x02070000
1527
1528
char format[64 ];
1528
1529
snprintf (format, 64 , " %s.%dg" , " %" , precision);
1530
+ #endif
1529
1531
1530
1532
typedef agg::conv_transform<PathIterator> transformed_path_t ;
1531
1533
typedef PathNanRemover<transformed_path_t > nan_removal_t ;
@@ -1568,9 +1570,23 @@ _path_module::convert_to_svg(const Py::Tuple& args)
1568
1570
*p++ = ' ' ;
1569
1571
}
1570
1572
1571
- p += snprintf (p, buffersize - (p - buffer), format, x);
1573
+ #if PY_VERSION_HEX >= 0x02070000
1574
+ char * str;
1575
+ str = PyOS_double_to_string (x, ' g' , precision, 0 , NULL );
1576
+ p += snprintf (p, buffersize - (p - buffer), str);
1577
+ PyMem_Free (str);
1572
1578
*p++ = ' ' ;
1573
- p += snprintf (p, buffersize - (p - buffer), format, y);
1579
+ str = PyOS_double_to_string (y, ' g' , precision, 0 , NULL );
1580
+ p += snprintf (p, buffersize - (p - buffer), str);
1581
+ PyMem_Free (str);
1582
+ #else
1583
+ char str[64 ];
1584
+ PyOS_ascii_formatd (str, 64 , format, x);
1585
+ p += snprintf (p, buffersize - (p - buffer), str);
1586
+ *p++ = ' ' ;
1587
+ PyOS_ascii_formatd (str, 64 , format, y);
1588
+ p += snprintf (p, buffersize - (p - buffer), str);
1589
+ #endif
1574
1590
1575
1591
--wait ;
1576
1592
}
0 commit comments