Skip to content

Commit

Permalink
pythongh-116984: Make mimalloc header includes relative to the curren…
Browse files Browse the repository at this point in the history
…t file (python#118808)

Some embedders and extensions include parts of the internal API. The
pycore_mimalloc.h file is transitively include by a number of other
internal headers. This avoids include errors for code that was
already including those headers.
  • Loading branch information
colesbury authored and SonicField committed May 10, 2024
1 parent fa80517 commit e0bb384
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Include/internal/mimalloc/mimalloc/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ terms of the MIT license. A copy of the license can be found in the file
// functions and macros.
// --------------------------------------------------------------------------

#include "mimalloc/types.h"
#include "mimalloc/track.h"
#include "types.h"
#include "track.h"

#if (MI_DEBUG>0)
#define mi_trace_message(...) _mi_trace_message(__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/mimalloc/mimalloc/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terms of the MIT license. A copy of the license can be found in the file

#include <stddef.h> // ptrdiff_t
#include <stdint.h> // uintptr_t, uint16_t, etc
#include "mimalloc/atomic.h" // _Atomic
#include "atomic.h" // _Atomic

#ifdef _MSC_VER
#pragma warning(disable:4214) // bitfield is not int
Expand Down
6 changes: 3 additions & 3 deletions Include/internal/pycore_mimalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ typedef enum {
# define MI_TSAN 1
#endif

#include "mimalloc.h"
#include "mimalloc/types.h"
#include "mimalloc/internal.h"
#include "mimalloc/mimalloc.h"
#include "mimalloc/mimalloc/types.h"
#include "mimalloc/mimalloc/internal.h"
#endif

#ifdef Py_GIL_DISABLED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make mimalloc includes relative to the current file to avoid embedders or
extensions needing to include ``Internal/mimalloc`` if they are already
including internal CPython headers.

0 comments on commit e0bb384

Please sign in to comment.