Skip to content
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

bpo-15450: Allow subclassing of dircmp #5088

Closed
wants to merge 1 commit into from
Closed

Conversation

mitar
Copy link

@mitar mitar commented Jan 3, 2018

Current implementation of dircmp does not really allow subclassing because it calls itself recursively.

https://bugs.python.org/issue15450

@mitar
Copy link
Author

mitar commented Jan 3, 2018

Hm, one also has to update methodmap for subclassing to work. But at least you can do this from outside.

@asvetlov
Copy link
Contributor

asvetlov commented Jan 3, 2018

I doubt if the Pull Request will be accepted without issue on bugs.python.org and unit test.

@mitar
Copy link
Author

mitar commented Jan 3, 2018

I have found this issue: https://bugs.python.org/issue15450

@asvetlov asvetlov changed the title Allow subclassing of dircmp bpo-15450: Allow subclassing of dircmp Jan 3, 2018
@asvetlov
Copy link
Contributor

asvetlov commented Jan 3, 2018

Unittests are required as well

@mitar
Copy link
Author

mitar commented Jan 3, 2018

Even if change is completely semantically the same?

@asvetlov
Copy link
Contributor

asvetlov commented Jan 3, 2018

You are adding a new behavior.
The behavior should be explicitly tested.
Otherwise nobody can guarantee that inheritance works, isn't it?

@mitar
Copy link
Author

mitar commented Jan 3, 2018

I mean, this just allows one to fix it to make it work. But if we really want to make this work properly, we should probably get rid of the whole methodmap construct and get normal methods there which call internal phase methods. Then it is easy to subclass. Currently this PR just allows one to subclass at all, but I would not recommend that the current chaos of subclassing is something officially supported.

@asvetlov
Copy link
Contributor

asvetlov commented Jan 3, 2018

Thus PR is not full. Please go forward and implement the requested feature.

@mitar
Copy link
Author

mitar commented Jan 3, 2018

Can I refactor the class to not use methodmap? Would that be something accepted?

@asvetlov
Copy link
Contributor

asvetlov commented Jan 3, 2018

Don't know, I not involved into the problem.
Maybe @cjerdonek is better person for review.
But code changes without new/updated tests have almost zero chance for merging, sure.

@cjerdonek
Copy link
Member

Thanks, @asvetlov. The patch I posted long ago on the tracker is probably a better start. I included not just the change, but also a failing test and documentation changes.

@NickCrews
Copy link
Contributor

@cjerdonek I ported over your old patch and submitted a PR at #23424 if you want to take a look. Thanks for your work!

@asvetlov
Copy link
Contributor

Closing, #23424 should land.

@asvetlov asvetlov closed this Nov 22, 2020
@mitar
Copy link
Author

mitar commented Nov 23, 2020

@NickCrews Thanks.

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

Successfully merging this pull request may close these issues.

6 participants