Skip to content
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
6 changes: 5 additions & 1 deletion Include/internal/pycore_blocks_output_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ extern "C" {

#include "Python.h"

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

typedef struct {
// List of bytes objects
PyObject *list;
Expand Down Expand Up @@ -314,4 +318,4 @@ _BlocksOutputBuffer_OnError(_BlocksOutputBuffer *buffer)
#ifdef __cplusplus
}
#endif
#endif /* Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H */
#endif /* Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H */
4 changes: 4 additions & 0 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
extern "C" {
#endif

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

#define CODE_MAX_WATCHERS 8

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

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

extern PyObject* _PyCodec_Lookup(const char *encoding);

/* Text codec specific encoding and decoding API.
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_emscripten_signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#if defined(__EMSCRIPTEN__)

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

void
_Py_CheckEmscriptenSignals(void);

Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
# error "this header requires Py_BUILD_CORE define"
#endif

#include <locale.h> /* struct lconv */
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_fileutils_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "Py_BUILD_CORE must be defined to include this header"
# error "this header requires Py_BUILD_CORE define"
#endif

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

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

#include <stdbool.h>
#include <stddef.h> // offsetof()
#include "pycore_code.h" // STATS
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
extern "C" {
#endif

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

#include "pycore_hashtable.h" // _Py_hashtable_t
#include "pycore_time.h" // _PyTime_t

Expand Down
4 changes: 3 additions & 1 deletion Include/internal/pycore_instruments.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

#ifndef Py_INTERNAL_INSTRUMENT_H
#define Py_INTERNAL_INSTRUMENT_H

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

#include "pycore_bitutils.h" // _Py_popcount32
#include "pycore_frame.h"
Expand Down
8 changes: 8 additions & 0 deletions Include/internal/pycore_intrinsics.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#ifndef Py_INTERNAL_INTRINSIC_H
#define Py_INTERNAL_INTRINSIC_H

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

/* Unary Functions: */
#define INTRINSIC_1_INVALID 0
Expand Down Expand Up @@ -40,3 +46,5 @@ typedef struct {

extern const intrinsic_func1_info _PyIntrinsics_UnaryFunctions[];
extern const intrinsic_func2_info _PyIntrinsics_BinaryFunctions[];

#endif // !Py_INTERNAL_INTRINSIC_H
4 changes: 4 additions & 0 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Modules/_bz2module.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* _bz2 - Low-level Python interface to libbzip2. */

#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif

#include "Python.h"

#include <bzlib.h>
Expand Down
4 changes: 4 additions & 0 deletions Modules/_lzmamodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/

#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif

#include "Python.h"


Expand Down
4 changes: 4 additions & 0 deletions Modules/_opcode.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif

#include "Python.h"
#include "compile.h"
#include "opcode.h"
Expand Down
4 changes: 4 additions & 0 deletions Modules/zlibmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

/* Windows users: read Python's PCbuild\readme.txt */

#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif

#include "Python.h"

#include "zlib.h"
Expand Down
7 changes: 7 additions & 0 deletions Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import posixpath
import sys
import textwrap
import typing
from collections.abc import Iterator

Expand Down Expand Up @@ -403,6 +404,12 @@ def write_metadata(self, metadata_filename: str, pymetadata_filename: str) -> No

self.write_provenance_header()

self.out.emit("\n" + textwrap.dedent("""
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
""").strip())
Comment on lines +407 to +411
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother asking for a review if you're going to merge it while I'm getting coffee? What response time do you expect for reviews?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother asking for a review

Hmm, I requested the review to you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was venting at @vstinner who ignored that and merged eight minutes later. :-(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't ask for a review on such "cleanup" change. I didn't see that @corona10 asked for a review.


self.out.emit("\n#include <stdbool.h>")

self.write_pseudo_instrs()
Expand Down