Commit cda695f8 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge commit 'c5b144' into refcounting

parents b843cdb9 c5b14490
...@@ -355,13 +355,13 @@ extern "C" Box* ord(Box* obj) { ...@@ -355,13 +355,13 @@ extern "C" Box* ord(Box* obj) {
size = PyString_GET_SIZE(obj); size = PyString_GET_SIZE(obj);
if (size == 1) { if (size == 1) {
ord = (long)((unsigned char)*PyString_AS_STRING(obj)); ord = (long)((unsigned char)*PyString_AS_STRING(obj));
return new BoxedInt(ord); return boxInt(ord);
} }
} else if (PyByteArray_Check(obj)) { } else if (PyByteArray_Check(obj)) {
size = PyByteArray_GET_SIZE(obj); size = PyByteArray_GET_SIZE(obj);
if (size == 1) { if (size == 1) {
ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj)); ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj));
return new BoxedInt(ord); return boxInt(ord);
} }
#ifdef Py_USING_UNICODE #ifdef Py_USING_UNICODE
...@@ -369,7 +369,7 @@ extern "C" Box* ord(Box* obj) { ...@@ -369,7 +369,7 @@ extern "C" Box* ord(Box* obj) {
size = PyUnicode_GET_SIZE(obj); size = PyUnicode_GET_SIZE(obj);
if (size == 1) { if (size == 1) {
ord = (long)*PyUnicode_AS_UNICODE(obj); ord = (long)*PyUnicode_AS_UNICODE(obj);
return new BoxedInt(ord); return boxInt(ord);
} }
#endif #endif
} else { } else {
......
...@@ -771,7 +771,7 @@ Box* longInt(Box* v) { ...@@ -771,7 +771,7 @@ Box* longInt(Box* v) {
mpz_init_set(rtn->n, ((BoxedLong*)v)->n); mpz_init_set(rtn->n, ((BoxedLong*)v)->n);
return rtn; return rtn;
} else } else
return new BoxedInt(n); return boxInt(n);
} }
Box* longToLong(Box* self) { Box* longToLong(Box* self) {
......
...@@ -3132,7 +3132,7 @@ int64_t hashUnboxed(Box* obj) { ...@@ -3132,7 +3132,7 @@ int64_t hashUnboxed(Box* obj) {
extern "C" BoxedInt* hash(Box* obj) { extern "C" BoxedInt* hash(Box* obj) {
int64_t r = hashUnboxed(obj); int64_t r = hashUnboxed(obj);
return new BoxedInt(r); return (BoxedInt*)boxInt(r);
} }
template <ExceptionStyle S, Rewritable rewritable> template <ExceptionStyle S, Rewritable rewritable>
......
...@@ -479,7 +479,7 @@ BORROWED(Box*) BoxedModule::getUnicodeConstant(llvm::StringRef ast_str) { ...@@ -479,7 +479,7 @@ BORROWED(Box*) BoxedModule::getUnicodeConstant(llvm::StringRef ast_str) {
BORROWED(BoxedInt*) BoxedModule::getIntConstant(int64_t n) { BORROWED(BoxedInt*) BoxedModule::getIntConstant(int64_t n) {
BoxedInt*& r = int_constants[n]; BoxedInt*& r = int_constants[n];
if (!r) if (!r)
r = new BoxedInt(n); r = (BoxedInt*)boxInt(n);
return r; return r;
} }
......
# while I think nothing requires that this works I actually found this in a library...
import subprocess
def f():
res = subprocess.Popen(["true"], stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
stdout = res.communicate()[0]
res.wait()
if res.returncode is not 0:
raise ValueError
f()
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