GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-36876: Moved Parser/listnode.c statics to interpreter state. by vsajip · Pull Request #16328 · python/cpython Conversation
|
| /* | ||
| * See bpo-36876: miscellaneous ad hoc statics have been moved here. | ||
| */ | ||
| struct { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If you think there will be any other parser/compiler-related state to move to PyInterpreterState then consider making this struct stand-alone and perhaps even creating pycore_compiler.h (or pycore_parser.h) for it. That way the code doesn't get too cluttered.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| atbol = 1; | ||
| PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); | ||
|
|
||
| interp->parser_data.listnode_data.level = 0; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I was going to point to the advantage of having stand-alone structs for places like this (so there isn't so much going on with each line). However, I actually kind of like how the line captures the indirection clearly. :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
You can add listnode or parser variable to avoid having to write "interp->parser.listnode". But for that, you need to name the structure in pycore_pystate.h. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not quite sure what you mean. The change was specifically to move those variables into the interpreter state rather than stand-alone variables, as they were previously. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I suggest to add |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ah, OK, I understand now :-) Not sure what an additional variable buys in this case. I agree, if readability were adversely affected, it would be worth doing. As it is, it seems readable enough. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It was just a minor remark for readability. You're free to ignore it ;-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.