From cc2e97c436390c909196a45af44efe0ca9688077 Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Fri, 15 May 2020 10:34:23 +0300 Subject: [PATCH] Mark PyPattern, PyMatch as ThreadSafe --- vm/src/stdlib/re.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vm/src/stdlib/re.rs b/vm/src/stdlib/re.rs index d819c8609..b99455b58 100644 --- a/vm/src/stdlib/re.rs +++ b/vm/src/stdlib/re.rs @@ -13,7 +13,7 @@ use crate::function::{Args, OptionalArg}; use crate::obj::objint::{PyInt, PyIntRef}; use crate::obj::objstr::{PyString, PyStringRef}; use crate::obj::objtype::PyClassRef; -use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue, TryFromObject}; +use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue, ThreadSafe, TryFromObject}; use crate::vm::VirtualMachine; #[pyclass(name = "Pattern")] @@ -23,6 +23,8 @@ struct PyPattern { pattern: String, } +impl ThreadSafe for PyPattern {} + const IGNORECASE: usize = 2; const LOCALE: usize = 4; const MULTILINE: usize = 8; @@ -75,6 +77,8 @@ struct PyMatch { captures: Vec>, } +impl ThreadSafe for PyMatch {} + impl fmt::Debug for PyMatch { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Match()")