wx.NewId() crashes in OS X

All:

The following error is generated by the script below using OSX 10.4, wxpython 2.7.1.3. The problem exists if you use wx.NewId() to generate the button id. If you use -1, all is well.

   File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.7.1-mac-ansi/wx/_controls.py", line 86, in __init__
     _controls_.Button_swiginit(self,_controls_.new_Button(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "id == wxID_ANY || (id >= 0 && id < 32767)" failed at /BUILD/wxPython-src-2.7.1.3/src/common/wincmn.cpp(249) in CreateBase(): invalid id value

#Begin script
import wx
app = wx.PySimpleApp()
f = wx.Frame(None, -1)
p = wx.Panel(f, -1)
f.Show()
for x in range(40000):
     print x
     b = wx.Button(p, wx.NewId(), 'Hello', (10, 10))
     b.Destroy()
app.MainLoop()