Skip to content

Commit 903b92f

Browse files
committed
Merge branch 'master' into sh_merge_master
2 parents 79fd12b + 7233072 commit 903b92f

23 files changed

+45
-91
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,6 @@ jobs:
312312
fail-fast: false
313313
matrix:
314314
clang:
315-
- 3.6
316-
- 3.7
317-
- 3.9
318-
- 7
319-
- 9
320315
- dev
321316
std:
322317
- 11
@@ -325,8 +320,6 @@ jobs:
325320
include:
326321
- clang: 5
327322
std: 14
328-
- clang: 10
329-
std: 17
330323
- clang: 11
331324
std: 20
332325
- clang: 12
@@ -504,10 +497,6 @@ jobs:
504497
fail-fast: false
505498
matrix:
506499
include:
507-
- { gcc: 7, std: 11 }
508-
- { gcc: 7, std: 17 }
509-
- { gcc: 8, std: 14 }
510-
- { gcc: 8, std: 17 }
511500
- { gcc: 9, std: 20 }
512501
- { gcc: 10, std: 17 }
513502
- { gcc: 10, std: 20 }
@@ -728,9 +717,9 @@ jobs:
728717

729718
# This tests an "install" with the CMake tools
730719
install-classic:
731-
name: "🐍 3.7 • Debian • x86 • Install"
720+
name: "🐍 3.9 • Debian • x86 • Install"
732721
runs-on: ubuntu-latest
733-
container: i386/debian:buster
722+
container: i386/debian:bullseye
734723

735724
steps:
736725
- uses: actions/checkout@v1 # v1 is required to run inside docker
@@ -810,7 +799,6 @@ jobs:
810799
fail-fast: false
811800
matrix:
812801
python:
813-
- '3.7'
814802
- '3.8'
815803
- '3.9'
816804
- '3.10'
@@ -828,8 +816,6 @@ jobs:
828816
args: -DCMAKE_CXX_STANDARD=20
829817
- python: '3.8'
830818
args: -DCMAKE_CXX_STANDARD=17
831-
- python: '3.7'
832-
args: -DCMAKE_CXX_STANDARD=14
833819

834820

835821
name: "🐍 ${{ matrix.python }} • MSVC 2019 • x86 ${{ matrix.args }}"

.github/workflows/configure.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ jobs:
4040

4141
- runs-on: macos-13
4242
arch: x64
43-
cmake: "3.7"
43+
cmake: "3.8"
4444

4545
- runs-on: windows-2019
4646
arch: x64 # x86 compilers seem to be missing on 2019 image
4747
cmake: "3.18"
4848

49-
name: 🐍 3.7 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}
49+
name: 🐍 3.8 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}
5050
runs-on: ${{ matrix.runs-on }}
5151

5252
steps:
5353
- uses: actions/checkout@v4
5454

55-
- name: Setup Python 3.7
55+
- name: Setup Python 3.8
5656
uses: actions/setup-python@v5
5757
with:
58-
python-version: 3.7
58+
python-version: 3.8
5959
architecture: ${{ matrix.arch }}
6060

6161
- name: Prepare env

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependency.
3838
Think of this library as a tiny self-contained version of Boost.Python
3939
with everything stripped away that isn't relevant for binding
4040
generation. Without comments, the core header files only require ~4K
41-
lines of code and depend on Python (3.7+, or PyPy) and the C++
41+
lines of code and depend on Python (3.8+, or PyPy) and the C++
4242
standard library. This compact implementation was possible thanks to
4343
some C++11 language features (specifically: tuples, lambda functions and
4444
variadic templates). Since its creation, this library has grown beyond
@@ -83,7 +83,7 @@ Goodies
8383
In addition to the core functionality, pybind11 provides some extra
8484
goodies:
8585

86-
- Python 3.7+, and PyPy3 7.3 are supported with an implementation-agnostic
86+
- Python 3.8+, and PyPy3 7.3 are supported with an implementation-agnostic
8787
interface (pybind11 2.9 was the last version to support Python 2 and 3.5).
8888

8989
- It is possible to bind C++11 lambda functions with captured

docs/advanced/classes.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,7 @@ An instance can now be pickled as follows:
826826
always use the latest available version. Beware: failure to follow these
827827
instructions will cause important pybind11 memory allocation routines to be
828828
skipped during unpickling, which will likely lead to memory corruption
829-
and/or segmentation faults. Python defaults to version 3 (Python 3-3.7) and
830-
version 4 for Python 3.8+.
829+
and/or segmentation faults.
831830

832831
.. seealso::
833832

docs/advanced/exceptions.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ Should they throw or fail to catch any exceptions in their call graph,
368368
the C++ runtime calls ``std::terminate()`` to abort immediately.
369369

