Skip to content

tests/cpydiff/core_class: Document issue with super in classmethod.#15509

Closed
AJMansfield wants to merge 1 commit intomicropython:masterfrom
AJMansfield:super-classmethod
Closed

tests/cpydiff/core_class: Document issue with super in classmethod.#15509
AJMansfield wants to merge 1 commit intomicropython:masterfrom
AJMansfield:super-classmethod

Conversation

@AJMansfield
Copy link
Copy Markdown
Member

@AJMansfield AJMansfield commented Jul 20, 2024

Summary

This documents an existing problem with the way super() is implemented that became evident while I was implementing __init_subclass__, where when used inside a classmethod it defers to the ancestor of the class object itself (i.e. type), rather than parent classes it inherits from.

This is probably an issue with super itself not treating the second argument differently when its a type in the way that CPython does.

Testing

I've verified this against CPython versions 3.8, 3.10, and 3.12.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (a734ee9) to head (ebbdde6).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15509   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files         161      161           
  Lines       21252    21252           
=======================================
  Hits        20918    20918           
  Misses        334      334           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dpgeorge
Copy link
Copy Markdown
Member

Thanks for the test case / report.

I was curious about why the difference existed, and upon investigating managed to fix it. See #15533.

@AJMansfield AJMansfield deleted the super-classmethod branch July 24, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Relates to tests/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants