File tree Expand file tree Collapse file tree 3 files changed +1
-10
lines changed Expand file tree Collapse file tree 3 files changed +1
-10
lines changed Original file line number Diff line number Diff line change 11# Owner(s): ["module: dynamo"]
2- import weakref
32
43import torch
54import torch ._dynamo .test_case
@@ -16,10 +15,6 @@ def setUpClass(cls):
1615 def tearDownClass (cls ):
1716 super ().tearDownClass ()
1817
19- def test_stream_weakref (self ):
20- s = torch .Stream ()
21- weakref .ref (s )
22-
2318 @requires_cuda
2419 def test_run_opcheck (self ):
2520 from torch ._dynamo .variables .streams import fork_stream , join_stream
Original file line number Diff line number Diff line change @@ -95,7 +95,6 @@ static PyObject* THPStream_pynew(
9595 self->device_index = static_cast <int64_t >(stream_opt->device_index ());
9696 self->device_type = static_cast <int64_t >(stream_opt->device_type ());
9797 self->context = nullptr ;
98- self->weakreflist = nullptr ;
9998
10099 return static_cast <PyObject*>(ptr.release ());
101100 END_HANDLE_TH_ERRORS
@@ -115,13 +114,11 @@ PyObject* THPStream_Wrap(const c10::Stream& stream) {
115114 self->device_index = static_cast <int64_t >(stream.device_index ());
116115 self->device_type = static_cast <int64_t >(stream.device_type ());
117116 self->context = nullptr ;
118- self->weakreflist = nullptr ;
119117 return ptr.release ();
120118 END_HANDLE_TH_ERRORS
121119}
122120
123121static void THPStream_dealloc (THPStream* self) {
124- PyObject_ClearWeakRefs ((PyObject*)self);
125122 Py_TYPE (self)->tp_free (reinterpret_cast <PyObject*>(self));
126123}
127124
@@ -447,7 +444,7 @@ static PyTypeObject THPStreamType = {
447444 nullptr , /* tp_traverse */
448445 nullptr , /* tp_clear */
449446 THPStream_richcompare, /* tp_richcompare */
450- offsetof (THPStream, weakreflist) , /* tp_weaklistoffset */
447+ 0 , /* tp_weaklistoffset */
451448 nullptr , /* tp_iter */
452449 nullptr , /* tp_iternext */
453450 // NOLINTNEXTLINE(*const-cast)
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ struct THPStream {
1313 int64_t device_index ;
1414 // Used to switch stream context management, initialized lazily.
1515 PyObject * context ;
16- PyObject * weakreflist ;
1716};
1817extern TORCH_API PyTypeObject * THPStreamClass ;
1918
You can’t perform that action at this time.
0 commit comments