-
-
Notifications
You must be signed in to change notification settings - Fork 306
-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
Support linting when missing sem_open syscall - [merged] #1282
Comments
In GitLab by @codecov on Aug 27, 2020, 05:19 Codecov Report
@@ Coverage Diff @@
## master #448 +/- ##
==========================================
+ Coverage 90.74% 90.75% +0.01%
==========================================
Files 59 59
Lines 4193 4209 +16
Branches 417 419 +2
==========================================
+ Hits 3805 3820 +15
Misses 335 335
- Partials 53 54 +1
Continue to review full report at Codecov.
|
In GitLab by @asottile on Aug 27, 2020, 06:57 can you show an actual failing output, I don't believe the patch is correct (catching too many exceptions, handling them incorrectly) for instance, it is impossible for |
In GitLab by @asottile on Aug 27, 2020, 07:09 Commented on tests/integration/test_checker.py line 300 you can use |
In GitLab by @asottile on Aug 27, 2020, 07:09 Commented on src/flake8/checker.py line 342 this would be better as a free function not on self, also please type annotate new code |
In GitLab by @asottile on Aug 27, 2020, 07:09 Commented on src/flake8/checker.py line 352 this should be a separate |
In GitLab by @nekokatt on Aug 27, 2020, 08:43 Is there a case where I assumed that try:
import multiprocessing
except ImportError:
multiprocessing = None ...over at https://gitlab.com/pycqa/flake8/-/blob/681b2bd751d8a07a2a1776d9aed077411c43e7c7/src/flake8/checker.py#L11 was still a valid case that could occur; and since the Will upload a reproduction of the multiprocessing ImportError from my phone, as I can reproduce this on there. Give me five minutes :) |
In GitLab by @nekokatt on Aug 27, 2020, 08:45 They had the same problem in Black for a long while until recently which needed the same functional fix to resolve. |
In GitLab by @nekokatt on Aug 27, 2020, 09:06 Commented on tests/integration/test_checker.py line 300 changed this line in version 2 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 09:06 Commented on src/flake8/checker.py line 342 changed this line in version 2 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 09:06 Commented on src/flake8/checker.py line 352 changed this line in version 2 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 09:06 added 1 commit
|
In GitLab by @nekokatt on Aug 27, 2020, 09:12 |
In GitLab by @nekokatt on Aug 27, 2020, 09:24 Amended suggested changes, ensured new code runs under Verified that bug is resolved on CPython 3.8.3 ARMv7. |
In GitLab by @nekokatt on Aug 27, 2020, 09:35 added 1 commit
|
In GitLab by @asottile on Aug 27, 2020, 10:52 Commented on src/flake8/checker.py line 318 probably can't change the signature of this function, can you go back to your original approach? |
In GitLab by @asottile on Aug 27, 2020, 10:52 Commented on src/flake8/checker.py line 646 as I said before, let's keep the change to just your change and not AttributeError it's possible / likely that the |
In GitLab by @asottile on Aug 27, 2020, 10:52 Commented on src/flake8/checker.py line 655 this function should not have side-effects |
In GitLab by @asottile on Aug 27, 2020, 10:52 Commented on tests/integration/test_checker.py line 266 no need to set |
In GitLab by @asottile on Aug 27, 2020, 10:53 just because I'm curious, does |
In GitLab by @nekokatt on Aug 27, 2020, 14:36 yeah, it does; you can't use a process pool executor either sadly. The issue is that Each one first imports the synchronization submodule. This is where the ImportError is coming from. concurrent.futures is importing multiprocessing.Queue from a glance. |
In GitLab by @nekokatt on Aug 27, 2020, 14:36 Commented on src/flake8/checker.py line 655 How would you suggest structuring this best? |
In GitLab by @asottile on Aug 27, 2020, 14:40 Commented on src/flake8/checker.py line 655 either remove the log line entirely or put it where |
In GitLab by @nekokatt on Aug 27, 2020, 14:40 Commented on src/flake8/checker.py line 318 changed this line in version 7 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 14:40 Commented on src/flake8/checker.py line 646 changed this line in version 7 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 14:40 Commented on src/flake8/checker.py line 655 changed this line in version 7 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 15:07 Commented on tests/integration/test_checker.py line 266 changed this line in version 8 of the diff |
In GitLab by @nekokatt on Aug 27, 2020, 15:07 added 1 commit
|
In GitLab by @nekokatt on Aug 27, 2020, 15:08 Commented on src/flake8/checker.py line 655 amended. Thanks. |
In GitLab by @nekokatt on Aug 27, 2020, 15:08 Commented on src/flake8/checker.py line 318 done |
In GitLab by @nekokatt on Aug 27, 2020, 15:08 resolved all threads |
In GitLab by @nekokatt on Aug 27, 2020, 15:09 Looks like everything else is resolved now. Let me know if there is any other feedback and I'll get on it ASAP tomorrow morning. Cheers :) |
In GitLab by @asottile on Aug 27, 2020, 15:39 added 3 commits
|
In GitLab by @asottile on Aug 27, 2020, 15:42 approved this merge request |
In GitLab by @nekokatt on Aug 27, 2020, 05:18
Merges bugfix/cpython-3770-semopen-missing -> master
Platforms such as Termux on Android, and other exotic devices
do not provide a sem_open implementation on the OS level. This
is problematic, as the error resulting from this occurs when
calling multiprocessing.Pool, throwing an unhandled ImportError.
The issue itself is outlined in https://bugs.python.org/issue3770.
This change allows devices missing this system call to respond
to the missing feature by falling back to synchronous execution,
which appears to be the default behaviour if the multiprocessing
module is not found.
This change also adds a potential fix for developers working
on platforms where multiprocessing itself cannot be imported.
The existing code would set the name referencing the import to
None, but there are no clear checks to ensure this does not
result in an AttributeError later when multiprocessing.Pool
has accession attempts.
Existing users should see no difference in functionality, as they
will assumably already be able to use flake8, so will not be
missing this sem_open call.
Users on devices without the sem_open call will now be able
to use flake8 where they would be unable to before due to
unhandled ImportErrors.
The text was updated successfully, but these errors were encountered: