# HG changeset patch # User Georges Racinet # Date 2019-05-16 19:22:29 # Node ID 48df8a06c8bbcd9eba42543a92ddbb987bb0b3fd # Parent 9166935da31f4a76f8fa10972d139e3bbd223bff rust-python3: compatibility fix for incoming PyLong 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) Differential Revision: https://phab.mercurial-scm.org/D6397 diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs --- a/rust/hg-cpython/src/dirstate.rs +++ b/rust/hg-cpython/src/dirstate.rs @@ -12,7 +12,7 @@ use cpython::{ exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyObject, PyResult, - PySequence, PyTuple, Python, ToPyObject, + PySequence, PythonObject, PyTuple, Python, ToPyObject, }; use hg::{ pack_dirstate, parse_dirstate, CopyVecEntry, DirstateEntry, @@ -153,7 +153,7 @@ fn pack_dirstate_wrapper( &dirstate_vec?, &copies?, DirstateParents { p1, p2 }, - now.value(py) as i32, + now.as_object().extract::(py)?, ) { Ok((packed, new_dirstate_vec)) => { for (