Skip to content

Commit

Permalink
fix declarative-modules compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
Icxolu committed Apr 7, 2024
1 parent 7a00b4d commit 79113f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ impl<'a> PyClassImplsBuilder<'a> {
quote! {
impl #cls {
#[doc(hidden)]
const _PYO3_DEF: #pyo3_path::impl_::pymodule::AddClassToModule<Self> = #pyo3_path::impl_::pymodule::AddClassToModule::new();
pub const _PYO3_DEF: #pyo3_path::impl_::pymodule::AddClassToModule<Self> = #pyo3_path::impl_::pymodule::AddClassToModule::new();
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/test_declarative_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ use pyo3::types::PyBool;
#[path = "../src/tests/common.rs"]
mod common;

mod some_module {
use pyo3::prelude::*;

#[pyclass]
pub struct SomePyClass;
}

#[pyclass]
struct ValueClass {
value: usize,
Expand Down Expand Up @@ -50,6 +57,10 @@ mod declarative_module {
#[pymodule_export]
use super::{declarative_module2, double, MyError, ValueClass as Value};

// test for #4036
#[pymodule_export]
use super::some_module::SomePyClass;

#[pymodule]
mod inner {
use super::*;
Expand Down

0 comments on commit 79113f8

Please sign in to comment.