Commit f73778fa authored by Boxiang Sun's avatar Boxiang Sun

add refcounting annotation that make test_long pass

parent a0412c43
# expected: reffail
import unittest import unittest
import sys import sys
......
...@@ -1575,7 +1575,6 @@ Box* instanceInt(Box* _inst) { ...@@ -1575,7 +1575,6 @@ Box* instanceInt(Box* _inst) {
} }
Box* truncated = instanceTrunc(inst); Box* truncated = instanceTrunc(inst);
AUTO_DECREF(truncated);
/* __trunc__ is specified to return an Integral type, but /* __trunc__ is specified to return an Integral type, but
int() needs to return an int. */ int() needs to return an int. */
Box* res = _PyNumber_ConvertIntegralToInt(truncated, "__trunc__ returned non-Integral (type %.200s)"); Box* res = _PyNumber_ConvertIntegralToInt(truncated, "__trunc__ returned non-Integral (type %.200s)");
......
...@@ -712,11 +712,11 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA ...@@ -712,11 +712,11 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
Box* srepr = PyObject_Repr(val); Box* srepr = PyObject_Repr(val);
if (S == CAPI) { if (S == CAPI) {
PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: '%s'", base, PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: '%s'", base,
PyString_AS_STRING(srepr)); PyString_AS_STRING(autoDecref(srepr)));
return NULL; return NULL;
} else { } else {
raiseExcHelper(ValueError, "invalid literal for long() with base %d: '%s'", base, raiseExcHelper(ValueError, "invalid literal for long() with base %d: '%s'", base,
PyString_AS_STRING(srepr)); PyString_AS_STRING(autoDecref(srepr)));
} }
} }
Box* r = PyLong_FromString(s->data(), NULL, base); Box* r = PyLong_FromString(s->data(), NULL, base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment