changeset 42378:48df8a06c8bb

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
author Georges Racinet <georges.racinet@octobus.net>
date Thu, 16 May 2019 21:22:29 +0200
parents 9166935da31f
children 5b795108dd17
files rust/hg-cpython/src/dirstate.rs
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate.rs	Tue May 21 04:30:56 2019 +0530
+++ b/rust/hg-cpython/src/dirstate.rs	Thu May 16 21:22:29 2019 +0200
@@ -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 @@
         &dirstate_vec?,
         &copies?,
         DirstateParents { p1, p2 },
-        now.value(py) as i32,
+        now.as_object().extract::<i32>(py)?,
     ) {
         Ok((packed, new_dirstate_vec)) => {
             for (