You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/01/13 17:10:20 UTC

[superset] 09/09: fix(timepicker): make pyparsing thread safe (#12489)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 4f35234f3e31e7879b3e83faac385c30e3ba93a7
Author: Yongjie Zhao <yo...@gmail.com>
AuthorDate: Wed Jan 13 23:25:58 2021 +0800

    fix(timepicker): make pyparsing thread safe (#12489)
    
    * fix: make pyparsing thread safe
    
    * remove parenthesis for decorator
---
 superset/utils/date_parser.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/superset/utils/date_parser.py b/superset/utils/date_parser.py
index aee2c83..bd979f3 100644
--- a/superset/utils/date_parser.py
+++ b/superset/utils/date_parser.py
@@ -32,6 +32,7 @@ from pyparsing import (
     Group,
     Optional as ppOptional,
     ParseException,
+    ParserElement,
     ParseResults,
     pyparsing_common,
     quotedString,
@@ -40,6 +41,8 @@ from pyparsing import (
 
 from .core import memoized
 
+ParserElement.enablePackrat()
+
 logger = logging.getLogger(__name__)
 
 
@@ -375,7 +378,7 @@ class EvalHolidayFunc:  # pylint: disable=too-few-public-methods
         raise ValueError(_("Unable to find such a holiday: [{}]").format(holiday))
 
 
-@memoized()
+@memoized
 def datetime_parser() -> ParseResults:  # pylint: disable=too-many-locals
     (  # pylint: disable=invalid-name
         DATETIME,