Skip to content

Commit 2e3165c

Browse files
authored
fix(asm): change ipaddress backport library (backport #4221) (#4223)
This is an automatic backport of pull request #4221 done by [Mergify](https://mergify.com). --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
1 parent a663f36 commit 2e3165c

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

docs/spelling_wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ autodetected
3333
autopatching
3434
backend
3535
backends
36+
backport
3637
bdd
3738
bikeshedding
3839
booleans
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fixes:
2+
- |
3+
ASM: fix a conflict with another backport of ipaddress by using the same lib. Add a test.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def get_exts_for(name):
258258
"pathlib2; python_version<'3.5'",
259259
"jsonschema",
260260
"xmltodict>=0.12",
261-
"backport_ipaddress; python_version=='2.7'",
261+
"ipaddress",
262262
"envier",
263263
]
264264
+ bytecode,

tests/tracer/test_trace_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from ipaddress import ip_network
23
import sys
34

45
from hypothesis import given
@@ -21,6 +22,7 @@
2122
from ddtrace.contrib import trace_utils
2223
from ddtrace.ext import http
2324
from ddtrace.internal import _context
25+
from ddtrace.internal.compat import six
2426
from ddtrace.internal.compat import stringify
2527
from ddtrace.propagation.http import HTTP_HEADER_PARENT_ID
2628
from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID
@@ -570,6 +572,16 @@ def test_set_http_meta_headers_ip(
570572
mock_store_headers.assert_called()
571573

572574

575+
def test_ip_subnet_regression():
576+
del_ip = "1.2.3.4/32"
577+
req_ip = "10.2.3.4"
578+
579+
del_ip = six.ensure_text(del_ip)
580+
req_ip = six.ensure_text(req_ip)
581+
582+
assert not ip_network(req_ip).subnet_of(ip_network(del_ip))
583+
584+
573585
@pytest.mark.skipif(sys.version_info < (3, 0, 0), reason="Python2 tests")
574586
@mock.patch("ddtrace.contrib.trace_utils._store_headers")
575587
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)