##// END OF EJS Templates
rust-cpython: mark all PyLeaked methods as unsafe...
rust-cpython: mark all PyLeaked methods as unsafe Unfortunately, these methods can be abused to obtain the inner 'static reference. The simplest (pseudo-code) example is: let leaked: PyLeaked<&'static _> = shared.leak_immutable(); let static_ref: &'static _ = &*leaked.try_borrow(py)?; // PyLeakedRef::deref() tries to bound the lifetime to itself, but // the underlying data is a &'static reference, so the returned // reference can be &'static. This problem can be easily fixed by coercing the lifetime, but there are many other ways to achieve that, and there wouldn't be a generic solution: let leaked: PyLeaked<&'static [_]> = shared.leak_immutable(); let leaked_iter: PyLeaked<slice::Iter<'static, _>> = unsafe { leaked.map(|v| v.iter()) }; let static_slice: &'static [_] = leaked_iter.try_borrow(py)?.as_slice(); So basically I failed to design the safe borrowing interface. Maybe we'll instead have to add much more restricted interface on top of the unsafe PyLeaked methods? For instance, Iterator::next() could be implemented if its Item type is not &'a (where 'a may be cheated.) Anyway, this seems not an easy issue, so it's probably better to leave the current interface as unsafe, and get broader comments while upstreaming this feature.

File last commit:

r44488:b084ad48 default
r44689:e960c30d default
Show More
ubuntu.template
17 lines | 316 B | text/plain | TextLexer
Gregory Szorc
packaging: don't write files for templatized Dockerfiles...
r38477 FROM ubuntu:%CODENAME%
Gregory Szorc
packaging: consistently create build user in Dockerfiles...
r38475
RUN groupadd -g 1000 build && \
useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
Gregory Szorc
packaging: move most of contrib/docker to contrib/packaging/docker...
r38023 RUN apt-get update && apt-get install -y \
build-essential \
debhelper \
devscripts \
dh-python \
less \
python \
Connor Sheehan
packaging: update Ubuntu docker build dependencies to Python 3...
r44488 python3-all \
python3-all-dev \
python3-docutils \
Gregory Szorc
packaging: move most of contrib/docker to contrib/packaging/docker...
r38023 unzip \
zip