Sat, 05 Oct 2019 09:01:25 -0400 rust-cpython: remove useless PyRefMut wrapper
Yuya Nishihara <yuya@tcha.org> [Sat, 05 Oct 2019 09:01:25 -0400] rev 43429
rust-cpython: remove useless PyRefMut wrapper
Sat, 05 Oct 2019 08:59:09 -0400 rust-cpython: drop manual management of mutably_borrowed
Yuya Nishihara <yuya@tcha.org> [Sat, 05 Oct 2019 08:59:09 -0400] rev 43428
rust-cpython: drop manual management of mutably_borrowed RefCell::borrow() should guarantee there's no mutable borrow. As a follow up, maybe PySharedState can be a pure data structure + function. Most ref-sharing business has already been moved to PySharedRef* and PyLeaked*.
Sat, 05 Oct 2019 08:56:15 -0400 rust-cpython: leverage RefCell::borrow() to guarantee there's no mutable ref
Yuya Nishihara <yuya@tcha.org> [Sat, 05 Oct 2019 08:56:15 -0400] rev 43427
rust-cpython: leverage RefCell::borrow() to guarantee there's no mutable ref Since the underlying value can't be mutably borrowed by PyLeaked, we don't have to manage yet another mutably-borrowed state. We can just rely on the RefCell implementation. Maybe we can add try_leak_immutable(), but this patch doesn't in order to keep the patch series not too long.
Sat, 12 Oct 2019 20:48:30 +0900 rust-cpython: remove useless Option<$leaked> from py_shared_iterator
Yuya Nishihara <yuya@tcha.org> [Sat, 12 Oct 2019 20:48:30 +0900] rev 43426
rust-cpython: remove useless Option<$leaked> from py_shared_iterator We no longer need to carefully drop the iterator when it's consumed. Mutation is allowed even if the iterator exists. There's a minor behavior change: next(iter) may return/raise something other than StopIteration if it's called after the iterator has been fully consumed, and if the Rust object isn't a FusedIterator.
Sat, 12 Oct 2019 20:26:38 +0900 rust-cpython: allow mutation unless leaked reference is borrowed
Yuya Nishihara <yuya@tcha.org> [Sat, 12 Oct 2019 20:26:38 +0900] rev 43425
rust-cpython: allow mutation unless leaked reference is borrowed In other words, mutation is allowed while a Python iterator holding PyLeaked exists. The iterator will be invalidated instead. We still need a borrow_count to prevent mutation while leaked data is dereferenced in Rust world, but most leak_count business is superseded by the generation counter. decrease_leak_count(py, true) will be removed soon.
Sat, 05 Oct 2019 08:27:57 -0400 rust-cpython: add generation counter to leaked reference
Yuya Nishihara <yuya@tcha.org> [Sat, 05 Oct 2019 08:27:57 -0400] rev 43424
rust-cpython: add generation counter to leaked reference This counter increments on borrow_mut() to invalidate existing leaked references. This is modeled after the iterator invalidation in Python. The other checks will be adjusted by the subsequent patches.
Sat, 12 Oct 2019 19:26:23 +0900 rust-cpython: add stub wrapper that'll prevent leaked data from being mutated
Yuya Nishihara <yuya@tcha.org> [Sat, 12 Oct 2019 19:26:23 +0900] rev 43423
rust-cpython: add stub wrapper that'll prevent leaked data from being mutated In order to allow mutation of PySharedRefCell value while PyLeaked reference exists, we need yet another "borrow" scope where mutation is prohibited. try_borrow<'a> and try_borrow_mut<'a> defines the "borrow" scope <'a>. The subsequent patches will implement leak counter based on this scope. PyLeakedRef<T> and PyLeakedRefMut<T> could be unified to PyLeakedRef<&T> and PyLeakedRef<&mut T> respectively, but I didn't do that since it seemed a bit weird that deref_mut() would return a mutable reference to an immutable reference.
Sat, 12 Oct 2019 19:10:51 +0900 rust-cpython: rename PyLeakedRef to PyLeaked
Yuya Nishihara <yuya@tcha.org> [Sat, 12 Oct 2019 19:10:51 +0900] rev 43422
rust-cpython: rename PyLeakedRef to PyLeaked This series will make PyLeaked* behave more like a Python iterator, which means mutation of the owner object will be allowed and the leaked reference (i.e. the iterator) will be invalidated instead. I'll add PyLeakedRef/PyLeakedRefMut structs which will represent a "borrowed" state, and prevent the underlying value from being mutably borrowed while the leaked reference is in use: let shared = self.inner_shared(py); let leaked = shared.leak_immutable(); { let leaked_ref: PyLeakedRef<_> = leaked.borrow(py); shared.borrow_mut(); // panics since the underlying value is borrowed } shared.borrow_mut(); // allowed The relation between PyLeaked* structs is quite similar to RefCell/Ref/RefMut, but the implementation can't be reused because the borrowing state will have to be shared across objects having no lifetime relation. PyLeaked isn't named as PyLeakedCell since it isn't actually a cell in that leaked.borrow_mut() will require &mut self.
Tue, 05 Nov 2019 08:42:42 -0800 py3: don't use bytes with vars() or __dict__ stable
Martin von Zweigbergk <martinvonz@google.com> [Tue, 05 Nov 2019 08:42:42 -0800] rev 43421
py3: don't use bytes with vars() or __dict__ Inspired by D7227. These were all the remaining instances I could find. Differential Revision: https://phab.mercurial-scm.org/D7230
Tue, 05 Nov 2019 12:10:38 -0500 Added signature for changeset ca3dca416f8d stable
Augie Fackler <raf@durin42.com> [Tue, 05 Nov 2019 12:10:38 -0500] rev 43420
Added signature for changeset ca3dca416f8d
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 tip