This is an archive of the discontinued Mercurial Phabricator instance.

rust-python3: compatibility fix for incoming PyLong
ClosedPublic

Authored by gracinet on May 17 2019, 7:42 AM.

Details

Summary

On Python3, PyInt is PyLong and it doesn't have the
value() method.
Re upcasting to PythonObj as done here works, but we
might prefer taking a PythonObj from the onset
(would require more testing)

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.May 17 2019, 7:42 AM
yuja added a subscriber: yuja.May 17 2019, 11:25 PM

@@ -153,7 +153,7 @@

&dirstate_vec?,
&copies?,
DirstateParents { p1, p2 },
  • now.value(py) as i32,

+ now.into_object().extract::<i32>(py)?,

Minor thing, but I think as_object() is preferred since it isn't needed
to consume the now value to extract.

gracinet updated this revision to Diff 15207.May 21 2019, 1:58 PM

@yuja yes indeed, just resubmitted with as_object(), thanks

Actually the first variant I tried was with it but I must have botched it, because it didn't compile.

D6415 is also necessary to actually build with python3

This revision was automatically updated to reflect the committed changes.