Skip to content

Commit

Permalink
bpo-35081: Add pycore_ prefix to internal header files (pythonGH-10263)
Browse files Browse the repository at this point in the history
* 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 includes. For example, replace #include "internal/mem.h"
  with #include "pycore_mem.h".
  • Loading branch information
vstinner authored Oct 31, 2018
1 parent 3a228ab commit 27e2d1f
Show file tree
Hide file tree
Showing 78 changed files with 138 additions and 137 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions Include/internal/ceval.h → Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
extern "C" {
#endif

#include "internal/pyatomic.h"
#include "pycore_atomic.h"
#include "pythread.h"

struct _pending_calls {
Expand All @@ -25,7 +25,7 @@ struct _pending_calls {
int last;
};

#include "internal/gil.h"
#include "pycore_gil.h"

struct _ceval_runtime_state {
int recursion_limit;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define Py_INTERNAL_CONTEXT_H


#include "internal/hamt.h"
#include "pycore_hamt.h"


struct _pycontextobject {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Include/internal/gil.h → Include/internal/pycore_gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#include "internal/condvar.h"
#include "internal/pyatomic.h"
#include "pycore_condvar.h"
#include "pycore_atomic.h"

#ifndef Py_HAVE_CONDVAR
# error You need either a POSIX-compatible or a Windows system!
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 "pycore_mem.h"
#include "pycore_ceval.h"
#include "pycore_warnings.h"


/* GIL state */
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Include/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_Get(void);
#endif
#ifdef Py_BUILD_CORE
/* Macro which should only be used for performance critical code.
Need "#include "internal/pystate.h". See also _PyInterpreterState_Get()
Need "#include "pycore_state.h". See also _PyInterpreterState_Get()
and _PyGILState_GetInterpreterStateUnsafe(). */
# define _PyInterpreterState_GET_UNSAFE() (PyThreadState_GET()->interp)
#endif
Expand Down
18 changes: 9 additions & 9 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CONFIGURE_LDFLAGS= @LDFLAGS@
# command line to append to these values without stomping the pre-set
# values.
PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the
# environment variables
Expand Down Expand Up @@ -1025,14 +1025,14 @@ PYTHON_HEADERS= \
pyconfig.h \
$(PARSER_HEADERS) \
$(srcdir)/Include/Python-ast.h \
$(srcdir)/Include/internal/ceval.h \
$(srcdir)/Include/internal/gil.h \
$(srcdir)/Include/internal/mem.h \
$(srcdir)/Include/internal/pyatomic.h \
$(srcdir)/Include/internal/pygetopt.h \
$(srcdir)/Include/internal/pystate.h \
$(srcdir)/Include/internal/context.h \
$(srcdir)/Include/internal/warnings.h \
$(srcdir)/Include/internal/pycore_atomic.h \
$(srcdir)/Include/internal/pycore_ceval.h \
$(srcdir)/Include/internal/pycore_context.h \
$(srcdir)/Include/internal/pycore_getopt.h \
$(srcdir)/Include/internal/pycore_gil.h \
$(srcdir)/Include/internal/pycore_mem.h \
$(srcdir)/Include/internal/pycore_state.h \
$(srcdir)/Include/internal/pycore_warnings.h \
$(DTRACE_HEADERS)

$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
Expand Down
12 changes: 6 additions & 6 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,29 @@ PYTHONPATH=$(COREPYTHONPATH)
# This only contains the minimal set of modules required to run the
# setup.py script in the root of the Python source tree.

posix -DPy_BUILD_CORE posixmodule.c # posix (UNIX) system calls
posix -DPy_BUILD_CORE -I$(srcdir)/Include/internal posixmodule.c # posix (UNIX) system calls
errno errnomodule.c # posix (UNIX) errno values
pwd pwdmodule.c # this is needed to find out the user's home dir
# if $HOME is not set
_sre _sre.c # Fredrik Lundh's new regular expressions
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
_weakref _weakref.c # weak references
_functools -DPy_BUILD_CORE _functoolsmodule.c # Tools for working with functions and callable objects
_functools -DPy_BUILD_CORE -I$(srcdir)/Include/internal _functoolsmodule.c # Tools for working with functions and callable objects
_operator _operator.c # operator.add() and similar goodies
_collections _collectionsmodule.c # Container types
_abc _abc.c # Abstract base classes
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
_signal -DPy_BUILD_CORE signalmodule.c
_signal -DPy_BUILD_CORE -I$(srcdir)/Include/internal signalmodule.c
_stat _stat.c # stat.h interface
time -DPy_BUILD_CORE timemodule.c # -lm # time operations and variables
_thread -DPy_BUILD_CORE _threadmodule.c # low-level threading interface
time -DPy_BUILD_CORE -I$(srcdir)/Include/internal timemodule.c # -lm # time operations and variables
_thread -DPy_BUILD_CORE -I$(srcdir)/Include/internal _threadmodule.c # low-level threading interface

# access to ISO C locale support
_locale _localemodule.c # -lintl

# Standard I/O baseline
_io -DPy_BUILD_CORE -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
_io -DPy_BUILD_CORE -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c

# faulthandler module
faulthandler faulthandler.c
Expand Down
4 changes: 2 additions & 2 deletions Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "structmember.h"

/* _functools module written and maintained
Expand Down
2 changes: 1 addition & 1 deletion Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "structmember.h"
#include "pythread.h"
#include "_iomodule.h"
Expand Down
2 changes: 1 addition & 1 deletion Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* Interface to Sjoerd's portable C thread library */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "structmember.h" /* offsetof */
#include "pythread.h"

Expand Down
2 changes: 1 addition & 1 deletion Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Python.h"
#include "frameobject.h"
#include "internal/pystate.h"
#include "pycore_state.h"


static char *
Expand Down
6 changes: 3 additions & 3 deletions Modules/gcmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/

#include "Python.h"
#include "internal/context.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_context.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "frameobject.h" /* for PyFrame_ClearFreeList */
#include "pydtrace.h"
#include "pytime.h" /* for _PyTime_GetMonotonicClock() */
Expand Down
2 changes: 1 addition & 1 deletion Modules/getpath.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Return the initial module search path. */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "osdefs.h"

#include <sys/types.h>
Expand Down
6 changes: 3 additions & 3 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "Python.h"
#include "osdefs.h"
#include "internal/mem.h"
#include "internal/pygetopt.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_getopt.h"
#include "pycore_state.h"

#include <locale.h>

Expand Down
2 changes: 1 addition & 1 deletion Modules/makesetup
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
rulesf="@rules.$$"
trap 'rm -f $rulesf' 0 1 2 3
echo "
# Rules appended by makedepend
# Rules appended by makesetup
" >$rulesf
DEFS=
BUILT=
Expand Down
2 changes: 1 addition & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#else
#include "winreparse.h"
#endif
#include "internal/pystate.h"
#include "pycore_state.h"

/* On android API level 21, 'AT_EACCESS' is not declared although
* HAVE_FACCESSAT is defined. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* XXX Signals should be recorded per thread, now we have thread state. */

#include "Python.h"
#include "internal/pyatomic.h"
#include "pycore_atomic.h"

#ifndef MS_WINDOWS
#include "posixmodule.h"
Expand Down
2 changes: 1 addition & 1 deletion Objects/abstract.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Abstract Object Interface (many thanks to Jim Fulton) */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include <ctype.h>
#include "structmember.h" /* we need the offsetof() macro from there */
#include "longintrepr.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "structmember.h"
#include "bytes_methods.h"
#include "bytesobject.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define PY_SSIZE_T_CLEAN

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"

#include "bytes_methods.h"
#include "pystrhex.h"
Expand Down
2 changes: 1 addition & 1 deletion Objects/call.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "frameobject.h"


Expand Down
4 changes: 2 additions & 2 deletions Objects/cellobject.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Cell object implementation */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"

PyObject *
PyCell_New(PyObject *obj)
Expand Down
4 changes: 2 additions & 2 deletions Objects/classobject.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Class object implementation (dead now except for methods) */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "structmember.h"

#define TP_DESCR_GET(t) ((t)->tp_descr_get)
Expand Down
2 changes: 1 addition & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "Python.h"
#include "code.h"
#include "structmember.h"
#include "internal/pystate.h"
#include "pycore_state.h"

/* Holder for co_extra information */
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion Objects/descrobject.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Descriptors -- a new, flexible way to describe attributes */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "structmember.h" /* Why is this not included in Python.h? */

/*[clinic input]
Expand Down
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ converting the dict to the combined table.
#define PyDict_MINSIZE 8

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "dict-common.h"
#include "stringlib/eq.h" /* to get unicode_eq() */

Expand Down
4 changes: 2 additions & 2 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "structmember.h"
#include "osdefs.h"

Expand Down
2 changes: 1 addition & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Frame object implementation */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"

#include "code.h"
#include "frameobject.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* Function object implementation */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "code.h"
#include "structmember.h"

Expand Down
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Generator object implementation */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "frameobject.h"
#include "structmember.h"
#include "opcode.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/iterobject.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Iterator objects */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"

typedef struct {
PyObject_HEAD
Expand Down
2 changes: 1 addition & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* List object implementation */

#include "Python.h"
#include "internal/pystate.h"
#include "pycore_state.h"
#include "accu.h"

#ifdef STDC_HEADERS
Expand Down
4 changes: 2 additions & 2 deletions Objects/memoryobject.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Memoryview object implementation */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "pystrhex.h"
#include <stddef.h>

Expand Down
4 changes: 2 additions & 2 deletions Objects/methodobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* Method object implementation */

#include "Python.h"
#include "internal/mem.h"
#include "internal/pystate.h"
#include "pycore_mem.h"
#include "pycore_state.h"
#include "structmember.h"

/* Free list for method objects to safe malloc/free overhead
Expand Down
Loading

0 comments on commit 27e2d1f

Please sign in to comment.