Skip to content

Writing magic method names as full name #5842

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

youknowone
Copy link
Member

@youknowone youknowone commented Jun 26, 2025

Summary by CodeRabbit

  • Refactor
    • All Python special (magic) methods and attributes have been renamed to use explicit double underscore (dunder) names (e.g., __len__, __getitem__, __name__) across built-in types, standard library modules, and exception handling.
    • Removed magic method annotation flags in favor of explicit dunder method naming, enhancing consistency with Python conventions.
    • Updated all internal and external calls to use the new dunder method names.
    • Setter methods for special attributes renamed to match dunder conventions.
    • Context manager methods (__enter__, __exit__) and other protocol methods renamed accordingly.
    • Exception handling methods and attributes now consistently use dunder names.
    • Suppression of non-snake-case warnings added automatically for setter methods.
    • Python magic method bindings in core types and modules were renamed from generic or attribute-based names to explicit dunder names for clarity and standardization.
  • Documentation
    • Removed outdated example demonstrating the use of deprecated magic attribute in documentation.
  • Style
    • Improved naming consistency and alignment with Python’s special method naming conventions.

These updates unify the Python interface naming, improve clarity, and maintain compatibility without changing functionality visible to end-users.

Copy link

coderabbitai bot commented Jun 26, 2025

Warning

Rate limit exceeded

@youknowone has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between bef21a3 and 3673372.

📒 Files selected for processing (94)
  • .cspell.dict/cpython.txt (1 hunks)
  • .cspell.dict/python-more.txt (3 hunks)
  • .cspell.dict/rust-more.txt (3 hunks)
  • .cspell.json (2 hunks)
  • common/src/str.rs (2 hunks)
  • compiler/codegen/src/compile.rs (2 hunks)
  • compiler/src/lib.rs (1 hunks)
  • derive-impl/src/pyclass.rs (9 hunks)
  • derive/src/lib.rs (0 hunks)
  • example_projects/barebone/Cargo.toml (1 hunks)
  • example_projects/frozen_stdlib/Cargo.toml (1 hunks)
  • example_projects/frozen_stdlib/src/main.rs (1 hunks)
  • examples/parse_folder.rs (1 hunks)
  • jit/tests/common.rs (1 hunks)
  • jit/tests/float_tests.rs (2 hunks)
  • src/lib.rs (1 hunks)
  • stdlib/build.rs (1 hunks)
  • stdlib/src/array.rs (13 hunks)
  • stdlib/src/contextvars.rs (3 hunks)
  • stdlib/src/gc.rs (1 hunks)
  • stdlib/src/lzma.rs (2 hunks)
  • stdlib/src/mmap.rs (21 hunks)
  • stdlib/src/pystruct.rs (1 hunks)
  • stdlib/src/select.rs (1 hunks)
  • stdlib/src/sqlite.rs (2 hunks)
  • stdlib/src/zlib.rs (1 hunks)
  • vm/src/builtins/asyncgenerator.rs (2 hunks)
  • vm/src/builtins/bool.rs (2 hunks)
  • vm/src/builtins/builtin_func.rs (3 hunks)
  • vm/src/builtins/bytearray.rs (10 hunks)
  • vm/src/builtins/bytes.rs (8 hunks)
  • vm/src/builtins/classmethod.rs (2 hunks)
  • vm/src/builtins/complex.rs (4 hunks)
  • vm/src/builtins/coroutine.rs (1 hunks)
  • vm/src/builtins/descriptor.rs (3 hunks)
  • vm/src/builtins/dict.rs (24 hunks)
  • vm/src/builtins/enumerate.rs (3 hunks)
  • vm/src/builtins/filter.rs (1 hunks)
  • vm/src/builtins/float.rs (8 hunks)
  • vm/src/builtins/function.rs (16 hunks)
  • vm/src/builtins/generator.rs (1 hunks)
  • vm/src/builtins/genericalias.rs (7 hunks)
  • vm/src/builtins/getset.rs (1 hunks)
  • vm/src/builtins/int.rs (9 hunks)
  • vm/src/builtins/iter.rs (2 hunks)
  • vm/src/builtins/list.rs (16 hunks)
  • vm/src/builtins/map.rs (1 hunks)
  • vm/src/builtins/mappingproxy.rs (5 hunks)
  • vm/src/builtins/memory.rs (8 hunks)
  • vm/src/builtins/module.rs (2 hunks)
  • vm/src/builtins/namespace.rs (2 hunks)
  • vm/src/builtins/object.rs (14 hunks)
  • vm/src/builtins/property.rs (4 hunks)
  • vm/src/builtins/range.rs (10 hunks)
  • vm/src/builtins/set.rs (23 hunks)
  • vm/src/builtins/singletons.rs (2 hunks)
  • vm/src/builtins/slice.rs (2 hunks)
  • vm/src/builtins/staticmethod.rs (2 hunks)
  • vm/src/builtins/str.rs (12 hunks)
  • vm/src/builtins/super.rs (1 hunks)
  • vm/src/builtins/tuple.rs (9 hunks)
  • vm/src/builtins/type.rs (20 hunks)
  • vm/src/builtins/union.rs (2 hunks)
  • vm/src/builtins/weakproxy.rs (2 hunks)
  • vm/src/builtins/weakref.rs (1 hunks)
  • vm/src/builtins/zip.rs (2 hunks)
  • vm/src/coroutine.rs (1 hunks)
  • vm/src/exceptions.rs (16 hunks)
  • vm/src/frame.rs (2 hunks)
  • vm/src/function/argument.rs (1 hunks)
  • vm/src/function/builtin.rs (1 hunks)
  • vm/src/import.rs (1 hunks)
  • vm/src/object/traverse_object.rs (2 hunks)
  • vm/src/stdlib/ast/python.rs (1 hunks)
  • vm/src/stdlib/builtins.rs (1 hunks)
  • vm/src/stdlib/collections.rs (15 hunks)
  • vm/src/stdlib/ctypes/base.rs (1 hunks)
  • vm/src/stdlib/ctypes/function.rs (1 hunks)
  • vm/src/stdlib/ctypes/library.rs (1 hunks)
  • vm/src/stdlib/functools.rs (2 hunks)
  • vm/src/stdlib/io.rs (7 hunks)
  • vm/src/stdlib/itertools.rs (20 hunks)
  • vm/src/stdlib/operator.rs (3 hunks)
  • vm/src/stdlib/os.rs (2 hunks)
  • vm/src/stdlib/sre.rs (4 hunks)
  • vm/src/stdlib/thread.rs (2 hunks)
  • vm/src/stdlib/typing.rs (18 hunks)
  • vm/src/stdlib/winreg.rs (1 hunks)
  • vm/src/suggestion.rs (1 hunks)
  • vm/src/types/slot.rs (5 hunks)
  • vm/src/types/structseq.rs (2 hunks)
  • vm/src/vm/mod.rs (3 hunks)
  • vm/src/vm/setting.rs (1 hunks)
  • vm/sre_engine/benches/benches.rs (1 hunks)

Walkthrough

This change removes the use of the magic attribute for Python magic methods and properties throughout the codebase. All magic methods and properties are now explicitly named with their Python dunder (__name__) equivalents. Decorator attributes are updated accordingly, and all internal calls are adjusted to use the new dunder method names. Exception and slot attribute accessors are also renamed for consistency.

Changes

File(s) / Area Change Summary
derive-impl/src/pyclass.rs, derive/src/lib.rs Removed "magic" attribute support from metadata and macro examples; setters now allow non-snake-case warnings.
stdlib/src/array.rs, stdlib/src/contextvars.rs, stdlib/src/mmap.rs, stdlib/src/pystruct.rs, stdlib/src/select.rs, stdlib/src/sqlite.rs, stdlib/src/zlib.rs, vm/src/stdlib/ast/python.rs, vm/src/stdlib/collections.rs, vm/src/stdlib/ctypes/base.rs, vm/src/stdlib/ctypes/function.rs, vm/src/stdlib/functools.rs, vm/src/stdlib/io.rs, vm/src/stdlib/itertools.rs, vm/src/stdlib/operator.rs, vm/src/stdlib/os.rs, vm/src/stdlib/sre.rs, vm/src/stdlib/thread.rs, vm/src/stdlib/typing.rs, vm/src/stdlib/winreg.rs Renamed all magic methods to explicit dunder names (e.g., __getitem__) and updated internal calls accordingly; replaced #[pymethod(magic)] and similar with explicit dunder names and updated all method calls and annotations.
vm/src/builtins/asyncgenerator.rs, vm/src/builtins/bool.rs, vm/src/builtins/builtin_func.rs, vm/src/builtins/bytearray.rs, vm/src/builtins/bytes.rs, vm/src/builtins/classmethod.rs, vm/src/builtins/complex.rs, vm/src/builtins/coroutine.rs, vm/src/builtins/descriptor.rs, vm/src/builtins/dict.rs, vm/src/builtins/enumerate.rs, vm/src/builtins/filter.rs, vm/src/builtins/float.rs, vm/src/builtins/function.rs, vm/src/builtins/generator.rs, vm/src/builtins/genericalias.rs, vm/src/builtins/getset.rs, vm/src/builtins/int.rs, vm/src/builtins/iter.rs, vm/src/builtins/list.rs, vm/src/builtins/map.rs, vm/src/builtins/mappingproxy.rs, vm/src/builtins/memory.rs, vm/src/builtins/module.rs, vm/src/builtins/namespace.rs, vm/src/builtins/object.rs, vm/src/builtins/property.rs, vm/src/builtins/range.rs, vm/src/builtins/set.rs, vm/src/builtins/singletons.rs, vm/src/builtins/slice.rs, vm/src/builtins/staticmethod.rs, vm/src/builtins/str.rs, vm/src/builtins/super.rs, vm/src/builtins/tuple.rs, vm/src/builtins/type.rs, vm/src/builtins/union.rs, vm/src/builtins/weakproxy.rs, vm/src/builtins/weakref.rs, vm/src/builtins/zip.rs Replaced all #[pymethod(magic)] and #[pygetset(magic)] with #[pymethod] or #[pygetset] and renamed methods and properties to their explicit Python dunder names; updated internal calls accordingly.
vm/src/coroutine.rs, vm/src/exceptions.rs, vm/src/frame.rs, vm/src/import.rs, vm/src/suggestion.rs, vm/src/vm/mod.rs Renamed exception internals to dunder names (e.g., __cause__, __traceback__) and updated all related calls.
vm/src/types/slot.rs, vm/src/types/structseq.rs Traits for slots and structseq now use explicit dunder method names and updated annotations.

Sequence Diagram(s)

