Rust bindings for the Python interpreter
This report presents the forensic synthetic code analysis of PyO3/pyo3, a Rust project with 15,909 GitHub stars. SynthScan v2.0 examined 143,982 lines of code across 676 source files, recording 714 pattern matches distributed across 15 syntactic categories. The overall adjusted score of 5.0 places this repository in the Low AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 714 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | typos.toml | 1 | [files] | COMMENT |
| LOW | typos.toml | 21 | # | ^^^ | COMMENT |
| LOW | typos.toml | 41 | # error: `placehold` should be `placeholder` | COMMENT |
| LOW | typos.toml | 61 | # | | COMMENT |
| LOW | guide/src/class.md | 241 | ) -> PyResult<()> { | COMMENT |
| LOW | guide/src/class.md | 261 | # }); | COMMENT |
| LOW | guide/src/class.md | 501 | Ok(Py::new(py, sub)?.into_any()) | COMMENT |
| LOW | guide/src/class.md | 841 | - The return type must be `PyResult<T>` or `T` for some `T` that implements `IntoPyObject`. | COMMENT |
| LOW | guide/src/class.md | 1081 | #[classmethod] | COMMENT |
| LOW | guide/src/class.md | 1101 | # let doc: String = class.getattr("__doc__")?.extract()?; | COMMENT |
| LOW | guide/src/class.md | 1121 | # let sig: String = inspect | COMMENT |
| LOW | guide/src/class.md | 1141 | # let method = class.getattr("my_static_method")?; | COMMENT |
| LOW | guide/src/parallelism.md | 41 | ``` | COMMENT |
| LOW | guide/src/parallelism.md | 61 | ``` | COMMENT |
| LOW | guide/src/function.md | 121 | #[pyfunction] | COMMENT |
| LOW | guide/src/function.md | 141 | # let catch_warnings = warnings | COMMENT |
| LOW | guide/src/function.md | 161 | # assert_eq!( | COMMENT |
| LOW | guide/src/migration.md | 501 | # use pyo3::sync::GILOnceCell; | COMMENT |
| LOW | guide/src/migration.md | 1861 | // generate exactly the same value. | COMMENT |
| LOW | guide/src/trait-bounds.md | 181 | # #[pyclass] | COMMENT |
| LOW | guide/src/trait-bounds.md | 201 | # .call_method("get_results", (), None) | COMMENT |
| LOW | guide/src/trait-bounds.md | 341 | # use pyo3::types::PyList; | COMMENT |
| LOW | guide/src/trait-bounds.md | 361 | .unwrap() | COMMENT |
| LOW | guide/src/trait-bounds.md | 381 | # .unwrap(); | COMMENT |
| LOW | guide/src/trait-bounds.md | 421 | py_result.extract() | COMMENT |
| LOW | guide/src/conversions/traits.md | 1 | # Conversion traits | COMMENT |
| LOW | guide/src/conversions/traits.md | 41 | COMMENT | |
| LOW | guide/src/conversions/traits.md | 81 | # let dict = PyDict::new(py); | COMMENT |
| LOW | guide/src/conversions/traits.md | 101 | string_attr: String, | COMMENT |
| LOW | guide/src/conversions/traits.md | 141 | bar: String, | COMMENT |
| LOW | guide/src/conversions/traits.md | 161 | Tuple structs are also supported but do not allow customizing the extraction. | COMMENT |
| LOW | guide/src/conversions/traits.md | 221 | inner: String, | COMMENT |
| LOW | guide/src/conversions/traits.md | 281 | # let rust_thing: RustyEnum<'_> = thing.extract()?; | COMMENT |
| LOW | guide/src/conversions/traits.md | 301 | # ); | COMMENT |
| LOW | guide/src/conversions/traits.md | 321 | # match rust_thing { | COMMENT |
| LOW | guide/src/conversions/traits.md | 341 | # let rust_thing: RustyEnum<'_> = instance.extract()?; | COMMENT |
| LOW | guide/src/conversions/traits.md | 361 | # )?; | COMMENT |
| LOW | guide/src/conversions/traits.md | 381 | # b"text", | COMMENT |
| LOW | guide/src/conversions/traits.md | 401 | enum RustyEnum { | COMMENT |
| LOW | guide/src/conversions/traits.md | 421 | # } | COMMENT |
| LOW | guide/src/conversions/traits.md | 501 | # // Filled case | COMMENT |
| LOW | guide/src/function/signature.md | 141 | COMMENT | |
| LOW | guide/src/function/signature.md | 201 | # let fun = pyo3::wrap_pyfunction!(add, py)?; | COMMENT |
| LOW | guide/src/function/signature.md | 241 | } | COMMENT |
| LOW | guide/src/function/error-handling.md | 161 | } | COMMENT |
| LOW | guide/src/class/numeric.md | 341 | # n = Number(ord(x)) + ((n << five) - n) | COMMENT |
| LOW | guide/src/class/numeric.md | 361 | # assert Number(13) < Number(20) | COMMENT |
| LOW | guide/src/class/numeric.md | 381 | # pass | COMMENT |
| LOW | guide/src/class/object.md | 41 | ## String representations | COMMENT |
| LOW | guide/src/class/object.md | 281 | # let y = &Bound::new(py, Number(4))?; | COMMENT |
| LOW | pyo3-ffi/src/moduleobject.rs | 41 | pub fn PyModule_GetDict(arg1: *mut PyObject) -> *mut PyObject; | COMMENT |
| LOW | pyo3-ffi/src/methodobject.rs | 141 | /// otherwise the behavior is undefined. | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 1 | #![no_std] | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 21 | //! - The vast majority can only be used safely while the thread is attached to the Python interpreter. | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 41 | //! PyO3 uses `rustc`'s `--cfg` flags to enable or disable code used for different Python versions. | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 61 | //! To use these attributes, add [`pyo3-build-config`] as a build dependency in | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 81 | //! - CPython 3.9 or greater | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 101 | //! # Downstream Rust code (including code in `bin/`, `examples/`, and `tests/`) will not be able | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 121 | //! **`build.rs`** | COMMENT |
| LOW | pyo3-ffi/src/lib.rs | 141 | //! m_base: PyModuleDef_HEAD_INIT, | COMMENT |
| 547 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | noxfile.py | 67 | def _parse_supported_interpreter_version( | CODE |
| LOW | noxfile.py | 81 | def _supported_interpreter_versions( | CODE |
| LOW⚡ | noxfile.py | 287 | def _clippy_additional_workspaces(session: nox.Session) -> bool: | CODE |
| LOW | noxfile.py | 576 | def test_cross_compilation_windows(session: nox.Session): | CODE |
| LOW | noxfile.py | 1239 | def set_msrv_package_versions(session: nox.Session): | STRING |
| LOW | noxfile.py | 1533 | def _iter_extern_libpython_blocks(source: str) -> Iterator[str]: | CODE |
| LOW | noxfile.py | 1558 | def _cfg_attr_is_non_cpython_only(attr: str) -> bool: | CODE |
| LOW | noxfile.py | 1941 | def _run_cargo_set_package_version( | CODE |
| LOW⚡ | examples/word-count/tests/test_word_count.py | 35 | def test_word_count_rust_parallel(benchmark, contents): | STRING |
| LOW⚡ | examples/word-count/tests/test_word_count.py | 40 | def test_word_count_rust_sequential(benchmark, contents): | STRING |
| LOW⚡ | examples/word-count/tests/test_word_count.py | 45 | def test_word_count_python_sequential(benchmark, contents): | STRING |
| LOW⚡ | examples/word-count/tests/test_word_count.py | 50 | def run_rust_sequential_twice( | STRING |
| LOW⚡ | examples/word-count/tests/test_word_count.py | 60 | def test_word_count_rust_sequential_twice_with_threads(benchmark, contents): | STRING |
| LOW | pytests/tests/test_sequence.py | 10 | def test_vec_from_list_pystring(): | CODE |
| LOW | pytests/tests/test_sequence.py | 30 | def test_rust_array_from_array(): | CODE |
| LOW | pytests/tests/test_misc.py | 23 | def test_multiple_imports_same_interpreter_ok(): | CODE |
| LOW | pytests/tests/test_misc.py | 41 | def test_import_in_subinterpreter_forbidden(): | CODE |
| LOW | pytests/tests/test_misc.py | 67 | def test_type_fully_qualified_name_includes_module(): | CODE |
| LOW | pytests/tests/test_finalization.py | 27 | def test_hammer_attaching_in_thread(): | CODE |
| LOW | pytests/tests/test_finalization.py | 35 | def test_detach_during_finalization(): | CODE |
| LOW | pytests/tests/test_enums.py | 5 | def test_complex_enum_variant_constructors(): | CODE |
| LOW | pytests/tests/test_enums.py | 39 | def test_complex_enum_variant_subclasses(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums.py | 43 | def test_complex_enum_field_getters(): | CODE |
| LOW | pytests/tests/test_enums.py | 74 | def test_complex_enum_desugared_match(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums.py | 105 | def test_complex_enum_pyfunction_in_out_desugared_match(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums.py | 126 | def test_tuple_enum_variant_constructors(): | CODE |
| LOW | pytests/tests/test_enums.py | 142 | def test_tuple_enum_variant_subclasses(variant: enums.TupleEnum): | CODE |
| LOW⚡ | pytests/tests/test_enums.py | 153 | def test_tuple_enum_field_getters(): | CODE |
| LOW⚡ | pytests/tests/test_enums.py | 160 | def test_tuple_enum_index_getter(): | CODE |
| LOW⚡ | pytests/tests/test_enums.py | 170 | def test_mixed_complex_enum_pyfunction_instance_nothing( | CODE |
| LOW | pytests/tests/test_enums.py | 183 | def test_mixed_complex_enum_pyfunction_instance_empty(variant: enums.MixedComplexEnum): | CODE |
| LOW | pytests/tests/test_datetime.py | 159 | def test_invalid_time_fails_overflow(args): | CODE |
| LOW | pytests/tests/test_datetime.py | 229 | def test_invalid_datetime_fails(): | CODE |
| LOW⚡ | pytests/tests/test_datetime.py | 241 | def test_datetime_from_timestamp(dt): | CODE |
| LOW⚡ | pytests/tests/test_datetime.py | 259 | def test_datetime_from_timestamp_tzinfo(): | CODE |
| LOW | pytests/tests/test_datetime.py | 325 | def test_tz_class_introspection(): | CODE |
| LOW | pytests/tests/test_enums_match.py | 16 | def test_complex_enum_match_statement(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 44 | def test_complex_enum_pyfunction_in_out(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 68 | def test_complex_enum_partial_match(variant: enums.ComplexEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 83 | def test_tuple_enum_match_statement(variant: enums.TupleEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 103 | def test_simple_tuple_enum_match_statement(variant: enums.SimpleTupleEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 119 | def test_tuple_enum_match_match_args(variant: enums.TupleEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 136 | def test_tuple_enum_partial_match(variant: enums.TupleEnum): | CODE |
| LOW | pytests/tests/test_enums_match.py | 151 | def test_mixed_complex_enum_match_statement(variant: enums.MixedComplexEnum): | CODE |
| LOW | pytests/tests/test_pyclasses.py | 131 | def test_no_constructor_defined_propagates_cause(cls: Type, exc_message: str): | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 66 | def test_simple_args_kwargs_py(benchmark): | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 70 | def test_simple_args_kwargs_rs(benchmark): | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 120 | def many_keyword_arguments_py( | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 141 | def call_with_many_keyword_arguments(f) -> Any: | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 160 | def test_many_keyword_arguments_py(benchmark): | CODE |
| LOW | pytests/tests/test_pyfunctions.py | 164 | def test_many_keyword_arguments_rs(benchmark): | CODE |
| LOW | pytests/tests/test_objstore.py | 7 | def test_objstore_doesnot_leak_memory(): | CODE |
| LOW | pytests/tests/test_path.py | 27 | def test_take_invalid_pathlike(): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH⚡ | examples/plugin/python_plugin/gadget_init_plugin.py | 8 | g.push(1) | CODE |
| HIGH⚡ | examples/plugin/python_plugin/gadget_init_plugin.py | 9 | g.push(2) | CODE |
| HIGH⚡ | examples/plugin/python_plugin/gadget_init_plugin.py | 10 | g.push(3) | CODE |
| HIGH | examples/plugin/plugin_api/tests/test_Gadget.py | 22 | gadget.push(42) | CODE |
| HIGH | pytests/tests/test_objstore.py | 23 | store.push(message) | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | noxfile.py | 294 | except Exception: | CODE |
| LOW⚡ | noxfile.py | 303 | except Exception: | CODE |
| LOW | noxfile.py | 359 | except Exception: | CODE |
| LOW | noxfile.py | 413 | except Exception: | CODE |
| LOW | noxfile.py | 1035 | except Exception: | CODE |
| LOW | guide/src/migration.md | 1713 | except Exception as e: | CODE |
| LOW⚡ | guide/src/debugging.md | 315 | except Exception: | CODE |
| LOW⚡ | guide/src/debugging.md | 322 | except Exception as e: | CODE |
| MEDIUM⚡ | guide/src/debugging.md | 323 | print(f"Error updating launch.json: {e}") | CODE |
| LOW | tests/test_inheritance.rs | 168 | except Exception as e: | CODE |
| LOW | pytests/tests/test_datetime.py | 98 | except Exception: | CODE |
| LOW | pytests/tests/test_datetime.py | 104 | except Exception as pdt_fail: | CODE |
| LOW⚡ | pytests/tests/test_datetime.py | 244 | except Exception: | CODE |
| LOW⚡ | pytests/tests/test_datetime.py | 250 | except Exception as pdt_fail: | CODE |
| MEDIUM | pytests/tests/test_datetime.py | 95 | def test_date_from_timestamp(d): | CODE |
| MEDIUM | pytests/tests/test_datetime.py | 241 | def test_datetime_from_timestamp(dt): | CODE |
| LOW | pytests/tests/test_pyclasses.py | 136 | except Exception: | CODE |
| LOW | src/types/traceback.rs | 158 | except Exception as e: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | guide/glossary_linker.py | 66 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | guide/glossary_linker.py | 68 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | guide/glossary_linker.py | 183 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | guide/glossary_linker.py | 185 | # --------------------------------------------------------------------------- | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | noxfile.py | 744 | CODE | |
| LOW | noxfile.py | 912 | CODE | |
| LOW | noxfile.py | 1239 | CODE | |
| LOW | noxfile.py | 1504 | CODE | |
| LOW | noxfile.py | 1533 | CODE | |
| LOW | guide/glossary_linker.py | 84 | CODE | |
| LOW | pytests/tests/test_enums.py | 74 | CODE | |
| LOW | pytests/tests/test_enums.py | 105 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/plugin/plugin_api/tests/test_import.py | 2 | CODE | |
| LOW | examples/maturin-starter/maturin_starter/__init__.py | 2 | CODE | |
| LOW | examples/maturin-starter/maturin_starter/__init__.py | 6 | CODE | |
| LOW | examples/word-count/word_count/__init__.py | 1 | CODE | |
| LOW | examples/word-count/word_count/__init__.py | 1 | CODE | |
| LOW | examples/word-count/word_count/__init__.py | 1 | CODE | |
| LOW | …tools-rust-starter/setuptools_rust_starter/__init__.py | 2 | CODE | |
| LOW | …tools-rust-starter/setuptools_rust_starter/__init__.py | 6 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pyo3-macros-backend/src/py_expr.rs | 157 | _ => PyConstant::Ellipsis, // TODO: implement ByteStr and CStr | CODE |
| LOW | pyo3-macros-backend/src/frompyobject.rs | 475 | // TODO: implement using a Protocol? | COMMENT |
| LOW | pyo3-macros-backend/src/intopyobject.rs | 378 | // TODO: implement using a Protocol? | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | pytests/tests/test_enums_match.py | 1 | # This file is only collected when Python >= 3.10, because it tests match syntax. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | noxfile.py | 199 | def set_coverage_env(session: nox.Session) -> None: | CODE |
| LOW | examples/word-count/word_count/__init__.py | 3 | __all__ = [ | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | .github/workflows/ci.yml | 864 | # Check if all needs were successful or skipped. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/pyclass.rs | 66 | /// Usage example: | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/pycell/impl_.rs | 268 | // For `#[pyclass]` types which inherit from PyAny, we can just call tp_free | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | guide/src/python-from-rust/calling-existing-code.md | 335 | let house = house_class.call1(("123 Main Street",)).unwrap(); | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pytests/tests/test_pyfunctions.py | 120 | CODE |