Skip to content

bpo-35081: Internal headers require Py_BUILD_CORE #10363

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

Merged
merged 2 commits into from
Nov 9, 2018
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
4 changes: 4 additions & 0 deletions Include/internal/pycore_accu.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ extern "C" {
*** Its definition may be changed or removed at any moment.
***/

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

/*
* A two-level accumulator of unicode objects that avoids both the overhead
* of keeping a huge number of small separate objects, and the quadratic
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "dynamic_annotations.h"
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
extern "C" {
#endif

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "pycore_atomic.h"
#include "pythread.h"

Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_condvar.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef Py_INTERNAL_CONDVAR_H
#define Py_INTERNAL_CONDVAR_H

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#ifndef _POSIX_THREADS
/* This means pthreads are not implemented in libc headers, hence the macro
not present in unistd.h. But they still can be implemented as an external
Expand Down
5 changes: 3 additions & 2 deletions Include/internal/pycore_context.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#ifndef Py_INTERNAL_CONTEXT_H
#define Py_INTERNAL_CONTEXT_H

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "pycore_hamt.h"


struct _pycontextobject {
PyObject_HEAD
PyContext *ctx_prev;
Expand Down Expand Up @@ -37,5 +39,4 @@ struct _pycontexttokenobject {
int _PyContext_Init(void);
void _PyContext_Fini(void);


#endif /* !Py_INTERNAL_CONTEXT_H */
4 changes: 4 additions & 0 deletions Include/internal/pycore_getopt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef Py_INTERNAL_PYGETOPT_H
#define Py_INTERNAL_PYGETOPT_H

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

extern int _PyOS_opterr;
extern int _PyOS_optind;
extern wchar_t *_PyOS_optarg;
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
extern "C" {
#endif

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "pycore_condvar.h"
#include "pycore_atomic.h"

Expand Down
3 changes: 3 additions & 0 deletions Include/internal/pycore_hamt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef Py_INTERNAL_HAMT_H
#define Py_INTERNAL_HAMT_H

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#define _Py_HAMT_MAX_TREE_DEPTH 7

Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_hash.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef Py_INTERNAL_HASH_H
#define Py_INTERNAL_HASH_H

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t);

#endif
4 changes: 2 additions & 2 deletions Include/internal/pycore_lifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

PyAPI_FUNC(int) _Py_UnixMain(int argc, char **argv);
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN defined"
#endif

#include "objimpl.h"
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_pathconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

PyAPI_FUNC(void) _Py_wstrlist_clear(
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "pystate.h"
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_warnings.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
extern "C" {
#endif

#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
#endif

#include "object.h"

struct _warnings_runtime_state {
Expand Down
1 change: 1 addition & 0 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ _symtable symtablemodule.c
#_bisect _bisectmodule.c # Bisection algorithms
#_heapq _heapqmodule.c # Heap queue algorithm
#_asyncio _asynciomodule.c # Fast asyncio Future
#_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c # _json speedups

#unicodedata unicodedata.c # static Unicode character database

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,9 @@ def detect_modules(self):
# atexit
exts.append( Extension("atexit", ["atexitmodule.c"]) )
# _json speedups
exts.append( Extension("_json", ["_json.c"]) )
exts.append( Extension("_json", ["_json.c"],
# pycore_accu.h requires Py_BUILD_CORE_BUILTIN
extra_compile_args=['-DPy_BUILD_CORE_BUILTIN']) )
# Python C API test module
exts.append( Extension('_testcapi', ['_testcapimodule.c'],
depends=['testcapi_long.h']) )
Expand Down