summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-07-31 19:54:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-07-31 19:54:18 (GMT)
commitc27cd71cd71e5b3f464f6994e2a73f201eb430ca (patch)
treeb973bb782096772fc8a38a0c3bd534acc867c10a /Modules
parent5c30a75722f1fb42f4e49dcc5dd30d90d7717086 (diff)
parentc91d5eea106d191e931f953bdbdb1db25e051767 (diff)
downloadcpython-c27cd71cd71e5b3f464f6994e2a73f201eb430ca.zip
cpython-c27cd71cd71e5b3f464f6994e2a73f201eb430ca.tar.gz
cpython-c27cd71cd71e5b3f464f6994e2a73f201eb430ca.tar.bz2
Merge
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/iobase.c4
-rw-r--r--Modules/_sha3/sha3module.c4
-rw-r--r--Modules/_testcapimodule.c11
3 files changed, 16 insertions, 3 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index a4f2c0e..ae188dd 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -210,8 +210,10 @@ iobase_finalize(PyObject *self)
/* If `closed` doesn't exist or can't be evaluated as bool, then the
object is probably in an unusable state, so ignore. */
res = PyObject_GetAttr(self, _PyIO_str_closed);
- if (res == NULL)
+ if (res == NULL) {
PyErr_Clear();
+ closed = -1;
+ }
else {
closed = PyObject_IsTrue(res);
Py_DECREF(res);
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index 32cd85a..4e6352b 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -322,7 +322,7 @@ SHA3_update(SHA3object *self, PyObject *args)
GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
/* add new data, the function takes the length in bits not bytes */
-#ifdef WITH_THREADS
+#ifdef WITH_THREAD
if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) {
self->lock = PyThread_allocate_lock();
}
@@ -464,7 +464,7 @@ SHA3_factory(PyObject *args, PyObject *kwdict, const char *fmt,
}
if (data_obj) {
-#ifdef WITH_THREADS
+#ifdef WITH_THREAD
if (buf.len >= HASHLIB_GIL_MINSIZE) {
/* invariant: New objects can't be accessed by other code yet,
* thus it's safe to release the GIL without locking the object.
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 6527a53..1ed5687 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2614,6 +2614,16 @@ test_decref_doesnt_leak(PyObject *ob)
}
static PyObject *
+test_incref_decref_API(PyObject *ob)
+{
+ PyObject *obj = PyLong_FromLong(0);
+ Py_IncRef(ob);
+ Py_DecRef(obj);
+ Py_DecRef(obj);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
test_pymem_alloc0(PyObject *self)
{
void *ptr;
@@ -2781,6 +2791,7 @@ static PyMethodDef TestMethods[] = {
{"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS},
{"test_xdecref_doesnt_leak",(PyCFunction)test_xdecref_doesnt_leak, METH_NOARGS},
{"test_decref_doesnt_leak", (PyCFunction)test_decref_doesnt_leak, METH_NOARGS},
+ {"test_incref_decref_API", (PyCFunction)test_incref_decref_API, METH_NOARGS},
{"test_long_and_overflow", (PyCFunction)test_long_and_overflow,
METH_NOARGS},
{"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS},