Skip to content

Enable PYINPUT Processing Through Common Python Interpreter#5029

Merged
bska merged 1 commit intoOPM:masterfrom
bska:pyinput-common-interpreter
Mar 4, 2026
Merged

Enable PYINPUT Processing Through Common Python Interpreter#5029
bska merged 1 commit intoOPM:masterfrom
bska:pyinput-common-interpreter

Conversation

@bska
Copy link
Copy Markdown
Member

@bska bska commented Feb 26, 2026

This PR 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.

@bska bska added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Feb 26, 2026
@bska
Copy link
Copy Markdown
Member Author

bska commented Feb 26, 2026

jenkins build this please

@bska
Copy link
Copy Markdown
Member Author

bska commented Feb 27, 2026

jenkins build this please

@bska bska force-pushed the pyinput-common-interpreter branch from 2762637 to d2859e1 Compare March 2, 2026 15:09
@bska
Copy link
Copy Markdown
Member Author

bska commented Mar 2, 2026

jenkins build this please

@bska bska force-pushed the pyinput-common-interpreter branch from d2859e1 to b4b9e9c Compare March 3, 2026 09:27
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.
@bska bska force-pushed the pyinput-common-interpreter branch from b4b9e9c to 19f329d Compare March 3, 2026 12:19
@bska
Copy link
Copy Markdown
Member Author

bska commented Mar 3, 2026

jenkins build this please

Copy link
Copy Markdown
Member

@akva2 akva2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bska
Copy link
Copy Markdown
Member Author

bska commented Mar 4, 2026

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.

@bska bska merged commit e6522de into OPM:master Mar 4, 2026
2 checks passed
@bska bska deleted the pyinput-common-interpreter branch March 4, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants