[Python-Dev] Rename Include/internals/ to Include/pycore/

Eric Snow ericsnowcurrently at gmail.com
Wed Oct 31 17:18:58 EDT 2018


On Wed, Oct 31, 2018 at 1:57 PM Victor Stinner <vstinner at redhat.com> wrote:
>
> Ok, I proposed to rename internal header files, add an "internal_"
> prefix, to avoid this issue:
> https://github.com/python/cpython/pull/10263
>
> My PR also adds Include/internal/ to search paths of header files.
>
> Extract of the change:
>
> diff --git a/Include/internal/pystate.h b/Include/internal/internal_pystate.h
> --- a/Include/internal/pystate.h
> +++ b/Include/internal/internal_pystate.h
> @@ -7,9 +7,9 @@ extern "C" {
>
>  #include "pystate.h"
>  #include "pythread.h"
>
> -#include "internal/mem.h"
> -#include "internal/ceval.h"
> -#include "internal/warnings.h"
> +#include "internal_pymem.h"
> +#include "internal_ceval.h"
> +#include "internal_warnings.h"
>
> With this PR, internal_pystate.h of Include/internal/ is able to
> properly include pystate.h from Include/ (include the correct header
> file).
>
>
> For practical reasons, I added Include/internal/ to all projects of
> the Visual Studio solution (I modified the properties common to all
> projects).
>
> Again, this is where I would like to replace "internal_" with
> "pycore_": "internal" is too generic, there is a risk that a third
> party project also the same header filename. "internal_hash.h" name is
> quite general. There is a non-zero risk of conflict with a library. In
> the past, we also had issues when compiling OpenSSL for example.

I'm not sure of this being a real problem, but I don't see a problem
with mitigating the risk. :)

> Maybe we can keep "Include/internal/" directory name, but add
> "pycore_" rather than "internal_" to header filenames?

this sounds good to me.  thanks for chasing this down.

-eric


More information about the Python-Dev mailing list