Skip to content

Commit

Permalink
Merge branch 'v2.10' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Mar 16, 2023
2 parents 12852cd + 5b0a6fc commit be97c5a
Show file tree
Hide file tree
Showing 25 changed files with 110 additions and 59 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ jobs:
- dev
std:
- 11
container_suffix:
- ""
include:
- clang: 5
std: 14
Expand All @@ -293,9 +295,12 @@ jobs:
std: 20
- clang: 14
std: 20
- clang: 15
std: 20
container_suffix: "-bullseye"

name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64"
container: "silkeh/clang:${{ matrix.clang }}"
container: "silkeh/clang:${{ matrix.clang }}${{ matrix.container_suffix }}"

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -761,7 +766,7 @@ jobs:
uses: jwlawson/actions-setup-cmake@v1.13

- name: Prepare MSVC
uses: ilammy/msvc-dev-cmd@v1.12.0
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: x86

Expand Down Expand Up @@ -814,7 +819,7 @@ jobs:
uses: jwlawson/actions-setup-cmake@v1.13

- name: Prepare MSVC
uses: ilammy/msvc-dev-cmd@v1.12.0
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: x86

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ jobs:
- uses: actions/download-artifact@v3

- name: Publish standard package
uses: pypa/gh-action-pypi-publish@v1.6.4
uses: pypa/gh-action-pypi-publish@v1.8.1
with:
password: ${{ secrets.pypi_password }}
packages_dir: standard/
packages-dir: standard/

- name: Publish global package
uses: pypa/gh-action-pypi-publish@v1.6.4
uses: pypa/gh-action-pypi-publish@v1.8.1
with:
password: ${{ secrets.pypi_password_global }}
packages_dir: global/
packages-dir: global/
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,46 +48,46 @@ repos:

# Nicely sort includes
- repo: https://github.com/PyCQA/isort
rev: "5.11.4"
rev: "5.12.0"
hooks:
- id: isort

# Black, the code formatter, natively supports pre-commit
- repo: https://github.com/psf/black
rev: "22.12.0" # Keep in sync with blacken-docs
rev: "23.1.0" # Keep in sync with blacken-docs
hooks:
- id: black

# Also code format the docs
- repo: https://github.com/asottile/blacken-docs
rev: "v1.12.1"
rev: "1.13.0"
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.10.0 # keep in sync with black hook
- black==23.1.0 # keep in sync with black hook

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: "v1.3.1"
rev: "v1.4.2"
hooks:
- id: remove-tabs

- repo: https://github.com/sirosen/texthooks
rev: "0.4.0"
rev: "0.5.0"
hooks:
- id: fix-ligatures
- id: fix-smartquotes

# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: "v2.1.2"
rev: "v2.1.3"
hooks:
- id: pycln
stages: [manual]

# Checking for common mistakes
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.9.0"
rev: "v1.10.0"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
Expand Down Expand Up @@ -116,7 +116,7 @@ repos:

# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
rev: "v2.15.9"
rev: "v2.16.1"
hooks:
- id: pylint
files: ^pybind11
Expand Down Expand Up @@ -175,7 +175,7 @@ repos:

# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v15.0.6"
rev: "v15.0.7"
hooks:
- id: clang-format
types_or: [c++, c, cuda]
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
prune tests
recursive-include pybind11/include/pybind11 *.h
recursive-include pybind11 *.py
recursive-include pybind11 py.typed
Expand Down
36 changes: 36 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,47 @@ Changes:
``dec_ref()`` are now enabled by default again.
`#4246 <https://github.com/pybind/pybind11/pull/4246>`_

* ``py::initialize_interpreter()`` using ``PyConfig_InitPythonConfig()``
instead of ``PyConfig_InitIsolatedConfig()``, to obtain complete
``sys.path``.
`#4473 <https://github.com/pybind/pybind11/pull/4473>`_

* Cast errors now always include Python type information, even if
``PYBIND11_DETAILED_ERROR_MESSAGES`` is not defined. This increases binary
sizes slightly (~1.5%) but the error messages are much more informative.
`#4463 <https://github.com/pybind/pybind11/pull/4463>`_


Build system improvements:

* Update clang-tidy to 15 in CI.
`#4387 <https://github.com/pybind/pybind11/pull/4387>`_

* Moved the linting framework over to Ruff.
`#4483 <https://github.com/pybind/pybind11/pull/4483>`_

