Get __name__ in C extension module

Barry Scott barry at barrys-emacs.org
Mon Oct 7 03:09:34 EDT 2019



> On 7 Oct 2019, at 00:44, Ian Pilcher <arequipeno at gmail.com> wrote:
> 
> On 10/6/19 12:55 PM, Barry Scott wrote:
>> Then the answer to your question is simple. Do it in python and passt
>> logger into the C++ module.
> 
> Funny thing, that's exactly where I started this journey.  I couldn't
> figure out how to get the logging.Logger type object, so that I could
> use a "O!" format string unit.  This led me to read a bit more about
> the logging framework, which led me to the advice to get loggers by
> name, rather than passing them around, etc., etc.


I meant pass in the specific named logger that you C code will use.

> 
>> Next I would never code directly against the C API. Its a pain to use
>> and get right, get the ref counts wrong and you get memory leaks of
>> worse crash python.
> 
> Well, I like driving cars with manual transmissions, so ...

You are clearly aware of the risks.

Barry


> 
> -- 
> ========================================================================
> Ian Pilcher                                         arequipeno at gmail.com
> -------- "I grew up before Mark Zuckerberg invented friendship" --------
> ========================================================================
> 




More information about the Python-list mailing list