Skip to content

Commit

Permalink
Remove incorrect assertion for Anaconda interpreters (#2856)
Browse files Browse the repository at this point in the history
* Remove incorrect assertion

* Fix comment

* One more comment rewrite

* Add a newsfragment
  • Loading branch information
A5rocks authored Nov 4, 2023
1 parent 626331f commit d34739e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/2855.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't crash on import in Anaconda interpreters.
10 changes: 8 additions & 2 deletions trio/_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ def pidfd_open(fd: int, flags: int) -> int:
from os import pidfd_open
except ImportError:
if sys.platform == "linux":
# This workaround is only needed on 3.8 and pypy
assert sys.version_info < (3, 9) or sys.implementation.name != "cpython"
# this workaround is needed on:
# - CPython <= 3.8
# - non-CPython (maybe?)
# - Anaconda's interpreter (as it is built to assume an older
# than current linux kernel)
#
# The last point implies that other custom builds might not work;
# therefore, no assertion should be here.
import ctypes

_cdll_for_pidfd_open = ctypes.CDLL(None, use_errno=True)
Expand Down

0 comments on commit d34739e

Please sign in to comment.