sequenceDiagram
    participant RustStruct as Rust Struct (e.g., PyList)
    participant PythonVM as Python VM

    PythonVM->>RustStruct: Call __getitem__(...)
    RustStruct->>RustStruct: Execute __getitem__ logic
    RustStruct-->>PythonVM: Return result

    Note over RustStruct,PythonVM: All magic methods now use explicit dunder names and attributes.
Loading

Possibly related PRs

Poem

Oh dunder, dunder, everywhere—
Magic's gone, but we don't care!
Methods now with double lines,
Python's wishes, Rust aligns.
No more magic flags to see,
Just dunder names for harmony!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
derive/src/lib.rs (1)

72-72: Update documentation example to clarify magic method implementation.

The example shows #[pymethod] for what appears to be a magic method (__add__). Consider updating the documentation to clarify that magic methods now use explicit names with #[pymethod(name = "__add__")] rather than the removed magic attribute.

stdlib/src/sqlite.rs (1)

1325-1338: Rename cls / exc / tb parameters for clarity

The three positional arguments of __exit__ correspond to exc_type, exc_val, and exc_tb. Using more explicit names (or prefixing with _ if unused) makes the intent obvious and keeps naming consistent with the many other __exit__ implementations in the repo.

-fn __exit__(
-    &self,
-    cls: PyObjectRef,
-    exc: PyObjectRef,
-    tb: PyObjectRef,
+fn __exit__(
+    &self,
+    exc_type: PyObjectRef,
+    exc_val: PyObjectRef,
+    exc_tb: PyObjectRef,
     vm: &VirtualMachine,
 ) -> PyResult<()> {
-    if vm.is_none(&cls) && vm.is_none(&exc) && vm.is_none(&tb) {
+    if vm.is_none(&exc_type) && vm.is_none(&exc_val) && vm.is_none(&exc_tb) {
         self.commit(vm)
     } else {
         self.rollback(vm)
     }
 }

Purely a readability / consistency nit – no functional change.

vm/src/builtins/str.rs (2)

516-535: Consider fast-pathing concatenation when either operand is empty

__add__ always allocates a fresh Wtf8Buf, even when one side is ''.
This is noticeably frequent in real code (s += '', building strings in a loop, etc.).
A micro-optimisation that matches CPython is to return the non-empty operand directly:

@@
-        if let Some(other) = other.payload::<PyStr>() {
+        if let Some(other) = other.payload::<PyStr>() {
+            if other.is_empty() {
+                // right operand is '', return left unchanged
+                return Ok(zelf.to_pyobject(vm));
+            }
+            if zelf.is_empty() {
+                // left operand is '', return right unchanged
+                return Ok(other.to_pyobject(vm));
+            }
             let bytes = zelf.as_wtf8().py_add(other.as_wtf8());

Cheap, branch-predictable and avoids an allocation in the hottest path.


548-551: Minor: reuse existing helper to avoid tiny boxing cost

__contains__ immediately wraps needle in PyObjectRef just to pass it to _contains; the helper already accepts &PyObject.
Dropping the wrapper avoids one Arc inc/dec:

-    fn __contains__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {
-        self._contains(&needle, vm)
+    fn __contains__(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult<bool> {
+        self._contains(needle, vm)

Call-sites (generated by the macro machinery) will happily pass &PyObject.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3031d5b and 69e46c4.

📒 Files selected for processing (70)
  • derive-impl/src/pyclass.rs (9 hunks)
  • derive/src/lib.rs (1 hunks)
  • stdlib/src/array.rs (13 hunks)
  • stdlib/src/contextvars.rs (3 hunks)
  • stdlib/src/mmap.rs (21 hunks)
  • stdlib/src/pystruct.rs (1 hunks)
  • stdlib/src/select.rs (1 hunks)
  • stdlib/src/sqlite.rs (2 hunks)
  • stdlib/src/zlib.rs (1 hunks)
  • vm/src/builtins/asyncgenerator.rs (2 hunks)
  • vm/src/builtins/bool.rs (2 hunks)
  • vm/src/builtins/builtin_func.rs (3 hunks)
  • vm/src/builtins/bytearray.rs (10 hunks)
  • vm/src/builtins/bytes.rs (8 hunks)
  • vm/src/builtins/classmethod.rs (2 hunks)
  • vm/src/builtins/complex.rs (4 hunks)
  • vm/src/builtins/coroutine.rs (1 hunks)
  • vm/src/builtins/descriptor.rs (2 hunks)
  • vm/src/builtins/dict.rs (24 hunks)
  • vm/src/builtins/enumerate.rs (3 hunks)
  • vm/src/builtins/filter.rs (1 hunks)
  • vm/src/builtins/float.rs (8 hunks)
  • vm/src/builtins/function.rs (14 hunks)
  • vm/src/builtins/generator.rs (1 hunks)
  • vm/src/builtins/genericalias.rs (6 hunks)
  • vm/src/builtins/getset.rs (1 hunks)
  • vm/src/builtins/int.rs (9 hunks)
  • vm/src/builtins/iter.rs (2 hunks)
  • vm/src/builtins/list.rs (16 hunks)
  • vm/src/builtins/map.rs (1 hunks)
  • vm/src/builtins/mappingproxy.rs (5 hunks)
  • vm/src/builtins/memory.rs (8 hunks)
  • vm/src/builtins/module.rs (1 hunks)
  • vm/src/builtins/namespace.rs (2 hunks)
  • vm/src/builtins/object.rs (14 hunks)
  • vm/src/builtins/property.rs (4 hunks)
  • vm/src/builtins/range.rs (10 hunks)
  • vm/src/builtins/set.rs (23 hunks)
  • vm/src/builtins/singletons.rs (2 hunks)
  • vm/src/builtins/slice.rs (2 hunks)
  • vm/src/builtins/staticmethod.rs (2 hunks)
  • vm/src/builtins/str.rs (9 hunks)
  • vm/src/builtins/super.rs (1 hunks)
  • vm/src/builtins/tuple.rs (9 hunks)
  • vm/src/builtins/type.rs (20 hunks)
  • vm/src/builtins/union.rs (2 hunks)
  • vm/src/builtins/weakproxy.rs (2 hunks)
  • vm/src/builtins/weakref.rs (1 hunks)
  • vm/src/builtins/zip.rs (2 hunks)
  • vm/src/coroutine.rs (1 hunks)
  • vm/src/exceptions.rs (16 hunks)
  • vm/src/frame.rs (2 hunks)
  • vm/src/import.rs (1 hunks)
  • vm/src/stdlib/ast/python.rs (1 hunks)
  • vm/src/stdlib/collections.rs (15 hunks)
  • vm/src/stdlib/ctypes/base.rs (1 hunks)
  • vm/src/stdlib/ctypes/function.rs (1 hunks)
  • vm/src/stdlib/functools.rs (2 hunks)
  • vm/src/stdlib/io.rs (7 hunks)
  • vm/src/stdlib/itertools.rs (20 hunks)
  • vm/src/stdlib/operator.rs (3 hunks)
  • vm/src/stdlib/os.rs (2 hunks)
  • vm/src/stdlib/sre.rs (4 hunks)
  • vm/src/stdlib/thread.rs (2 hunks)
  • vm/src/stdlib/typing.rs (16 hunks)
  • vm/src/stdlib/winreg.rs (1 hunks)
  • vm/src/suggestion.rs (1 hunks)
  • vm/src/types/slot.rs (5 hunks)
  • vm/src/types/structseq.rs (2 hunks)
  • vm/src/vm/mod.rs (3 hunks)
🧰 Additional context used
🧠 Learnings (59)
derive/src/lib.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
stdlib/src/zlib.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/import.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/builtins/module.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/map.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/weakref.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/super.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/types/structseq.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/ctypes/base.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/builtins/getset.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/slice.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/builtins/iter.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/stdlib/thread.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
vm/src/stdlib/functools.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/ctypes/function.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/operator.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/zip.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/stdlib/ast/python.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/singletons.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
stdlib/src/select.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/stdlib/winreg.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
vm/src/builtins/bool.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/weakproxy.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/io.rs (5)

undefined

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
</retrieved_learning>

vm/src/builtins/enumerate.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
stdlib/src/contextvars.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/sre.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/asyncgenerator.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/os.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
derive-impl/src/pyclass.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/union.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
vm/src/builtins/staticmethod.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
stdlib/src/mmap.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/memory.rs (5)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/classmethod.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/genericalias.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
vm/src/builtins/range.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/stdlib/collections.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/builtins/mappingproxy.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
vm/src/builtins/tuple.rs (6)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/exceptions.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/builtin_func.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/builtins/bytes.rs (5)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
stdlib/src/sqlite.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/str.rs (6)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When comparing behavior with CPython, use the 'python' command explicitly for CPython and 'cargo run --' for RustPython to avoid confusion.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/list.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/complex.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/builtins/function.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/builtins/object.rs (3)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/types/slot.rs (1)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
vm/src/builtins/bytearray.rs (6)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When comparing behavior with CPython, use the 'python' command explicitly for CPython and 'cargo run --' for RustPython to avoid confusion.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/float.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Always use 'cargo fmt' to format Rust code and follow the default rustfmt code style when contributing to RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
stdlib/src/array.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/dict.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
vm/src/stdlib/typing.rs (2)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
vm/src/builtins/type.rs (7)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When comparing behavior with CPython, use the 'python' command explicitly for CPython and 'cargo run --' for RustPython to avoid confusion.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
vm/src/stdlib/itertools.rs (5)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Follow Rust best practices for error handling and memory management in all RustPython Rust code.
vm/src/builtins/int.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To add a Python module to the RustPython interpreter, use 'vm.add_native_module' with the module name and module factory.
vm/src/builtins/set.rs (4)
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: When implementing a Python module in Rust for RustPython, use the #[pymodule] attribute and expose functions and classes using #[pyfunction], #[pyclass], and #[pymethod] as appropriate.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: To find unimplemented methods and contribution opportunities, run './whats_left.py' in the RustPython repository.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Use the macro system (such as 'pyclass', 'pymodule', 'pyfunction') when implementing Python functionality in Rust for RustPython.
🧬 Code Graph Analysis (14)
vm/src/builtins/module.rs (3)
vm/src/builtins/genericalias.rs (1)
  • __dir__ (171-179)
vm/src/builtins/object.rs (1)
  • __dir__ (388-390)
vm/src/builtins/type.rs (1)
  • __dir__ (1190-1197)
vm/src/builtins/weakref.rs (11)
vm/src/builtins/dict.rs (1)
  • __class_getitem__ (324-326)
vm/src/builtins/list.rs (1)
  • __class_getitem__ (338-340)
vm/src/stdlib/collections.rs (1)
  • __class_getitem__ (413-419)
vm/src/builtins/mappingproxy.rs (1)
  • __class_getitem__ (174-176)
vm/src/builtins/tuple.rs (1)
  • __class_getitem__ (346-348)
vm/src/builtins/set.rs (2)
  • __class_getitem__ (788-790)
  • __class_getitem__ (1132-1134)
vm/src/builtins/asyncgenerator.rs (1)
  • __class_getitem__ (70-72)
vm/src/builtins/enumerate.rs (1)
  • __class_getitem__ (58-60)
vm/src/stdlib/typing.rs (2)
  • __class_getitem__ (933-939)
  • args (358-364)
vm/src/stdlib/itertools.rs (1)
  • __class_getitem__ (66-72)
vm/src/stdlib/os.rs (1)
  • __class_getitem__ (590-596)
vm/src/stdlib/ctypes/base.rs (6)
stdlib/src/array.rs (1)
  • __mul__ (1095-1099)
vm/src/builtins/bytes.rs (1)
  • __mul__ (463-465)
vm/src/builtins/bytearray.rs (1)
  • __mul__ (549-551)
vm/src/builtins/list.rs (1)
  • __mul__ (243-245)
vm/src/builtins/tuple.rs (1)
  • __mul__ (283-285)
vm/src/builtins/str.rs (1)
  • __mul__ (612-614)
vm/src/builtins/coroutine.rs (9)
vm/src/builtins/classmethod.rs (1)
  • __name__ (148-150)
vm/src/builtins/function.rs (2)
  • __name__ (436-438)
  • set___name__ (441-443)
vm/src/builtins/staticmethod.rs (1)
  • __name__ (109-111)
vm/src/builtins/type.rs (3)
  • __name__ (560-575)
  • set___name__ (762-778)
  • name (416-421)
vm/src/builtins/asyncgenerator.rs (2)
  • __name__ (43-45)
  • set___name__ (48-50)
vm/src/builtins/builtin_func.rs (1)
  • __name__ (83-85)
vm/src/builtins/descriptor.rs (1)
  • __name__ (113-115)
vm/src/builtins/generator.rs (2)
  • __name__ (41-43)
  • set___name__ (46-48)
vm/src/builtins/module.rs (2)
  • name (117-123)
  • name (122-122)
vm/src/builtins/generator.rs (8)
vm/src/builtins/function.rs (2)
  • __name__ (436-438)
  • set___name__ (441-443)
vm/src/builtins/type.rs (3)
  • __name__ (560-575)
  • set___name__ (762-778)
  • name (416-421)
vm/src/builtins/asyncgenerator.rs (2)
  • __name__ (43-45)
  • set___name__ (48-50)
vm/src/builtins/builtin_func.rs (1)
  • __name__ (83-85)
vm/src/builtins/coroutine.rs (2)
  • __name__ (38-40)
  • set___name__ (43-45)
vm/src/builtins/descriptor.rs (1)
  • __name__ (113-115)
vm/src/builtins/getset.rs (1)
  • __name__ (134-136)
vm/src/builtins/module.rs (2)
  • name (117-123)
  • name (122-122)
vm/src/builtins/iter.rs (10)
vm/src/builtins/bytes.rs (2)
  • __length_hint__ (694-696)
  • __setstate__ (706-710)
vm/src/builtins/bytearray.rs (2)
  • __length_hint__ (895-897)
  • __setstate__ (906-910)
vm/src/builtins/list.rs (6)
  • __length_hint__ (549-551)
  • __length_hint__ (594-596)
  • __reduce__ (561-565)
  • __reduce__ (606-610)
  • __setstate__ (554-558)
  • __setstate__ (599-603)
vm/src/builtins/range.rs (5)
  • __length_hint__ (544-551)
  • __length_hint__ (609-612)
  • __setstate__ (554-557)
  • __setstate__ (615-619)
  • state (670-670)
vm/src/builtins/tuple.rs (3)
  • __length_hint__ (468-470)
  • __reduce__ (480-484)
  • __setstate__ (473-477)
vm/src/builtins/str.rs (3)
  • __length_hint__ (287-289)
  • __reduce__ (301-306)
  • __setstate__ (292-298)
vm/src/builtins/enumerate.rs (4)
  • __length_hint__ (110-118)
  • __reduce__ (66-71)
  • __reduce__ (126-130)
  • __setstate__ (121-123)
vm/src/builtins/map.rs (2)
  • __length_hint__ (38-44)
  • __reduce__ (47-51)
vm/src/builtins/filter.rs (1)
  • __reduce__ (38-43)
vm/src/builtins/zip.rs (2)
  • __reduce__ (47-60)
  • __setstate__ (63-68)
vm/src/stdlib/thread.rs (5)
stdlib/src/mmap.rs (1)
  • __exit__ (922-924)
vm/src/builtins/memory.rs (1)
  • __exit__ (650-652)
vm/src/stdlib/io.rs (2)
  • __exit__ (435-438)
  • vm (3238-3240)
stdlib/src/sqlite.rs (2)
  • __exit__ (1326-1338)
  • __exit__ (2099-2101)
vm/src/stdlib/os.rs (1)
  • __exit__ (650-652)
vm/src/builtins/singletons.rs (14)
vm/src/builtins/weakproxy.rs (1)
  • __bool__ (92-94)
vm/src/builtins/float.rs (1)
  • __bool__ (287-289)
vm/src/builtins/int.rs (1)
  • __bool__ (579-581)
vm/src/builtins/range.rs (2)
  • __bool__ (270-272)
  • __reduce__ (275-282)
vm/src/builtins/tuple.rs (1)
  • __bool__ (255-257)
vm/src/builtins/complex.rs (1)
  • __bool__ (381-383)
vm/src/builtins/bytes.rs (2)
  • __reduce__ (497-504)
  • __reduce__ (699-703)
vm/src/builtins/bytearray.rs (2)
  • __reduce__ (651-658)
  • __reduce__ (899-903)
vm/src/builtins/function.rs (1)
  • __reduce__ (740-748)
vm/src/builtins/namespace.rs (1)
  • __reduce__ (44-53)
vm/src/builtins/list.rs (2)
  • __reduce__ (561-565)
  • __reduce__ (606-610)
vm/src/builtins/memory.rs (2)
  • __reduce__ (881-883)
  • __reduce__ (1128-1132)
vm/src/builtins/set.rs (3)
  • __reduce__ (780-785)
  • __reduce__ (1124-1129)
  • __reduce__ (1311-1327)
vm/src/builtins/str.rs (1)
  • __reduce__ (301-306)
stdlib/src/contextvars.rs (13)
vm/src/builtins/bytes.rs (2)
  • __getitem__ (189-191)
  • __len__ (150-152)
vm/src/builtins/bytearray.rs (2)
  • __getitem__ (245-247)
  • __len__ (209-211)
vm/src/builtins/list.rs (3)
  • __getitem__ (217-219)
  • __len__ (183-185)
  • __class_getitem__ (338-340)
vm/src/builtins/tuple.rs (3)
  • __getitem__ (298-300)
  • __len__ (272-274)
  • __class_getitem__ (346-348)
vm/src/builtins/str.rs (1)
  • __getitem__ (562-564)
vm/src/builtins/set.rs (5)
  • item (486-486)
  • __len__ (546-548)
  • __len__ (972-974)
  • __class_getitem__ (788-790)
  • __class_getitem__ (1132-1134)
vm/src/types/slot.rs (3)
  • __iter__ (1311-1313)
  • __iter__ (1352-1354)
  • mapping_downcast (1259-1261)
vm/src/builtins/asyncgenerator.rs (1)
  • __class_getitem__ (70-72)
vm/src/builtins/enumerate.rs (1)
  • __class_getitem__ (58-60)
vm/src/builtins/weakref.rs (1)
  • __class_getitem__ (56-58)
vm/src/stdlib/typing.rs (1)
  • __class_getitem__ (933-939)
vm/src/stdlib/itertools.rs (1)
  • __class_getitem__ (66-72)
vm/src/stdlib/os.rs (1)
  • __class_getitem__ (590-596)
stdlib/src/pystruct.rs (7)
vm/src/builtins/bytes.rs (1)
  • __length_hint__ (694-696)
vm/src/builtins/bytearray.rs (1)
  • __length_hint__ (895-897)
vm/src/builtins/list.rs (2)
  • __length_hint__ (549-551)
  • __length_hint__ (594-596)
vm/src/stdlib/collections.rs (2)
  • __length_hint__ (632-634)
  • __length_hint__ (698-700)
vm/src/builtins/tuple.rs (1)
  • __length_hint__ (468-470)
vm/src/builtins/set.rs (1)
  • __length_hint__ (1306-1308)
vm/src/builtins/str.rs (1)
  • __length_hint__ (287-289)
vm/src/builtins/staticmethod.rs (4)
vm/src/builtins/classmethod.rs (8)
  • __func__ (128-130)
  • __wrapped__ (133-135)
  • __module__ (138-140)
  • __qualname__ (143-145)
  • __name__ (148-150)
  • __annotations__ (153-155)
  • __isabstractmethod__ (158-163)
  • set___isabstractmethod__ (166-171)
vm/src/builtins/type.rs (5)
  • __module__ (677-691)
  • __qualname__ (578-592)
  • __name__ (560-575)
  • __annotations__ (623-646)
  • value (764-764)
vm/src/builtins/descriptor.rs (3)
  • __qualname__ (117-119)
  • __qualname__ (252-262)
  • __name__ (113-115)
vm/src/builtins/property.rs (3)
  • __isabstractmethod__ (241-272)
  • setter (223-229)
  • set___isabstractmethod__ (275-280)
vm/src/builtins/classmethod.rs (3)
vm/src/builtins/staticmethod.rs (8)
  • __func__ (89-91)
  • __wrapped__ (94-96)
  • __module__ (99-101)
  • __qualname__ (104-106)
  • __name__ (109-111)
  • __annotations__ (114-116)
  • __isabstractmethod__ (119-124)
  • set___isabstractmethod__ (127-132)
vm/src/builtins/type.rs (5)
  • __module__ (677-691)
  • __qualname__ (578-592)
  • __name__ (560-575)
  • __annotations__ (623-646)
  • value (764-764)
vm/src/builtins/property.rs (3)
  • __isabstractmethod__ (241-272)
  • setter (223-229)
  • set___isabstractmethod__ (275-280)
stdlib/src/sqlite.rs (6)
stdlib/src/mmap.rs (2)
  • __enter__ (916-919)
  • __exit__ (922-924)
vm/src/builtins/memory.rs (2)
  • __enter__ (645-647)
  • __exit__ (650-652)
stdlib/src/select.rs (2)
  • __enter__ (726-729)
  • __exit__ (732-739)
vm/src/stdlib/io.rs (2)
  • __enter__ (429-432)
  • __exit__ (435-438)
vm/src/stdlib/winreg.rs (2)
  • __enter__ (109-111)
  • __exit__ (113-115)
vm/src/stdlib/os.rs (2)
  • __enter__ (645-647)
  • __exit__ (650-652)
vm/src/builtins/bytearray.rs (6)
vm/src/builtins/bytes.rs (12)
  • __len__ (150-152)
  • __sizeof__ (165-167)
  • __add__ (170-172)
  • __contains__ (175-181)
  • __getitem__ (189-191)
  • __mul__ (463-465)
  • __rmod__ (474-476)
  • __reduce_ex__ (488-494)
  • __reduce__ (497-504)
  • __reduce__ (699-703)
  • __length_hint__ (694-696)
  • __setstate__ (706-710)
vm/src/builtins/list.rs (19)
  • __len__ (183-185)
  • __sizeof__ (188-191)
  • __add__ (146-148)
  • other (133-133)
  • __contains__ (258-260)
  • __iadd__ (161-169)
  • __getitem__ (217-219)
  • __delitem__ (316-318)
  • __mul__ (243-245)
  • __imul__ (248-250)
  • __setitem__ (232-239)
  • __reduce__ (561-565)
  • __reduce__ (606-610)
  • __length_hint__ (549-551)
  • __length_hint__ (594-596)
  • obj (348-348)
  • obj (350-350)
  • __setstate__ (554-558)
  • __setstate__ (599-603)
vm/src/builtins/tuple.rs (10)
  • __len__ (272-274)
  • __add__ (232-252)
  • other (237-237)
  • __contains__ (328-330)
  • zelf (243-247)
  • __getitem__ (298-300)
  • __mul__ (283-285)
  • __reduce__ (480-484)
  • __length_hint__ (468-470)
  • __setstate__ (473-477)
vm/src/protocol/buffer.rs (1)
  • simple (178-186)
vm/src/types/slot.rs (3)
  • mapping_downcast (1259-1261)
  • sequence_downcast (1270-1272)
  • obj (1207-1208)
vm/src/builtins/iter.rs (2)
  • __length_hint__ (203-216)
  • state (62-62)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Check Rust code with rustfmt and clippy
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run tests under miri
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Ensure compilation on various targets
🔇 Additional comments (240)
stdlib/src/zlib.rs (1)

407-407: LGTM! Consistent attribute update in commented code.

Good practice to update the commented attribute syntax to reflect the new explicit naming convention, maintaining consistency even in unimplemented code.

vm/src/import.rs (1)

214-214: LGTM! Consistent dunder method naming.

The change from traceback() to __traceback__() aligns with the systematic refactoring to use explicit Python dunder method names.

vm/src/coroutine.rs (2)

118-118: LGTM! Consistent exception cause setter naming.

The change from set_cause to set___cause__ aligns with the systematic refactoring to use explicit dunder method naming for exception handling.


124-124: LGTM! Consistent exception cause setter naming.

Same as above - the dunder method naming update maintains functionality while improving consistency.

vm/src/stdlib/ast/python.rs (1)

18-19: LGTM! Proper magic method conversion to explicit dunder naming.

The conversion from #[pymethod(magic)] with fn init to #[pymethod] with fn __init__ correctly implements the new explicit naming convention while preserving all functionality.

vm/src/suggestion.rs (1)

58-58: LGTM: Consistent with systematic magic method refactoring.

The change from exc.traceback()? to exc.__traceback__()? aligns with the codebase-wide refactoring to use explicit Python dunder method names instead of magic method shortcuts.

vm/src/builtins/module.rs (1)

171-172: LGTM: Systematic magic method refactoring applied correctly.

The change from #[pymethod(magic)] fn dir to #[pymethod] fn __dir__ follows the codebase-wide pattern of replacing magic method shortcuts with explicit Python dunder method names, while preserving the exact implementation logic.

vm/src/builtins/filter.rs (1)

37-38: LGTM: Systematic magic method refactoring applied correctly.

The change from #[pymethod(magic)] fn reduce to #[pymethod] fn __reduce__ is consistent with the codebase-wide refactoring to use explicit Python dunder method names, while maintaining the exact serialization protocol implementation.

vm/src/frame.rs (2)

386-386: LGTM: Consistent with systematic magic method refactoring.

The change from exception.traceback() to exception.__traceback__() aligns with the codebase-wide refactoring to use explicit Python dunder method names in exception handling.


1711-1711: LGTM: Systematic magic method refactoring applied correctly.

The change from exception.set_cause(cause) to exception.set___cause__(cause) follows the consistent pattern of replacing magic method shortcuts with explicit dunder method names throughout the codebase.

vm/src/stdlib/ctypes/base.rs (1)

264-267: LGTM! Correct magic method renaming.

The method is correctly renamed from mul with the magic attribute to the explicit Python special method name __mul__, consistent with the codebase-wide refactoring effort and Python's canonical naming conventions.

vm/src/builtins/weakref.rs (1)

55-58: LGTM! Correct magic method renaming.

The method is correctly renamed from class_getitem with the magic attribute to the explicit Python special method name __class_getitem__, following the standard pattern used across all builtin types for generic type subscription.

stdlib/src/pystruct.rs (1)

194-197: LGTM! Correct magic method renaming.

The method is correctly renamed from length_hint with the magic attribute to the explicit Python special method name __length_hint__, consistent with the pattern used across iterator types throughout the codebase.

vm/src/builtins/generator.rs (1)

40-48: LGTM! Correct magic attribute renaming.

The getter and setter for the __name__ attribute are correctly renamed from name/set_name with the magic attribute to the explicit Python special attribute names __name__/set___name__, consistent with the pattern used across coroutines, async generators, and functions.

vm/src/builtins/coroutine.rs (1)

37-45: LGTM! Correct magic attribute renaming.

The getter and setter for the __name__ attribute are correctly renamed from name/set_name with the magic attribute to the explicit Python special attribute names __name__/set___name__, consistent with the pattern used across generators, async generators, and functions.

vm/src/builtins/map.rs (2)

37-38: Correctly renamed magic method to use explicit dunder naming.

The method length_hint has been appropriately renamed to __length_hint__ and the magic attribute removed, aligning with Python's special method naming conventions.


46-47: Correctly renamed magic method to use explicit dunder naming.

The method reduce has been appropriately renamed to __reduce__ and the magic attribute removed, following Python's pickling protocol conventions.

vm/src/builtins/namespace.rs (2)

43-44: Correctly renamed magic method to use explicit dunder naming.

The method reduce has been appropriately renamed to __reduce__ and the magic attribute removed, consistent with Python's pickling protocol.


99-99: Good consistency in using the new dunder method naming internally.

The internal call has been updated from dict.len() to dict.__len__(), maintaining consistency with the new explicit dunder method naming convention throughout the codebase.

vm/src/stdlib/ctypes/function.rs (2)

202-203: Correctly renamed property getter to use explicit dunder naming.

The getter method name has been appropriately renamed to __name__ and the magic attribute removed, aligning with Python's standard __name__ attribute for callable objects.


207-208: Correctly renamed property setter to use explicit dunder naming.

The setter method set_name has been appropriately renamed to set___name__ and the magic attribute removed, maintaining consistency with the getter method naming.

vm/src/stdlib/thread.rs (2)

161-162: Correctly renamed context manager method to use explicit dunder naming.

The method exit has been appropriately renamed to __exit__ and the magic attribute removed, aligning with Python's context manager protocol.


247-248: Correctly renamed context manager method to use explicit dunder naming.

The method exit in RLock has been appropriately renamed to __exit__ and the magic attribute removed, maintaining consistency with Python's context manager protocol.

vm/src/builtins/super.rs (2)

138-139: Correctly renamed property getter to use explicit dunder naming.

The getter method thisclass has been appropriately renamed to __thisclass__ and the magic attribute removed, aligning with Python's special attributes for super objects.


143-144: Correctly renamed property getter to use explicit dunder naming.

The getter method self_class has been appropriately renamed to __self_class__ and the magic attribute removed, maintaining consistency with Python's special attributes for super objects.

vm/src/builtins/getset.rs (3)

133-136: LGTM: Correct standardization to dunder naming

The renaming from name to __name__ and removal of the magic flag correctly aligns with Python's data model for descriptor objects.


138-141: LGTM: Proper qualname attribute naming

The change from qualname to __qualname__ correctly follows Python's naming convention for qualified names in descriptors.


143-146: LGTM: Correct objclass attribute standardization

The renaming from objclass to __objclass__ properly implements the standard Python descriptor protocol.

vm/src/builtins/zip.rs (2)

46-60: LGTM: Correct pickle protocol method naming

The renaming from reduce to __reduce__ and removal of the magic flag correctly follows Python's pickle protocol conventions.


62-68: LGTM: Proper setstate method standardization

The change from setstate to __setstate__ correctly implements the standard Python pickle protocol method.

vm/src/builtins/slice.rs (2)

185-196: LGTM: Correct pickle protocol implementation for PySlice

The renaming from reduce to __reduce__ and removal of the magic flag correctly follows Python's pickle protocol for slice objects.


320-323: LGTM: Proper ellipsis pickle support

The change from reduce to __reduce__ correctly implements the standard Python pickle protocol for ellipsis objects.

vm/src/types/structseq.rs (2)

50-75: LGTM: Correct trait method standardization

The renaming from repr to __repr__ and removal of the magic flag correctly aligns the trait with Python's data model for string representation.


77-80: LGTM: Proper pickle protocol in trait

The change from reduce to __reduce__ correctly implements the standard Python pickle protocol in the trait interface.

vm/src/vm/mod.rs (3)

462-462: LGTM: Correct exception traceback access

The change from e.traceback() to e.__traceback__() correctly uses the standardized dunder method name.


832-839: LGTM: Consistent exception context handling

The method calls to __context__() and set___context__() are consistent with the standardized naming convention for exception context handling.


260-260: Verify triple underscore setter naming convention

The call to set___cause__ uses three underscores, which seems unusual. Please verify this is the correct naming convention for exception cause setters.

#!/bin/bash
# Search for other triple underscore setter method definitions to verify naming convention
rg -A 2 "set___" --type rust
stdlib/src/select.rs (2)

725-729: LGTM! Context manager protocol correctly implemented.

The method correctly implements the __enter__ protocol by returning self, which is standard behavior for context managers.


731-739: LGTM! Context manager exit protocol correctly implemented.

The __exit__ method properly calls close() to clean up resources, which is the expected behavior for the context manager protocol.

vm/src/builtins/iter.rs (3)

202-216: LGTM! Iterator length hint protocol correctly implemented.

The method properly implements the __length_hint__ protocol by returning the estimated number of remaining items in the sequence iterator.


218-221: LGTM! Pickling protocol correctly implemented.

The __reduce__ method properly enables pickling support for sequence iterators by delegating to the internal reduce implementation.


223-226: LGTM! Unpickling protocol correctly implemented.

The __setstate__ method properly enables unpickling support by restoring the iterator's internal state.

vm/src/builtins/singletons.rs (3)

47-50: LGTM! Boolean conversion protocol correctly implemented.

The method correctly implements __bool__ for PyNone, always returning false as expected for Python's None singleton.


98-101: LGTM! Boolean conversion protocol correctly implemented.

The method correctly implements __bool__ for PyNotImplemented, always returning true as expected for Python's NotImplemented singleton.


103-106: LGTM! Pickling protocol correctly implemented.

The __reduce__ method correctly returns the string name for NotImplemented, enabling proper pickling support for this singleton.

vm/src/stdlib/winreg.rs (3)

104-107: LGTM! Boolean conversion protocol correctly implemented.

The method correctly implements __bool__ by checking if the registry key handle is not null, which is the appropriate way to determine if a registry key is valid.


108-111: LGTM! Context manager entry protocol correctly implemented.

The __enter__ method correctly returns self, following the standard context manager pattern for registry keys.


112-115: LGTM! Context manager exit protocol correctly implemented.

The __exit__ method properly calls Close() to ensure the registry key is properly closed when exiting the context, providing proper resource management.

vm/src/stdlib/operator.rs (3)

359-365: LGTM! Pickling protocol correctly implemented for attrgetter.

The __reduce__ method properly returns a tuple containing the class and attribute names, enabling correct reconstruction during unpickling.


458-462: LGTM! Pickling protocol correctly implemented for itemgetter.

The __reduce__ method properly returns a tuple containing the class and items, enabling correct reconstruction during unpickling.


529-547: LGTM! Pickling protocol correctly implemented for methodcaller.

The __reduce__ method handles both simple cases (no kwargs) and complex cases (with kwargs using partial functions), ensuring proper reconstruction during unpickling.

vm/src/stdlib/functools.rs (2)

103-104: LGTM! Proper migration to explicit dunder method naming.

The change from #[pymethod(magic)] with setstate to #[pymethod] with __setstate__ correctly aligns with Python's special method naming conventions. The method implementation remains unchanged and properly handles the pickle protocol state restoration.


293-293: LGTM! Consistent use of explicit dunder method call.

The change from .module(vm) to .__module__(vm) is consistent with the broader refactoring to use explicit dunder method names throughout the codebase. This maintains the same functionality while following Python's special attribute naming conventions.

stdlib/src/sqlite.rs (2)

1320-1324: __enter__ looks good

The context-manager entry simply returns the Connection itself, which matches CPython’s sqlite3 behaviour.
No further action needed.


2093-2101: Blob context-manager implementation is fine

__enter__ returns self, and __exit__ closes the blob without attempting to suppress exceptions – identical to CPython’s behaviour.
No issues spotted.

vm/src/builtins/property.rs (3)

152-165: LGTM! Correct mapping to Python special method name.

The renaming of set_name to set___name__ properly reflects the Python __set_name__ descriptor protocol method, and removing the magic attribute makes the special method nature explicit.


240-272: LGTM! Proper abstract method attribute naming.

The changes correctly rename:

  • isabstractmethod__isabstractmethod__
  • set_isabstractmethodset___isabstractmethod__

These align with Python's __isabstractmethod__ attribute convention for abstract methods.


292-292: LGTM! Consistent internal call update.

The update from qualname(vm) to __qualname__(vm) is consistent with the broader refactoring to use explicit dunder method names.

stdlib/src/contextvars.rs (3)

200-221: LGTM! Correct mapping to Python special methods.

The systematic renaming follows Python conventions correctly:

  • getitem__getitem__ (subscription protocol)
  • len__len__ (length protocol)
  • iter__iter__ (iteration protocol)

The multi-line parameter formatting also improves readability.


263-265: LGTM! Consistent internal call update.

The AsMapping implementation correctly updates the internal call to use __len__() instead of the old len() method name, maintaining consistency with the method renaming.


479-486: LGTM! Proper class method naming.

The renaming of class_getitem to __class_getitem__ correctly reflects Python's generic type subscripting protocol and removes the magic attribute appropriately.

vm/src/stdlib/os.rs (2)

584-596: LGTM! Correct path protocol and generic type methods.

The changes properly map to Python special methods:

  • fspath__fspath__ (PEP 519 path protocol)
  • class_getitem__class_getitem__ (generic type subscripting)

Both follow Python conventions and maintain the original functionality.


644-652: LGTM! Proper context manager protocol methods.

The renaming correctly implements the context manager protocol:

  • enter__enter__
  • exit__exit__

These are the standard Python dunder methods for context managers and the logic is preserved.

vm/src/builtins/bool.rs (3)

113-119: LGTM! Correct format method naming.

The renaming of format to __format__ properly reflects Python's string formatting protocol and removes the magic attribute appropriately.


122-167: LGTM! Proper bitwise operation methods.

The systematic renaming correctly maps to Python special methods:

  • or__or__ (bitwise OR)
  • and__and__ (bitwise AND)
  • xor__xor__ (bitwise XOR)

The internal calls on lines 131, 147, and 163 are consistently updated to use the new dunder method names.


173-179: LGTM! Consistent trait implementation update.

The AsNumber trait implementation correctly references the renamed dunder methods, maintaining consistency with the method name changes throughout the file.

vm/src/builtins/weakproxy.rs (2)

82-109: LGTM! Correct mapping to Python special methods.

The systematic renaming properly reflects Python protocols:

  • str__str__ (string representation)
  • bool__bool__ (truthiness testing)
  • bytes__bytes__ (bytes conversion)
  • reversed__reversed__ (reverse iteration)
  • contains__contains__ (membership testing)

All changes maintain the original functionality while making the special method nature explicit.


192-193: LGTM! Consistent internal call update.

The AsSequence trait implementation correctly updates the internal call to use __contains__(), maintaining consistency with the method renaming.

vm/src/builtins/enumerate.rs (5)

57-61: LGTM!

The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.


65-71: LGTM!

The change correctly updates the method to use the explicit dunder name __reduce__ and removes the magic attribute.


109-118: LGTM!

The change correctly updates the method to use the explicit dunder name __length_hint__ and removes the magic attribute.


120-123: LGTM!

The change correctly updates the method to use the explicit dunder name __setstate__ and removes the magic attribute.


125-130: LGTM!

The change correctly updates the method to use the explicit dunder name __reduce__ and removes the magic attribute.

vm/src/stdlib/sre.rs (4)

499-506: LGTM!

The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.


724-736: LGTM!

The change correctly updates the method to use the explicit dunder name __getitem__ and removes the magic attribute.


813-820: LGTM!

The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.


827-831: LGTM!

The internal method call correctly updated to use the new dunder method name __getitem__.

vm/src/builtins/asyncgenerator.rs (5)

42-45: LGTM!

The change correctly updates the getter to use the explicit dunder name __name__ and removes the magic attribute.


47-50: LGTM!

The setter correctly uses the set___name__ naming convention and removes the magic attribute. The non-standard naming is handled by the automatic #[allow(non_snake_case)] addition in the derive macro.


69-72: LGTM!

The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.


77-80: LGTM!

The change correctly updates the method to use the explicit dunder name __aiter__ and removes the magic attribute.


82-85: LGTM!

The change correctly updates the method to use the explicit dunder name __anext__ and removes the magic attribute.

vm/src/builtins/union.rs (6)

87-90: LGTM!

The change correctly updates the getter to use the explicit dunder name __parameters__ and removes the magic attribute.


92-95: LGTM!

The change correctly updates the getter to use the explicit dunder name __args__ and removes the magic attribute.


97-112: LGTM!

The change correctly updates the method to use the explicit dunder name __instancecheck__, removes the magic attribute, and properly updates the internal call to __args__().


114-129: LGTM!

The change correctly updates the method to use the explicit dunder name __subclasscheck__, removes the magic attribute, and properly updates the internal call to __args__().


131-135: LGTM!

The change correctly updates the method to use the explicit dunder name __or__ while maintaining the __ror__ alias, and removes the magic attribute.


236-243: LGTM!

The AsNumber trait implementation correctly updated to call the renamed __or__ method.

derive-impl/src/pyclass.rs (5)

1231-1231: LGTM!

Correctly removes "magic" from the allowed method attributes.


755-760: LGTM!

The automatic addition of #[allow(non_snake_case)] for setter methods with dunder names properly handles the naming convention.


791-796: LGTM!

Consistently applies the non_snake_case allowance for getset setters.


951-956: LGTM!

Consistently applies the non_snake_case allowance for member setters.


1386-1398: LGTM!

The slot name normalization correctly strips the double underscores to match the expected slot naming convention.

vm/src/stdlib/io.rs (8)

428-432: LGTM! Correct standardization of context manager entry method.

The change from #[pymethod(magic)] with method name enter to #[pymethod] with __enter__ properly follows Python's special method naming conventions for context managers.


434-438: LGTM! Correct standardization of context manager exit method.

The change from #[pymethod(magic)] with method name exit to #[pymethod] with __exit__ properly follows Python's special method naming conventions for context managers.


1413-1413: LGTM! Consistent with dunder method naming standardization.

The change from e.str(vm) to e.__str__(vm) aligns with the broader refactoring to use explicit Python dunder method names throughout the codebase.


1562-1565: LGTM! Correct standardization of string representation method.

The change from #[pymethod(magic)] with method name repr to #[pymethod] with __repr__ properly follows Python's special method naming conventions for object representation.


1604-1607: LGTM! Correct standardization of serialization method.

The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ properly follows Python's special method naming conventions for object serialization.


1683-1683: LGTM! Consistent with dunder method naming standardization.

The change from e.set_context(Some(e1)) to e.set___context__(Some(e1)) aligns with the broader refactoring to use explicit Python dunder method names for exception handling.


2997-3000: LGTM! Consistent serialization method standardization.

The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ maintains consistency with Python's special method naming conventions across all IO classes.


4506-4509: LGTM! Complete standardization across all IO classes.

The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ completes the consistent application of Python's special method naming conventions across all IO implementations.

vm/src/builtins/descriptor.rs (2)

112-143: LGTM! Excellent systematic refactoring to canonical Python dunder names.

The renaming from name, qualname, doc, text_signature, objclass, reduce to their canonical Python dunder equivalents (__name__, __qualname__, __doc__, __text_signature__, __objclass__, __reduce__) is correct and improves consistency. The removal of the magic attribute from the decorators aligns with the broader codebase refactoring.


246-262: LGTM! Consistent application of dunder naming pattern.

The PyMemberDescriptor changes follow the same pattern as PyMethodDescriptor, correctly renaming doc and qualname to __doc__ and __qualname__ respectively. The logic remains unchanged.

vm/src/builtins/mappingproxy.rs (2)

119-205: LGTM! Proper implementation of Python dunder method naming.

The systematic renaming from getitem, contains, len, etc. to their canonical Python dunder equivalents (__getitem__, __contains__, __len__, etc.) is correct. The removal of the magic attribute and use of plain #[pymethod] aligns with the codebase refactoring.


225-270: LGTM! Protocol implementations correctly updated.

The AsMapping and AsNumber trait implementations have been properly updated to call the renamed dunder methods (__len__, __getitem__, __or__, __ior__). This ensures consistency between the public Python interface and internal protocol usage.

vm/src/builtins/staticmethod.rs (2)

88-132: LGTM! Consistent property renaming to Python dunder conventions.

The systematic renaming of property getters from func, wrapped, module, qualname, name, annotations, isabstractmethod to their canonical Python dunder equivalents is correct and follows the established pattern. The logic for each property remains unchanged.


150-157: LGTM! Representable implementation correctly updated.

The calls to class.__qualname__(vm) and class.__module__(vm) correctly use the renamed dunder methods, ensuring consistency with the property renamings above.

vm/src/builtins/classmethod.rs (2)

127-171: LGTM! Consistent property renaming following Python conventions.

The systematic renaming of property getters mirrors the pattern established in staticmethod.rs and correctly implements canonical Python dunder names. The underlying logic for accessing the callable's attributes remains unchanged.


182-188: LGTM! Representable trait correctly updated.

The Representable implementation has been properly updated to call __qualname__ and __module__ instead of the old non-dunder names, maintaining consistency with the property renamings.

stdlib/src/mmap.rs (3)

419-454: LGTM! Protocol implementations correctly updated.

The AsBuffer, AsMapping, and AsSequence trait implementations have been properly updated to call the renamed dunder methods (__len__, getitem_inner, setitem_inner). The buffer descriptor correctly uses __len__() for size calculation.


499-924: LGTM! Comprehensive method renaming to Python dunder conventions.

The systematic renaming of methods from len, getitem, setitem, enter, exit to their canonical Python dunder equivalents (__len__, __getitem__, __setitem__, __enter__, __exit__) is correct. The context manager methods (__enter__/__exit__) properly follow Python's context manager protocol. All method implementations remain unchanged, only the names have been updated.


576-1084: LGTM! Internal calls consistently updated.

All internal method calls have been properly updated to use __len__() instead of len(), ensuring consistency throughout the implementation. The helper methods have been appropriately renamed from _getitem/_setitem to getitem_inner/setitem_inner, which follows better naming conventions for internal helpers.

vm/src/builtins/memory.rs (4)

644-695: LGTM! Excellent standardization of magic method names.

The systematic renaming of magic methods to their canonical Python dunder forms (__enter__, __exit__, __getitem__, __delitem__, __len__) improves code clarity by making the Python special method protocol explicit rather than relying on the magic attribute annotation.


842-883: LGTM! Consistent dunder method naming in PyMemoryView.

The renaming of setitem to __setitem__, reduce_ex to __reduce_ex__, and reduce to __reduce__ maintains the same functionality while following Python's canonical special method naming conventions.


966-990: LGTM! Updated internal calls to use new dunder method names.

The trait implementations correctly update their internal calls to use the renamed dunder methods (__len__(), __getitem__(), __setitem__()), ensuring consistency throughout the codebase.


1127-1148: LGTM! Iterator implementation updated consistently.

The PyMemoryViewIterator methods are properly renamed to __reduce__ and internal calls updated to use __len__(), maintaining consistency with the broader refactoring effort.

vm/src/builtins/genericalias.rs (4)

139-152: LGTM! Property names standardized to Python conventions.

The renaming of properties to their canonical dunder forms (__parameters__, __args__, __origin__) makes the code more consistent with Python's special attribute naming conventions.


154-212: LGTM! Magic methods properly renamed to dunder equivalents.

All magic methods are correctly renamed to their canonical Python forms (__getitem__, __dir__, __reduce__, __mro_entries__, __instancecheck__, __subclasscheck__, __ror__, __or__) while maintaining the same functionality.


324-343: LGTM! Trait implementations updated with new method names.

The AsMapping and AsNumber trait implementations correctly use the renamed dunder methods (__getitem__(), __or__()) in their function calls, ensuring consistency throughout the implementation.


362-402: LGTM! Comparison and attribute access traits updated consistently.

The Comparable and GetAttr trait implementations properly call the renamed dunder methods (__origin__(), __args__()) while maintaining the same comparison and attribute access logic.

vm/src/stdlib/collections.rs (4)

96-98: LGTM! Copy method properly dual-named.

The copy method correctly includes both the regular name and the __copy__ magic method name, following Python's copy protocol conventions.


253-420: LGTM! Comprehensive magic method standardization in PyDeque.

All magic methods are systematically renamed to their canonical dunder forms (__reversed__, __getitem__, __setitem__, __delitem__, __contains__, __mul__, __imul__, __len__, __bool__, __add__, __iadd__, __reduce__). The __class_getitem__ method is correctly annotated as #[pyclassmethod] for class-level generic typing support.


499-537: LGTM! Sequence trait implementation updated consistently.

The AsSequence trait implementation correctly calls the renamed dunder methods (__len__(), __mul__(), __getitem__(), __setitem__(), __delitem__(), __imul__()) in all its function mappings, maintaining consistency with the method renames.


631-717: LGTM! Iterator classes updated with dunder method naming.

Both PyDequeIterator and PyReverseDequeIterator are properly updated with dunder method names (__length_hint__, __reduce__) and their internal calls use the renamed methods (__len__(), __reversed__()), maintaining consistency throughout the iterator implementations.

vm/src/builtins/builtin_func.rs (2)

78-130: LGTM! Builtin function attributes standardized to dunder forms.

All special attributes and methods in PyNativeFunction are correctly renamed to their canonical Python forms (__module__, __name__, __qualname__, __doc__, __reduce__, __reduce_ex__, __text_signature__) while removing the magic attribute from annotations. This improves code clarity and follows Python conventions.


154-176: LGTM! PyNativeMethod updated consistently with dunder naming.

The PyNativeMethod class properly adopts the dunder naming convention for __qualname__ and __reduce__, maintaining consistency with the broader refactoring effort across builtin types.

vm/src/builtins/str.rs (7)

286-307: Magic-method renaming looks correct & keeps iterator semantics intact

__length_hint__, __setstate__, and __reduce__ are now exposed with their canonical dunder names and their bodies are unchanged, so behaviour as observed by user-code is preserved.
No issues spotted.


605-608: __sizeof__ omission is acceptable but document the deviation

CPython reports sys.getsizeof('') == 49 (64-bit) because it includes allocator
overhead and the implicit trailing nul.
Here we only return size_of::<Self>() + len, which will under-report.
That’s fine for RustPython, but worth a doc-comment so users don’t assume parity.


611-614: Alias strategy for __mul__ / __rmul__ is neat

Exposing the same body twice with #[pymethod(name = "__rmul__")] keeps code DRY
and fully matches CPython semantics.
Nicely done.


923-926: Correct CPython behaviour: return NotImplemented from __rmod__

CPython also returns NotImplemented for the RHS % on strings; implementation matches.


1434-1437: __getnewargs__ keeps pickling compatibility

Returning a 1-tuple of the underlying UTF-8 data is exactly what the pickle
protocol expects for str.


1456-1461: __str__ preserves subclass identity when possible

Using into_exact_or ensures subclasses don’t get collapsed to base str
unnecessarily. Good call.


1553-1555: Direct call to PyStr::__add__ matches CPython C-API semantics

PySequenceMethods::concat in CPython bypasses overridden __add__; your direct
Rust call does the same so behaviour is faithful.

vm/src/exceptions.rs (4)

97-97: LGTM: Exception accessor calls updated to use dunder methods.

The internal calls to exception properties have been correctly updated to use the new dunder method names (__cause__, __context__, __traceback__), maintaining consistency with the refactored method definitions.

Also applies to: 104-104, 135-135, 313-313


581-627: LGTM: Exception property methods properly renamed to dunder equivalents.

The exception property getters and setters have been correctly refactored:

  • Removed magic attributes from #[pygetset] annotations
  • Renamed methods to explicit dunder forms (__traceback__, __cause__, __context__)
  • Renamed setters with triple underscores (set___traceback__, set___cause__, set___context__)

This standardizes the naming convention and aligns with Python's canonical method naming.


639-683: LGTM: Base exception magic methods correctly refactored.

The magic methods have been properly updated:

  • Removed magic attribute from #[pymethod] annotations
  • Renamed methods to explicit dunder forms (__str__, __reduce__, __setstate__)
  • Functionality and logic remain unchanged

This aligns with the PR objective of standardizing Python special method naming.


1361-1374: LGTM: Exception type magic methods systematically refactored.

All exception type magic methods have been consistently updated across the types module:

  • Removed magic attributes from method annotations
  • Renamed methods to explicit dunder forms (__reduce__, __str__)
  • Internal calls to base exception methods updated to use dunder names (e.g., exc.__str__(vm))

The refactoring maintains consistency across all exception types and preserves the original functionality.

Also applies to: 1395-1406, 1482-1548, 1680-1725, 1798-1822, 1848-1873, 1898-1919

vm/src/builtins/tuple.rs (3)

231-348: LGTM: Tuple magic methods systematically refactored to dunder names.

All tuple magic methods have been correctly updated:

  • Removed magic attributes from #[pymethod] and #[pyclassmethod] annotations
  • Renamed methods to explicit dunder forms (__add__, __bool__, __len__, __mul__, __getitem__, __contains__, __getnewargs__, __class_getitem__)
  • Functionality and method signatures remain unchanged

This standardizes the naming convention and improves code clarity by making Python special methods explicit.


367-370: LGTM: AsSequence trait updated to call renamed methods.

The trait implementation has been correctly updated to call the renamed dunder methods (__len__, __add__), maintaining consistency with the refactored method names.


467-484: LGTM: Tuple iterator magic methods consistently refactored.

The PyTupleIterator magic methods have been properly updated:

  • Removed magic attributes from #[pymethod] annotations
  • Renamed methods to explicit dunder forms (__length_hint__, __setstate__, __reduce__)

This maintains consistency with the broader refactoring effort across the tuple module.

vm/src/builtins/range.rs (8)

228-262: LGTM: Explicit dunder method naming

The transition from #[pymethod(magic)] with shorthand name reversed to #[pymethod] with explicit __reversed__ name improves code clarity and follows Python's special method conventions. The internal call to __len__() is also correctly updated.


264-267: LGTM: Standard magic method rename

Correctly renames the length method to its explicit Python dunder name __len__.


269-272: LGTM: Boolean magic method rename

Correctly renames the boolean conversion method to its explicit Python dunder name __bool__.


274-310: LGTM: Pickling and item access methods

Both __reduce__ and __getitem__ method renames are correct and follow Python's special method conventions for object serialization and item access respectively.


340-343: LGTM: Container membership method

Correctly renames the containment check method to its explicit Python dunder name __contains__.


380-380: LGTM: Updated internal method calls

Internal method calls are correctly updated to use the new dunder method names (__len__() and __getitem__()), maintaining consistency with the renamed methods.

Also applies to: 393-393, 477-477


543-568: LGTM: Iterator magic methods for PyLongRangeIterator

All magic method renames (__length_hint__, __setstate__, __reduce__) are correctly implemented with explicit dunder names and proper attribute changes.


608-630: LGTM: Iterator magic methods for PyRangeIterator

Consistent magic method renames for the range iterator class, maintaining the same pattern as the long range iterator.

vm/src/types/slot.rs (4)

899-907: LGTM: Descriptor protocol method

Correctly renames the descriptor get method to its explicit Python dunder name __get__, improving consistency with Python's descriptor protocol.


1025-1077: LGTM: Rich comparison protocol methods

All comparison methods are correctly renamed to their explicit Python dunder equivalents (__eq__, __ne__, __lt__, __le__, __ge__, __gt__). This improves consistency with Python's rich comparison protocol.


1191-1194: LGTM: Attribute access method

Correctly renames the attribute getter method to its explicit Python dunder name __getattribute__.


1221-1235: LGTM: Attribute modification methods

Both __setattr__ and __delattr__ method renames are correct and follow Python's attribute access protocol for setting and deleting attributes.

vm/src/builtins/bytes.rs (5)

149-152: LGTM: Core sequence protocol methods

All fundamental sequence magic methods (__len__, __sizeof__, __contains__, __getitem__) are correctly renamed to their explicit Python dunder equivalents, improving consistency with Python's sequence protocol.

Also applies to: 164-167, 174-181, 188-191


169-172: LGTM: Arithmetic and special methods

Arithmetic operations (__add__, __mul__, __rmod__) and pickling support (__getnewargs__) methods are correctly renamed to their explicit Python dunder names.

Also applies to: 462-465, 473-476, 478-482


487-504: LGTM: Pickling and conversion methods

Pickling methods (__reduce_ex__, __reduce__) and type conversion (__bytes__) are correctly renamed. The internal call update on line 493 to use __reduce__() maintains consistency.

Also applies to: 509-516


607-607: LGTM: Updated protocol implementation

Internal call correctly updated to use the renamed __contains__() method, maintaining consistency with the method renames.


693-710: LGTM: Iterator magic methods

Iterator magic methods (__length_hint__, __reduce__, __setstate__) are correctly renamed to their explicit Python dunder names, maintaining consistency with the main bytes class.

vm/src/builtins/complex.rs (3)

258-268: LGTM: Arithmetic magic methods

All arithmetic magic methods (__abs__, __add__, __sub__, __rsub__, __mul__, __truediv__, __rtruediv__) are correctly renamed to their explicit Python dunder equivalents, following Python's numeric protocol for complex number operations.

Also applies to: 287-312, 320-345


347-355: LGTM: Unary and power operations

Unary operations (__pos__, __neg__) and power operations (__pow__, __rpow__) are correctly renamed to their explicit Python dunder names, maintaining the numeric protocol implementation.

Also applies to: 357-378


380-383: LGTM: Type conversion and special methods

Type conversion methods (__bool__, __complex__) and pickling support (__getnewargs__) are correctly renamed to their explicit Python dunder names, completing the comprehensive magic method refactoring for complex numbers.

Also applies to: 385-389, 394-401

vm/src/builtins/list.rs (8)

145-148: LGTM: Consistent magic method naming

The renaming from add to __add__ with removal of the magic attribute follows the project's standardization to explicit dunder method names.


160-169: LGTM: Consistent in-place addition method naming

The __iadd__ method renaming and implementation are correct and consistent with the refactoring pattern.


182-185: LGTM: Standard length method implementation

The renaming to __len__ properly exposes Python's length protocol method.


198-204: LGTM: Reversed iterator with updated internal call

The method renaming to __reversed__ and the internal call update on line 200 (zelf.__len__()) are both consistent with the refactoring.


216-219: LGTM: Indexing protocol methods properly renamed

The __getitem__, __setitem__, and __delitem__ method renamings correctly implement Python's indexing protocol.

Also applies to: 231-239, 315-318


241-250: LGTM: Multiplication methods consistently renamed

Both __mul__ and __imul__ method renamings follow the correct Python dunder naming convention.


404-404: LGTM: Internal calls updated consistently

All internal calls to __len__() in mapping/sequence implementations and repr method are correctly updated to use the new method name.

Also applies to: 424-424, 496-496


548-551: LGTM: Iterator methods consistently renamed

The iterator methods __length_hint__, __setstate__, and __reduce__ are properly renamed, and internal calls to __len__() on lines 550, 557, 595, and 602 are correctly updated.

Also applies to: 553-558, 593-596, 598-603, 605-610

vm/src/builtins/function.rs (4)

389-401: LGTM: Function attributes consistently renamed to dunder form

All function attributes (__code__, __defaults__, __kwdefaults__, __name__, __module__, __annotations__, __qualname__, __type_params__) are properly renamed with the magic attribute removed. The setter methods follow the correct naming pattern.

Also applies to: 403-410, 435-443, 465-473, 475-483, 485-504, 506-526


148-148: LGTM: Internal calls and error messages updated

All references to self.__qualname__() in error messages and self.__name__() in generator/coroutine creation are correctly updated to use the new dunder method names.

Also applies to: 183-183, 195-195, 203-203, 260-260, 365-365, 366-366, 367-367


529-539: LGTM: JIT method properly renamed

The __jit__ method renaming is consistent with the refactoring pattern and maintains the correct functionality.


572-572: LGTM: Bound method dunder methods consistently implemented

The __reduce__, __doc__, __func__, __module__, and __qualname__ methods for PyBoundMethod are properly renamed and implemented.

Also applies to: 739-748, 750-758, 765-771

vm/src/builtins/object.rs (5)

250-267: LGTM: Comparison methods properly renamed

All comparison methods (__eq__, __ne__, __lt__, __le__, __ge__, __gt__) are correctly renamed from their magic attribute form to explicit dunder names.

Also applies to: 270-287, 290-307


337-341: LGTM: Core object methods consistently renamed

The __str__, __repr__, __subclasshook__, __init_subclass__, __dir__, __format__, and __init__ methods are all properly renamed with the magic attribute removed.

Also applies to: 374-377, 379-382, 384-385, 387-390, 392-405, 407-411


138-138: LGTM: Internal calls updated to use dunder methods

The calls to slot_names.__len__() on lines 138 and 148 are correctly updated to use the new method name instead of the len() property.

Also applies to: 148-148


347-355: LGTM: Slot repr implementation updated

The calls to class.__qualname__(vm) and class.__module__(vm) are correctly updated to use the new dunder method names.


457-460: LGTM: Attribute and reduction methods renamed

The __getattribute__, __reduce__, __reduce_ex__, __hash__, and __sizeof__ methods are all properly renamed following the consistent pattern.

Also applies to: 462-465, 467-479, 487-490, 492-495

vm/src/builtins/bytearray.rs (6)

203-211: LGTM: Core bytearray methods consistently renamed

All core methods (__alloc__, __len__, __sizeof__, __add__, __contains__, __iadd__, __getitem__, __delitem__) are properly renamed from their magic attribute form to explicit dunder names.

Also applies to: 213-216, 218-221, 223-230, 232-242, 244-247, 249-252


548-551: LGTM: Arithmetic and item assignment methods renamed

The __mul__, __imul__, __rmod__, and __setitem__ methods are correctly renamed following the consistent pattern.

Also applies to: 553-557, 565-568, 578-586


641-648: LGTM: Pickle protocol methods consistently implemented

The __reduce_ex__ and __reduce__ methods are properly renamed, with the internal call on line 647 correctly updated.

Also applies to: 650-658


756-756: LGTM: Buffer implementation updated

The call to zelf.__len__() in the buffer descriptor creation is correctly updated to use the new method name.


774-776: LGTM: Protocol implementations consistently updated

All protocol method calls in AsMapping and AsSequence implementations are correctly updated to use the new dunder method names (__len__(), __getitem__(), __setitem__(), __delitem__(), __contains__(), __iadd__()).

Also applies to: 778-778, 783-783, 785-785, 796-796, 825-825, 830-830


894-897: LGTM: Iterator methods consistently renamed

The iterator methods __length_hint__, __reduce__, and __setstate__ are properly renamed, with internal calls to __len__() correctly updated on lines 896 and 909.

Also applies to: 898-903, 905-910

stdlib/src/array.rs (11)

910-910: LGTM: Consistent use of dunder method naming

The call to self.__len__() is consistent with the refactoring to use explicit dunder method names throughout the codebase.


979-987: Excellent refactoring of copy methods to explicit dunder names

The transformation from #[pymethod(magic)] fn copy to #[pymethod] fn __copy__ and similar for __deepcopy__ follows Python's standard magic method conventions. The internal call from __deepcopy__ to self.__copy__() is correctly updated.


989-999: Good refactoring of item access methods

The renaming from _getitem to getitem_inner and the explicit __getitem__ magic method wrapper follows a clear pattern that separates the internal implementation from the Python-exposed magic method.


1001-1046: Consistent refactoring of setitem implementation

The pattern of renaming internal methods to *_inner and creating explicit dunder magic method wrappers is applied consistently. The __setitem__ method properly delegates to setitem_inner.


1048-1058: Well-structured delitem refactoring

The same consistent pattern is applied to delitem - internal logic in delitem_inner with explicit __delitem__ magic method wrapper.


1060-1105: Comprehensive arithmetic method refactoring

All arithmetic magic methods (__add__, __iadd__, __mul__, __imul__) are consistently renamed from their short forms to explicit dunder names while preserving functionality.


1107-1110: Proper len method conversion

The conversion from len to __len__ maintains the pub(crate) visibility, indicating this method is used both as a Python magic method and internally by the Rust code.


1136-1180: Well-executed pickle method refactoring

Both __reduce_ex__ and __reduce__ are properly renamed and the internal call from __reduce_ex__ to Self::__reduce__ is correctly updated.


1182-1197: Consistent contains method refactoring

The contains method is properly renamed to __contains__ following the same pattern as other magic methods.


1306-1362: Trait implementations correctly updated

All trait implementations (AsMapping and AsSequence) are properly updated to use the new method names: __len__(), getitem_inner, setitem_inner, delitem_inner, __add__, __mul__, __contains__, __iadd__, and __imul__.


1395-1407: Iterator methods properly refactored

The iterator's __setstate__ and __reduce__ methods are consistently renamed and the internal call to obj.__len__() is correctly updated.

vm/src/builtins/float.rs (6)

207-230: Excellent conversion of format methods to explicit dunder names

Both __format__ and __getformat__ are properly converted from their magic attribute forms to explicit dunder method names. The #[pystaticmethod] attribute is correctly used for __getformat__.


232-235: Proper abs method conversion

The abs method is correctly renamed to __abs__ following Python's magic method conventions.


281-406: Comprehensive arithmetic method refactoring

All arithmetic magic methods are systematically converted to explicit dunder names: __add__, __bool__, __divmod__, __rdivmod__, __floordiv__, __rfloordiv__, __rmod__, __pos__, __neg__, __pow__, __rpow__, __sub__, __rsub__, __truediv__, __rtruediv__, and __mul__. The functionality is preserved while making the naming explicit.


408-451: Well-executed numeric conversion method refactoring

The numeric conversion and rounding methods (__trunc__, __floor__, __ceil__, __round__) are consistently renamed to their dunder equivalents while maintaining all the complex rounding logic.


453-461: Correct type conversion method updates

Both __int__ and __float__ are properly renamed, and the internal call in __int__ is correctly updated to use self.__trunc__(vm).


512-515: Proper getnewargs method conversion

The getnewargs method is correctly renamed to __getnewargs__ following the same pattern as all other magic methods.

vm/src/builtins/dict.rs (10)

192-192: LGTM: Consistent method call update

The call to __setitem__ correctly uses the renamed dunder method name.


205-208: LGTM: Proper magic method renaming

The method is correctly renamed from len to __len__ with the magic attribute removed from the decorator. This makes the Python special method name explicit.


215-218: LGTM: Consistent dunder method implementation

The __contains__ method properly follows the dunder naming convention and removes the magic attribute.


220-223: LGTM: Proper __delitem__ implementation

The method is correctly renamed to use the explicit Python dunder name.


230-238: LGTM: Explicit __setitem__ method

The method signature and naming follow Python's data model conventions correctly.


287-296: LGTM: Comprehensive magic method renaming

All the binary operation methods (__or__, __getitem__, __reversed__, __ior__, __ror__) are properly renamed to their explicit dunder equivalents with consistent decorator updates.

Also applies to: 368-372, 392-395, 397-401, 403-412


432-432: LGTM: Updated internal method calls

All internal calls to magic methods are correctly updated to use the new dunder names (__len__, __or__, __ior__).

Also applies to: 466-466, 473-476


743-750: LGTM: DictView trait method updates

The trait methods __len__ and __reversed__ are properly renamed with consistent decorator changes.

Also applies to: 778-780


840-843: LGTM: Iterator method renaming

The iterator special methods __length_hint__ and __reduce__ are correctly renamed to their dunder equivalents across all iterator classes.

Also applies to: 846-858, 916-929, 931-936


1026-1027: LGTM: Set operation methods

All set operation magic methods (__xor__, __and__, __or__, __sub__, __rsub__) are properly renamed with the magic attribute removed.

Also applies to: 1034-1035, 1042-1043, 1049-1050, 1056-1057

vm/src/builtins/type.rs (10)

479-488: LGTM: Type property getters renamed

The type properties (__bases__, __base__, __flags__, __basicsize__) are correctly renamed to their explicit dunder equivalents with proper decorator updates.

Also applies to: 544-547, 549-552, 554-557


577-592: LGTM: __qualname__ property implementation

Both the getter and setter methods for __qualname__ are properly renamed with consistent naming conventions (set___qualname__).

Also applies to: 594-620


622-674: LGTM: __annotations__ property methods

The getter and setter methods for __annotations__ follow the correct dunder naming pattern.


676-698: LGTM: Module and class methods renamed

The __module__, __prepare__, and __subclasses__ methods are properly renamed to their dunder equivalents.

Also applies to: 700-709, 711-721


723-731: LGTM: Binary operation and dict methods

The __ror__, __or__, and __dict__ methods are correctly renamed with proper decorator updates.

Also applies to: 733-743


761-778: LGTM: Name and signature properties

The set___name__ setter and __text_signature__ getter are properly renamed following the dunder convention.

Also applies to: 780-786


1029-1029: LGTM: Exception handling call update

The call to set___cause__ correctly uses the renamed exception attribute setter method.


1140-1187: LGTM: Documentation property methods

Both the __doc__ getter and set___doc__ setter are properly implemented with the dunder naming convention.


1189-1212: LGTM: Type introspection methods

The methods __dir__, __instancecheck__, __subclasscheck__, and __subclasshook__ are correctly renamed to their dunder equivalents.


1292-1292: LGTM: Updated method calls

All internal calls to the renamed methods (__module__, __qualname__, __basicsize__) are correctly updated.

Also applies to: 1301-1301, 1479-1479

vm/src/stdlib/itertools.rs (4)

65-72: LGTM: Excellent systematic refactoring of magic method naming.

The renaming of class_getitem to __class_getitem__ and removal of the magic attribute makes the Python special method explicit and aligns perfectly with Python's dunder naming conventions.


74-88: Well-executed standardization of __reduce__ method.

The explicit naming of the pickle reduction method follows Python conventions perfectly. The logic remains unchanged while improving code readability and explicitness.


90-119: Consistent and correct __setstate__ implementation.

The renaming maintains the exact same functionality while making the pickle state restoration method explicitly named according to Python standards.


204-210: Comprehensive and systematic magic method standardization.

This refactoring systematically renames all Python special methods across multiple iterator classes to their canonical dunder forms:

  • reduce__reduce__
  • setstate__setstate__
  • length_hint__length_hint__
  • copy__copy__

The changes are consistent, maintain all existing functionality, and significantly improve code explicitness by removing the magic attribute flag in favor of explicit Python dunder naming conventions.

Also applies to: 277-280, 398-415, 477-483, 542-560, 629-647, 966-993, 1063-1069, 1133-1182, 1306-1312, 1393-1443, 1528-1554, 1769-1775, 1882-1904

vm/src/builtins/set.rs (5)

545-548: Excellent systematic refactoring of PySet magic methods.

The comprehensive renaming of magic methods to their canonical Python dunder forms significantly improves code explicitness:

  • len__len__
  • contains__contains__
  • or__or__
  • and__and__
  • sub__sub__
  • reduce__reduce__
  • class_getitem__class_getitem__

All functionality is preserved while removing the implicit magic attribute in favor of explicit Python naming conventions.

Also applies to: 562-565, 607-618, 621-636, 638-653, 655-670, 673-688, 717-721, 741-746, 754-759, 772-777, 779-785, 787-790


810-810: Well-updated trait implementations with new dunder method calls.

The AsSequence and AsNumber trait implementations have been properly updated to call the new dunder method names (e.g., a.__sub__(...), a.__and__(...), etc.), maintaining consistency with the renamed methods.

Also applies to: 844-844, 851-851, 858-858, 865-865, 872-872, 880-880, 888-888, 896-896


971-974: Consistent refactoring applied to PyFrozenSet.

The same systematic approach is correctly applied to PyFrozenSet, ensuring consistency across both mutable and immutable set implementations. All magic methods follow the same dunder naming pattern.

Also applies to: 994-997, 1039-1050, 1053-1068, 1070-1085, 1087-1103, 1106-1121, 1123-1129, 1131-1134


1140-1140: Proper trait implementation updates for PyFrozenSet.

The AsSequence and AsNumber trait implementations for PyFrozenSet are correctly updated to use the new dunder method names, maintaining consistency with the PySet implementation.

Also applies to: 1197-1197, 1204-1204, 1211-1211, 1218-1218


1305-1308: Complete coverage with PySetIterator updates.

The refactoring extends to PySetIterator with proper __length_hint__ and __reduce__ method naming, ensuring comprehensive coverage of all Python special methods in the set module.

Also applies to: 1310-1327

vm/src/stdlib/typing.rs (6)

72-156: LGTM: Proper conversion to explicit dunder method naming

The systematic conversion of magic methods to explicit dunder names is correctly implemented:

  • #[pymethod(magic)]#[pymethod]
  • #[pygetset(magic)]#[pygetset]
  • Method names explicitly use dunder notation (e.g., __mro_entries__, __name__, __reduce__)

This aligns with Python's data model and improves code clarity.


347-461: LGTM: Consistent dunder method naming for ParamSpec

The conversion follows the same correct pattern as other classes, with proper removal of magic attributes and explicit dunder method naming.


575-578: LGTM: Correct dunder method naming for NoDefault

The __reduce__ method conversion is properly implemented.


612-667: LGTM: TypeVarTuple dunder method conversion

All method renamings and decorator updates are correctly applied following the established pattern.


748-836: LGTM: ParamSpecArgs and ParamSpecKwargs dunder methods

The conversion of __mro_entries__ and __origin__ methods follows the correct pattern with proper decorator updates.


932-939: LGTM: Generic class method conversion

The __class_getitem__ class method is correctly converted to explicit dunder naming while maintaining the proper #[pyclassmethod] decorator.

vm/src/builtins/int.rs (5)

324-481: LGTM: Arithmetic method conversion to explicit dunder naming

The systematic conversion of arithmetic methods (__add__, __sub__, __mul__, __truediv__, etc.) correctly removes magic attributes and uses explicit dunder method names. The pattern is consistent throughout all arithmetic operations.


484-586: LGTM: Special method conversion

All unary and special methods are correctly converted to explicit dunder naming with proper decorator updates.


548-548: LGTM: Internal method call updates

The internal calls are correctly updated to use the new dunder method names (__int__) instead of the old plain names (int), maintaining consistency with the renamed methods.

Also applies to: 553-553, 558-558, 563-563, 600-600, 669-669, 679-679


694-697: LGTM: __getnewargs__ method conversion

The conversion follows the established pattern correctly.


702-708: LGTM: PyRef implementation consistency

The __int__ method in the PyRef implementation is correctly updated to maintain consistency with the overall dunder method naming pattern.

@youknowone youknowone force-pushed the magic-method-names branch 2 times, most recently from bef21a3 to ece5c75 Compare June 27, 2025 03:13
@youknowone youknowone force-pushed the magic-method-names branch from ece5c75 to 3673372 Compare June 27, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant