Edgewall Software

Opened 17 years ago

Closed 17 years ago

#180 closed task (fixed)

__new__() deprecation warning with 2.6

Reported by: jruigrok Owned by: cmlenz
Priority: minor Milestone: 0.5
Component: General Version: devel
Keywords: Cc:

Description

Using Python 2.6 with Genshi cases a deprecation warning for this part: source:trunk/genshi/core.py#800#L602

DeprecationWarning: object.__new__() takes no parameters
  return object.__new__(cls, uri)

Change History (2)

comment:1 Changed 17 years ago by jruigrok

As Guido van Rossum wrote to me:

There's no point in calling object.__new__() with more than a class parameter, and any code that did so was just dumping those args into a black hole.

The only time when it makes sense for object.__new__() to ignore extra arguments is when it's not being overridden, but __init__ *is* being overridden -- then you have a completely default __new__ and the checking of constructor arguments is relegated to __init__.

The purpose of all this is to catch the error in a call like object(42) which (again) passes an argument that is not used. This is often a symptom of a bug in your program.

comment:2 Changed 17 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [801].

Note: See TracTickets for help on using tickets.