Skip to content

Commit 3c8eebc

Browse files
authored
[Python] Fix self move to pyobject_file (cppfastio#1170)
* unfinshed overhual of c's fwrite/fread etc * done * self-reference for pyobject_file
1 parent 7b537e3 commit 3c8eebc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/fast_io_driver/python/pyobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class pyobject_file : public pyobject_io_observer
141141
}
142142
pyobject_file &operator=(pyobject_file &&pob) noexcept
143143
{
144+
if (__builtin_addressof(pob) == this)
145+
{
146+
return *this;
147+
}
144148
::fast_io::details::py_inc_dec_ref_impl<true>(this->p);
145149
this->p = pob.p;
146150
pob.p = nullptr;

0 commit comments

Comments
 (0)