Commit e7b2b337 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add nonzero(unicode) special case

parent 60ce3708
...@@ -2254,6 +2254,16 @@ extern "C" bool nonzero(Box* obj) { ...@@ -2254,6 +2254,16 @@ extern "C" bool nonzero(Box* obj) {
rewriter->commitReturning(r_rtn); rewriter->commitReturning(r_rtn);
} }
return r; return r;
} else if (obj->cls == unicode_cls) {
PyUnicodeObject* unicode_obj = reinterpret_cast<PyUnicodeObject*>(obj);
bool r = (unicode_obj->length != 0);
if (rewriter.get()) {
RewriterVar* r_rtn
= r_obj->getAttr(offsetof(PyUnicodeObject, length))->toBool(rewriter->getReturnDestination());
rewriter->commitReturning(r_rtn);
}
return r;
} }
// TODO: rewrite these. // TODO: rewrite these.
......
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