Skip to content

Commit 4272107

Browse files
authored
Merge pull request #118 from graingert/waitclose-in-rinfo-call
waitclose in _rinfo() call
2 parents 0785570 + f0cfea4 commit 4272107

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
------------------
33

44
* Dropped support for Python 3.4.
5+
* `#118 <https://github.com/pytest-dev/execnet/pull/118>`__: Fixed internal leak that should make
6+
``execnet`` execute remote code in the main thread more often; previously it would sometimes
7+
spawn a thread to execute a ``remote_exec`` call, even when the caller
8+
didn't issue multiple ``remote_exec`` calls at the same time. Some frameworks require code
9+
to execute in the main thread, so the previous behavior would break them on occasion (see
10+
`pytest-dev/pytest-xdist#620 <https://github.com/pytest-dev/pytest-xdist/issues/620>`__
11+
for an example).
512

613

714
1.7.1 (2019-08-28)

execnet/gateway.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def _rinfo(self, update=False):
7575
""" return some sys/env information from remote. """
7676
if update or not hasattr(self, "_cache_rinfo"):
7777
ch = self.remote_exec(rinfo_source)
78-
self._cache_rinfo = RInfo(ch.receive())
78+
try:
79+
self._cache_rinfo = RInfo(ch.receive())
80+
finally:
81+
ch.waitclose()
7982
return self._cache_rinfo
8083

8184
def hasreceiver(self):

0 commit comments

Comments
 (0)