[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f0af69faee902d4b80c07c100dbd528fd8df6832 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.7': bpo-23722: Fix docs for future __classcell__ changes. (GH-6999) (GH-7000)

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f5e7b1999f46e592d42dfab51563ea5411946fb7 by Serhiy Storchaka in branch 'master': bpo-23722: Raise a RuntimeError for absent __classcell__. (GH-6931)

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread miss-islington
miss-islington added the comment: New changeset 10a122c0d55b01b053126ef3fd4d9e05ab8f2372 by Miss Islington (bot) in branch '3.6': bpo-23722: Fix docs for future __classcell__ changes. (GH-6999)

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread miss-islington
Change by miss-islington : -- pull_requests: +6654 ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread miss-islington
Change by miss-islington : -- pull_requests: +6653 ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 8ae8e6af37f29163ee263e293570cb892dc5b5d5 by Serhiy Storchaka in branch 'master': bpo-23722: Fix docs for future __classcell__ changes. (GH-6999)

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6652 ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-19 Thread Nick Coghlan
Nick Coghlan added the comment: I think the reference to RuntimeWarning in the docs is a typo (if it was only going to be a warning, it could have been that from the start), and that reference to RuntimeError in the code comment is correct. So there's also a docs fix to

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: An alternate PR 6933 replaces it with a RuntimeWarning. -- ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6603 ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 6931 replaces a DeprecationWarning with a RuntimeError (is it correct?). It was planned to do in 3.7, but it is too later for 3.7. -- resolution: fixed -> stage: resolved -> patch review status: closed -> open

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6601 ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nick, should a DeprecationWarning be replaced with a RuntimeWarning or a RuntimeError? There are contradictions about this in comments and the documentation. -- ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2018-05-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -1013 ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +1013 ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset fa4d8276d0fb by Serhiy Storchaka in branch 'default': Fixed merge error in Misc/NEWS for issue #23722. https://hg.python.org/cpython/rev/fa4d8276d0fb -- ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-05 Thread Ned Deily
Changes by Ned Deily : -- assignee: ned.deily -> priority: release blocker -> ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for the reviews Serhiy! The patch as merged addressed both your comments on the docs (including adding several new index entries) as well as the last couple of style comments on the code changes. I've filed separate issues for the test failures I'm

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset e33245800f1a by Nick Coghlan in branch '3.6': Issue #23722: improve __classcell__ compatibility https://hg.python.org/cpython/rev/e33245800f1a New changeset 9e5bc3d38de8 by Nick Coghlan in branch 'default': Merge #23722 from 3.6

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Nick Coghlan
Nick Coghlan added the comment: I've hit a problem where test_builtin and test_unittest are failing for me when refleak hunting is enabled (as in actual test failures, not just leak reports), but those also appear for me without the patch applied. Current plan: - ensure "./python -m test -R

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added two more style comments. And please take note of my comments to issue23722_documentation_updates.diff. Nothing critical, but would be nice to add more cross-references in the documentation. -- ___ Python

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Nick Coghlan
Nick Coghlan added the comment: Assuming there are no further comments overnight, I'll go ahead and commit this tomorrow (after doing a local refleak hunting run). -- ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Nick Coghlan
Nick Coghlan added the comment: Updated patch for Serhiy's review comments: issue23722_classcell_reference_validation_v2.diff - avoids a spurious deprecation warning for metaclasses that don't return a type() instance at all - avoids even the appearance of a refleak in the __build_class__

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added comments on Rietveld. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-04 Thread Nick Coghlan
Nick Coghlan added the comment: I should have made my comments a bit clearer as to which patches they were referring to. The ones submitted for inclusion in 3.6.0rc1 are: * issue23722_classcell_reference_validation.diff (the compatibility fix) * issue23722_documentation_updates.diff (the

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Nick Coghlan
Nick Coghlan added the comment: Attached patch covers the proposed documentation updates. -- Added file: http://bugs.python.org/file45744/issue23722_documentation_updates.diff ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Emanuel Barry
Changes by Emanuel Barry : -- nosy: +ebarry ___ Python tracker ___ ___ Python-bugs-list

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Nick Coghlan
Nick Coghlan added the comment: In the meantime, I'll try to work out a suitable documentation patch. -- ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Nick Coghlan
Nick Coghlan added the comment: Reassigning to Ned for now, pending finding another commit reviewer. -- assignee: ncoghlan -> ned.deily ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Nick Coghlan
Nick Coghlan added the comment: This latest patch restores the behaviour where a reference to the class cell is returned from the class-defining closure. That restoration allows __build_class__ to implement a sanity check that ensures that the class referenced from the cell is the one that

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-02 Thread Nick Coghlan
Nick Coghlan added the comment: Attached patch is some new test cases for an approach that I figured out *won't work*. The problem I hit is that "__classcell__" is only injected into the class body execution namespace when there is at least one method implementation that needs it. In any

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-02 Thread Tim Graham
Tim Graham added the comment: Thanks Nick. Your suggestion does fix the issue for Django: https://github.com/django/django/pull/7653. -- ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-02 Thread Nick Coghlan
Nick Coghlan added the comment: This step here is likely to be causing you problems: https://github.com/django/django/blob/6d1394182d8c4c02598e0cf47f42a5e86706411f/django/db/models/base.py#L90 Because the original class namespace isn't being passed up to type.__new__, it isn't seeing the

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-02 Thread Tim Graham
Tim Graham added the comment: Hi, this causes a regression in Django and I'm not sure if Django or cpython is at fault. For a simple model that uses super() rather than super(Model self) in save(): from django.db import models class Model(models.Model): def save(self, *args, **kwargs):

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Nick Coghlan
Nick Coghlan added the comment: And done - thanks for the patch Martin! The one additional change needed was to increment the magic number for pyc files, as this changed the code emitted for class definitions. I also picked up a latent defect in PC/launcher.c which hadn't been updated for

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset feb1ae9d5381 by Nick Coghlan in branch 'default': Issue #23722: Initialize __class__ from type.__new__() https://hg.python.org/cpython/rev/feb1ae9d5381 -- nosy: +python-dev ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Nick Coghlan
Nick Coghlan added the comment: Reassigning to myself given Guido's +1 -- assignee: ned.deily -> ncoghlan stage: -> commit review type: -> behavior ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Guido van Rossum
Guido van Rossum added the comment: Nick, if you feel like doing this, go ahead, either before or after beta1 (but if you want to do it before please do it quickly). (Off-topic: boy do I miss CI that triggers when you send a patch for review...) On Sat, Sep 10, 2016 at 11:14 AM, Martin

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Martin Teichmann
Martin Teichmann added the comment: This is the originial patch rebased such that it applies to the current master. As a detail in the discussion: "__classcell__" is not visible during the execution of the class body, as it is added at the end of the class body. In this regard, it is

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Nick Coghlan
Nick Coghlan added the comment: Now that you point it out, I agree "clearly" is overstating things when it comes to claiming bug fix status for a form of usage that has never worked in the entire life of zero-argument super :) -- ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Guido van Rossum
Guido van Rossum added the comment: > That aspect of the change is clearly a bug fix I am happy to *rule* that we can treat it as a bugfix, but I disagree that it's *clearly* a bugfix. It's definitely debatable. This area of the language is so obscure and so few people remember why it was done

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-09-10 Thread Nick Coghlan
Nick Coghlan added the comment: Martin, the patch isn't currently applying to trunk - would you have time to take a look at that? Ned, this is tangentially related to Martin's work on subclass initialization in PEP 487: one of the current problems with zero-argument super is that we don't

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think this requires adding it to the PEP, and I think doing this is fine. (But I can't review the code.) -- nosy: +gvanrossum ___ Python tracker

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann
Changes by Martin Teichmann : Added file: http://bugs.python.org/file43766/pep487.patch ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann
Changes by Martin Teichmann : Removed file: http://bugs.python.org/file43765/pep487.patch ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann
Changes by Martin Teichmann : Removed file: http://bugs.python.org/file38604/patch ___ Python tracker ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann
Martin Teichmann added the comment: Currently, a class is created as follows: the compiler turns the class statement into a call to __build_class__. This runs the class body. If __class__ or super() is used within a method of the class, an empty PyCell is created, to be filled later with the

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-14 Thread Eric Snow
Changes by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2015-03-23 Thread Martin Teichmann
Martin Teichmann added the comment: A note on the implementation: The compiler leaves a __cell__ entry in the class' namespace, which is then filled by type.__new__, and removed from the namespace by the latter. This is the same way it is done for __qualname__. As the patch tampers with the

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2015-03-21 Thread Nick Coghlan
Nick Coghlan added the comment: I like the change, but even though the current behaviour is arguably buggy (and certainly undesirable) the fix does introduce a new class level attribute that is visible during execution of Python level code. Perhaps it would be worth rolling this change into

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2015-03-20 Thread Martin Teichmann
New submission from Martin Teichmann: When a new class is initialized with __init__ in a metaclass, the __class__ cell of the class about to be initialized is not set yet, meaning that super() does not work. This is a known but fixable problem. The attached patch moves the initialization of