Patchwork [01,of,11] rust-parsers: fix unboxing of PyInt on Python 3

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 17, 2019, 12:12 p.m.
Message ID <809ab6f869baaa800f15.1566043922@mimosa>
Download mbox | patch
Permalink /patch/41323/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 17, 2019, 12:12 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1566011866 -32400
#      Sat Aug 17 12:17:46 2019 +0900
# Node ID 809ab6f869baaa800f15fd6ab4003c480bd0871f
# Parent  302e4706ab25b4d29d858f93ca2678a609e95570
rust-parsers: fix unboxing of PyInt on Python 3

Broken at 7cae6bc29ff9.

Patch

diff --git a/rust/hg-cpython/src/parsers.rs b/rust/hg-cpython/src/parsers.rs
--- a/rust/hg-cpython/src/parsers.rs
+++ b/rust/hg-cpython/src/parsers.rs
@@ -12,7 +12,7 @@ 
 //!
 use cpython::{
     exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyResult, PyTuple, Python,
-    ToPyObject,
+    PythonObject, ToPyObject,
 };
 use hg::{
     pack_dirstate, parse_dirstate, utils::copy_into_array, DirstateEntry,
@@ -123,7 +123,7 @@  fn pack_dirstate_wrapper(
             p1: copy_into_array(&p1),
             p2: copy_into_array(&p2),
         },
-        Duration::from_secs(now.value(py) as u64),
+        Duration::from_secs(now.as_object().extract::<u64>(py)?),
     ) {
         Ok(packed) => {
             for (