File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2488,8 +2488,12 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
24882488 PyObject * str ;
24892489 assert (obj );
24902490 str = PyObject_Str (obj );
2491- if (!str || PyUnicode_READY (str ) == -1 )
2491+ if (!str )
2492+ goto fail ;
2493+ if (PyUnicode_READY (str ) == -1 ) {
2494+ Py_DECREF (str );
24922495 goto fail ;
2496+ }
24932497 argmaxchar = PyUnicode_MAX_CHAR_VALUE (str );
24942498 maxchar = Py_MAX (maxchar , argmaxchar );
24952499 n += PyUnicode_GET_LENGTH (str );
@@ -2503,8 +2507,12 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
25032507 PyObject * repr ;
25042508 assert (obj );
25052509 repr = PyObject_Repr (obj );
2506- if (!repr || PyUnicode_READY (repr ) == -1 )
2510+ if (!repr )
2511+ goto fail ;
2512+ if (PyUnicode_READY (repr ) == -1 ) {
2513+ Py_DECREF (repr );
25072514 goto fail ;
2515+ }
25082516 argmaxchar = PyUnicode_MAX_CHAR_VALUE (repr );
25092517 maxchar = Py_MAX (maxchar , argmaxchar );
25102518 n += PyUnicode_GET_LENGTH (repr );
@@ -2518,8 +2526,12 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
25182526 PyObject * ascii ;
25192527 assert (obj );
25202528 ascii = PyObject_ASCII (obj );
2521- if (!ascii || PyUnicode_READY (ascii ) == -1 )
2529+ if (!ascii )
2530+ goto fail ;
2531+ if (PyUnicode_READY (ascii ) == -1 ) {
2532+ Py_DECREF (ascii );
25222533 goto fail ;
2534+ }
25232535 argmaxchar = PyUnicode_MAX_CHAR_VALUE (ascii );
25242536 maxchar = Py_MAX (maxchar , argmaxchar );
25252537 n += PyUnicode_GET_LENGTH (ascii );
You can’t perform that action at this time.
0 commit comments