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

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


The following commit(s) were added to refs/heads/PG13 by this push:
     new 5f749a58 Optimised Antlr4ResultHandler initialization (#1168)
5f749a58 is described below

commit 5f749a5890709ce6981935a9c4b4ba6a48c355a8
Author: Moontasir Mahmood <[email protected]>
AuthorDate: Tue Aug 22 04:07:13 2023 +0600

    Optimised Antlr4ResultHandler initialization (#1168)
---
 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..44bcee9d 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