py: modify object struct to empty#22
Conversation
Summary of ChangesHello @toaction, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the definition of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request modifies the py.Object struct to be an empty struct by removing the Unused field. This is a good change as it makes py.Object an opaque type, which is idiomatic in Go for representing C pointers like PyObject*. The change correctly reflects that *Object is used as a handle to a Python object managed by the C runtime, and its Go definition does not need to match the C layout. The change is clean and has no apparent side effects based on the usage in the provided files.
Review SummaryThis change is functionally safe with no security, performance, or compatibility issues. The empty struct correctly represents an opaque handle to Python's One noteworthy observation: The codebase predominantly uses |
fc65464 to
2155307
Compare
Overview
This PR changes the
py.Objectstructure definition to an empty structure. which clarifies that LLGo treats Python objects managed by the C runtime as references, rather than storing the specific memory address of Python object in actual structure field.This definition change supports multiple inheritance via structure embedding in LLGo. The design can be found at goplus/llpyg#21, and the implementation can be found at xgo-dev/llgo#1289.
Major Changes
source code:
target code:
Changing the field size to 0 is more clear than deleting the field and is consistent with the established pattern of the warehouse, such as
c/os/dir.go: