This is an automated email from the ASF dual-hosted git repository.
dehowef pushed a commit to branch PG14
in repository https://gitbox.apache.org/repos/asf/age.git
The following commit(s) were added to refs/heads/PG14 by this push:
new b3161491 Optimised Antlr4ResultHandler initialization (#1169)
b3161491 is described below
commit b316149152a4f7bd58696c7e0781ab4300080c2e
Author: Moontasir Mahmood <[email protected]>
AuthorDate: Tue Aug 22 04:04:15 2023 +0600
Optimised Antlr4ResultHandler initialization (#1169)
---
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: