* status: new => closed
* resolution: => wontfix
Comment:
Adapting `ModeBase.__new__` to play better with `__init_subclass__` and
possibly [https://code.djangoproject.com/ticket/24313 pave the way for
some deprecation] is one thing but maintaining backward compatibility (or
at least providing a bullet proof deprecation path) with the hundreds of
third-party applications that rely on the current implementation is-far
from trivial. For your particular use case to work, that is `cls._meta`
being already present at `__init_subclass__` time, the whole concept of
`add_to_class` would have to be thrown away as `object.__new__` (aka
`super().__new__` in `ModeBase.__new__`) triggers `__init_subclass__`.
That's also the reason why `contribute_to_class` is still relevant today
even if recent versions of Python introduced a `__set_name__` hook that is
a strong contender to replace it.
If you can demonstrate that there is a way to achieve such thing (e.g. a
PoC PR) and that there are strong enough benefits to warrant the burden
this will incur on third party application that have been using `__new__`
for years and might need to be adjusted then I believe you might have a
stronger case than by asking for this request to be adjusted in its
current form.
I'll be closing as ''wontfix'' until it can be demonstrated that this is
somewhat technically achievable at least.
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by hottwaj):
Thanks, I completely agree that this change should not break the existing
API in any way.
Please take a look at proposed fix and test added in this PR:
https://github.com/django/django/pull/16849
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:5>
* status: closed => new
* resolution: wontfix =>
Comment:
As I've added a PoC PR and in case it is needed to continue the process
I'm reopening - hope I'm not generating too much noise :)
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:6>
* status: new => closed
* resolution: => wontfix
Comment:
I appreciate you'd like to reopen the ticket, but please
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow the triaging guidelines with regards to
wontfix tickets] and take this to DevelopersMailingList.
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:7>
Comment (by Simon Charette):
Thanks for the PoC, the PR is definitely less invasive than I initially
envisioned so my main concerns are addressed. I do agree with Mariusz that
this should be brought to the scrutiny of the mailing list though to
gather more feedback on the approach and evaluate the appetite of the
community for such a change.
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:8>
Comment (by hottwaj):
Great, thanks Simon & Mariusz. I've sent an email to the mailing list as
requested, think it is just waiting approval, so will wait to hear on
further feedback there. Cheers!
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:9>
Comment (by Carlton Gibson):
Related to is #27880 ''Use `__set_name__` to replace some usages of
contribute_to_class'', I think
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:10>
* cc: Carlton Gibson (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34555#comment:11>