Skip to content

Commit 38f0a59

Browse files
committed
Extract the class name
1 parent d5c7502 commit 38f0a59

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pyo3-macros-backend/src/pyclass.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::pymethod::{
1515
};
1616
use crate::utils::{self, get_pyo3_crate, PythonDoc};
1717
use crate::PyFunctionOptions;
18-
use proc_macro2::{Span, TokenStream};
18+
use proc_macro2::{Literal, Span, TokenStream};
1919
use quote::{format_ident, quote};
2020
use syn::ext::IdentExt;
2121
use syn::parse::{Parse, ParseStream};
@@ -1006,13 +1006,15 @@ fn generate_class_info(
10061006
let class_field_info = format_ident!("{}_struct_field_info", ident_prefix);
10071007
let class_info = format_ident!("{}_struct_info", ident_prefix);
10081008

1009+
let name = Literal::string(&*get_class_python_name(cls, args).to_string());
1010+
10091011
quote! {
10101012
const #class_field_info: [pyo3::interface::FieldInfo; 0] = [
10111013
//TODO
10121014
];
10131015

10141016
const #class_info: pyo3::interface::ClassInfo = pyo3::interface::ClassInfo {
1015-
name: "", //TODO
1017+
name: #name,
10161018
base: "", //TODO
10171019
fields: &#class_field_info,
10181020
};

0 commit comments

Comments
 (0)