[OE-core] [master][RFC] Adding back wrapper and using OEPYTHON3HOME variable for python3
Jaewon Lee
JAEWON at xilinx.com
Thu Apr 25 21:59:59 UTC 2019
Hi Richard,
Agreed, will send a v2
Thanks,
Jaewon
-----Original Message-----
From: richard.purdie at linuxfoundation.org <richard.purdie at linuxfoundation.org>
Sent: Thursday, April 25, 2019 1:50 PM
To: Jaewon Lee <JAEWON at xilinx.com>; openembedded-core at lists.openembedded.org; Manjukumar Harthikote Matha <MANJUKUM at xilinx.com>; Alejandro Enedino Hernandez Samaniego <alejandr at xilinx.com>
Subject: Re: [OE-core][master][RFC] Adding back wrapper and using OEPYTHON3HOME variable for python3
On Thu, 2019-04-25 at 12:56 -0700, Jaewon Lee wrote:
> +diff --git a/Modules/main.c b/Modules/main.c index a745381..25ca435
> +100644
> +--- a/Modules/main.c
> ++++ b/Modules/main.c
> +@@ -1857,6 +1857,11 @@ config_init_home(_PyCoreConfig *config)
> + }
> +
> + int res = config_get_env_var_dup(&home, L"PYTHONHOME",
> + "PYTHONHOME");
> ++
> ++ const char *oepython3home = config_get_env_var("OEPYTHON3HOME");
> ++ if (oepython3home) {
> ++ res = config_get_env_var_dup(&home, L"OEPYTHON3HOME", "OEPYTHON3HOME");
> ++ }
> + if (res < 0) {
> + return DECODE_LOCALE_ERR("PYTHONHOME", res);
> + }
> +--
> +2.7.4
I think the above will leak memory.
Instead I think the code should be something like:
int res;
const char *oepython3home = config_get_env_var("OEPYTHON3HOME");
if (oepython3home) {
res = config_get_env_var_dup(&home, L"OEPYTHON3HOME", "OEPYTHON3HOME");
if (res < 0)
return DECODE_LOCALE_ERR("OEPYTHON3HOME", res); } else {
res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
if (res < 0)
return DECODE_LOCALE_ERR("PYTHONHOME", res); }
and then a copy of PYTHONHOME isn't created in the OEPYTHON3HOME case.
Cheers,
Richard
More information about the Openembedded-core
mailing list