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

dehowef pushed a commit to branch PG11
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/PG11 by this push:
     new 439cf332 Optimised Antlr4ResultHandler initialization (#1166)
439cf332 is described below

commit 439cf3320c9c788e1771780fa70d29980c5d55fc
Author: Moontasir Mahmood <[email protected]>
AuthorDate: Tue Aug 22 04:00:13 2023 +0600

    Optimised Antlr4ResultHandler initialization (#1166)
---
 drivers/python/age/builder.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/python/age/builder.py b/drivers/python/age/builder.py
index a13de471..b6599240 100644
--- a/drivers/python/age/builder.py
+++ b/drivers/python/age/builder.py
@@ -22,6 +22,8 @@ from antlr4 import *
 from antlr4.tree.Tree import *
 from decimal import Decimal
 
+resultHandler = None
+
 class ResultHandler:
     def parse(ageData):
         pass
@@ -34,7 +36,10 @@ def parseAgeValue(value, cursor=None):
     if value is None:
         return None
 
-    resultHandler = Antlr4ResultHandler(None)
+    global resultHandler
+    if (resultHandler == None):
+        resultHandler = Antlr4ResultHandler(None)
+    
     try:
         return resultHandler.parse(value)
     except Exception as ex:

Reply via email to