Skip to content

[3.6] bpo-29581: Make __init_subclass__ work on ABCMeta type classes #1282

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 5 commits into from
Jun 7, 2017

Conversation

Soares
Copy link
Contributor

@Soares Soares commented Apr 25, 2017

I'm not entirely sure that I used the cherry_pick tool correctly, please make sure that I didn't muck anything up.

I'm also planning to backport PR #678, which depends on this backport (of PR #527). I assume that I shouldn't begin that backport until this one is accepted, but let me know if I can begin cherry-picking #678 now.

Nate added 2 commits April 25, 2017 09:13
…#527)

Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item

Note: I'm not sure I backported the NEWS changes correctly; I'm
assuming that the cherry_picker tool merged everything corectly except
for the explicit merge conflicts, but I'm not sure this is true.

(cherry picked from commit bd583ef)
…ythonGH-527)

Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item.
(cherry picked from commit bd583ef)
@Mariatta
Copy link
Member

Sorry with the confusion of how to use cherry_picker.py.

I suppose you were following the instruction here, which mentions about merging with master first. This section is not up to date, and
there is an outstanding issue in the devguide about it.

Once you have cherry_picker.py you'll only need to do python -m cherry_picker <sha1> 3.6.
In case there is a merge conflict, you'll need to resolve it manually (I use Resolve Conflict from within Pycharm), and then do python -m cherry_picker --continue

Hope this helps a bit :)

If you want, I can do the backport for you later today.

@Mariatta Mariatta changed the base branch from master to 3.6 April 25, 2017 17:28
@Mariatta
Copy link
Member

Nvm, I changed the base branch to 3.6 instead of master 😅 Looks better now

@Soares
Copy link
Contributor Author

Soares commented May 31, 2017

Bump. What do I need to do to cause this backport to happen?

@Mariatta
Copy link
Member

Mariatta commented Jun 6, 2017

Sorry this fell off my radar.
Can you please resolve the conflict? After that this is good to go. Thanks :)

@Soares
Copy link
Contributor Author

Soares commented Jun 6, 2017

Conflict resolved. Thanks!

@Mariatta
Copy link
Member

Mariatta commented Jun 6, 2017

Travis build failed.. 🤔

Misc/NEWS Outdated
@@ -45,6 +45,9 @@ Core and Builtins
Library
-------

- bpo-29581: ABCMeta.__new__ now accepts **kwargs, allowing abstract base
Copy link
Member

Choose a reason for hiding this comment

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

Instead of

**kwargs

, can you try

``kwargs``

That might fix it for travis.

@Mariatta
Copy link
Member

Mariatta commented Jun 7, 2017

Thanks 🎉

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.

4 participants