[issue2366] Fixer for new metaclass syntax is needed
Benjamin Peterson [EMAIL PROTECTED] added the comment: Added in r66438. One open issue is that the comment is lost in the following example: class X: __metaclass__ = Meta # Spam -- resolution: - fixed status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Benjamin Peterson [EMAIL PROTECTED] added the comment: Good work on the patch! It looks pretty good. I'm attaching a patch with a few minor changes. I don't really understand the need for fixup_parse_tree, since I see in the Grammar that a suite is required for every classdef. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Benjamin Peterson [EMAIL PROTECTED] added the comment: On Thu, Aug 21, 2008 at 9:38 PM, Jack Diederich [EMAIL PROTECTED] wrote: Jack Diederich [EMAIL PROTECTED] added the comment: Benjamin, the 2to3 parse tree straddles the 2.x Grammar and 3.x Grammar (it's its own thing) which is why fixup_parse_tree is there. From the docstring: one-line classes don't get a suite in the parse tree so we add one to normalize the tree The 2to3 parser is very line oriented - only the try/except logic uses blocks (I think). Yes. Sorry that was a brain seg fault. :) There haven't been any objection so I've assigned this to myself and I'll check it in and close it soonish. Add an example example.py while you're at it. -- assignee: collinwinter - jackdied ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Jack Diederich [EMAIL PROTECTED] added the comment: Thanks for the ping. I just rewrote the patch from scratch and it handles corner cases (of which there are many in the parse tree) better. I'll upload/checkin sometime today. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Jack Diederich [EMAIL PROTECTED] added the comment: The new patch works and handles all the corner cases I could think of. I tried to comment the heck out of it because it does a lot of manual walking and manipulation of the syntax tree. This only handles __metaclass__ inside classes. I wasn't sure what to do with __metaclass__ at the module level (which is now a NOP, I think). Added file: http://bugs.python.org/file11020/fix_metaclass.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Benjamin Peterson [EMAIL PROTECTED] added the comment: Ping -- nosy: +benjamin.peterson ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Jack Diederich [EMAIL PROTECTED] added the comment: New patch that does more. Collin, could you take a look at the fixer? I listed some stumbling blocks at the top (and at least one bug in 2to3). The fixer seems to work fine on actual files but the unit tests that use strings do nothing. Thanks. Added file: http://bugs.python.org/file9797/fix_metaclass.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Collin Winter [EMAIL PROTECTED] added the comment: A quick test indicates that the old way doesn't work anymore. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Jack Diederich [EMAIL PROTECTED] added the comment: Here is a partial implementation. It doesn't warn about __metaclass__ at the module level and doesn't handle multiple __metaclass__ assignements in one class. tests pending. -- keywords: +patch Added file: http://bugs.python.org/file9778/fix_metaclass.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
New submission from Brett Cannon [EMAIL PROTECTED]: * new metaclass syntax (removing __metaclass__?) - __metaclass__ = type at global level disappear - __metaclass__ = anything else should generate warning - __metaclass__ = something within a class should use new syntax - class __metaclass__ should be warned about - any other use of __metaclass__ should be warned about -- assignee: collinwinter components: 2to3 (2.x to 3.0 conversion tool) keywords: 26backport messages: 63743 nosy: brett.cannon, collinwinter priority: immediate severity: normal status: open title: Fixer for new metaclass syntax is needed type: behavior versions: Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Changes by Jack Diederich [EMAIL PROTECTED]: -- nosy: +jackdied __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Changes by Brett Cannon [EMAIL PROTECTED]: -- priority: immediate - urgent __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2366] Fixer for new metaclass syntax is needed
Raymond Hettinger [EMAIL PROTECTED] added the comment: Does the old way still work in 3.0? If so, I don't think we should have a fixer. -- nosy: +rhettinger __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2366 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com