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

feat: Support for mappingproxy objects #3521

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f8fcfac
Write mappingproxy tests
dignissimus Jun 2, 2022
e8e3913
Amend tests to reflect proposed API
dignissimus Jun 2, 2022
bd5b89d
Update ffi
dignissimus Jun 2, 2022
4757e6d
Prevent integer underflow in test
dignissimus Jun 5, 2022
d992200
Add support for mappingproxy objects
dignissimus Jun 5, 2022
171fe85
Merge branch 'main' into support-mappingproxy
dignissimus Jun 5, 2022
2d4b883
Formatting
dignissimus Jun 5, 2022
9783ae5
Remove unused imports present during testing
dignissimus Jun 5, 2022
11dfceb
Replace calls to ffi::PyObject_CallMethodNoArgs with calls to PyAny::…
dignissimus Jun 5, 2022
7bb1f09
Add imports to PyPy build
dignissimus Jun 5, 2022
f9b8d9e
Remove unused import on PyPy builds
dignissimus Jun 6, 2022
4b9f02a
Remove unused imports from PyPy build
dignissimus Jun 6, 2022
83fe47a
Add required imports to PyPy build
dignissimus Jun 6, 2022
136d8fa
Move misplaced macro
dignissimus Jun 6, 2022
69baaf8
Remove outdated comments from merge
dignissimus Jun 8, 2022
00bac8e
Remove #[inline] from private function
dignissimus Jun 8, 2022
3bfb811
Don't export PyDictProxyObject
dignissimus Jun 8, 2022
f4b5a05
Don't rely on PyDictProxyObject
dignissimus Jun 8, 2022
7f98dd9
Don't export add_of_mut_shim macro
dignissimus Jun 9, 2022
9bd2f44
Replace instance of &mut with macro call
dignissimus Jun 12, 2022
c5e434d
Preserve error message when extracting dicts
dignissimus Jun 12, 2022
651a007
Add tests for PyDict::is_empty and PyMappingProxy::is_empty
dignissimus Jun 12, 2022
9e0cf63
Merge branch 'main' into support-mappingproxy
michaelhly Oct 16, 2023
1bcfe71
Fix build
michaelhly Oct 16, 2023
322b677
elements: &'py PyMapping
michaelhly Oct 16, 2023
f7e4436
Conversions
michaelhly Oct 16, 2023
10c007c
Move tests
michaelhly Oct 16, 2023
8336961
Return PyMapping on copy
michaelhly Oct 16, 2023
b47bea9
newfragments
michaelhly Oct 16, 2023
54fdc00
unwrap_or_default
michaelhly Oct 16, 2023
5ae7d64
Fix
michaelhly Oct 16, 2023
38671ad
Test hashbrown + indexmap conversions
michaelhly Oct 16, 2023
e949a7e
Clippy and cargo check
michaelhly Oct 16, 2023
16df9bf
Clean up test imports
michaelhly Oct 16, 2023
f66c610
Test hashbrown/indexmap extract conversions
michaelhly Oct 16, 2023
5005fc3
#[cfg(not(PyPy))]
michaelhly Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent integer underflow in test
  • Loading branch information
dignissimus committed Jun 5, 2022
commit 4757e6d44b006261bfe292e295420092bce5f22b
2 changes: 2 additions & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use self::datetime::{
PyTzInfoAccess,
};
pub use self::dict::{IntoPyDict, PyDict};
pub use self::mappingproxy::{IntoPyMappingProxy, PyMappingProxy};
pub use self::floatob::PyFloat;
#[cfg(all(not(Py_LIMITED_API), not(PyPy)))]
pub use self::frame::PyFrame;
Expand Down Expand Up @@ -275,6 +276,7 @@ mod function;
mod iterator;
mod list;
mod mapping;
mod mappingproxy;
mod module;
mod num;
mod sequence;
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mappingproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn get_value_from_mappingproxy_of_integers(){
let gil = Python::acquire_gil();
let py = gil.python();

let items = (0..LEN).map(|i| (i, i - 1)).collect::<Vec<(usize, usize)>>();
let items: Vec<(usize, usize)> = (1..LEN).map(|i| (i, i - 1)).collect();
let mappingproxy = items.to_vec().into_py_mappingproxy(py).unwrap();
assert_eq!(
items,
Expand All @@ -46,7 +46,7 @@ fn get_value_from_mappingproxy_of_integers(){
)
).collect::<Vec<(usize, usize)>>()
);
for index in 0..LEN {
for index in 1..LEN {
assert_eq!(
mappingproxy.get_item(index).unwrap().extract::<usize>().unwrap(),
index - 1
Expand Down