-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Suppress socket imports that might not exist on some systems #2916
Suppress socket imports that might not exist on some systems #2916
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2916 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 116 116
Lines 17477 17479 +2
Branches 3133 3134 +1
=======================================
+ Hits 17415 17417 +2
Misses 43 43
Partials 19 19
|
LGTM 👍 thanks! EDIT: OTOH I can't help but notice the code uses |
this is for |
This is a partial revert of #2887 which broke these out. If we want to be extra thorough it'd perhaps be nice if we could add a conditional that is only true for the failing android API. @Cheaterman do you know of any I suppose building on android could maybe be considered for #2885 @Cheaterman have you tried building against this branch, or with local changes fixing this import, to verify these are the only problematic imports on your system? Does the test suite run correctly otherwise? API 24 was released in august 2016 - which is very old by python standards: python3.8 was released in 2019. So I'm a bit wary that even if we fixed this import there'd be a lot of additional problems hiding. |
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.
This makes sense to me and while I would prefer to gate this rather than suppress import errors (so we have documentation for exactly what platforms fail in form of code), this works fine too.
That other approach might be too much work for something so small!
@jakkdl Thanks for all the comments! I'm not aware of a I didn't get to test against this branch just yet - bumping minimum API is acceptable for my current application and other users I interacted with, in fact we might also bump the default in P4A to be thorough. The reason it does matter to support such an old API version is simply because this isn't the target API but the minimum supported one, which means (AIUI at least) devices older than that will not be able to run the app. In practice I agree the ever-shrinking pool of 7+ year old devices isn't a huge concern, but it matters to some users ; and given we're actively recommending people switch to trio these days so they avoid all the threading footguns, we'd like to make their experience as smooth as possible :-). |
@Cheaterman |
-- snip -- OK, I found where all 3 attributes here are defined and commit date (to add Makes sense to me. |
Hi @A5rocks and thanks for your comments, I think you are entirely correct (only if_nameindex was introduced in 24) :-) Hi @jakkdl and thanks for your work, P4A is indeed very relevant but the reason we were caught offguard by this is that the name will be unavailable on even Python 3.11 if building against minAPI < 24. Either way, I completely forgot to mention that yes, this is indeed being addressed on the P4A side, simply by bumping up the default minAPI to 24 ; but as you might guess, this isn't an ideal fix for people wanting to use recent |
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.
Just a nitpick. I'm fine whether or not you update the comment.
src/trio/socket.py
Outdated
if_nametoindex as if_nametoindex, | ||
) | ||
|
||
# In https://github.com/kivy/python-for-android, if_nameindex |
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.
For what it's worth: as far as I can tell, this is just a CPython thing. Though that's a guess based on how CPython is pulling it in (see https://bugs.python.org/msg279495). I kinda assume this is just building CPython for Android, no specific changes.
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 think 9dda073 should be sufficient
Would have been better to make a new issue, but yes, you should upgrade Trio to 0.27.0, which is the latest release as of writing. |
This pull request adds import exception suppression to a few imports from the socket library that apparently might not exist on all systems. Fixes #2915.