[issue30602] [Windows] os.spawn*() tests of test_os leak references on Windows

Eryk Sun report at bugs.python.org
Thu Jun 8 16:09:36 EDT 2017


Eryk Sun added the comment:

The memory leak is in os_spawnv_impl and os_spawnve_impl in Modules/posixmodule.c. The call fails with a ValueError when the first argument in the argv list is an empty string, in which case these functions both mistakenly pass i (0) to free_string_array() as the count of strings to free. But the conversion was successful, so it needs to include the current string in the count, i.e. `i + 1`.

The fix for this could also address the following two issues, which are mostly cosmetic in nature. os_spawnve_impl needs its TypeError message to be special cased the same as in os_spawnv_impl, i.e. "spawnve() arg 2 must contain only strings". Currently it uses the default message from the failed conversion: "expected str, bytes or os.PathLike object, not %.200s". Also, its ValueError message needs to reference "spawnve()" instead of "spawnv()".

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30602>
_______________________________________


More information about the Python-bugs-list mailing list