Skip to content

Commit

Permalink
gateway_base: fix load(strconfig) getting ignored
Browse files Browse the repository at this point in the history
Accidental regression in 2.1.0 (c58d485).

Fix #267.
  • Loading branch information
bluetech committed Apr 7, 2024
1 parent d0fc2c2 commit d08b7e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
TBD
---

* `#267 <https://github.com/pytest-dev/execnet/issue/267>`__ Fixed regression
in 2.1.0 where the ``strconfig`` argument to ``load``/``loads`` is ignored.

2.1.0 (2024-04-05)
------------------

Expand Down
4 changes: 1 addition & 3 deletions src/execnet/gateway_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,9 +1391,7 @@ def __init__(
gw: BaseGateway | None = channel_or_gateway.gateway
else:
gw = channel_or_gateway
if channel_or_gateway is None:
strconfig = None
else:
if channel_or_gateway is not None:
strconfig = channel_or_gateway._strconfig
if strconfig:
self.py2str_as_py3str, self.py3str_as_py2str = strconfig
Expand Down
5 changes: 5 additions & 0 deletions testing/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,8 @@ def test_tuple_nested_with_empty_in_between(dump, load) -> None:
tp, s = load(p)
assert tp == "tuple"
assert s == "(1, (), 3)"


def test_py2_string_loads() -> None:
"""Regression test for #267."""
assert execnet.loads(b"\x02M\x00\x00\x00\x01aQ") == b"a"

0 comments on commit d08b7e7

Please # to comment.