[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-13 Thread Ethan Furman
On 05/13/2020 06:04 AM, Antoine Pitrou wrote: On Tue, 12 May 2020 11:36:38 -0700 Ethan Furman wrote: Also, if a flag is used, won't that slow down every call to zip even when the flag is False? Why would it? Is that based on a rational analysis of how argument parsing works? Not the call

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-13 Thread Steven D'Aprano
On Wed, May 13, 2020 at 03:04:02PM +0200, Antoine Pitrou wrote: > On Tue, 12 May 2020 11:36:38 -0700 > Ethan Furman wrote: > > > > Also, if a flag is used, won't that slow down every call to zip even when > > the flag is False? > > Why would it? Is that based on a rational analysis of how

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Sebastian Berg
On Wed, 2020-05-13 at 13:14 +0100, Pablo Galindo Salgado wrote: > > But again this is for PyObjects only. > > Not really, we check also memory blocks: > > https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.py#L72 > > as long as you don't directly call malloc and use one

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-13 Thread Antoine Pitrou
On Tue, 12 May 2020 11:36:38 -0700 Ethan Furman wrote: > > Also, if a flag is used, won't that slow down every call to zip even when the > flag is False? Why would it? Is that based on a rational analysis of how argument parsing works? Regards Antoine.

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Ammar Askar
Aah, thanks for pointing this out. As a quick side note: are these cool regrtest features documented anywhere? I remember seeing some mention of the -R 3:3 argument in the dev guide but nothing else. Probably useful to have this documented somewhere in the dev guide. On Wed, May 13, 2020, 5:14

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Victor Stinner
C extensions "should" use PyMem_Malloc/PyMem_Free to benefit of PEP 445 hooks like debug hooks and tracemalloc. * Debug hooks (enabled by -X dev) helps to debug buffer overflow: https://docs.python.org/dev/c-api/memory.html#c.PyMem_SetupDebugHooks * tracemalloc:

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Victor Stinner
Hi, Le mer. 13 mai 2020 à 02:04, Giampaolo Rodola' a écrit : > I would like to discuss a proposal regarding one aspect which AFAIK is > currently missing from cPython's test suite: the ability to detect memory > leaks of functions implemented in the C extension modules. test.regrtest can be

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Pablo Galindo Salgado
> But again this is for PyObjects only. Not really, we check also memory blocks: https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.py#L72 as long as you don't directly call malloc and use one of the Python specific APIs like PyMem_Malloc then the reflect code should

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Giampaolo Rodola'
On Wed, May 13, 2020 at 9:17 AM Ammar Askar wrote: > > Py_DECREF calls in the C code > > I think this part specifically is already covered through refleak > checks: > https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.py > > Since it can involve the repetition of tests

[Python-Dev] Re: Detect memory leaks in unit tests

2020-05-13 Thread Ammar Askar
> Py_DECREF calls in the C code I think this part specifically is already covered through refleak checks: https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.py Since it can involve the repetition of tests many times, these aren't run on the CI though, they do get run on