Skip to content

Conversation

damusss
Copy link
Member

@damusss damusss commented Oct 8, 2025

I'm splitting #3455 . This PR handles the remaining small clarifications and typos. The locking functions and the _pixels_address property are also moved at the end of the file with no changes.

@damusss damusss requested a review from a team as a code owner October 8, 2025 08:39
@damusss damusss added docs Surface pygame.Surface labels Oct 8, 2025
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

📝 Walkthrough

Walkthrough

Adds a public read-only _pixels_address property to the Surface stubs and refines multiple Surface docstrings and return/parameter semantics (blit/fblits returns, dest Rect handling, copy/get_abs_parent/get_alpha behavior and related wording/typo fixes).

Changes

Cohort / File(s) Summary
Surface stubs
buildconfig/stubs/pygame/surface.pyi
Added public @property def _pixels_address(self) -> int with docstring; corrected typos and refined wording across many Surface method docstrings; clarified blit() dest Rect behavior; updated blits()/fblits() return notes; expanded get_alpha() and get_abs_parent() semantics and copy()/subsurface descriptions; adjusted related pixel-locking/API doc placements.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App
  participant Surface

  Note over Surface: New public read-only\nproperty `_pixels_address`

  App->>Surface: read _pixels_address
  Surface-->>App: int (pixel buffer start address)

  App->>Surface: lock()/unlock()/mustlock()
  Surface-->>App: lock state change

  App->>Surface: blit()/blits()/fblits()
  alt fblits may return None
    Surface-->>App: performs blit (returns surfaces or None)
  else blits/fblits return list
    Surface-->>App: returns blit results list
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Starbuck5
  • aatle

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the primary updates by indicating that it is the third cleanup of Surface documentation, covering minor clarifications, typo corrections, and the relocation of functions and properties without introducing unrelated details.
Description Check ✅ Passed The description directly references splitting the previous PR, details the scope of small clarifications and typo fixes, and notes the relocation of the locking functions and the _pixels_address property, aligning clearly with the actual changes.
Docstring Coverage ✅ Passed Docstring coverage is 92.31% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eade6d5 and 4185490.

📒 Files selected for processing (1)
  • buildconfig/stubs/pygame/surface.pyi (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • buildconfig/stubs/pygame/surface.pyi
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: AMD64
  • GitHub Check: x86
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: Debian (Bookworm - 12) [armv7]
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
  • GitHub Check: i686
  • GitHub Check: dev-check
  • GitHub Check: aarch64
  • GitHub Check: x86_64
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.9.23)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-24.04)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Starbuck5
Copy link
Member

Can you explain why you moved the locking functions / pixel address around?

@damusss
Copy link
Member Author

damusss commented Oct 9, 2025

Can you explain why you moved the locking functions / pixel address around?

This PR just does what I did in the original, so I'll try to explain my past self:
All the locking methods seemed kind of useless so I thought of slapping them to the bottom. But I'm pretty sure things are added in the docs in chronological order, so it might not be the best idea looking at it now, although there are other parts of the docs where methods are added where they make sense and not just at the end.
The property, it's because inside classes you usually put properties with properties and methods with methods. made sense to put it among other properties, at the bottom since it's private. If we want to keep a chronological order this change wouldn't make sense.
I'll move the locking methods back and will wait your opinion on the property.

Copy link
Contributor

@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 (2)
buildconfig/stubs/pygame/surface.pyi (2)

274-274: Clarify "regular blitting" reference.

The phrase "unlike regular blitting" is somewhat vague. Consider specifying "unlike blit() and blits()" for clarity.

Apply this diff:

-        :returns: ``None`` (unlike regular blitting)
+        :returns: ``None`` (unlike `blit()` and `blits()`)

344-346: Consider present tense for consistency.

The clarification about subsurface behavior is helpful and accurate. However, for consistency with other docstrings in this file (e.g., get_abs_parent() at line 717), consider using present tense.

Apply this diff:

-        If the Surface was a subsurface, the returned Surface will *not* retain
-        the parent and will be a regular Surface with its own pixel data.
+        If this Surface is a subsurface, the returned Surface will *not* retain
+        the parent and will instead be a regular Surface with its own pixel data.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4afd45d and eade6d5.

⛔ Files ignored due to path filters (1)
  • src_c/doc/surface_doc.h is excluded by !src_c/doc/*
📒 Files selected for processing (1)
  • buildconfig/stubs/pygame/surface.pyi (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
  • GitHub Check: build (macos-14)
  • GitHub Check: dev-check
  • GitHub Check: aarch64
  • GitHub Check: x86
  • GitHub Check: AMD64
🔇 Additional comments (5)
buildconfig/stubs/pygame/surface.pyi (5)

153-153: Typo fix looks good.

The correction from "blittting" to "blitting" is accurate.


442-450: Documentation improvements look good.

The reformatting improves readability, and the version change note provides helpful context.


456-458: Enhanced documentation is clear and helpful.

The expanded description of the return value is accurate and provides useful detail about the range and None case.


716-717: Clearer and more precise wording.

The clarification improves understanding of the method's behavior in both subsurface and non-subsurface cases.


1047-1054: Verify public API status for underscore-prefixed property.

The _pixels_address property starts with an underscore, which conventionally indicates a private/internal API in Python. However, it's being added to the public stub file and marked as available since version 1.9.2, suggesting it's been part of the public API for a long time.

Can you confirm this is intentionally public API despite the naming convention? If so, the addition to the stubs is appropriate. If it's actually private, consider whether it should be exposed in the public stub file.

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

Labels

docs Surface pygame.Surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants