Re: `import somemodule` does not check all paths in `sys.path`

2018-07-28 Thread MRAB
On 2018-07-28 22:16, stefand...@gmail.com wrote: Hi everyone, I am currently investigating an interesting bug in homeassistant which is a bit hard to reproduce. I already dug so deep that I ask here, because I think the root cause has to do with how Python locates and loads modules/packages. T

`import somemodule` does not check all paths in `sys.path`

2018-07-28 Thread stefand986
Hi everyone, I am currently investigating an interesting bug in homeassistant which is a bit hard to reproduce. I already dug so deep that I ask here, because I think the root cause has to do with how Python locates and loads modules/packages. The "story" is: In homeassistant (short HA) some mod

Re: Tracking a memory leak in C extension - interpreting the output of PYTHONMALLOCSTATS

2018-07-28 Thread Stefan Behnel
Bartosz Golaszewski schrieb am 24.07.2018 um 13:05: > Ok I've found the problem and it's my fault. From tp_dealloc's documentation: > > --- > The destructor function should free all references which the instance > owns, free all memory buffers owned by the instance (using the freeing > function co

Re: Checking whether type is None

2018-07-28 Thread Chris Angelico
On Sat, Jul 28, 2018 at 8:07 PM, Steven D'Aprano wrote: > On Sat, 28 Jul 2018 09:47:07 +, Gilmeh Serda wrote: > >> On Tue, 24 Jul 2018 12:33:27 -0700, Tobiah wrote: >> >>> I'm trying to get away from things like: >>> >>> >>> type(thing) is type(None) >> >> How about: >> >> >>> some_th

Re: Checking whether type is None

2018-07-28 Thread Steven D'Aprano
On Sat, 28 Jul 2018 09:47:07 +, Gilmeh Serda wrote: > On Tue, 24 Jul 2018 12:33:27 -0700, Tobiah wrote: > >> I'm trying to get away from things like: >> >> >>> type(thing) is type(None) > > How about: > > >>> some_thing = None > >>> type(some_thing).__str__(some_thing) > '