Version 2.10.4 (Mar 16, 2023)
----------------------------

Changes:

* ``python3 -m pybind11`` gained a ``--version`` option (prints the version and
exits).
`#4526 <https://github.com/pybind/pybind11/pull/4526>`_

Bug Fixes:

* Fix a warning when pydebug is enabled on Python 3.11.
`#4461 <https://github.com/pybind/pybind11/pull/4461>`_

* Ensure ``gil_scoped_release`` RAII is non-copyable.
`#4490 <https://github.com/pybind/pybind11/pull/4490>`_

* Ensure the tests dir does not show up with new versions of setuptools.
`#4510 <https://github.com/pybind/pybind11/pull/4510>`_

* Better stacklevel for a warning in setuptools helpers.
`#4516 <https://github.com/pybind/pybind11/pull/4516>`_

Version 2.10.3 (Jan 3, 2023)
----------------------------
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def clean_up(app, exception):


def setup(app):

# Add hook for building doxygen xml when needed
app.connect("builder-inited", generate_doxygen_xml)

Expand Down
10 changes: 9 additions & 1 deletion include/pybind11/detail/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,17 @@ inline void clear_instance(PyObject *self) {
/// Instance destructor function for all pybind11 types. It calls `type_info.dealloc`
/// to destroy the C++ object itself, while the rest is Python bookkeeping.
extern "C" inline void pybind11_object_dealloc(PyObject *self) {
auto *type = Py_TYPE(self);

// If this is a GC tracked object, untrack it first
// Note that the track call is implicitly done by the
// default tp_alloc, which we never override.
if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_GC) != 0) {
PyObject_GC_UnTrack(self);
}

clear_instance(self);

auto *type = Py_TYPE(self);
type->tp_free(self);

#if PY_VERSION_HEX < 0x03080000
Expand Down
6 changes: 3 additions & 3 deletions include/pybind11/detail/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

#define PYBIND11_VERSION_MAJOR 2
#define PYBIND11_VERSION_MINOR 10
#define PYBIND11_VERSION_PATCH 3
#define PYBIND11_VERSION_PATCH 4

// Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
// Additional convention: 0xD = dev
#define PYBIND11_VERSION_HEX 0x020A0300
#define PYBIND11_VERSION_HEX 0x020A0400

// Define some generic pybind11 helper macros for warning management.
//
Expand Down Expand Up @@ -437,7 +437,7 @@ PYBIND11_WARNING_POP

