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

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


The following commit(s) were added to refs/heads/PG12 by this push:
     new 7a40d629 Optimised Antlr4ResultHandler initialization (#1167)
7a40d629 is described below

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

    Optimised Antlr4ResultHandler initialization (#1167)
---
 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