core.py: TypeError: keyword arguments are not supported

I'm seeing this exception on the last line of this snippet from core.py. Am I correct this looks like a bug.

Michael

File "C:\dev\virtenvs\auction\Lib\site-packages\wxPython_Phoenix-3.0.1.dev76030-py2.7-win32.egg\wx\core.py", line 69, in __init__
   item.__init__(*args, **kw)

TypeError: keyword arguments are not supported

def deprecated(item, msg='', useName=False):
     """
     Create a delegating wrapper that raises a deprecation warning. Can be
     used with callable objects (functions, methods, classes) or with
     properties.
     """
     import warnings

     name = ''
     if useName:
         try:
             name = ' ' + item.__name__
         except AttributeError:
             pass

     if isinstance(item, type):
         # It is a class. Make a subclass that raises a warning.
         class DeprecatedClassProxy(item):
             def __init__(*args, **kw):
                 warnings.warn("Using deprecated class%s. %s" % (name, msg),
                           wxPyDeprecationWarning, stacklevel=2)
                 item.__init__(*args, **kw)

Michael Hipp wrote:

I'm seeing this exception on the last line of this snippet from core.py.
Am I correct this looks like a bug.

Michael

File
"C:\dev\virtenvs\auction\Lib\site-packages\wxPython_Phoenix-3.0.1.dev76030-py2.7-win32.egg\wx\core.py",
line 69, in __init__
item.__init__(*args, **kw)

TypeError: keyword arguments are not supported

What class are you trying to instantiate there? I've noticed this before, I think it was when trying to call a deprecated function that took zero args. SIP is using an optimization in that case where it simply doesn't allow keyword args because there can't be any args at all, so passing an empty dict for **kw is triggering a built-in Python exception.

···

--
Robin Dunn
Software Craftsman

Here's the offending code:

import wx.grid as gridlib

class HugeTable(gridlib.PyGridTableBase):
     def __init__(self, loader):
         gridlib.PyGridTableBase.__init__(self)

The __init__ call is where it crashes. Obviously the fix is to just change it to GridTableBase, but a deprecation warning is probably needed.

Michael

···

On 3/1/2014 6:10 PM, Robin Dunn wrote:

Michael Hipp wrote:

I'm seeing this exception on the last line of this snippet from core.py.
Am I correct this looks like a bug.

Michael

File
"C:\dev\virtenvs\auction\Lib\site-packages\wxPython_Phoenix-3.0.1.dev76030-py2.7-win32.egg\wx\core.py",

line 69, in __init__
item.__init__(*args, **kw)

TypeError: keyword arguments are not supported

What class are you trying to instantiate there?