Conversation

sobolevn

cc @ncoghlan, @cdce8p

This brings back two features mentioned in #135368

  • __class__
  • __dataclass_*__ features

Basically, the fix is rather obvious: we just set the proper fields.

__annotations__ has changed due to __annotate__ function, this is not our fault :)

I also have a revert PR ready, if this one is not good enough.

Refs #124429

@python-cla-bot

All commit authors signed the Contributor License Agreement.

CLA signed

@cdce8p

The following commit authors need to sign the Contributor License Agreement:

Not fully sure what's going on there as I've singed the CLA already. There are a handful of merged PRs from me with the same user email, e.g. #130191.

--
This PR should probably also get the backport 3.14 label.

@sobolevnsobolevn added the needs backport to 3.14bugs and security fixeslabel Jun 12, 2025
@zware

Not fully sure what's going on there as I've singed the CLA already. There are a handful of merged PRs from me with the same user email, e.g. #130191.

Because of the way messes with authorship on merges, the CLA also needs to be signed for the noted address (I believe there's an option to tie it to a real address for CLA purposes, but this is an area I'm not that familiar with).

@cdce8p

Because of the way messes with authorship on merges, the CLA also needs to be signed for the noted address (I believe there's an option to tie it to a real address for CLA purposes, but this is an area I'm not that familiar with).

Just clicked on the link above and signed it again although I can even see the Legacy PSF Contributor Agreement there too. Oh well 🤷🏻‍♂️ Should be all good now.

@cjw296cjw296 merged commit c8319a3 into python:main Jun 14, 2025
45 checks passed
@miss-islington-app

Thanks @sobolevn for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 14, 2025
…ythonGH-135421)

* pythongh-135368: Fix mocks on dataclass specs with `instance=True`

* Extend dataclass mock_methods

---------
(cherry picked from commit c8319a3fea9ff7f9b49008be3b5d681112bbe7f3)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
@bedevere-app

GH-135503 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-app bot removed the needs backport to 3.14bugs and security fixeslabel Jun 14, 2025
@cjw296

Did this need to go the 3.13 or earlier too?

@sobolevn

Thank you! No, #124429 was never backported to 3.13, because it was a new feature.

sobolevn added a commit that referenced this pull request Jun 14, 2025
…H-135421) (#135503)

gh-135368: Fix mocks on dataclass specs with `instance=True` (GH-135421)

* gh-135368: Fix mocks on dataclass specs with `instance=True`

* Extend dataclass mock_methods

---------
(cherry picked from commit c8319a3)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.