Skip to content

Commit 28fb540

Browse files
chore(tracer): remove support for Python 2 int [backport 2.21] (#13369)
Backport b452b63 from #12693 to 2.21. We remove support for the Python 2 int type in the encoder. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Gabriele N. Tornetta <[email protected]>
1 parent 41a7461 commit 28fb540

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

ddtrace/internal/_encoding.pyx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,13 @@ cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:
107107
return msgpack_pack_nil(pk)
108108

109109
if PyLong_Check(n):
110-
# PyInt_Check(long) is True for Python 3.
111-
# So we should test long before int.
112110
try:
113111
if n > 0:
114112
return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
115113
return msgpack_pack_long_long(pk, <long long> n)
116114
except OverflowError as oe:
117115
raise OverflowError("Integer value out of range")
118116

119-
if PyInt_Check(n):
120-
return msgpack_pack_long(pk, <long> n)
121-
122117
if PyFloat_Check(n):
123118
return msgpack_pack_double(pk, <double> n)
124119

@@ -1024,8 +1019,6 @@ cdef class Packer(object):
10241019
if o is None:
10251020
ret = msgpack_pack_nil(&self.pk)
10261021
elif PyLong_CheckExact(o):
1027-
# PyInt_Check(long) is True for Python 3.
1028-
# So we should test long before int.
10291022
try:
10301023
if o > 0:
10311024
ullval = o
@@ -1040,9 +1033,6 @@ cdef class Packer(object):
10401033
continue
10411034
else:
10421035
raise OverflowError("Integer value out of range")
1043-
elif PyInt_CheckExact(o):
1044-
longval = o
1045-
ret = msgpack_pack_long(&self.pk, longval)
10461036
elif PyFloat_CheckExact(o):
10471037
dval = o
10481038
ret = msgpack_pack_double(&self.pk, dval)

0 commit comments

Comments
 (0)