From 66f09b8bdb2257db734c73ea4b1d597358185b77 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Mon, 21 Oct 2024 09:33:55 -0600 Subject: [PATCH] fix doctests --- guide/src/free-threading.md | 7 ++++--- src/lib.rs | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/guide/src/free-threading.md b/guide/src/free-threading.md index 7f43f265490..77b2ff327a2 100644 --- a/guide/src/free-threading.md +++ b/guide/src/free-threading.md @@ -100,7 +100,7 @@ The most straightforward way to trigger this problem to use the Python `pyclass`. For example, consider the following `PyClass` implementation: ``` -# use python::prelude::*; +# use pyo3::prelude::*; # fn main() { #[pyclass] #[derive(Default)] @@ -119,12 +119,13 @@ impl ThreadIter { self.count += 1; self.count } +} # } ``` And then if we do something like this in Python: -``` +```python import concurrent.futures from my_module import ThreadIter @@ -140,7 +141,7 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=16) as tpe: We will see an exception: -``` +```text Traceback (most recent call last) File "example.py", line 5, in next(i) diff --git a/src/lib.rs b/src/lib.rs index 7de32ca264f..247b42ac372 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -501,6 +501,7 @@ pub mod doc_test { "guide/src/exception.md" => guide_exception_md, "guide/src/faq.md" => guide_faq_md, "guide/src/features.md" => guide_features_md, + "guide/src/free-threading.md" => guide_free_threading_md, "guide/src/function.md" => guide_function_md, "guide/src/function/error-handling.md" => guide_function_error_handling_md, "guide/src/function/signature.md" => guide_function_signature_md,