Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35081: Move bytes_methods.h to the internal C API #18492

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#ifndef Py_BYTES_CTYPE_H
#define Py_BYTES_CTYPE_H

#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif

/*
* The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
* methods of the given names, they operate on ASCII byte strings.
Expand Down
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,6 @@ PYTHON_HEADERS= \
$(srcdir)/Include/bltinmodule.h \
$(srcdir)/Include/boolobject.h \
$(srcdir)/Include/bytearrayobject.h \
$(srcdir)/Include/bytes_methods.h \
$(srcdir)/Include/bytesobject.h \
$(srcdir)/Include/cellobject.h \
$(srcdir)/Include/ceval.h \
Expand Down Expand Up @@ -1077,6 +1076,7 @@ PYTHON_HEADERS= \
\
$(srcdir)/Include/internal/pycore_accu.h \
$(srcdir)/Include/internal/pycore_atomic.h \
$(srcdir)/Include/internal/pycore_bytes_methods.h \
$(srcdir)/Include/internal/pycore_call.h \
$(srcdir)/Include/internal/pycore_ceval.h \
$(srcdir)/Include/internal/pycore_code.h \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Move the ``bytes_methods.h`` header file to the internal C API as
``pycore_bytes_methods.h``: it only contains private symbols (prefixed by
``_Py``), except of the ``PyDoc_STRVAR_shared()`` macro.
2 changes: 1 addition & 1 deletion Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "structmember.h"
#include "bytes_methods.h"
#include "bytesobject.h"
#include "pystrhex.h"

Expand Down
2 changes: 1 addition & 1 deletion Objects/bytes_methods.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "bytes_methods.h"
#include "pycore_bytes_methods.h"

PyDoc_STRVAR_shared(_Py_isspace__doc__,
"B.isspace() -> bool\n\
Expand Down
2 changes: 1 addition & 1 deletion Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#define PY_SSIZE_T_CLEAN

#include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"

#include "bytes_methods.h"
#include "pystrhex.h"
#include <stddef.h>

Expand Down
2 changes: 1 addition & 1 deletion Objects/stringlib/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# error "ctype.h only compatible with byte-wise strings"
#endif

#include "bytes_methods.h"
#include "pycore_bytes_methods.h"

static PyObject*
stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored))
Expand Down
2 changes: 1 addition & 1 deletion Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_fileutils.h"
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "pycore_pathconfig.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h"
#include "ucnhash.h"
#include "bytes_methods.h"
#include "stringlib/eq.h"

#ifdef MS_WINDOWS
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
<ClInclude Include="..\Include\ast.h" />
<ClInclude Include="..\Include\bitset.h" />
<ClInclude Include="..\Include\boolobject.h" />
<ClInclude Include="..\Include\bytes_methods.h" />
<ClInclude Include="..\Include\bytearrayobject.h" />
<ClInclude Include="..\Include\bytesobject.h" />
<ClInclude Include="..\Include\cellobject.h" />
Expand Down Expand Up @@ -161,6 +160,7 @@
<ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\pycore_accu.h" />
<ClInclude Include="..\Include\internal\pycore_atomic.h" />
<ClInclude Include="..\Include\internal\pycore_bytes_methods.h" />
<ClInclude Include="..\Include\internal\pycore_call.h" />
<ClInclude Include="..\Include\internal\pycore_ceval.h" />
<ClInclude Include="..\Include\internal\pycore_code.h" />
Expand Down
6 changes: 3 additions & 3 deletions PCbuild/pythoncore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<ClInclude Include="..\Include\boolobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\bytes_methods.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\bytearrayobject.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -186,6 +183,9 @@
<ClInclude Include="..\Include\internal\pycore_atomic.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_call.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down