/** \rst
This macro creates the entry point that will be invoked when the Python interpreter
imports an extension module. The module name is given as the fist argument and it
imports an extension module. The module name is given as the first argument and it
should not be in quotes. The second macro argument defines a variable of type
`py::module_` which can be used to initialize the module.
Expand Down
2 changes: 2 additions & 0 deletions include/pybind11/eigen/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
PYBIND11_WARNING_PUSH
PYBIND11_WARNING_DISABLE_MSVC(5054) // https://github.com/pybind/pybind11/pull/3741
// C5054: operator '&': deprecated between enumerations of different types
#if defined(__MINGW32__)
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
#endif

#include <Eigen/Core>
#include <Eigen/SparseCore>
Expand Down
2 changes: 2 additions & 0 deletions include/pybind11/eigen/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ static_assert(__GNUC__ > 5, "Eigen Tensor support in pybind11 requires GCC > 5.0
PYBIND11_WARNING_PUSH
PYBIND11_WARNING_DISABLE_MSVC(4554)
PYBIND11_WARNING_DISABLE_MSVC(4127)
#if defined(__MINGW32__)
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
#endif

#include <unsupported/Eigen/CXX11/Tensor>

Expand Down
8 changes: 4 additions & 4 deletions include/pybind11/gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class gil_scoped_release {
}
}

gil_scoped_release(const gil_scoped_acquire &) = delete;
gil_scoped_release &operator=(const gil_scoped_acquire &) = delete;
gil_scoped_release(const gil_scoped_release &) = delete;
gil_scoped_release &operator=(const gil_scoped_release &) = delete;

/// This method will disable the PyThreadState_DeleteCurrent call and the
/// GIL won't be acquired. This method should be used if the interpreter
Expand Down Expand Up @@ -203,7 +203,7 @@ class gil_scoped_release {
public:
gil_scoped_release() : state{PyEval_SaveThread()} {}
gil_scoped_release(const gil_scoped_release &) = delete;
gil_scoped_release &operator=(const gil_scoped_acquire &) = delete;
gil_scoped_release &operator=(const gil_scoped_release &) = delete;
~gil_scoped_release() { PyEval_RestoreThread(state); }
void disarm() {}
};
Expand All @@ -230,7 +230,7 @@ class gil_scoped_release {
(void) (this != (this + 1));
}
gil_scoped_release(const gil_scoped_release &) = delete;
gil_scoped_release &operator=(const gil_scoped_acquire &) = delete;
gil_scoped_release &operator=(const gil_scoped_release &) = delete;
void disarm() {}
};

Expand Down
8 changes: 4 additions & 4 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,10 @@ class array_t : public array {

/**
* Returns a proxy object that provides const access to the array's data without bounds or
* dimensionality checking. Unlike `unchecked()`, this does not require that the underlying
* array have the `writable` flag. Use with care: the array must not be destroyed or reshaped
* for the duration of the returned object, and the caller must take care not to access invalid
* dimensions or dimension indices.
* dimensionality checking. Unlike `mutable_unchecked()`, this does not require that the
* underlying array have the `writable` flag. Use with care: the array must not be destroyed
* or reshaped for the duration of the returned object, and the caller must take care not to
* access invalid dimensions or dimension indices.
*/
template <ssize_t Dims = -1>
detail::unchecked_reference<T, Dims> unchecked() const & {
Expand Down
8 changes: 7 additions & 1 deletion pybind11/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import sysconfig

from ._version import __version__
from .commands import get_cmake_dir, get_include, get_pkgconfig_dir


Expand All @@ -24,8 +25,13 @@ def print_includes() -> None:


def main() -> None:

parser = argparse.ArgumentParser()
parser.add_argument(
"--version",
action="version",
version=__version__,
help="Print the version and exit.",
)
parser.add_argument(
"--includes",
action="store_true",
Expand Down
2 changes: 1 addition & 1 deletion pybind11/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def _to_int(s: str) -> Union[int, str]:
return s


__version__ = "2.10.3"
__version__ = "2.10.4"
version_info = tuple(_to_int(s) for s in __version__.split("."))
7 changes: 3 additions & 4 deletions pybind11/setup_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def _add_ldflags(self, flags: List[str]) -> None:
self.extra_link_args[:0] = flags

def __init__(self, *args: Any, **kwargs: Any) -> None:

self._cxx_level = 0
cxx_std = kwargs.pop("cxx_std", 0)

Expand Down Expand Up @@ -174,9 +173,10 @@ def cxx_std(self) -> int:

@cxx_std.setter
def cxx_std(self, level: int) -> None:

if self._cxx_level:
warnings.warn("You cannot safely change the cxx_level after setting it!")
warnings.warn(
"You cannot safely change the cxx_level after setting it!", stacklevel=2
)

# MSVC 2015 Update 3 and later only have 14 (and later 17) modes, so
# force a valid flag here.
Expand Down Expand Up @@ -439,7 +439,6 @@ def compile_function(
extra_postargs: Optional[List[str]] = None,
depends: Optional[List[str]] = None,
) -> Any:

# These lines are directly from distutils.ccompiler.CCompiler
macros, objects, extra_postargs, pp_opts, build = compiler._setup_compile( # type: ignore[attr-defined]
output_dir, macros, include_dirs, sources, depends, extra_postargs
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if(PYBIND11_TEST_OVERRIDE)
# This allows the override to be done with extensions, preserving backwards compatibility.
foreach(test_name ${TEST_FILES_NO_EXT})
if(NOT ${test_name} IN_LIST TEST_OVERRIDE_NO_EXT
)# If not in the whitelist, add to be filtered out.
)# If not in the allowlist, add to be filtered out.
list(APPEND PYBIND11_TEST_FILTER ${test_name})
endif()
endforeach()
Expand Down
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
import os
import re
import textwrap
import traceback

import pytest

# Early diagnostic for failed imports
import pybind11_tests
try:
import pybind11_tests
except Exception:
# pytest does not show the traceback without this.
traceback.print_exc()
raise


@pytest.fixture(scope="session", autouse=True)
Expand Down

0 comments on commit be97c5a

Please sign in to comment.