Prev: What's a good XSL to translate xmlrunner.py output into a testreport?
Next: efficiently create and fill array.array from C code?
From: moerchendiser2k3 on 13 Jun 2010 09:54 Hi, can anyone give me a hint how to mark a built-in module as deprecated? So mark via warnings... I create a module with Py_InitModule4. Thanks in advance!! Bye, moerchendiser2k3
From: Thomas Jollans on 13 Jun 2010 10:22 On 06/13/2010 03:54 PM, moerchendiser2k3 wrote: > Hi, > > can anyone give me a hint how to mark a built-in module as deprecated? > So mark via warnings... I create a module with Py_InitModule4. How are modules ever marked as deprecated? I think all there is to it is issuing a DeprecationWarning... something like PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz", 1); maybe.
From: moerchendiser2k3 on 13 Jun 2010 20:30 PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz", 1); But where can I write this? With Py_InitModule4 I can just pass a list of functions but no real execution part which is executed when a module is imported.
From: Thomas Jollans on 14 Jun 2010 04:59 On 06/14/2010 02:30 AM, moerchendiser2k3 wrote: > PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz", > 1); > > But where can I write this? With Py_InitModule4 I can just > pass a list of functions but no real execution part which > is executed when a module is imported. This is Python 2.x, right? I'm only familiar with Python 3 extension writing, but there shouldn't have been that much change... Where do you call the Py_InitModule4? I would have expected you call it in your initfoo function - which is also a good place to issue a warning. - the initfoo (or PyInit_foo) function is called when the module is first imported.
From: moerchendiser2k3 on 14 Jun 2010 20:29
Hi, yes, that was my first idea when I just create an external module. I forgot something to say: In my case the initfoo() function is called on startup in my embedding environment, that means I call that on startup of my main app. Bye, moerchendiser2k3 |