diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e138550aa..179caa9e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,8 @@ jobs: - '3.6' - '3.9' - '3.10' - - 'pypy-3.7-v7.3.7' - - 'pypy-3.8-v7.3.7' + - 'pypy-3.7' + - 'pypy-3.8' # Items in here will either be added to the build matrix (if not # present), or add new keys to an existing matrix element if all the diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 052420549..e9a0e03f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,7 +59,7 @@ repos: # Changes tabs to spaces - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: "v1.1.12" + rev: "v1.1.13" hooks: - id: remove-tabs @@ -71,7 +71,7 @@ repos: # Autoremoves unused imports - repo: https://github.com/hadialqattan/pycln - rev: "v1.2.0" + rev: "v1.2.4" hooks: - id: pycln diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h index ebdc07271..e52ec1d3e 100644 --- a/include/pybind11/detail/class.h +++ b/include/pybind11/detail/class.h @@ -101,14 +101,14 @@ inline PyTypeObject *make_static_property_type() { inline PyTypeObject *make_static_property_type() { auto d = dict(); PyObject *result = PyRun_String(R"(\ - class pybind11_static_property(property): - def __get__(self, obj, cls): - return property.__get__(self, cls, cls) +class pybind11_static_property(property): + def __get__(self, obj, cls): + return property.__get__(self, cls, cls) - def __set__(self, obj, value): - cls = obj if isinstance(obj, type) else type(obj) - property.__set__(self, cls, value) - )", + def __set__(self, obj, value): + cls = obj if isinstance(obj, type) else type(obj) + property.__set__(self, cls, value) +)", Py_file_input, d.ptr(), d.ptr()); diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 22b629f40..1ec6c17c6 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -334,7 +334,7 @@ protected: const std::type_info *const *types, size_t args) { // Do NOT receive `unique_rec` by value. If this function fails to move out the unique_ptr, - // we do not want this to destuct the pointer. `initialize` (the caller) still relies on + // we do not want this to destruct the pointer. `initialize` (the caller) still relies on // the pointee being alive after this call. Only move out if a `capsule` is going to keep // it alive. auto *rec = unique_rec.get(); diff --git a/noxfile.py b/noxfile.py index 50b7e4ee0..341d964e9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,6 +2,7 @@ import os import nox +nox.needs_version = ">=2022.1.7" nox.options.sessions = ["lint", "tests", "tests_packaging"] PYTHON_VERISONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8"] @@ -29,14 +30,12 @@ def tests(session: nox.Session) -> None: session.install("-r", "tests/requirements.txt") session.run( "cmake", - "-S", - ".", - "-B", - tmpdir, + "-S.", + f"-B{tmpdir}", "-DPYBIND11_WERROR=ON", "-DDOWNLOAD_CATCH=ON", "-DDOWNLOAD_EIGEN=ON", - *session.posargs + *session.posargs, ) session.run("cmake", "--build", tmpdir) session.run("cmake", "--build", tmpdir, "--config=Release", "--target", "check") diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake index 7aeffa441..6ad5fe157 100644 --- a/tools/FindPythonLibsNew.cmake +++ b/tools/FindPythonLibsNew.cmake @@ -112,11 +112,24 @@ endif() # VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows. execute_process( COMMAND - "${PYTHON_EXECUTABLE}" "-c" "from distutils import sysconfig as s;import sys;import struct; + "${PYTHON_EXECUTABLE}" "-c" " +import sys;import struct; +import sysconfig as s +USE_SYSCONFIG = sys.version_info >= (3, 10) +if not USE_SYSCONFIG: + from distutils import sysconfig as ds print('.'.join(str(v) for v in sys.version_info)); print(sys.prefix); -print(s.get_python_inc(plat_specific=True)); -print(s.get_python_lib(plat_specific=True)); +if USE_SYSCONFIG: + scheme = s.get_default_scheme() + if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' + print(s.get_path('platinclude', scheme)) + print(s.get_path('platlib')) +else: + print(ds.get_python_inc(plat_specific=True)); + print(ds.get_python_lib(plat_specific=True)); print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO')); print(hasattr(sys, 'gettotalrefcount')+0); print(struct.calcsize('@P'));