Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe51a1f

Browse files
committed
rollback the merge of r74524 because it causes failures in test_multiprocessing
1 parent c70614f commit fe51a1f

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

Doc/library/weakref.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ instances, functions written in Python (but not in C), instance methods, sets,
6161
frozensets, file objects, :term:`generator`\s, type objects, sockets, arrays,
6262
deques, and regular expression pattern objects.
6363

64-
.. versionchanged:: 2.7
65-
Added support for thread.lock and threading.Lock.
66-
6764
Several built-in types such as :class:`list` and :class:`dict` do not directly
6865
support weak references but can add support through subclassing::
6966

Modules/_threadmodule.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/* Interface to Sjoerd's portable C thread library */
44

55
#include "Python.h"
6-
#include "structmember.h" /* offsetof */
76

87
#ifndef WITH_THREAD
98
#error "Error! The rest of Python is not compiled with thread support."
@@ -21,15 +20,12 @@ static PyObject *ThreadError;
2120
typedef struct {
2221
PyObject_HEAD
2322
PyThread_type_lock lock_lock;
24-
PyObject *in_weakreflist;
2523
} lockobject;
2624

2725
static void
2826
lock_dealloc(lockobject *self)
2927
{
3028
assert(self->lock_lock);
31-
if (self->in_weakreflist != NULL)
32-
PyObject_ClearWeakRefs((PyObject *) self);
3329
/* Unlock the lock so it's safe to free it */
3430
PyThread_acquire_lock(self->lock_lock, 0);
3531
PyThread_release_lock(self->lock_lock);
@@ -144,12 +140,12 @@ static PyTypeObject Locktype = {
144140
0, /*tp_getattro*/
145141
0, /*tp_setattro*/
146142
0, /*tp_as_buffer*/
147-
Py_TPFLAGS_DEFAULT, /*tp_flags*/
143+
Py_TPFLAGS_DEFAULT, /*tp_flags*/
148144
0, /*tp_doc*/
149145
0, /*tp_traverse*/
150146
0, /*tp_clear*/
151147
0, /*tp_richcompare*/
152-
offsetof(lockobject, in_weakreflist), /*tp_weaklistoffset*/
148+
0, /*tp_weaklistoffset*/
153149
0, /*tp_iter*/
154150
0, /*tp_iternext*/
155151
lock_methods, /*tp_methods*/
@@ -163,7 +159,6 @@ newlockobject(void)
163159
if (self == NULL)
164160
return NULL;
165161
self->lock_lock = PyThread_allocate_lock();
166-
self->in_weakreflist = NULL;
167162
if (self->lock_lock == NULL) {
168163
PyObject_Del(self);
169164
self = NULL;

0 commit comments

Comments
 (0)