summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2019-03-08 10:53:45 +0200
committerOmer Katz <omer.drow@gmail.com>2019-03-08 10:53:45 +0200
commitf455ff6a69a7759ef36f0e82d6f83bac731f29ab (patch)
tree24a164246481ef4094e8063676bffa6056588199
parentf6f921326acf52eef5671ffedff764ba25146b2b (diff)
downloadpy-amqp-rust-serialization.tar.gz
Create list with capacity.rust-serialization
-rw-r--r--Cargo.lock18
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs11
3 files changed, 15 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7a5a8f3..6d4db34 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14,7 +14,7 @@ version = "0.1.0"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pyo3 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)",
+ "pyo3 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)",
]
[[package]]
@@ -123,13 +123,13 @@ dependencies = [
[[package]]
name = "pyo3"
version = "0.6.0-alpha.4"
-source = "git+https://github.com/thedrow/pyo3?branch=list-with-capacity#aae9cf44bf700d6fcf4ea18bdb5e2cf3c7b8999c"
+source = "git+https://github.com/PyO3/pyo3#d63fac8d1cbdc3dcf4eefbbb871b3a6eb031a1b3"
dependencies = [
"inventory 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)",
"mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "pyo3cls 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)",
+ "pyo3cls 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -138,7 +138,7 @@ dependencies = [
[[package]]
name = "pyo3-derive-backend"
version = "0.6.0-alpha.4"
-source = "git+https://github.com/thedrow/pyo3?branch=list-with-capacity#aae9cf44bf700d6fcf4ea18bdb5e2cf3c7b8999c"
+source = "git+https://github.com/PyO3/pyo3#d63fac8d1cbdc3dcf4eefbbb871b3a6eb031a1b3"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -148,10 +148,10 @@ dependencies = [
[[package]]
name = "pyo3cls"
version = "0.6.0-alpha.4"
-source = "git+https://github.com/thedrow/pyo3?branch=list-with-capacity#aae9cf44bf700d6fcf4ea18bdb5e2cf3c7b8999c"
+source = "git+https://github.com/PyO3/pyo3#d63fac8d1cbdc3dcf4eefbbb871b3a6eb031a1b3"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
- "pyo3-derive-backend 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)",
+ "pyo3-derive-backend 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -243,9 +243,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8"
"checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
-"checksum pyo3 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)" = "<none>"
-"checksum pyo3-derive-backend 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)" = "<none>"
-"checksum pyo3cls 0.6.0-alpha.4 (git+https://github.com/thedrow/pyo3?branch=list-with-capacity)" = "<none>"
+"checksum pyo3 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)" = "<none>"
+"checksum pyo3-derive-backend 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)" = "<none>"
+"checksum pyo3cls 0.6.0-alpha.4 (git+https://github.com/PyO3/pyo3)" = "<none>"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861"
diff --git a/Cargo.toml b/Cargo.toml
index 60e6072..650a784 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,6 @@ crate-type = ["cdylib"]
[dependencies]
# pyo3 = { version = "0.6.0-alpha.4", features = ["extension-module"] }
-pyo3 = { git = "https://github.com/thedrow/pyo3", branch = "list-with-capacity", features = ["extension-module"] }
+pyo3 = { git = "https://github.com/PyO3/pyo3", branch = "master", features = ["extension-module"] }
byteorder = "1.3.1"
lazy_static = "1.3.0"
diff --git a/src/lib.rs b/src/lib.rs
index 25f66d1..4ad1e9d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,8 +11,8 @@ use pyo3::{IntoPy, Py};
use std::io::{self, Cursor, Read, Seek, SeekFrom};
use pyo3::import_exception;
-// Since this module is being currently imported we assume the GIL is acquired.
-// If it isn't, this module is the least of our problems
+// Since these modules are being currently imported we assume the GIL is acquired.
+// If they aren't, these modules is the least of our problems
lazy_static! {
static ref DATETIME_MODULE: &'static PyModule =
{ unsafe { Python::assume_gil_acquired().import("datetime").unwrap() } };
@@ -218,10 +218,9 @@ impl<'deserializer_l> AMQPDeserializer<'deserializer_l> {
}
fn deserialize(&mut self) -> PyResult<(&'deserializer_l PyList, u64)> {
- // TODO: Figure out why
- // let values = PyList::with_capacity(*self.py, self.format.len());
- // crashes
- let values = PyList::empty(*self.py);
+ let none = &self.py.None();
+ let initial = vec![none; self.format.len()];
+ let values = PyList::new(*self.py, initial);
for p in self.format.chars() {
match p {