Skip to content

py/runtime: Fix self arg passed to classmethod when accessed via super. #15533

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

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

dpgeorge
Copy link
Member

Summary

MicroPython was not conforming to CPython behaviour when using super() within a classmethod. This patch fixes this behaviour.

Testing

New test added which did not pass before, but now passes.

Thanks to @AJMansfield for the original test case.

Trade-offs and Alternatives

This increases code size a little bit, but if not fixed it can lead to some very difficult to debug problems, if you even notice there's a problem in the first place.

@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Jul 24, 2024
@dpgeorge
Copy link
Member Author

Won't need #15509 if this is merged.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (07bf317) to head (233f5ce).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15533   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         161      161           
  Lines       21279    21281    +2     
=======================================
+ Hits        20946    20948    +2     
  Misses        333      333           

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

Copy link

github-actions bot commented Jul 24, 2024

Code size report:

   bare-arm:   +12 +0.021% 
minimal x86:   +32 +0.017% 
   unix x64:   +40 +0.005% standard
      stm32:    +8 +0.002% PYBV10
     mimxrt:   +16 +0.004% TEENSY40
        rp2:    +8 +0.001% RPI_PICO_W
       samd:   +16 +0.006% ADAFRUIT_ITSYBITSY_M4_EXPRESS

Thanks to @AJMansfield for the original test case.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the py-fix-super-classmethod-arg branch from da2b739 to 233f5ce Compare July 25, 2024 03:08
@dpgeorge dpgeorge merged commit 233f5ce into micropython:master Jul 25, 2024
63 checks passed
@dpgeorge dpgeorge deleted the py-fix-super-classmethod-arg branch July 25, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
py-core Relates to py/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy