Skip to content

Commit 3ccea8c

Browse files
committed
factor out internals_version.h from internals.h (no functional changes)
1 parent 87ebc39 commit 3ccea8c

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

include/pybind11/detail/internals.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#pragma once
1111

1212
#include "common.h"
13+
#include "internals_version.h"
1314
#include "platform_abi_id.h"
1415

1516
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
@@ -22,34 +23,6 @@
2223
#include <mutex>
2324
#include <thread>
2425

25-
/// Tracks the `internals` and `type_info` ABI version independent of the main library version.
26-
///
27-
/// Some portions of the code use an ABI that is conditional depending on this
28-
/// version number. That allows ABI-breaking changes to be "pre-implemented".
29-
/// Once the default version number is incremented, the conditional logic that
30-
/// no longer applies can be removed. Additionally, users that need not
31-
/// maintain ABI compatibility can increase the version number in order to take
32-
/// advantage of any functionality/efficiency improvements that depend on the
33-
/// newer ABI.
34-
///
35-
/// WARNING: If you choose to manually increase the ABI version, note that
36-
/// pybind11 may not be tested as thoroughly with a non-default ABI version, and
37-
/// further ABI-incompatible changes may be made before the ABI is officially
38-
/// changed to the new version.
39-
#ifndef PYBIND11_INTERNALS_VERSION
40-
# if PY_VERSION_HEX >= 0x030C0000 || defined(_MSC_VER)
41-
// Version bump for Python 3.12+, before first 3.12 beta release.
42-
// Version bump for MSVC piggy-backed on PR #4779. See comments there.
43-
# define PYBIND11_INTERNALS_VERSION 5
44-
# else
45-
# define PYBIND11_INTERNALS_VERSION 4
46-
# endif
47-
#endif
48-
49-
// This requirement is mainly to reduce the support burden (see PR #4570).
50-
static_assert(PY_VERSION_HEX < 0x030C0000 || PYBIND11_INTERNALS_VERSION >= 5,
51-
"pybind11 ABI version 5 is the minimum for Python 3.12+");
52-
5326
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
5427

5528
using ExceptionTranslator = void (*)(std::exception_ptr);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2024 The pybind Community.
2+
3+
#pragma once
4+
5+
#include "common.h"
6+
7+
/// Tracks the `internals` and `type_info` ABI version independent of the main library version.
8+
///
9+
/// Some portions of the code use an ABI that is conditional depending on this
10+
/// version number. That allows ABI-breaking changes to be "pre-implemented".
11+
/// Once the default version number is incremented, the conditional logic that
12+
/// no longer applies can be removed. Additionally, users that need not
13+
/// maintain ABI compatibility can increase the version number in order to take
14+
/// advantage of any functionality/efficiency improvements that depend on the
15+
/// newer ABI.
16+
///
17+
/// WARNING: If you choose to manually increase the ABI version, note that
18+
/// pybind11 may not be tested as thoroughly with a non-default ABI version, and
19+
/// further ABI-incompatible changes may be made before the ABI is officially
20+
/// changed to the new version.
21+
#ifndef PYBIND11_INTERNALS_VERSION
22+
# if PY_VERSION_HEX >= 0x030C0000 || defined(_MSC_VER)
23+
// Version bump for Python 3.12+, before first 3.12 beta release.
24+
// Version bump for MSVC piggy-backed on PR #4779. See comments there.
25+
# define PYBIND11_INTERNALS_VERSION 5
26+
# else
27+
# define PYBIND11_INTERNALS_VERSION 4
28+
# endif
29+
#endif
30+
31+
// This requirement is mainly to reduce the support burden (see PR #4570).
32+
static_assert(PY_VERSION_HEX < 0x030C0000 || PYBIND11_INTERNALS_VERSION >= 5,
33+
"pybind11 ABI version 5 is the minimum for Python 3.12+");

0 commit comments

Comments
 (0)