-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-124351: Optimize Endianness Handling in ctypes Module #124355
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
gh-124351: Optimize Endianness Handling in ctypes Module #124355
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert all unrelated changes, see examples.
Please also keep just one news entry, that describe actual changes.
|
@Harikrishna-Srinivasan-1, please read https://devguide.python.org/ first. Then please address review comments. |
Code Review Comments
Global Variable Usage: The use of a global variable (
_OTHER_ENDIAN) can lead to potential issues with state management and performance, as global lookups are generally slower than local variable accesses.Redundant Checks: The
_other_endianfunction repeatedly checks the type oftyp, which can be inefficient if this function is called multiple times.List Creation Overhead: In the
__setattr__method of_swapped_meta, creating a new list for fields can introduce unnecessary overhead, especially if no modifications are made.