Repository Analysis

pybind/pybind11

Seamless operability between C++11 and Python

8.4 Low AI signal View on GitHub
8.4
Adjusted Score
8.4
Raw Score
100%
Time Factor
2026-05-27
Last Push
17,879
Stars
C++
Language
76,088
Lines of Code
308
Files
590
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 5MEDIUM 6LOW 579

Pattern Findings

590 matches across 11 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers337 hits · 346 pts
SeverityFileLineSnippet
LOWtests/test_stl_binders.py198def test_map_string_double_const():
LOWtests/test_stl_binders.py211def test_noncopyable_containers():
LOWtests/test_methods_and_attributes.py29def test_methods_and_attributes():
LOWtests/test_methods_and_attributes.py274def test_property_return_value_policies(access):
LOWtests/test_methods_and_attributes.py294def test_property_rvalue_policy():
LOWtests/test_methods_and_attributes.py388def test_dynamic_attr_dealloc_frees_dict_contents():
LOWtests/test_methods_and_attributes.py519def test_unregistered_base_implementations():
LOWtests/test_methods_and_attributes.py565def test_rvalue_ref_qualified_methods():
LOWtests/test_methods_and_attributes.py589def test_noexcept_rvalue_ref_qualified_methods():
LOWtests/test_methods_and_attributes.py603def test_noexcept_overload_cast():
LOWtests/test_methods_and_attributes.py621def test_ref_qualified_overload_cast():
LOWtests/test_methods_and_attributes.py645def test_noexcept_ref_qualified_overload_cast():
LOWtests/test_sequences_and_iterators.py19def test_slice_constructors_explicit_optional():
LOWtests/test_sequences_and_iterators.py24def test_generalized_iterators():
LOWtests/test_sequences_and_iterators.py56def test_generalized_iterators_simple():
LOWtests/test_sequences_and_iterators.py66def test_iterator_doc_annotations():
LOWtests/test_sequences_and_iterators.py83def test_iterator_referencing():
LOWtests/test_sequences_and_iterators.py235def test_python_iterator_in_cpp():
LOWtests/test_sequences_and_iterators.py267def test_iterator_passthrough():
LOWtests/test_sequences_and_iterators.py288def test_generated_dunder_methods_pos_only():
LOWtests/test_numpy_vectorize.py159def test_trivial_broadcasting():
LOWtests/test_numpy_vectorize.py210def test_passthrough_arguments(doc):
LOWtests/test_numpy_vectorize.py243def test_method_vectorization():
LOWtests/test_numpy_vectorize.py250def test_ref_qualified_method_vectorization():
LOWtests/test_numpy_vectorize.py270def test_noexcept_ref_qualified_method_vectorization():
LOWtests/test_numpy_vectorize.py284def test_noexcept_method_vectorization():
LOWtests/test_class_release_gil_before_calling_cpp_dtor.py17def test_gil_state_check_results(probe_type, unique_key, expected_result):
LOWtests/test_chrono.py32def test_chrono_system_clock_roundtrip():
LOWtests/test_chrono.py46def test_chrono_system_clock_roundtrip_date():
LOWtests/test_chrono.py102def test_chrono_system_clock_roundtrip_time(time1, tz, monkeypatch):
LOWtests/test_chrono.py125def test_chrono_duration_roundtrip():
LOWtests/test_chrono.py145def test_chrono_duration_subtraction_equivalence():
LOWtests/test_chrono.py155def test_chrono_duration_subtraction_equivalence_date():
LOWtests/test_chrono.py170def test_chrono_steady_clock_roundtrip():
LOWtests/test_chrono.py180def test_floating_point_duration():
LOWtests/test_chrono.py200def test_chrono_different_resolutions():
LOWtests/conftest.py34def use_multiprocessing_forkserver_on_linux():
LOWtests/conftest.py205def pytest_assertrepr_compare(op, left, right): # noqa: ARG001
LOWtests/conftest.py228def delattr_and_ensure_destroyed(*specs):
LOWtests/test_callbacks.py38def test_bound_method_callback():
LOWtests/test_callbacks.py51def test_keyword_args_and_generalized_unpacking():
LOWtests/test_callbacks.py94def test_lambda_closure_cleanup():
LOWtests/test_callbacks.py103def test_cpp_callable_cleanup():
LOWtests/test_callbacks.py108def test_cpp_function_roundtrip():
LOWtests/test_callbacks.py191def test_async_async_callbacks():
LOWtests/test_callbacks.py239def test_boost_histogram_apply_custom_transform():
LOWtests/test_warnings.py30def test_warning_wrong_subclass_fail():
LOWtests/test_warnings.py41def test_warning_double_register_fail():
LOWtests/test_pytypes.py473def test_non_converting_constructors():
LOWtests/test_pytypes.py661def test_memoryview_from_buffer_empty_shape():
LOWtests/test_pytypes.py668def test_test_memoryview_from_buffer_invalid_strides():
LOWtests/test_pytypes.py673def test_test_memoryview_from_buffer_nullptr():
LOWtests/test_pytypes.py678def test_memoryview_from_memory():
LOWtests/test_pytypes.py924def test_tuple_nonempty_annotations(doc):
LOWtests/test_pytypes.py931def test_tuple_empty_annotations(doc):
LOWtests/test_pytypes.py937def test_tuple_variable_length_annotations(doc):
LOWtests/test_pytypes.py1008def test_union_object_annotations(doc):
LOWtests/test_pytypes.py1015def test_optional_annotations(doc):
LOWtests/test_pytypes.py1021def test_type_guard_annotations(doc, backport_typehints):
LOWtests/test_pytypes.py208def test_unhashable_exceptions(arg, func):
277 more matches not shown…
Unused Imports119 hits · 119 pts
SeverityFileLineSnippet
LOWnoxfile.py7
LOWtools/libsize.py1
LOWtools/make_changelog.py7
LOWtools/make_global.py6
LOWtools/codespell_ignore_lines_from_errors.py12
LOWpybind11/setup_helpers.py39
LOWpybind11/_version.py5
LOWpybind11/__init__.py1
LOWpybind11/__init__.py10
LOWpybind11/__init__.py11
LOWpybind11/__init__.py11
LOWpybind11/__init__.py11
LOWpybind11/commands.py1
LOWpybind11/__main__.py2
LOWtests/test_stl_binders.py1
LOWtests/test_methods_and_attributes.py1
LOWtests/test_sequences_and_iterators.py1
LOWtests/test_vector_unique_ptr_member.py1
LOWtests/test_numpy_vectorize.py1
LOWtests/test_class_release_gil_before_calling_cpp_dtor.py1
LOWtests/test_chrono.py1
LOWtests/test_chrono.py7
LOWtests/conftest.py7
LOWtests/test_python_multiple_inheritance.py3
LOWtests/test_callbacks.py1
LOWtests/test_callbacks.py9
LOWtests/test_warnings.py1
LOWtests/test_warnings.py7
LOWtests/test_pytypes.py1
LOWtests/test_class.py1
LOWtests/env.py1
LOWtests/test_class_sh_trampoline_self_life_support.py1
LOWtests/test_class_sh_property_non_owning.py1
LOWtests/test_docs_advanced_cast_custom.py1
LOWtests/test_eigen_tensor.py1
LOWtests/test_eigen_tensor.py7
LOWtests/test_class_sh_trampoline_shared_from_this.py1
LOWtests/test_docstring_options.py1
LOWtests/test_cpp_conduit.py3
LOWtests/test_class_sh_disowning_mi.py1
LOWtests/test_class_sh_disowning_mi.py5
LOWtests/test_async.py1
LOWtests/test_unnamed_namespace_a.py1
LOWtests/test_class_sh_basic.py2
LOWtests/test_class_sh_trampoline_basic.py1
LOWtests/test_local_bindings.py1
LOWtests/test_class_sh_factory_constructors.py1
LOWtests/test_smart_ptr.py1
LOWtests/test_smart_ptr.py5
LOWtests/test_numpy_array.py1
LOWtests/test_numpy_array.py5
LOWtests/test_builtin_casters.py1
LOWtests/test_constants_and_functions.py1
LOWtests/test_exceptions.py1
LOWtests/test_factory_constructors.py1
LOWtests/test_factory_constructors.py7
LOWtests/test_iostream.py1
LOWtests/test_operator_overloading.py1
LOWtests/test_union.py1
LOWtests/test_kwargs_and_defaults.py1
59 more matches not shown…
Over-Commented Block110 hits · 110 pts
SeverityFileLineSnippet
LOW.pre-commit-config.yaml1# To use:
LOW.cmake-format.yaml21 # arguments, then force it to a vertical layout.
LOWtools/check-style.sh1#!/bin/bash
LOWinclude/pybind11/numpy.h21#include <cstdlib>
LOWinclude/pybind11/numpy.h461PYBIND11_NUMPY_SCALAR_IMPL(std::complex<double>, NPY_CDOUBLE);
LOWinclude/pybind11/numpy.h921 // Note: The signature, `dtype::char_` follows the naming of NumPy's
LOWinclude/pybind11/numpy.h1801
LOWinclude/pybind11/numpy.h1821# define PYBIND11_MAP_END(...)
LOWinclude/pybind11/pybind11.h21#include "gil.h"
LOWinclude/pybind11/pybind11.h261#else
LOWinclude/pybind11/pybind11.h701
LOWinclude/pybind11/iostream.h21
LOWinclude/pybind11/subinterpreter.h21
LOWinclude/pybind11/subinterpreter.h261/// A single OS thread can hold one of these per subinterpreter and alternate between them via
LOWinclude/pybind11/native_enum.h1// Copyright (c) 2022-2025 The pybind Community.
LOWinclude/pybind11/stl.h21#include <memory>
LOWinclude/pybind11/common.h1#include "detail/common.h"
LOWinclude/pybind11/cast.h21
LOWinclude/pybind11/cast.h1121/// Specialize for the common std::shared_ptr, so users don't need to
LOWinclude/pybind11/cast.h1141/// (see issue #5623). An easy solution is to use py::potentially_slicing_weak_ptr<>(obj),
LOWinclude/pybind11/trampoline_self_life_support.h1// Copyright (c) 2021 The Pybind Development Team.
LOWinclude/pybind11/gil_safe_call_once.h1// Copyright (c) 2023 The pybind Community.
LOWinclude/pybind11/gil_safe_call_once.h21PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
LOWinclude/pybind11/gil_safe_call_once.h41//
LOWinclude/pybind11/gil_safe_call_once.h61// normal Python code. However, this will be unnoticeable for quick call-once
LOWinclude/pybind11/gil_safe_call_once.h261 // Fast local cache to avoid repeated lookups when there are no multiple interpreters.
LOWinclude/pybind11/pytypes.h761
LOWinclude/pybind11/conduit/pybind11_platform_abi_id.h1#pragma once
LOWinclude/pybind11/conduit/pybind11_platform_abi_id.h21# define PYBIND11_COMPILER_TYPE "mingw"
LOWinclude/pybind11/conduit/pybind11_platform_abi_id.h41# if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd.
LOWinclude/pybind11/conduit/pybind11_platform_abi_id.h61// // Assume that NVHPC is in the 1xxx ABI family.
LOWinclude/pybind11/conduit/pybind11_platform_abi_id.h81# define PYBIND11_BUILD_TYPE "_debug"
LOWinclude/pybind11/conduit/wrap_include_python_h.h1#pragma once
LOWinclude/pybind11/conduit/wrap_include_python_h.h21// See https://github.com/pybind/pybind11/pull/3497 for full context.
LOWinclude/pybind11/conduit/wrap_include_python_h.h41// C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed
LOWinclude/pybind11/conduit/wrap_include_python_h.h61# undef isalnum
LOWinclude/pybind11/stl/filesystem.h1// Copyright (c) 2021 The Pybind Development Team.
LOWinclude/pybind11/detail/type_caster_base.h21#include "typeid.h"
LOWinclude/pybind11/detail/type_caster_base.h41/// A life support system for temporary objects created by `type_caster::load()`.
LOWinclude/pybind11/detail/type_caster_base.h1561template <>
LOWinclude/pybind11/detail/function_ref.h1/*
LOWinclude/pybind11/detail/function_ref.h21//===----------------------------------------------------------------------===//
LOWinclude/pybind11/detail/function_record_pyobject.h1// Copyright (c) 2024-2025 The Pybind Development Team.
LOWinclude/pybind11/detail/function_record_pyobject.h41 // unhelpful compiler warnings.
LOWinclude/pybind11/detail/internals.h21#include <cstdint>
LOWinclude/pybind11/detail/internals.h41#ifndef PYBIND11_INTERNALS_VERSION
LOWinclude/pybind11/detail/internals.h61 _Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
LOWinclude/pybind11/detail/internals.h301/// `PYBIND11_INTERNALS_VERSION` must be incremented.
LOWinclude/pybind11/detail/internals.h581
LOWinclude/pybind11/detail/internals.h621 }
LOWinclude/pybind11/detail/internals.h821 on_fetch_function *on_fetch_ = nullptr;
LOWinclude/pybind11/detail/argument_vector.h21#include <cstring>
LOWinclude/pybind11/detail/common.h21#define PYBIND11_VERSION_MINOR 1
LOWinclude/pybind11/detail/common.h41 Py_PACK_FULL_VERSION(PYBIND11_VERSION_MAJOR, \
LOWinclude/pybind11/detail/common.h61// MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully
LOWinclude/pybind11/detail/common.h81
LOWinclude/pybind11/detail/common.h101#else
LOWinclude/pybind11/detail/common.h121# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
LOWinclude/pybind11/detail/common.h141# if defined(WIN32) || defined(_WIN32)
LOWinclude/pybind11/detail/common.h161// https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
50 more matches not shown…
Cross-Language Confusion4 hits · 24 pts
SeverityFileLineSnippet
HIGHtests/test_methods_and_attributes.py594 - Return (Class::*)(Args...) const && noexcept (peek_noexcept)
HIGHtests/test_methods_and_attributes.py632 - overload_cast_impl::operator()(Return (Class::*)(Args...) const && noexcept, true_type)
HIGHtests/test_methods_and_attributes.py652 - overload_cast_impl::operator()(Return (Class::*)(Args...) const && noexcept, true_type)
HIGHtests/test_methods_and_attributes.py658 assert obj.method_const_rref_noexcept(1.0) == "(double) const && noexcept"
Self-Referential Comments3 hits · 9 pts
SeverityFileLineSnippet
MEDIUMtests/test_eval_call.py1# This file is called from 'test_eval.py'
MEDIUMtests/test_custom_type_setup.py69 # Create a self-referential cycle that will be collected during shutdown.
MEDIUMdocs/conf.py6# This file is execfile()d with the current directory set to its
AI Slop Vocabulary3 hits · 8 pts
SeverityFileLineSnippet
MEDIUMpybind11/__main__.py28 # about nuanced counting here.
MEDIUMtests/test_numpy_array.py651# HINT: An easy and robust way (although only manual unfortunately) to check for
LOWtests/test_modules.py138 # changes in future Python versions, simply add the new expected exception types here.
Synthetic Comment Markers1 hit · 8 pts
SeverityFileLineSnippet
HIGHinclude/pybind11/detail/class.h662 // Fill in all the information, and then downgrade as requested by the caller, or raise an
Deep Nesting7 hits · 7 pts
SeverityFileLineSnippet
LOWtools/codespell_ignore_lines_from_errors.py17
LOWpybind11/setup_helpers.py290
LOWtests/test_numpy_array.py591
LOWtests/test_factory_constructors.py481
LOWtests/test_factory_constructors.py499
LOWtests/test_numpy_dtypes.py374
LOWtests/test_gil_scoped.py170
Excessive Try-Catch Wrapping4 hits · 5 pts
SeverityFileLineSnippet
LOWtests/conftest.py27except Exception:
LOWtests/test_thread.py22 except Exception as e:
MEDIUMtests/test_thread.py18def run(self):
LOWtests/test_multiple_interpreters.py115 except Exception as e:
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWtools/libsize.py7# Usage:
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippet
LOWtests/test_numpy_array.py658# value increases without bounds. (Don't forget to Ctrl-C the test!)