This is an archive of the discontinued Mercurial Phabricator instance.

rust-cpython: using the new bindings from Python
ClosedPublic

Authored by gracinet on Dec 15 2018, 6:42 AM.

Details

Summary

The Python callers detect if we have cpython or
direct-ffi bindings and fallback to the Python
implementation if none is present.

This intermediate state allows to compare the
three possibilities.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gracinet created this revision.Dec 15 2018, 6:42 AM
yuja added a subscriber: yuja.Dec 15 2018, 11:46 PM

+try:
+ from . import rustext
+except ImportError:
+ rustext = None

Need to access to e.g. rustext.doc to trigger ImportError here.

yuja added a comment.Dec 23 2018, 11:57 PM

+try:
+ from . import rustext

Touch e.g. rustext.doc here to get around the lazy importer.

@yuja about the lazy importer, and just to clarify: so you're saying it's not worth it to delay until rustext is actually used. I'm fine with that, will do it.
I didn't amend that patch yet, but you might have received notifications due to evolve of the whole stack.

gracinet updated this revision to Diff 13008.Jan 4 2019, 1:30 PM
This revision was automatically updated to reflect the committed changes.