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

2018-11-01 Thread Steve Dower
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  
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  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 ,
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 mailto:[email protected]>> a écrit :
 >
 > B
 > On Wed, Oct 31, 2018 at 4:28 PM Victor Stinner
mailto:[email protected]>> wrote:
 > >
 > > Le mer. 31 oct. 2018 à 22:19, Eric Snow
mailto:[email protected]>> 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
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-11-01 Thread Victor Stinner
Le jeu. 1 nov. 2018 à 16:38, Steve Dower  a écrit :
> 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).

Aha, I didn't try this approach. I counted 41 Include/ header files
which are not included by Python.h:

Python-ast.h
abstract.h
asdl.h
ast.h
bitset.h
bytes_methods.h
bytesobject.h
code.h
codecs.h
datetime.h
dictobject.h
dynamic_annotations.h
errcode.h
fileobject.h
frameobject.h
graminit.h
grammar.h
longintrepr.h
marshal.h
metagrammar.h
node.h
opcode.h
osdefs.h
parsetok.h
patchlevel.h
pgen.h
pgenheaders.h
py_curses.h
pydtrace.h
pyexpat.h
pystrhex.h
pythonrun.h
pythread.h
pytime.h
setobject.h
structmember.h
symtable.h
token.h
ucnhash.h
unicodeobject.h

For Py_BUILD_CORE, there is at least datetime.h which may be a
Include/internal/ twin header.

Now I'm not sure how it's going to fit with the second step, "Move
!Py_LIMITED_API to Include/pycapi/":
https://bugs.python.org/issue35134

Victor
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com