mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-21 20:55:11 +00:00
factor out internals_version.h from internals.h (no functional changes)
This commit is contained in:
parent
87ebc39e98
commit
3ccea8cd43
@ -10,6 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "internals_version.h"
|
||||||
#include "platform_abi_id.h"
|
#include "platform_abi_id.h"
|
||||||
|
|
||||||
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
|
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
|
||||||
@ -22,34 +23,6 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
/// Tracks the `internals` and `type_info` ABI version independent of the main library version.
|
|
||||||
///
|
|
||||||
/// Some portions of the code use an ABI that is conditional depending on this
|
|
||||||
/// version number. That allows ABI-breaking changes to be "pre-implemented".
|
|
||||||
/// Once the default version number is incremented, the conditional logic that
|
|
||||||
/// no longer applies can be removed. Additionally, users that need not
|
|
||||||
/// maintain ABI compatibility can increase the version number in order to take
|
|
||||||
/// advantage of any functionality/efficiency improvements that depend on the
|
|
||||||
/// newer ABI.
|
|
||||||
///
|
|
||||||
/// WARNING: If you choose to manually increase the ABI version, note that
|
|
||||||
/// pybind11 may not be tested as thoroughly with a non-default ABI version, and
|
|
||||||
/// further ABI-incompatible changes may be made before the ABI is officially
|
|
||||||
/// changed to the new version.
|
|
||||||
#ifndef PYBIND11_INTERNALS_VERSION
|
|
||||||
# if PY_VERSION_HEX >= 0x030C0000 || defined(_MSC_VER)
|
|
||||||
// Version bump for Python 3.12+, before first 3.12 beta release.
|
|
||||||
// Version bump for MSVC piggy-backed on PR #4779. See comments there.
|
|
||||||
# define PYBIND11_INTERNALS_VERSION 5
|
|
||||||
# else
|
|
||||||
# define PYBIND11_INTERNALS_VERSION 4
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This requirement is mainly to reduce the support burden (see PR #4570).
|
|
||||||
static_assert(PY_VERSION_HEX < 0x030C0000 || PYBIND11_INTERNALS_VERSION >= 5,
|
|
||||||
"pybind11 ABI version 5 is the minimum for Python 3.12+");
|
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||||
|
|
||||||
using ExceptionTranslator = void (*)(std::exception_ptr);
|
using ExceptionTranslator = void (*)(std::exception_ptr);
|
||||||
|
33
include/pybind11/detail/internals_version.h
Normal file
33
include/pybind11/detail/internals_version.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (c) 2024 The pybind Community.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/// Tracks the `internals` and `type_info` ABI version independent of the main library version.
|
||||||
|
///
|
||||||
|
/// Some portions of the code use an ABI that is conditional depending on this
|
||||||
|
/// version number. That allows ABI-breaking changes to be "pre-implemented".
|
||||||
|
/// Once the default version number is incremented, the conditional logic that
|
||||||
|
/// no longer applies can be removed. Additionally, users that need not
|
||||||
|
/// maintain ABI compatibility can increase the version number in order to take
|
||||||
|
/// advantage of any functionality/efficiency improvements that depend on the
|
||||||
|
/// newer ABI.
|
||||||
|
///
|
||||||
|
/// WARNING: If you choose to manually increase the ABI version, note that
|
||||||
|
/// pybind11 may not be tested as thoroughly with a non-default ABI version, and
|
||||||
|
/// further ABI-incompatible changes may be made before the ABI is officially
|
||||||
|
/// changed to the new version.
|
||||||
|
#ifndef PYBIND11_INTERNALS_VERSION
|
||||||
|
# if PY_VERSION_HEX >= 0x030C0000 || defined(_MSC_VER)
|
||||||
|
// Version bump for Python 3.12+, before first 3.12 beta release.
|
||||||
|
// Version bump for MSVC piggy-backed on PR #4779. See comments there.
|
||||||
|
# define PYBIND11_INTERNALS_VERSION 5
|
||||||
|
# else
|
||||||
|
# define PYBIND11_INTERNALS_VERSION 4
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// This requirement is mainly to reduce the support burden (see PR #4570).
|
||||||
|
static_assert(PY_VERSION_HEX < 0x030C0000 || PYBIND11_INTERNALS_VERSION >= 5,
|
||||||
|
"pybind11 ABI version 5 is the minimum for Python 3.12+");
|
Loading…
Reference in New Issue
Block a user