summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁrni Dagur <agudmundsson@fc-md.umd.edu>2020-04-05 03:59:39 -0400
committerÁrni Dagur <agudmundsson@fc-md.umd.edu>2020-04-05 03:59:39 -0400
commit5b1284cbb56963315c6576b39c7e1329fc9954e8 (patch)
treec4a28340752424cb6f4be5733c77e47d705d53ef
parentd697bf7ee74e0e3dc476c176a392269530ff6c74 (diff)
Bugfix: Allow overwriting existing file in 'serialize_to_file'
-rw-r--r--Cargo.toml2
-rw-r--r--pyproject.toml2
-rw-r--r--src/lib.rs3
3 files changed, 4 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 8ed386a..13cea47 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "adblock" 2name = "adblock"
3publish = false 3publish = false
4version = "0.1.1" 4version = "0.1.2"
5authors = ["Árni Dagur <arni@dagur.eu"] 5authors = ["Árni Dagur <arni@dagur.eu"]
6edition = "2018" 6edition = "2018"
7 7
diff --git a/pyproject.toml b/pyproject.toml
index b7e1d33..f629403 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
1[tool.poetry] 1[tool.poetry]
2name = "adblock" 2name = "adblock"
3version = "0.1.1" 3version = "0.1.2"
4description = "Brave's adblocking in Python" 4description = "Brave's adblocking in Python"
5authors = ["Árni Dagur <arni@dagur.eu>"] 5authors = ["Árni Dagur <arni@dagur.eu>"]
6license = "Apache-2.0" 6license = "Apache-2.0"
diff --git a/src/lib.rs b/src/lib.rs
index 46274a9..35d8519 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -199,7 +199,8 @@ impl Engine {
199 199
200 pub fn serialize_to_file(&mut self, file: &str) -> PyResult<()> { 200 pub fn serialize_to_file(&mut self, file: &str) -> PyResult<()> {
201 let mut fd = fs::OpenOptions::new() 201 let mut fd = fs::OpenOptions::new()
202 .create_new(true) 202 .create(true)
203 .truncate(true)
203 .write(true) 204 .write(true)
204 .open(file)?; 205 .open(file)?;
205 let data = self.serialize()?; 206 let data = self.serialize()?;