Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting the module name of a class #477

Merged
merged 1 commit into from
May 12, 2019

Conversation

Alexander-N
Copy link
Member

Didn't implement setting it automatically to avoid unexpected behavior. Pickling is possible but very awkward.

#100
Closes #474

Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

tests/test_various.rs Outdated Show resolved Hide resolved
@kngwyu
Copy link
Member

kngwyu commented May 8, 2019

Thank you for investigating the problem!
Looks it's the correct solution to me.

This is relevant for pickling objects.
@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

Merging #477 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
- Coverage   87.85%   87.85%   -0.01%     
==========================================
  Files          65       65              
  Lines        3393     3416      +23     
==========================================
+ Hits         2981     3001      +20     
- Misses        412      415       +3
Impacted Files Coverage Δ
src/type_object.rs 88.67% <100%> (+0.16%) ⬆️
src/types/module.rs 89.39% <0%> (-4.49%) ⬇️
src/types/any.rs 100% <0%> (ø) ⬆️
src/conversion.rs 97.34% <0%> (+0.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4c75bb...299d325. Read the comment docs.

Some(module_name) => format!("{}.{}", module_name, T::NAME),
None => T::NAME.to_string(),
};
let name = CString::new(name).expect("Module name/type name must not contain NUL byte");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*NULL ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kngwyu kngwyu mentioned this pull request May 12, 2019
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Building upon that, I think it would be cool to have something like #[pyclass(module = "foo.bar")]

@konstin konstin merged commit 9525e58 into PyO3:master May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated classes are part of the builtin module
5 participants