Skip to content
Unverified Commit 5c7b50dd authored by Fahad Zubair's avatar Fahad Zubair Committed by GitHub
Browse files

Fix Rust 1.82 compilation errors by upgrading PyO3 from 0.18 to 0.20 (#4146)

## PyO3 Upgrade to Fix Compatibility with Rust 1.82

This PR addresses a compatibility issue between `PyO3 0.18` and `Rust
1.82`, which causes compilation errors due to unexpected `cfg` condition
names.

When compiled with Rust 1.82, the current [PyO3
0.18](https://github.com/PyO3/pyo3/blob/v0.18.3/src/types/mod.rs#L193

)
dependency produces errors like:
```
error: unexpected `cfg` condition name: `addr_of`
```

This error occurs because of changes in how Rust handles conditional
configuration checks in newer compiler versions.

## Changes in this PR:

1. Upgrades PyO3 from version 0.18 to 0.20 (the latest version
compatible with pyo3-asyncio)
2. Updates generated functions to follow the required API pattern where
required fields precede optional ones
3. API changes in pyo3, whereby in the new version dictionary.get_key
returns a Result<Option<PyAny>> instead of Result<PyAny> in the older
version.

This upgrade ensures compatibility with Rust 1.82 while maintaining all
existing functionality.

## Testing

1. Current protocol tests pass
2. An additional test has been included for required versus optional
parameters.

---------

Co-authored-by: default avatarFahad Zubair <fahadzub@amazon.com>
parent 7d64b2f9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment