Enable PYINPUT Processing Through Common Python Interpreter#5029
Enable PYINPUT Processing Through Common Python Interpreter#5029bska merged 1 commit intoOPM:masterfrom
Conversation
|
jenkins build this please |
bcae485 to
2762637
Compare
|
jenkins build this please |
2762637 to
d2859e1
Compare
|
jenkins build this please |
d2859e1 to
b4b9e9c
Compare
This commit allows client code to use a single Python interpreter for all input parsing operations. Having an independent interpreter as part of the internal ParserState class means we run the risk of failing to initialise that interpreter if the calling code has already created a separate interpreter object. That, in turn, means that the ability to parse PYINPUT is generally dependent on the client code's environment so we need a way to inform the parser of that environment. The default remains that the Parser creates an independent interpreter object.
b4b9e9c to
19f329d
Compare
|
jenkins build this please |
akva2
left a comment
There was a problem hiding this comment.
LGTM. I do slightly feel like it would be more consistent to just flat out require a pre-created interpreter when support is enabled, but it would of course break existing code.
I agree, and I think we could even take it one step further and to have a system-wide singleton for the Python interpreter instead of passing it as an argument into functions/constructors. Given that there must be exactly one interpreter for the entire process I think a singleton makes a certain amount of sense for that. That's a (much) bigger change, however, so I'll do that as follow-up work if we decide to do it at all. For now I'll merge this since the PR's approved and build check is green. |
This PR allows client code to use a single
Pythoninterpreter for all input parsing operations. Having an independent interpreter as part of the internalParserStateclass means we run the risk of failing to initialise that interpreter if the calling code has already created a separate interpreter object. That, in turn, means that the ability to parsePYINPUTis generally dependent on the client code's environment so we need a way to inform the parser of that environment.The default remains that the
Parsercreates an independent interpreter object.