Skip to content

gh-111903: Update AC to support "pycore_critical_section.h" header #112251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 19, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Nov 18, 2023

@corona10
Copy link
Member Author

@colesbury IMO, we don't have to declare #include "pycore_critical_section.h" for AC things.

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

Nice! LGTM

@@ -6,6 +6,7 @@ preserve
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
Copy link
Member

Choose a reason for hiding this comment

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

The formatting isn't great here: it would be nice if the generated code had at least one space (preferably two) before each inline comment

Copy link
Member

@AlexWaygood AlexWaygood Nov 19, 2023

Choose a reason for hiding this comment

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

(This can be dealt with in a followup PR, though, if you'd prefer to merge this one quickly :)

Copy link
Member Author

@corona10 corona10 Nov 19, 2023

Choose a reason for hiding this comment

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

IMO, It will affect the overall generated code formatting since we have to touch

cpython/Tools/clinic/clinic.py

Lines 2347 to 2350 in 1a969b4

if include.reason:
comment = f'// {include.reason}\n'
line = line.ljust(INCLUDE_COMMENT_COLUMN - 1) + comment
output += line

So, let's handle it as a separate PR, @AlexWaygood would you like to touch it?
(Easy way might just updating INCLUDE_COMMENT_COLUMN but there might be smarter policy rather than fixed policy)

Copy link
Member Author

Choose a reason for hiding this comment

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

Simply updating INCLUDE_COMMENT_COLUMN to 38 will resolve this issue.
But IMO, this value should be adaptively chosen.

Copy link
Member

@AlexWaygood AlexWaygood Nov 19, 2023

Choose a reason for hiding this comment

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

I'll try to find some time in the next few days to look at it, but can't guarantee it right now!

Anyway, I'm happy to defer this for now; it's definitely not the most important thing in the world :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants