##// END OF EJS Templates
rust-pyo3: simplified API to get core Index references...
rust-pyo3: simplified API to get core Index references Given the amount of conversion and arcane internal detail, it is easier for the caller and makes a better separation of concerns to just introduce a new unsafe helper. It is actually possible that it would be safe, and we can decide about that later. Actually the reason given in the `cpython` crate for unsafety of the `try_borrow()` method is the following: ``` // try_borrow() and try_borrow_mut() are unsafe because self.data may // have a function returning the inner &'static reference. // If T is &'static U, its lifetime can be easily coerced to &'a U, but // how could we do that for Whatever<'static> in general? ``` Given that we coerce the Index reference to the GIL lifetime and that it is unlikely that the inner data would contain a function returning the a `'static` reference, it is possible that it is actually even safe.
Georges Racinet -
r53311:23370710 default
Show More
Name Size Modified Last Commit Author
/ mercurial / helptext / internals
__init__.py Loading ...
bid-merge.txt Loading ...
bundle2.txt Loading ...
bundles.txt Loading ...
cbor.txt Loading ...
censor.txt Loading ...
changegroups.txt Loading ...
config.txt Loading ...
dirstate-v2.txt Loading ...
extensions.txt Loading ...
linelog.txt Loading ...
mergestate.txt Loading ...
requirements.txt Loading ...
revlogs.txt Loading ...
wireprotocol.txt Loading ...
wireprotocolrpc.txt Loading ...
wireprotocolv2.txt Loading ...