-
Notifications
You must be signed in to change notification settings - Fork 778
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
Makes PathBuf FromPyObject implementation work on all os.PathLike #3374
Conversation
40e250e
to
3474366
Compare
@@ -37,6 +37,7 @@ The table below contains the Python type and the corresponding function argument | |||
| `decimal.Decimal` | `rust_decimal::Decimal`[^5] | - | | |||
| `ipaddress.IPv4Address` | `std::net::IpAddr`, `std::net::IpV4Addr` | - | | |||
| `ipaddress.IPv6Address` | `std::net::IpAddr`, `std::net::IpV6Addr` | - | | |||
| `os.PathLike ` | `PathBuf`, `Path` | `&PyString`, `&PyUnicode` | | |||
| `pathlib.Path` | `PathBuf`, `Path` | `&PyString`, `&PyUnicode` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't pathlib.Path
also an os.PathLike
, i.e. doesn't the first line basically include the second one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I left the two lines for explictness because I assumed a lot of people are not used to os.PathLike
. If you prefer I can remove the pathlib.Path
line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would merge them and maybe use "pathlib.Path
, os.PathLike
" for the first column to stay explicit. But let's see what the other maintainers think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of upending this table anyway and describing it from the Rust types (what they accept and what they convert to), so I'm ok with leaving this as two rows for now.
PyOS_FSPath is in abi3-py36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - please accept the new licensing change in #3108 before we can merge this.
@davidhewitt Thank you! Done. |
Pypy 3.10 fails with "undefined reference to `PyOS_FSPath'". What is strange is that it's supposed to be supported by Pypy 3.7+: https://doc.pypy.org/en/latest/release-v7.3.0.html#python-3-6-c-api |
Yes, on all supported PyPy versions it looks like it is exported under the (I would love to catch cases where our definition is wrong in |
Thank you! I have added the
Dumb idea: if Pyo3 is supposed to cover all/most symbols expose al |
PyOS_FSPath is in abi3-py36