Mercurial > public > mercurial-scm > hg-stable
annotate rust/hg-cpython/src/utils.rs @ 44156:7f5410dfc8a6 stable 5.3
rust-dirstatemap: add missing @propertycache
While investigating a regression on `hg update` performance introduced by the
Rust `dirstatemap`, two missing `@propertycache` were identified when comparing
against the Python implementation. This adds back the first one, that has
no observable impact on behavior. The second one (`nonnormalset`) is going to
be more involved, as the caching has to be done from the Rust side of things.
Differential Revision: https://phab.mercurial-scm.org/D8047
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Wed, 29 Jan 2020 11:11:18 +0100 |
parents | 970978975574 |
children | d738b7a18438 |
rev | line source |
---|---|
43251
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
1 use cpython::{PyDict, PyObject, PyResult, PyTuple, Python}; |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
2 |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
3 #[allow(unused)] |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
4 pub fn print_python_trace(py: Python) -> PyResult<PyObject> { |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
5 eprintln!("==============================="); |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
6 eprintln!("Printing Python stack from Rust"); |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
7 eprintln!("==============================="); |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
8 let traceback = py.import("traceback")?; |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
9 let sys = py.import("sys")?; |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
10 let kwargs = PyDict::new(py); |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
11 kwargs.set_item(py, "file", sys.get(py, "stderr")?)?; |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
12 traceback.call(py, "print_stack", PyTuple::new(py, &[]), Some(&kwargs)) |
970978975574
rust-utils: introduce a debug util to print the python stack trace
Rapha?l Gom?s <rgomes@octobus.net>
parents:
diff
changeset
|
13 } |