Skip to content

Commit 48dcd0a

Browse files
committed
geitem -> getitem
1 parent 2cc2327 commit 48dcd0a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

guide/src/python-typing-hints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ To overcome this limitation, implementers can pass the `generic` parameter to `p
237237
#### Advanced Users
238238

239239
`#[pyclass(generic)]` implements a very simple runtime behavior that accepts any generic argument.
240-
Advanced users can opt to manually implement [`__class_geitem__`](https://docs.python.org/3/reference/datamodel.html#emulating-generic-types) for the generic class to have more control.
240+
Advanced users can opt to manually implement [`__class_getitem__`](https://docs.python.org/3/reference/datamodel.html#emulating-generic-types) for the generic class to have more control.
241241

242242
```rust ignore
243243
impl MyClass {

pyo3-macros-backend/src/pyclass.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,11 @@ fn impl_class(
476476
ctx,
477477
)?;
478478

479-
let (default_class_geitem, default_class_geitem_method) =
479+
let (default_class_getitem, default_class_getitem_method) =
480480
pyclass_class_getitem(&args.options, &syn::parse_quote!(#cls), ctx)?;
481481

482-
if let Some(default_class_geitem_method) = default_class_geitem_method {
483-
default_methods.push(default_class_geitem_method);
482+
if let Some(default_class_getitem_method) = default_class_getitem_method {
483+
default_methods.push(default_class_getitem_method);
484484
}
485485

486486
let (default_str, default_str_slot) =
@@ -514,7 +514,7 @@ fn impl_class(
514514
#default_richcmp
515515
#default_hash
516516
#default_str
517-
#default_class_geitem
517+
#default_class_getitem
518518
}
519519
})
520520
}
@@ -2242,7 +2242,7 @@ fn pyclass_class_getitem(
22422242
match options.generic {
22432243
Some(_) => {
22442244
let ident = format_ident!("__class_getitem__");
2245-
let mut class_geitem_impl: syn::ImplItemFn = {
2245+
let mut class_getitem_impl: syn::ImplItemFn = {
22462246
parse_quote! {
22472247
#[classmethod]
22482248
fn #ident<'py>(
@@ -2255,18 +2255,18 @@ fn pyclass_class_getitem(
22552255
};
22562256

22572257
let spec = FnSpec::parse(
2258-
&mut class_geitem_impl.sig,
2259-
&mut class_geitem_impl.attrs,
2258+
&mut class_getitem_impl.sig,
2259+
&mut class_getitem_impl.attrs,
22602260
Default::default(),
22612261
)?;
22622262

2263-
let class_geitem_method = crate::pymethod::impl_py_method_def(
2263+
let class_getitem_method = crate::pymethod::impl_py_method_def(
22642264
cls,
22652265
&spec,
2266-
&spec.get_doc(&class_geitem_impl.attrs, ctx)?,
2266+
&spec.get_doc(&class_getitem_impl.attrs, ctx)?,
22672267
ctx,
22682268
)?;
2269-
Ok((Some(class_geitem_impl), Some(class_geitem_method)))
2269+
Ok((Some(class_getitem_impl), Some(class_getitem_method)))
22702270
}
22712271
None => Ok((None, None)),
22722272
}

0 commit comments

Comments
 (0)