Skip to content

Commit f8ea68f

Browse files
committed
Merge branch 'master' into sh_merge_master
2 parents 28ec485 + 3aece81 commit f8ea68f

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ repos:
2525

2626
# Clang format the codebase automatically
2727
- repo: https://github.com/pre-commit/mirrors-clang-format
28-
rev: "v16.0.6"
28+
rev: "v17.0.3"
2929
hooks:
3030
- id: clang-format
3131
types_or: [c++, c, cuda]
3232

3333
# Black, the code formatter, natively supports pre-commit
3434
- repo: https://github.com/psf/black-pre-commit-mirror
35-
rev: "23.9.1" # Keep in sync with blacken-docs
35+
rev: "23.10.1" # Keep in sync with blacken-docs
3636
hooks:
3737
- id: black
3838

3939
# Ruff, the Python auto-correcting linter written in Rust
4040
- repo: https://github.com/astral-sh/ruff-pre-commit
41-
rev: v0.0.292
41+
rev: v0.1.2
4242
hooks:
4343
- id: ruff
4444
args: ["--fix", "--show-fixes"]
4545

4646
# Check static types with mypy
4747
- repo: https://github.com/pre-commit/mirrors-mypy
48-
rev: "v1.5.1"
48+
rev: "v1.6.1"
4949
hooks:
5050
- id: mypy
5151
args: []
@@ -67,7 +67,7 @@ repos:
6767

6868
# Standard hooks
6969
- repo: https://github.com/pre-commit/pre-commit-hooks
70-
rev: "v4.4.0"
70+
rev: "v4.5.0"
7171
hooks:
7272
- id: check-added-large-files
7373
- id: check-case-conflict
@@ -100,7 +100,7 @@ repos:
100100

101101
# Avoid directional quotes
102102
- repo: https://github.com/sirosen/texthooks
103-
rev: "0.5.0"
103+
rev: "0.6.2"
104104
hooks:
105105
- id: fix-ligatures
106106
- id: fix-smartquotes
@@ -149,7 +149,7 @@ repos:
149149

150150
# PyLint has native support - not always usable, but works for us
151151
- repo: https://github.com/PyCQA/pylint
152-
rev: "v3.0.0"
152+
rev: "v3.0.1"
153153
hooks:
154154
- id: pylint
155155
files: ^pybind11

include/pybind11/detail/type_caster_base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,10 @@ PYBIND11_NOINLINE handle get_object_handle(const void *ptr, const detail::type_i
486486
inline PyThreadState *get_thread_state_unchecked() {
487487
#if defined(PYPY_VERSION)
488488
return PyThreadState_GET();
489-
#else
489+
#elif PY_VERSION_HEX < 0x030D0000
490490
return _PyThreadState_UncheckedGet();
491+
#else
492+
return PyThreadState_GetUnchecked();
491493
#endif
492494
}
493495

include/pybind11/pytypes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,19 @@ class handle : public detail::object_api<handle> {
305305
"https://pybind11.readthedocs.io/en/stable/advanced/"
306306
"misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.\n"
307307
"If you are convinced there is no bug in your code, you can #define "
308-
"PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF"
308+
"PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF "
309309
"to disable this check. In that case you have to ensure this #define is consistently "
310310
"used for all translation units linked into a given pybind11 extension, otherwise "
311311
"there will be ODR violations.",
312312
function_name.c_str());
313-
fflush(stderr);
314313
if (Py_TYPE(m_ptr)->tp_name != nullptr) {
315314
fprintf(stderr,
316-
"The failing %s call was triggered on a %s object.\n",
315+
" The failing %s call was triggered on a %s object.",
317316
function_name.c_str(),
318317
Py_TYPE(m_ptr)->tp_name);
319-
fflush(stderr);
320318
}
319+
fprintf(stderr, "\n");
320+
fflush(stderr);
321321
throw std::runtime_error(function_name + " PyGILState_Check() failure.");
322322
}
323323
#endif

pyproject.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ignore = [
1919

2020
[tool.mypy]
2121
files = ["pybind11"]
22-
python_version = "3.6"
22+
python_version = "3.7"
2323
strict = true
2424
show_error_codes = true
2525
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
@@ -57,10 +57,13 @@ messages_control.disable = [
5757
"unused-argument", # covered by Ruff ARG
5858
]
5959

60-
6160
[tool.ruff]
62-
select = [
63-
"E", "F", "W", # flake8
61+
target-version = "py37"
62+
src = ["src"]
63+
line-length = 120
64+
65+
[tool.ruff.lint]
66+
extend-select = [
6467
"B", # flake8-bugbear
6568
"I", # isort
6669
"N", # pep8-naming
@@ -86,13 +89,10 @@ ignore = [
8689
"PT004", # Fixture that doesn't return needs underscore (no, it is fine)
8790
"SIM118", # iter(x) is not always the same as iter(x.keys())
8891
]
89-
target-version = "py37"
90-
src = ["src"]
9192
unfixable = ["T20"]
9293
exclude = []
93-
line-length = 120
9494
isort.known-first-party = ["env", "pybind11_cross_module_tests", "pybind11_tests"]
9595

96-
[tool.ruff.per-file-ignores]
96+
[tool.ruff.lint.per-file-ignores]
9797
"tests/**" = ["EM", "N", "E721"]
9898
"tests/test_call_policies.py" = ["PLC1901"]

tests/test_numpy_dtypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ py::array mkarray_via_buffer(size_t n) {
157157
do { \
158158
(s).bool_ = (i) % 2 != 0; \
159159
(s).uint_ = (uint32_t) (i); \
160-
(s).float_ = (float) (i) *1.5f; \
160+
(s).float_ = (float) (i) * 1.5f; \
161161
(s).ldbl_ = (long double) (i) * -2.5L; \
162162
} while (0)
163163

tests/test_pytypes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ TEST_SUBMODULE(pytypes, m) {
662662
// This is "most correct" and enforced on these platforms.
663663
# define PYBIND11_AUTO_IT auto it
664664
#else
665-
// This works on many platforms and is (unfortunately) reflective of existing user code.
666-
// NOLINTNEXTLINE(bugprone-macro-parentheses)
665+
// This works on many platforms and is (unfortunately) reflective of existing user code.
666+
// NOLINTNEXTLINE(bugprone-macro-parentheses)
667667
# define PYBIND11_AUTO_IT auto &it
668668
#endif
669669

0 commit comments

Comments
 (0)