I assume the redundancy was there to handle the naming collision problem, but a better way to do that is to have only header files that users should ever use in "include/", and put the rest inside "include/python/" and "include/internal/" (and if possible, we don't distribute the internal directory as part of -develop packages, which only really impacts the Windows installer as far as we're concerned, but I assume some distros will care).

That would mean a layout like:

include/
  Python.h
  typeslots.h
  Python/
    abstract.h
    ...
  internal/
    pycore_atomic.h
    ...

End users/distutils should only -Iinclude, while our build can -Iinclude/Python and -Iinclude/internal as well. Or we can update all of our includes to specify the directory (which I'd prefer - #include "name.h" should look adjacent to the file first, while #include <name.h> looks at search paths first, which should be able to deal with collisions).

Any change here is an improvement, though. I'll be happy for Py_BUILD_CORE to go away (or at least only imply -Iinclude/internal, rather than actual preprocessor work), no matter where files land precisely :)

Cheers,
Steve

On 31Oct2018 1835, Eric Snow wrote:
On the one hand dropping redundancy in the filename is fine.  On the other having the names mirror the public header files is valuable.  How about leaving the base names alone and change the directory to "pyinternal"?

-eric

On Wed, Oct 31, 2018, 17:36 Victor Stinner <vstin...@redhat.com <mailto:vstin...@redhat.com> wrote:

    Ok, thanks. I decided to remove the redundant "py", so I renamed
    "pystate.h" to "pycore_state.h" (single "py", instead of
    "pycore_pystate.h", double "py py").

    I updated my PR:
    https://github.com/python/cpython/pull/10263

    * Rename Include/internal/ header files:

       * pyatomic.h -> pycore_atomic.h
       * ceval.h -> pycore_ceval.h
       * condvar.h -> pycore_condvar.h
       * context.h -> pycore_context.h
       * pygetopt.h -> pycore_getopt.h
       * gil.h -> pycore_gil.h
       * hamt.h -> pycore_hamt.h
       * hash.h -> pycore_hash.h
       * mem.h -> pycore_mem.h
       * pystate.h -> pycore_state.h
       * warnings.h -> pycore_warnings.h

    * PCbuild project, Makefile.pre.in <http://Makefile.pre.in>,
    Modules/Setup: add the
       Include/internal/ directory to the search paths of header files.
    * Update include. For example, replace #include "internal/mem.h"
       with #include "pycore_mem.h".

    Victor
    Le mer. 31 oct. 2018 à 23:38, Eric Snow <ericsnowcurren...@gmail.com
    <mailto:ericsnowcurren...@gmail.com>> a écrit :
     >
     > B
     > On Wed, Oct 31, 2018 at 4:28 PM Victor Stinner
    <vstin...@redhat.com <mailto:vstin...@redhat.com>> wrote:
     > >
     > > Le mer. 31 oct. 2018 à 22:19, Eric Snow
    <ericsnowcurren...@gmail.com <mailto:ericsnowcurren...@gmail.com>> a
    écrit :
     > > > > 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.
     > >
     > > What do you prefer?
     > >
     > > (A Include/internal/internal_pystate.h
     > > (B) Include/internal/pycore_pystate.h
     > > (C) Include/pycore/pycore_pystate.h
     > >
     > > Victor


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to