Skip to content

Commit 8481612

Browse files
authored
Merge pull request #268 from bluetech/fix-strconfig-ignored
gateway_base: fix `load(strconfig)` getting ignored
2 parents d0fc2c2 + d08b7e7 commit 8481612

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
TBD
2+
---
3+
4+
* `#267 <https://github.com/pytest-dev/execnet/issue/267>`__ Fixed regression
5+
in 2.1.0 where the ``strconfig`` argument to ``load``/``loads`` is ignored.
6+
17
2.1.0 (2024-04-05)
28
------------------
39

src/execnet/gateway_base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,7 @@ def __init__(
13911391
gw: BaseGateway | None = channel_or_gateway.gateway
13921392
else:
13931393
gw = channel_or_gateway
1394-
if channel_or_gateway is None:
1395-
strconfig = None
1396-
else:
1394+
if channel_or_gateway is not None:
13971395
strconfig = channel_or_gateway._strconfig
13981396
if strconfig:
13991397
self.py2str_as_py3str, self.py3str_as_py2str = strconfig

testing/test_serializer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,8 @@ def test_tuple_nested_with_empty_in_between(dump, load) -> None:
163163
tp, s = load(p)
164164
assert tp == "tuple"
165165
assert s == "(1, (), 3)"
166+
167+
168+
def test_py2_string_loads() -> None:
169+
"""Regression test for #267."""
170+
assert execnet.loads(b"\x02M\x00\x00\x00\x01aQ") == b"a"

0 commit comments

Comments
 (0)