370370
Similarly, Python exceptions raised in a class's ``__del__`` method do not
371-
propagate, but are logged by Python as an unraisable error. In Python 3.8+, a
372-
`system hook is triggered
371+
propagate, but ``sys.unraisablehook()`` `is triggered
373372
<https://docs.python.org/3/library/sys.html#sys.unraisablehook>`_
374373
and an auditing event is logged.
375374

docs/compiling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ with ``PYTHON_EXECUTABLE``. For example:
426426

427427
.. code-block:: bash
428428
429-
cmake -DPYBIND11_PYTHON_VERSION=3.7 ..
429+
cmake -DPYBIND11_PYTHON_VERSION=3.8 ..
430430
431431
# Another method:
432432
cmake -DPYTHON_EXECUTABLE=/path/to/python ..
@@ -493,7 +493,7 @@ existing targets instead:
493493
cmake_minimum_required(VERSION 3.15...3.22)
494494
project(example LANGUAGES CXX)
495495
496-
find_package(Python 3.7 COMPONENTS Interpreter Development REQUIRED)
496+
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
497497
find_package(pybind11 CONFIG REQUIRED)
498498
# or add_subdirectory(pybind11)
499499

include/pybind11/cast.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct type_caster<T, enable_if_t<std::is_arithmetic<T>::value && !is_std_char_t
175175
} else {
176176
handle src_or_index = src;
177177
// PyPy: 7.3.7's 3.8 does not implement PyLong_*'s __index__ calls.
178-
#if PY_VERSION_HEX < 0x03080000 || defined(PYPY_VERSION)
178+
#if defined(PYPY_VERSION)
179179
object index;
180180
if (!PYBIND11_LONG_CHECK(src.ptr())) { // So: index_check(src.ptr())
181181
index = reinterpret_steal<object>(PyNumber_Index(src.ptr()));
@@ -1527,7 +1527,7 @@ struct kw_only {};
15271527

15281528
/// \ingroup annotations
15291529
/// Annotation indicating that all previous arguments are positional-only; the is the equivalent of
1530-
/// an unnamed '/' argument (in Python 3.8)
1530+
/// an unnamed '/' argument
15311531
struct pos_only {};
15321532

15331533
template <typename T>

include/pybind11/detail/class.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,19 +468,9 @@ extern "C" inline void pybind11_object_dealloc(PyObject *self) {
468468

469469
type->tp_free(self);
470470

471-
#if PY_VERSION_HEX < 0x03080000
472-
// `type->tp_dealloc != pybind11_object_dealloc` means that we're being called
473-
// as part of a derived type's dealloc, in which case we're not allowed to decref
474-
// the type here. For cross-module compatibility, we shouldn't compare directly
475-
// with `pybind11_object_dealloc`, but with the common one stashed in internals.
476-
auto pybind11_object_type = (PyTypeObject *) get_internals().instance_base;
477-
if (type->tp_dealloc == pybind11_object_type->tp_dealloc)
478-
Py_DECREF(type);
479-
#else
480471
// This was not needed before Python 3.8 (Python issue 35810)
481472
// https://github.com/pybind/pybind11/issues/1946
482473
Py_DECREF(type);
483-
#endif
484474
}
485475

486476
std::string error_string();

include/pybind11/detail/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ PYBIND11_WARNING_DISABLE_MSVC(4505)
272272
#endif
273273

274274
#include <Python.h>
275-
#if PY_VERSION_HEX < 0x03070000
276-
# error "PYTHON < 3.7 IS UNSUPPORTED. pybind11 v2.12 was the last to support Python 3.6."
275+
#if PY_VERSION_HEX < 0x03080000
276+
# error "PYTHON < 3.8 IS UNSUPPORTED. pybind11 v2.13 was the last to support Python 3.7."
277277
#endif
278278
#include <frameobject.h>
279279
#include <pythread.h>

include/pybind11/detail/internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ inline void translate_local_exception(std::exception_ptr p) {
458458

459459
inline object get_python_state_dict() {
460460
object state_dict;
461-
#if PYBIND11_INTERNALS_VERSION <= 4 || PY_VERSION_HEX < 0x03080000 || defined(PYPY_VERSION)
461+
#if PYBIND11_INTERNALS_VERSION <= 4 || defined(PYPY_VERSION)
462462
state_dict = reinterpret_borrow<object>(PyEval_GetBuiltins());
463463
#else
464464
# if PY_VERSION_HEX < 0x03090000

include/pybind11/embed.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,13 @@ inline void initialize_interpreter_pre_pyconfig(bool init_signal_handlers,
104104
detail::precheck_interpreter();
105105
Py_InitializeEx(init_signal_handlers ? 1 : 0);
106106

107-
// Before it was special-cased in python 3.8, passing an empty or null argv
108-
// caused a segfault, so we have to reimplement the special case ourselves.
109-
bool special_case = (argv == nullptr || argc <= 0);
110-
111-
const char *const empty_argv[]{"\0"};
112-
const char *const *safe_argv = special_case ? empty_argv : argv;
113-
if (special_case) {
114-
argc = 1;
115-
}
116-
117107
auto argv_size = static_cast<size_t>(argc);
118108
// SetArgv* on python 3 takes wchar_t, so we have to convert.
119109
std::unique_ptr<wchar_t *[]> widened_argv(new wchar_t *[argv_size]);
120110
std::vector<std::unique_ptr<wchar_t[], detail::wide_char_arg_deleter>> widened_argv_entries;
121111
widened_argv_entries.reserve(argv_size);
122112
for (size_t ii = 0; ii < argv_size; ++ii) {
123-
widened_argv_entries.emplace_back(detail::widen_chars(safe_argv[ii]));
113+
widened_argv_entries.emplace_back(detail::widen_chars(argv[ii]));
124114
if (!widened_argv_entries.back()) {
125115
// A null here indicates a character-encoding failure or the python
126116
// interpreter out of memory. Give up.

include/pybind11/eval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1919
PYBIND11_NAMESPACE_BEGIN(detail)
2020

2121
inline void ensure_builtins_in_globals(object &global) {
22-
#if defined(PYPY_VERSION) || PY_VERSION_HEX < 0x03080000
22+
#if defined(PYPY_VERSION)
2323
// Running exec and eval adds `builtins` module under `__builtins__` key to
2424
// globals if not yet present. Python 3.8 made PyRun_String behave
2525
// similarly. Let's also do that for older versions, for consistency. This

include/pybind11/gil.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ class gil_scoped_release {
147147
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
148148
tstate = PyEval_SaveThread();
149149
if (disassoc) {
150-
// Python >= 3.7 can remove this, it's an int before 3.7
151-
// NOLINTNEXTLINE(readability-qualified-auto)
152-
auto key = internals.tstate;
150+
auto key = internals.tstate; // NOLINT(readability-qualified-auto)
153151
PYBIND11_TLS_DELETE_VALUE(key);
154152
}
155153
}
@@ -173,9 +171,7 @@ class gil_scoped_release {
173171
PyEval_RestoreThread(tstate);
174172
}
175173
if (disassoc) {
176-
// Python >= 3.7 can remove this, it's an int before 3.7
177-
// NOLINTNEXTLINE(readability-qualified-auto)
178-
auto key = detail::get_internals().tstate;
174+
auto key = detail::get_internals().tstate; // NOLINT(readability-qualified-auto)
179175
PYBIND11_TLS_REPLACE_VALUE(key, tstate);
180176
}
181177
}

pybind11/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import sys
44

5-
if sys.version_info < (3, 7): # noqa: UP036
6-
msg = "pybind11 does not support Python < 3.7. v2.12 was the last release supporting Python 3.6."
5+
if sys.version_info < (3, 8): # noqa: UP036
6+
msg = "pybind11 does not support Python < 3.8. v2.13 was the last release supporting Python 3.7."
77
raise ImportError(msg)
88

99

pybind11/setup_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def has_flag(compiler: Any, flag: str) -> bool:
249249
cpp_flag_cache = None
250250

251251

252-
@lru_cache()
252+
@lru_cache
253253
def auto_cpp_level(compiler: Any) -> str | int:
254254
"""
255255
Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ignore_missing_imports = true
3030

3131

3232
[tool.pylint]
33-
master.py-version = "3.7"
33+
master.py-version = "3.8"
3434
reports.output-format = "colorized"
3535
messages_control.disable = [
3636
"design",
@@ -45,7 +45,7 @@ messages_control.disable = [
4545
]
4646

4747
[tool.ruff]
48-
target-version = "py37"
48+
target-version = "py38"
4949
src = ["src"]
5050

5151
[tool.ruff.lint]

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ classifiers =
1414
Topic :: Utilities
1515
Programming Language :: C++
1616
Programming Language :: Python :: 3 :: Only
17-
Programming Language :: Python :: 3.7
1817
Programming Language :: Python :: 3.8
1918
Programming Language :: Python :: 3.9
2019
Programming Language :: Python :: 3.10
@@ -39,5 +38,5 @@ project_urls =
3938
Chat = https://gitter.im/pybind/Lobby
4039

4140
[options]
42-
python_requires = >=3.7
41+
python_requires = >=3.8
4342
zip_safe = False

tests/requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
--only-binary=:all:
2-
build~=1.0; python_version>="3.7"
3-
numpy~=1.20.0; python_version=="3.7" and platform_python_implementation=="PyPy"
2+
build~=1.0; python_version>="3.8"
43
numpy~=1.23.0; python_version=="3.8" and platform_python_implementation=="PyPy"
54
numpy~=1.25.0; python_version=="3.9" and platform_python_implementation=='PyPy'
6-
numpy~=1.21.5; platform_python_implementation!="PyPy" and python_version>="3.7" and python_version<"3.10"
5+
numpy~=1.21.5; platform_python_implementation!="PyPy" and python_version>="3.8" and python_version<"3.10"
76
numpy~=1.22.2; platform_python_implementation!="PyPy" and python_version=="3.10"
87
numpy~=1.26.0; platform_python_implementation!="PyPy" and python_version>="3.11" and python_version<"3.13"
98
pytest~=7.0

tests/test_builtin_casters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def cant_convert(v):
297297
cant_convert(3.14159)
298298
# TODO: Avoid DeprecationWarning in `PyLong_AsLong` (and similar)
299299
# TODO: PyPy 3.8 does not behave like CPython 3.8 here yet (7.3.7)
300-
if (3, 8) <= sys.version_info < (3, 10) and env.CPYTHON:
300+
if sys.version_info < (3, 10) and env.CPYTHON:
301301
with env.deprecated_call():
302302
assert convert(Int()) == 42
303303
else:

tests/test_exceptions.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,24 @@ def ignore_pytest_unraisable_warning(f):
103103
@pytest.mark.xfail(env.PYPY, reason="Failure on PyPy 3.8 (7.3.7)", strict=False)
104104
@ignore_pytest_unraisable_warning
105105
def test_python_alreadyset_in_destructor(monkeypatch, capsys):
106-
hooked = False
107106
triggered = False
108107

109-
if hasattr(sys, "unraisablehook"): # Python 3.8+
110-
hooked = True
111-
# Don't take `sys.unraisablehook`, as that's overwritten by pytest
112-
default_hook = sys.__unraisablehook__
108+
# Don't take `sys.unraisablehook`, as that's overwritten by pytest
109+
default_hook = sys.__unraisablehook__
113110

114-
def hook(unraisable_hook_args):
115-
exc_type, exc_value, exc_tb, err_msg, obj = unraisable_hook_args
116-
if obj == "already_set demo":
117-
nonlocal triggered
118-
triggered = True
119-
default_hook(unraisable_hook_args)
120-
return
111+
def hook(unraisable_hook_args):
112+
exc_type, exc_value, exc_tb, err_msg, obj = unraisable_hook_args
113+
if obj == "already_set demo":
114+
nonlocal triggered
115+
triggered = True
116+
default_hook(unraisable_hook_args)
117+
return
121118

122-
# Use monkeypatch so pytest can apply and remove the patch as appropriate
123-
monkeypatch.setattr(sys, "unraisablehook", hook)
119+
# Use monkeypatch so pytest can apply and remove the patch as appropriate
120+
monkeypatch.setattr(sys, "unraisablehook", hook)
124121

125122
assert m.python_alreadyset_in_destructor("already_set demo") is True
126-
if hooked:
127-
assert triggered is True
123+
assert triggered is True
128124

129125
_, captured_stderr = capsys.readouterr()
130126
assert captured_stderr.startswith("Exception ignored in: 'already_set demo'")

tools/FindPythonLibsNew.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ endif()
9292

9393
# Use the Python interpreter to find the libs.
9494
if(NOT PythonLibsNew_FIND_VERSION)
95-
set(PythonLibsNew_FIND_VERSION "3.7")
95+
set(PythonLibsNew_FIND_VERSION "3.8")
9696
endif()
9797

9898
if(NOT CMAKE_VERSION VERSION_LESS "3.27")

tools/pybind11NewTools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
5656
endif()
5757

5858
find_package(
59-
Python 3.7 REQUIRED COMPONENTS ${_pybind11_interp_component} ${_pybind11_dev_component}
59+
Python 3.8 REQUIRED COMPONENTS ${_pybind11_interp_component} ${_pybind11_dev_component}
6060
${_pybind11_quiet} ${_pybind11_global_keyword})
6161

6262
# If we are in submodule mode, export the Python targets to global targets.

tools/pybind11Tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ endif()
4343

4444
# A user can set versions manually too
4545
set(Python_ADDITIONAL_VERSIONS
46-
"3.12;3.11;3.10;3.9;3.8;3.7"
46+
"3.12;3.11;3.10;3.9;3.8"
4747
CACHE INTERNAL "")
4848

4949
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

0 commit comments

Comments
 (0)