Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'guido': 0.05; '(using': 0.07; 'args': 0.07; '*args,': 0.09; 'arguments': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'jan': 0.12; 'sections': 0.14; 'args,': 0.16; 'buggy': 0.16; 'builtins': 0.16; 'highlight': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:object': 0.16; 'subject:skip:m 10': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'passing': 0.19; 'properly': 0.19; 'header:User-Agent:1': 0.23; 'error': 0.23; 'new,': 0.24; 'versions': 0.24; 'tracker': 0.26; 'somewhere': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'fixed': 0.29; 'url:bugs': 0.29; 'am,': 0.29; 'andrew': 0.30; 'change,': 0.30; 'forgot': 0.30; 'code': 0.31; 'object.': 0.31; 'yes.': 0.31; 'class': 0.32; 'worked': 0.33; 'url:python': 0.33; 'core': 0.34; 'something': 0.35; 'but': 0.35; 'raising': 0.36; 'doing': 0.36; 'url:org': 0.36; 'should': 0.36; 'depends': 0.38; 'to:addr:python- list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'remove': 0.60; 'chain': 0.60; 'break': 0.61; 'reaching': 0.61; 'first': 0.61; 'decided': 0.64; 'behavior': 0.77; "'object'": 0.84; '3.4': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Basic misunderstanding on object creation Date: Wed, 13 May 2015 13:13:39 -0400 References: <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431537243 news.xs4all.nl 2904 [2001:888:2000:d::a6]:45602 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90570 On 5/13/2015 12:36 PM, Terry Reedy wrote: > On 5/13/2015 9:25 AM, andrew cooke wrote: > >> The following code worked on Python 3.2, but no longer works in 3.4. > > Bugfixes break code that depends on buggy behavior. See > https://bugs.python.org/issue1683368 > Your code also fails in 2.7.9 if you inherit Foo from object. > The exact error messages changed for 3.4 in > https://bugs.python.org/issue7963 > > > Did something change, > > Obviously yes. > > > or have I always been doing something dumb? > > You were depending on behavior of object that Guido decided was buggy. > > I found the tracker issue by looking for 'object' in the Core and > Builtins sections of the changelog one can access from What's New, first > paragraph (using Highlight All in Firefox). > >>>>> class Foo: >> ... def __new__(cls, *args, **kargs): >> ... print('new', args, kargs) >> ... super().__new__(cls, *args, **kargs) I forgot to memtion that it is intended that one remove arguments that are specific to a class before passing them on to super. All arguments should be consumed (removed) somewhere in the chain before reaching object. The bug that was fixed was not raising when not all args were consumed. As other showed, your code works properly in all versions when you do so by only passing on cls. -- Terry Jan Reedy