diff --git a/docker/utils/ports.py b/docker/utils/ports.py index 57332deee..8f713c720 100644 --- a/docker/utils/ports.py +++ b/docker/utils/ports.py @@ -54,6 +54,7 @@ def port_range(start, end, proto, randomly_available_port=False): def split_port(port): + port = str(port) match = PORT_SPEC.match(port) if match is None: _raise_invalid_port(port) diff --git a/docker/version.py b/docker/version.py index 8f40f467a..7953c904c 100644 --- a/docker/version.py +++ b/docker/version.py @@ -1,2 +1,2 @@ -version = "2.4.0" +version = "2.4.1" version_info = tuple([int(d) for d in version.split("-")[0].split(".")]) diff --git a/docs/change-log.md b/docs/change-log.md index 194f73479..4ccb617da 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,6 +1,16 @@ Change log ========== +2.4.1 +----- + +[List of PRs / issues for this release](https://github.com/docker/docker-py/milestone/35?closed=1) + +### Bugfixes + +* Fixed a bug where the `split_port` utility would raise an exception when + passed a non-string argument. + 2.4.0 ----- diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index c25881d14..a2d463d71 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -587,6 +587,9 @@ def test_with_no_container_port(self): def test_split_port_empty_string(self): self.assertRaises(ValueError, lambda: split_port("")) + def test_split_port_non_string(self): + assert split_port(1243) == (['1243'], None) + def test_build_port_bindings_with_one_port(self): port_bindings = build_port_bindings(["127.0.0.1:1000:1000"]) self.assertEqual(port_bindings["1000"], [("127.0.0.1", "1000")])