1 /* Generated by Cython 0.29.24 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "__LITTLE_ENDIAN__",
9                 "1"
10             ]
11         ],
12         "depends": [
13             "ddtrace/internal/_utils.h",
14             "ddtrace/internal/pack.h"
15         ],
16         "include_dirs": [
17             "ddtrace/internal",
18             "./ddtrace/internal",
19             "."
20         ],
21         "name": "ddtrace.internal._encoding",
22         "sources": [
23             "ddtrace/internal/_encoding.pyx"
24         ]
25     },
26     "module_name": "ddtrace.internal._encoding"
27 }
28 END: Cython Metadata */
29 
30 #ifndef PY_SSIZE_T_CLEAN
31 #define PY_SSIZE_T_CLEAN
32 #endif /* PY_SSIZE_T_CLEAN */
33 #include "Python.h"
34 #ifndef Py_PYTHON_H
35     #error Python headers needed to compile C extensions, please install development version of Python.
36 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
37     #error Cython requires Python 2.6+ or Python 3.3+.
38 #else
39 #define CYTHON_ABI "0_29_24"
40 #define CYTHON_HEX_VERSION 0x001D18F0
41 #define CYTHON_FUTURE_DIVISION 0
42 #include <stddef.h>
43 #ifndef offsetof
44   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
45 #endif
46 #if !defined(WIN32) && !defined(MS_WINDOWS)
47   #ifndef __stdcall
48     #define __stdcall
49   #endif
50   #ifndef __cdecl
51     #define __cdecl
52   #endif
53   #ifndef __fastcall
54     #define __fastcall
55   #endif
56 #endif
57 #ifndef DL_IMPORT
58   #define DL_IMPORT(t) t
59 #endif
60 #ifndef DL_EXPORT
61   #define DL_EXPORT(t) t
62 #endif
63 #define __PYX_COMMA ,
64 #ifndef HAVE_LONG_LONG
65   #if PY_VERSION_HEX >= 0x02070000
66     #define HAVE_LONG_LONG
67   #endif
68 #endif
69 #ifndef PY_LONG_LONG
70   #define PY_LONG_LONG LONG_LONG
71 #endif
72 #ifndef Py_HUGE_VAL
73   #define Py_HUGE_VAL HUGE_VAL
74 #endif
75 #ifdef PYPY_VERSION
76   #define CYTHON_COMPILING_IN_PYPY 1
77   #define CYTHON_COMPILING_IN_PYSTON 0
78   #define CYTHON_COMPILING_IN_CPYTHON 0
79   #undef CYTHON_USE_TYPE_SLOTS
80   #define CYTHON_USE_TYPE_SLOTS 0
81   #undef CYTHON_USE_PYTYPE_LOOKUP
82   #define CYTHON_USE_PYTYPE_LOOKUP 0
83   #if PY_VERSION_HEX < 0x03050000
84     #undef CYTHON_USE_ASYNC_SLOTS
85     #define CYTHON_USE_ASYNC_SLOTS 0
86   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
87     #define CYTHON_USE_ASYNC_SLOTS 1
88   #endif
89   #undef CYTHON_USE_PYLIST_INTERNALS
90   #define CYTHON_USE_PYLIST_INTERNALS 0
91   #undef CYTHON_USE_UNICODE_INTERNALS
92   #define CYTHON_USE_UNICODE_INTERNALS 0
93   #undef CYTHON_USE_UNICODE_WRITER
94   #define CYTHON_USE_UNICODE_WRITER 0
95   #undef CYTHON_USE_PYLONG_INTERNALS
96   #define CYTHON_USE_PYLONG_INTERNALS 0
97   #undef CYTHON_AVOID_BORROWED_REFS
98   #define CYTHON_AVOID_BORROWED_REFS 1
99   #undef CYTHON_ASSUME_SAFE_MACROS
100   #define CYTHON_ASSUME_SAFE_MACROS 0
101   #undef CYTHON_UNPACK_METHODS
102   #define CYTHON_UNPACK_METHODS 0
103   #undef CYTHON_FAST_THREAD_STATE
104   #define CYTHON_FAST_THREAD_STATE 0
105   #undef CYTHON_FAST_PYCALL
106   #define CYTHON_FAST_PYCALL 0
107   #undef CYTHON_PEP489_MULTI_PHASE_INIT
108   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
109   #undef CYTHON_USE_TP_FINALIZE
110   #define CYTHON_USE_TP_FINALIZE 0
111   #undef CYTHON_USE_DICT_VERSIONS
112   #define CYTHON_USE_DICT_VERSIONS 0
113   #undef CYTHON_USE_EXC_INFO_STACK
114   #define CYTHON_USE_EXC_INFO_STACK 0
115 #elif defined(PYSTON_VERSION)
116   #define CYTHON_COMPILING_IN_PYPY 0
117   #define CYTHON_COMPILING_IN_PYSTON 1
118   #define CYTHON_COMPILING_IN_CPYTHON 0
119   #ifndef CYTHON_USE_TYPE_SLOTS
120     #define CYTHON_USE_TYPE_SLOTS 1
121   #endif
122   #undef CYTHON_USE_PYTYPE_LOOKUP
123   #define CYTHON_USE_PYTYPE_LOOKUP 0
124   #undef CYTHON_USE_ASYNC_SLOTS
125   #define CYTHON_USE_ASYNC_SLOTS 0
126   #undef CYTHON_USE_PYLIST_INTERNALS
127   #define CYTHON_USE_PYLIST_INTERNALS 0
128   #ifndef CYTHON_USE_UNICODE_INTERNALS
129     #define CYTHON_USE_UNICODE_INTERNALS 1
130   #endif
131   #undef CYTHON_USE_UNICODE_WRITER
132   #define CYTHON_USE_UNICODE_WRITER 0
133   #undef CYTHON_USE_PYLONG_INTERNALS
134   #define CYTHON_USE_PYLONG_INTERNALS 0
135   #ifndef CYTHON_AVOID_BORROWED_REFS
136     #define CYTHON_AVOID_BORROWED_REFS 0
137   #endif
138   #ifndef CYTHON_ASSUME_SAFE_MACROS
139     #define CYTHON_ASSUME_SAFE_MACROS 1
140   #endif
141   #ifndef CYTHON_UNPACK_METHODS
142     #define CYTHON_UNPACK_METHODS 1
143   #endif
144   #undef CYTHON_FAST_THREAD_STATE
145   #define CYTHON_FAST_THREAD_STATE 0
146   #undef CYTHON_FAST_PYCALL
147   #define CYTHON_FAST_PYCALL 0
148   #undef CYTHON_PEP489_MULTI_PHASE_INIT
149   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
150   #undef CYTHON_USE_TP_FINALIZE
151   #define CYTHON_USE_TP_FINALIZE 0
152   #undef CYTHON_USE_DICT_VERSIONS
153   #define CYTHON_USE_DICT_VERSIONS 0
154   #undef CYTHON_USE_EXC_INFO_STACK
155   #define CYTHON_USE_EXC_INFO_STACK 0
156 #else
157   #define CYTHON_COMPILING_IN_PYPY 0
158   #define CYTHON_COMPILING_IN_PYSTON 0
159   #define CYTHON_COMPILING_IN_CPYTHON 1
160   #ifndef CYTHON_USE_TYPE_SLOTS
161     #define CYTHON_USE_TYPE_SLOTS 1
162   #endif
163   #if PY_VERSION_HEX < 0x02070000
164     #undef CYTHON_USE_PYTYPE_LOOKUP
165     #define CYTHON_USE_PYTYPE_LOOKUP 0
166   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
167     #define CYTHON_USE_PYTYPE_LOOKUP 1
168   #endif
169   #if PY_MAJOR_VERSION < 3
170     #undef CYTHON_USE_ASYNC_SLOTS
171     #define CYTHON_USE_ASYNC_SLOTS 0
172   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
173     #define CYTHON_USE_ASYNC_SLOTS 1
174   #endif
175   #if PY_VERSION_HEX < 0x02070000
176     #undef CYTHON_USE_PYLONG_INTERNALS
177     #define CYTHON_USE_PYLONG_INTERNALS 0
178   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
179     #define CYTHON_USE_PYLONG_INTERNALS 1
180   #endif
181   #ifndef CYTHON_USE_PYLIST_INTERNALS
182     #define CYTHON_USE_PYLIST_INTERNALS 1
183   #endif
184   #ifndef CYTHON_USE_UNICODE_INTERNALS
185     #define CYTHON_USE_UNICODE_INTERNALS 1
186   #endif
187   #if PY_VERSION_HEX < 0x030300F0
188     #undef CYTHON_USE_UNICODE_WRITER
189     #define CYTHON_USE_UNICODE_WRITER 0
190   #elif !defined(CYTHON_USE_UNICODE_WRITER)
191     #define CYTHON_USE_UNICODE_WRITER 1
192   #endif
193   #ifndef CYTHON_AVOID_BORROWED_REFS
194     #define CYTHON_AVOID_BORROWED_REFS 0
195   #endif
196   #ifndef CYTHON_ASSUME_SAFE_MACROS
197     #define CYTHON_ASSUME_SAFE_MACROS 1
198   #endif
199   #ifndef CYTHON_UNPACK_METHODS
200     #define CYTHON_UNPACK_METHODS 1
201   #endif
202   #ifndef CYTHON_FAST_THREAD_STATE
203     #define CYTHON_FAST_THREAD_STATE 1
204   #endif
205   #ifndef CYTHON_FAST_PYCALL
206     #define CYTHON_FAST_PYCALL 1
207   #endif
208   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
209     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
210   #endif
211   #ifndef CYTHON_USE_TP_FINALIZE
212     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
213   #endif
214   #ifndef CYTHON_USE_DICT_VERSIONS
215     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
216   #endif
217   #ifndef CYTHON_USE_EXC_INFO_STACK
218     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
219   #endif
220 #endif
221 #if !defined(CYTHON_FAST_PYCCALL)
222 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
223 #endif
224 #if CYTHON_USE_PYLONG_INTERNALS
225   #include "longintrepr.h"
226   #undef SHIFT
227   #undef BASE
228   #undef MASK
229   #ifdef SIZEOF_VOID_P
230     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
231   #endif
232 #endif
233 #ifndef __has_attribute
234   #define __has_attribute(x) 0
235 #endif
236 #ifndef __has_cpp_attribute
237   #define __has_cpp_attribute(x) 0
238 #endif
239 #ifndef CYTHON_RESTRICT
240   #if defined(__GNUC__)
241     #define CYTHON_RESTRICT __restrict__
242   #elif defined(_MSC_VER) && _MSC_VER >= 1400
243     #define CYTHON_RESTRICT __restrict
244   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
245     #define CYTHON_RESTRICT restrict
246   #else
247     #define CYTHON_RESTRICT
248   #endif
249 #endif
250 #ifndef CYTHON_UNUSED
251 # if defined(__GNUC__)
252 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
253 #     define CYTHON_UNUSED __attribute__ ((__unused__))
254 #   else
255 #     define CYTHON_UNUSED
256 #   endif
257 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
258 #   define CYTHON_UNUSED __attribute__ ((__unused__))
259 # else
260 #   define CYTHON_UNUSED
261 # endif
262 #endif
263 #ifndef CYTHON_MAYBE_UNUSED_VAR
264 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)265      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
266 #  else
267 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
268 #  endif
269 #endif
270 #ifndef CYTHON_NCP_UNUSED
271 # if CYTHON_COMPILING_IN_CPYTHON
272 #  define CYTHON_NCP_UNUSED
273 # else
274 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
275 # endif
276 #endif
277 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
278 #ifdef _MSC_VER
279     #ifndef _MSC_STDINT_H_
280         #if _MSC_VER < 1300
281            typedef unsigned char     uint8_t;
282            typedef unsigned int      uint32_t;
283         #else
284            typedef unsigned __int8   uint8_t;
285            typedef unsigned __int32  uint32_t;
286         #endif
287     #endif
288 #else
289    #include <stdint.h>
290 #endif
291 #ifndef CYTHON_FALLTHROUGH
292   #if defined(__cplusplus) && __cplusplus >= 201103L
293     #if __has_cpp_attribute(fallthrough)
294       #define CYTHON_FALLTHROUGH [[fallthrough]]
295     #elif __has_cpp_attribute(clang::fallthrough)
296       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
297     #elif __has_cpp_attribute(gnu::fallthrough)
298       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
299     #endif
300   #endif
301   #ifndef CYTHON_FALLTHROUGH
302     #if __has_attribute(fallthrough)
303       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
304     #else
305       #define CYTHON_FALLTHROUGH
306     #endif
307   #endif
308   #if defined(__clang__ ) && defined(__apple_build_version__)
309     #if __apple_build_version__ < 7000000
310       #undef  CYTHON_FALLTHROUGH
311       #define CYTHON_FALLTHROUGH
312     #endif
313   #endif
314 #endif
315 
316 #ifndef CYTHON_INLINE
317   #if defined(__clang__)
318     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
319   #elif defined(__GNUC__)
320     #define CYTHON_INLINE __inline__
321   #elif defined(_MSC_VER)
322     #define CYTHON_INLINE __inline
323   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
324     #define CYTHON_INLINE inline
325   #else
326     #define CYTHON_INLINE
327   #endif
328 #endif
329 
330 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
331   #define Py_OptimizeFlag 0
332 #endif
333 #define __PYX_BUILD_PY_SSIZE_T "n"
334 #define CYTHON_FORMAT_SSIZE_T "z"
335 #if PY_MAJOR_VERSION < 3
336   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
337   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
338           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
339   #define __Pyx_DefaultClassType PyClass_Type
340 #else
341   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
342 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
343   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
345 #else
346   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
347           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
348 #endif
349   #define __Pyx_DefaultClassType PyType_Type
350 #endif
351 #ifndef Py_TPFLAGS_CHECKTYPES
352   #define Py_TPFLAGS_CHECKTYPES 0
353 #endif
354 #ifndef Py_TPFLAGS_HAVE_INDEX
355   #define Py_TPFLAGS_HAVE_INDEX 0
356 #endif
357 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
358   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
359 #endif
360 #ifndef Py_TPFLAGS_HAVE_FINALIZE
361   #define Py_TPFLAGS_HAVE_FINALIZE 0
362 #endif
363 #ifndef METH_STACKLESS
364   #define METH_STACKLESS 0
365 #endif
366 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
367   #ifndef METH_FASTCALL
368      #define METH_FASTCALL 0x80
369   #endif
370   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
371   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
372                                                           Py_ssize_t nargs, PyObject *kwnames);
373 #else
374   #define __Pyx_PyCFunctionFast _PyCFunctionFast
375   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
376 #endif
377 #if CYTHON_FAST_PYCCALL
378 #define __Pyx_PyFastCFunction_Check(func)\
379     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
380 #else
381 #define __Pyx_PyFastCFunction_Check(func) 0
382 #endif
383 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
384   #define PyObject_Malloc(s)   PyMem_Malloc(s)
385   #define PyObject_Free(p)     PyMem_Free(p)
386   #define PyObject_Realloc(p)  PyMem_Realloc(p)
387 #endif
388 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
389   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
390   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
391   #define PyMem_RawFree(p)             PyMem_Free(p)
392 #endif
393 #if CYTHON_COMPILING_IN_PYSTON
394   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
395   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
396 #else
397   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
398   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
399 #endif
400 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
401   #define __Pyx_PyThreadState_Current PyThreadState_GET()
402 #elif PY_VERSION_HEX >= 0x03060000
403   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
404 #elif PY_VERSION_HEX >= 0x03000000
405   #define __Pyx_PyThreadState_Current PyThreadState_GET()
406 #else
407   #define __Pyx_PyThreadState_Current _PyThreadState_Current
408 #endif
409 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
410 #include "pythread.h"
411 #define Py_tss_NEEDS_INIT 0
412 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)413 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
414   *key = PyThread_create_key();
415   return 0;
416 }
PyThread_tss_alloc(void)417 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
418   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
419   *key = Py_tss_NEEDS_INIT;
420   return key;
421 }
PyThread_tss_free(Py_tss_t * key)422 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
423   PyObject_Free(key);
424 }
PyThread_tss_is_created(Py_tss_t * key)425 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
426   return *key != Py_tss_NEEDS_INIT;
427 }
PyThread_tss_delete(Py_tss_t * key)428 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
429   PyThread_delete_key(*key);
430   *key = Py_tss_NEEDS_INIT;
431 }
PyThread_tss_set(Py_tss_t * key,void * value)432 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
433   return PyThread_set_key_value(*key, value);
434 }
PyThread_tss_get(Py_tss_t * key)435 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
436   return PyThread_get_key_value(*key);
437 }
438 #endif
439 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
440 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
441 #else
442 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
443 #endif
444 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
445   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
446   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
447 #else
448   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
449   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
450 #endif
451 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
452 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
453 #else
454 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
455 #endif
456 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
457   #define CYTHON_PEP393_ENABLED 1
458   #if defined(PyUnicode_IS_READY)
459   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
460                                               0 : _PyUnicode_Ready((PyObject *)(op)))
461   #else
462   #define __Pyx_PyUnicode_READY(op)       (0)
463   #endif
464   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
465   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
466   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
467   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
468   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
469   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
470   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
471   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
472   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
473   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
474   #else
475   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
476   #endif
477   #else
478   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
479   #endif
480 #else
481   #define CYTHON_PEP393_ENABLED 0
482   #define PyUnicode_1BYTE_KIND  1
483   #define PyUnicode_2BYTE_KIND  2
484   #define PyUnicode_4BYTE_KIND  4
485   #define __Pyx_PyUnicode_READY(op)       (0)
486   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
487   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
488   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
489   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
490   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
491   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
492   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
493   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
494 #endif
495 #if CYTHON_COMPILING_IN_PYPY
496   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
497   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
498 #else
499   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
500   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
501       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
502 #endif
503 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
504   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
505 #endif
506 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
507   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
508 #endif
509 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
510   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
511 #endif
512 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
513 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
514 #if PY_MAJOR_VERSION >= 3
515   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
516 #else
517   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
518 #endif
519 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
520   #define PyObject_ASCII(o)            PyObject_Repr(o)
521 #endif
522 #if PY_MAJOR_VERSION >= 3
523   #define PyBaseString_Type            PyUnicode_Type
524   #define PyStringObject               PyUnicodeObject
525   #define PyString_Type                PyUnicode_Type
526   #define PyString_Check               PyUnicode_Check
527   #define PyString_CheckExact          PyUnicode_CheckExact
528 #ifndef PyObject_Unicode
529   #define PyObject_Unicode             PyObject_Str
530 #endif
531 #endif
532 #if PY_MAJOR_VERSION >= 3
533   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
534   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
535 #else
536   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
537   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
538 #endif
539 #ifndef PySet_CheckExact
540   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
541 #endif
542 #if PY_VERSION_HEX >= 0x030900A4
543   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
544   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
545 #else
546   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
547   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
548 #endif
549 #if CYTHON_ASSUME_SAFE_MACROS
550   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
551 #else
552   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
553 #endif
554 #if PY_MAJOR_VERSION >= 3
555   #define PyIntObject                  PyLongObject
556   #define PyInt_Type                   PyLong_Type
557   #define PyInt_Check(op)              PyLong_Check(op)
558   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
559   #define PyInt_FromString             PyLong_FromString
560   #define PyInt_FromUnicode            PyLong_FromUnicode
561   #define PyInt_FromLong               PyLong_FromLong
562   #define PyInt_FromSize_t             PyLong_FromSize_t
563   #define PyInt_FromSsize_t            PyLong_FromSsize_t
564   #define PyInt_AsLong                 PyLong_AsLong
565   #define PyInt_AS_LONG                PyLong_AS_LONG
566   #define PyInt_AsSsize_t              PyLong_AsSsize_t
567   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
568   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
569   #define PyNumber_Int                 PyNumber_Long
570 #endif
571 #if PY_MAJOR_VERSION >= 3
572   #define PyBoolObject                 PyLongObject
573 #endif
574 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
575   #ifndef PyUnicode_InternFromString
576     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
577   #endif
578 #endif
579 #if PY_VERSION_HEX < 0x030200A4
580   typedef long Py_hash_t;
581   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
582   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
583 #else
584   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
585   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
586 #endif
587 #if PY_MAJOR_VERSION >= 3
588   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
589 #else
590   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
591 #endif
592 #if CYTHON_USE_ASYNC_SLOTS
593   #if PY_VERSION_HEX >= 0x030500B1
594     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
595     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
596   #else
597     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
598   #endif
599 #else
600   #define __Pyx_PyType_AsAsync(obj) NULL
601 #endif
602 #ifndef __Pyx_PyAsyncMethodsStruct
603     typedef struct {
604         unaryfunc am_await;
605         unaryfunc am_aiter;
606         unaryfunc am_anext;
607     } __Pyx_PyAsyncMethodsStruct;
608 #endif
609 
610 #if defined(WIN32) || defined(MS_WINDOWS)
611   #define _USE_MATH_DEFINES
612 #endif
613 #include <math.h>
614 #ifdef NAN
615 #define __PYX_NAN() ((float) NAN)
616 #else
__PYX_NAN()617 static CYTHON_INLINE float __PYX_NAN() {
618   float value;
619   memset(&value, 0xFF, sizeof(value));
620   return value;
621 }
622 #endif
623 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
624 #define __Pyx_truncl trunc
625 #else
626 #define __Pyx_truncl truncl
627 #endif
628 
629 #define __PYX_MARK_ERR_POS(f_index, lineno) \
630     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
631 #define __PYX_ERR(f_index, lineno, Ln_error) \
632     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
633 
634 #ifndef __PYX_EXTERN_C
635   #ifdef __cplusplus
636     #define __PYX_EXTERN_C extern "C"
637   #else
638     #define __PYX_EXTERN_C extern
639   #endif
640 #endif
641 
642 #define __PYX_HAVE__ddtrace__internal___encoding
643 #define __PYX_HAVE_API__ddtrace__internal___encoding
644 /* Early includes */
645 #include <string.h>
646 #include <stdio.h>
647 #include "pythread.h"
648 #include <stdint.h>
649 #include "_utils.h"
650 #include "pack.h"
651 #ifdef _OPENMP
652 #include <omp.h>
653 #endif /* _OPENMP */
654 
655 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
656 #define CYTHON_WITHOUT_ASSERTIONS
657 #endif
658 
659 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
660                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
661 
662 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
663 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
664 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
665 #define __PYX_DEFAULT_STRING_ENCODING ""
666 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
667 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
668 #define __Pyx_uchar_cast(c) ((unsigned char)c)
669 #define __Pyx_long_cast(x) ((long)x)
670 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
671     (sizeof(type) < sizeof(Py_ssize_t))  ||\
672     (sizeof(type) > sizeof(Py_ssize_t) &&\
673           likely(v < (type)PY_SSIZE_T_MAX ||\
674                  v == (type)PY_SSIZE_T_MAX)  &&\
675           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
676                                 v == (type)PY_SSIZE_T_MIN)))  ||\
677     (sizeof(type) == sizeof(Py_ssize_t) &&\
678           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
679                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)680 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
681     return (size_t) i < (size_t) limit;
682 }
683 #if defined (__cplusplus) && __cplusplus >= 201103L
684     #include <cstdlib>
685     #define __Pyx_sst_abs(value) std::abs(value)
686 #elif SIZEOF_INT >= SIZEOF_SIZE_T
687     #define __Pyx_sst_abs(value) abs(value)
688 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
689     #define __Pyx_sst_abs(value) labs(value)
690 #elif defined (_MSC_VER)
691     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
692 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
693     #define __Pyx_sst_abs(value) llabs(value)
694 #elif defined (__GNUC__)
695     #define __Pyx_sst_abs(value) __builtin_llabs(value)
696 #else
697     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
698 #endif
699 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
700 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
701 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
702 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
703 #define __Pyx_PyBytes_FromString        PyBytes_FromString
704 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
705 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
706 #if PY_MAJOR_VERSION < 3
707     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
708     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
709 #else
710     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
711     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
712 #endif
713 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
714 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
715 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
716 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
717 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
718 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
719 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
720 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
721 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
722 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
723 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
724 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
725 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
726 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
727 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
728 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)729 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
730     const Py_UNICODE *u_end = u;
731     while (*u_end++) ;
732     return (size_t)(u_end - u - 1);
733 }
734 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
735 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
736 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
737 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
738 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
739 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
740 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
741 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
742 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
743 #define __Pyx_PySequence_Tuple(obj)\
744     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
745 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
746 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
747 #if CYTHON_ASSUME_SAFE_MACROS
748 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
749 #else
750 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
751 #endif
752 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
753 #if PY_MAJOR_VERSION >= 3
754 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
755 #else
756 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
757 #endif
758 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
759 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
760 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)761 static int __Pyx_init_sys_getdefaultencoding_params(void) {
762     PyObject* sys;
763     PyObject* default_encoding = NULL;
764     PyObject* ascii_chars_u = NULL;
765     PyObject* ascii_chars_b = NULL;
766     const char* default_encoding_c;
767     sys = PyImport_ImportModule("sys");
768     if (!sys) goto bad;
769     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
770     Py_DECREF(sys);
771     if (!default_encoding) goto bad;
772     default_encoding_c = PyBytes_AsString(default_encoding);
773     if (!default_encoding_c) goto bad;
774     if (strcmp(default_encoding_c, "ascii") == 0) {
775         __Pyx_sys_getdefaultencoding_not_ascii = 0;
776     } else {
777         char ascii_chars[128];
778         int c;
779         for (c = 0; c < 128; c++) {
780             ascii_chars[c] = c;
781         }
782         __Pyx_sys_getdefaultencoding_not_ascii = 1;
783         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
784         if (!ascii_chars_u) goto bad;
785         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
786         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
787             PyErr_Format(
788                 PyExc_ValueError,
789                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
790                 default_encoding_c);
791             goto bad;
792         }
793         Py_DECREF(ascii_chars_u);
794         Py_DECREF(ascii_chars_b);
795     }
796     Py_DECREF(default_encoding);
797     return 0;
798 bad:
799     Py_XDECREF(default_encoding);
800     Py_XDECREF(ascii_chars_u);
801     Py_XDECREF(ascii_chars_b);
802     return -1;
803 }
804 #endif
805 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
806 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
807 #else
808 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
809 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
810 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)811 static int __Pyx_init_sys_getdefaultencoding_params(void) {
812     PyObject* sys;
813     PyObject* default_encoding = NULL;
814     char* default_encoding_c;
815     sys = PyImport_ImportModule("sys");
816     if (!sys) goto bad;
817     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
818     Py_DECREF(sys);
819     if (!default_encoding) goto bad;
820     default_encoding_c = PyBytes_AsString(default_encoding);
821     if (!default_encoding_c) goto bad;
822     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
823     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
824     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
825     Py_DECREF(default_encoding);
826     return 0;
827 bad:
828     Py_XDECREF(default_encoding);
829     return -1;
830 }
831 #endif
832 #endif
833 
834 
835 /* Test for GCC > 2.95 */
836 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
837   #define likely(x)   __builtin_expect(!!(x), 1)
838   #define unlikely(x) __builtin_expect(!!(x), 0)
839 #else /* !__GNUC__ or GCC < 2.95 */
840   #define likely(x)   (x)
841   #define unlikely(x) (x)
842 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)843 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
844 
845 static PyObject *__pyx_m = NULL;
846 static PyObject *__pyx_d;
847 static PyObject *__pyx_b;
848 static PyObject *__pyx_cython_runtime = NULL;
849 static PyObject *__pyx_empty_tuple;
850 static PyObject *__pyx_empty_bytes;
851 static PyObject *__pyx_empty_unicode;
852 static int __pyx_lineno;
853 static int __pyx_clineno = 0;
854 static const char * __pyx_cfilenm= __FILE__;
855 static const char *__pyx_filename;
856 
857 
858 static const char *__pyx_f[] = {
859   "ddtrace/internal/_encoding.pyx",
860   "stringsource",
861   "type.pxd",
862   "bool.pxd",
863   "complex.pxd",
864 };
865 
866 /*--- Type declarations ---*/
867 struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable;
868 struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable;
869 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable;
870 struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder;
871 struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
872 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
873 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
874 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
875 
876 /* "ddtrace/internal/_encoding.pyx":138
877  *
878  *
879  * cdef class StringTable(object):             # <<<<<<<<<<<<<<
880  *     cdef dict _table
881  *     cdef stdint.uint32_t _next_id
882  */
883 struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable {
884   PyObject_HEAD
885   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *__pyx_vtab;
886   PyObject *_table;
887   uint32_t _next_id;
888 };
889 
890 
891 /* "ddtrace/internal/_encoding.pyx":181
892  *
893  *
894  * cdef class ListStringTable(StringTable):             # <<<<<<<<<<<<<<
895  *     cdef list _list
896  *
897  */
898 struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable {
899   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable __pyx_base;
900   PyObject *_list;
901 };
902 
903 
904 /* "ddtrace/internal/_encoding.pyx":195
905  *
906  *
907  * cdef class MsgpackStringTable(StringTable):             # <<<<<<<<<<<<<<
908  *     cdef msgpack_packer pk
909  *     cdef int max_size
910  */
911 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable {
912   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable __pyx_base;
913   struct msgpack_packer pk;
914   int max_size;
915   int _sp_len;
916   uint32_t _sp_id;
917   PyObject *_lock;
918   size_t _reset_size;
919 };
920 
921 
922 /* "ddtrace/internal/_encoding.pyx":295
923  *
924  *
925  * cdef class BufferedEncoder(object):             # <<<<<<<<<<<<<<
926  *     content_type: str = None
927  *
928  */
929 struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder {
930   PyObject_HEAD
931   size_t max_size;
932   size_t max_item_size;
933   PyObject *_lock;
934 };
935 
936 
937 /* "ddtrace/internal/_encoding.pyx":316
938  *
939  *
940  * cdef class ListBufferedEncoder(BufferedEncoder):             # <<<<<<<<<<<<<<
941  *     cdef list _buffer
942  *     cdef Py_ssize_t _size
943  */
944 struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder {
945   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder __pyx_base;
946   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_vtab;
947   PyObject *_buffer;
948   Py_ssize_t _size;
949 };
950 
951 
952 /* "ddtrace/internal/_encoding.pyx":362
953  *
954  *
955  * cdef class MsgpackEncoderBase(BufferedEncoder):             # <<<<<<<<<<<<<<
956  *     content_type = "application/msgpack"
957  *
958  */
959 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase {
960   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder __pyx_base;
961   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_vtab;
962   struct msgpack_packer pk;
963   uint32_t _count;
964 };
965 
966 
967 /* "ddtrace/internal/_encoding.pyx":493
968  *
969  *
970  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):             # <<<<<<<<<<<<<<
971  *     cpdef flush(self):
972  *         with self._lock:
973  */
974 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 {
975   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase __pyx_base;
976 };
977 
978 
979 /* "ddtrace/internal/_encoding.pyx":638
980  *
981  *
982  * cdef class MsgpackEncoderV05(MsgpackEncoderBase):             # <<<<<<<<<<<<<<
983  *     cdef MsgpackStringTable _st
984  *
985  */
986 struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 {
987   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase __pyx_base;
988   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *_st;
989 };
990 
991 
992 
993 /* "ddtrace/internal/_encoding.pyx":138
994  *
995  *
996  * cdef class StringTable(object):             # <<<<<<<<<<<<<<
997  *     cdef dict _table
998  *     cdef stdint.uint32_t _next_id
999  */
1000 
1001 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable {
1002   PyObject *(*insert)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *);
1003   uint32_t (*_index)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *);
1004   PyObject *(*index)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *, int __pyx_skip_dispatch);
1005   PyObject *(*reset)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *);
1006 };
1007 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *__pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable;
1008 
1009 
1010 /* "ddtrace/internal/_encoding.pyx":181
1011  *
1012  *
1013  * cdef class ListStringTable(StringTable):             # <<<<<<<<<<<<<<
1014  *     cdef list _list
1015  *
1016  */
1017 
1018 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListStringTable {
1019   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable __pyx_base;
1020 };
1021 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_vtabptr_7ddtrace_8internal_9_encoding_ListStringTable;
1022 
1023 
1024 /* "ddtrace/internal/_encoding.pyx":195
1025  *
1026  *
1027  * cdef class MsgpackStringTable(StringTable):             # <<<<<<<<<<<<<<
1028  *     cdef msgpack_packer pk
1029  *     cdef int max_size
1030  */
1031 
1032 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable {
1033   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable __pyx_base;
1034   PyObject *(*savepoint)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *);
1035   PyObject *(*rollback)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *);
1036   PyObject *(*get_bytes)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *);
1037   PyObject *(*append_raw)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *, long, Py_ssize_t);
1038   PyObject *(*flush)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *, int __pyx_skip_dispatch);
1039 };
1040 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackStringTable;
1041 
1042 
1043 /* "ddtrace/internal/_encoding.pyx":316
1044  *
1045  *
1046  * cdef class ListBufferedEncoder(BufferedEncoder):             # <<<<<<<<<<<<<<
1047  *     cdef list _buffer
1048  *     cdef Py_ssize_t _size
1049  */
1050 
1051 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListBufferedEncoder {
1052   PyObject *(*put)(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *, PyObject *, int __pyx_skip_dispatch);
1053   PyObject *(*get)(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *, int __pyx_skip_dispatch);
1054 };
1055 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_vtabptr_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
1056 
1057 
1058 /* "ddtrace/internal/_encoding.pyx":362
1059  *
1060  *
1061  * cdef class MsgpackEncoderBase(BufferedEncoder):             # <<<<<<<<<<<<<<
1062  *     content_type = "application/msgpack"
1063  *
1064  */
1065 
1066 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase {
1067   PyObject *(*_decode)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, int __pyx_skip_dispatch);
1068   PyObject *(*_reset_buffer)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *);
1069   PyObject *(*encode)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch);
1070   int (*_update_array_len)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *);
1071   PyObject *(*get_bytes)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *);
1072   char *(*get_buffer)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *);
1073   void *(*get_dd_origin_ref)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *);
1074   int (*_pack_trace)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *);
1075   PyObject *(*put)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, int __pyx_skip_dispatch);
1076   PyObject *(*flush)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch);
1077   int (*pack_span)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, void *);
1078 };
1079 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
1080 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *);
1081 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *);
1082 
1083 
1084 /* "ddtrace/internal/_encoding.pyx":493
1085  *
1086  *
1087  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):             # <<<<<<<<<<<<<<
1088  *     cpdef flush(self):
1089  *         with self._lock:
1090  */
1091 
1092 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 {
1093   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase __pyx_base;
1094   int (*_pack_meta)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *, char *);
1095   int (*_pack_metrics)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *);
1096 };
1097 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
1098 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *, char *);
1099 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *);
1100 
1101 
1102 /* "ddtrace/internal/_encoding.pyx":638
1103  *
1104  *
1105  * cdef class MsgpackEncoderV05(MsgpackEncoderBase):             # <<<<<<<<<<<<<<
1106  *     cdef MsgpackStringTable _st
1107  *
1108  */
1109 
1110 struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 {
1111   struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase __pyx_base;
1112   int (*_pack_string)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *, PyObject *);
1113 };
1114 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
1115 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *, PyObject *);
1116 
1117 /* --- Runtime support code (head) --- */
1118 /* Refnanny.proto */
1119 #ifndef CYTHON_REFNANNY
1120   #define CYTHON_REFNANNY 0
1121 #endif
1122 #if CYTHON_REFNANNY
1123   typedef struct {
1124     void (*INCREF)(void*, PyObject*, int);
1125     void (*DECREF)(void*, PyObject*, int);
1126     void (*GOTREF)(void*, PyObject*, int);
1127     void (*GIVEREF)(void*, PyObject*, int);
1128     void* (*SetupContext)(const char*, int, const char*);
1129     void (*FinishContext)(void**);
1130   } __Pyx_RefNannyAPIStruct;
1131   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1132   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1133   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1134 #ifdef WITH_THREAD
1135   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1136           if (acquire_gil) {\
1137               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1138               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1139               PyGILState_Release(__pyx_gilstate_save);\
1140           } else {\
1141               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1142           }
1143 #else
1144   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1145           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1146 #endif
1147   #define __Pyx_RefNannyFinishContext()\
1148           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1149   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1150   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1151   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1152   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1153   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1154   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1155   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1156   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1157 #else
1158   #define __Pyx_RefNannyDeclarations
1159   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1160   #define __Pyx_RefNannyFinishContext()
1161   #define __Pyx_INCREF(r) Py_INCREF(r)
1162   #define __Pyx_DECREF(r) Py_DECREF(r)
1163   #define __Pyx_GOTREF(r)
1164   #define __Pyx_GIVEREF(r)
1165   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1166   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1167   #define __Pyx_XGOTREF(r)
1168   #define __Pyx_XGIVEREF(r)
1169 #endif
1170 #define __Pyx_XDECREF_SET(r, v) do {\
1171         PyObject *tmp = (PyObject *) r;\
1172         r = v; __Pyx_XDECREF(tmp);\
1173     } while (0)
1174 #define __Pyx_DECREF_SET(r, v) do {\
1175         PyObject *tmp = (PyObject *) r;\
1176         r = v; __Pyx_DECREF(tmp);\
1177     } while (0)
1178 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1179 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1180 
1181 /* PyObjectGetAttrStr.proto */
1182 #if CYTHON_USE_TYPE_SLOTS
1183 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1184 #else
1185 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1186 #endif
1187 
1188 /* GetBuiltinName.proto */
1189 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1190 
1191 /* GetTopmostException.proto */
1192 #if CYTHON_USE_EXC_INFO_STACK
1193 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1194 #endif
1195 
1196 /* PyThreadStateGet.proto */
1197 #if CYTHON_FAST_THREAD_STATE
1198 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1199 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1200 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1201 #else
1202 #define __Pyx_PyThreadState_declare
1203 #define __Pyx_PyThreadState_assign
1204 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1205 #endif
1206 
1207 /* SaveResetException.proto */
1208 #if CYTHON_FAST_THREAD_STATE
1209 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1210 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1211 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1212 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1213 #else
1214 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1215 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1216 #endif
1217 
1218 /* PyErrExceptionMatches.proto */
1219 #if CYTHON_FAST_THREAD_STATE
1220 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1221 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1222 #else
1223 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1224 #endif
1225 
1226 /* GetException.proto */
1227 #if CYTHON_FAST_THREAD_STATE
1228 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1229 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1230 #else
1231 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1232 #endif
1233 
1234 /* PyObjectCall.proto */
1235 #if CYTHON_COMPILING_IN_CPYTHON
1236 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1237 #else
1238 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1239 #endif
1240 
1241 /* PyErrFetchRestore.proto */
1242 #if CYTHON_FAST_THREAD_STATE
1243 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1244 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1245 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1246 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1247 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1248 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1249 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1250 #if CYTHON_COMPILING_IN_CPYTHON
1251 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1252 #else
1253 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1254 #endif
1255 #else
1256 #define __Pyx_PyErr_Clear() PyErr_Clear()
1257 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1258 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1259 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1260 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1261 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1262 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1263 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1264 #endif
1265 
1266 /* RaiseException.proto */
1267 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1268 
1269 /* PyCFunctionFastCall.proto */
1270 #if CYTHON_FAST_PYCCALL
1271 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1272 #else
1273 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1274 #endif
1275 
1276 /* PyFunctionFastCall.proto */
1277 #if CYTHON_FAST_PYCALL
1278 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1279     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1280 #if 1 || PY_VERSION_HEX < 0x030600B1
1281 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1282 #else
1283 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1284 #endif
1285 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1286     (sizeof(char [1 - 2*!(cond)]) - 1)
1287 #ifndef Py_MEMBER_SIZE
1288 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1289 #endif
1290   static size_t __pyx_pyframe_localsplus_offset = 0;
1291   #include "frameobject.h"
1292   #define __Pxy_PyFrame_Initialize_Offsets()\
1293     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1294      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1295   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1296     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1297 #endif
1298 
1299 /* PyObjectCallMethO.proto */
1300 #if CYTHON_COMPILING_IN_CPYTHON
1301 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1302 #endif
1303 
1304 /* PyObjectCallOneArg.proto */
1305 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1306 
1307 /* RaiseArgTupleInvalid.proto */
1308 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1309     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1310 
1311 /* KeywordStringCheck.proto */
1312 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1313 
1314 /* WriteUnraisableException.proto */
1315 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1316                                   int lineno, const char *filename,
1317                                   int full_traceback, int nogil);
1318 
1319 /* PyDictVersioning.proto */
1320 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1321 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1322 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1323 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1324     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1325     (cache_var) = (value);
1326 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1327     static PY_UINT64_T __pyx_dict_version = 0;\
1328     static PyObject *__pyx_dict_cached_value = NULL;\
1329     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1330         (VAR) = __pyx_dict_cached_value;\
1331     } else {\
1332         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1333         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1334     }\
1335 }
1336 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1337 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1338 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1339 #else
1340 #define __PYX_GET_DICT_VERSION(dict)  (0)
1341 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1342 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1343 #endif
1344 
1345 /* PyObjectCall2Args.proto */
1346 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1347 
1348 /* GetAttr.proto */
1349 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1350 
1351 /* GetAttr3.proto */
1352 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1353 
1354 /* GetModuleGlobalName.proto */
1355 #if CYTHON_USE_DICT_VERSIONS
1356 #define __Pyx_GetModuleGlobalName(var, name)  {\
1357     static PY_UINT64_T __pyx_dict_version = 0;\
1358     static PyObject *__pyx_dict_cached_value = NULL;\
1359     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1360         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1361         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1362 }
1363 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1364     PY_UINT64_T __pyx_dict_version;\
1365     PyObject *__pyx_dict_cached_value;\
1366     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1367 }
1368 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1369 #else
1370 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1371 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1372 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1373 #endif
1374 
1375 /* PyObjectCallNoArg.proto */
1376 #if CYTHON_COMPILING_IN_CPYTHON
1377 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1378 #else
1379 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1380 #endif
1381 
1382 /* RaiseDoubleKeywords.proto */
1383 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1384 
1385 /* ParseKeywords.proto */
1386 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1387     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1388     const char* function_name);
1389 
1390 /* PyIntCompare.proto */
1391 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1392 
1393 /* PyObjectLookupSpecial.proto */
1394 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_LookupSpecial(PyObject * obj,PyObject * attr_name)1395 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1396     PyObject *res;
1397     PyTypeObject *tp = Py_TYPE(obj);
1398 #if PY_MAJOR_VERSION < 3
1399     if (unlikely(PyInstance_Check(obj)))
1400         return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1401 #endif
1402     res = _PyType_Lookup(tp, attr_name);
1403     if (likely(res)) {
1404         descrgetfunc f = Py_TYPE(res)->tp_descr_get;
1405         if (!f) {
1406             Py_INCREF(res);
1407         } else {
1408             res = f(res, obj, (PyObject *)tp);
1409         }
1410     } else {
1411         PyErr_SetObject(PyExc_AttributeError, attr_name);
1412     }
1413     return res;
1414 }
1415 #else
1416 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1417 #endif
1418 
1419 /* SwapException.proto */
1420 #if CYTHON_FAST_THREAD_STATE
1421 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1422 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1423 #else
1424 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1425 #endif
1426 
1427 /* ListAppend.proto */
1428 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1429 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1430     PyListObject* L = (PyListObject*) list;
1431     Py_ssize_t len = Py_SIZE(list);
1432     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1433         Py_INCREF(x);
1434         PyList_SET_ITEM(list, len, x);
1435         __Pyx_SET_SIZE(list, len + 1);
1436         return 0;
1437     }
1438     return PyList_Append(list, x);
1439 }
1440 #else
1441 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1442 #endif
1443 
1444 /* SliceObject.proto */
1445 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1446     __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1447 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1448         PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1449         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1450         int has_cstart, int has_cstop, int wraparound);
1451 
1452 /* Import.proto */
1453 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1454 
1455 /* SliceObject.proto */
1456 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1457         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1458         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1459         int has_cstart, int has_cstop, int wraparound);
1460 
1461 /* GetItemInt.proto */
1462 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1463     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1464     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1465     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1466                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1467 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1468     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1469     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1470     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1471 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1472                                                               int wraparound, int boundscheck);
1473 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1474     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1475     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1476     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1477 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1478                                                               int wraparound, int boundscheck);
1479 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1480 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1481                                                      int is_list, int wraparound, int boundscheck);
1482 
1483 /* ArgTypeTest.proto */
1484 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1485     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1486         __Pyx__ArgTypeTest(obj, type, name, exact))
1487 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1488 
1489 /* py_dict_items.proto */
1490 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1491 
1492 /* UnpackUnboundCMethod.proto */
1493 typedef struct {
1494     PyObject *type;
1495     PyObject **method_name;
1496     PyCFunction func;
1497     PyObject *method;
1498     int flag;
1499 } __Pyx_CachedCFunction;
1500 
1501 /* CallUnboundCMethod0.proto */
1502 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1503 #if CYTHON_COMPILING_IN_CPYTHON
1504 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1505     (likely((cfunc)->func) ?\
1506         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1507          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1508             (PY_VERSION_HEX >= 0x030700A0 ?\
1509                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1510                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1511           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1512             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1513             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1514                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1515                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1516         __Pyx__CallUnboundCMethod0(cfunc, self))
1517 #else
1518 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1519 #endif
1520 
1521 /* RaiseTooManyValuesToUnpack.proto */
1522 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1523 
1524 /* RaiseNeedMoreValuesToUnpack.proto */
1525 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1526 
1527 /* IterFinish.proto */
1528 static CYTHON_INLINE int __Pyx_IterFinish(void);
1529 
1530 /* UnpackItemEndCheck.proto */
1531 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1532 
1533 /* PyIntCompare.proto */
1534 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1535 
1536 /* ImportFrom.proto */
1537 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1538 
1539 /* HasAttr.proto */
1540 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1541 
1542 /* PyObject_GenericGetAttrNoDict.proto */
1543 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1544 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1545 #else
1546 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1547 #endif
1548 
1549 /* PyObject_GenericGetAttr.proto */
1550 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1551 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1552 #else
1553 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1554 #endif
1555 
1556 /* SetVTable.proto */
1557 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1558 
1559 /* PyObjectGetAttrStrNoError.proto */
1560 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1561 
1562 /* SetupReduce.proto */
1563 static int __Pyx_setup_reduce(PyObject* type_obj);
1564 
1565 /* TypeImport.proto */
1566 #ifndef __PYX_HAVE_RT_ImportType_proto
1567 #define __PYX_HAVE_RT_ImportType_proto
1568 enum __Pyx_ImportType_CheckSize {
1569    __Pyx_ImportType_CheckSize_Error = 0,
1570    __Pyx_ImportType_CheckSize_Warn = 1,
1571    __Pyx_ImportType_CheckSize_Ignore = 2
1572 };
1573 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1574 #endif
1575 
1576 /* CalculateMetaclass.proto */
1577 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1578 
1579 /* Py3ClassCreate.proto */
1580 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1581                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1582 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1583                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1584 
1585 /* CLineInTraceback.proto */
1586 #ifdef CYTHON_CLINE_IN_TRACEBACK
1587 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1588 #else
1589 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1590 #endif
1591 
1592 /* CodeObjectCache.proto */
1593 typedef struct {
1594     PyCodeObject* code_object;
1595     int code_line;
1596 } __Pyx_CodeObjectCacheEntry;
1597 struct __Pyx_CodeObjectCache {
1598     int count;
1599     int max_count;
1600     __Pyx_CodeObjectCacheEntry* entries;
1601 };
1602 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1603 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1604 static PyCodeObject *__pyx_find_code_object(int code_line);
1605 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1606 
1607 /* AddTraceback.proto */
1608 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1609                                int py_line, const char *filename);
1610 
1611 /* GCCDiagnostics.proto */
1612 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1613 #define __Pyx_HAS_GCC_DIAGNOSTIC
1614 #endif
1615 
1616 /* CIntToPy.proto */
1617 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);
1618 
1619 /* CIntFromPy.proto */
1620 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);
1621 
1622 /* CIntFromPy.proto */
1623 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1624 
1625 /* CIntFromPy.proto */
1626 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1627 
1628 /* CIntFromPy.proto */
1629 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *);
1630 
1631 /* CIntFromPy.proto */
1632 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);
1633 
1634 /* CIntFromPy.proto */
1635 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1636 
1637 /* CIntToPy.proto */
1638 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1639 
1640 /* CIntToPy.proto */
1641 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1642 
1643 /* CIntFromPy.proto */
1644 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
1645 
1646 /* CIntFromPy.proto */
1647 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);
1648 
1649 /* CIntFromPy.proto */
1650 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);
1651 
1652 /* FastTypeChecks.proto */
1653 #if CYTHON_COMPILING_IN_CPYTHON
1654 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1655 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1656 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1657 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1658 #else
1659 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1660 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1661 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1662 #endif
1663 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1664 
1665 /* CheckBinaryVersion.proto */
1666 static int __Pyx_check_binary_version(void);
1667 
1668 /* InitStrings.proto */
1669 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1670 
1671 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_insert(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_string); /* proto*/
1672 static uint32_t __pyx_f_7ddtrace_8internal_9_encoding_11StringTable__index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string); /* proto*/
1673 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string, int __pyx_skip_dispatch); /* proto*/
1674 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self); /* proto*/
1675 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_15ListStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self, PyObject *__pyx_v_string); /* proto*/
1676 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, PyObject *__pyx_v_string); /* proto*/
1677 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_savepoint(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto*/
1678 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_rollback(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto*/
1679 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto*/
1680 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_append_raw(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, long __pyx_v_src, Py_ssize_t __pyx_v_size); /* proto*/
1681 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto*/
1682 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1683 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch); /* proto*/
1684 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1685 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__decode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch); /* proto*/
1686 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__reset_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto*/
1687 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1688 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto*/
1689 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto*/
1690 static char *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto*/
1691 static void *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dd_origin); /* proto*/
1692 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace); /* proto*/
1693 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch); /* proto*/
1694 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_flush(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1695 static int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_pack_span(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_span, CYTHON_UNUSED void *__pyx_v_dd_origin); /* proto*/
1696 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1697 static void *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_dd_origin); /* proto*/
1698 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_meta, char *__pyx_v_dd_origin); /* proto*/
1699 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_metrics); /* proto*/
1700 static int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_span, void *__pyx_v_dd_origin); /* proto*/
1701 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1702 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch); /* proto*/
1703 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_string); /* proto*/
1704 static void *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_get_dd_origin_ref(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_dd_origin); /* proto*/
1705 static int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_span, void *__pyx_v_dd_origin); /* proto*/
1706 
1707 /* Module declarations from 'cpython.version' */
1708 
1709 /* Module declarations from '__builtin__' */
1710 
1711 /* Module declarations from 'cpython.type' */
1712 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1713 
1714 /* Module declarations from 'libc.string' */
1715 
1716 /* Module declarations from 'libc.stdio' */
1717 
1718 /* Module declarations from 'cpython.object' */
1719 
1720 /* Module declarations from 'cpython.ref' */
1721 
1722 /* Module declarations from 'cpython.exc' */
1723 
1724 /* Module declarations from 'cpython.module' */
1725 
1726 /* Module declarations from 'cpython.mem' */
1727 
1728 /* Module declarations from 'cpython.tuple' */
1729 
1730 /* Module declarations from 'cpython.list' */
1731 
1732 /* Module declarations from 'cpython.sequence' */
1733 
1734 /* Module declarations from 'cpython.mapping' */
1735 
1736 /* Module declarations from 'cpython.iterator' */
1737 
1738 /* Module declarations from 'cpython.number' */
1739 
1740 /* Module declarations from 'cpython.int' */
1741 
1742 /* Module declarations from '__builtin__' */
1743 
1744 /* Module declarations from 'cpython.bool' */
1745 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1746 
1747 /* Module declarations from 'cpython.long' */
1748 
1749 /* Module declarations from 'cpython.float' */
1750 
1751 /* Module declarations from '__builtin__' */
1752 
1753 /* Module declarations from 'cpython.complex' */
1754 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1755 
1756 /* Module declarations from 'cpython.string' */
1757 
1758 /* Module declarations from 'cpython.unicode' */
1759 
1760 /* Module declarations from 'cpython.dict' */
1761 
1762 /* Module declarations from 'cpython.instance' */
1763 
1764 /* Module declarations from 'cpython.function' */
1765 
1766 /* Module declarations from 'cpython.method' */
1767 
1768 /* Module declarations from 'cpython.weakref' */
1769 
1770 /* Module declarations from 'cpython.getargs' */
1771 
1772 /* Module declarations from 'cpython.pythread' */
1773 
1774 /* Module declarations from 'cpython.pystate' */
1775 
1776 /* Module declarations from 'cpython.cobject' */
1777 
1778 /* Module declarations from 'cpython.oldbuffer' */
1779 
1780 /* Module declarations from 'cpython.set' */
1781 
1782 /* Module declarations from 'cpython.buffer' */
1783 
1784 /* Module declarations from 'cpython.bytes' */
1785 
1786 /* Module declarations from 'cpython.pycapsule' */
1787 
1788 /* Module declarations from 'cpython' */
1789 
1790 /* Module declarations from 'cpython.bytearray' */
1791 
1792 /* Module declarations from 'libc' */
1793 
1794 /* Module declarations from 'libc.stdint' */
1795 
1796 /* Module declarations from 'ddtrace.internal._utils' */
1797 
1798 /* Module declarations from 'ddtrace.internal._encoding' */
1799 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_StringTable = 0;
1800 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable = 0;
1801 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable = 0;
1802 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder = 0;
1803 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_ListBufferedEncoder = 0;
1804 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase = 0;
1805 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 = 0;
1806 static PyTypeObject *__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 = 0;
1807 static PY_LONG_LONG __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT;
1808 static char const *__pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY;
1809 static size_t __pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY_LEN;
1810 static CYTHON_INLINE char const *__pyx_f_7ddtrace_8internal_9_encoding_string_to_buff(PyObject *); /*proto*/
1811 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(uint32_t); /*proto*/
1812 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes(struct msgpack_packer *, char *, Py_ssize_t); /*proto*/
1813 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_number(struct msgpack_packer *, PyObject *); /*proto*/
1814 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_text(struct msgpack_packer *, PyObject *); /*proto*/
1815 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *); /*proto*/
1816 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_ListStringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *, PyObject *); /*proto*/
1817 #define __Pyx_MODULE_NAME "ddtrace.internal._encoding"
1818 extern int __pyx_module_is_main_ddtrace__internal___encoding;
1819 int __pyx_module_is_main_ddtrace__internal___encoding = 0;
1820 
1821 /* Implementation of 'ddtrace.internal._encoding' */
1822 static PyObject *__pyx_builtin_OverflowError;
1823 static PyObject *__pyx_builtin_TypeError;
1824 static PyObject *__pyx_builtin_ValueError;
1825 static PyObject *__pyx_builtin_super;
1826 static PyObject *__pyx_builtin_MemoryError;
1827 static PyObject *__pyx_builtin_RuntimeError;
1828 static PyObject *__pyx_builtin_NotImplementedError;
1829 static const char __pyx_k__3[] = "";
1830 static const char __pyx_k_doc[] = "__doc__";
1831 static const char __pyx_k_get[] = "get";
1832 static const char __pyx_k_new[] = "__new__";
1833 static const char __pyx_k_put[] = "put";
1834 static const char __pyx_k_raw[] = "raw";
1835 static const char __pyx_k_Lock[] = "Lock";
1836 static const char __pyx_k_dict[] = "__dict__";
1837 static const char __pyx_k_exit[] = "__exit__";
1838 static const char __pyx_k_init[] = "__init__";
1839 static const char __pyx_k_main[] = "__main__";
1840 static const char __pyx_k_meta[] = "meta";
1841 static const char __pyx_k_name[] = "name";
1842 static const char __pyx_k_size[] = "size";
1843 static const char __pyx_k_test[] = "__test__";
1844 static const char __pyx_k_RLock[] = "RLock";
1845 static const char __pyx_k_enter[] = "__enter__";
1846 static const char __pyx_k_error[] = "error";
1847 static const char __pyx_k_flush[] = "flush";
1848 static const char __pyx_k_index[] = "index";
1849 static const char __pyx_k_items[] = "items";
1850 static const char __pyx_k_super[] = "super";
1851 static const char __pyx_k_decode[] = "_decode";
1852 static const char __pyx_k_encode[] = "encode";
1853 static const char __pyx_k_import[] = "__import__";
1854 static const char __pyx_k_module[] = "__module__";
1855 static const char __pyx_k_name_2[] = "__name__";
1856 static const char __pyx_k_pickle[] = "pickle";
1857 static const char __pyx_k_reduce[] = "__reduce__";
1858 static const char __pyx_k_update[] = "update";
1859 static const char __pyx_k_context[] = "context";
1860 static const char __pyx_k_metrics[] = "metrics";
1861 static const char __pyx_k_msgpack[] = "msgpack";
1862 static const char __pyx_k_prepare[] = "__prepare__";
1863 static const char __pyx_k_service[] = "service";
1864 static const char __pyx_k_span_id[] = "span_id";
1865 static const char __pyx_k_unpackb[] = "unpackb";
1866 static const char __pyx_k_version[] = "version";
1867 static const char __pyx_k_getstate[] = "__getstate__";
1868 static const char __pyx_k_max_size[] = "max_size";
1869 static const char __pyx_k_pyx_type[] = "__pyx_type";
1870 static const char __pyx_k_qualname[] = "__qualname__";
1871 static const char __pyx_k_resource[] = "resource";
1872 static const char __pyx_k_setstate[] = "__setstate__";
1873 static const char __pyx_k_start_ns[] = "start_ns";
1874 static const char __pyx_k_trace_id[] = "trace_id";
1875 static const char __pyx_k_TypeError[] = "TypeError";
1876 static const char __pyx_k_dd_origin[] = "dd_origin";
1877 static const char __pyx_k_metaclass[] = "__metaclass__";
1878 static const char __pyx_k_parent_id[] = "parent_id";
1879 static const char __pyx_k_pyx_state[] = "__pyx_state";
1880 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1881 static const char __pyx_k_span_type[] = "span_type";
1882 static const char __pyx_k_threading[] = "threading";
1883 static const char __pyx_k_BufferFull[] = "BufferFull";
1884 static const char __pyx_k_ORIGIN_KEY[] = "ORIGIN_KEY";
1885 static const char __pyx_k_ValueError[] = "ValueError";
1886 static const char __pyx_k_pyx_result[] = "__pyx_result";
1887 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1888 static const char __pyx_k_MemoryError[] = "MemoryError";
1889 static const char __pyx_k_PickleError[] = "PickleError";
1890 static const char __pyx_k_StringTable[] = "StringTable";
1891 static const char __pyx_k_duration_ns[] = "duration_ns";
1892 static const char __pyx_k_encode_item[] = "encode_item";
1893 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1894 static const char __pyx_k_content_type[] = "content_type";
1895 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1896 static const char __pyx_k_stringsource[] = "stringsource";
1897 static const char __pyx_k_OverflowError[] = "OverflowError";
1898 static const char __pyx_k_max_item_size[] = "max_item_size";
1899 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1900 static const char __pyx_k_internal_error[] = "internal error";
1901 static const char __pyx_k_BufferedEncoder[] = "BufferedEncoder";
1902 static const char __pyx_k_ListStringTable[] = "ListStringTable";
1903 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1904 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1905 static const char __pyx_k_MsgpackEncoderV03[] = "MsgpackEncoderV03";
1906 static const char __pyx_k_MsgpackEncoderV05[] = "MsgpackEncoderV05";
1907 static const char __pyx_k_ddtrace_constants[] = "ddtrace.constants";
1908 static const char __pyx_k_dict_is_too_large[] = "dict is too large";
1909 static const char __pyx_k_list_is_too_large[] = "list is too large";
1910 static const char __pyx_k_BufferItemTooLarge[] = "BufferItemTooLarge";
1911 static const char __pyx_k_Couldn_t_pack_span[] = "Couldn't pack span";
1912 static const char __pyx_k_MsgpackEncoderBase[] = "MsgpackEncoderBase";
1913 static const char __pyx_k_MsgpackStringTable[] = "MsgpackStringTable";
1914 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1915 static const char __pyx_k_Couldn_t_pack_trace[] = "Couldn't pack trace";
1916 static const char __pyx_k_ListBufferedEncoder[] = "ListBufferedEncoder";
1917 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1918 static const char __pyx_k_application_msgpack[] = "application/msgpack";
1919 static const char __pyx_k_Unhandled_meta_type_r[] = "Unhandled meta type: %r";
1920 static const char __pyx_k_Unhandled_text_type_r[] = "Unhandled text type: %r";
1921 static const char __pyx_k_Unhandled_metrics_type_r[] = "Unhandled metrics type: %r";
1922 static const char __pyx_k_Unhandled_numeric_type_r[] = "Unhandled numeric type: %r";
1923 static const char __pyx_k_pyx_unpickle_StringTable[] = "__pyx_unpickle_StringTable";
1924 static const char __pyx_k_Integer_value_out_of_range[] = "Integer value out of range";
1925 static const char __pyx_k_ddtrace_internal__encoding[] = "ddtrace.internal._encoding";
1926 static const char __pyx_k_unicode_string_is_too_large[] = "unicode string is too large";
1927 static const char __pyx_k_pyx_unpickle_ListStringTable[] = "__pyx_unpickle_ListStringTable";
1928 static const char __pyx_k_Cannot_insert_s_string_table_is[] = "Cannot insert '%s': string table is full (current size: %d, max size: %d).";
1929 static const char __pyx_k_Failed_to_add_string_to_msgpack[] = "Failed to add string to msgpack string table";
1930 static const char __pyx_k_Pickling_of_struct_members_such[] = "Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)";
1931 static const char __pyx_k_Failed_to_append_raw_bytes_to_ms[] = "Failed to append raw bytes to msgpack string table";
1932 static const char __pyx_k_Incompatible_checksums_s_vs_0xae[] = "Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))";
1933 static const char __pyx_k_Incompatible_checksums_s_vs_0xb9[] = "Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))";
1934 static const char __pyx_k_Unable_to_allocate_internal_buff[] = "Unable to allocate internal buffer.";
1935 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1936 static PyObject *__pyx_n_s_BufferFull;
1937 static PyObject *__pyx_n_s_BufferItemTooLarge;
1938 static PyObject *__pyx_n_s_BufferedEncoder;
1939 static PyObject *__pyx_kp_s_Cannot_insert_s_string_table_is;
1940 static PyObject *__pyx_kp_s_Couldn_t_pack_span;
1941 static PyObject *__pyx_kp_s_Couldn_t_pack_trace;
1942 static PyObject *__pyx_kp_s_Failed_to_add_string_to_msgpack;
1943 static PyObject *__pyx_kp_s_Failed_to_append_raw_bytes_to_ms;
1944 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xae;
1945 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb9;
1946 static PyObject *__pyx_kp_s_Integer_value_out_of_range;
1947 static PyObject *__pyx_n_s_ListBufferedEncoder;
1948 static PyObject *__pyx_n_s_ListStringTable;
1949 static PyObject *__pyx_n_s_Lock;
1950 static PyObject *__pyx_n_s_MemoryError;
1951 static PyObject *__pyx_n_s_MsgpackEncoderBase;
1952 static PyObject *__pyx_n_s_MsgpackEncoderV03;
1953 static PyObject *__pyx_n_s_MsgpackEncoderV05;
1954 static PyObject *__pyx_n_s_MsgpackStringTable;
1955 static PyObject *__pyx_n_s_NotImplementedError;
1956 static PyObject *__pyx_n_s_ORIGIN_KEY;
1957 static PyObject *__pyx_n_s_OverflowError;
1958 static PyObject *__pyx_n_s_PickleError;
1959 static PyObject *__pyx_kp_s_Pickling_of_struct_members_such;
1960 static PyObject *__pyx_n_s_RLock;
1961 static PyObject *__pyx_n_s_RuntimeError;
1962 static PyObject *__pyx_n_s_StringTable;
1963 static PyObject *__pyx_n_s_TypeError;
1964 static PyObject *__pyx_kp_s_Unable_to_allocate_internal_buff;
1965 static PyObject *__pyx_kp_s_Unhandled_meta_type_r;
1966 static PyObject *__pyx_kp_s_Unhandled_metrics_type_r;
1967 static PyObject *__pyx_kp_s_Unhandled_numeric_type_r;
1968 static PyObject *__pyx_kp_s_Unhandled_text_type_r;
1969 static PyObject *__pyx_n_s_ValueError;
1970 static PyObject *__pyx_kp_s__3;
1971 static PyObject *__pyx_kp_s_application_msgpack;
1972 static PyObject *__pyx_n_s_cline_in_traceback;
1973 static PyObject *__pyx_n_s_content_type;
1974 static PyObject *__pyx_n_s_context;
1975 static PyObject *__pyx_n_s_dd_origin;
1976 static PyObject *__pyx_n_s_ddtrace_constants;
1977 static PyObject *__pyx_n_s_ddtrace_internal__encoding;
1978 static PyObject *__pyx_n_s_decode;
1979 static PyObject *__pyx_n_s_dict;
1980 static PyObject *__pyx_kp_s_dict_is_too_large;
1981 static PyObject *__pyx_n_s_doc;
1982 static PyObject *__pyx_n_s_duration_ns;
1983 static PyObject *__pyx_n_s_encode;
1984 static PyObject *__pyx_n_s_encode_item;
1985 static PyObject *__pyx_n_s_enter;
1986 static PyObject *__pyx_n_s_error;
1987 static PyObject *__pyx_n_s_exit;
1988 static PyObject *__pyx_n_s_flush;
1989 static PyObject *__pyx_n_s_get;
1990 static PyObject *__pyx_n_s_getstate;
1991 static PyObject *__pyx_n_s_import;
1992 static PyObject *__pyx_n_s_index;
1993 static PyObject *__pyx_n_s_init;
1994 static PyObject *__pyx_kp_s_internal_error;
1995 static PyObject *__pyx_n_s_items;
1996 static PyObject *__pyx_kp_s_list_is_too_large;
1997 static PyObject *__pyx_n_s_main;
1998 static PyObject *__pyx_n_s_max_item_size;
1999 static PyObject *__pyx_n_s_max_size;
2000 static PyObject *__pyx_n_s_meta;
2001 static PyObject *__pyx_n_s_metaclass;
2002 static PyObject *__pyx_n_s_metrics;
2003 static PyObject *__pyx_n_s_module;
2004 static PyObject *__pyx_n_s_msgpack;
2005 static PyObject *__pyx_n_s_name;
2006 static PyObject *__pyx_n_s_name_2;
2007 static PyObject *__pyx_n_s_new;
2008 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2009 static PyObject *__pyx_n_s_parent_id;
2010 static PyObject *__pyx_n_s_pickle;
2011 static PyObject *__pyx_n_s_prepare;
2012 static PyObject *__pyx_n_s_put;
2013 static PyObject *__pyx_n_s_pyx_PickleError;
2014 static PyObject *__pyx_n_s_pyx_checksum;
2015 static PyObject *__pyx_n_s_pyx_result;
2016 static PyObject *__pyx_n_s_pyx_state;
2017 static PyObject *__pyx_n_s_pyx_type;
2018 static PyObject *__pyx_n_s_pyx_unpickle_ListStringTable;
2019 static PyObject *__pyx_n_s_pyx_unpickle_StringTable;
2020 static PyObject *__pyx_n_s_pyx_vtable;
2021 static PyObject *__pyx_n_s_qualname;
2022 static PyObject *__pyx_n_s_raw;
2023 static PyObject *__pyx_n_s_reduce;
2024 static PyObject *__pyx_n_s_reduce_cython;
2025 static PyObject *__pyx_n_s_reduce_ex;
2026 static PyObject *__pyx_n_s_resource;
2027 static PyObject *__pyx_n_s_service;
2028 static PyObject *__pyx_n_s_setstate;
2029 static PyObject *__pyx_n_s_setstate_cython;
2030 static PyObject *__pyx_n_s_size;
2031 static PyObject *__pyx_n_s_span_id;
2032 static PyObject *__pyx_n_s_span_type;
2033 static PyObject *__pyx_n_s_start_ns;
2034 static PyObject *__pyx_kp_s_stringsource;
2035 static PyObject *__pyx_n_s_super;
2036 static PyObject *__pyx_n_s_test;
2037 static PyObject *__pyx_n_s_threading;
2038 static PyObject *__pyx_n_s_trace_id;
2039 static PyObject *__pyx_kp_s_unicode_string_is_too_large;
2040 static PyObject *__pyx_n_s_unpackb;
2041 static PyObject *__pyx_n_s_update;
2042 static PyObject *__pyx_n_s_version;
2043 static int __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self); /* proto */
2044 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_2index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string); /* proto */
2045 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self); /* proto */
2046 static int __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_6__contains__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string); /* proto */
2047 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_8__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self); /* proto */
2048 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_10__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2049 static int __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self); /* proto */
2050 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_2__iter__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self); /* proto */
2051 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_4__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self); /* proto */
2052 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_6__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2053 static int __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, PyObject *__pyx_v_max_size); /* proto */
2054 static void __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto */
2055 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto */
2056 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto */
2057 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self); /* proto */
2058 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2059 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, size_t __pyx_v_max_size, size_t __pyx_v_max_item_size); /* proto */
2060 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_2put(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_item); /* proto */
2061 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_4encode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self); /* proto */
2062 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self); /* proto */
2063 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2064 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self); /* proto */
2065 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2066 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self); /* proto */
2067 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2068 static int __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED size_t __pyx_v_max_size, CYTHON_UNUSED size_t __pyx_v_max_item_size); /* proto */
2069 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_2__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self); /* proto */
2070 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self); /* proto */
2071 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2072 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self); /* proto */
2073 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_8encode_item(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_item); /* proto */
2074 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self); /* proto */
2075 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2076 static int __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, size_t __pyx_v_max_size, size_t __pyx_v_max_item_size); /* proto */
2077 static void __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2078 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2079 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_6_decode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
2080 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_8encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2081 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace); /* proto */
2082 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2083 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_12flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2084 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self); /* proto */
2085 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2086 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self); /* proto */
2087 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self); /* proto */
2088 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2089 static int __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, size_t __pyx_v_max_size, CYTHON_UNUSED size_t __pyx_v_max_item_size); /* proto */
2090 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_2flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self); /* proto */
2091 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self); /* proto */
2092 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_trace); /* proto */
2093 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self); /* proto */
2094 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2095 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2096 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_2__pyx_unpickle_ListStringTable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2097 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2098 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_ListStringTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2099 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2100 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2101 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2102 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2103 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV03(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2104 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2105 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
2106 static PyObject *__pyx_int_0;
2107 static PyObject *__pyx_int_1;
2108 static PyObject *__pyx_int_2;
2109 static PyObject *__pyx_int_6;
2110 static PyObject *__pyx_int_182609841;
2111 static PyObject *__pyx_int_194841817;
2112 static PyObject *__pyx_tuple_;
2113 static PyObject *__pyx_tuple__2;
2114 static PyObject *__pyx_tuple__4;
2115 static PyObject *__pyx_tuple__5;
2116 static PyObject *__pyx_tuple__6;
2117 static PyObject *__pyx_tuple__7;
2118 static PyObject *__pyx_tuple__8;
2119 static PyObject *__pyx_tuple__9;
2120 static PyObject *__pyx_slice__14;
2121 static PyObject *__pyx_tuple__10;
2122 static PyObject *__pyx_tuple__11;
2123 static PyObject *__pyx_tuple__12;
2124 static PyObject *__pyx_tuple__13;
2125 static PyObject *__pyx_tuple__15;
2126 static PyObject *__pyx_tuple__16;
2127 static PyObject *__pyx_tuple__17;
2128 static PyObject *__pyx_tuple__18;
2129 static PyObject *__pyx_tuple__19;
2130 static PyObject *__pyx_tuple__20;
2131 static PyObject *__pyx_tuple__21;
2132 static PyObject *__pyx_tuple__22;
2133 static PyObject *__pyx_tuple__23;
2134 static PyObject *__pyx_tuple__24;
2135 static PyObject *__pyx_tuple__25;
2136 static PyObject *__pyx_tuple__26;
2137 static PyObject *__pyx_tuple__27;
2138 static PyObject *__pyx_tuple__29;
2139 static PyObject *__pyx_codeobj__28;
2140 static PyObject *__pyx_codeobj__30;
2141 /* Late includes */
2142 
2143 /* "ddtrace/internal/_encoding.pyx":51
2144  *
2145  *
2146  * cdef inline const char * string_to_buff(str s):             # <<<<<<<<<<<<<<
2147  *     IF PY_MAJOR_VERSION >= 3:
2148  *         return PyUnicode_AsUTF8(s)
2149  */
2150 
__pyx_f_7ddtrace_8internal_9_encoding_string_to_buff(PyObject * __pyx_v_s)2151 static CYTHON_INLINE char const *__pyx_f_7ddtrace_8internal_9_encoding_string_to_buff(PyObject *__pyx_v_s) {
2152   char const *__pyx_r;
2153   __Pyx_RefNannyDeclarations
2154   __Pyx_RefNannySetupContext("string_to_buff", 0);
2155 
2156   /* "ddtrace/internal/_encoding.pyx":53
2157  * cdef inline const char * string_to_buff(str s):
2158  *     IF PY_MAJOR_VERSION >= 3:
2159  *         return PyUnicode_AsUTF8(s)             # <<<<<<<<<<<<<<
2160  *     ELSE:
2161  *         return <const char *> s
2162  */
2163   __pyx_r = PyUnicode_AsUTF8(__pyx_v_s);
2164   goto __pyx_L0;
2165 
2166   /* "ddtrace/internal/_encoding.pyx":51
2167  *
2168  *
2169  * cdef inline const char * string_to_buff(str s):             # <<<<<<<<<<<<<<
2170  *     IF PY_MAJOR_VERSION >= 3:
2171  *         return PyUnicode_AsUTF8(s)
2172  */
2173 
2174   /* function exit code */
2175   __pyx_L0:;
2176   __Pyx_RefNannyFinishContext();
2177   return __pyx_r;
2178 }
2179 
2180 /* "ddtrace/internal/_encoding.pyx":64
2181  *
2182  *
2183  * cdef inline int array_prefix_size(stdint.uint32_t l):             # <<<<<<<<<<<<<<
2184  *     if l < 16:
2185  *         return 1
2186  */
2187 
__pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(uint32_t __pyx_v_l)2188 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(uint32_t __pyx_v_l) {
2189   int __pyx_r;
2190   __Pyx_RefNannyDeclarations
2191   int __pyx_t_1;
2192   __Pyx_RefNannySetupContext("array_prefix_size", 0);
2193 
2194   /* "ddtrace/internal/_encoding.pyx":65
2195  *
2196  * cdef inline int array_prefix_size(stdint.uint32_t l):
2197  *     if l < 16:             # <<<<<<<<<<<<<<
2198  *         return 1
2199  *     elif l < (2<<16):
2200  */
2201   __pyx_t_1 = ((__pyx_v_l < 16) != 0);
2202   if (__pyx_t_1) {
2203 
2204     /* "ddtrace/internal/_encoding.pyx":66
2205  * cdef inline int array_prefix_size(stdint.uint32_t l):
2206  *     if l < 16:
2207  *         return 1             # <<<<<<<<<<<<<<
2208  *     elif l < (2<<16):
2209  *         return 3
2210  */
2211     __pyx_r = 1;
2212     goto __pyx_L0;
2213 
2214     /* "ddtrace/internal/_encoding.pyx":65
2215  *
2216  * cdef inline int array_prefix_size(stdint.uint32_t l):
2217  *     if l < 16:             # <<<<<<<<<<<<<<
2218  *         return 1
2219  *     elif l < (2<<16):
2220  */
2221   }
2222 
2223   /* "ddtrace/internal/_encoding.pyx":67
2224  *     if l < 16:
2225  *         return 1
2226  *     elif l < (2<<16):             # <<<<<<<<<<<<<<
2227  *         return 3
2228  *     return MSGPACK_ARRAY_LENGTH_PREFIX_SIZE
2229  */
2230   __pyx_t_1 = ((__pyx_v_l < 0x20000) != 0);
2231   if (__pyx_t_1) {
2232 
2233     /* "ddtrace/internal/_encoding.pyx":68
2234  *         return 1
2235  *     elif l < (2<<16):
2236  *         return 3             # <<<<<<<<<<<<<<
2237  *     return MSGPACK_ARRAY_LENGTH_PREFIX_SIZE
2238  *
2239  */
2240     __pyx_r = 3;
2241     goto __pyx_L0;
2242 
2243     /* "ddtrace/internal/_encoding.pyx":67
2244  *     if l < 16:
2245  *         return 1
2246  *     elif l < (2<<16):             # <<<<<<<<<<<<<<
2247  *         return 3
2248  *     return MSGPACK_ARRAY_LENGTH_PREFIX_SIZE
2249  */
2250   }
2251 
2252   /* "ddtrace/internal/_encoding.pyx":69
2253  *     elif l < (2<<16):
2254  *         return 3
2255  *     return MSGPACK_ARRAY_LENGTH_PREFIX_SIZE             # <<<<<<<<<<<<<<
2256  *
2257  *
2258  */
2259   __pyx_r = 5;
2260   goto __pyx_L0;
2261 
2262   /* "ddtrace/internal/_encoding.pyx":64
2263  *
2264  *
2265  * cdef inline int array_prefix_size(stdint.uint32_t l):             # <<<<<<<<<<<<<<
2266  *     if l < 16:
2267  *         return 1
2268  */
2269 
2270   /* function exit code */
2271   __pyx_L0:;
2272   __Pyx_RefNannyFinishContext();
2273   return __pyx_r;
2274 }
2275 
2276 /* "ddtrace/internal/_encoding.pyx":72
2277  *
2278  *
2279  * cdef inline int pack_bytes(msgpack_packer *pk, char *bs, Py_ssize_t l):             # <<<<<<<<<<<<<<
2280  *     cdef int ret
2281  *
2282  */
2283 
__pyx_f_7ddtrace_8internal_9_encoding_pack_bytes(struct msgpack_packer * __pyx_v_pk,char * __pyx_v_bs,Py_ssize_t __pyx_v_l)2284 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes(struct msgpack_packer *__pyx_v_pk, char *__pyx_v_bs, Py_ssize_t __pyx_v_l) {
2285   int __pyx_v_ret;
2286   int __pyx_r;
2287   __Pyx_RefNannyDeclarations
2288   int __pyx_t_1;
2289   __Pyx_RefNannySetupContext("pack_bytes", 0);
2290 
2291   /* "ddtrace/internal/_encoding.pyx":75
2292  *     cdef int ret
2293  *
2294  *     ret = msgpack_pack_raw(pk, l)             # <<<<<<<<<<<<<<
2295  *     if ret == 0:
2296  *         ret = msgpack_pack_raw_body(pk, bs, l)
2297  */
2298   __pyx_v_ret = msgpack_pack_raw(__pyx_v_pk, __pyx_v_l);
2299 
2300   /* "ddtrace/internal/_encoding.pyx":76
2301  *
2302  *     ret = msgpack_pack_raw(pk, l)
2303  *     if ret == 0:             # <<<<<<<<<<<<<<
2304  *         ret = msgpack_pack_raw_body(pk, bs, l)
2305  *     return ret
2306  */
2307   __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
2308   if (__pyx_t_1) {
2309 
2310     /* "ddtrace/internal/_encoding.pyx":77
2311  *     ret = msgpack_pack_raw(pk, l)
2312  *     if ret == 0:
2313  *         ret = msgpack_pack_raw_body(pk, bs, l)             # <<<<<<<<<<<<<<
2314  *     return ret
2315  *
2316  */
2317     __pyx_v_ret = msgpack_pack_raw_body(__pyx_v_pk, __pyx_v_bs, __pyx_v_l);
2318 
2319     /* "ddtrace/internal/_encoding.pyx":76
2320  *
2321  *     ret = msgpack_pack_raw(pk, l)
2322  *     if ret == 0:             # <<<<<<<<<<<<<<
2323  *         ret = msgpack_pack_raw_body(pk, bs, l)
2324  *     return ret
2325  */
2326   }
2327 
2328   /* "ddtrace/internal/_encoding.pyx":78
2329  *     if ret == 0:
2330  *         ret = msgpack_pack_raw_body(pk, bs, l)
2331  *     return ret             # <<<<<<<<<<<<<<
2332  *
2333  *
2334  */
2335   __pyx_r = __pyx_v_ret;
2336   goto __pyx_L0;
2337 
2338   /* "ddtrace/internal/_encoding.pyx":72
2339  *
2340  *
2341  * cdef inline int pack_bytes(msgpack_packer *pk, char *bs, Py_ssize_t l):             # <<<<<<<<<<<<<<
2342  *     cdef int ret
2343  *
2344  */
2345 
2346   /* function exit code */
2347   __pyx_L0:;
2348   __Pyx_RefNannyFinishContext();
2349   return __pyx_r;
2350 }
2351 
2352 /* "ddtrace/internal/_encoding.pyx":81
2353  *
2354  *
2355  * cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:             # <<<<<<<<<<<<<<
2356  *     if n is None:
2357  *         return msgpack_pack_nil(pk)
2358  */
2359 
__pyx_f_7ddtrace_8internal_9_encoding_pack_number(struct msgpack_packer * __pyx_v_pk,PyObject * __pyx_v_n)2360 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_number(struct msgpack_packer *__pyx_v_pk, PyObject *__pyx_v_n) {
2361   CYTHON_UNUSED PyObject *__pyx_v_oe = NULL;
2362   int __pyx_r;
2363   __Pyx_RefNannyDeclarations
2364   int __pyx_t_1;
2365   int __pyx_t_2;
2366   PyObject *__pyx_t_3 = NULL;
2367   PyObject *__pyx_t_4 = NULL;
2368   PyObject *__pyx_t_5 = NULL;
2369   PyObject *__pyx_t_6 = NULL;
2370   unsigned PY_LONG_LONG __pyx_t_7;
2371   PY_LONG_LONG __pyx_t_8;
2372   int __pyx_t_9;
2373   PyObject *__pyx_t_10 = NULL;
2374   PyObject *__pyx_t_11 = NULL;
2375   PyObject *__pyx_t_12 = NULL;
2376   long __pyx_t_13;
2377   double __pyx_t_14;
2378   int __pyx_lineno = 0;
2379   const char *__pyx_filename = NULL;
2380   int __pyx_clineno = 0;
2381   __Pyx_RefNannySetupContext("pack_number", 0);
2382 
2383   /* "ddtrace/internal/_encoding.pyx":82
2384  *
2385  * cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:
2386  *     if n is None:             # <<<<<<<<<<<<<<
2387  *         return msgpack_pack_nil(pk)
2388  *
2389  */
2390   __pyx_t_1 = (__pyx_v_n == Py_None);
2391   __pyx_t_2 = (__pyx_t_1 != 0);
2392   if (__pyx_t_2) {
2393 
2394     /* "ddtrace/internal/_encoding.pyx":83
2395  * cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:
2396  *     if n is None:
2397  *         return msgpack_pack_nil(pk)             # <<<<<<<<<<<<<<
2398  *
2399  *     if PyLong_Check(n):
2400  */
2401     __pyx_r = msgpack_pack_nil(__pyx_v_pk);
2402     goto __pyx_L0;
2403 
2404     /* "ddtrace/internal/_encoding.pyx":82
2405  *
2406  * cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:
2407  *     if n is None:             # <<<<<<<<<<<<<<
2408  *         return msgpack_pack_nil(pk)
2409  *
2410  */
2411   }
2412 
2413   /* "ddtrace/internal/_encoding.pyx":85
2414  *         return msgpack_pack_nil(pk)
2415  *
2416  *     if PyLong_Check(n):             # <<<<<<<<<<<<<<
2417  *         # PyInt_Check(long) is True for Python 3.
2418  *         # So we should test long before int.
2419  */
2420   __pyx_t_2 = (PyLong_Check(__pyx_v_n) != 0);
2421   if (__pyx_t_2) {
2422 
2423     /* "ddtrace/internal/_encoding.pyx":88
2424  *         # PyInt_Check(long) is True for Python 3.
2425  *         # So we should test long before int.
2426  *         try:             # <<<<<<<<<<<<<<
2427  *             if n > 0:
2428  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2429  */
2430     {
2431       __Pyx_PyThreadState_declare
2432       __Pyx_PyThreadState_assign
2433       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
2434       __Pyx_XGOTREF(__pyx_t_3);
2435       __Pyx_XGOTREF(__pyx_t_4);
2436       __Pyx_XGOTREF(__pyx_t_5);
2437       /*try:*/ {
2438 
2439         /* "ddtrace/internal/_encoding.pyx":89
2440  *         # So we should test long before int.
2441  *         try:
2442  *             if n > 0:             # <<<<<<<<<<<<<<
2443  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2444  *             return msgpack_pack_long_long(pk, <long long> n)
2445  */
2446         __pyx_t_6 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L5_error)
2447         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 89, __pyx_L5_error)
2448         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2449         if (__pyx_t_2) {
2450 
2451           /* "ddtrace/internal/_encoding.pyx":90
2452  *         try:
2453  *             if n > 0:
2454  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)             # <<<<<<<<<<<<<<
2455  *             return msgpack_pack_long_long(pk, <long long> n)
2456  *         except OverflowError as oe:
2457  */
2458           __pyx_t_7 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_v_n); if (unlikely((__pyx_t_7 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L5_error)
2459           __pyx_r = msgpack_pack_unsigned_long_long(__pyx_v_pk, ((unsigned PY_LONG_LONG)__pyx_t_7));
2460           goto __pyx_L9_try_return;
2461 
2462           /* "ddtrace/internal/_encoding.pyx":89
2463  *         # So we should test long before int.
2464  *         try:
2465  *             if n > 0:             # <<<<<<<<<<<<<<
2466  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2467  *             return msgpack_pack_long_long(pk, <long long> n)
2468  */
2469         }
2470 
2471         /* "ddtrace/internal/_encoding.pyx":91
2472  *             if n > 0:
2473  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2474  *             return msgpack_pack_long_long(pk, <long long> n)             # <<<<<<<<<<<<<<
2475  *         except OverflowError as oe:
2476  *             raise OverflowError("Integer value out of range")
2477  */
2478         __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_n); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L5_error)
2479         __pyx_r = msgpack_pack_long_long(__pyx_v_pk, ((PY_LONG_LONG)__pyx_t_8));
2480         goto __pyx_L9_try_return;
2481 
2482         /* "ddtrace/internal/_encoding.pyx":88
2483  *         # PyInt_Check(long) is True for Python 3.
2484  *         # So we should test long before int.
2485  *         try:             # <<<<<<<<<<<<<<
2486  *             if n > 0:
2487  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2488  */
2489       }
2490       __pyx_L5_error:;
2491       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2492 
2493       /* "ddtrace/internal/_encoding.pyx":92
2494  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2495  *             return msgpack_pack_long_long(pk, <long long> n)
2496  *         except OverflowError as oe:             # <<<<<<<<<<<<<<
2497  *             raise OverflowError("Integer value out of range")
2498  *
2499  */
2500       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
2501       if (__pyx_t_9) {
2502         __Pyx_AddTraceback("ddtrace.internal._encoding.pack_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
2503         if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 92, __pyx_L7_except_error)
2504         __Pyx_GOTREF(__pyx_t_6);
2505         __Pyx_GOTREF(__pyx_t_10);
2506         __Pyx_GOTREF(__pyx_t_11);
2507         __Pyx_INCREF(__pyx_t_10);
2508         __pyx_v_oe = __pyx_t_10;
2509 
2510         /* "ddtrace/internal/_encoding.pyx":93
2511  *             return msgpack_pack_long_long(pk, <long long> n)
2512  *         except OverflowError as oe:
2513  *             raise OverflowError("Integer value out of range")             # <<<<<<<<<<<<<<
2514  *
2515  *     if PyInt_Check(n):
2516  */
2517         __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_OverflowError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 93, __pyx_L7_except_error)
2518         __Pyx_GOTREF(__pyx_t_12);
2519         __Pyx_Raise(__pyx_t_12, 0, 0, 0);
2520         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
2521         __PYX_ERR(0, 93, __pyx_L7_except_error)
2522       }
2523       goto __pyx_L7_except_error;
2524       __pyx_L7_except_error:;
2525 
2526       /* "ddtrace/internal/_encoding.pyx":88
2527  *         # PyInt_Check(long) is True for Python 3.
2528  *         # So we should test long before int.
2529  *         try:             # <<<<<<<<<<<<<<
2530  *             if n > 0:
2531  *                 return msgpack_pack_unsigned_long_long(pk, <unsigned long long> n)
2532  */
2533       __Pyx_XGIVEREF(__pyx_t_3);
2534       __Pyx_XGIVEREF(__pyx_t_4);
2535       __Pyx_XGIVEREF(__pyx_t_5);
2536       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
2537       goto __pyx_L1_error;
2538       __pyx_L9_try_return:;
2539       __Pyx_XGIVEREF(__pyx_t_3);
2540       __Pyx_XGIVEREF(__pyx_t_4);
2541       __Pyx_XGIVEREF(__pyx_t_5);
2542       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
2543       goto __pyx_L0;
2544     }
2545 
2546     /* "ddtrace/internal/_encoding.pyx":85
2547  *         return msgpack_pack_nil(pk)
2548  *
2549  *     if PyLong_Check(n):             # <<<<<<<<<<<<<<
2550  *         # PyInt_Check(long) is True for Python 3.
2551  *         # So we should test long before int.
2552  */
2553   }
2554 
2555   /* "ddtrace/internal/_encoding.pyx":95
2556  *             raise OverflowError("Integer value out of range")
2557  *
2558  *     if PyInt_Check(n):             # <<<<<<<<<<<<<<
2559  *         return msgpack_pack_long(pk, <long> n)
2560  *
2561  */
2562   __pyx_t_2 = (PyInt_Check(__pyx_v_n) != 0);
2563   if (__pyx_t_2) {
2564 
2565     /* "ddtrace/internal/_encoding.pyx":96
2566  *
2567  *     if PyInt_Check(n):
2568  *         return msgpack_pack_long(pk, <long> n)             # <<<<<<<<<<<<<<
2569  *
2570  *     if PyFloat_Check(n):
2571  */
2572     __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_v_n); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
2573     __pyx_r = msgpack_pack_long(__pyx_v_pk, ((long)__pyx_t_13));
2574     goto __pyx_L0;
2575 
2576     /* "ddtrace/internal/_encoding.pyx":95
2577  *             raise OverflowError("Integer value out of range")
2578  *
2579  *     if PyInt_Check(n):             # <<<<<<<<<<<<<<
2580  *         return msgpack_pack_long(pk, <long> n)
2581  *
2582  */
2583   }
2584 
2585   /* "ddtrace/internal/_encoding.pyx":98
2586  *         return msgpack_pack_long(pk, <long> n)
2587  *
2588  *     if PyFloat_Check(n):             # <<<<<<<<<<<<<<
2589  *         return msgpack_pack_double(pk, <double> n)
2590  *
2591  */
2592   __pyx_t_2 = (PyFloat_Check(__pyx_v_n) != 0);
2593   if (__pyx_t_2) {
2594 
2595     /* "ddtrace/internal/_encoding.pyx":99
2596  *
2597  *     if PyFloat_Check(n):
2598  *         return msgpack_pack_double(pk, <double> n)             # <<<<<<<<<<<<<<
2599  *
2600  *     raise TypeError("Unhandled numeric type: %r" % type(n))
2601  */
2602     __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_n); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error)
2603     __pyx_r = msgpack_pack_double(__pyx_v_pk, ((double)__pyx_t_14));
2604     goto __pyx_L0;
2605 
2606     /* "ddtrace/internal/_encoding.pyx":98
2607  *         return msgpack_pack_long(pk, <long> n)
2608  *
2609  *     if PyFloat_Check(n):             # <<<<<<<<<<<<<<
2610  *         return msgpack_pack_double(pk, <double> n)
2611  *
2612  */
2613   }
2614 
2615   /* "ddtrace/internal/_encoding.pyx":101
2616  *         return msgpack_pack_double(pk, <double> n)
2617  *
2618  *     raise TypeError("Unhandled numeric type: %r" % type(n))             # <<<<<<<<<<<<<<
2619  *
2620  *
2621  */
2622   __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L1_error)
2623   __Pyx_GOTREF(__pyx_t_11);
2624   __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Unhandled_numeric_type_r, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error)
2625   __Pyx_GOTREF(__pyx_t_10);
2626   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2627   __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L1_error)
2628   __Pyx_GOTREF(__pyx_t_11);
2629   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2630   __Pyx_Raise(__pyx_t_11, 0, 0, 0);
2631   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2632   __PYX_ERR(0, 101, __pyx_L1_error)
2633 
2634   /* "ddtrace/internal/_encoding.pyx":81
2635  *
2636  *
2637  * cdef inline int pack_number(msgpack_packer *pk, object n) except? -1:             # <<<<<<<<<<<<<<
2638  *     if n is None:
2639  *         return msgpack_pack_nil(pk)
2640  */
2641 
2642   /* function exit code */
2643   __pyx_L1_error:;
2644   __Pyx_XDECREF(__pyx_t_6);
2645   __Pyx_XDECREF(__pyx_t_10);
2646   __Pyx_XDECREF(__pyx_t_11);
2647   __Pyx_XDECREF(__pyx_t_12);
2648   __Pyx_AddTraceback("ddtrace.internal._encoding.pack_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
2649   __pyx_r = -1;
2650   __pyx_L0:;
2651   __Pyx_XDECREF(__pyx_v_oe);
2652   __Pyx_RefNannyFinishContext();
2653   return __pyx_r;
2654 }
2655 
2656 /* "ddtrace/internal/_encoding.pyx":104
2657  *
2658  *
2659  * cdef inline int pack_text(msgpack_packer *pk, object text) except? -1:             # <<<<<<<<<<<<<<
2660  *     cdef Py_ssize_t L
2661  *     cdef int ret
2662  */
2663 
__pyx_f_7ddtrace_8internal_9_encoding_pack_text(struct msgpack_packer * __pyx_v_pk,PyObject * __pyx_v_text)2664 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_pack_text(struct msgpack_packer *__pyx_v_pk, PyObject *__pyx_v_text) {
2665   Py_ssize_t __pyx_v_L;
2666   int __pyx_v_ret;
2667   int __pyx_r;
2668   __Pyx_RefNannyDeclarations
2669   int __pyx_t_1;
2670   int __pyx_t_2;
2671   Py_ssize_t __pyx_t_3;
2672   PyObject *__pyx_t_4;
2673   char *__pyx_t_5;
2674   PyObject *__pyx_t_6 = NULL;
2675   PyObject *__pyx_t_7 = NULL;
2676   int __pyx_lineno = 0;
2677   const char *__pyx_filename = NULL;
2678   int __pyx_clineno = 0;
2679   __Pyx_RefNannySetupContext("pack_text", 0);
2680 
2681   /* "ddtrace/internal/_encoding.pyx":108
2682  *     cdef int ret
2683  *
2684  *     if text is None:             # <<<<<<<<<<<<<<
2685  *         return msgpack_pack_nil(pk)
2686  *
2687  */
2688   __pyx_t_1 = (__pyx_v_text == Py_None);
2689   __pyx_t_2 = (__pyx_t_1 != 0);
2690   if (__pyx_t_2) {
2691 
2692     /* "ddtrace/internal/_encoding.pyx":109
2693  *
2694  *     if text is None:
2695  *         return msgpack_pack_nil(pk)             # <<<<<<<<<<<<<<
2696  *
2697  *     if PyBytesLike_Check(text):
2698  */
2699     __pyx_r = msgpack_pack_nil(__pyx_v_pk);
2700     goto __pyx_L0;
2701 
2702     /* "ddtrace/internal/_encoding.pyx":108
2703  *     cdef int ret
2704  *
2705  *     if text is None:             # <<<<<<<<<<<<<<
2706  *         return msgpack_pack_nil(pk)
2707  *
2708  */
2709   }
2710 
2711   /* "ddtrace/internal/_encoding.pyx":111
2712  *         return msgpack_pack_nil(pk)
2713  *
2714  *     if PyBytesLike_Check(text):             # <<<<<<<<<<<<<<
2715  *         L = len(text)
2716  *         if L > ITEM_LIMIT:
2717  */
2718   __pyx_t_2 = (PyBytesLike_Check(__pyx_v_text) != 0);
2719   if (__pyx_t_2) {
2720 
2721     /* "ddtrace/internal/_encoding.pyx":112
2722  *
2723  *     if PyBytesLike_Check(text):
2724  *         L = len(text)             # <<<<<<<<<<<<<<
2725  *         if L > ITEM_LIMIT:
2726  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2727  */
2728     __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 112, __pyx_L1_error)
2729     __pyx_v_L = __pyx_t_3;
2730 
2731     /* "ddtrace/internal/_encoding.pyx":113
2732  *     if PyBytesLike_Check(text):
2733  *         L = len(text)
2734  *         if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
2735  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2736  *         ret = msgpack_pack_raw(pk, L)
2737  */
2738     __pyx_t_2 = ((__pyx_v_L > __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT) != 0);
2739     if (__pyx_t_2) {
2740 
2741       /* "ddtrace/internal/_encoding.pyx":114
2742  *         L = len(text)
2743  *         if L > ITEM_LIMIT:
2744  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)             # <<<<<<<<<<<<<<
2745  *         ret = msgpack_pack_raw(pk, L)
2746  *         if ret == 0:
2747  */
2748       __pyx_t_4 = PyErr_Format(__pyx_builtin_ValueError, ((char *)"%.200s object is too large"), Py_TYPE(__pyx_v_text)->tp_name); if (unlikely(__pyx_t_4 == ((PyObject *)NULL))) __PYX_ERR(0, 114, __pyx_L1_error)
2749 
2750       /* "ddtrace/internal/_encoding.pyx":113
2751  *     if PyBytesLike_Check(text):
2752  *         L = len(text)
2753  *         if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
2754  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2755  *         ret = msgpack_pack_raw(pk, L)
2756  */
2757     }
2758 
2759     /* "ddtrace/internal/_encoding.pyx":115
2760  *         if L > ITEM_LIMIT:
2761  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2762  *         ret = msgpack_pack_raw(pk, L)             # <<<<<<<<<<<<<<
2763  *         if ret == 0:
2764  *             ret = msgpack_pack_raw_body(pk, <char *> text, L)
2765  */
2766     __pyx_v_ret = msgpack_pack_raw(__pyx_v_pk, __pyx_v_L);
2767 
2768     /* "ddtrace/internal/_encoding.pyx":116
2769  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2770  *         ret = msgpack_pack_raw(pk, L)
2771  *         if ret == 0:             # <<<<<<<<<<<<<<
2772  *             ret = msgpack_pack_raw_body(pk, <char *> text, L)
2773  *         return ret
2774  */
2775     __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
2776     if (__pyx_t_2) {
2777 
2778       /* "ddtrace/internal/_encoding.pyx":117
2779  *         ret = msgpack_pack_raw(pk, L)
2780  *         if ret == 0:
2781  *             ret = msgpack_pack_raw_body(pk, <char *> text, L)             # <<<<<<<<<<<<<<
2782  *         return ret
2783  *
2784  */
2785       __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_text); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error)
2786       __pyx_v_ret = msgpack_pack_raw_body(__pyx_v_pk, ((char *)__pyx_t_5), __pyx_v_L);
2787 
2788       /* "ddtrace/internal/_encoding.pyx":116
2789  *             PyErr_Format(ValueError, b"%.200s object is too large", Py_TYPE(text).tp_name)
2790  *         ret = msgpack_pack_raw(pk, L)
2791  *         if ret == 0:             # <<<<<<<<<<<<<<
2792  *             ret = msgpack_pack_raw_body(pk, <char *> text, L)
2793  *         return ret
2794  */
2795     }
2796 
2797     /* "ddtrace/internal/_encoding.pyx":118
2798  *         if ret == 0:
2799  *             ret = msgpack_pack_raw_body(pk, <char *> text, L)
2800  *         return ret             # <<<<<<<<<<<<<<
2801  *
2802  *     if PyUnicode_Check(text):
2803  */
2804     __pyx_r = __pyx_v_ret;
2805     goto __pyx_L0;
2806 
2807     /* "ddtrace/internal/_encoding.pyx":111
2808  *         return msgpack_pack_nil(pk)
2809  *
2810  *     if PyBytesLike_Check(text):             # <<<<<<<<<<<<<<
2811  *         L = len(text)
2812  *         if L > ITEM_LIMIT:
2813  */
2814   }
2815 
2816   /* "ddtrace/internal/_encoding.pyx":120
2817  *         return ret
2818  *
2819  *     if PyUnicode_Check(text):             # <<<<<<<<<<<<<<
2820  *         IF PY_MAJOR_VERSION >= 3:
2821  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
2822  */
2823   __pyx_t_2 = (PyUnicode_Check(__pyx_v_text) != 0);
2824   if (__pyx_t_2) {
2825 
2826     /* "ddtrace/internal/_encoding.pyx":122
2827  *     if PyUnicode_Check(text):
2828  *         IF PY_MAJOR_VERSION >= 3:
2829  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)             # <<<<<<<<<<<<<<
2830  *             if ret == -2:
2831  *                 raise ValueError("unicode string is too large")
2832  */
2833     __pyx_v_ret = msgpack_pack_unicode(__pyx_v_pk, __pyx_v_text, __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT);
2834 
2835     /* "ddtrace/internal/_encoding.pyx":123
2836  *         IF PY_MAJOR_VERSION >= 3:
2837  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
2838  *             if ret == -2:             # <<<<<<<<<<<<<<
2839  *                 raise ValueError("unicode string is too large")
2840  *         ELSE:
2841  */
2842     __pyx_t_2 = ((__pyx_v_ret == -2L) != 0);
2843     if (unlikely(__pyx_t_2)) {
2844 
2845       /* "ddtrace/internal/_encoding.pyx":124
2846  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
2847  *             if ret == -2:
2848  *                 raise ValueError("unicode string is too large")             # <<<<<<<<<<<<<<
2849  *         ELSE:
2850  *             text = PyUnicode_AsEncodedString(text, "utf-8", NULL)
2851  */
2852       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
2853       __Pyx_GOTREF(__pyx_t_6);
2854       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
2855       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2856       __PYX_ERR(0, 124, __pyx_L1_error)
2857 
2858       /* "ddtrace/internal/_encoding.pyx":123
2859  *         IF PY_MAJOR_VERSION >= 3:
2860  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
2861  *             if ret == -2:             # <<<<<<<<<<<<<<
2862  *                 raise ValueError("unicode string is too large")
2863  *         ELSE:
2864  */
2865     }
2866 
2867     /* "ddtrace/internal/_encoding.pyx":133
2868  *             if ret == 0:
2869  *                 ret = msgpack_pack_raw_body(pk, <char *> text, L)
2870  *         return ret             # <<<<<<<<<<<<<<
2871  *
2872  *     raise TypeError("Unhandled text type: %r" % type(text))
2873  */
2874     __pyx_r = __pyx_v_ret;
2875     goto __pyx_L0;
2876 
2877     /* "ddtrace/internal/_encoding.pyx":120
2878  *         return ret
2879  *
2880  *     if PyUnicode_Check(text):             # <<<<<<<<<<<<<<
2881  *         IF PY_MAJOR_VERSION >= 3:
2882  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
2883  */
2884   }
2885 
2886   /* "ddtrace/internal/_encoding.pyx":135
2887  *         return ret
2888  *
2889  *     raise TypeError("Unhandled text type: %r" % type(text))             # <<<<<<<<<<<<<<
2890  *
2891  *
2892  */
2893   __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
2894   __Pyx_GOTREF(__pyx_t_6);
2895   __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Unhandled_text_type_r, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 135, __pyx_L1_error)
2896   __Pyx_GOTREF(__pyx_t_7);
2897   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2898   __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
2899   __Pyx_GOTREF(__pyx_t_6);
2900   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2901   __Pyx_Raise(__pyx_t_6, 0, 0, 0);
2902   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2903   __PYX_ERR(0, 135, __pyx_L1_error)
2904 
2905   /* "ddtrace/internal/_encoding.pyx":104
2906  *
2907  *
2908  * cdef inline int pack_text(msgpack_packer *pk, object text) except? -1:             # <<<<<<<<<<<<<<
2909  *     cdef Py_ssize_t L
2910  *     cdef int ret
2911  */
2912 
2913   /* function exit code */
2914   __pyx_L1_error:;
2915   __Pyx_XDECREF(__pyx_t_6);
2916   __Pyx_XDECREF(__pyx_t_7);
2917   __Pyx_AddTraceback("ddtrace.internal._encoding.pack_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
2918   __pyx_r = -1;
2919   __pyx_L0:;
2920   __Pyx_RefNannyFinishContext();
2921   return __pyx_r;
2922 }
2923 
2924 /* "ddtrace/internal/_encoding.pyx":142
2925  *     cdef stdint.uint32_t _next_id
2926  *
2927  *     def __init__(self):             # <<<<<<<<<<<<<<
2928  *         self._table = {"": 0}
2929  *         self.insert("")
2930  */
2931 
2932 /* Python wrapper */
2933 static int __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2934 static int __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2935   int __pyx_r;
2936   __Pyx_RefNannyDeclarations
2937   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2938   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
2939     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
2940   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
2941   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable___init__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self));
2942 
2943   /* function exit code */
2944   __Pyx_RefNannyFinishContext();
2945   return __pyx_r;
2946 }
2947 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self)2948 static int __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self) {
2949   int __pyx_r;
2950   __Pyx_RefNannyDeclarations
2951   PyObject *__pyx_t_1 = NULL;
2952   int __pyx_lineno = 0;
2953   const char *__pyx_filename = NULL;
2954   int __pyx_clineno = 0;
2955   __Pyx_RefNannySetupContext("__init__", 0);
2956 
2957   /* "ddtrace/internal/_encoding.pyx":143
2958  *
2959  *     def __init__(self):
2960  *         self._table = {"": 0}             # <<<<<<<<<<<<<<
2961  *         self.insert("")
2962  *         self._next_id = 1
2963  */
2964   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
2965   __Pyx_GOTREF(__pyx_t_1);
2966   if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__3, __pyx_int_0) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
2967   __Pyx_GIVEREF(__pyx_t_1);
2968   __Pyx_GOTREF(__pyx_v_self->_table);
2969   __Pyx_DECREF(__pyx_v_self->_table);
2970   __pyx_v_self->_table = ((PyObject*)__pyx_t_1);
2971   __pyx_t_1 = 0;
2972 
2973   /* "ddtrace/internal/_encoding.pyx":144
2974  *     def __init__(self):
2975  *         self._table = {"": 0}
2976  *         self.insert("")             # <<<<<<<<<<<<<<
2977  *         self._next_id = 1
2978  *
2979  */
2980   __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->__pyx_vtab)->insert(__pyx_v_self, __pyx_kp_s__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
2981   __Pyx_GOTREF(__pyx_t_1);
2982   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2983 
2984   /* "ddtrace/internal/_encoding.pyx":145
2985  *         self._table = {"": 0}
2986  *         self.insert("")
2987  *         self._next_id = 1             # <<<<<<<<<<<<<<
2988  *
2989  *     cdef insert(self, object string):
2990  */
2991   __pyx_v_self->_next_id = 1;
2992 
2993   /* "ddtrace/internal/_encoding.pyx":142
2994  *     cdef stdint.uint32_t _next_id
2995  *
2996  *     def __init__(self):             # <<<<<<<<<<<<<<
2997  *         self._table = {"": 0}
2998  *         self.insert("")
2999  */
3000 
3001   /* function exit code */
3002   __pyx_r = 0;
3003   goto __pyx_L0;
3004   __pyx_L1_error:;
3005   __Pyx_XDECREF(__pyx_t_1);
3006   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3007   __pyx_r = -1;
3008   __pyx_L0:;
3009   __Pyx_RefNannyFinishContext();
3010   return __pyx_r;
3011 }
3012 
3013 /* "ddtrace/internal/_encoding.pyx":147
3014  *         self._next_id = 1
3015  *
3016  *     cdef insert(self, object string):             # <<<<<<<<<<<<<<
3017  *         pass
3018  *
3019  */
3020 
__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_insert(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_string)3021 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_insert(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_string) {
3022   PyObject *__pyx_r = NULL;
3023   __Pyx_RefNannyDeclarations
3024   __Pyx_RefNannySetupContext("insert", 0);
3025 
3026   /* function exit code */
3027   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3028   __Pyx_XGIVEREF(__pyx_r);
3029   __Pyx_RefNannyFinishContext();
3030   return __pyx_r;
3031 }
3032 
3033 /* "ddtrace/internal/_encoding.pyx":150
3034  *         pass
3035  *
3036  *     cdef stdint.uint32_t _index(self, object string):             # <<<<<<<<<<<<<<
3037  *         cdef stdint.uint32_t _id
3038  *
3039  */
3040 
__pyx_f_7ddtrace_8internal_9_encoding_11StringTable__index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,PyObject * __pyx_v_string)3041 static uint32_t __pyx_f_7ddtrace_8internal_9_encoding_11StringTable__index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string) {
3042   uint32_t __pyx_v__id;
3043   uint32_t __pyx_r;
3044   __Pyx_RefNannyDeclarations
3045   int __pyx_t_1;
3046   int __pyx_t_2;
3047   PyObject *__pyx_t_3 = NULL;
3048   int __pyx_t_4;
3049   PyObject *__pyx_t_5;
3050   long __pyx_t_6;
3051   uint32_t __pyx_t_7;
3052   PyObject *__pyx_t_8 = NULL;
3053   int __pyx_lineno = 0;
3054   const char *__pyx_filename = NULL;
3055   int __pyx_clineno = 0;
3056   __Pyx_RefNannySetupContext("_index", 0);
3057 
3058   /* "ddtrace/internal/_encoding.pyx":153
3059  *         cdef stdint.uint32_t _id
3060  *
3061  *         if string is None:             # <<<<<<<<<<<<<<
3062  *             return 0
3063  *
3064  */
3065   __pyx_t_1 = (__pyx_v_string == Py_None);
3066   __pyx_t_2 = (__pyx_t_1 != 0);
3067   if (__pyx_t_2) {
3068 
3069     /* "ddtrace/internal/_encoding.pyx":154
3070  *
3071  *         if string is None:
3072  *             return 0             # <<<<<<<<<<<<<<
3073  *
3074  *         if PyDict_Contains(self._table, string):
3075  */
3076     __pyx_r = 0;
3077     goto __pyx_L0;
3078 
3079     /* "ddtrace/internal/_encoding.pyx":153
3080  *         cdef stdint.uint32_t _id
3081  *
3082  *         if string is None:             # <<<<<<<<<<<<<<
3083  *             return 0
3084  *
3085  */
3086   }
3087 
3088   /* "ddtrace/internal/_encoding.pyx":156
3089  *             return 0
3090  *
3091  *         if PyDict_Contains(self._table, string):             # <<<<<<<<<<<<<<
3092  *             return PyLong_AsLong(<object>PyDict_GetItem(self._table, string))
3093  *
3094  */
3095   __pyx_t_3 = __pyx_v_self->_table;
3096   __Pyx_INCREF(__pyx_t_3);
3097   __pyx_t_4 = PyDict_Contains(__pyx_t_3, __pyx_v_string); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error)
3098   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3099   __pyx_t_2 = (__pyx_t_4 != 0);
3100   if (__pyx_t_2) {
3101 
3102     /* "ddtrace/internal/_encoding.pyx":157
3103  *
3104  *         if PyDict_Contains(self._table, string):
3105  *             return PyLong_AsLong(<object>PyDict_GetItem(self._table, string))             # <<<<<<<<<<<<<<
3106  *
3107  *         _id = self._next_id
3108  */
3109     __pyx_t_3 = __pyx_v_self->_table;
3110     __Pyx_INCREF(__pyx_t_3);
3111     __pyx_t_5 = PyDict_GetItem(__pyx_t_3, __pyx_v_string);
3112     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3113     __pyx_t_6 = PyLong_AsLong(((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_6 == ((long)-1L) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
3114     __pyx_r = __pyx_t_6;
3115     goto __pyx_L0;
3116 
3117     /* "ddtrace/internal/_encoding.pyx":156
3118  *             return 0
3119  *
3120  *         if PyDict_Contains(self._table, string):             # <<<<<<<<<<<<<<
3121  *             return PyLong_AsLong(<object>PyDict_GetItem(self._table, string))
3122  *
3123  */
3124   }
3125 
3126   /* "ddtrace/internal/_encoding.pyx":159
3127  *             return PyLong_AsLong(<object>PyDict_GetItem(self._table, string))
3128  *
3129  *         _id = self._next_id             # <<<<<<<<<<<<<<
3130  *         PyDict_SetItem(self._table, string, PyLong_FromLong(_id))
3131  *         self.insert(string)
3132  */
3133   __pyx_t_7 = __pyx_v_self->_next_id;
3134   __pyx_v__id = __pyx_t_7;
3135 
3136   /* "ddtrace/internal/_encoding.pyx":160
3137  *
3138  *         _id = self._next_id
3139  *         PyDict_SetItem(self._table, string, PyLong_FromLong(_id))             # <<<<<<<<<<<<<<
3140  *         self.insert(string)
3141  *         self._next_id += 1
3142  */
3143   __pyx_t_3 = __pyx_v_self->_table;
3144   __Pyx_INCREF(__pyx_t_3);
3145   __pyx_t_8 = PyLong_FromLong(__pyx_v__id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 160, __pyx_L1_error)
3146   __Pyx_GOTREF(__pyx_t_8);
3147   __pyx_t_4 = PyDict_SetItem(__pyx_t_3, __pyx_v_string, __pyx_t_8); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 160, __pyx_L1_error)
3148   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3149   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3150 
3151   /* "ddtrace/internal/_encoding.pyx":161
3152  *         _id = self._next_id
3153  *         PyDict_SetItem(self._table, string, PyLong_FromLong(_id))
3154  *         self.insert(string)             # <<<<<<<<<<<<<<
3155  *         self._next_id += 1
3156  *         return _id
3157  */
3158   __pyx_t_8 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->__pyx_vtab)->insert(__pyx_v_self, __pyx_v_string); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 161, __pyx_L1_error)
3159   __Pyx_GOTREF(__pyx_t_8);
3160   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3161 
3162   /* "ddtrace/internal/_encoding.pyx":162
3163  *         PyDict_SetItem(self._table, string, PyLong_FromLong(_id))
3164  *         self.insert(string)
3165  *         self._next_id += 1             # <<<<<<<<<<<<<<
3166  *         return _id
3167  *
3168  */
3169   __pyx_v_self->_next_id = (__pyx_v_self->_next_id + 1);
3170 
3171   /* "ddtrace/internal/_encoding.pyx":163
3172  *         self.insert(string)
3173  *         self._next_id += 1
3174  *         return _id             # <<<<<<<<<<<<<<
3175  *
3176  *     cpdef index(self, object string):
3177  */
3178   __pyx_r = __pyx_v__id;
3179   goto __pyx_L0;
3180 
3181   /* "ddtrace/internal/_encoding.pyx":150
3182  *         pass
3183  *
3184  *     cdef stdint.uint32_t _index(self, object string):             # <<<<<<<<<<<<<<
3185  *         cdef stdint.uint32_t _id
3186  *
3187  */
3188 
3189   /* function exit code */
3190   __pyx_L1_error:;
3191   __Pyx_XDECREF(__pyx_t_3);
3192   __Pyx_XDECREF(__pyx_t_8);
3193   __Pyx_WriteUnraisable("ddtrace.internal._encoding.StringTable._index", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3194   __pyx_r = 0;
3195   __pyx_L0:;
3196   __Pyx_RefNannyFinishContext();
3197   return __pyx_r;
3198 }
3199 
3200 /* "ddtrace/internal/_encoding.pyx":165
3201  *         return _id
3202  *
3203  *     cpdef index(self, object string):             # <<<<<<<<<<<<<<
3204  *         return self._index(string)
3205  *
3206  */
3207 
3208 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,PyObject * __pyx_v_string,int __pyx_skip_dispatch)3209 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string, int __pyx_skip_dispatch) {
3210   PyObject *__pyx_r = NULL;
3211   __Pyx_RefNannyDeclarations
3212   PyObject *__pyx_t_1 = NULL;
3213   PyObject *__pyx_t_2 = NULL;
3214   PyObject *__pyx_t_3 = NULL;
3215   PyObject *__pyx_t_4 = NULL;
3216   int __pyx_lineno = 0;
3217   const char *__pyx_filename = NULL;
3218   int __pyx_clineno = 0;
3219   __Pyx_RefNannySetupContext("index", 0);
3220   /* Check if called by wrapper */
3221   if (unlikely(__pyx_skip_dispatch)) ;
3222   /* Check if overridden in Python */
3223   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
3224     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
3225     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
3226     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
3227       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
3228       #endif
3229       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
3230       __Pyx_GOTREF(__pyx_t_1);
3231       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index)) {
3232         __Pyx_XDECREF(__pyx_r);
3233         __Pyx_INCREF(__pyx_t_1);
3234         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
3235         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3236           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3237           if (likely(__pyx_t_4)) {
3238             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3239             __Pyx_INCREF(__pyx_t_4);
3240             __Pyx_INCREF(function);
3241             __Pyx_DECREF_SET(__pyx_t_3, function);
3242           }
3243         }
3244         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_string) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_string);
3245         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3246         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
3247         __Pyx_GOTREF(__pyx_t_2);
3248         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3249         __pyx_r = __pyx_t_2;
3250         __pyx_t_2 = 0;
3251         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3252         goto __pyx_L0;
3253       }
3254       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
3255       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
3256       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
3257       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
3258         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
3259       }
3260       #endif
3261       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3262       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
3263     }
3264     #endif
3265   }
3266 
3267   /* "ddtrace/internal/_encoding.pyx":166
3268  *
3269  *     cpdef index(self, object string):
3270  *         return self._index(string)             # <<<<<<<<<<<<<<
3271  *
3272  *     cdef reset(self):
3273  */
3274   __Pyx_XDECREF(__pyx_r);
3275   __pyx_t_1 = __Pyx_PyInt_From_uint32_t(((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->__pyx_vtab)->_index(__pyx_v_self, __pyx_v_string)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
3276   __Pyx_GOTREF(__pyx_t_1);
3277   __pyx_r = __pyx_t_1;
3278   __pyx_t_1 = 0;
3279   goto __pyx_L0;
3280 
3281   /* "ddtrace/internal/_encoding.pyx":165
3282  *         return _id
3283  *
3284  *     cpdef index(self, object string):             # <<<<<<<<<<<<<<
3285  *         return self._index(string)
3286  *
3287  */
3288 
3289   /* function exit code */
3290   __pyx_L1_error:;
3291   __Pyx_XDECREF(__pyx_t_1);
3292   __Pyx_XDECREF(__pyx_t_2);
3293   __Pyx_XDECREF(__pyx_t_3);
3294   __Pyx_XDECREF(__pyx_t_4);
3295   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
3296   __pyx_r = 0;
3297   __pyx_L0:;
3298   __Pyx_XGIVEREF(__pyx_r);
3299   __Pyx_RefNannyFinishContext();
3300   return __pyx_r;
3301 }
3302 
3303 /* Python wrapper */
3304 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index(PyObject * __pyx_v_self,PyObject * __pyx_v_string)3305 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index(PyObject *__pyx_v_self, PyObject *__pyx_v_string) {
3306   PyObject *__pyx_r = 0;
3307   __Pyx_RefNannyDeclarations
3308   __Pyx_RefNannySetupContext("index (wrapper)", 0);
3309   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_2index(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self), ((PyObject *)__pyx_v_string));
3310 
3311   /* function exit code */
3312   __Pyx_RefNannyFinishContext();
3313   return __pyx_r;
3314 }
3315 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_2index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,PyObject * __pyx_v_string)3316 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_2index(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string) {
3317   PyObject *__pyx_r = NULL;
3318   __Pyx_RefNannyDeclarations
3319   PyObject *__pyx_t_1 = NULL;
3320   int __pyx_lineno = 0;
3321   const char *__pyx_filename = NULL;
3322   int __pyx_clineno = 0;
3323   __Pyx_RefNannySetupContext("index", 0);
3324   __Pyx_XDECREF(__pyx_r);
3325   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_11StringTable_index(__pyx_v_self, __pyx_v_string, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
3326   __Pyx_GOTREF(__pyx_t_1);
3327   __pyx_r = __pyx_t_1;
3328   __pyx_t_1 = 0;
3329   goto __pyx_L0;
3330 
3331   /* function exit code */
3332   __pyx_L1_error:;
3333   __Pyx_XDECREF(__pyx_t_1);
3334   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
3335   __pyx_r = NULL;
3336   __pyx_L0:;
3337   __Pyx_XGIVEREF(__pyx_r);
3338   __Pyx_RefNannyFinishContext();
3339   return __pyx_r;
3340 }
3341 
3342 /* "ddtrace/internal/_encoding.pyx":168
3343  *         return self._index(string)
3344  *
3345  *     cdef reset(self):             # <<<<<<<<<<<<<<
3346  *         PyDict_Clear(self._table)
3347  *         PyDict_SetItem(self._table, "", 0)
3348  */
3349 
__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self)3350 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self) {
3351   PyObject *__pyx_r = NULL;
3352   __Pyx_RefNannyDeclarations
3353   PyObject *__pyx_t_1 = NULL;
3354   int __pyx_t_2;
3355   int __pyx_lineno = 0;
3356   const char *__pyx_filename = NULL;
3357   int __pyx_clineno = 0;
3358   __Pyx_RefNannySetupContext("reset", 0);
3359 
3360   /* "ddtrace/internal/_encoding.pyx":169
3361  *
3362  *     cdef reset(self):
3363  *         PyDict_Clear(self._table)             # <<<<<<<<<<<<<<
3364  *         PyDict_SetItem(self._table, "", 0)
3365  *         self.insert("")
3366  */
3367   __pyx_t_1 = __pyx_v_self->_table;
3368   __Pyx_INCREF(__pyx_t_1);
3369   PyDict_Clear(__pyx_t_1);
3370   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3371 
3372   /* "ddtrace/internal/_encoding.pyx":170
3373  *     cdef reset(self):
3374  *         PyDict_Clear(self._table)
3375  *         PyDict_SetItem(self._table, "", 0)             # <<<<<<<<<<<<<<
3376  *         self.insert("")
3377  *         self._next_id = 1
3378  */
3379   __pyx_t_1 = __pyx_v_self->_table;
3380   __Pyx_INCREF(__pyx_t_1);
3381   __pyx_t_2 = PyDict_SetItem(__pyx_t_1, __pyx_kp_s__3, __pyx_int_0); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 170, __pyx_L1_error)
3382   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3383 
3384   /* "ddtrace/internal/_encoding.pyx":171
3385  *         PyDict_Clear(self._table)
3386  *         PyDict_SetItem(self._table, "", 0)
3387  *         self.insert("")             # <<<<<<<<<<<<<<
3388  *         self._next_id = 1
3389  *
3390  */
3391   __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->__pyx_vtab)->insert(__pyx_v_self, __pyx_kp_s__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
3392   __Pyx_GOTREF(__pyx_t_1);
3393   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3394 
3395   /* "ddtrace/internal/_encoding.pyx":172
3396  *         PyDict_SetItem(self._table, "", 0)
3397  *         self.insert("")
3398  *         self._next_id = 1             # <<<<<<<<<<<<<<
3399  *
3400  *     def __len__(self):
3401  */
3402   __pyx_v_self->_next_id = 1;
3403 
3404   /* "ddtrace/internal/_encoding.pyx":168
3405  *         return self._index(string)
3406  *
3407  *     cdef reset(self):             # <<<<<<<<<<<<<<
3408  *         PyDict_Clear(self._table)
3409  *         PyDict_SetItem(self._table, "", 0)
3410  */
3411 
3412   /* function exit code */
3413   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3414   goto __pyx_L0;
3415   __pyx_L1_error:;
3416   __Pyx_XDECREF(__pyx_t_1);
3417   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
3418   __pyx_r = 0;
3419   __pyx_L0:;
3420   __Pyx_XGIVEREF(__pyx_r);
3421   __Pyx_RefNannyFinishContext();
3422   return __pyx_r;
3423 }
3424 
3425 /* "ddtrace/internal/_encoding.pyx":174
3426  *         self._next_id = 1
3427  *
3428  *     def __len__(self):             # <<<<<<<<<<<<<<
3429  *         return PyLong_FromLong(self._next_id)
3430  *
3431  */
3432 
3433 /* Python wrapper */
3434 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_5__len__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_5__len__(PyObject * __pyx_v_self)3435 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_5__len__(PyObject *__pyx_v_self) {
3436   Py_ssize_t __pyx_r;
3437   __Pyx_RefNannyDeclarations
3438   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
3439   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_4__len__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self));
3440 
3441   /* function exit code */
3442   __Pyx_RefNannyFinishContext();
3443   return __pyx_r;
3444 }
3445 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self)3446 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self) {
3447   Py_ssize_t __pyx_r;
3448   __Pyx_RefNannyDeclarations
3449   PyObject *__pyx_t_1 = NULL;
3450   Py_ssize_t __pyx_t_2;
3451   int __pyx_lineno = 0;
3452   const char *__pyx_filename = NULL;
3453   int __pyx_clineno = 0;
3454   __Pyx_RefNannySetupContext("__len__", 0);
3455 
3456   /* "ddtrace/internal/_encoding.pyx":175
3457  *
3458  *     def __len__(self):
3459  *         return PyLong_FromLong(self._next_id)             # <<<<<<<<<<<<<<
3460  *
3461  *     def __contains__(self, object string):
3462  */
3463   __pyx_t_1 = PyLong_FromLong(__pyx_v_self->_next_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
3464   __Pyx_GOTREF(__pyx_t_1);
3465   __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
3466   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3467   __pyx_r = __pyx_t_2;
3468   goto __pyx_L0;
3469 
3470   /* "ddtrace/internal/_encoding.pyx":174
3471  *         self._next_id = 1
3472  *
3473  *     def __len__(self):             # <<<<<<<<<<<<<<
3474  *         return PyLong_FromLong(self._next_id)
3475  *
3476  */
3477 
3478   /* function exit code */
3479   __pyx_L1_error:;
3480   __Pyx_XDECREF(__pyx_t_1);
3481   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3482   __pyx_r = -1;
3483   __pyx_L0:;
3484   __Pyx_RefNannyFinishContext();
3485   return __pyx_r;
3486 }
3487 
3488 /* "ddtrace/internal/_encoding.pyx":177
3489  *         return PyLong_FromLong(self._next_id)
3490  *
3491  *     def __contains__(self, object string):             # <<<<<<<<<<<<<<
3492  *         return PyBool_FromLong(PyDict_Contains(self._table, string))
3493  *
3494  */
3495 
3496 /* Python wrapper */
3497 static int __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_7__contains__(PyObject * __pyx_v_self,PyObject * __pyx_v_string)3498 static int __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_7__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_string) {
3499   int __pyx_r;
3500   __Pyx_RefNannyDeclarations
3501   __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
3502   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_6__contains__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self), ((PyObject *)__pyx_v_string));
3503 
3504   /* function exit code */
3505   __Pyx_RefNannyFinishContext();
3506   return __pyx_r;
3507 }
3508 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_6__contains__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,PyObject * __pyx_v_string)3509 static int __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_6__contains__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v_string) {
3510   int __pyx_r;
3511   __Pyx_RefNannyDeclarations
3512   PyObject *__pyx_t_1 = NULL;
3513   int __pyx_t_2;
3514   int __pyx_lineno = 0;
3515   const char *__pyx_filename = NULL;
3516   int __pyx_clineno = 0;
3517   __Pyx_RefNannySetupContext("__contains__", 0);
3518 
3519   /* "ddtrace/internal/_encoding.pyx":178
3520  *
3521  *     def __contains__(self, object string):
3522  *         return PyBool_FromLong(PyDict_Contains(self._table, string))             # <<<<<<<<<<<<<<
3523  *
3524  *
3525  */
3526   __pyx_t_1 = __pyx_v_self->_table;
3527   __Pyx_INCREF(__pyx_t_1);
3528   __pyx_t_2 = PyDict_Contains(__pyx_t_1, __pyx_v_string); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 178, __pyx_L1_error)
3529   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3530   __pyx_t_1 = PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
3531   __Pyx_GOTREF(__pyx_t_1);
3532   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
3533   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3534   __pyx_r = __pyx_t_2;
3535   goto __pyx_L0;
3536 
3537   /* "ddtrace/internal/_encoding.pyx":177
3538  *         return PyLong_FromLong(self._next_id)
3539  *
3540  *     def __contains__(self, object string):             # <<<<<<<<<<<<<<
3541  *         return PyBool_FromLong(PyDict_Contains(self._table, string))
3542  *
3543  */
3544 
3545   /* function exit code */
3546   __pyx_L1_error:;
3547   __Pyx_XDECREF(__pyx_t_1);
3548   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3549   __pyx_r = -1;
3550   __pyx_L0:;
3551   __Pyx_RefNannyFinishContext();
3552   return __pyx_r;
3553 }
3554 
3555 /* "(tree fragment)":1
3556  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3557  *     cdef tuple state
3558  *     cdef object _dict
3559  */
3560 
3561 /* Python wrapper */
3562 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3563 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3564   PyObject *__pyx_r = 0;
3565   __Pyx_RefNannyDeclarations
3566   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3567   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_8__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self));
3568 
3569   /* function exit code */
3570   __Pyx_RefNannyFinishContext();
3571   return __pyx_r;
3572 }
3573 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_8__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self)3574 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_8__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self) {
3575   PyObject *__pyx_v_state = 0;
3576   PyObject *__pyx_v__dict = 0;
3577   int __pyx_v_use_setstate;
3578   PyObject *__pyx_r = NULL;
3579   __Pyx_RefNannyDeclarations
3580   PyObject *__pyx_t_1 = NULL;
3581   PyObject *__pyx_t_2 = NULL;
3582   int __pyx_t_3;
3583   int __pyx_t_4;
3584   PyObject *__pyx_t_5 = NULL;
3585   int __pyx_lineno = 0;
3586   const char *__pyx_filename = NULL;
3587   int __pyx_clineno = 0;
3588   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3589 
3590   /* "(tree fragment)":5
3591  *     cdef object _dict
3592  *     cdef bint use_setstate
3593  *     state = (self._next_id, self._table)             # <<<<<<<<<<<<<<
3594  *     _dict = getattr(self, '__dict__', None)
3595  *     if _dict is not None:
3596  */
3597   __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->_next_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
3598   __Pyx_GOTREF(__pyx_t_1);
3599   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
3600   __Pyx_GOTREF(__pyx_t_2);
3601   __Pyx_GIVEREF(__pyx_t_1);
3602   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
3603   __Pyx_INCREF(__pyx_v_self->_table);
3604   __Pyx_GIVEREF(__pyx_v_self->_table);
3605   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->_table);
3606   __pyx_t_1 = 0;
3607   __pyx_v_state = ((PyObject*)__pyx_t_2);
3608   __pyx_t_2 = 0;
3609 
3610   /* "(tree fragment)":6
3611  *     cdef bint use_setstate
3612  *     state = (self._next_id, self._table)
3613  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
3614  *     if _dict is not None:
3615  *         state += (_dict,)
3616  */
3617   __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
3618   __Pyx_GOTREF(__pyx_t_2);
3619   __pyx_v__dict = __pyx_t_2;
3620   __pyx_t_2 = 0;
3621 
3622   /* "(tree fragment)":7
3623  *     state = (self._next_id, self._table)
3624  *     _dict = getattr(self, '__dict__', None)
3625  *     if _dict is not None:             # <<<<<<<<<<<<<<
3626  *         state += (_dict,)
3627  *         use_setstate = True
3628  */
3629   __pyx_t_3 = (__pyx_v__dict != Py_None);
3630   __pyx_t_4 = (__pyx_t_3 != 0);
3631   if (__pyx_t_4) {
3632 
3633     /* "(tree fragment)":8
3634  *     _dict = getattr(self, '__dict__', None)
3635  *     if _dict is not None:
3636  *         state += (_dict,)             # <<<<<<<<<<<<<<
3637  *         use_setstate = True
3638  *     else:
3639  */
3640     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
3641     __Pyx_GOTREF(__pyx_t_2);
3642     __Pyx_INCREF(__pyx_v__dict);
3643     __Pyx_GIVEREF(__pyx_v__dict);
3644     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
3645     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
3646     __Pyx_GOTREF(__pyx_t_1);
3647     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3648     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
3649     __pyx_t_1 = 0;
3650 
3651     /* "(tree fragment)":9
3652  *     if _dict is not None:
3653  *         state += (_dict,)
3654  *         use_setstate = True             # <<<<<<<<<<<<<<
3655  *     else:
3656  *         use_setstate = self._table is not None
3657  */
3658     __pyx_v_use_setstate = 1;
3659 
3660     /* "(tree fragment)":7
3661  *     state = (self._next_id, self._table)
3662  *     _dict = getattr(self, '__dict__', None)
3663  *     if _dict is not None:             # <<<<<<<<<<<<<<
3664  *         state += (_dict,)
3665  *         use_setstate = True
3666  */
3667     goto __pyx_L3;
3668   }
3669 
3670   /* "(tree fragment)":11
3671  *         use_setstate = True
3672  *     else:
3673  *         use_setstate = self._table is not None             # <<<<<<<<<<<<<<
3674  *     if use_setstate:
3675  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, None), state
3676  */
3677   /*else*/ {
3678     __pyx_t_4 = (__pyx_v_self->_table != ((PyObject*)Py_None));
3679     __pyx_v_use_setstate = __pyx_t_4;
3680   }
3681   __pyx_L3:;
3682 
3683   /* "(tree fragment)":12
3684  *     else:
3685  *         use_setstate = self._table is not None
3686  *     if use_setstate:             # <<<<<<<<<<<<<<
3687  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, None), state
3688  *     else:
3689  */
3690   __pyx_t_4 = (__pyx_v_use_setstate != 0);
3691   if (__pyx_t_4) {
3692 
3693     /* "(tree fragment)":13
3694  *         use_setstate = self._table is not None
3695  *     if use_setstate:
3696  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, None), state             # <<<<<<<<<<<<<<
3697  *     else:
3698  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, state)
3699  */
3700     __Pyx_XDECREF(__pyx_r);
3701     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_StringTable); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
3702     __Pyx_GOTREF(__pyx_t_1);
3703     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
3704     __Pyx_GOTREF(__pyx_t_2);
3705     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
3706     __Pyx_GOTREF(__pyx_t_5);
3707     __Pyx_GIVEREF(__pyx_t_2);
3708     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
3709     __Pyx_INCREF(__pyx_int_194841817);
3710     __Pyx_GIVEREF(__pyx_int_194841817);
3711     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_194841817);
3712     __Pyx_INCREF(Py_None);
3713     __Pyx_GIVEREF(Py_None);
3714     PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
3715     __pyx_t_2 = 0;
3716     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
3717     __Pyx_GOTREF(__pyx_t_2);
3718     __Pyx_GIVEREF(__pyx_t_1);
3719     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
3720     __Pyx_GIVEREF(__pyx_t_5);
3721     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
3722     __Pyx_INCREF(__pyx_v_state);
3723     __Pyx_GIVEREF(__pyx_v_state);
3724     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
3725     __pyx_t_1 = 0;
3726     __pyx_t_5 = 0;
3727     __pyx_r = __pyx_t_2;
3728     __pyx_t_2 = 0;
3729     goto __pyx_L0;
3730 
3731     /* "(tree fragment)":12
3732  *     else:
3733  *         use_setstate = self._table is not None
3734  *     if use_setstate:             # <<<<<<<<<<<<<<
3735  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, None), state
3736  *     else:
3737  */
3738   }
3739 
3740   /* "(tree fragment)":15
3741  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, None), state
3742  *     else:
3743  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, state)             # <<<<<<<<<<<<<<
3744  * def __setstate_cython__(self, __pyx_state):
3745  *     __pyx_unpickle_StringTable__set_state(self, __pyx_state)
3746  */
3747   /*else*/ {
3748     __Pyx_XDECREF(__pyx_r);
3749     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_StringTable); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
3750     __Pyx_GOTREF(__pyx_t_2);
3751     __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
3752     __Pyx_GOTREF(__pyx_t_5);
3753     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
3754     __Pyx_GOTREF(__pyx_t_1);
3755     __Pyx_GIVEREF(__pyx_t_5);
3756     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
3757     __Pyx_INCREF(__pyx_int_194841817);
3758     __Pyx_GIVEREF(__pyx_int_194841817);
3759     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_194841817);
3760     __Pyx_INCREF(__pyx_v_state);
3761     __Pyx_GIVEREF(__pyx_v_state);
3762     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
3763     __pyx_t_5 = 0;
3764     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
3765     __Pyx_GOTREF(__pyx_t_5);
3766     __Pyx_GIVEREF(__pyx_t_2);
3767     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
3768     __Pyx_GIVEREF(__pyx_t_1);
3769     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
3770     __pyx_t_2 = 0;
3771     __pyx_t_1 = 0;
3772     __pyx_r = __pyx_t_5;
3773     __pyx_t_5 = 0;
3774     goto __pyx_L0;
3775   }
3776 
3777   /* "(tree fragment)":1
3778  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3779  *     cdef tuple state
3780  *     cdef object _dict
3781  */
3782 
3783   /* function exit code */
3784   __pyx_L1_error:;
3785   __Pyx_XDECREF(__pyx_t_1);
3786   __Pyx_XDECREF(__pyx_t_2);
3787   __Pyx_XDECREF(__pyx_t_5);
3788   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3789   __pyx_r = NULL;
3790   __pyx_L0:;
3791   __Pyx_XDECREF(__pyx_v_state);
3792   __Pyx_XDECREF(__pyx_v__dict);
3793   __Pyx_XGIVEREF(__pyx_r);
3794   __Pyx_RefNannyFinishContext();
3795   return __pyx_r;
3796 }
3797 
3798 /* "(tree fragment)":16
3799  *     else:
3800  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, state)
3801  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3802  *     __pyx_unpickle_StringTable__set_state(self, __pyx_state)
3803  */
3804 
3805 /* Python wrapper */
3806 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3807 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3808   PyObject *__pyx_r = 0;
3809   __Pyx_RefNannyDeclarations
3810   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3811   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_10__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3812 
3813   /* function exit code */
3814   __Pyx_RefNannyFinishContext();
3815   return __pyx_r;
3816 }
3817 
__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_10__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v_self,PyObject * __pyx_v___pyx_state)3818 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_11StringTable_10__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3819   PyObject *__pyx_r = NULL;
3820   __Pyx_RefNannyDeclarations
3821   PyObject *__pyx_t_1 = NULL;
3822   int __pyx_lineno = 0;
3823   const char *__pyx_filename = NULL;
3824   int __pyx_clineno = 0;
3825   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3826 
3827   /* "(tree fragment)":17
3828  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, state)
3829  * def __setstate_cython__(self, __pyx_state):
3830  *     __pyx_unpickle_StringTable__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
3831  */
3832   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
3833   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
3834   __Pyx_GOTREF(__pyx_t_1);
3835   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3836 
3837   /* "(tree fragment)":16
3838  *     else:
3839  *         return __pyx_unpickle_StringTable, (type(self), 0xb9d0cd9, state)
3840  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3841  *     __pyx_unpickle_StringTable__set_state(self, __pyx_state)
3842  */
3843 
3844   /* function exit code */
3845   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3846   goto __pyx_L0;
3847   __pyx_L1_error:;
3848   __Pyx_XDECREF(__pyx_t_1);
3849   __Pyx_AddTraceback("ddtrace.internal._encoding.StringTable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3850   __pyx_r = NULL;
3851   __pyx_L0:;
3852   __Pyx_XGIVEREF(__pyx_r);
3853   __Pyx_RefNannyFinishContext();
3854   return __pyx_r;
3855 }
3856 
3857 /* "ddtrace/internal/_encoding.pyx":184
3858  *     cdef list _list
3859  *
3860  *     def __init__(self):             # <<<<<<<<<<<<<<
3861  *         self._list = []
3862  *         super(ListStringTable, self).__init__()
3863  */
3864 
3865 /* Python wrapper */
3866 static int __pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3867 static int __pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3868   int __pyx_r;
3869   __Pyx_RefNannyDeclarations
3870   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
3871   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
3872     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
3873   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
3874   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable___init__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)__pyx_v_self));
3875 
3876   /* function exit code */
3877   __Pyx_RefNannyFinishContext();
3878   return __pyx_r;
3879 }
3880 
__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v_self)3881 static int __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self) {
3882   int __pyx_r;
3883   __Pyx_RefNannyDeclarations
3884   PyObject *__pyx_t_1 = NULL;
3885   PyObject *__pyx_t_2 = NULL;
3886   PyObject *__pyx_t_3 = NULL;
3887   int __pyx_lineno = 0;
3888   const char *__pyx_filename = NULL;
3889   int __pyx_clineno = 0;
3890   __Pyx_RefNannySetupContext("__init__", 0);
3891 
3892   /* "ddtrace/internal/_encoding.pyx":185
3893  *
3894  *     def __init__(self):
3895  *         self._list = []             # <<<<<<<<<<<<<<
3896  *         super(ListStringTable, self).__init__()
3897  *
3898  */
3899   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
3900   __Pyx_GOTREF(__pyx_t_1);
3901   __Pyx_GIVEREF(__pyx_t_1);
3902   __Pyx_GOTREF(__pyx_v_self->_list);
3903   __Pyx_DECREF(__pyx_v_self->_list);
3904   __pyx_v_self->_list = ((PyObject*)__pyx_t_1);
3905   __pyx_t_1 = 0;
3906 
3907   /* "ddtrace/internal/_encoding.pyx":186
3908  *     def __init__(self):
3909  *         self._list = []
3910  *         super(ListStringTable, self).__init__()             # <<<<<<<<<<<<<<
3911  *
3912  *     cdef insert(self, object string):
3913  */
3914   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
3915   __Pyx_GOTREF(__pyx_t_2);
3916   __Pyx_INCREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable));
3917   __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable));
3918   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable));
3919   __Pyx_INCREF(((PyObject *)__pyx_v_self));
3920   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3921   PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
3922   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
3923   __Pyx_GOTREF(__pyx_t_3);
3924   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3925   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
3926   __Pyx_GOTREF(__pyx_t_2);
3927   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3928   __pyx_t_3 = NULL;
3929   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3930     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3931     if (likely(__pyx_t_3)) {
3932       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3933       __Pyx_INCREF(__pyx_t_3);
3934       __Pyx_INCREF(function);
3935       __Pyx_DECREF_SET(__pyx_t_2, function);
3936     }
3937   }
3938   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3939   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3940   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
3941   __Pyx_GOTREF(__pyx_t_1);
3942   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3943   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3944 
3945   /* "ddtrace/internal/_encoding.pyx":184
3946  *     cdef list _list
3947  *
3948  *     def __init__(self):             # <<<<<<<<<<<<<<
3949  *         self._list = []
3950  *         super(ListStringTable, self).__init__()
3951  */
3952 
3953   /* function exit code */
3954   __pyx_r = 0;
3955   goto __pyx_L0;
3956   __pyx_L1_error:;
3957   __Pyx_XDECREF(__pyx_t_1);
3958   __Pyx_XDECREF(__pyx_t_2);
3959   __Pyx_XDECREF(__pyx_t_3);
3960   __Pyx_AddTraceback("ddtrace.internal._encoding.ListStringTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3961   __pyx_r = -1;
3962   __pyx_L0:;
3963   __Pyx_RefNannyFinishContext();
3964   return __pyx_r;
3965 }
3966 
3967 /* "ddtrace/internal/_encoding.pyx":188
3968  *         super(ListStringTable, self).__init__()
3969  *
3970  *     cdef insert(self, object string):             # <<<<<<<<<<<<<<
3971  *         PyList_Append(self._list, string)
3972  *
3973  */
3974 
__pyx_f_7ddtrace_8internal_9_encoding_15ListStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v_self,PyObject * __pyx_v_string)3975 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_15ListStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self, PyObject *__pyx_v_string) {
3976   PyObject *__pyx_r = NULL;
3977   __Pyx_RefNannyDeclarations
3978   PyObject *__pyx_t_1 = NULL;
3979   int __pyx_t_2;
3980   int __pyx_lineno = 0;
3981   const char *__pyx_filename = NULL;
3982   int __pyx_clineno = 0;
3983   __Pyx_RefNannySetupContext("insert", 0);
3984 
3985   /* "ddtrace/internal/_encoding.pyx":189
3986  *
3987  *     cdef insert(self, object string):
3988  *         PyList_Append(self._list, string)             # <<<<<<<<<<<<<<
3989  *
3990  *     def __iter__(self):
3991  */
3992   __pyx_t_1 = __pyx_v_self->_list;
3993   __Pyx_INCREF(__pyx_t_1);
3994   __pyx_t_2 = PyList_Append(__pyx_t_1, __pyx_v_string); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 189, __pyx_L1_error)
3995   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3996 
3997   /* "ddtrace/internal/_encoding.pyx":188
3998  *         super(ListStringTable, self).__init__()
3999  *
4000  *     cdef insert(self, object string):             # <<<<<<<<<<<<<<
4001  *         PyList_Append(self._list, string)
4002  *
4003  */
4004 
4005   /* function exit code */
4006   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4007   goto __pyx_L0;
4008   __pyx_L1_error:;
4009   __Pyx_XDECREF(__pyx_t_1);
4010   __Pyx_AddTraceback("ddtrace.internal._encoding.ListStringTable.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
4011   __pyx_r = 0;
4012   __pyx_L0:;
4013   __Pyx_XGIVEREF(__pyx_r);
4014   __Pyx_RefNannyFinishContext();
4015   return __pyx_r;
4016 }
4017 
4018 /* "ddtrace/internal/_encoding.pyx":191
4019  *         PyList_Append(self._list, string)
4020  *
4021  *     def __iter__(self):             # <<<<<<<<<<<<<<
4022  *         return iter(self._list)
4023  *
4024  */
4025 
4026 /* Python wrapper */
4027 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_3__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_3__iter__(PyObject * __pyx_v_self)4028 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_3__iter__(PyObject *__pyx_v_self) {
4029   PyObject *__pyx_r = 0;
4030   __Pyx_RefNannyDeclarations
4031   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
4032   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_2__iter__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)__pyx_v_self));
4033 
4034   /* function exit code */
4035   __Pyx_RefNannyFinishContext();
4036   return __pyx_r;
4037 }
4038 
__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_2__iter__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v_self)4039 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_2__iter__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self) {
4040   PyObject *__pyx_r = NULL;
4041   __Pyx_RefNannyDeclarations
4042   PyObject *__pyx_t_1 = NULL;
4043   PyObject *__pyx_t_2 = NULL;
4044   int __pyx_lineno = 0;
4045   const char *__pyx_filename = NULL;
4046   int __pyx_clineno = 0;
4047   __Pyx_RefNannySetupContext("__iter__", 0);
4048 
4049   /* "ddtrace/internal/_encoding.pyx":192
4050  *
4051  *     def __iter__(self):
4052  *         return iter(self._list)             # <<<<<<<<<<<<<<
4053  *
4054  *
4055  */
4056   __Pyx_XDECREF(__pyx_r);
4057   __pyx_t_1 = __pyx_v_self->_list;
4058   __Pyx_INCREF(__pyx_t_1);
4059   __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
4060   __Pyx_GOTREF(__pyx_t_2);
4061   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4062   __pyx_r = __pyx_t_2;
4063   __pyx_t_2 = 0;
4064   goto __pyx_L0;
4065 
4066   /* "ddtrace/internal/_encoding.pyx":191
4067  *         PyList_Append(self._list, string)
4068  *
4069  *     def __iter__(self):             # <<<<<<<<<<<<<<
4070  *         return iter(self._list)
4071  *
4072  */
4073 
4074   /* function exit code */
4075   __pyx_L1_error:;
4076   __Pyx_XDECREF(__pyx_t_1);
4077   __Pyx_XDECREF(__pyx_t_2);
4078   __Pyx_AddTraceback("ddtrace.internal._encoding.ListStringTable.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4079   __pyx_r = NULL;
4080   __pyx_L0:;
4081   __Pyx_XGIVEREF(__pyx_r);
4082   __Pyx_RefNannyFinishContext();
4083   return __pyx_r;
4084 }
4085 
4086 /* "(tree fragment)":1
4087  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4088  *     cdef tuple state
4089  *     cdef object _dict
4090  */
4091 
4092 /* Python wrapper */
4093 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4094 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4095   PyObject *__pyx_r = 0;
4096   __Pyx_RefNannyDeclarations
4097   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4098   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_4__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)__pyx_v_self));
4099 
4100   /* function exit code */
4101   __Pyx_RefNannyFinishContext();
4102   return __pyx_r;
4103 }
4104 
__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_4__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v_self)4105 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_4__reduce_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self) {
4106   PyObject *__pyx_v_state = 0;
4107   PyObject *__pyx_v__dict = 0;
4108   int __pyx_v_use_setstate;
4109   PyObject *__pyx_r = NULL;
4110   __Pyx_RefNannyDeclarations
4111   PyObject *__pyx_t_1 = NULL;
4112   PyObject *__pyx_t_2 = NULL;
4113   int __pyx_t_3;
4114   int __pyx_t_4;
4115   int __pyx_t_5;
4116   PyObject *__pyx_t_6 = NULL;
4117   int __pyx_lineno = 0;
4118   const char *__pyx_filename = NULL;
4119   int __pyx_clineno = 0;
4120   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4121 
4122   /* "(tree fragment)":5
4123  *     cdef object _dict
4124  *     cdef bint use_setstate
4125  *     state = (self._list, self._next_id, self._table)             # <<<<<<<<<<<<<<
4126  *     _dict = getattr(self, '__dict__', None)
4127  *     if _dict is not None:
4128  */
4129   __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->__pyx_base._next_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
4130   __Pyx_GOTREF(__pyx_t_1);
4131   __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
4132   __Pyx_GOTREF(__pyx_t_2);
4133   __Pyx_INCREF(__pyx_v_self->_list);
4134   __Pyx_GIVEREF(__pyx_v_self->_list);
4135   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->_list);
4136   __Pyx_GIVEREF(__pyx_t_1);
4137   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
4138   __Pyx_INCREF(__pyx_v_self->__pyx_base._table);
4139   __Pyx_GIVEREF(__pyx_v_self->__pyx_base._table);
4140   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->__pyx_base._table);
4141   __pyx_t_1 = 0;
4142   __pyx_v_state = ((PyObject*)__pyx_t_2);
4143   __pyx_t_2 = 0;
4144 
4145   /* "(tree fragment)":6
4146  *     cdef bint use_setstate
4147  *     state = (self._list, self._next_id, self._table)
4148  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
4149  *     if _dict is not None:
4150  *         state += (_dict,)
4151  */
4152   __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
4153   __Pyx_GOTREF(__pyx_t_2);
4154   __pyx_v__dict = __pyx_t_2;
4155   __pyx_t_2 = 0;
4156 
4157   /* "(tree fragment)":7
4158  *     state = (self._list, self._next_id, self._table)
4159  *     _dict = getattr(self, '__dict__', None)
4160  *     if _dict is not None:             # <<<<<<<<<<<<<<
4161  *         state += (_dict,)
4162  *         use_setstate = True
4163  */
4164   __pyx_t_3 = (__pyx_v__dict != Py_None);
4165   __pyx_t_4 = (__pyx_t_3 != 0);
4166   if (__pyx_t_4) {
4167 
4168     /* "(tree fragment)":8
4169  *     _dict = getattr(self, '__dict__', None)
4170  *     if _dict is not None:
4171  *         state += (_dict,)             # <<<<<<<<<<<<<<
4172  *         use_setstate = True
4173  *     else:
4174  */
4175     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
4176     __Pyx_GOTREF(__pyx_t_2);
4177     __Pyx_INCREF(__pyx_v__dict);
4178     __Pyx_GIVEREF(__pyx_v__dict);
4179     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
4180     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
4181     __Pyx_GOTREF(__pyx_t_1);
4182     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4183     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
4184     __pyx_t_1 = 0;
4185 
4186     /* "(tree fragment)":9
4187  *     if _dict is not None:
4188  *         state += (_dict,)
4189  *         use_setstate = True             # <<<<<<<<<<<<<<
4190  *     else:
4191  *         use_setstate = self._list is not None or self._table is not None
4192  */
4193     __pyx_v_use_setstate = 1;
4194 
4195     /* "(tree fragment)":7
4196  *     state = (self._list, self._next_id, self._table)
4197  *     _dict = getattr(self, '__dict__', None)
4198  *     if _dict is not None:             # <<<<<<<<<<<<<<
4199  *         state += (_dict,)
4200  *         use_setstate = True
4201  */
4202     goto __pyx_L3;
4203   }
4204 
4205   /* "(tree fragment)":11
4206  *         use_setstate = True
4207  *     else:
4208  *         use_setstate = self._list is not None or self._table is not None             # <<<<<<<<<<<<<<
4209  *     if use_setstate:
4210  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, None), state
4211  */
4212   /*else*/ {
4213     __pyx_t_3 = (__pyx_v_self->_list != ((PyObject*)Py_None));
4214     __pyx_t_5 = (__pyx_t_3 != 0);
4215     if (!__pyx_t_5) {
4216     } else {
4217       __pyx_t_4 = __pyx_t_5;
4218       goto __pyx_L4_bool_binop_done;
4219     }
4220     __pyx_t_5 = (__pyx_v_self->__pyx_base._table != ((PyObject*)Py_None));
4221     __pyx_t_3 = (__pyx_t_5 != 0);
4222     __pyx_t_4 = __pyx_t_3;
4223     __pyx_L4_bool_binop_done:;
4224     __pyx_v_use_setstate = __pyx_t_4;
4225   }
4226   __pyx_L3:;
4227 
4228   /* "(tree fragment)":12
4229  *     else:
4230  *         use_setstate = self._list is not None or self._table is not None
4231  *     if use_setstate:             # <<<<<<<<<<<<<<
4232  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, None), state
4233  *     else:
4234  */
4235   __pyx_t_4 = (__pyx_v_use_setstate != 0);
4236   if (__pyx_t_4) {
4237 
4238     /* "(tree fragment)":13
4239  *         use_setstate = self._list is not None or self._table is not None
4240  *     if use_setstate:
4241  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, None), state             # <<<<<<<<<<<<<<
4242  *     else:
4243  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, state)
4244  */
4245     __Pyx_XDECREF(__pyx_r);
4246     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_ListStringTable); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
4247     __Pyx_GOTREF(__pyx_t_1);
4248     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
4249     __Pyx_GOTREF(__pyx_t_2);
4250     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
4251     __Pyx_GOTREF(__pyx_t_6);
4252     __Pyx_GIVEREF(__pyx_t_2);
4253     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
4254     __Pyx_INCREF(__pyx_int_182609841);
4255     __Pyx_GIVEREF(__pyx_int_182609841);
4256     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_182609841);
4257     __Pyx_INCREF(Py_None);
4258     __Pyx_GIVEREF(Py_None);
4259     PyTuple_SET_ITEM(__pyx_t_6, 2, Py_None);
4260     __pyx_t_2 = 0;
4261     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
4262     __Pyx_GOTREF(__pyx_t_2);
4263     __Pyx_GIVEREF(__pyx_t_1);
4264     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4265     __Pyx_GIVEREF(__pyx_t_6);
4266     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
4267     __Pyx_INCREF(__pyx_v_state);
4268     __Pyx_GIVEREF(__pyx_v_state);
4269     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
4270     __pyx_t_1 = 0;
4271     __pyx_t_6 = 0;
4272     __pyx_r = __pyx_t_2;
4273     __pyx_t_2 = 0;
4274     goto __pyx_L0;
4275 
4276     /* "(tree fragment)":12
4277  *     else:
4278  *         use_setstate = self._list is not None or self._table is not None
4279  *     if use_setstate:             # <<<<<<<<<<<<<<
4280  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, None), state
4281  *     else:
4282  */
4283   }
4284 
4285   /* "(tree fragment)":15
4286  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, None), state
4287  *     else:
4288  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, state)             # <<<<<<<<<<<<<<
4289  * def __setstate_cython__(self, __pyx_state):
4290  *     __pyx_unpickle_ListStringTable__set_state(self, __pyx_state)
4291  */
4292   /*else*/ {
4293     __Pyx_XDECREF(__pyx_r);
4294     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_ListStringTable); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
4295     __Pyx_GOTREF(__pyx_t_2);
4296     __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
4297     __Pyx_GOTREF(__pyx_t_6);
4298     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
4299     __Pyx_GOTREF(__pyx_t_1);
4300     __Pyx_GIVEREF(__pyx_t_6);
4301     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
4302     __Pyx_INCREF(__pyx_int_182609841);
4303     __Pyx_GIVEREF(__pyx_int_182609841);
4304     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_182609841);
4305     __Pyx_INCREF(__pyx_v_state);
4306     __Pyx_GIVEREF(__pyx_v_state);
4307     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
4308     __pyx_t_6 = 0;
4309     __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
4310     __Pyx_GOTREF(__pyx_t_6);
4311     __Pyx_GIVEREF(__pyx_t_2);
4312     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
4313     __Pyx_GIVEREF(__pyx_t_1);
4314     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
4315     __pyx_t_2 = 0;
4316     __pyx_t_1 = 0;
4317     __pyx_r = __pyx_t_6;
4318     __pyx_t_6 = 0;
4319     goto __pyx_L0;
4320   }
4321 
4322   /* "(tree fragment)":1
4323  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4324  *     cdef tuple state
4325  *     cdef object _dict
4326  */
4327 
4328   /* function exit code */
4329   __pyx_L1_error:;
4330   __Pyx_XDECREF(__pyx_t_1);
4331   __Pyx_XDECREF(__pyx_t_2);
4332   __Pyx_XDECREF(__pyx_t_6);
4333   __Pyx_AddTraceback("ddtrace.internal._encoding.ListStringTable.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4334   __pyx_r = NULL;
4335   __pyx_L0:;
4336   __Pyx_XDECREF(__pyx_v_state);
4337   __Pyx_XDECREF(__pyx_v__dict);
4338   __Pyx_XGIVEREF(__pyx_r);
4339   __Pyx_RefNannyFinishContext();
4340   return __pyx_r;
4341 }
4342 
4343 /* "(tree fragment)":16
4344  *     else:
4345  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, state)
4346  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4347  *     __pyx_unpickle_ListStringTable__set_state(self, __pyx_state)
4348  */
4349 
4350 /* Python wrapper */
4351 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4352 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4353   PyObject *__pyx_r = 0;
4354   __Pyx_RefNannyDeclarations
4355   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4356   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_6__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4357 
4358   /* function exit code */
4359   __Pyx_RefNannyFinishContext();
4360   return __pyx_r;
4361 }
4362 
__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_6__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v_self,PyObject * __pyx_v___pyx_state)4363 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15ListStringTable_6__setstate_cython__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4364   PyObject *__pyx_r = NULL;
4365   __Pyx_RefNannyDeclarations
4366   PyObject *__pyx_t_1 = NULL;
4367   int __pyx_lineno = 0;
4368   const char *__pyx_filename = NULL;
4369   int __pyx_clineno = 0;
4370   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4371 
4372   /* "(tree fragment)":17
4373  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, state)
4374  * def __setstate_cython__(self, __pyx_state):
4375  *     __pyx_unpickle_ListStringTable__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
4376  */
4377   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
4378   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_ListStringTable__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
4379   __Pyx_GOTREF(__pyx_t_1);
4380   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4381 
4382   /* "(tree fragment)":16
4383  *     else:
4384  *         return __pyx_unpickle_ListStringTable, (type(self), 0xae267b1, state)
4385  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4386  *     __pyx_unpickle_ListStringTable__set_state(self, __pyx_state)
4387  */
4388 
4389   /* function exit code */
4390   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4391   goto __pyx_L0;
4392   __pyx_L1_error:;
4393   __Pyx_XDECREF(__pyx_t_1);
4394   __Pyx_AddTraceback("ddtrace.internal._encoding.ListStringTable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4395   __pyx_r = NULL;
4396   __pyx_L0:;
4397   __Pyx_XGIVEREF(__pyx_r);
4398   __Pyx_RefNannyFinishContext();
4399   return __pyx_r;
4400 }
4401 
4402 /* "ddtrace/internal/_encoding.pyx":203
4403  *     cdef size_t _reset_size
4404  *
4405  *     def __init__(self, max_size):             # <<<<<<<<<<<<<<
4406  *         self.pk.buf_size = min(max_size, 1 << 20)
4407  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4408  */
4409 
4410 /* Python wrapper */
4411 static int __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4412 static int __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4413   PyObject *__pyx_v_max_size = 0;
4414   int __pyx_lineno = 0;
4415   const char *__pyx_filename = NULL;
4416   int __pyx_clineno = 0;
4417   int __pyx_r;
4418   __Pyx_RefNannyDeclarations
4419   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4420   {
4421     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_size,0};
4422     PyObject* values[1] = {0};
4423     if (unlikely(__pyx_kwds)) {
4424       Py_ssize_t kw_args;
4425       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4426       switch (pos_args) {
4427         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4428         CYTHON_FALLTHROUGH;
4429         case  0: break;
4430         default: goto __pyx_L5_argtuple_error;
4431       }
4432       kw_args = PyDict_Size(__pyx_kwds);
4433       switch (pos_args) {
4434         case  0:
4435         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_size)) != 0)) kw_args--;
4436         else goto __pyx_L5_argtuple_error;
4437       }
4438       if (unlikely(kw_args > 0)) {
4439         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 203, __pyx_L3_error)
4440       }
4441     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4442       goto __pyx_L5_argtuple_error;
4443     } else {
4444       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4445     }
4446     __pyx_v_max_size = values[0];
4447   }
4448   goto __pyx_L4_argument_unpacking_done;
4449   __pyx_L5_argtuple_error:;
4450   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error)
4451   __pyx_L3_error:;
4452   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4453   __Pyx_RefNannyFinishContext();
4454   return -1;
4455   __pyx_L4_argument_unpacking_done:;
4456   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable___init__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self), __pyx_v_max_size);
4457 
4458   /* function exit code */
4459   __Pyx_RefNannyFinishContext();
4460   return __pyx_r;
4461 }
4462 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self,PyObject * __pyx_v_max_size)4463 static int __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable___init__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, PyObject *__pyx_v_max_size) {
4464   int __pyx_r;
4465   __Pyx_RefNannyDeclarations
4466   long __pyx_t_1;
4467   PyObject *__pyx_t_2 = NULL;
4468   PyObject *__pyx_t_3 = NULL;
4469   PyObject *__pyx_t_4 = NULL;
4470   PyObject *__pyx_t_5 = NULL;
4471   int __pyx_t_6;
4472   size_t __pyx_t_7;
4473   int __pyx_t_8;
4474   int __pyx_lineno = 0;
4475   const char *__pyx_filename = NULL;
4476   int __pyx_clineno = 0;
4477   __Pyx_RefNannySetupContext("__init__", 0);
4478 
4479   /* "ddtrace/internal/_encoding.pyx":204
4480  *
4481  *     def __init__(self, max_size):
4482  *         self.pk.buf_size = min(max_size, 1 << 20)             # <<<<<<<<<<<<<<
4483  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4484  *         if self.pk.buf == NULL:
4485  */
4486   __pyx_t_1 = 0x100000;
4487   __Pyx_INCREF(__pyx_v_max_size);
4488   __pyx_t_2 = __pyx_v_max_size;
4489   __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
4490   __Pyx_GOTREF(__pyx_t_4);
4491   __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
4492   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4493   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
4494   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4495   if (__pyx_t_6) {
4496     __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
4497     __Pyx_GOTREF(__pyx_t_5);
4498     __pyx_t_3 = __pyx_t_5;
4499     __pyx_t_5 = 0;
4500   } else {
4501     __Pyx_INCREF(__pyx_t_2);
4502     __pyx_t_3 = __pyx_t_2;
4503   }
4504   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4505   __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error)
4506   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4507   __pyx_v_self->pk.buf_size = __pyx_t_7;
4508 
4509   /* "ddtrace/internal/_encoding.pyx":205
4510  *     def __init__(self, max_size):
4511  *         self.pk.buf_size = min(max_size, 1 << 20)
4512  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)             # <<<<<<<<<<<<<<
4513  *         if self.pk.buf == NULL:
4514  *             raise MemoryError("Unable to allocate internal buffer.")
4515  */
4516   __pyx_v_self->pk.buf = ((char *)PyMem_Malloc(__pyx_v_self->pk.buf_size));
4517 
4518   /* "ddtrace/internal/_encoding.pyx":206
4519  *         self.pk.buf_size = min(max_size, 1 << 20)
4520  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4521  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
4522  *             raise MemoryError("Unable to allocate internal buffer.")
4523  *         self.max_size = max_size
4524  */
4525   __pyx_t_6 = ((__pyx_v_self->pk.buf == NULL) != 0);
4526   if (unlikely(__pyx_t_6)) {
4527 
4528     /* "ddtrace/internal/_encoding.pyx":207
4529  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4530  *         if self.pk.buf == NULL:
4531  *             raise MemoryError("Unable to allocate internal buffer.")             # <<<<<<<<<<<<<<
4532  *         self.max_size = max_size
4533  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE
4534  */
4535     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error)
4536     __Pyx_GOTREF(__pyx_t_3);
4537     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4538     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4539     __PYX_ERR(0, 207, __pyx_L1_error)
4540 
4541     /* "ddtrace/internal/_encoding.pyx":206
4542  *         self.pk.buf_size = min(max_size, 1 << 20)
4543  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4544  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
4545  *             raise MemoryError("Unable to allocate internal buffer.")
4546  *         self.max_size = max_size
4547  */
4548   }
4549 
4550   /* "ddtrace/internal/_encoding.pyx":208
4551  *         if self.pk.buf == NULL:
4552  *             raise MemoryError("Unable to allocate internal buffer.")
4553  *         self.max_size = max_size             # <<<<<<<<<<<<<<
4554  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE
4555  *         self._sp_len = 0
4556  */
4557   __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error)
4558   __pyx_v_self->max_size = __pyx_t_8;
4559 
4560   /* "ddtrace/internal/_encoding.pyx":209
4561  *             raise MemoryError("Unable to allocate internal buffer.")
4562  *         self.max_size = max_size
4563  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE             # <<<<<<<<<<<<<<
4564  *         self._sp_len = 0
4565  *         self._lock = threading.RLock()
4566  */
4567   __pyx_v_self->pk.length = 6;
4568 
4569   /* "ddtrace/internal/_encoding.pyx":210
4570  *         self.max_size = max_size
4571  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE
4572  *         self._sp_len = 0             # <<<<<<<<<<<<<<
4573  *         self._lock = threading.RLock()
4574  *         super(MsgpackStringTable, self).__init__()
4575  */
4576   __pyx_v_self->_sp_len = 0;
4577 
4578   /* "ddtrace/internal/_encoding.pyx":211
4579  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE
4580  *         self._sp_len = 0
4581  *         self._lock = threading.RLock()             # <<<<<<<<<<<<<<
4582  *         super(MsgpackStringTable, self).__init__()
4583  *
4584  */
4585   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
4586   __Pyx_GOTREF(__pyx_t_2);
4587   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RLock); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
4588   __Pyx_GOTREF(__pyx_t_5);
4589   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4590   __pyx_t_2 = NULL;
4591   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4592     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
4593     if (likely(__pyx_t_2)) {
4594       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4595       __Pyx_INCREF(__pyx_t_2);
4596       __Pyx_INCREF(function);
4597       __Pyx_DECREF_SET(__pyx_t_5, function);
4598     }
4599   }
4600   __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
4601   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4602   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
4603   __Pyx_GOTREF(__pyx_t_3);
4604   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4605   __Pyx_GIVEREF(__pyx_t_3);
4606   __Pyx_GOTREF(__pyx_v_self->_lock);
4607   __Pyx_DECREF(__pyx_v_self->_lock);
4608   __pyx_v_self->_lock = __pyx_t_3;
4609   __pyx_t_3 = 0;
4610 
4611   /* "ddtrace/internal/_encoding.pyx":212
4612  *         self._sp_len = 0
4613  *         self._lock = threading.RLock()
4614  *         super(MsgpackStringTable, self).__init__()             # <<<<<<<<<<<<<<
4615  *
4616  *         assert self.index(ORIGIN_KEY) == 1
4617  */
4618   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
4619   __Pyx_GOTREF(__pyx_t_5);
4620   __Pyx_INCREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable));
4621   __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable));
4622   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable));
4623   __Pyx_INCREF(((PyObject *)__pyx_v_self));
4624   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4625   PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self));
4626   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
4627   __Pyx_GOTREF(__pyx_t_2);
4628   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4629   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
4630   __Pyx_GOTREF(__pyx_t_5);
4631   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4632   __pyx_t_2 = NULL;
4633   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
4634     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
4635     if (likely(__pyx_t_2)) {
4636       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4637       __Pyx_INCREF(__pyx_t_2);
4638       __Pyx_INCREF(function);
4639       __Pyx_DECREF_SET(__pyx_t_5, function);
4640     }
4641   }
4642   __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
4643   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4644   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
4645   __Pyx_GOTREF(__pyx_t_3);
4646   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4647   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4648 
4649   /* "ddtrace/internal/_encoding.pyx":214
4650  *         super(MsgpackStringTable, self).__init__()
4651  *
4652  *         assert self.index(ORIGIN_KEY) == 1             # <<<<<<<<<<<<<<
4653  *         self._reset_size = self.pk.length
4654  *
4655  */
4656   #ifndef CYTHON_WITHOUT_ASSERTIONS
4657   if (unlikely(!Py_OptimizeFlag)) {
4658     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ORIGIN_KEY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
4659     __Pyx_GOTREF(__pyx_t_3);
4660     __pyx_t_5 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self), __pyx_t_3, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error)
4661     __Pyx_GOTREF(__pyx_t_5);
4662     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4663     __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
4664     __Pyx_GOTREF(__pyx_t_3);
4665     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4666     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
4667     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4668     if (unlikely(!__pyx_t_6)) {
4669       PyErr_SetNone(PyExc_AssertionError);
4670       __PYX_ERR(0, 214, __pyx_L1_error)
4671     }
4672   }
4673   #endif
4674 
4675   /* "ddtrace/internal/_encoding.pyx":215
4676  *
4677  *         assert self.index(ORIGIN_KEY) == 1
4678  *         self._reset_size = self.pk.length             # <<<<<<<<<<<<<<
4679  *
4680  *     def __dealloc__(self):
4681  */
4682   __pyx_t_7 = __pyx_v_self->pk.length;
4683   __pyx_v_self->_reset_size = __pyx_t_7;
4684 
4685   /* "ddtrace/internal/_encoding.pyx":203
4686  *     cdef size_t _reset_size
4687  *
4688  *     def __init__(self, max_size):             # <<<<<<<<<<<<<<
4689  *         self.pk.buf_size = min(max_size, 1 << 20)
4690  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
4691  */
4692 
4693   /* function exit code */
4694   __pyx_r = 0;
4695   goto __pyx_L0;
4696   __pyx_L1_error:;
4697   __Pyx_XDECREF(__pyx_t_2);
4698   __Pyx_XDECREF(__pyx_t_3);
4699   __Pyx_XDECREF(__pyx_t_4);
4700   __Pyx_XDECREF(__pyx_t_5);
4701   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4702   __pyx_r = -1;
4703   __pyx_L0:;
4704   __Pyx_RefNannyFinishContext();
4705   return __pyx_r;
4706 }
4707 
4708 /* "ddtrace/internal/_encoding.pyx":217
4709  *         self._reset_size = self.pk.length
4710  *
4711  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
4712  *         PyMem_Free(self.pk.buf)
4713  *         self.pk.buf = NULL
4714  */
4715 
4716 /* Python wrapper */
4717 static void __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_3__dealloc__(PyObject * __pyx_v_self)4718 static void __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_3__dealloc__(PyObject *__pyx_v_self) {
4719   __Pyx_RefNannyDeclarations
4720   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
4721   __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_2__dealloc__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self));
4722 
4723   /* function exit code */
4724   __Pyx_RefNannyFinishContext();
4725 }
4726 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)4727 static void __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
4728   __Pyx_RefNannyDeclarations
4729   __Pyx_RefNannySetupContext("__dealloc__", 0);
4730 
4731   /* "ddtrace/internal/_encoding.pyx":218
4732  *
4733  *     def __dealloc__(self):
4734  *         PyMem_Free(self.pk.buf)             # <<<<<<<<<<<<<<
4735  *         self.pk.buf = NULL
4736  *
4737  */
4738   PyMem_Free(__pyx_v_self->pk.buf);
4739 
4740   /* "ddtrace/internal/_encoding.pyx":219
4741  *     def __dealloc__(self):
4742  *         PyMem_Free(self.pk.buf)
4743  *         self.pk.buf = NULL             # <<<<<<<<<<<<<<
4744  *
4745  *     cdef insert(self, object string):
4746  */
4747   __pyx_v_self->pk.buf = NULL;
4748 
4749   /* "ddtrace/internal/_encoding.pyx":217
4750  *         self._reset_size = self.pk.length
4751  *
4752  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
4753  *         PyMem_Free(self.pk.buf)
4754  *         self.pk.buf = NULL
4755  */
4756 
4757   /* function exit code */
4758   __Pyx_RefNannyFinishContext();
4759 }
4760 
4761 /* "ddtrace/internal/_encoding.pyx":221
4762  *         self.pk.buf = NULL
4763  *
4764  *     cdef insert(self, object string):             # <<<<<<<<<<<<<<
4765  *         cdef int ret
4766  *
4767  */
4768 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self,PyObject * __pyx_v_string)4769 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_insert(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, PyObject *__pyx_v_string) {
4770   int __pyx_v_ret;
4771   PyObject *__pyx_r = NULL;
4772   __Pyx_RefNannyDeclarations
4773   Py_ssize_t __pyx_t_1;
4774   int __pyx_t_2;
4775   PyObject *__pyx_t_3 = NULL;
4776   PyObject *__pyx_t_4 = NULL;
4777   PyObject *__pyx_t_5 = NULL;
4778   int __pyx_t_6;
4779   int __pyx_lineno = 0;
4780   const char *__pyx_filename = NULL;
4781   int __pyx_clineno = 0;
4782   __Pyx_RefNannySetupContext("insert", 0);
4783 
4784   /* "ddtrace/internal/_encoding.pyx":224
4785  *         cdef int ret
4786  *
4787  *         if self.pk.length + len(string) > self.max_size:             # <<<<<<<<<<<<<<
4788  *             raise ValueError(
4789  *                 "Cannot insert '%s': string table is full (current size: %d, max size: %d)." % (
4790  */
4791   __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
4792   __pyx_t_2 = (((__pyx_v_self->pk.length + __pyx_t_1) > __pyx_v_self->max_size) != 0);
4793   if (unlikely(__pyx_t_2)) {
4794 
4795     /* "ddtrace/internal/_encoding.pyx":227
4796  *             raise ValueError(
4797  *                 "Cannot insert '%s': string table is full (current size: %d, max size: %d)." % (
4798  *                     string, self.pk.length, self.max_size             # <<<<<<<<<<<<<<
4799  *                 )
4800  *             )
4801  */
4802     __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_self->pk.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
4803     __Pyx_GOTREF(__pyx_t_3);
4804     __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->max_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
4805     __Pyx_GOTREF(__pyx_t_4);
4806     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
4807     __Pyx_GOTREF(__pyx_t_5);
4808     __Pyx_INCREF(__pyx_v_string);
4809     __Pyx_GIVEREF(__pyx_v_string);
4810     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_string);
4811     __Pyx_GIVEREF(__pyx_t_3);
4812     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
4813     __Pyx_GIVEREF(__pyx_t_4);
4814     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
4815     __pyx_t_3 = 0;
4816     __pyx_t_4 = 0;
4817 
4818     /* "ddtrace/internal/_encoding.pyx":226
4819  *         if self.pk.length + len(string) > self.max_size:
4820  *             raise ValueError(
4821  *                 "Cannot insert '%s': string table is full (current size: %d, max size: %d)." % (             # <<<<<<<<<<<<<<
4822  *                     string, self.pk.length, self.max_size
4823  *                 )
4824  */
4825     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_insert_s_string_table_is, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
4826     __Pyx_GOTREF(__pyx_t_4);
4827     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4828 
4829     /* "ddtrace/internal/_encoding.pyx":225
4830  *
4831  *         if self.pk.length + len(string) > self.max_size:
4832  *             raise ValueError(             # <<<<<<<<<<<<<<
4833  *                 "Cannot insert '%s': string table is full (current size: %d, max size: %d)." % (
4834  *                     string, self.pk.length, self.max_size
4835  */
4836     __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error)
4837     __Pyx_GOTREF(__pyx_t_5);
4838     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4839     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
4840     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4841     __PYX_ERR(0, 225, __pyx_L1_error)
4842 
4843     /* "ddtrace/internal/_encoding.pyx":224
4844  *         cdef int ret
4845  *
4846  *         if self.pk.length + len(string) > self.max_size:             # <<<<<<<<<<<<<<
4847  *             raise ValueError(
4848  *                 "Cannot insert '%s': string table is full (current size: %d, max size: %d)." % (
4849  */
4850   }
4851 
4852   /* "ddtrace/internal/_encoding.pyx":231
4853  *             )
4854  *
4855  *         ret = pack_text(&self.pk, string)             # <<<<<<<<<<<<<<
4856  *         if ret != 0:
4857  *             raise RuntimeError("Failed to add string to msgpack string table")
4858  */
4859   __pyx_t_6 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->pk), __pyx_v_string); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
4860   __pyx_v_ret = __pyx_t_6;
4861 
4862   /* "ddtrace/internal/_encoding.pyx":232
4863  *
4864  *         ret = pack_text(&self.pk, string)
4865  *         if ret != 0:             # <<<<<<<<<<<<<<
4866  *             raise RuntimeError("Failed to add string to msgpack string table")
4867  *
4868  */
4869   __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
4870   if (unlikely(__pyx_t_2)) {
4871 
4872     /* "ddtrace/internal/_encoding.pyx":233
4873  *         ret = pack_text(&self.pk, string)
4874  *         if ret != 0:
4875  *             raise RuntimeError("Failed to add string to msgpack string table")             # <<<<<<<<<<<<<<
4876  *
4877  *     cdef savepoint(self):
4878  */
4879     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
4880     __Pyx_GOTREF(__pyx_t_5);
4881     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
4882     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4883     __PYX_ERR(0, 233, __pyx_L1_error)
4884 
4885     /* "ddtrace/internal/_encoding.pyx":232
4886  *
4887  *         ret = pack_text(&self.pk, string)
4888  *         if ret != 0:             # <<<<<<<<<<<<<<
4889  *             raise RuntimeError("Failed to add string to msgpack string table")
4890  *
4891  */
4892   }
4893 
4894   /* "ddtrace/internal/_encoding.pyx":221
4895  *         self.pk.buf = NULL
4896  *
4897  *     cdef insert(self, object string):             # <<<<<<<<<<<<<<
4898  *         cdef int ret
4899  *
4900  */
4901 
4902   /* function exit code */
4903   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4904   goto __pyx_L0;
4905   __pyx_L1_error:;
4906   __Pyx_XDECREF(__pyx_t_3);
4907   __Pyx_XDECREF(__pyx_t_4);
4908   __Pyx_XDECREF(__pyx_t_5);
4909   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
4910   __pyx_r = 0;
4911   __pyx_L0:;
4912   __Pyx_XGIVEREF(__pyx_r);
4913   __Pyx_RefNannyFinishContext();
4914   return __pyx_r;
4915 }
4916 
4917 /* "ddtrace/internal/_encoding.pyx":235
4918  *             raise RuntimeError("Failed to add string to msgpack string table")
4919  *
4920  *     cdef savepoint(self):             # <<<<<<<<<<<<<<
4921  *         self._sp_len = self.pk.length
4922  *         self._sp_id = self._next_id
4923  */
4924 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_savepoint(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)4925 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_savepoint(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
4926   PyObject *__pyx_r = NULL;
4927   __Pyx_RefNannyDeclarations
4928   size_t __pyx_t_1;
4929   uint32_t __pyx_t_2;
4930   __Pyx_RefNannySetupContext("savepoint", 0);
4931 
4932   /* "ddtrace/internal/_encoding.pyx":236
4933  *
4934  *     cdef savepoint(self):
4935  *         self._sp_len = self.pk.length             # <<<<<<<<<<<<<<
4936  *         self._sp_id = self._next_id
4937  *
4938  */
4939   __pyx_t_1 = __pyx_v_self->pk.length;
4940   __pyx_v_self->_sp_len = __pyx_t_1;
4941 
4942   /* "ddtrace/internal/_encoding.pyx":237
4943  *     cdef savepoint(self):
4944  *         self._sp_len = self.pk.length
4945  *         self._sp_id = self._next_id             # <<<<<<<<<<<<<<
4946  *
4947  *     cdef rollback(self):
4948  */
4949   __pyx_t_2 = __pyx_v_self->__pyx_base._next_id;
4950   __pyx_v_self->_sp_id = __pyx_t_2;
4951 
4952   /* "ddtrace/internal/_encoding.pyx":235
4953  *             raise RuntimeError("Failed to add string to msgpack string table")
4954  *
4955  *     cdef savepoint(self):             # <<<<<<<<<<<<<<
4956  *         self._sp_len = self.pk.length
4957  *         self._sp_id = self._next_id
4958  */
4959 
4960   /* function exit code */
4961   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4962   __Pyx_XGIVEREF(__pyx_r);
4963   __Pyx_RefNannyFinishContext();
4964   return __pyx_r;
4965 }
4966 
4967 /* "ddtrace/internal/_encoding.pyx":239
4968  *         self._sp_id = self._next_id
4969  *
4970  *     cdef rollback(self):             # <<<<<<<<<<<<<<
4971  *         if self._sp_len > 0:
4972  *             self.pk.length = self._sp_len
4973  */
4974 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_rollback(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)4975 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_rollback(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
4976   PyObject *__pyx_r = NULL;
4977   __Pyx_RefNannyDeclarations
4978   int __pyx_t_1;
4979   int __pyx_t_2;
4980   uint32_t __pyx_t_3;
4981   __Pyx_RefNannySetupContext("rollback", 0);
4982 
4983   /* "ddtrace/internal/_encoding.pyx":240
4984  *
4985  *     cdef rollback(self):
4986  *         if self._sp_len > 0:             # <<<<<<<<<<<<<<
4987  *             self.pk.length = self._sp_len
4988  *             self._next_id = self._sp_id
4989  */
4990   __pyx_t_1 = ((__pyx_v_self->_sp_len > 0) != 0);
4991   if (__pyx_t_1) {
4992 
4993     /* "ddtrace/internal/_encoding.pyx":241
4994  *     cdef rollback(self):
4995  *         if self._sp_len > 0:
4996  *             self.pk.length = self._sp_len             # <<<<<<<<<<<<<<
4997  *             self._next_id = self._sp_id
4998  *
4999  */
5000     __pyx_t_2 = __pyx_v_self->_sp_len;
5001     __pyx_v_self->pk.length = __pyx_t_2;
5002 
5003     /* "ddtrace/internal/_encoding.pyx":242
5004  *         if self._sp_len > 0:
5005  *             self.pk.length = self._sp_len
5006  *             self._next_id = self._sp_id             # <<<<<<<<<<<<<<
5007  *
5008  *     cdef get_bytes(self):
5009  */
5010     __pyx_t_3 = __pyx_v_self->_sp_id;
5011     __pyx_v_self->__pyx_base._next_id = __pyx_t_3;
5012 
5013     /* "ddtrace/internal/_encoding.pyx":240
5014  *
5015  *     cdef rollback(self):
5016  *         if self._sp_len > 0:             # <<<<<<<<<<<<<<
5017  *             self.pk.length = self._sp_len
5018  *             self._next_id = self._sp_id
5019  */
5020   }
5021 
5022   /* "ddtrace/internal/_encoding.pyx":239
5023  *         self._sp_id = self._next_id
5024  *
5025  *     cdef rollback(self):             # <<<<<<<<<<<<<<
5026  *         if self._sp_len > 0:
5027  *             self.pk.length = self._sp_len
5028  */
5029 
5030   /* function exit code */
5031   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5032   __Pyx_XGIVEREF(__pyx_r);
5033   __Pyx_RefNannyFinishContext();
5034   return __pyx_r;
5035 }
5036 
5037 /* "ddtrace/internal/_encoding.pyx":244
5038  *             self._next_id = self._sp_id
5039  *
5040  *     cdef get_bytes(self):             # <<<<<<<<<<<<<<
5041  *         cdef int ret;
5042  *         cdef stdint.uint32_t l = self._next_id
5043  */
5044 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)5045 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
5046   int __pyx_v_ret;
5047   uint32_t __pyx_v_l;
5048   int __pyx_v_offset;
5049   int __pyx_v_old_pos;
5050   PyObject *__pyx_r = NULL;
5051   __Pyx_RefNannyDeclarations
5052   uint32_t __pyx_t_1;
5053   size_t __pyx_t_2;
5054   PyObject *__pyx_t_3 = NULL;
5055   PyObject *__pyx_t_4 = NULL;
5056   PyObject *__pyx_t_5 = NULL;
5057   PyObject *__pyx_t_6 = NULL;
5058   PyObject *__pyx_t_7 = NULL;
5059   PyObject *__pyx_t_8 = NULL;
5060   PyObject *__pyx_t_9 = NULL;
5061   int __pyx_t_10;
5062   long __pyx_t_11;
5063   int __pyx_lineno = 0;
5064   const char *__pyx_filename = NULL;
5065   int __pyx_clineno = 0;
5066   __Pyx_RefNannySetupContext("get_bytes", 0);
5067 
5068   /* "ddtrace/internal/_encoding.pyx":246
5069  *     cdef get_bytes(self):
5070  *         cdef int ret;
5071  *         cdef stdint.uint32_t l = self._next_id             # <<<<<<<<<<<<<<
5072  *         cdef int offset = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE - array_prefix_size(l)
5073  *         cdef int old_pos = self.pk.length
5074  */
5075   __pyx_t_1 = __pyx_v_self->__pyx_base._next_id;
5076   __pyx_v_l = __pyx_t_1;
5077 
5078   /* "ddtrace/internal/_encoding.pyx":247
5079  *         cdef int ret;
5080  *         cdef stdint.uint32_t l = self._next_id
5081  *         cdef int offset = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE - array_prefix_size(l)             # <<<<<<<<<<<<<<
5082  *         cdef int old_pos = self.pk.length
5083  *
5084  */
5085   __pyx_v_offset = (6 - __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(__pyx_v_l));
5086 
5087   /* "ddtrace/internal/_encoding.pyx":248
5088  *         cdef stdint.uint32_t l = self._next_id
5089  *         cdef int offset = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE - array_prefix_size(l)
5090  *         cdef int old_pos = self.pk.length             # <<<<<<<<<<<<<<
5091  *
5092  *         with self._lock:
5093  */
5094   __pyx_t_2 = __pyx_v_self->pk.length;
5095   __pyx_v_old_pos = __pyx_t_2;
5096 
5097   /* "ddtrace/internal/_encoding.pyx":250
5098  *         cdef int old_pos = self.pk.length
5099  *
5100  *         with self._lock:             # <<<<<<<<<<<<<<
5101  *             # Update table size prefix
5102  *             self.pk.length = offset
5103  */
5104   /*with:*/ {
5105     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
5106     __Pyx_GOTREF(__pyx_t_3);
5107     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L3_error)
5108     __Pyx_GOTREF(__pyx_t_5);
5109     __pyx_t_6 = NULL;
5110     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5111       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5112       if (likely(__pyx_t_6)) {
5113         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5114         __Pyx_INCREF(__pyx_t_6);
5115         __Pyx_INCREF(function);
5116         __Pyx_DECREF_SET(__pyx_t_5, function);
5117       }
5118     }
5119     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5120     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5121     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L3_error)
5122     __Pyx_GOTREF(__pyx_t_4);
5123     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5124     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5125     /*try:*/ {
5126       {
5127         (void)__pyx_t_7; (void)__pyx_t_8; (void)__pyx_t_9; /* mark used */
5128         /*try:*/ {
5129 
5130           /* "ddtrace/internal/_encoding.pyx":252
5131  *         with self._lock:
5132  *             # Update table size prefix
5133  *             self.pk.length = offset             # <<<<<<<<<<<<<<
5134  *             ret = msgpack_pack_array(&self.pk, l)
5135  *             if ret:
5136  */
5137           __pyx_v_self->pk.length = __pyx_v_offset;
5138 
5139           /* "ddtrace/internal/_encoding.pyx":253
5140  *             # Update table size prefix
5141  *             self.pk.length = offset
5142  *             ret = msgpack_pack_array(&self.pk, l)             # <<<<<<<<<<<<<<
5143  *             if ret:
5144  *                 return None
5145  */
5146           __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_l);
5147 
5148           /* "ddtrace/internal/_encoding.pyx":254
5149  *             self.pk.length = offset
5150  *             ret = msgpack_pack_array(&self.pk, l)
5151  *             if ret:             # <<<<<<<<<<<<<<
5152  *                 return None
5153  *             # Add root array size prefix
5154  */
5155           __pyx_t_10 = (__pyx_v_ret != 0);
5156           if (__pyx_t_10) {
5157 
5158             /* "ddtrace/internal/_encoding.pyx":255
5159  *             ret = msgpack_pack_array(&self.pk, l)
5160  *             if ret:
5161  *                 return None             # <<<<<<<<<<<<<<
5162  *             # Add root array size prefix
5163  *             self.pk.length = offset = offset - 1
5164  */
5165             __Pyx_XDECREF(__pyx_r);
5166             __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5167             goto __pyx_L11_try_return;
5168 
5169             /* "ddtrace/internal/_encoding.pyx":254
5170  *             self.pk.length = offset
5171  *             ret = msgpack_pack_array(&self.pk, l)
5172  *             if ret:             # <<<<<<<<<<<<<<
5173  *                 return None
5174  *             # Add root array size prefix
5175  */
5176           }
5177 
5178           /* "ddtrace/internal/_encoding.pyx":257
5179  *                 return None
5180  *             # Add root array size prefix
5181  *             self.pk.length = offset = offset - 1             # <<<<<<<<<<<<<<
5182  *             ret = msgpack_pack_array(&self.pk, 2)
5183  *             if ret:
5184  */
5185           __pyx_t_11 = (__pyx_v_offset - 1);
5186           __pyx_v_self->pk.length = __pyx_t_11;
5187           __pyx_v_offset = __pyx_t_11;
5188 
5189           /* "ddtrace/internal/_encoding.pyx":258
5190  *             # Add root array size prefix
5191  *             self.pk.length = offset = offset - 1
5192  *             ret = msgpack_pack_array(&self.pk, 2)             # <<<<<<<<<<<<<<
5193  *             if ret:
5194  *                 return None
5195  */
5196           __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), 2);
5197 
5198           /* "ddtrace/internal/_encoding.pyx":259
5199  *             self.pk.length = offset = offset - 1
5200  *             ret = msgpack_pack_array(&self.pk, 2)
5201  *             if ret:             # <<<<<<<<<<<<<<
5202  *                 return None
5203  *             self.pk.length = old_pos
5204  */
5205           __pyx_t_10 = (__pyx_v_ret != 0);
5206           if (__pyx_t_10) {
5207 
5208             /* "ddtrace/internal/_encoding.pyx":260
5209  *             ret = msgpack_pack_array(&self.pk, 2)
5210  *             if ret:
5211  *                 return None             # <<<<<<<<<<<<<<
5212  *             self.pk.length = old_pos
5213  *
5214  */
5215             __Pyx_XDECREF(__pyx_r);
5216             __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5217             goto __pyx_L11_try_return;
5218 
5219             /* "ddtrace/internal/_encoding.pyx":259
5220  *             self.pk.length = offset = offset - 1
5221  *             ret = msgpack_pack_array(&self.pk, 2)
5222  *             if ret:             # <<<<<<<<<<<<<<
5223  *                 return None
5224  *             self.pk.length = old_pos
5225  */
5226           }
5227 
5228           /* "ddtrace/internal/_encoding.pyx":261
5229  *             if ret:
5230  *                 return None
5231  *             self.pk.length = old_pos             # <<<<<<<<<<<<<<
5232  *
5233  *         return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
5234  */
5235           __pyx_v_self->pk.length = __pyx_v_old_pos;
5236 
5237           /* "ddtrace/internal/_encoding.pyx":250
5238  *         cdef int old_pos = self.pk.length
5239  *
5240  *         with self._lock:             # <<<<<<<<<<<<<<
5241  *             # Update table size prefix
5242  *             self.pk.length = offset
5243  */
5244         }
5245         goto __pyx_L12_try_end;
5246         __pyx_L11_try_return:;
5247         goto __pyx_L4_return;
5248         __pyx_L12_try_end:;
5249       }
5250     }
5251     /*finally:*/ {
5252       /*normal exit:*/{
5253         if (__pyx_t_3) {
5254           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__6, NULL);
5255           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5256           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 250, __pyx_L1_error)
5257           __Pyx_GOTREF(__pyx_t_9);
5258           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5259         }
5260         goto __pyx_L6;
5261       }
5262       __pyx_L4_return: {
5263         __pyx_t_9 = __pyx_r;
5264         __pyx_r = 0;
5265         if (__pyx_t_3) {
5266           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__6, NULL);
5267           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5268           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 250, __pyx_L1_error)
5269           __Pyx_GOTREF(__pyx_t_8);
5270           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5271         }
5272         __pyx_r = __pyx_t_9;
5273         __pyx_t_9 = 0;
5274         goto __pyx_L0;
5275       }
5276       __pyx_L6:;
5277     }
5278     goto __pyx_L15;
5279     __pyx_L3_error:;
5280     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5281     goto __pyx_L1_error;
5282     __pyx_L15:;
5283   }
5284 
5285   /* "ddtrace/internal/_encoding.pyx":263
5286  *             self.pk.length = old_pos
5287  *
5288  *         return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)             # <<<<<<<<<<<<<<
5289  *
5290  *     @property
5291  */
5292   __Pyx_XDECREF(__pyx_r);
5293   __pyx_t_4 = PyBytes_FromStringAndSize((__pyx_v_self->pk.buf + __pyx_v_offset), (__pyx_v_self->pk.length - __pyx_v_offset)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error)
5294   __Pyx_GOTREF(__pyx_t_4);
5295   __pyx_r = __pyx_t_4;
5296   __pyx_t_4 = 0;
5297   goto __pyx_L0;
5298 
5299   /* "ddtrace/internal/_encoding.pyx":244
5300  *             self._next_id = self._sp_id
5301  *
5302  *     cdef get_bytes(self):             # <<<<<<<<<<<<<<
5303  *         cdef int ret;
5304  *         cdef stdint.uint32_t l = self._next_id
5305  */
5306 
5307   /* function exit code */
5308   __pyx_L1_error:;
5309   __Pyx_XDECREF(__pyx_t_4);
5310   __Pyx_XDECREF(__pyx_t_5);
5311   __Pyx_XDECREF(__pyx_t_6);
5312   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.get_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5313   __pyx_r = 0;
5314   __pyx_L0:;
5315   __Pyx_XGIVEREF(__pyx_r);
5316   __Pyx_RefNannyFinishContext();
5317   return __pyx_r;
5318 }
5319 
5320 /* "ddtrace/internal/_encoding.pyx":266
5321  *
5322  *     @property
5323  *     def size(self):             # <<<<<<<<<<<<<<
5324  *         with self._lock:
5325  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5326  */
5327 
5328 /* Python wrapper */
5329 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size_1__get__(PyObject * __pyx_v_self)5330 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size_1__get__(PyObject *__pyx_v_self) {
5331   PyObject *__pyx_r = 0;
5332   __Pyx_RefNannyDeclarations
5333   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5334   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self));
5335 
5336   /* function exit code */
5337   __Pyx_RefNannyFinishContext();
5338   return __pyx_r;
5339 }
5340 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)5341 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
5342   PyObject *__pyx_r = NULL;
5343   __Pyx_RefNannyDeclarations
5344   PyObject *__pyx_t_1 = NULL;
5345   PyObject *__pyx_t_2 = NULL;
5346   PyObject *__pyx_t_3 = NULL;
5347   PyObject *__pyx_t_4 = NULL;
5348   PyObject *__pyx_t_5 = NULL;
5349   PyObject *__pyx_t_6 = NULL;
5350   PyObject *__pyx_t_7 = NULL;
5351   PyObject *__pyx_t_8 = NULL;
5352   PyObject *__pyx_t_9 = NULL;
5353   int __pyx_t_10;
5354   int __pyx_t_11;
5355   int __pyx_lineno = 0;
5356   const char *__pyx_filename = NULL;
5357   int __pyx_clineno = 0;
5358   __Pyx_RefNannySetupContext("__get__", 0);
5359 
5360   /* "ddtrace/internal/_encoding.pyx":267
5361  *     @property
5362  *     def size(self):
5363  *         with self._lock:             # <<<<<<<<<<<<<<
5364  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5365  *
5366  */
5367   /*with:*/ {
5368     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
5369     __Pyx_GOTREF(__pyx_t_1);
5370     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L3_error)
5371     __Pyx_GOTREF(__pyx_t_3);
5372     __pyx_t_4 = NULL;
5373     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
5374       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5375       if (likely(__pyx_t_4)) {
5376         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5377         __Pyx_INCREF(__pyx_t_4);
5378         __Pyx_INCREF(function);
5379         __Pyx_DECREF_SET(__pyx_t_3, function);
5380       }
5381     }
5382     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5383     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5384     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L3_error)
5385     __Pyx_GOTREF(__pyx_t_2);
5386     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5387     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5388     /*try:*/ {
5389       {
5390         __Pyx_PyThreadState_declare
5391         __Pyx_PyThreadState_assign
5392         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
5393         __Pyx_XGOTREF(__pyx_t_5);
5394         __Pyx_XGOTREF(__pyx_t_6);
5395         __Pyx_XGOTREF(__pyx_t_7);
5396         /*try:*/ {
5397 
5398           /* "ddtrace/internal/_encoding.pyx":268
5399  *     def size(self):
5400  *         with self._lock:
5401  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)             # <<<<<<<<<<<<<<
5402  *
5403  *     cdef append_raw(self, long src, Py_ssize_t size):
5404  */
5405           __Pyx_XDECREF(__pyx_r);
5406           __pyx_t_2 = __Pyx_PyInt_FromSize_t(((__pyx_v_self->pk.length - 5) + __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(__pyx_v_self->__pyx_base._next_id))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L7_error)
5407           __Pyx_GOTREF(__pyx_t_2);
5408           __pyx_r = __pyx_t_2;
5409           __pyx_t_2 = 0;
5410           goto __pyx_L11_try_return;
5411 
5412           /* "ddtrace/internal/_encoding.pyx":267
5413  *     @property
5414  *     def size(self):
5415  *         with self._lock:             # <<<<<<<<<<<<<<
5416  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5417  *
5418  */
5419         }
5420         __pyx_L7_error:;
5421         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5422         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5423         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5424         /*except:*/ {
5425           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5426           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 267, __pyx_L9_except_error)
5427           __Pyx_GOTREF(__pyx_t_2);
5428           __Pyx_GOTREF(__pyx_t_3);
5429           __Pyx_GOTREF(__pyx_t_4);
5430           __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 267, __pyx_L9_except_error)
5431           __Pyx_GOTREF(__pyx_t_8);
5432           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL);
5433           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5434           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5435           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 267, __pyx_L9_except_error)
5436           __Pyx_GOTREF(__pyx_t_9);
5437           __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
5438           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5439           if (__pyx_t_10 < 0) __PYX_ERR(0, 267, __pyx_L9_except_error)
5440           __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
5441           if (__pyx_t_11) {
5442             __Pyx_GIVEREF(__pyx_t_2);
5443             __Pyx_GIVEREF(__pyx_t_3);
5444             __Pyx_XGIVEREF(__pyx_t_4);
5445             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4);
5446             __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
5447             __PYX_ERR(0, 267, __pyx_L9_except_error)
5448           }
5449           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5450           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5451           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5452           goto __pyx_L8_exception_handled;
5453         }
5454         __pyx_L9_except_error:;
5455         __Pyx_XGIVEREF(__pyx_t_5);
5456         __Pyx_XGIVEREF(__pyx_t_6);
5457         __Pyx_XGIVEREF(__pyx_t_7);
5458         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
5459         goto __pyx_L1_error;
5460         __pyx_L11_try_return:;
5461         __Pyx_XGIVEREF(__pyx_t_5);
5462         __Pyx_XGIVEREF(__pyx_t_6);
5463         __Pyx_XGIVEREF(__pyx_t_7);
5464         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
5465         goto __pyx_L4_return;
5466         __pyx_L8_exception_handled:;
5467         __Pyx_XGIVEREF(__pyx_t_5);
5468         __Pyx_XGIVEREF(__pyx_t_6);
5469         __Pyx_XGIVEREF(__pyx_t_7);
5470         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
5471       }
5472     }
5473     /*finally:*/ {
5474       /*normal exit:*/{
5475         if (__pyx_t_1) {
5476           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
5477           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5478           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 267, __pyx_L1_error)
5479           __Pyx_GOTREF(__pyx_t_7);
5480           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5481         }
5482         goto __pyx_L6;
5483       }
5484       __pyx_L4_return: {
5485         __pyx_t_7 = __pyx_r;
5486         __pyx_r = 0;
5487         if (__pyx_t_1) {
5488           __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
5489           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5490           if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error)
5491           __Pyx_GOTREF(__pyx_t_6);
5492           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5493         }
5494         __pyx_r = __pyx_t_7;
5495         __pyx_t_7 = 0;
5496         goto __pyx_L0;
5497       }
5498       __pyx_L6:;
5499     }
5500     goto __pyx_L16;
5501     __pyx_L3_error:;
5502     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5503     goto __pyx_L1_error;
5504     __pyx_L16:;
5505   }
5506 
5507   /* "ddtrace/internal/_encoding.pyx":266
5508  *
5509  *     @property
5510  *     def size(self):             # <<<<<<<<<<<<<<
5511  *         with self._lock:
5512  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5513  */
5514 
5515   /* function exit code */
5516   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5517   goto __pyx_L0;
5518   __pyx_L1_error:;
5519   __Pyx_XDECREF(__pyx_t_2);
5520   __Pyx_XDECREF(__pyx_t_3);
5521   __Pyx_XDECREF(__pyx_t_4);
5522   __Pyx_XDECREF(__pyx_t_8);
5523   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5524   __pyx_r = NULL;
5525   __pyx_L0:;
5526   __Pyx_XGIVEREF(__pyx_r);
5527   __Pyx_RefNannyFinishContext();
5528   return __pyx_r;
5529 }
5530 
5531 /* "ddtrace/internal/_encoding.pyx":270
5532  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5533  *
5534  *     cdef append_raw(self, long src, Py_ssize_t size):             # <<<<<<<<<<<<<<
5535  *         cdef int res
5536  *         with self._lock:
5537  */
5538 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_append_raw(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self,long __pyx_v_src,Py_ssize_t __pyx_v_size)5539 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_append_raw(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, long __pyx_v_src, Py_ssize_t __pyx_v_size) {
5540   int __pyx_v_res;
5541   PyObject *__pyx_r = NULL;
5542   __Pyx_RefNannyDeclarations
5543   PyObject *__pyx_t_1 = NULL;
5544   PyObject *__pyx_t_2 = NULL;
5545   PyObject *__pyx_t_3 = NULL;
5546   PyObject *__pyx_t_4 = NULL;
5547   PyObject *__pyx_t_5 = NULL;
5548   PyObject *__pyx_t_6 = NULL;
5549   PyObject *__pyx_t_7 = NULL;
5550   int __pyx_t_8;
5551   long __pyx_t_9;
5552   PyObject *__pyx_t_10 = NULL;
5553   PyObject *__pyx_t_11 = NULL;
5554   int __pyx_t_12;
5555   int __pyx_lineno = 0;
5556   const char *__pyx_filename = NULL;
5557   int __pyx_clineno = 0;
5558   __Pyx_RefNannySetupContext("append_raw", 0);
5559 
5560   /* "ddtrace/internal/_encoding.pyx":272
5561  *     cdef append_raw(self, long src, Py_ssize_t size):
5562  *         cdef int res
5563  *         with self._lock:             # <<<<<<<<<<<<<<
5564  *             assert self.size + size <= self.max_size
5565  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5566  */
5567   /*with:*/ {
5568     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
5569     __Pyx_GOTREF(__pyx_t_1);
5570     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L3_error)
5571     __Pyx_GOTREF(__pyx_t_3);
5572     __pyx_t_4 = NULL;
5573     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
5574       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5575       if (likely(__pyx_t_4)) {
5576         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5577         __Pyx_INCREF(__pyx_t_4);
5578         __Pyx_INCREF(function);
5579         __Pyx_DECREF_SET(__pyx_t_3, function);
5580       }
5581     }
5582     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5583     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5584     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L3_error)
5585     __Pyx_GOTREF(__pyx_t_2);
5586     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5587     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5588     /*try:*/ {
5589       {
5590         __Pyx_PyThreadState_declare
5591         __Pyx_PyThreadState_assign
5592         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
5593         __Pyx_XGOTREF(__pyx_t_5);
5594         __Pyx_XGOTREF(__pyx_t_6);
5595         __Pyx_XGOTREF(__pyx_t_7);
5596         /*try:*/ {
5597 
5598           /* "ddtrace/internal/_encoding.pyx":273
5599  *         cdef int res
5600  *         with self._lock:
5601  *             assert self.size + size <= self.max_size             # <<<<<<<<<<<<<<
5602  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5603  *             if res != 0:
5604  */
5605           #ifndef CYTHON_WITHOUT_ASSERTIONS
5606           if (unlikely(!Py_OptimizeFlag)) {
5607             __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L7_error)
5608             __Pyx_GOTREF(__pyx_t_2);
5609             __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L7_error)
5610             __Pyx_GOTREF(__pyx_t_3);
5611             __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L7_error)
5612             __Pyx_GOTREF(__pyx_t_4);
5613             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5614             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5615             __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->max_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L7_error)
5616             __Pyx_GOTREF(__pyx_t_3);
5617             __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L7_error)
5618             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5619             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5620             __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 273, __pyx_L7_error)
5621             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5622             if (unlikely(!__pyx_t_8)) {
5623               PyErr_SetNone(PyExc_AssertionError);
5624               __PYX_ERR(0, 273, __pyx_L7_error)
5625             }
5626           }
5627           #endif
5628 
5629           /* "ddtrace/internal/_encoding.pyx":274
5630  *         with self._lock:
5631  *             assert self.size + size <= self.max_size
5632  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)             # <<<<<<<<<<<<<<
5633  *             if res != 0:
5634  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")
5635  */
5636           __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_src); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L7_error)
5637           __Pyx_GOTREF(__pyx_t_2);
5638           __pyx_t_9 = PyLong_AsLong(__pyx_t_2); if (unlikely(__pyx_t_9 == ((long)-1L) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L7_error)
5639           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5640           __pyx_v_res = msgpack_pack_raw_body((&__pyx_v_self->pk), ((char *)__pyx_t_9), __pyx_v_size);
5641 
5642           /* "ddtrace/internal/_encoding.pyx":275
5643  *             assert self.size + size <= self.max_size
5644  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5645  *             if res != 0:             # <<<<<<<<<<<<<<
5646  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")
5647  *
5648  */
5649           __pyx_t_8 = ((__pyx_v_res != 0) != 0);
5650           if (unlikely(__pyx_t_8)) {
5651 
5652             /* "ddtrace/internal/_encoding.pyx":276
5653  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5654  *             if res != 0:
5655  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")             # <<<<<<<<<<<<<<
5656  *
5657  *     cdef reset(self):
5658  */
5659             __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L7_error)
5660             __Pyx_GOTREF(__pyx_t_2);
5661             __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5662             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5663             __PYX_ERR(0, 276, __pyx_L7_error)
5664 
5665             /* "ddtrace/internal/_encoding.pyx":275
5666  *             assert self.size + size <= self.max_size
5667  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5668  *             if res != 0:             # <<<<<<<<<<<<<<
5669  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")
5670  *
5671  */
5672           }
5673 
5674           /* "ddtrace/internal/_encoding.pyx":272
5675  *     cdef append_raw(self, long src, Py_ssize_t size):
5676  *         cdef int res
5677  *         with self._lock:             # <<<<<<<<<<<<<<
5678  *             assert self.size + size <= self.max_size
5679  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
5680  */
5681         }
5682         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5683         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5684         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5685         goto __pyx_L12_try_end;
5686         __pyx_L7_error:;
5687         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5688         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5689         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5690         /*except:*/ {
5691           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.append_raw", __pyx_clineno, __pyx_lineno, __pyx_filename);
5692           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 272, __pyx_L9_except_error)
5693           __Pyx_GOTREF(__pyx_t_2);
5694           __Pyx_GOTREF(__pyx_t_3);
5695           __Pyx_GOTREF(__pyx_t_4);
5696           __pyx_t_10 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 272, __pyx_L9_except_error)
5697           __Pyx_GOTREF(__pyx_t_10);
5698           __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL);
5699           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5700           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5701           if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 272, __pyx_L9_except_error)
5702           __Pyx_GOTREF(__pyx_t_11);
5703           __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11);
5704           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5705           if (__pyx_t_8 < 0) __PYX_ERR(0, 272, __pyx_L9_except_error)
5706           __pyx_t_12 = ((!(__pyx_t_8 != 0)) != 0);
5707           if (__pyx_t_12) {
5708             __Pyx_GIVEREF(__pyx_t_2);
5709             __Pyx_GIVEREF(__pyx_t_3);
5710             __Pyx_XGIVEREF(__pyx_t_4);
5711             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4);
5712             __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
5713             __PYX_ERR(0, 272, __pyx_L9_except_error)
5714           }
5715           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5716           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5717           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5718           goto __pyx_L8_exception_handled;
5719         }
5720         __pyx_L9_except_error:;
5721         __Pyx_XGIVEREF(__pyx_t_5);
5722         __Pyx_XGIVEREF(__pyx_t_6);
5723         __Pyx_XGIVEREF(__pyx_t_7);
5724         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
5725         goto __pyx_L1_error;
5726         __pyx_L8_exception_handled:;
5727         __Pyx_XGIVEREF(__pyx_t_5);
5728         __Pyx_XGIVEREF(__pyx_t_6);
5729         __Pyx_XGIVEREF(__pyx_t_7);
5730         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
5731         __pyx_L12_try_end:;
5732       }
5733     }
5734     /*finally:*/ {
5735       /*normal exit:*/{
5736         if (__pyx_t_1) {
5737           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
5738           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5739           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 272, __pyx_L1_error)
5740           __Pyx_GOTREF(__pyx_t_7);
5741           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5742         }
5743         goto __pyx_L6;
5744       }
5745       __pyx_L6:;
5746     }
5747     goto __pyx_L17;
5748     __pyx_L3_error:;
5749     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5750     goto __pyx_L1_error;
5751     __pyx_L17:;
5752   }
5753 
5754   /* "ddtrace/internal/_encoding.pyx":270
5755  *             return self.pk.length - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE + array_prefix_size(self._next_id)
5756  *
5757  *     cdef append_raw(self, long src, Py_ssize_t size):             # <<<<<<<<<<<<<<
5758  *         cdef int res
5759  *         with self._lock:
5760  */
5761 
5762   /* function exit code */
5763   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5764   goto __pyx_L0;
5765   __pyx_L1_error:;
5766   __Pyx_XDECREF(__pyx_t_2);
5767   __Pyx_XDECREF(__pyx_t_3);
5768   __Pyx_XDECREF(__pyx_t_4);
5769   __Pyx_XDECREF(__pyx_t_10);
5770   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.append_raw", __pyx_clineno, __pyx_lineno, __pyx_filename);
5771   __pyx_r = 0;
5772   __pyx_L0:;
5773   __Pyx_XGIVEREF(__pyx_r);
5774   __Pyx_RefNannyFinishContext();
5775   return __pyx_r;
5776 }
5777 
5778 /* "ddtrace/internal/_encoding.pyx":278
5779  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")
5780  *
5781  *     cdef reset(self):             # <<<<<<<<<<<<<<
5782  *         StringTable.reset(self)
5783  *         assert self._next_id == 1
5784  */
5785 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)5786 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_reset(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
5787   PyObject *__pyx_r = NULL;
5788   __Pyx_RefNannyDeclarations
5789   PyObject *__pyx_t_1 = NULL;
5790   PyObject *__pyx_t_2 = NULL;
5791   int __pyx_t_3;
5792   size_t __pyx_t_4;
5793   int __pyx_lineno = 0;
5794   const char *__pyx_filename = NULL;
5795   int __pyx_clineno = 0;
5796   __Pyx_RefNannySetupContext("reset", 0);
5797 
5798   /* "ddtrace/internal/_encoding.pyx":279
5799  *
5800  *     cdef reset(self):
5801  *         StringTable.reset(self)             # <<<<<<<<<<<<<<
5802  *         assert self._next_id == 1
5803  *
5804  */
5805   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_11StringTable_reset(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
5806   __Pyx_GOTREF(__pyx_t_1);
5807   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5808 
5809   /* "ddtrace/internal/_encoding.pyx":280
5810  *     cdef reset(self):
5811  *         StringTable.reset(self)
5812  *         assert self._next_id == 1             # <<<<<<<<<<<<<<
5813  *
5814  *         PyDict_SetItem(self._table, ORIGIN_KEY, 1)
5815  */
5816   #ifndef CYTHON_WITHOUT_ASSERTIONS
5817   if (unlikely(!Py_OptimizeFlag)) {
5818     if (unlikely(!((__pyx_v_self->__pyx_base._next_id == 1) != 0))) {
5819       PyErr_SetNone(PyExc_AssertionError);
5820       __PYX_ERR(0, 280, __pyx_L1_error)
5821     }
5822   }
5823   #endif
5824 
5825   /* "ddtrace/internal/_encoding.pyx":282
5826  *         assert self._next_id == 1
5827  *
5828  *         PyDict_SetItem(self._table, ORIGIN_KEY, 1)             # <<<<<<<<<<<<<<
5829  *         self._next_id = 2
5830  *         self.pk.length = self._reset_size
5831  */
5832   __pyx_t_1 = __pyx_v_self->__pyx_base._table;
5833   __Pyx_INCREF(__pyx_t_1);
5834   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ORIGIN_KEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
5835   __Pyx_GOTREF(__pyx_t_2);
5836   __pyx_t_3 = PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_int_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 282, __pyx_L1_error)
5837   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5838   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5839 
5840   /* "ddtrace/internal/_encoding.pyx":283
5841  *
5842  *         PyDict_SetItem(self._table, ORIGIN_KEY, 1)
5843  *         self._next_id = 2             # <<<<<<<<<<<<<<
5844  *         self.pk.length = self._reset_size
5845  *         self._sp_len = 0
5846  */
5847   __pyx_v_self->__pyx_base._next_id = 2;
5848 
5849   /* "ddtrace/internal/_encoding.pyx":284
5850  *         PyDict_SetItem(self._table, ORIGIN_KEY, 1)
5851  *         self._next_id = 2
5852  *         self.pk.length = self._reset_size             # <<<<<<<<<<<<<<
5853  *         self._sp_len = 0
5854  *
5855  */
5856   __pyx_t_4 = __pyx_v_self->_reset_size;
5857   __pyx_v_self->pk.length = __pyx_t_4;
5858 
5859   /* "ddtrace/internal/_encoding.pyx":285
5860  *         self._next_id = 2
5861  *         self.pk.length = self._reset_size
5862  *         self._sp_len = 0             # <<<<<<<<<<<<<<
5863  *
5864  *     cpdef flush(self):
5865  */
5866   __pyx_v_self->_sp_len = 0;
5867 
5868   /* "ddtrace/internal/_encoding.pyx":278
5869  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")
5870  *
5871  *     cdef reset(self):             # <<<<<<<<<<<<<<
5872  *         StringTable.reset(self)
5873  *         assert self._next_id == 1
5874  */
5875 
5876   /* function exit code */
5877   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5878   goto __pyx_L0;
5879   __pyx_L1_error:;
5880   __Pyx_XDECREF(__pyx_t_1);
5881   __Pyx_XDECREF(__pyx_t_2);
5882   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
5883   __pyx_r = 0;
5884   __pyx_L0:;
5885   __Pyx_XGIVEREF(__pyx_r);
5886   __Pyx_RefNannyFinishContext();
5887   return __pyx_r;
5888 }
5889 
5890 /* "ddtrace/internal/_encoding.pyx":287
5891  *         self._sp_len = 0
5892  *
5893  *     cpdef flush(self):             # <<<<<<<<<<<<<<
5894  *         with self._lock:
5895  *             try:
5896  */
5897 
5898 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self,int __pyx_skip_dispatch)5899 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, int __pyx_skip_dispatch) {
5900   PyObject *__pyx_r = NULL;
5901   __Pyx_RefNannyDeclarations
5902   PyObject *__pyx_t_1 = NULL;
5903   PyObject *__pyx_t_2 = NULL;
5904   PyObject *__pyx_t_3 = NULL;
5905   PyObject *__pyx_t_4 = NULL;
5906   PyObject *__pyx_t_5 = NULL;
5907   PyObject *__pyx_t_6 = NULL;
5908   PyObject *__pyx_t_7 = NULL;
5909   PyObject *__pyx_t_8 = NULL;
5910   int __pyx_t_9;
5911   int __pyx_t_10;
5912   char const *__pyx_t_11;
5913   PyObject *__pyx_t_12 = NULL;
5914   PyObject *__pyx_t_13 = NULL;
5915   PyObject *__pyx_t_14 = NULL;
5916   PyObject *__pyx_t_15 = NULL;
5917   PyObject *__pyx_t_16 = NULL;
5918   PyObject *__pyx_t_17 = NULL;
5919   int __pyx_t_18;
5920   int __pyx_t_19;
5921   int __pyx_lineno = 0;
5922   const char *__pyx_filename = NULL;
5923   int __pyx_clineno = 0;
5924   __Pyx_RefNannySetupContext("flush", 0);
5925   /* Check if called by wrapper */
5926   if (unlikely(__pyx_skip_dispatch)) ;
5927   /* Check if overridden in Python */
5928   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
5929     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5930     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
5931     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
5932       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
5933       #endif
5934       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
5935       __Pyx_GOTREF(__pyx_t_1);
5936       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush)) {
5937         __Pyx_XDECREF(__pyx_r);
5938         __Pyx_INCREF(__pyx_t_1);
5939         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
5940         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5941           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5942           if (likely(__pyx_t_4)) {
5943             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5944             __Pyx_INCREF(__pyx_t_4);
5945             __Pyx_INCREF(function);
5946             __Pyx_DECREF_SET(__pyx_t_3, function);
5947           }
5948         }
5949         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5950         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5951         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
5952         __Pyx_GOTREF(__pyx_t_2);
5953         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5954         __pyx_r = __pyx_t_2;
5955         __pyx_t_2 = 0;
5956         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5957         goto __pyx_L0;
5958       }
5959       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5960       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
5961       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
5962       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
5963         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
5964       }
5965       #endif
5966       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5967       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5968     }
5969     #endif
5970   }
5971 
5972   /* "ddtrace/internal/_encoding.pyx":288
5973  *
5974  *     cpdef flush(self):
5975  *         with self._lock:             # <<<<<<<<<<<<<<
5976  *             try:
5977  *                 return self.get_bytes()
5978  */
5979   /*with:*/ {
5980     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
5981     __Pyx_GOTREF(__pyx_t_5);
5982     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L3_error)
5983     __Pyx_GOTREF(__pyx_t_2);
5984     __pyx_t_3 = NULL;
5985     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5986       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5987       if (likely(__pyx_t_3)) {
5988         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5989         __Pyx_INCREF(__pyx_t_3);
5990         __Pyx_INCREF(function);
5991         __Pyx_DECREF_SET(__pyx_t_2, function);
5992       }
5993     }
5994     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5995     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5996     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L3_error)
5997     __Pyx_GOTREF(__pyx_t_1);
5998     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5999     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6000     /*try:*/ {
6001       {
6002         __Pyx_PyThreadState_declare
6003         __Pyx_PyThreadState_assign
6004         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
6005         __Pyx_XGOTREF(__pyx_t_6);
6006         __Pyx_XGOTREF(__pyx_t_7);
6007         __Pyx_XGOTREF(__pyx_t_8);
6008         /*try:*/ {
6009 
6010           /* "ddtrace/internal/_encoding.pyx":289
6011  *     cpdef flush(self):
6012  *         with self._lock:
6013  *             try:             # <<<<<<<<<<<<<<
6014  *                 return self.get_bytes()
6015  *             finally:
6016  */
6017           /*try:*/ {
6018 
6019             /* "ddtrace/internal/_encoding.pyx":290
6020  *         with self._lock:
6021  *             try:
6022  *                 return self.get_bytes()             # <<<<<<<<<<<<<<
6023  *             finally:
6024  *                 self.reset()
6025  */
6026             __Pyx_XDECREF(__pyx_r);
6027             __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_bytes(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L14_error)
6028             __Pyx_GOTREF(__pyx_t_1);
6029             __pyx_r = __pyx_t_1;
6030             __pyx_t_1 = 0;
6031             goto __pyx_L13_return;
6032           }
6033 
6034           /* "ddtrace/internal/_encoding.pyx":292
6035  *                 return self.get_bytes()
6036  *             finally:
6037  *                 self.reset()             # <<<<<<<<<<<<<<
6038  *
6039  *
6040  */
6041           /*finally:*/ {
6042             __pyx_L14_error:;
6043             /*exception exit:*/{
6044               __Pyx_PyThreadState_declare
6045               __Pyx_PyThreadState_assign
6046               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
6047               __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6048               __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6049               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6050               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6051               if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
6052               if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
6053               __Pyx_XGOTREF(__pyx_t_12);
6054               __Pyx_XGOTREF(__pyx_t_13);
6055               __Pyx_XGOTREF(__pyx_t_14);
6056               __Pyx_XGOTREF(__pyx_t_15);
6057               __Pyx_XGOTREF(__pyx_t_16);
6058               __Pyx_XGOTREF(__pyx_t_17);
6059               __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
6060               {
6061                 __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.reset(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L17_error)
6062                 __Pyx_GOTREF(__pyx_t_1);
6063                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6064               }
6065               if (PY_MAJOR_VERSION >= 3) {
6066                 __Pyx_XGIVEREF(__pyx_t_15);
6067                 __Pyx_XGIVEREF(__pyx_t_16);
6068                 __Pyx_XGIVEREF(__pyx_t_17);
6069                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
6070               }
6071               __Pyx_XGIVEREF(__pyx_t_12);
6072               __Pyx_XGIVEREF(__pyx_t_13);
6073               __Pyx_XGIVEREF(__pyx_t_14);
6074               __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
6075               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
6076               __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
6077               goto __pyx_L7_error;
6078               __pyx_L17_error:;
6079               if (PY_MAJOR_VERSION >= 3) {
6080                 __Pyx_XGIVEREF(__pyx_t_15);
6081                 __Pyx_XGIVEREF(__pyx_t_16);
6082                 __Pyx_XGIVEREF(__pyx_t_17);
6083                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
6084               }
6085               __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
6086               __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
6087               __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
6088               __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
6089               goto __pyx_L7_error;
6090             }
6091             __pyx_L13_return: {
6092               __pyx_t_17 = __pyx_r;
6093               __pyx_r = 0;
6094               __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.reset(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L7_error)
6095               __Pyx_GOTREF(__pyx_t_1);
6096               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6097               __pyx_r = __pyx_t_17;
6098               __pyx_t_17 = 0;
6099               goto __pyx_L11_try_return;
6100             }
6101           }
6102 
6103           /* "ddtrace/internal/_encoding.pyx":288
6104  *
6105  *     cpdef flush(self):
6106  *         with self._lock:             # <<<<<<<<<<<<<<
6107  *             try:
6108  *                 return self.get_bytes()
6109  */
6110         }
6111         __pyx_L7_error:;
6112         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6113         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6114         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6115         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6116         /*except:*/ {
6117           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
6118           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 288, __pyx_L9_except_error)
6119           __Pyx_GOTREF(__pyx_t_1);
6120           __Pyx_GOTREF(__pyx_t_2);
6121           __Pyx_GOTREF(__pyx_t_3);
6122           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6123           __Pyx_GOTREF(__pyx_t_4);
6124           __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
6125           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6126           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6127           if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6128           __Pyx_GOTREF(__pyx_t_17);
6129           __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
6130           __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6131           if (__pyx_t_18 < 0) __PYX_ERR(0, 288, __pyx_L9_except_error)
6132           __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
6133           if (__pyx_t_19) {
6134             __Pyx_GIVEREF(__pyx_t_1);
6135             __Pyx_GIVEREF(__pyx_t_2);
6136             __Pyx_XGIVEREF(__pyx_t_3);
6137             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6138             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
6139             __PYX_ERR(0, 288, __pyx_L9_except_error)
6140           }
6141           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6142           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6143           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6144           goto __pyx_L8_exception_handled;
6145         }
6146         __pyx_L9_except_error:;
6147         __Pyx_XGIVEREF(__pyx_t_6);
6148         __Pyx_XGIVEREF(__pyx_t_7);
6149         __Pyx_XGIVEREF(__pyx_t_8);
6150         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
6151         goto __pyx_L1_error;
6152         __pyx_L11_try_return:;
6153         __Pyx_XGIVEREF(__pyx_t_6);
6154         __Pyx_XGIVEREF(__pyx_t_7);
6155         __Pyx_XGIVEREF(__pyx_t_8);
6156         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
6157         goto __pyx_L4_return;
6158         __pyx_L8_exception_handled:;
6159         __Pyx_XGIVEREF(__pyx_t_6);
6160         __Pyx_XGIVEREF(__pyx_t_7);
6161         __Pyx_XGIVEREF(__pyx_t_8);
6162         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
6163       }
6164     }
6165     /*finally:*/ {
6166       /*normal exit:*/{
6167         if (__pyx_t_5) {
6168           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
6169           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6170           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error)
6171           __Pyx_GOTREF(__pyx_t_8);
6172           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6173         }
6174         goto __pyx_L6;
6175       }
6176       __pyx_L4_return: {
6177         __pyx_t_8 = __pyx_r;
6178         __pyx_r = 0;
6179         if (__pyx_t_5) {
6180           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
6181           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6182           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
6183           __Pyx_GOTREF(__pyx_t_7);
6184           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6185         }
6186         __pyx_r = __pyx_t_8;
6187         __pyx_t_8 = 0;
6188         goto __pyx_L0;
6189       }
6190       __pyx_L6:;
6191     }
6192     goto __pyx_L21;
6193     __pyx_L3_error:;
6194     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6195     goto __pyx_L1_error;
6196     __pyx_L21:;
6197   }
6198 
6199   /* "ddtrace/internal/_encoding.pyx":287
6200  *         self._sp_len = 0
6201  *
6202  *     cpdef flush(self):             # <<<<<<<<<<<<<<
6203  *         with self._lock:
6204  *             try:
6205  */
6206 
6207   /* function exit code */
6208   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6209   goto __pyx_L0;
6210   __pyx_L1_error:;
6211   __Pyx_XDECREF(__pyx_t_1);
6212   __Pyx_XDECREF(__pyx_t_2);
6213   __Pyx_XDECREF(__pyx_t_3);
6214   __Pyx_XDECREF(__pyx_t_4);
6215   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
6216   __pyx_r = 0;
6217   __pyx_L0:;
6218   __Pyx_XGIVEREF(__pyx_r);
6219   __Pyx_RefNannyFinishContext();
6220   return __pyx_r;
6221 }
6222 
6223 /* Python wrapper */
6224 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6225 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6226   PyObject *__pyx_r = 0;
6227   __Pyx_RefNannyDeclarations
6228   __Pyx_RefNannySetupContext("flush (wrapper)", 0);
6229   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4flush(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self));
6230 
6231   /* function exit code */
6232   __Pyx_RefNannyFinishContext();
6233   return __pyx_r;
6234 }
6235 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)6236 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
6237   PyObject *__pyx_r = NULL;
6238   __Pyx_RefNannyDeclarations
6239   PyObject *__pyx_t_1 = NULL;
6240   int __pyx_lineno = 0;
6241   const char *__pyx_filename = NULL;
6242   int __pyx_clineno = 0;
6243   __Pyx_RefNannySetupContext("flush", 0);
6244   __Pyx_XDECREF(__pyx_r);
6245   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_flush(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
6246   __Pyx_GOTREF(__pyx_t_1);
6247   __pyx_r = __pyx_t_1;
6248   __pyx_t_1 = 0;
6249   goto __pyx_L0;
6250 
6251   /* function exit code */
6252   __pyx_L1_error:;
6253   __Pyx_XDECREF(__pyx_t_1);
6254   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
6255   __pyx_r = NULL;
6256   __pyx_L0:;
6257   __Pyx_XGIVEREF(__pyx_r);
6258   __Pyx_RefNannyFinishContext();
6259   return __pyx_r;
6260 }
6261 
6262 /* "(tree fragment)":1
6263  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6264  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6265  * def __setstate_cython__(self, __pyx_state):
6266  */
6267 
6268 /* Python wrapper */
6269 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6270 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6271   PyObject *__pyx_r = 0;
6272   __Pyx_RefNannyDeclarations
6273   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
6274   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_6__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self));
6275 
6276   /* function exit code */
6277   __Pyx_RefNannyFinishContext();
6278   return __pyx_r;
6279 }
6280 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self)6281 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self) {
6282   PyObject *__pyx_r = NULL;
6283   __Pyx_RefNannyDeclarations
6284   PyObject *__pyx_t_1 = NULL;
6285   int __pyx_lineno = 0;
6286   const char *__pyx_filename = NULL;
6287   int __pyx_clineno = 0;
6288   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
6289 
6290   /* "(tree fragment)":2
6291  * def __reduce_cython__(self):
6292  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")             # <<<<<<<<<<<<<<
6293  * def __setstate_cython__(self, __pyx_state):
6294  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6295  */
6296   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
6297   __Pyx_GOTREF(__pyx_t_1);
6298   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6299   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6300   __PYX_ERR(1, 2, __pyx_L1_error)
6301 
6302   /* "(tree fragment)":1
6303  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6304  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6305  * def __setstate_cython__(self, __pyx_state):
6306  */
6307 
6308   /* function exit code */
6309   __pyx_L1_error:;
6310   __Pyx_XDECREF(__pyx_t_1);
6311   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6312   __pyx_r = NULL;
6313   __Pyx_XGIVEREF(__pyx_r);
6314   __Pyx_RefNannyFinishContext();
6315   return __pyx_r;
6316 }
6317 
6318 /* "(tree fragment)":3
6319  * def __reduce_cython__(self):
6320  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6321  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6322  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6323  */
6324 
6325 /* Python wrapper */
6326 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)6327 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6328   PyObject *__pyx_r = 0;
6329   __Pyx_RefNannyDeclarations
6330   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
6331   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_8__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6332 
6333   /* function exit code */
6334   __Pyx_RefNannyFinishContext();
6335   return __pyx_r;
6336 }
6337 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)6338 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackStringTable_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
6339   PyObject *__pyx_r = NULL;
6340   __Pyx_RefNannyDeclarations
6341   PyObject *__pyx_t_1 = NULL;
6342   int __pyx_lineno = 0;
6343   const char *__pyx_filename = NULL;
6344   int __pyx_clineno = 0;
6345   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6346 
6347   /* "(tree fragment)":4
6348  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6349  * def __setstate_cython__(self, __pyx_state):
6350  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")             # <<<<<<<<<<<<<<
6351  */
6352   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
6353   __Pyx_GOTREF(__pyx_t_1);
6354   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6355   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6356   __PYX_ERR(1, 4, __pyx_L1_error)
6357 
6358   /* "(tree fragment)":3
6359  * def __reduce_cython__(self):
6360  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6361  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6362  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
6363  */
6364 
6365   /* function exit code */
6366   __pyx_L1_error:;
6367   __Pyx_XDECREF(__pyx_t_1);
6368   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackStringTable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6369   __pyx_r = NULL;
6370   __Pyx_XGIVEREF(__pyx_r);
6371   __Pyx_RefNannyFinishContext();
6372   return __pyx_r;
6373 }
6374 
6375 /* "ddtrace/internal/_encoding.pyx":302
6376  *     cdef object _lock
6377  *
6378  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
6379  *         self.max_size = max_size
6380  *         self.max_item_size = max_item_size
6381  */
6382 
6383 /* Python wrapper */
6384 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6385 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6386   size_t __pyx_v_max_size;
6387   size_t __pyx_v_max_item_size;
6388   int __pyx_lineno = 0;
6389   const char *__pyx_filename = NULL;
6390   int __pyx_clineno = 0;
6391   int __pyx_r;
6392   __Pyx_RefNannyDeclarations
6393   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
6394   {
6395     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_size,&__pyx_n_s_max_item_size,0};
6396     PyObject* values[2] = {0,0};
6397     if (unlikely(__pyx_kwds)) {
6398       Py_ssize_t kw_args;
6399       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6400       switch (pos_args) {
6401         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6402         CYTHON_FALLTHROUGH;
6403         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6404         CYTHON_FALLTHROUGH;
6405         case  0: break;
6406         default: goto __pyx_L5_argtuple_error;
6407       }
6408       kw_args = PyDict_Size(__pyx_kwds);
6409       switch (pos_args) {
6410         case  0:
6411         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_size)) != 0)) kw_args--;
6412         else goto __pyx_L5_argtuple_error;
6413         CYTHON_FALLTHROUGH;
6414         case  1:
6415         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_item_size)) != 0)) kw_args--;
6416         else {
6417           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 302, __pyx_L3_error)
6418         }
6419       }
6420       if (unlikely(kw_args > 0)) {
6421         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 302, __pyx_L3_error)
6422       }
6423     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6424       goto __pyx_L5_argtuple_error;
6425     } else {
6426       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6427       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6428     }
6429     __pyx_v_max_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_max_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
6430     __pyx_v_max_item_size = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_max_item_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
6431   }
6432   goto __pyx_L4_argument_unpacking_done;
6433   __pyx_L5_argtuple_error:;
6434   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 302, __pyx_L3_error)
6435   __pyx_L3_error:;
6436   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6437   __Pyx_RefNannyFinishContext();
6438   return -1;
6439   __pyx_L4_argument_unpacking_done:;
6440   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder___cinit__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self), __pyx_v_max_size, __pyx_v_max_item_size);
6441 
6442   /* function exit code */
6443   __Pyx_RefNannyFinishContext();
6444   return __pyx_r;
6445 }
6446 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self,size_t __pyx_v_max_size,size_t __pyx_v_max_item_size)6447 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, size_t __pyx_v_max_size, size_t __pyx_v_max_item_size) {
6448   int __pyx_r;
6449   __Pyx_RefNannyDeclarations
6450   PyObject *__pyx_t_1 = NULL;
6451   PyObject *__pyx_t_2 = NULL;
6452   PyObject *__pyx_t_3 = NULL;
6453   int __pyx_lineno = 0;
6454   const char *__pyx_filename = NULL;
6455   int __pyx_clineno = 0;
6456   __Pyx_RefNannySetupContext("__cinit__", 0);
6457 
6458   /* "ddtrace/internal/_encoding.pyx":303
6459  *
6460  *     def __cinit__(self, size_t max_size, size_t max_item_size):
6461  *         self.max_size = max_size             # <<<<<<<<<<<<<<
6462  *         self.max_item_size = max_item_size
6463  *         self._lock = threading.Lock()
6464  */
6465   __pyx_v_self->max_size = __pyx_v_max_size;
6466 
6467   /* "ddtrace/internal/_encoding.pyx":304
6468  *     def __cinit__(self, size_t max_size, size_t max_item_size):
6469  *         self.max_size = max_size
6470  *         self.max_item_size = max_item_size             # <<<<<<<<<<<<<<
6471  *         self._lock = threading.Lock()
6472  *
6473  */
6474   __pyx_v_self->max_item_size = __pyx_v_max_item_size;
6475 
6476   /* "ddtrace/internal/_encoding.pyx":305
6477  *         self.max_size = max_size
6478  *         self.max_item_size = max_item_size
6479  *         self._lock = threading.Lock()             # <<<<<<<<<<<<<<
6480  *
6481  *     # ---- Abstract methods ----
6482  */
6483   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
6484   __Pyx_GOTREF(__pyx_t_2);
6485   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
6486   __Pyx_GOTREF(__pyx_t_3);
6487   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6488   __pyx_t_2 = NULL;
6489   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6490     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6491     if (likely(__pyx_t_2)) {
6492       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6493       __Pyx_INCREF(__pyx_t_2);
6494       __Pyx_INCREF(function);
6495       __Pyx_DECREF_SET(__pyx_t_3, function);
6496     }
6497   }
6498   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6499   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6500   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
6501   __Pyx_GOTREF(__pyx_t_1);
6502   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6503   __Pyx_GIVEREF(__pyx_t_1);
6504   __Pyx_GOTREF(__pyx_v_self->_lock);
6505   __Pyx_DECREF(__pyx_v_self->_lock);
6506   __pyx_v_self->_lock = __pyx_t_1;
6507   __pyx_t_1 = 0;
6508 
6509   /* "ddtrace/internal/_encoding.pyx":302
6510  *     cdef object _lock
6511  *
6512  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
6513  *         self.max_size = max_size
6514  *         self.max_item_size = max_item_size
6515  */
6516 
6517   /* function exit code */
6518   __pyx_r = 0;
6519   goto __pyx_L0;
6520   __pyx_L1_error:;
6521   __Pyx_XDECREF(__pyx_t_1);
6522   __Pyx_XDECREF(__pyx_t_2);
6523   __Pyx_XDECREF(__pyx_t_3);
6524   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6525   __pyx_r = -1;
6526   __pyx_L0:;
6527   __Pyx_RefNannyFinishContext();
6528   return __pyx_r;
6529 }
6530 
6531 /* "ddtrace/internal/_encoding.pyx":309
6532  *     # ---- Abstract methods ----
6533  *
6534  *     def put(self, item):             # <<<<<<<<<<<<<<
6535  *         raise NotImplementedError()
6536  *
6537  */
6538 
6539 /* Python wrapper */
6540 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_3put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_3put(PyObject * __pyx_v_self,PyObject * __pyx_v_item)6541 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_3put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
6542   PyObject *__pyx_r = 0;
6543   __Pyx_RefNannyDeclarations
6544   __Pyx_RefNannySetupContext("put (wrapper)", 0);
6545   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_2put(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v_item));
6546 
6547   /* function exit code */
6548   __Pyx_RefNannyFinishContext();
6549   return __pyx_r;
6550 }
6551 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_2put(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_item)6552 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_2put(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_item) {
6553   PyObject *__pyx_r = NULL;
6554   __Pyx_RefNannyDeclarations
6555   PyObject *__pyx_t_1 = NULL;
6556   int __pyx_lineno = 0;
6557   const char *__pyx_filename = NULL;
6558   int __pyx_clineno = 0;
6559   __Pyx_RefNannySetupContext("put", 0);
6560 
6561   /* "ddtrace/internal/_encoding.pyx":310
6562  *
6563  *     def put(self, item):
6564  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
6565  *
6566  *     def encode(self):
6567  */
6568   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
6569   __Pyx_GOTREF(__pyx_t_1);
6570   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6571   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6572   __PYX_ERR(0, 310, __pyx_L1_error)
6573 
6574   /* "ddtrace/internal/_encoding.pyx":309
6575  *     # ---- Abstract methods ----
6576  *
6577  *     def put(self, item):             # <<<<<<<<<<<<<<
6578  *         raise NotImplementedError()
6579  *
6580  */
6581 
6582   /* function exit code */
6583   __pyx_L1_error:;
6584   __Pyx_XDECREF(__pyx_t_1);
6585   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
6586   __pyx_r = NULL;
6587   __Pyx_XGIVEREF(__pyx_r);
6588   __Pyx_RefNannyFinishContext();
6589   return __pyx_r;
6590 }
6591 
6592 /* "ddtrace/internal/_encoding.pyx":312
6593  *         raise NotImplementedError()
6594  *
6595  *     def encode(self):             # <<<<<<<<<<<<<<
6596  *         raise NotImplementedError()
6597  *
6598  */
6599 
6600 /* Python wrapper */
6601 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_5encode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_5encode(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6602 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_5encode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6603   PyObject *__pyx_r = 0;
6604   __Pyx_RefNannyDeclarations
6605   __Pyx_RefNannySetupContext("encode (wrapper)", 0);
6606   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_4encode(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self));
6607 
6608   /* function exit code */
6609   __Pyx_RefNannyFinishContext();
6610   return __pyx_r;
6611 }
6612 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_4encode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self)6613 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_4encode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self) {
6614   PyObject *__pyx_r = NULL;
6615   __Pyx_RefNannyDeclarations
6616   PyObject *__pyx_t_1 = NULL;
6617   int __pyx_lineno = 0;
6618   const char *__pyx_filename = NULL;
6619   int __pyx_clineno = 0;
6620   __Pyx_RefNannySetupContext("encode", 0);
6621 
6622   /* "ddtrace/internal/_encoding.pyx":313
6623  *
6624  *     def encode(self):
6625  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
6626  *
6627  *
6628  */
6629   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
6630   __Pyx_GOTREF(__pyx_t_1);
6631   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6632   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6633   __PYX_ERR(0, 313, __pyx_L1_error)
6634 
6635   /* "ddtrace/internal/_encoding.pyx":312
6636  *         raise NotImplementedError()
6637  *
6638  *     def encode(self):             # <<<<<<<<<<<<<<
6639  *         raise NotImplementedError()
6640  *
6641  */
6642 
6643   /* function exit code */
6644   __pyx_L1_error:;
6645   __Pyx_XDECREF(__pyx_t_1);
6646   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
6647   __pyx_r = NULL;
6648   __Pyx_XGIVEREF(__pyx_r);
6649   __Pyx_RefNannyFinishContext();
6650   return __pyx_r;
6651 }
6652 
6653 /* "ddtrace/internal/_encoding.pyx":298
6654  *     content_type: str = None
6655  *
6656  *     cdef public size_t max_size             # <<<<<<<<<<<<<<
6657  *     cdef public size_t max_item_size
6658  *     cdef object _lock
6659  */
6660 
6661 /* Python wrapper */
6662 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_1__get__(PyObject * __pyx_v_self)6663 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_1__get__(PyObject *__pyx_v_self) {
6664   PyObject *__pyx_r = 0;
6665   __Pyx_RefNannyDeclarations
6666   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6667   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self));
6668 
6669   /* function exit code */
6670   __Pyx_RefNannyFinishContext();
6671   return __pyx_r;
6672 }
6673 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self)6674 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self) {
6675   PyObject *__pyx_r = NULL;
6676   __Pyx_RefNannyDeclarations
6677   PyObject *__pyx_t_1 = NULL;
6678   int __pyx_lineno = 0;
6679   const char *__pyx_filename = NULL;
6680   int __pyx_clineno = 0;
6681   __Pyx_RefNannySetupContext("__get__", 0);
6682   __Pyx_XDECREF(__pyx_r);
6683   __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
6684   __Pyx_GOTREF(__pyx_t_1);
6685   __pyx_r = __pyx_t_1;
6686   __pyx_t_1 = 0;
6687   goto __pyx_L0;
6688 
6689   /* function exit code */
6690   __pyx_L1_error:;
6691   __Pyx_XDECREF(__pyx_t_1);
6692   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.max_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6693   __pyx_r = NULL;
6694   __pyx_L0:;
6695   __Pyx_XGIVEREF(__pyx_r);
6696   __Pyx_RefNannyFinishContext();
6697   return __pyx_r;
6698 }
6699 
6700 /* Python wrapper */
6701 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)6702 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6703   int __pyx_r;
6704   __Pyx_RefNannyDeclarations
6705   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
6706   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_2__set__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v_value));
6707 
6708   /* function exit code */
6709   __Pyx_RefNannyFinishContext();
6710   return __pyx_r;
6711 }
6712 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self,PyObject * __pyx_v_value)6713 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, PyObject *__pyx_v_value) {
6714   int __pyx_r;
6715   __Pyx_RefNannyDeclarations
6716   size_t __pyx_t_1;
6717   int __pyx_lineno = 0;
6718   const char *__pyx_filename = NULL;
6719   int __pyx_clineno = 0;
6720   __Pyx_RefNannySetupContext("__set__", 0);
6721   __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error)
6722   __pyx_v_self->max_size = __pyx_t_1;
6723 
6724   /* function exit code */
6725   __pyx_r = 0;
6726   goto __pyx_L0;
6727   __pyx_L1_error:;
6728   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.max_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6729   __pyx_r = -1;
6730   __pyx_L0:;
6731   __Pyx_RefNannyFinishContext();
6732   return __pyx_r;
6733 }
6734 
6735 /* "ddtrace/internal/_encoding.pyx":299
6736  *
6737  *     cdef public size_t max_size
6738  *     cdef public size_t max_item_size             # <<<<<<<<<<<<<<
6739  *     cdef object _lock
6740  *
6741  */
6742 
6743 /* Python wrapper */
6744 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_1__get__(PyObject * __pyx_v_self)6745 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_1__get__(PyObject *__pyx_v_self) {
6746   PyObject *__pyx_r = 0;
6747   __Pyx_RefNannyDeclarations
6748   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6749   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self));
6750 
6751   /* function exit code */
6752   __Pyx_RefNannyFinishContext();
6753   return __pyx_r;
6754 }
6755 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self)6756 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self) {
6757   PyObject *__pyx_r = NULL;
6758   __Pyx_RefNannyDeclarations
6759   PyObject *__pyx_t_1 = NULL;
6760   int __pyx_lineno = 0;
6761   const char *__pyx_filename = NULL;
6762   int __pyx_clineno = 0;
6763   __Pyx_RefNannySetupContext("__get__", 0);
6764   __Pyx_XDECREF(__pyx_r);
6765   __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->max_item_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
6766   __Pyx_GOTREF(__pyx_t_1);
6767   __pyx_r = __pyx_t_1;
6768   __pyx_t_1 = 0;
6769   goto __pyx_L0;
6770 
6771   /* function exit code */
6772   __pyx_L1_error:;
6773   __Pyx_XDECREF(__pyx_t_1);
6774   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.max_item_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6775   __pyx_r = NULL;
6776   __pyx_L0:;
6777   __Pyx_XGIVEREF(__pyx_r);
6778   __Pyx_RefNannyFinishContext();
6779   return __pyx_r;
6780 }
6781 
6782 /* Python wrapper */
6783 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)6784 static int __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6785   int __pyx_r;
6786   __Pyx_RefNannyDeclarations
6787   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
6788   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_2__set__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v_value));
6789 
6790   /* function exit code */
6791   __Pyx_RefNannyFinishContext();
6792   return __pyx_r;
6793 }
6794 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self,PyObject * __pyx_v_value)6795 static int __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_2__set__(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, PyObject *__pyx_v_value) {
6796   int __pyx_r;
6797   __Pyx_RefNannyDeclarations
6798   size_t __pyx_t_1;
6799   int __pyx_lineno = 0;
6800   const char *__pyx_filename = NULL;
6801   int __pyx_clineno = 0;
6802   __Pyx_RefNannySetupContext("__set__", 0);
6803   __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error)
6804   __pyx_v_self->max_item_size = __pyx_t_1;
6805 
6806   /* function exit code */
6807   __pyx_r = 0;
6808   goto __pyx_L0;
6809   __pyx_L1_error:;
6810   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.max_item_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6811   __pyx_r = -1;
6812   __pyx_L0:;
6813   __Pyx_RefNannyFinishContext();
6814   return __pyx_r;
6815 }
6816 
6817 /* "(tree fragment)":1
6818  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6819  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6820  * def __setstate_cython__(self, __pyx_state):
6821  */
6822 
6823 /* Python wrapper */
6824 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6825 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6826   PyObject *__pyx_r = 0;
6827   __Pyx_RefNannyDeclarations
6828   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
6829   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_6__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self));
6830 
6831   /* function exit code */
6832   __Pyx_RefNannyFinishContext();
6833   return __pyx_r;
6834 }
6835 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self)6836 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self) {
6837   PyObject *__pyx_r = NULL;
6838   __Pyx_RefNannyDeclarations
6839   PyObject *__pyx_t_1 = NULL;
6840   int __pyx_lineno = 0;
6841   const char *__pyx_filename = NULL;
6842   int __pyx_clineno = 0;
6843   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
6844 
6845   /* "(tree fragment)":2
6846  * def __reduce_cython__(self):
6847  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6848  * def __setstate_cython__(self, __pyx_state):
6849  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6850  */
6851   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
6852   __Pyx_GOTREF(__pyx_t_1);
6853   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6854   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6855   __PYX_ERR(1, 2, __pyx_L1_error)
6856 
6857   /* "(tree fragment)":1
6858  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6859  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6860  * def __setstate_cython__(self, __pyx_state):
6861  */
6862 
6863   /* function exit code */
6864   __pyx_L1_error:;
6865   __Pyx_XDECREF(__pyx_t_1);
6866   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6867   __pyx_r = NULL;
6868   __Pyx_XGIVEREF(__pyx_r);
6869   __Pyx_RefNannyFinishContext();
6870   return __pyx_r;
6871 }
6872 
6873 /* "(tree fragment)":3
6874  * def __reduce_cython__(self):
6875  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6876  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6877  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6878  */
6879 
6880 /* Python wrapper */
6881 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)6882 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6883   PyObject *__pyx_r = 0;
6884   __Pyx_RefNannyDeclarations
6885   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
6886   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6887 
6888   /* function exit code */
6889   __Pyx_RefNannyFinishContext();
6890   return __pyx_r;
6891 }
6892 
__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)6893 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_15BufferedEncoder_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
6894   PyObject *__pyx_r = NULL;
6895   __Pyx_RefNannyDeclarations
6896   PyObject *__pyx_t_1 = NULL;
6897   int __pyx_lineno = 0;
6898   const char *__pyx_filename = NULL;
6899   int __pyx_clineno = 0;
6900   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6901 
6902   /* "(tree fragment)":4
6903  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6904  * def __setstate_cython__(self, __pyx_state):
6905  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6906  */
6907   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
6908   __Pyx_GOTREF(__pyx_t_1);
6909   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6910   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6911   __PYX_ERR(1, 4, __pyx_L1_error)
6912 
6913   /* "(tree fragment)":3
6914  * def __reduce_cython__(self):
6915  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6916  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6917  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6918  */
6919 
6920   /* function exit code */
6921   __pyx_L1_error:;
6922   __Pyx_XDECREF(__pyx_t_1);
6923   __Pyx_AddTraceback("ddtrace.internal._encoding.BufferedEncoder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6924   __pyx_r = NULL;
6925   __Pyx_XGIVEREF(__pyx_r);
6926   __Pyx_RefNannyFinishContext();
6927   return __pyx_r;
6928 }
6929 
6930 /* "ddtrace/internal/_encoding.pyx":320
6931  *     cdef Py_ssize_t _size
6932  *
6933  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
6934  *         self._buffer = []
6935  *         self._size = 0
6936  */
6937 
6938 /* Python wrapper */
6939 static int __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6940 static int __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6941   CYTHON_UNUSED size_t __pyx_v_max_size;
6942   CYTHON_UNUSED size_t __pyx_v_max_item_size;
6943   int __pyx_lineno = 0;
6944   const char *__pyx_filename = NULL;
6945   int __pyx_clineno = 0;
6946   int __pyx_r;
6947   __Pyx_RefNannyDeclarations
6948   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
6949   {
6950     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_size,&__pyx_n_s_max_item_size,0};
6951     PyObject* values[2] = {0,0};
6952     if (unlikely(__pyx_kwds)) {
6953       Py_ssize_t kw_args;
6954       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6955       switch (pos_args) {
6956         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6957         CYTHON_FALLTHROUGH;
6958         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6959         CYTHON_FALLTHROUGH;
6960         case  0: break;
6961         default: goto __pyx_L5_argtuple_error;
6962       }
6963       kw_args = PyDict_Size(__pyx_kwds);
6964       switch (pos_args) {
6965         case  0:
6966         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_size)) != 0)) kw_args--;
6967         else goto __pyx_L5_argtuple_error;
6968         CYTHON_FALLTHROUGH;
6969         case  1:
6970         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_item_size)) != 0)) kw_args--;
6971         else {
6972           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 320, __pyx_L3_error)
6973         }
6974       }
6975       if (unlikely(kw_args > 0)) {
6976         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 320, __pyx_L3_error)
6977       }
6978     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6979       goto __pyx_L5_argtuple_error;
6980     } else {
6981       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6982       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6983     }
6984     __pyx_v_max_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_max_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error)
6985     __pyx_v_max_item_size = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_max_item_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error)
6986   }
6987   goto __pyx_L4_argument_unpacking_done;
6988   __pyx_L5_argtuple_error:;
6989   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 320, __pyx_L3_error)
6990   __pyx_L3_error:;
6991   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6992   __Pyx_RefNannyFinishContext();
6993   return -1;
6994   __pyx_L4_argument_unpacking_done:;
6995   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder___cinit__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self), __pyx_v_max_size, __pyx_v_max_item_size);
6996 
6997   /* function exit code */
6998   __Pyx_RefNannyFinishContext();
6999   return __pyx_r;
7000 }
7001 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,CYTHON_UNUSED size_t __pyx_v_max_size,CYTHON_UNUSED size_t __pyx_v_max_item_size)7002 static int __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED size_t __pyx_v_max_size, CYTHON_UNUSED size_t __pyx_v_max_item_size) {
7003   int __pyx_r;
7004   __Pyx_RefNannyDeclarations
7005   PyObject *__pyx_t_1 = NULL;
7006   int __pyx_lineno = 0;
7007   const char *__pyx_filename = NULL;
7008   int __pyx_clineno = 0;
7009   __Pyx_RefNannySetupContext("__cinit__", 0);
7010 
7011   /* "ddtrace/internal/_encoding.pyx":321
7012  *
7013  *     def __cinit__(self, size_t max_size, size_t max_item_size):
7014  *         self._buffer = []             # <<<<<<<<<<<<<<
7015  *         self._size = 0
7016  *
7017  */
7018   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
7019   __Pyx_GOTREF(__pyx_t_1);
7020   __Pyx_GIVEREF(__pyx_t_1);
7021   __Pyx_GOTREF(__pyx_v_self->_buffer);
7022   __Pyx_DECREF(__pyx_v_self->_buffer);
7023   __pyx_v_self->_buffer = ((PyObject*)__pyx_t_1);
7024   __pyx_t_1 = 0;
7025 
7026   /* "ddtrace/internal/_encoding.pyx":322
7027  *     def __cinit__(self, size_t max_size, size_t max_item_size):
7028  *         self._buffer = []
7029  *         self._size = 0             # <<<<<<<<<<<<<<
7030  *
7031  *     def __len__(self):
7032  */
7033   __pyx_v_self->_size = 0;
7034 
7035   /* "ddtrace/internal/_encoding.pyx":320
7036  *     cdef Py_ssize_t _size
7037  *
7038  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
7039  *         self._buffer = []
7040  *         self._size = 0
7041  */
7042 
7043   /* function exit code */
7044   __pyx_r = 0;
7045   goto __pyx_L0;
7046   __pyx_L1_error:;
7047   __Pyx_XDECREF(__pyx_t_1);
7048   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7049   __pyx_r = -1;
7050   __pyx_L0:;
7051   __Pyx_RefNannyFinishContext();
7052   return __pyx_r;
7053 }
7054 
7055 /* "ddtrace/internal/_encoding.pyx":324
7056  *         self._size = 0
7057  *
7058  *     def __len__(self):             # <<<<<<<<<<<<<<
7059  *         return len(self._buffer)
7060  *
7061  */
7062 
7063 /* Python wrapper */
7064 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_3__len__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_3__len__(PyObject * __pyx_v_self)7065 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_3__len__(PyObject *__pyx_v_self) {
7066   Py_ssize_t __pyx_r;
7067   __Pyx_RefNannyDeclarations
7068   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
7069   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_2__len__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self));
7070 
7071   /* function exit code */
7072   __Pyx_RefNannyFinishContext();
7073   return __pyx_r;
7074 }
7075 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_2__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self)7076 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_2__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self) {
7077   Py_ssize_t __pyx_r;
7078   __Pyx_RefNannyDeclarations
7079   PyObject *__pyx_t_1 = NULL;
7080   Py_ssize_t __pyx_t_2;
7081   int __pyx_lineno = 0;
7082   const char *__pyx_filename = NULL;
7083   int __pyx_clineno = 0;
7084   __Pyx_RefNannySetupContext("__len__", 0);
7085 
7086   /* "ddtrace/internal/_encoding.pyx":325
7087  *
7088  *     def __len__(self):
7089  *         return len(self._buffer)             # <<<<<<<<<<<<<<
7090  *
7091  *     @property
7092  */
7093   __pyx_t_1 = __pyx_v_self->_buffer;
7094   __Pyx_INCREF(__pyx_t_1);
7095   if (unlikely(__pyx_t_1 == Py_None)) {
7096     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
7097     __PYX_ERR(0, 325, __pyx_L1_error)
7098   }
7099   __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 325, __pyx_L1_error)
7100   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7101   __pyx_r = __pyx_t_2;
7102   goto __pyx_L0;
7103 
7104   /* "ddtrace/internal/_encoding.pyx":324
7105  *         self._size = 0
7106  *
7107  *     def __len__(self):             # <<<<<<<<<<<<<<
7108  *         return len(self._buffer)
7109  *
7110  */
7111 
7112   /* function exit code */
7113   __pyx_L1_error:;
7114   __Pyx_XDECREF(__pyx_t_1);
7115   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7116   __pyx_r = -1;
7117   __pyx_L0:;
7118   __Pyx_RefNannyFinishContext();
7119   return __pyx_r;
7120 }
7121 
7122 /* "ddtrace/internal/_encoding.pyx":328
7123  *
7124  *     @property
7125  *     def size(self):             # <<<<<<<<<<<<<<
7126  *         with self._lock:
7127  *             return self._size
7128  */
7129 
7130 /* Python wrapper */
7131 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size_1__get__(PyObject * __pyx_v_self)7132 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size_1__get__(PyObject *__pyx_v_self) {
7133   PyObject *__pyx_r = 0;
7134   __Pyx_RefNannyDeclarations
7135   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7136   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self));
7137 
7138   /* function exit code */
7139   __Pyx_RefNannyFinishContext();
7140   return __pyx_r;
7141 }
7142 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self)7143 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self) {
7144   PyObject *__pyx_r = NULL;
7145   __Pyx_RefNannyDeclarations
7146   PyObject *__pyx_t_1 = NULL;
7147   PyObject *__pyx_t_2 = NULL;
7148   PyObject *__pyx_t_3 = NULL;
7149   PyObject *__pyx_t_4 = NULL;
7150   PyObject *__pyx_t_5 = NULL;
7151   PyObject *__pyx_t_6 = NULL;
7152   PyObject *__pyx_t_7 = NULL;
7153   PyObject *__pyx_t_8 = NULL;
7154   PyObject *__pyx_t_9 = NULL;
7155   int __pyx_t_10;
7156   int __pyx_t_11;
7157   int __pyx_lineno = 0;
7158   const char *__pyx_filename = NULL;
7159   int __pyx_clineno = 0;
7160   __Pyx_RefNannySetupContext("__get__", 0);
7161 
7162   /* "ddtrace/internal/_encoding.pyx":329
7163  *     @property
7164  *     def size(self):
7165  *         with self._lock:             # <<<<<<<<<<<<<<
7166  *             return self._size
7167  *
7168  */
7169   /*with:*/ {
7170     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
7171     __Pyx_GOTREF(__pyx_t_1);
7172     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L3_error)
7173     __Pyx_GOTREF(__pyx_t_3);
7174     __pyx_t_4 = NULL;
7175     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7176       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7177       if (likely(__pyx_t_4)) {
7178         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7179         __Pyx_INCREF(__pyx_t_4);
7180         __Pyx_INCREF(function);
7181         __Pyx_DECREF_SET(__pyx_t_3, function);
7182       }
7183     }
7184     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7185     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7186     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L3_error)
7187     __Pyx_GOTREF(__pyx_t_2);
7188     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7189     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7190     /*try:*/ {
7191       {
7192         __Pyx_PyThreadState_declare
7193         __Pyx_PyThreadState_assign
7194         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
7195         __Pyx_XGOTREF(__pyx_t_5);
7196         __Pyx_XGOTREF(__pyx_t_6);
7197         __Pyx_XGOTREF(__pyx_t_7);
7198         /*try:*/ {
7199 
7200           /* "ddtrace/internal/_encoding.pyx":330
7201  *     def size(self):
7202  *         with self._lock:
7203  *             return self._size             # <<<<<<<<<<<<<<
7204  *
7205  *     cpdef put(self, item):
7206  */
7207           __Pyx_XDECREF(__pyx_r);
7208           __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L7_error)
7209           __Pyx_GOTREF(__pyx_t_2);
7210           __pyx_r = __pyx_t_2;
7211           __pyx_t_2 = 0;
7212           goto __pyx_L11_try_return;
7213 
7214           /* "ddtrace/internal/_encoding.pyx":329
7215  *     @property
7216  *     def size(self):
7217  *         with self._lock:             # <<<<<<<<<<<<<<
7218  *             return self._size
7219  *
7220  */
7221         }
7222         __pyx_L7_error:;
7223         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7224         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7225         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7226         /*except:*/ {
7227           __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7228           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 329, __pyx_L9_except_error)
7229           __Pyx_GOTREF(__pyx_t_2);
7230           __Pyx_GOTREF(__pyx_t_3);
7231           __Pyx_GOTREF(__pyx_t_4);
7232           __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 329, __pyx_L9_except_error)
7233           __Pyx_GOTREF(__pyx_t_8);
7234           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL);
7235           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7236           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7237           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 329, __pyx_L9_except_error)
7238           __Pyx_GOTREF(__pyx_t_9);
7239           __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
7240           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7241           if (__pyx_t_10 < 0) __PYX_ERR(0, 329, __pyx_L9_except_error)
7242           __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
7243           if (__pyx_t_11) {
7244             __Pyx_GIVEREF(__pyx_t_2);
7245             __Pyx_GIVEREF(__pyx_t_3);
7246             __Pyx_XGIVEREF(__pyx_t_4);
7247             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4);
7248             __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
7249             __PYX_ERR(0, 329, __pyx_L9_except_error)
7250           }
7251           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7252           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7253           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7254           goto __pyx_L8_exception_handled;
7255         }
7256         __pyx_L9_except_error:;
7257         __Pyx_XGIVEREF(__pyx_t_5);
7258         __Pyx_XGIVEREF(__pyx_t_6);
7259         __Pyx_XGIVEREF(__pyx_t_7);
7260         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
7261         goto __pyx_L1_error;
7262         __pyx_L11_try_return:;
7263         __Pyx_XGIVEREF(__pyx_t_5);
7264         __Pyx_XGIVEREF(__pyx_t_6);
7265         __Pyx_XGIVEREF(__pyx_t_7);
7266         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
7267         goto __pyx_L4_return;
7268         __pyx_L8_exception_handled:;
7269         __Pyx_XGIVEREF(__pyx_t_5);
7270         __Pyx_XGIVEREF(__pyx_t_6);
7271         __Pyx_XGIVEREF(__pyx_t_7);
7272         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
7273       }
7274     }
7275     /*finally:*/ {
7276       /*normal exit:*/{
7277         if (__pyx_t_1) {
7278           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
7279           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7280           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error)
7281           __Pyx_GOTREF(__pyx_t_7);
7282           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7283         }
7284         goto __pyx_L6;
7285       }
7286       __pyx_L4_return: {
7287         __pyx_t_7 = __pyx_r;
7288         __pyx_r = 0;
7289         if (__pyx_t_1) {
7290           __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
7291           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7292           if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
7293           __Pyx_GOTREF(__pyx_t_6);
7294           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7295         }
7296         __pyx_r = __pyx_t_7;
7297         __pyx_t_7 = 0;
7298         goto __pyx_L0;
7299       }
7300       __pyx_L6:;
7301     }
7302     goto __pyx_L16;
7303     __pyx_L3_error:;
7304     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7305     goto __pyx_L1_error;
7306     __pyx_L16:;
7307   }
7308 
7309   /* "ddtrace/internal/_encoding.pyx":328
7310  *
7311  *     @property
7312  *     def size(self):             # <<<<<<<<<<<<<<
7313  *         with self._lock:
7314  *             return self._size
7315  */
7316 
7317   /* function exit code */
7318   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7319   goto __pyx_L0;
7320   __pyx_L1_error:;
7321   __Pyx_XDECREF(__pyx_t_2);
7322   __Pyx_XDECREF(__pyx_t_3);
7323   __Pyx_XDECREF(__pyx_t_4);
7324   __Pyx_XDECREF(__pyx_t_8);
7325   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7326   __pyx_r = NULL;
7327   __pyx_L0:;
7328   __Pyx_XGIVEREF(__pyx_r);
7329   __Pyx_RefNannyFinishContext();
7330   return __pyx_r;
7331 }
7332 
7333 /* "ddtrace/internal/_encoding.pyx":332
7334  *             return self._size
7335  *
7336  *     cpdef put(self, item):             # <<<<<<<<<<<<<<
7337  *         """Put an item to be serialized in the buffer."""
7338  *         cdef int item_len
7339  */
7340 
7341 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,PyObject * __pyx_v_item,int __pyx_skip_dispatch)7342 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
7343   int __pyx_v_item_len;
7344   PyObject *__pyx_v_encoded_item = NULL;
7345   PyObject *__pyx_r = NULL;
7346   __Pyx_RefNannyDeclarations
7347   PyObject *__pyx_t_1 = NULL;
7348   PyObject *__pyx_t_2 = NULL;
7349   PyObject *__pyx_t_3 = NULL;
7350   PyObject *__pyx_t_4 = NULL;
7351   Py_ssize_t __pyx_t_5;
7352   int __pyx_t_6;
7353   int __pyx_t_7;
7354   PyObject *__pyx_t_8 = NULL;
7355   PyObject *__pyx_t_9 = NULL;
7356   PyObject *__pyx_t_10 = NULL;
7357   PyObject *__pyx_t_11 = NULL;
7358   int __pyx_t_12;
7359   PyObject *__pyx_t_13 = NULL;
7360   int __pyx_lineno = 0;
7361   const char *__pyx_filename = NULL;
7362   int __pyx_clineno = 0;
7363   __Pyx_RefNannySetupContext("put", 0);
7364   /* Check if called by wrapper */
7365   if (unlikely(__pyx_skip_dispatch)) ;
7366   /* Check if overridden in Python */
7367   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
7368     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7369     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
7370     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
7371       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
7372       #endif
7373       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
7374       __Pyx_GOTREF(__pyx_t_1);
7375       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put)) {
7376         __Pyx_XDECREF(__pyx_r);
7377         __Pyx_INCREF(__pyx_t_1);
7378         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
7379         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7380           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7381           if (likely(__pyx_t_4)) {
7382             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7383             __Pyx_INCREF(__pyx_t_4);
7384             __Pyx_INCREF(function);
7385             __Pyx_DECREF_SET(__pyx_t_3, function);
7386           }
7387         }
7388         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item);
7389         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7390         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
7391         __Pyx_GOTREF(__pyx_t_2);
7392         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7393         __pyx_r = __pyx_t_2;
7394         __pyx_t_2 = 0;
7395         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7396         goto __pyx_L0;
7397       }
7398       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7399       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
7400       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
7401       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
7402         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
7403       }
7404       #endif
7405       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7406       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7407     }
7408     #endif
7409   }
7410 
7411   /* "ddtrace/internal/_encoding.pyx":336
7412  *         cdef int item_len
7413  *
7414  *         encoded_item = self.encode_item(item)             # <<<<<<<<<<<<<<
7415  *         item_len = len(encoded_item)
7416  *
7417  */
7418   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_encode_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error)
7419   __Pyx_GOTREF(__pyx_t_2);
7420   __pyx_t_3 = NULL;
7421   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7422     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7423     if (likely(__pyx_t_3)) {
7424       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7425       __Pyx_INCREF(__pyx_t_3);
7426       __Pyx_INCREF(function);
7427       __Pyx_DECREF_SET(__pyx_t_2, function);
7428     }
7429   }
7430   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_item);
7431   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7432   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
7433   __Pyx_GOTREF(__pyx_t_1);
7434   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7435   __pyx_v_encoded_item = __pyx_t_1;
7436   __pyx_t_1 = 0;
7437 
7438   /* "ddtrace/internal/_encoding.pyx":337
7439  *
7440  *         encoded_item = self.encode_item(item)
7441  *         item_len = len(encoded_item)             # <<<<<<<<<<<<<<
7442  *
7443  *         if item_len > self.max_item_size or item_len > self.max_size:
7444  */
7445   __pyx_t_5 = PyObject_Length(__pyx_v_encoded_item); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 337, __pyx_L1_error)
7446   __pyx_v_item_len = __pyx_t_5;
7447 
7448   /* "ddtrace/internal/_encoding.pyx":339
7449  *         item_len = len(encoded_item)
7450  *
7451  *         if item_len > self.max_item_size or item_len > self.max_size:             # <<<<<<<<<<<<<<
7452  *             raise BufferItemTooLarge(item_len)
7453  *
7454  */
7455   __pyx_t_7 = ((__pyx_v_item_len > __pyx_v_self->__pyx_base.max_item_size) != 0);
7456   if (!__pyx_t_7) {
7457   } else {
7458     __pyx_t_6 = __pyx_t_7;
7459     goto __pyx_L4_bool_binop_done;
7460   }
7461   __pyx_t_7 = ((__pyx_v_item_len > __pyx_v_self->__pyx_base.max_size) != 0);
7462   __pyx_t_6 = __pyx_t_7;
7463   __pyx_L4_bool_binop_done:;
7464   if (unlikely(__pyx_t_6)) {
7465 
7466     /* "ddtrace/internal/_encoding.pyx":340
7467  *
7468  *         if item_len > self.max_item_size or item_len > self.max_size:
7469  *             raise BufferItemTooLarge(item_len)             # <<<<<<<<<<<<<<
7470  *
7471  *         with self._lock:
7472  */
7473     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BufferItemTooLarge); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
7474     __Pyx_GOTREF(__pyx_t_2);
7475     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_item_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
7476     __Pyx_GOTREF(__pyx_t_3);
7477     __pyx_t_4 = NULL;
7478     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7479       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
7480       if (likely(__pyx_t_4)) {
7481         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7482         __Pyx_INCREF(__pyx_t_4);
7483         __Pyx_INCREF(function);
7484         __Pyx_DECREF_SET(__pyx_t_2, function);
7485       }
7486     }
7487     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
7488     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7489     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7490     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
7491     __Pyx_GOTREF(__pyx_t_1);
7492     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7493     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7494     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7495     __PYX_ERR(0, 340, __pyx_L1_error)
7496 
7497     /* "ddtrace/internal/_encoding.pyx":339
7498  *         item_len = len(encoded_item)
7499  *
7500  *         if item_len > self.max_item_size or item_len > self.max_size:             # <<<<<<<<<<<<<<
7501  *             raise BufferItemTooLarge(item_len)
7502  *
7503  */
7504   }
7505 
7506   /* "ddtrace/internal/_encoding.pyx":342
7507  *             raise BufferItemTooLarge(item_len)
7508  *
7509  *         with self._lock:             # <<<<<<<<<<<<<<
7510  *             if self._size + item_len <= self.max_size:
7511  *                 self._buffer.append(encoded_item)
7512  */
7513   /*with:*/ {
7514     __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error)
7515     __Pyx_GOTREF(__pyx_t_8);
7516     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L6_error)
7517     __Pyx_GOTREF(__pyx_t_2);
7518     __pyx_t_3 = NULL;
7519     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7520       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7521       if (likely(__pyx_t_3)) {
7522         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7523         __Pyx_INCREF(__pyx_t_3);
7524         __Pyx_INCREF(function);
7525         __Pyx_DECREF_SET(__pyx_t_2, function);
7526       }
7527     }
7528     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7529     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7530     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L6_error)
7531     __Pyx_GOTREF(__pyx_t_1);
7532     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7533     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7534     /*try:*/ {
7535       {
7536         __Pyx_PyThreadState_declare
7537         __Pyx_PyThreadState_assign
7538         __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
7539         __Pyx_XGOTREF(__pyx_t_9);
7540         __Pyx_XGOTREF(__pyx_t_10);
7541         __Pyx_XGOTREF(__pyx_t_11);
7542         /*try:*/ {
7543 
7544           /* "ddtrace/internal/_encoding.pyx":343
7545  *
7546  *         with self._lock:
7547  *             if self._size + item_len <= self.max_size:             # <<<<<<<<<<<<<<
7548  *                 self._buffer.append(encoded_item)
7549  *                 self._size += item_len
7550  */
7551           __pyx_t_6 = (((__pyx_v_self->_size + __pyx_v_item_len) <= __pyx_v_self->__pyx_base.max_size) != 0);
7552           if (likely(__pyx_t_6)) {
7553 
7554             /* "ddtrace/internal/_encoding.pyx":344
7555  *         with self._lock:
7556  *             if self._size + item_len <= self.max_size:
7557  *                 self._buffer.append(encoded_item)             # <<<<<<<<<<<<<<
7558  *                 self._size += item_len
7559  *             else:
7560  */
7561             if (unlikely(__pyx_v_self->_buffer == Py_None)) {
7562               PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
7563               __PYX_ERR(0, 344, __pyx_L10_error)
7564             }
7565             __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_self->_buffer, __pyx_v_encoded_item); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 344, __pyx_L10_error)
7566 
7567             /* "ddtrace/internal/_encoding.pyx":345
7568  *             if self._size + item_len <= self.max_size:
7569  *                 self._buffer.append(encoded_item)
7570  *                 self._size += item_len             # <<<<<<<<<<<<<<
7571  *             else:
7572  *                 raise BufferFull(item_len)
7573  */
7574             __pyx_v_self->_size = (__pyx_v_self->_size + __pyx_v_item_len);
7575 
7576             /* "ddtrace/internal/_encoding.pyx":343
7577  *
7578  *         with self._lock:
7579  *             if self._size + item_len <= self.max_size:             # <<<<<<<<<<<<<<
7580  *                 self._buffer.append(encoded_item)
7581  *                 self._size += item_len
7582  */
7583             goto __pyx_L16;
7584           }
7585 
7586           /* "ddtrace/internal/_encoding.pyx":347
7587  *                 self._size += item_len
7588  *             else:
7589  *                 raise BufferFull(item_len)             # <<<<<<<<<<<<<<
7590  *
7591  *     cpdef get(self):
7592  */
7593           /*else*/ {
7594             __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BufferFull); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L10_error)
7595             __Pyx_GOTREF(__pyx_t_2);
7596             __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_item_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L10_error)
7597             __Pyx_GOTREF(__pyx_t_3);
7598             __pyx_t_4 = NULL;
7599             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7600               __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
7601               if (likely(__pyx_t_4)) {
7602                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7603                 __Pyx_INCREF(__pyx_t_4);
7604                 __Pyx_INCREF(function);
7605                 __Pyx_DECREF_SET(__pyx_t_2, function);
7606               }
7607             }
7608             __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
7609             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7610             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7611             if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L10_error)
7612             __Pyx_GOTREF(__pyx_t_1);
7613             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7614             __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7615             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7616             __PYX_ERR(0, 347, __pyx_L10_error)
7617           }
7618           __pyx_L16:;
7619 
7620           /* "ddtrace/internal/_encoding.pyx":342
7621  *             raise BufferItemTooLarge(item_len)
7622  *
7623  *         with self._lock:             # <<<<<<<<<<<<<<
7624  *             if self._size + item_len <= self.max_size:
7625  *                 self._buffer.append(encoded_item)
7626  */
7627         }
7628         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7629         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7630         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7631         goto __pyx_L15_try_end;
7632         __pyx_L10_error:;
7633         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7634         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7635         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7636         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7637         /*except:*/ {
7638           __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
7639           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 342, __pyx_L12_except_error)
7640           __Pyx_GOTREF(__pyx_t_1);
7641           __Pyx_GOTREF(__pyx_t_2);
7642           __Pyx_GOTREF(__pyx_t_3);
7643           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L12_except_error)
7644           __Pyx_GOTREF(__pyx_t_4);
7645           __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL);
7646           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7647           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7648           if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 342, __pyx_L12_except_error)
7649           __Pyx_GOTREF(__pyx_t_13);
7650           __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_13);
7651           __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7652           if (__pyx_t_6 < 0) __PYX_ERR(0, 342, __pyx_L12_except_error)
7653           __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0);
7654           if (__pyx_t_7) {
7655             __Pyx_GIVEREF(__pyx_t_1);
7656             __Pyx_GIVEREF(__pyx_t_2);
7657             __Pyx_XGIVEREF(__pyx_t_3);
7658             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7659             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
7660             __PYX_ERR(0, 342, __pyx_L12_except_error)
7661           }
7662           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7663           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7664           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7665           goto __pyx_L11_exception_handled;
7666         }
7667         __pyx_L12_except_error:;
7668         __Pyx_XGIVEREF(__pyx_t_9);
7669         __Pyx_XGIVEREF(__pyx_t_10);
7670         __Pyx_XGIVEREF(__pyx_t_11);
7671         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
7672         goto __pyx_L1_error;
7673         __pyx_L11_exception_handled:;
7674         __Pyx_XGIVEREF(__pyx_t_9);
7675         __Pyx_XGIVEREF(__pyx_t_10);
7676         __Pyx_XGIVEREF(__pyx_t_11);
7677         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
7678         __pyx_L15_try_end:;
7679       }
7680     }
7681     /*finally:*/ {
7682       /*normal exit:*/{
7683         if (__pyx_t_8) {
7684           __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__6, NULL);
7685           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7686           if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 342, __pyx_L1_error)
7687           __Pyx_GOTREF(__pyx_t_11);
7688           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7689         }
7690         goto __pyx_L9;
7691       }
7692       __pyx_L9:;
7693     }
7694     goto __pyx_L20;
7695     __pyx_L6_error:;
7696     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7697     goto __pyx_L1_error;
7698     __pyx_L20:;
7699   }
7700 
7701   /* "ddtrace/internal/_encoding.pyx":332
7702  *             return self._size
7703  *
7704  *     cpdef put(self, item):             # <<<<<<<<<<<<<<
7705  *         """Put an item to be serialized in the buffer."""
7706  *         cdef int item_len
7707  */
7708 
7709   /* function exit code */
7710   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7711   goto __pyx_L0;
7712   __pyx_L1_error:;
7713   __Pyx_XDECREF(__pyx_t_1);
7714   __Pyx_XDECREF(__pyx_t_2);
7715   __Pyx_XDECREF(__pyx_t_3);
7716   __Pyx_XDECREF(__pyx_t_4);
7717   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
7718   __pyx_r = 0;
7719   __pyx_L0:;
7720   __Pyx_XDECREF(__pyx_v_encoded_item);
7721   __Pyx_XGIVEREF(__pyx_r);
7722   __Pyx_RefNannyFinishContext();
7723   return __pyx_r;
7724 }
7725 
7726 /* Python wrapper */
7727 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
7728 static char __pyx_doc_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put[] = "Put an item to be serialized in the buffer.";
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put(PyObject * __pyx_v_self,PyObject * __pyx_v_item)7729 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
7730   PyObject *__pyx_r = 0;
7731   __Pyx_RefNannyDeclarations
7732   __Pyx_RefNannySetupContext("put (wrapper)", 0);
7733   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v_item));
7734 
7735   /* function exit code */
7736   __Pyx_RefNannyFinishContext();
7737   return __pyx_r;
7738 }
7739 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,PyObject * __pyx_v_item)7740 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, PyObject *__pyx_v_item) {
7741   PyObject *__pyx_r = NULL;
7742   __Pyx_RefNannyDeclarations
7743   PyObject *__pyx_t_1 = NULL;
7744   int __pyx_lineno = 0;
7745   const char *__pyx_filename = NULL;
7746   int __pyx_clineno = 0;
7747   __Pyx_RefNannySetupContext("put", 0);
7748   __Pyx_XDECREF(__pyx_r);
7749   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
7750   __Pyx_GOTREF(__pyx_t_1);
7751   __pyx_r = __pyx_t_1;
7752   __pyx_t_1 = 0;
7753   goto __pyx_L0;
7754 
7755   /* function exit code */
7756   __pyx_L1_error:;
7757   __Pyx_XDECREF(__pyx_t_1);
7758   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
7759   __pyx_r = NULL;
7760   __pyx_L0:;
7761   __Pyx_XGIVEREF(__pyx_r);
7762   __Pyx_RefNannyFinishContext();
7763   return __pyx_r;
7764 }
7765 
7766 /* "ddtrace/internal/_encoding.pyx":349
7767  *                 raise BufferFull(item_len)
7768  *
7769  *     cpdef get(self):             # <<<<<<<<<<<<<<
7770  *         """Get a copy of the buffer and clear it."""
7771  *         with self._lock:
7772  */
7773 
7774 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,int __pyx_skip_dispatch)7775 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, int __pyx_skip_dispatch) {
7776   PyObject *__pyx_r = NULL;
7777   __Pyx_RefNannyDeclarations
7778   PyObject *__pyx_t_1 = NULL;
7779   PyObject *__pyx_t_2 = NULL;
7780   PyObject *__pyx_t_3 = NULL;
7781   PyObject *__pyx_t_4 = NULL;
7782   PyObject *__pyx_t_5 = NULL;
7783   PyObject *__pyx_t_6 = NULL;
7784   PyObject *__pyx_t_7 = NULL;
7785   PyObject *__pyx_t_8 = NULL;
7786   int __pyx_t_9;
7787   int __pyx_t_10;
7788   char const *__pyx_t_11;
7789   PyObject *__pyx_t_12 = NULL;
7790   PyObject *__pyx_t_13 = NULL;
7791   PyObject *__pyx_t_14 = NULL;
7792   PyObject *__pyx_t_15 = NULL;
7793   PyObject *__pyx_t_16 = NULL;
7794   PyObject *__pyx_t_17 = NULL;
7795   int __pyx_t_18;
7796   int __pyx_t_19;
7797   int __pyx_lineno = 0;
7798   const char *__pyx_filename = NULL;
7799   int __pyx_clineno = 0;
7800   __Pyx_RefNannySetupContext("get", 0);
7801   /* Check if called by wrapper */
7802   if (unlikely(__pyx_skip_dispatch)) ;
7803   /* Check if overridden in Python */
7804   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
7805     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7806     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
7807     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
7808       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
7809       #endif
7810       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
7811       __Pyx_GOTREF(__pyx_t_1);
7812       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get)) {
7813         __Pyx_XDECREF(__pyx_r);
7814         __Pyx_INCREF(__pyx_t_1);
7815         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
7816         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7817           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7818           if (likely(__pyx_t_4)) {
7819             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7820             __Pyx_INCREF(__pyx_t_4);
7821             __Pyx_INCREF(function);
7822             __Pyx_DECREF_SET(__pyx_t_3, function);
7823           }
7824         }
7825         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7826         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7827         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
7828         __Pyx_GOTREF(__pyx_t_2);
7829         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7830         __pyx_r = __pyx_t_2;
7831         __pyx_t_2 = 0;
7832         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7833         goto __pyx_L0;
7834       }
7835       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7836       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
7837       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
7838       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
7839         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
7840       }
7841       #endif
7842       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7843       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
7844     }
7845     #endif
7846   }
7847 
7848   /* "ddtrace/internal/_encoding.pyx":351
7849  *     cpdef get(self):
7850  *         """Get a copy of the buffer and clear it."""
7851  *         with self._lock:             # <<<<<<<<<<<<<<
7852  *             try:
7853  *                 return list(self._buffer)
7854  */
7855   /*with:*/ {
7856     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error)
7857     __Pyx_GOTREF(__pyx_t_5);
7858     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L3_error)
7859     __Pyx_GOTREF(__pyx_t_2);
7860     __pyx_t_3 = NULL;
7861     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7862       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7863       if (likely(__pyx_t_3)) {
7864         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7865         __Pyx_INCREF(__pyx_t_3);
7866         __Pyx_INCREF(function);
7867         __Pyx_DECREF_SET(__pyx_t_2, function);
7868       }
7869     }
7870     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7871     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7872     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L3_error)
7873     __Pyx_GOTREF(__pyx_t_1);
7874     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7875     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7876     /*try:*/ {
7877       {
7878         __Pyx_PyThreadState_declare
7879         __Pyx_PyThreadState_assign
7880         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
7881         __Pyx_XGOTREF(__pyx_t_6);
7882         __Pyx_XGOTREF(__pyx_t_7);
7883         __Pyx_XGOTREF(__pyx_t_8);
7884         /*try:*/ {
7885 
7886           /* "ddtrace/internal/_encoding.pyx":352
7887  *         """Get a copy of the buffer and clear it."""
7888  *         with self._lock:
7889  *             try:             # <<<<<<<<<<<<<<
7890  *                 return list(self._buffer)
7891  *             finally:
7892  */
7893           /*try:*/ {
7894 
7895             /* "ddtrace/internal/_encoding.pyx":353
7896  *         with self._lock:
7897  *             try:
7898  *                 return list(self._buffer)             # <<<<<<<<<<<<<<
7899  *             finally:
7900  *                 self._buffer[:] = []
7901  */
7902             __Pyx_XDECREF(__pyx_r);
7903             __pyx_t_1 = PySequence_List(__pyx_v_self->_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L14_error)
7904             __Pyx_GOTREF(__pyx_t_1);
7905             __pyx_r = __pyx_t_1;
7906             __pyx_t_1 = 0;
7907             goto __pyx_L13_return;
7908           }
7909 
7910           /* "ddtrace/internal/_encoding.pyx":355
7911  *                 return list(self._buffer)
7912  *             finally:
7913  *                 self._buffer[:] = []             # <<<<<<<<<<<<<<
7914  *                 self._size = 0
7915  *
7916  */
7917           /*finally:*/ {
7918             __pyx_L14_error:;
7919             /*exception exit:*/{
7920               __Pyx_PyThreadState_declare
7921               __Pyx_PyThreadState_assign
7922               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
7923               __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7924               __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7925               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7926               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7927               if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
7928               if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
7929               __Pyx_XGOTREF(__pyx_t_12);
7930               __Pyx_XGOTREF(__pyx_t_13);
7931               __Pyx_XGOTREF(__pyx_t_14);
7932               __Pyx_XGOTREF(__pyx_t_15);
7933               __Pyx_XGOTREF(__pyx_t_16);
7934               __Pyx_XGOTREF(__pyx_t_17);
7935               __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
7936               {
7937                 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L17_error)
7938                 __Pyx_GOTREF(__pyx_t_1);
7939                 if (unlikely(__pyx_v_self->_buffer == Py_None)) {
7940                   PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7941                   __PYX_ERR(0, 355, __pyx_L17_error)
7942                 }
7943                 if (__Pyx_PyObject_SetSlice(__pyx_v_self->_buffer, __pyx_t_1, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 355, __pyx_L17_error)
7944                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7945 
7946                 /* "ddtrace/internal/_encoding.pyx":356
7947  *             finally:
7948  *                 self._buffer[:] = []
7949  *                 self._size = 0             # <<<<<<<<<<<<<<
7950  *
7951  *     def encode_item(self, item):
7952  */
7953                 __pyx_v_self->_size = 0;
7954               }
7955               if (PY_MAJOR_VERSION >= 3) {
7956                 __Pyx_XGIVEREF(__pyx_t_15);
7957                 __Pyx_XGIVEREF(__pyx_t_16);
7958                 __Pyx_XGIVEREF(__pyx_t_17);
7959                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
7960               }
7961               __Pyx_XGIVEREF(__pyx_t_12);
7962               __Pyx_XGIVEREF(__pyx_t_13);
7963               __Pyx_XGIVEREF(__pyx_t_14);
7964               __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
7965               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
7966               __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
7967               goto __pyx_L7_error;
7968               __pyx_L17_error:;
7969               if (PY_MAJOR_VERSION >= 3) {
7970                 __Pyx_XGIVEREF(__pyx_t_15);
7971                 __Pyx_XGIVEREF(__pyx_t_16);
7972                 __Pyx_XGIVEREF(__pyx_t_17);
7973                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
7974               }
7975               __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
7976               __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7977               __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
7978               __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
7979               goto __pyx_L7_error;
7980             }
7981             __pyx_L13_return: {
7982               __pyx_t_17 = __pyx_r;
7983               __pyx_r = 0;
7984 
7985               /* "ddtrace/internal/_encoding.pyx":355
7986  *                 return list(self._buffer)
7987  *             finally:
7988  *                 self._buffer[:] = []             # <<<<<<<<<<<<<<
7989  *                 self._size = 0
7990  *
7991  */
7992               __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L7_error)
7993               __Pyx_GOTREF(__pyx_t_1);
7994               if (unlikely(__pyx_v_self->_buffer == Py_None)) {
7995                 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7996                 __PYX_ERR(0, 355, __pyx_L7_error)
7997               }
7998               if (__Pyx_PyObject_SetSlice(__pyx_v_self->_buffer, __pyx_t_1, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 355, __pyx_L7_error)
7999               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8000 
8001               /* "ddtrace/internal/_encoding.pyx":356
8002  *             finally:
8003  *                 self._buffer[:] = []
8004  *                 self._size = 0             # <<<<<<<<<<<<<<
8005  *
8006  *     def encode_item(self, item):
8007  */
8008               __pyx_v_self->_size = 0;
8009               __pyx_r = __pyx_t_17;
8010               __pyx_t_17 = 0;
8011               goto __pyx_L11_try_return;
8012             }
8013           }
8014 
8015           /* "ddtrace/internal/_encoding.pyx":351
8016  *     cpdef get(self):
8017  *         """Get a copy of the buffer and clear it."""
8018  *         with self._lock:             # <<<<<<<<<<<<<<
8019  *             try:
8020  *                 return list(self._buffer)
8021  */
8022         }
8023         __pyx_L7_error:;
8024         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8025         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8026         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8027         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8028         /*except:*/ {
8029           __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
8030           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 351, __pyx_L9_except_error)
8031           __Pyx_GOTREF(__pyx_t_1);
8032           __Pyx_GOTREF(__pyx_t_2);
8033           __Pyx_GOTREF(__pyx_t_3);
8034           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L9_except_error)
8035           __Pyx_GOTREF(__pyx_t_4);
8036           __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
8037           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8038           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8039           if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 351, __pyx_L9_except_error)
8040           __Pyx_GOTREF(__pyx_t_17);
8041           __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
8042           __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8043           if (__pyx_t_18 < 0) __PYX_ERR(0, 351, __pyx_L9_except_error)
8044           __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
8045           if (__pyx_t_19) {
8046             __Pyx_GIVEREF(__pyx_t_1);
8047             __Pyx_GIVEREF(__pyx_t_2);
8048             __Pyx_XGIVEREF(__pyx_t_3);
8049             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8050             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
8051             __PYX_ERR(0, 351, __pyx_L9_except_error)
8052           }
8053           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8054           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8055           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8056           goto __pyx_L8_exception_handled;
8057         }
8058         __pyx_L9_except_error:;
8059         __Pyx_XGIVEREF(__pyx_t_6);
8060         __Pyx_XGIVEREF(__pyx_t_7);
8061         __Pyx_XGIVEREF(__pyx_t_8);
8062         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
8063         goto __pyx_L1_error;
8064         __pyx_L11_try_return:;
8065         __Pyx_XGIVEREF(__pyx_t_6);
8066         __Pyx_XGIVEREF(__pyx_t_7);
8067         __Pyx_XGIVEREF(__pyx_t_8);
8068         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
8069         goto __pyx_L4_return;
8070         __pyx_L8_exception_handled:;
8071         __Pyx_XGIVEREF(__pyx_t_6);
8072         __Pyx_XGIVEREF(__pyx_t_7);
8073         __Pyx_XGIVEREF(__pyx_t_8);
8074         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
8075       }
8076     }
8077     /*finally:*/ {
8078       /*normal exit:*/{
8079         if (__pyx_t_5) {
8080           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
8081           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8082           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 351, __pyx_L1_error)
8083           __Pyx_GOTREF(__pyx_t_8);
8084           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8085         }
8086         goto __pyx_L6;
8087       }
8088       __pyx_L4_return: {
8089         __pyx_t_8 = __pyx_r;
8090         __pyx_r = 0;
8091         if (__pyx_t_5) {
8092           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
8093           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8094           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 351, __pyx_L1_error)
8095           __Pyx_GOTREF(__pyx_t_7);
8096           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8097         }
8098         __pyx_r = __pyx_t_8;
8099         __pyx_t_8 = 0;
8100         goto __pyx_L0;
8101       }
8102       __pyx_L6:;
8103     }
8104     goto __pyx_L21;
8105     __pyx_L3_error:;
8106     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8107     goto __pyx_L1_error;
8108     __pyx_L21:;
8109   }
8110 
8111   /* "ddtrace/internal/_encoding.pyx":349
8112  *                 raise BufferFull(item_len)
8113  *
8114  *     cpdef get(self):             # <<<<<<<<<<<<<<
8115  *         """Get a copy of the buffer and clear it."""
8116  *         with self._lock:
8117  */
8118 
8119   /* function exit code */
8120   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8121   goto __pyx_L0;
8122   __pyx_L1_error:;
8123   __Pyx_XDECREF(__pyx_t_1);
8124   __Pyx_XDECREF(__pyx_t_2);
8125   __Pyx_XDECREF(__pyx_t_3);
8126   __Pyx_XDECREF(__pyx_t_4);
8127   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
8128   __pyx_r = 0;
8129   __pyx_L0:;
8130   __Pyx_XGIVEREF(__pyx_r);
8131   __Pyx_RefNannyFinishContext();
8132   return __pyx_r;
8133 }
8134 
8135 /* Python wrapper */
8136 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8137 static char __pyx_doc_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get[] = "Get a copy of the buffer and clear it.";
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8138 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8139   PyObject *__pyx_r = 0;
8140   __Pyx_RefNannyDeclarations
8141   __Pyx_RefNannySetupContext("get (wrapper)", 0);
8142   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self));
8143 
8144   /* function exit code */
8145   __Pyx_RefNannyFinishContext();
8146   return __pyx_r;
8147 }
8148 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self)8149 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self) {
8150   PyObject *__pyx_r = NULL;
8151   __Pyx_RefNannyDeclarations
8152   PyObject *__pyx_t_1 = NULL;
8153   int __pyx_lineno = 0;
8154   const char *__pyx_filename = NULL;
8155   int __pyx_clineno = 0;
8156   __Pyx_RefNannySetupContext("get", 0);
8157   __Pyx_XDECREF(__pyx_r);
8158   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
8159   __Pyx_GOTREF(__pyx_t_1);
8160   __pyx_r = __pyx_t_1;
8161   __pyx_t_1 = 0;
8162   goto __pyx_L0;
8163 
8164   /* function exit code */
8165   __pyx_L1_error:;
8166   __Pyx_XDECREF(__pyx_t_1);
8167   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
8168   __pyx_r = NULL;
8169   __pyx_L0:;
8170   __Pyx_XGIVEREF(__pyx_r);
8171   __Pyx_RefNannyFinishContext();
8172   return __pyx_r;
8173 }
8174 
8175 /* "ddtrace/internal/_encoding.pyx":358
8176  *                 self._size = 0
8177  *
8178  *     def encode_item(self, item):             # <<<<<<<<<<<<<<
8179  *         raise NotImplementedError()
8180  *
8181  */
8182 
8183 /* Python wrapper */
8184 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_9encode_item(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_9encode_item(PyObject * __pyx_v_self,PyObject * __pyx_v_item)8185 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_9encode_item(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8186   PyObject *__pyx_r = 0;
8187   __Pyx_RefNannyDeclarations
8188   __Pyx_RefNannySetupContext("encode_item (wrapper)", 0);
8189   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_8encode_item(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8190 
8191   /* function exit code */
8192   __Pyx_RefNannyFinishContext();
8193   return __pyx_r;
8194 }
8195 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_8encode_item(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_item)8196 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_8encode_item(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_item) {
8197   PyObject *__pyx_r = NULL;
8198   __Pyx_RefNannyDeclarations
8199   PyObject *__pyx_t_1 = NULL;
8200   int __pyx_lineno = 0;
8201   const char *__pyx_filename = NULL;
8202   int __pyx_clineno = 0;
8203   __Pyx_RefNannySetupContext("encode_item", 0);
8204 
8205   /* "ddtrace/internal/_encoding.pyx":359
8206  *
8207  *     def encode_item(self, item):
8208  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
8209  *
8210  *
8211  */
8212   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
8213   __Pyx_GOTREF(__pyx_t_1);
8214   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8215   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8216   __PYX_ERR(0, 359, __pyx_L1_error)
8217 
8218   /* "ddtrace/internal/_encoding.pyx":358
8219  *                 self._size = 0
8220  *
8221  *     def encode_item(self, item):             # <<<<<<<<<<<<<<
8222  *         raise NotImplementedError()
8223  *
8224  */
8225 
8226   /* function exit code */
8227   __pyx_L1_error:;
8228   __Pyx_XDECREF(__pyx_t_1);
8229   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.encode_item", __pyx_clineno, __pyx_lineno, __pyx_filename);
8230   __pyx_r = NULL;
8231   __Pyx_XGIVEREF(__pyx_r);
8232   __Pyx_RefNannyFinishContext();
8233   return __pyx_r;
8234 }
8235 
8236 /* "(tree fragment)":1
8237  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8238  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8239  * def __setstate_cython__(self, __pyx_state):
8240  */
8241 
8242 /* Python wrapper */
8243 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_11__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8244 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8245   PyObject *__pyx_r = 0;
8246   __Pyx_RefNannyDeclarations
8247   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8248   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_10__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self));
8249 
8250   /* function exit code */
8251   __Pyx_RefNannyFinishContext();
8252   return __pyx_r;
8253 }
8254 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self)8255 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self) {
8256   PyObject *__pyx_r = NULL;
8257   __Pyx_RefNannyDeclarations
8258   PyObject *__pyx_t_1 = NULL;
8259   int __pyx_lineno = 0;
8260   const char *__pyx_filename = NULL;
8261   int __pyx_clineno = 0;
8262   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8263 
8264   /* "(tree fragment)":2
8265  * def __reduce_cython__(self):
8266  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8267  * def __setstate_cython__(self, __pyx_state):
8268  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8269  */
8270   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8271   __Pyx_GOTREF(__pyx_t_1);
8272   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8273   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8274   __PYX_ERR(1, 2, __pyx_L1_error)
8275 
8276   /* "(tree fragment)":1
8277  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8278  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8279  * def __setstate_cython__(self, __pyx_state):
8280  */
8281 
8282   /* function exit code */
8283   __pyx_L1_error:;
8284   __Pyx_XDECREF(__pyx_t_1);
8285   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8286   __pyx_r = NULL;
8287   __Pyx_XGIVEREF(__pyx_r);
8288   __Pyx_RefNannyFinishContext();
8289   return __pyx_r;
8290 }
8291 
8292 /* "(tree fragment)":3
8293  * def __reduce_cython__(self):
8294  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8295  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8296  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8297  */
8298 
8299 /* Python wrapper */
8300 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_13__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8301 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8302   PyObject *__pyx_r = 0;
8303   __Pyx_RefNannyDeclarations
8304   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8305   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_12__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8306 
8307   /* function exit code */
8308   __Pyx_RefNannyFinishContext();
8309   return __pyx_r;
8310 }
8311 
__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8312 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8313   PyObject *__pyx_r = NULL;
8314   __Pyx_RefNannyDeclarations
8315   PyObject *__pyx_t_1 = NULL;
8316   int __pyx_lineno = 0;
8317   const char *__pyx_filename = NULL;
8318   int __pyx_clineno = 0;
8319   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8320 
8321   /* "(tree fragment)":4
8322  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8323  * def __setstate_cython__(self, __pyx_state):
8324  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8325  */
8326   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8327   __Pyx_GOTREF(__pyx_t_1);
8328   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8329   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8330   __PYX_ERR(1, 4, __pyx_L1_error)
8331 
8332   /* "(tree fragment)":3
8333  * def __reduce_cython__(self):
8334  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8335  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8336  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8337  */
8338 
8339   /* function exit code */
8340   __pyx_L1_error:;
8341   __Pyx_XDECREF(__pyx_t_1);
8342   __Pyx_AddTraceback("ddtrace.internal._encoding.ListBufferedEncoder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8343   __pyx_r = NULL;
8344   __Pyx_XGIVEREF(__pyx_r);
8345   __Pyx_RefNannyFinishContext();
8346   return __pyx_r;
8347 }
8348 
8349 /* "ddtrace/internal/_encoding.pyx":368
8350  *     cdef stdint.uint32_t _count
8351  *
8352  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
8353  *         cdef int buf_size = 1024*1024
8354  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8355  */
8356 
8357 /* Python wrapper */
8358 static int __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8359 static int __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8360   size_t __pyx_v_max_size;
8361   size_t __pyx_v_max_item_size;
8362   int __pyx_lineno = 0;
8363   const char *__pyx_filename = NULL;
8364   int __pyx_clineno = 0;
8365   int __pyx_r;
8366   __Pyx_RefNannyDeclarations
8367   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8368   {
8369     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_size,&__pyx_n_s_max_item_size,0};
8370     PyObject* values[2] = {0,0};
8371     if (unlikely(__pyx_kwds)) {
8372       Py_ssize_t kw_args;
8373       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8374       switch (pos_args) {
8375         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8376         CYTHON_FALLTHROUGH;
8377         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8378         CYTHON_FALLTHROUGH;
8379         case  0: break;
8380         default: goto __pyx_L5_argtuple_error;
8381       }
8382       kw_args = PyDict_Size(__pyx_kwds);
8383       switch (pos_args) {
8384         case  0:
8385         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_size)) != 0)) kw_args--;
8386         else goto __pyx_L5_argtuple_error;
8387         CYTHON_FALLTHROUGH;
8388         case  1:
8389         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_item_size)) != 0)) kw_args--;
8390         else {
8391           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 368, __pyx_L3_error)
8392         }
8393       }
8394       if (unlikely(kw_args > 0)) {
8395         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 368, __pyx_L3_error)
8396       }
8397     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8398       goto __pyx_L5_argtuple_error;
8399     } else {
8400       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8401       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8402     }
8403     __pyx_v_max_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_max_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
8404     __pyx_v_max_item_size = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_max_item_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
8405   }
8406   goto __pyx_L4_argument_unpacking_done;
8407   __pyx_L5_argtuple_error:;
8408   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 368, __pyx_L3_error)
8409   __pyx_L3_error:;
8410   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8411   __Pyx_RefNannyFinishContext();
8412   return -1;
8413   __pyx_L4_argument_unpacking_done:;
8414   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase___cinit__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self), __pyx_v_max_size, __pyx_v_max_item_size);
8415 
8416   /* function exit code */
8417   __Pyx_RefNannyFinishContext();
8418   return __pyx_r;
8419 }
8420 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,size_t __pyx_v_max_size,size_t __pyx_v_max_item_size)8421 static int __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, size_t __pyx_v_max_size, size_t __pyx_v_max_item_size) {
8422   int __pyx_v_buf_size;
8423   int __pyx_r;
8424   __Pyx_RefNannyDeclarations
8425   int __pyx_t_1;
8426   PyObject *__pyx_t_2 = NULL;
8427   size_t __pyx_t_3;
8428   PyObject *__pyx_t_4 = NULL;
8429   PyObject *__pyx_t_5 = NULL;
8430   int __pyx_lineno = 0;
8431   const char *__pyx_filename = NULL;
8432   int __pyx_clineno = 0;
8433   __Pyx_RefNannySetupContext("__cinit__", 0);
8434 
8435   /* "ddtrace/internal/_encoding.pyx":369
8436  *
8437  *     def __cinit__(self, size_t max_size, size_t max_item_size):
8438  *         cdef int buf_size = 1024*1024             # <<<<<<<<<<<<<<
8439  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8440  *         if self.pk.buf == NULL:
8441  */
8442   __pyx_v_buf_size = 0x100000;
8443 
8444   /* "ddtrace/internal/_encoding.pyx":370
8445  *     def __cinit__(self, size_t max_size, size_t max_item_size):
8446  *         cdef int buf_size = 1024*1024
8447  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)             # <<<<<<<<<<<<<<
8448  *         if self.pk.buf == NULL:
8449  *             raise MemoryError("Unable to allocate internal buffer.")
8450  */
8451   __pyx_v_self->pk.buf = ((char *)PyMem_Malloc(__pyx_v_buf_size));
8452 
8453   /* "ddtrace/internal/_encoding.pyx":371
8454  *         cdef int buf_size = 1024*1024
8455  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8456  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
8457  *             raise MemoryError("Unable to allocate internal buffer.")
8458  *
8459  */
8460   __pyx_t_1 = ((__pyx_v_self->pk.buf == NULL) != 0);
8461   if (unlikely(__pyx_t_1)) {
8462 
8463     /* "ddtrace/internal/_encoding.pyx":372
8464  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8465  *         if self.pk.buf == NULL:
8466  *             raise MemoryError("Unable to allocate internal buffer.")             # <<<<<<<<<<<<<<
8467  *
8468  *         self.max_size = max_size
8469  */
8470     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
8471     __Pyx_GOTREF(__pyx_t_2);
8472     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8473     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8474     __PYX_ERR(0, 372, __pyx_L1_error)
8475 
8476     /* "ddtrace/internal/_encoding.pyx":371
8477  *         cdef int buf_size = 1024*1024
8478  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8479  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
8480  *             raise MemoryError("Unable to allocate internal buffer.")
8481  *
8482  */
8483   }
8484 
8485   /* "ddtrace/internal/_encoding.pyx":374
8486  *             raise MemoryError("Unable to allocate internal buffer.")
8487  *
8488  *         self.max_size = max_size             # <<<<<<<<<<<<<<
8489  *         self.pk.buf_size = buf_size
8490  *         self.max_item_size = max_item_size if max_item_size < max_size else max_size
8491  */
8492   __pyx_v_self->__pyx_base.max_size = __pyx_v_max_size;
8493 
8494   /* "ddtrace/internal/_encoding.pyx":375
8495  *
8496  *         self.max_size = max_size
8497  *         self.pk.buf_size = buf_size             # <<<<<<<<<<<<<<
8498  *         self.max_item_size = max_item_size if max_item_size < max_size else max_size
8499  *         self._lock = threading.RLock()
8500  */
8501   __pyx_v_self->pk.buf_size = __pyx_v_buf_size;
8502 
8503   /* "ddtrace/internal/_encoding.pyx":376
8504  *         self.max_size = max_size
8505  *         self.pk.buf_size = buf_size
8506  *         self.max_item_size = max_item_size if max_item_size < max_size else max_size             # <<<<<<<<<<<<<<
8507  *         self._lock = threading.RLock()
8508  *         self._reset_buffer()
8509  */
8510   if (((__pyx_v_max_item_size < __pyx_v_max_size) != 0)) {
8511     __pyx_t_3 = __pyx_v_max_item_size;
8512   } else {
8513     __pyx_t_3 = __pyx_v_max_size;
8514   }
8515   __pyx_v_self->__pyx_base.max_item_size = __pyx_t_3;
8516 
8517   /* "ddtrace/internal/_encoding.pyx":377
8518  *         self.pk.buf_size = buf_size
8519  *         self.max_item_size = max_item_size if max_item_size < max_size else max_size
8520  *         self._lock = threading.RLock()             # <<<<<<<<<<<<<<
8521  *         self._reset_buffer()
8522  *
8523  */
8524   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_threading); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 377, __pyx_L1_error)
8525   __Pyx_GOTREF(__pyx_t_4);
8526   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_RLock); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error)
8527   __Pyx_GOTREF(__pyx_t_5);
8528   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8529   __pyx_t_4 = NULL;
8530   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8531     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
8532     if (likely(__pyx_t_4)) {
8533       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8534       __Pyx_INCREF(__pyx_t_4);
8535       __Pyx_INCREF(function);
8536       __Pyx_DECREF_SET(__pyx_t_5, function);
8537     }
8538   }
8539   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8540   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8541   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
8542   __Pyx_GOTREF(__pyx_t_2);
8543   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8544   __Pyx_GIVEREF(__pyx_t_2);
8545   __Pyx_GOTREF(__pyx_v_self->__pyx_base._lock);
8546   __Pyx_DECREF(__pyx_v_self->__pyx_base._lock);
8547   __pyx_v_self->__pyx_base._lock = __pyx_t_2;
8548   __pyx_t_2 = 0;
8549 
8550   /* "ddtrace/internal/_encoding.pyx":378
8551  *         self.max_item_size = max_item_size if max_item_size < max_size else max_size
8552  *         self._lock = threading.RLock()
8553  *         self._reset_buffer()             # <<<<<<<<<<<<<<
8554  *
8555  *     def __dealloc__(self):
8556  */
8557   __pyx_t_2 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self->__pyx_vtab)->_reset_buffer(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
8558   __Pyx_GOTREF(__pyx_t_2);
8559   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8560 
8561   /* "ddtrace/internal/_encoding.pyx":368
8562  *     cdef stdint.uint32_t _count
8563  *
8564  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
8565  *         cdef int buf_size = 1024*1024
8566  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
8567  */
8568 
8569   /* function exit code */
8570   __pyx_r = 0;
8571   goto __pyx_L0;
8572   __pyx_L1_error:;
8573   __Pyx_XDECREF(__pyx_t_2);
8574   __Pyx_XDECREF(__pyx_t_4);
8575   __Pyx_XDECREF(__pyx_t_5);
8576   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8577   __pyx_r = -1;
8578   __pyx_L0:;
8579   __Pyx_RefNannyFinishContext();
8580   return __pyx_r;
8581 }
8582 
8583 /* "ddtrace/internal/_encoding.pyx":380
8584  *         self._reset_buffer()
8585  *
8586  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
8587  *         PyMem_Free(self.pk.buf)
8588  *         self.pk.buf = NULL
8589  */
8590 
8591 /* Python wrapper */
8592 static void __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_3__dealloc__(PyObject * __pyx_v_self)8593 static void __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_3__dealloc__(PyObject *__pyx_v_self) {
8594   __Pyx_RefNannyDeclarations
8595   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8596   __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_2__dealloc__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
8597 
8598   /* function exit code */
8599   __Pyx_RefNannyFinishContext();
8600 }
8601 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)8602 static void __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_2__dealloc__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
8603   __Pyx_RefNannyDeclarations
8604   __Pyx_RefNannySetupContext("__dealloc__", 0);
8605 
8606   /* "ddtrace/internal/_encoding.pyx":381
8607  *
8608  *     def __dealloc__(self):
8609  *         PyMem_Free(self.pk.buf)             # <<<<<<<<<<<<<<
8610  *         self.pk.buf = NULL
8611  *
8612  */
8613   PyMem_Free(__pyx_v_self->pk.buf);
8614 
8615   /* "ddtrace/internal/_encoding.pyx":382
8616  *     def __dealloc__(self):
8617  *         PyMem_Free(self.pk.buf)
8618  *         self.pk.buf = NULL             # <<<<<<<<<<<<<<
8619  *
8620  *     def __len__(self):  # TODO: Use a better name?
8621  */
8622   __pyx_v_self->pk.buf = NULL;
8623 
8624   /* "ddtrace/internal/_encoding.pyx":380
8625  *         self._reset_buffer()
8626  *
8627  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
8628  *         PyMem_Free(self.pk.buf)
8629  *         self.pk.buf = NULL
8630  */
8631 
8632   /* function exit code */
8633   __Pyx_RefNannyFinishContext();
8634 }
8635 
8636 /* "ddtrace/internal/_encoding.pyx":384
8637  *         self.pk.buf = NULL
8638  *
8639  *     def __len__(self):  # TODO: Use a better name?             # <<<<<<<<<<<<<<
8640  *         return self._count
8641  *
8642  */
8643 
8644 /* Python wrapper */
8645 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_5__len__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_5__len__(PyObject * __pyx_v_self)8646 static Py_ssize_t __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_5__len__(PyObject *__pyx_v_self) {
8647   Py_ssize_t __pyx_r;
8648   __Pyx_RefNannyDeclarations
8649   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8650   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4__len__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
8651 
8652   /* function exit code */
8653   __Pyx_RefNannyFinishContext();
8654   return __pyx_r;
8655 }
8656 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)8657 static Py_ssize_t __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4__len__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
8658   Py_ssize_t __pyx_r;
8659   __Pyx_RefNannyDeclarations
8660   __Pyx_RefNannySetupContext("__len__", 0);
8661 
8662   /* "ddtrace/internal/_encoding.pyx":385
8663  *
8664  *     def __len__(self):  # TODO: Use a better name?
8665  *         return self._count             # <<<<<<<<<<<<<<
8666  *
8667  *     cpdef _decode(self, data):
8668  */
8669   __pyx_r = __pyx_v_self->_count;
8670   goto __pyx_L0;
8671 
8672   /* "ddtrace/internal/_encoding.pyx":384
8673  *         self.pk.buf = NULL
8674  *
8675  *     def __len__(self):  # TODO: Use a better name?             # <<<<<<<<<<<<<<
8676  *         return self._count
8677  *
8678  */
8679 
8680   /* function exit code */
8681   __pyx_L0:;
8682   __Pyx_RefNannyFinishContext();
8683   return __pyx_r;
8684 }
8685 
8686 /* "ddtrace/internal/_encoding.pyx":387
8687  *         return self._count
8688  *
8689  *     cpdef _decode(self, data):             # <<<<<<<<<<<<<<
8690  *         import msgpack
8691  *         if msgpack.version[:2] < (0, 6):
8692  */
8693 
8694 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__decode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,PyObject * __pyx_v_data,int __pyx_skip_dispatch)8695 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__decode(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
8696   PyObject *__pyx_v_msgpack = NULL;
8697   PyObject *__pyx_r = NULL;
8698   __Pyx_RefNannyDeclarations
8699   PyObject *__pyx_t_1 = NULL;
8700   PyObject *__pyx_t_2 = NULL;
8701   PyObject *__pyx_t_3 = NULL;
8702   PyObject *__pyx_t_4 = NULL;
8703   int __pyx_t_5;
8704   int __pyx_lineno = 0;
8705   const char *__pyx_filename = NULL;
8706   int __pyx_clineno = 0;
8707   __Pyx_RefNannySetupContext("_decode", 0);
8708   /* Check if called by wrapper */
8709   if (unlikely(__pyx_skip_dispatch)) ;
8710   /* Check if overridden in Python */
8711   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
8712     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
8713     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
8714     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
8715       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
8716       #endif
8717       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
8718       __Pyx_GOTREF(__pyx_t_1);
8719       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode)) {
8720         __Pyx_XDECREF(__pyx_r);
8721         __Pyx_INCREF(__pyx_t_1);
8722         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
8723         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8724           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8725           if (likely(__pyx_t_4)) {
8726             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8727             __Pyx_INCREF(__pyx_t_4);
8728             __Pyx_INCREF(function);
8729             __Pyx_DECREF_SET(__pyx_t_3, function);
8730           }
8731         }
8732         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_data);
8733         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8734         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
8735         __Pyx_GOTREF(__pyx_t_2);
8736         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8737         __pyx_r = __pyx_t_2;
8738         __pyx_t_2 = 0;
8739         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8740         goto __pyx_L0;
8741       }
8742       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
8743       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
8744       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
8745       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
8746         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
8747       }
8748       #endif
8749       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8750       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
8751     }
8752     #endif
8753   }
8754 
8755   /* "ddtrace/internal/_encoding.pyx":388
8756  *
8757  *     cpdef _decode(self, data):
8758  *         import msgpack             # <<<<<<<<<<<<<<
8759  *         if msgpack.version[:2] < (0, 6):
8760  *             return msgpack.unpackb(data)
8761  */
8762   __pyx_t_1 = __Pyx_Import(__pyx_n_s_msgpack, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
8763   __Pyx_GOTREF(__pyx_t_1);
8764   __pyx_v_msgpack = __pyx_t_1;
8765   __pyx_t_1 = 0;
8766 
8767   /* "ddtrace/internal/_encoding.pyx":389
8768  *     cpdef _decode(self, data):
8769  *         import msgpack
8770  *         if msgpack.version[:2] < (0, 6):             # <<<<<<<<<<<<<<
8771  *             return msgpack.unpackb(data)
8772  *         return msgpack.unpackb(data, raw=True)
8773  */
8774   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_msgpack, __pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
8775   __Pyx_GOTREF(__pyx_t_1);
8776   __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 2, NULL, NULL, &__pyx_slice__14, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
8777   __Pyx_GOTREF(__pyx_t_2);
8778   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8779   __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_tuple__15, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
8780   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8781   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 389, __pyx_L1_error)
8782   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8783   if (__pyx_t_5) {
8784 
8785     /* "ddtrace/internal/_encoding.pyx":390
8786  *         import msgpack
8787  *         if msgpack.version[:2] < (0, 6):
8788  *             return msgpack.unpackb(data)             # <<<<<<<<<<<<<<
8789  *         return msgpack.unpackb(data, raw=True)
8790  *
8791  */
8792     __Pyx_XDECREF(__pyx_r);
8793     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_msgpack, __pyx_n_s_unpackb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
8794     __Pyx_GOTREF(__pyx_t_2);
8795     __pyx_t_3 = NULL;
8796     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8797       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8798       if (likely(__pyx_t_3)) {
8799         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8800         __Pyx_INCREF(__pyx_t_3);
8801         __Pyx_INCREF(function);
8802         __Pyx_DECREF_SET(__pyx_t_2, function);
8803       }
8804     }
8805     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_data);
8806     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8807     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
8808     __Pyx_GOTREF(__pyx_t_1);
8809     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8810     __pyx_r = __pyx_t_1;
8811     __pyx_t_1 = 0;
8812     goto __pyx_L0;
8813 
8814     /* "ddtrace/internal/_encoding.pyx":389
8815  *     cpdef _decode(self, data):
8816  *         import msgpack
8817  *         if msgpack.version[:2] < (0, 6):             # <<<<<<<<<<<<<<
8818  *             return msgpack.unpackb(data)
8819  *         return msgpack.unpackb(data, raw=True)
8820  */
8821   }
8822 
8823   /* "ddtrace/internal/_encoding.pyx":391
8824  *         if msgpack.version[:2] < (0, 6):
8825  *             return msgpack.unpackb(data)
8826  *         return msgpack.unpackb(data, raw=True)             # <<<<<<<<<<<<<<
8827  *
8828  *     cdef _reset_buffer(self):
8829  */
8830   __Pyx_XDECREF(__pyx_r);
8831   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_msgpack, __pyx_n_s_unpackb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
8832   __Pyx_GOTREF(__pyx_t_1);
8833   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
8834   __Pyx_GOTREF(__pyx_t_2);
8835   __Pyx_INCREF(__pyx_v_data);
8836   __Pyx_GIVEREF(__pyx_v_data);
8837   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
8838   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
8839   __Pyx_GOTREF(__pyx_t_3);
8840   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_raw, Py_True) < 0) __PYX_ERR(0, 391, __pyx_L1_error)
8841   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error)
8842   __Pyx_GOTREF(__pyx_t_4);
8843   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8844   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8845   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8846   __pyx_r = __pyx_t_4;
8847   __pyx_t_4 = 0;
8848   goto __pyx_L0;
8849 
8850   /* "ddtrace/internal/_encoding.pyx":387
8851  *         return self._count
8852  *
8853  *     cpdef _decode(self, data):             # <<<<<<<<<<<<<<
8854  *         import msgpack
8855  *         if msgpack.version[:2] < (0, 6):
8856  */
8857 
8858   /* function exit code */
8859   __pyx_L1_error:;
8860   __Pyx_XDECREF(__pyx_t_1);
8861   __Pyx_XDECREF(__pyx_t_2);
8862   __Pyx_XDECREF(__pyx_t_3);
8863   __Pyx_XDECREF(__pyx_t_4);
8864   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase._decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
8865   __pyx_r = 0;
8866   __pyx_L0:;
8867   __Pyx_XDECREF(__pyx_v_msgpack);
8868   __Pyx_XGIVEREF(__pyx_r);
8869   __Pyx_RefNannyFinishContext();
8870   return __pyx_r;
8871 }
8872 
8873 /* Python wrapper */
8874 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode(PyObject * __pyx_v_self,PyObject * __pyx_v_data)8875 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
8876   PyObject *__pyx_r = 0;
8877   __Pyx_RefNannyDeclarations
8878   __Pyx_RefNannySetupContext("_decode (wrapper)", 0);
8879   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_6_decode(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self), ((PyObject *)__pyx_v_data));
8880 
8881   /* function exit code */
8882   __Pyx_RefNannyFinishContext();
8883   return __pyx_r;
8884 }
8885 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_6_decode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,PyObject * __pyx_v_data)8886 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_6_decode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_data) {
8887   PyObject *__pyx_r = NULL;
8888   __Pyx_RefNannyDeclarations
8889   PyObject *__pyx_t_1 = NULL;
8890   int __pyx_lineno = 0;
8891   const char *__pyx_filename = NULL;
8892   int __pyx_clineno = 0;
8893   __Pyx_RefNannySetupContext("_decode", 0);
8894   __Pyx_XDECREF(__pyx_r);
8895   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__decode(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
8896   __Pyx_GOTREF(__pyx_t_1);
8897   __pyx_r = __pyx_t_1;
8898   __pyx_t_1 = 0;
8899   goto __pyx_L0;
8900 
8901   /* function exit code */
8902   __pyx_L1_error:;
8903   __Pyx_XDECREF(__pyx_t_1);
8904   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase._decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
8905   __pyx_r = NULL;
8906   __pyx_L0:;
8907   __Pyx_XGIVEREF(__pyx_r);
8908   __Pyx_RefNannyFinishContext();
8909   return __pyx_r;
8910 }
8911 
8912 /* "ddtrace/internal/_encoding.pyx":393
8913  *         return msgpack.unpackb(data, raw=True)
8914  *
8915  *     cdef _reset_buffer(self):             # <<<<<<<<<<<<<<
8916  *         self._count = 0
8917  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix
8918  */
8919 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__reset_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)8920 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__reset_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
8921   PyObject *__pyx_r = NULL;
8922   __Pyx_RefNannyDeclarations
8923   __Pyx_RefNannySetupContext("_reset_buffer", 0);
8924 
8925   /* "ddtrace/internal/_encoding.pyx":394
8926  *
8927  *     cdef _reset_buffer(self):
8928  *         self._count = 0             # <<<<<<<<<<<<<<
8929  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix
8930  *
8931  */
8932   __pyx_v_self->_count = 0;
8933 
8934   /* "ddtrace/internal/_encoding.pyx":395
8935  *     cdef _reset_buffer(self):
8936  *         self._count = 0
8937  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix             # <<<<<<<<<<<<<<
8938  *
8939  *     cpdef encode(self):
8940  */
8941   __pyx_v_self->pk.length = 5;
8942 
8943   /* "ddtrace/internal/_encoding.pyx":393
8944  *         return msgpack.unpackb(data, raw=True)
8945  *
8946  *     cdef _reset_buffer(self):             # <<<<<<<<<<<<<<
8947  *         self._count = 0
8948  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix
8949  */
8950 
8951   /* function exit code */
8952   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8953   __Pyx_XGIVEREF(__pyx_r);
8954   __Pyx_RefNannyFinishContext();
8955   return __pyx_r;
8956 }
8957 
8958 /* "ddtrace/internal/_encoding.pyx":397
8959  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix
8960  *
8961  *     cpdef encode(self):             # <<<<<<<<<<<<<<
8962  *         with self._lock:
8963  *             if not self._count:
8964  */
8965 
8966 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,int __pyx_skip_dispatch)8967 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, int __pyx_skip_dispatch) {
8968   PyObject *__pyx_r = NULL;
8969   __Pyx_RefNannyDeclarations
8970   PyObject *__pyx_t_1 = NULL;
8971   PyObject *__pyx_t_2 = NULL;
8972   PyObject *__pyx_t_3 = NULL;
8973   PyObject *__pyx_t_4 = NULL;
8974   PyObject *__pyx_t_5 = NULL;
8975   PyObject *__pyx_t_6 = NULL;
8976   PyObject *__pyx_t_7 = NULL;
8977   PyObject *__pyx_t_8 = NULL;
8978   int __pyx_t_9;
8979   PyObject *__pyx_t_10 = NULL;
8980   int __pyx_t_11;
8981   int __pyx_lineno = 0;
8982   const char *__pyx_filename = NULL;
8983   int __pyx_clineno = 0;
8984   __Pyx_RefNannySetupContext("encode", 0);
8985   /* Check if called by wrapper */
8986   if (unlikely(__pyx_skip_dispatch)) ;
8987   /* Check if overridden in Python */
8988   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
8989     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
8990     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
8991     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
8992       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
8993       #endif
8994       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
8995       __Pyx_GOTREF(__pyx_t_1);
8996       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode)) {
8997         __Pyx_XDECREF(__pyx_r);
8998         __Pyx_INCREF(__pyx_t_1);
8999         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
9000         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9001           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9002           if (likely(__pyx_t_4)) {
9003             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9004             __Pyx_INCREF(__pyx_t_4);
9005             __Pyx_INCREF(function);
9006             __Pyx_DECREF_SET(__pyx_t_3, function);
9007           }
9008         }
9009         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9010         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9011         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
9012         __Pyx_GOTREF(__pyx_t_2);
9013         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9014         __pyx_r = __pyx_t_2;
9015         __pyx_t_2 = 0;
9016         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9017         goto __pyx_L0;
9018       }
9019       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
9020       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
9021       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
9022       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
9023         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
9024       }
9025       #endif
9026       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9027       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
9028     }
9029     #endif
9030   }
9031 
9032   /* "ddtrace/internal/_encoding.pyx":398
9033  *
9034  *     cpdef encode(self):
9035  *         with self._lock:             # <<<<<<<<<<<<<<
9036  *             if not self._count:
9037  *                 return None
9038  */
9039   /*with:*/ {
9040     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error)
9041     __Pyx_GOTREF(__pyx_t_5);
9042     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L3_error)
9043     __Pyx_GOTREF(__pyx_t_2);
9044     __pyx_t_3 = NULL;
9045     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
9046       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
9047       if (likely(__pyx_t_3)) {
9048         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9049         __Pyx_INCREF(__pyx_t_3);
9050         __Pyx_INCREF(function);
9051         __Pyx_DECREF_SET(__pyx_t_2, function);
9052       }
9053     }
9054     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
9055     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9056     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L3_error)
9057     __Pyx_GOTREF(__pyx_t_1);
9058     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9059     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9060     /*try:*/ {
9061       {
9062         __Pyx_PyThreadState_declare
9063         __Pyx_PyThreadState_assign
9064         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
9065         __Pyx_XGOTREF(__pyx_t_6);
9066         __Pyx_XGOTREF(__pyx_t_7);
9067         __Pyx_XGOTREF(__pyx_t_8);
9068         /*try:*/ {
9069 
9070           /* "ddtrace/internal/_encoding.pyx":399
9071  *     cpdef encode(self):
9072  *         with self._lock:
9073  *             if not self._count:             # <<<<<<<<<<<<<<
9074  *                 return None
9075  *
9076  */
9077           __pyx_t_9 = ((!(__pyx_v_self->_count != 0)) != 0);
9078           if (__pyx_t_9) {
9079 
9080             /* "ddtrace/internal/_encoding.pyx":400
9081  *         with self._lock:
9082  *             if not self._count:
9083  *                 return None             # <<<<<<<<<<<<<<
9084  *
9085  *             return self.flush()
9086  */
9087             __Pyx_XDECREF(__pyx_r);
9088             __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9089             goto __pyx_L11_try_return;
9090 
9091             /* "ddtrace/internal/_encoding.pyx":399
9092  *     cpdef encode(self):
9093  *         with self._lock:
9094  *             if not self._count:             # <<<<<<<<<<<<<<
9095  *                 return None
9096  *
9097  */
9098           }
9099 
9100           /* "ddtrace/internal/_encoding.pyx":402
9101  *                 return None
9102  *
9103  *             return self.flush()             # <<<<<<<<<<<<<<
9104  *
9105  *     cdef inline int _update_array_len(self):
9106  */
9107           __Pyx_XDECREF(__pyx_r);
9108           __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self->__pyx_vtab)->flush(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L7_error)
9109           __Pyx_GOTREF(__pyx_t_1);
9110           __pyx_r = __pyx_t_1;
9111           __pyx_t_1 = 0;
9112           goto __pyx_L11_try_return;
9113 
9114           /* "ddtrace/internal/_encoding.pyx":398
9115  *
9116  *     cpdef encode(self):
9117  *         with self._lock:             # <<<<<<<<<<<<<<
9118  *             if not self._count:
9119  *                 return None
9120  */
9121         }
9122         __pyx_L7_error:;
9123         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9124         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9125         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9126         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9127         /*except:*/ {
9128           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
9129           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 398, __pyx_L9_except_error)
9130           __Pyx_GOTREF(__pyx_t_1);
9131           __Pyx_GOTREF(__pyx_t_2);
9132           __Pyx_GOTREF(__pyx_t_3);
9133           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L9_except_error)
9134           __Pyx_GOTREF(__pyx_t_4);
9135           __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
9136           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9137           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9138           if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 398, __pyx_L9_except_error)
9139           __Pyx_GOTREF(__pyx_t_10);
9140           __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10);
9141           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9142           if (__pyx_t_9 < 0) __PYX_ERR(0, 398, __pyx_L9_except_error)
9143           __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0);
9144           if (__pyx_t_11) {
9145             __Pyx_GIVEREF(__pyx_t_1);
9146             __Pyx_GIVEREF(__pyx_t_2);
9147             __Pyx_XGIVEREF(__pyx_t_3);
9148             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
9149             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
9150             __PYX_ERR(0, 398, __pyx_L9_except_error)
9151           }
9152           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9153           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9154           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9155           goto __pyx_L8_exception_handled;
9156         }
9157         __pyx_L9_except_error:;
9158         __Pyx_XGIVEREF(__pyx_t_6);
9159         __Pyx_XGIVEREF(__pyx_t_7);
9160         __Pyx_XGIVEREF(__pyx_t_8);
9161         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9162         goto __pyx_L1_error;
9163         __pyx_L11_try_return:;
9164         __Pyx_XGIVEREF(__pyx_t_6);
9165         __Pyx_XGIVEREF(__pyx_t_7);
9166         __Pyx_XGIVEREF(__pyx_t_8);
9167         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9168         goto __pyx_L4_return;
9169         __pyx_L8_exception_handled:;
9170         __Pyx_XGIVEREF(__pyx_t_6);
9171         __Pyx_XGIVEREF(__pyx_t_7);
9172         __Pyx_XGIVEREF(__pyx_t_8);
9173         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9174       }
9175     }
9176     /*finally:*/ {
9177       /*normal exit:*/{
9178         if (__pyx_t_5) {
9179           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
9180           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9181           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 398, __pyx_L1_error)
9182           __Pyx_GOTREF(__pyx_t_8);
9183           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9184         }
9185         goto __pyx_L6;
9186       }
9187       __pyx_L4_return: {
9188         __pyx_t_8 = __pyx_r;
9189         __pyx_r = 0;
9190         if (__pyx_t_5) {
9191           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
9192           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9193           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 398, __pyx_L1_error)
9194           __Pyx_GOTREF(__pyx_t_7);
9195           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9196         }
9197         __pyx_r = __pyx_t_8;
9198         __pyx_t_8 = 0;
9199         goto __pyx_L0;
9200       }
9201       __pyx_L6:;
9202     }
9203     goto __pyx_L17;
9204     __pyx_L3_error:;
9205     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9206     goto __pyx_L1_error;
9207     __pyx_L17:;
9208   }
9209 
9210   /* "ddtrace/internal/_encoding.pyx":397
9211  *         self.pk.length = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE  # Leave room for array length prefix
9212  *
9213  *     cpdef encode(self):             # <<<<<<<<<<<<<<
9214  *         with self._lock:
9215  *             if not self._count:
9216  */
9217 
9218   /* function exit code */
9219   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9220   goto __pyx_L0;
9221   __pyx_L1_error:;
9222   __Pyx_XDECREF(__pyx_t_1);
9223   __Pyx_XDECREF(__pyx_t_2);
9224   __Pyx_XDECREF(__pyx_t_3);
9225   __Pyx_XDECREF(__pyx_t_4);
9226   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
9227   __pyx_r = 0;
9228   __pyx_L0:;
9229   __Pyx_XGIVEREF(__pyx_r);
9230   __Pyx_RefNannyFinishContext();
9231   return __pyx_r;
9232 }
9233 
9234 /* Python wrapper */
9235 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9236 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9237   PyObject *__pyx_r = 0;
9238   __Pyx_RefNannyDeclarations
9239   __Pyx_RefNannySetupContext("encode (wrapper)", 0);
9240   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_8encode(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
9241 
9242   /* function exit code */
9243   __Pyx_RefNannyFinishContext();
9244   return __pyx_r;
9245 }
9246 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_8encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)9247 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_8encode(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
9248   PyObject *__pyx_r = NULL;
9249   __Pyx_RefNannyDeclarations
9250   PyObject *__pyx_t_1 = NULL;
9251   int __pyx_lineno = 0;
9252   const char *__pyx_filename = NULL;
9253   int __pyx_clineno = 0;
9254   __Pyx_RefNannySetupContext("encode", 0);
9255   __Pyx_XDECREF(__pyx_r);
9256   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_encode(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
9257   __Pyx_GOTREF(__pyx_t_1);
9258   __pyx_r = __pyx_t_1;
9259   __pyx_t_1 = 0;
9260   goto __pyx_L0;
9261 
9262   /* function exit code */
9263   __pyx_L1_error:;
9264   __Pyx_XDECREF(__pyx_t_1);
9265   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
9266   __pyx_r = NULL;
9267   __pyx_L0:;
9268   __Pyx_XGIVEREF(__pyx_r);
9269   __Pyx_RefNannyFinishContext();
9270   return __pyx_r;
9271 }
9272 
9273 /* "ddtrace/internal/_encoding.pyx":404
9274  *             return self.flush()
9275  *
9276  *     cdef inline int _update_array_len(self):             # <<<<<<<<<<<<<<
9277  *         """Update traces array size prefix"""
9278  *         cdef int offset = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE - array_prefix_size(self._count)
9279  */
9280 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)9281 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
9282   int __pyx_v_offset;
9283   int __pyx_v_old_pos;
9284   int __pyx_r;
9285   __Pyx_RefNannyDeclarations
9286   size_t __pyx_t_1;
9287   PyObject *__pyx_t_2 = NULL;
9288   PyObject *__pyx_t_3 = NULL;
9289   PyObject *__pyx_t_4 = NULL;
9290   PyObject *__pyx_t_5 = NULL;
9291   PyObject *__pyx_t_6 = NULL;
9292   PyObject *__pyx_t_7 = NULL;
9293   PyObject *__pyx_t_8 = NULL;
9294   int __pyx_t_9;
9295   int __pyx_lineno = 0;
9296   const char *__pyx_filename = NULL;
9297   int __pyx_clineno = 0;
9298   __Pyx_RefNannySetupContext("_update_array_len", 0);
9299 
9300   /* "ddtrace/internal/_encoding.pyx":406
9301  *     cdef inline int _update_array_len(self):
9302  *         """Update traces array size prefix"""
9303  *         cdef int offset = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE - array_prefix_size(self._count)             # <<<<<<<<<<<<<<
9304  *         cdef int old_pos = self.pk.length
9305  *
9306  */
9307   __pyx_v_offset = (5 - __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(__pyx_v_self->_count));
9308 
9309   /* "ddtrace/internal/_encoding.pyx":407
9310  *         """Update traces array size prefix"""
9311  *         cdef int offset = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE - array_prefix_size(self._count)
9312  *         cdef int old_pos = self.pk.length             # <<<<<<<<<<<<<<
9313  *
9314  *         with self._lock:
9315  */
9316   __pyx_t_1 = __pyx_v_self->pk.length;
9317   __pyx_v_old_pos = __pyx_t_1;
9318 
9319   /* "ddtrace/internal/_encoding.pyx":409
9320  *         cdef int old_pos = self.pk.length
9321  *
9322  *         with self._lock:             # <<<<<<<<<<<<<<
9323  *             self.pk.length = offset
9324  *             msgpack_pack_array(&self.pk, self._count)
9325  */
9326   /*with:*/ {
9327     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
9328     __Pyx_GOTREF(__pyx_t_2);
9329     __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L3_error)
9330     __Pyx_GOTREF(__pyx_t_4);
9331     __pyx_t_5 = NULL;
9332     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9333       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9334       if (likely(__pyx_t_5)) {
9335         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9336         __Pyx_INCREF(__pyx_t_5);
9337         __Pyx_INCREF(function);
9338         __Pyx_DECREF_SET(__pyx_t_4, function);
9339       }
9340     }
9341     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9342     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9343     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L3_error)
9344     __Pyx_GOTREF(__pyx_t_3);
9345     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9346     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9347     /*try:*/ {
9348       {
9349         (void)__pyx_t_6; (void)__pyx_t_7; (void)__pyx_t_8; /* mark used */
9350         /*try:*/ {
9351 
9352           /* "ddtrace/internal/_encoding.pyx":410
9353  *
9354  *         with self._lock:
9355  *             self.pk.length = offset             # <<<<<<<<<<<<<<
9356  *             msgpack_pack_array(&self.pk, self._count)
9357  *             self.pk.length = old_pos
9358  */
9359           __pyx_v_self->pk.length = __pyx_v_offset;
9360 
9361           /* "ddtrace/internal/_encoding.pyx":411
9362  *         with self._lock:
9363  *             self.pk.length = offset
9364  *             msgpack_pack_array(&self.pk, self._count)             # <<<<<<<<<<<<<<
9365  *             self.pk.length = old_pos
9366  *             return offset
9367  */
9368           (void)(msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_self->_count));
9369 
9370           /* "ddtrace/internal/_encoding.pyx":412
9371  *             self.pk.length = offset
9372  *             msgpack_pack_array(&self.pk, self._count)
9373  *             self.pk.length = old_pos             # <<<<<<<<<<<<<<
9374  *             return offset
9375  *
9376  */
9377           __pyx_v_self->pk.length = __pyx_v_old_pos;
9378 
9379           /* "ddtrace/internal/_encoding.pyx":413
9380  *             msgpack_pack_array(&self.pk, self._count)
9381  *             self.pk.length = old_pos
9382  *             return offset             # <<<<<<<<<<<<<<
9383  *
9384  *     cdef get_bytes(self):
9385  */
9386           __pyx_r = __pyx_v_offset;
9387           goto __pyx_L11_try_return;
9388 
9389           /* "ddtrace/internal/_encoding.pyx":409
9390  *         cdef int old_pos = self.pk.length
9391  *
9392  *         with self._lock:             # <<<<<<<<<<<<<<
9393  *             self.pk.length = offset
9394  *             msgpack_pack_array(&self.pk, self._count)
9395  */
9396         }
9397         __pyx_L11_try_return:;
9398         goto __pyx_L4_return;
9399       }
9400     }
9401     /*finally:*/ {
9402       /*normal exit:*/{
9403         if (__pyx_t_2) {
9404           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL);
9405           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9406           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 409, __pyx_L1_error)
9407           __Pyx_GOTREF(__pyx_t_8);
9408           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9409         }
9410         goto __pyx_L6;
9411       }
9412       __pyx_L4_return: {
9413         __pyx_t_9 = __pyx_r;
9414         if (__pyx_t_2) {
9415           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL);
9416           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9417           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 409, __pyx_L1_error)
9418           __Pyx_GOTREF(__pyx_t_8);
9419           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9420         }
9421         __pyx_r = __pyx_t_9;
9422         goto __pyx_L0;
9423       }
9424       __pyx_L6:;
9425     }
9426     goto __pyx_L13;
9427     __pyx_L3_error:;
9428     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9429     goto __pyx_L1_error;
9430     __pyx_L13:;
9431   }
9432 
9433   /* "ddtrace/internal/_encoding.pyx":404
9434  *             return self.flush()
9435  *
9436  *     cdef inline int _update_array_len(self):             # <<<<<<<<<<<<<<
9437  *         """Update traces array size prefix"""
9438  *         cdef int offset = MSGPACK_ARRAY_LENGTH_PREFIX_SIZE - array_prefix_size(self._count)
9439  */
9440 
9441   /* function exit code */
9442   __pyx_r = 0;
9443   goto __pyx_L0;
9444   __pyx_L1_error:;
9445   __Pyx_XDECREF(__pyx_t_3);
9446   __Pyx_XDECREF(__pyx_t_4);
9447   __Pyx_XDECREF(__pyx_t_5);
9448   __Pyx_WriteUnraisable("ddtrace.internal._encoding.MsgpackEncoderBase._update_array_len", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9449   __pyx_r = 0;
9450   __pyx_L0:;
9451   __Pyx_RefNannyFinishContext();
9452   return __pyx_r;
9453 }
9454 
9455 /* "ddtrace/internal/_encoding.pyx":415
9456  *             return offset
9457  *
9458  *     cdef get_bytes(self):             # <<<<<<<<<<<<<<
9459  *         """Return internal buffer contents as bytes object"""
9460  *         cdef int offset = self._update_array_len()
9461  */
9462 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)9463 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_bytes(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
9464   int __pyx_v_offset;
9465   PyObject *__pyx_r = NULL;
9466   __Pyx_RefNannyDeclarations
9467   PyObject *__pyx_t_1 = NULL;
9468   PyObject *__pyx_t_2 = NULL;
9469   PyObject *__pyx_t_3 = NULL;
9470   PyObject *__pyx_t_4 = NULL;
9471   PyObject *__pyx_t_5 = NULL;
9472   PyObject *__pyx_t_6 = NULL;
9473   PyObject *__pyx_t_7 = NULL;
9474   PyObject *__pyx_t_8 = NULL;
9475   PyObject *__pyx_t_9 = NULL;
9476   int __pyx_t_10;
9477   int __pyx_t_11;
9478   int __pyx_lineno = 0;
9479   const char *__pyx_filename = NULL;
9480   int __pyx_clineno = 0;
9481   __Pyx_RefNannySetupContext("get_bytes", 0);
9482 
9483   /* "ddtrace/internal/_encoding.pyx":417
9484  *     cdef get_bytes(self):
9485  *         """Return internal buffer contents as bytes object"""
9486  *         cdef int offset = self._update_array_len()             # <<<<<<<<<<<<<<
9487  *         with self._lock:
9488  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
9489  */
9490   __pyx_v_offset = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(__pyx_v_self);
9491 
9492   /* "ddtrace/internal/_encoding.pyx":418
9493  *         """Return internal buffer contents as bytes object"""
9494  *         cdef int offset = self._update_array_len()
9495  *         with self._lock:             # <<<<<<<<<<<<<<
9496  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
9497  *
9498  */
9499   /*with:*/ {
9500     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error)
9501     __Pyx_GOTREF(__pyx_t_1);
9502     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L3_error)
9503     __Pyx_GOTREF(__pyx_t_3);
9504     __pyx_t_4 = NULL;
9505     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9506       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9507       if (likely(__pyx_t_4)) {
9508         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9509         __Pyx_INCREF(__pyx_t_4);
9510         __Pyx_INCREF(function);
9511         __Pyx_DECREF_SET(__pyx_t_3, function);
9512       }
9513     }
9514     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9515     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9516     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L3_error)
9517     __Pyx_GOTREF(__pyx_t_2);
9518     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9519     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9520     /*try:*/ {
9521       {
9522         __Pyx_PyThreadState_declare
9523         __Pyx_PyThreadState_assign
9524         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
9525         __Pyx_XGOTREF(__pyx_t_5);
9526         __Pyx_XGOTREF(__pyx_t_6);
9527         __Pyx_XGOTREF(__pyx_t_7);
9528         /*try:*/ {
9529 
9530           /* "ddtrace/internal/_encoding.pyx":419
9531  *         cdef int offset = self._update_array_len()
9532  *         with self._lock:
9533  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)             # <<<<<<<<<<<<<<
9534  *
9535  *     cdef char * get_buffer(self):
9536  */
9537           __Pyx_XDECREF(__pyx_r);
9538           __pyx_t_2 = PyBytes_FromStringAndSize((__pyx_v_self->pk.buf + __pyx_v_offset), (__pyx_v_self->pk.length - __pyx_v_offset)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L7_error)
9539           __Pyx_GOTREF(__pyx_t_2);
9540           __pyx_r = __pyx_t_2;
9541           __pyx_t_2 = 0;
9542           goto __pyx_L11_try_return;
9543 
9544           /* "ddtrace/internal/_encoding.pyx":418
9545  *         """Return internal buffer contents as bytes object"""
9546  *         cdef int offset = self._update_array_len()
9547  *         with self._lock:             # <<<<<<<<<<<<<<
9548  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
9549  *
9550  */
9551         }
9552         __pyx_L7_error:;
9553         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9554         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9555         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9556         /*except:*/ {
9557           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.get_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
9558           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 418, __pyx_L9_except_error)
9559           __Pyx_GOTREF(__pyx_t_2);
9560           __Pyx_GOTREF(__pyx_t_3);
9561           __Pyx_GOTREF(__pyx_t_4);
9562           __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 418, __pyx_L9_except_error)
9563           __Pyx_GOTREF(__pyx_t_8);
9564           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL);
9565           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9566           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9567           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 418, __pyx_L9_except_error)
9568           __Pyx_GOTREF(__pyx_t_9);
9569           __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
9570           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9571           if (__pyx_t_10 < 0) __PYX_ERR(0, 418, __pyx_L9_except_error)
9572           __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
9573           if (__pyx_t_11) {
9574             __Pyx_GIVEREF(__pyx_t_2);
9575             __Pyx_GIVEREF(__pyx_t_3);
9576             __Pyx_XGIVEREF(__pyx_t_4);
9577             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9578             __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
9579             __PYX_ERR(0, 418, __pyx_L9_except_error)
9580           }
9581           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9582           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9583           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9584           goto __pyx_L8_exception_handled;
9585         }
9586         __pyx_L9_except_error:;
9587         __Pyx_XGIVEREF(__pyx_t_5);
9588         __Pyx_XGIVEREF(__pyx_t_6);
9589         __Pyx_XGIVEREF(__pyx_t_7);
9590         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
9591         goto __pyx_L1_error;
9592         __pyx_L11_try_return:;
9593         __Pyx_XGIVEREF(__pyx_t_5);
9594         __Pyx_XGIVEREF(__pyx_t_6);
9595         __Pyx_XGIVEREF(__pyx_t_7);
9596         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
9597         goto __pyx_L4_return;
9598         __pyx_L8_exception_handled:;
9599         __Pyx_XGIVEREF(__pyx_t_5);
9600         __Pyx_XGIVEREF(__pyx_t_6);
9601         __Pyx_XGIVEREF(__pyx_t_7);
9602         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
9603       }
9604     }
9605     /*finally:*/ {
9606       /*normal exit:*/{
9607         if (__pyx_t_1) {
9608           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
9609           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9610           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error)
9611           __Pyx_GOTREF(__pyx_t_7);
9612           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9613         }
9614         goto __pyx_L6;
9615       }
9616       __pyx_L4_return: {
9617         __pyx_t_7 = __pyx_r;
9618         __pyx_r = 0;
9619         if (__pyx_t_1) {
9620           __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
9621           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9622           if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
9623           __Pyx_GOTREF(__pyx_t_6);
9624           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9625         }
9626         __pyx_r = __pyx_t_7;
9627         __pyx_t_7 = 0;
9628         goto __pyx_L0;
9629       }
9630       __pyx_L6:;
9631     }
9632     goto __pyx_L16;
9633     __pyx_L3_error:;
9634     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9635     goto __pyx_L1_error;
9636     __pyx_L16:;
9637   }
9638 
9639   /* "ddtrace/internal/_encoding.pyx":415
9640  *             return offset
9641  *
9642  *     cdef get_bytes(self):             # <<<<<<<<<<<<<<
9643  *         """Return internal buffer contents as bytes object"""
9644  *         cdef int offset = self._update_array_len()
9645  */
9646 
9647   /* function exit code */
9648   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9649   goto __pyx_L0;
9650   __pyx_L1_error:;
9651   __Pyx_XDECREF(__pyx_t_2);
9652   __Pyx_XDECREF(__pyx_t_3);
9653   __Pyx_XDECREF(__pyx_t_4);
9654   __Pyx_XDECREF(__pyx_t_8);
9655   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.get_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
9656   __pyx_r = 0;
9657   __pyx_L0:;
9658   __Pyx_XGIVEREF(__pyx_r);
9659   __Pyx_RefNannyFinishContext();
9660   return __pyx_r;
9661 }
9662 
9663 /* "ddtrace/internal/_encoding.pyx":421
9664  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
9665  *
9666  *     cdef char * get_buffer(self):             # <<<<<<<<<<<<<<
9667  *         """Return internal buffer."""
9668  *         return self.pk.buf + self._update_array_len()
9669  */
9670 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)9671 static char *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_buffer(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
9672   char *__pyx_r;
9673   __Pyx_RefNannyDeclarations
9674   __Pyx_RefNannySetupContext("get_buffer", 0);
9675 
9676   /* "ddtrace/internal/_encoding.pyx":423
9677  *     cdef char * get_buffer(self):
9678  *         """Return internal buffer."""
9679  *         return self.pk.buf + self._update_array_len()             # <<<<<<<<<<<<<<
9680  *
9681  *     cdef void * get_dd_origin_ref(self, str dd_origin):
9682  */
9683   __pyx_r = (__pyx_v_self->pk.buf + __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len(__pyx_v_self));
9684   goto __pyx_L0;
9685 
9686   /* "ddtrace/internal/_encoding.pyx":421
9687  *             return PyBytes_FromStringAndSize(self.pk.buf + offset, self.pk.length - offset)
9688  *
9689  *     cdef char * get_buffer(self):             # <<<<<<<<<<<<<<
9690  *         """Return internal buffer."""
9691  *         return self.pk.buf + self._update_array_len()
9692  */
9693 
9694   /* function exit code */
9695   __pyx_L0:;
9696   __Pyx_RefNannyFinishContext();
9697   return __pyx_r;
9698 }
9699 
9700 /* "ddtrace/internal/_encoding.pyx":425
9701  *         return self.pk.buf + self._update_array_len()
9702  *
9703  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
9704  *         raise NotImplementedError()
9705  *
9706  */
9707 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_dd_origin)9708 static void *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dd_origin) {
9709   void *__pyx_r;
9710   __Pyx_RefNannyDeclarations
9711   PyObject *__pyx_t_1 = NULL;
9712   int __pyx_lineno = 0;
9713   const char *__pyx_filename = NULL;
9714   int __pyx_clineno = 0;
9715   __Pyx_RefNannySetupContext("get_dd_origin_ref", 0);
9716 
9717   /* "ddtrace/internal/_encoding.pyx":426
9718  *
9719  *     cdef void * get_dd_origin_ref(self, str dd_origin):
9720  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
9721  *
9722  *     cdef inline int _pack_trace(self, list trace) except? -1:
9723  */
9724   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error)
9725   __Pyx_GOTREF(__pyx_t_1);
9726   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9727   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9728   __PYX_ERR(0, 426, __pyx_L1_error)
9729 
9730   /* "ddtrace/internal/_encoding.pyx":425
9731  *         return self.pk.buf + self._update_array_len()
9732  *
9733  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
9734  *         raise NotImplementedError()
9735  *
9736  */
9737 
9738   /* function exit code */
9739   __pyx_L1_error:;
9740   __Pyx_XDECREF(__pyx_t_1);
9741   __Pyx_WriteUnraisable("ddtrace.internal._encoding.MsgpackEncoderBase.get_dd_origin_ref", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9742   __pyx_r = 0;
9743   __Pyx_RefNannyFinishContext();
9744   return __pyx_r;
9745 }
9746 
9747 /* "ddtrace/internal/_encoding.pyx":428
9748  *         raise NotImplementedError()
9749  *
9750  *     cdef inline int _pack_trace(self, list trace) except? -1:             # <<<<<<<<<<<<<<
9751  *         cdef int ret
9752  *         cdef Py_ssize_t L
9753  */
9754 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,PyObject * __pyx_v_trace)9755 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace) {
9756   int __pyx_v_ret;
9757   Py_ssize_t __pyx_v_L;
9758   void *__pyx_v_dd_origin;
9759   PyObject *__pyx_v_span = NULL;
9760   int __pyx_r;
9761   __Pyx_RefNannyDeclarations
9762   Py_ssize_t __pyx_t_1;
9763   int __pyx_t_2;
9764   PyObject *__pyx_t_3 = NULL;
9765   int __pyx_t_4;
9766   PyObject *__pyx_t_5 = NULL;
9767   int __pyx_t_6;
9768   int __pyx_t_7;
9769   int __pyx_lineno = 0;
9770   const char *__pyx_filename = NULL;
9771   int __pyx_clineno = 0;
9772   __Pyx_RefNannySetupContext("_pack_trace", 0);
9773 
9774   /* "ddtrace/internal/_encoding.pyx":431
9775  *         cdef int ret
9776  *         cdef Py_ssize_t L
9777  *         cdef void * dd_origin = NULL             # <<<<<<<<<<<<<<
9778  *
9779  *         L = len(trace)
9780  */
9781   __pyx_v_dd_origin = NULL;
9782 
9783   /* "ddtrace/internal/_encoding.pyx":433
9784  *         cdef void * dd_origin = NULL
9785  *
9786  *         L = len(trace)             # <<<<<<<<<<<<<<
9787  *         if L > ITEM_LIMIT:
9788  *             raise ValueError("list is too large")
9789  */
9790   if (unlikely(__pyx_v_trace == Py_None)) {
9791     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
9792     __PYX_ERR(0, 433, __pyx_L1_error)
9793   }
9794   __pyx_t_1 = PyList_GET_SIZE(__pyx_v_trace); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 433, __pyx_L1_error)
9795   __pyx_v_L = __pyx_t_1;
9796 
9797   /* "ddtrace/internal/_encoding.pyx":434
9798  *
9799  *         L = len(trace)
9800  *         if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
9801  *             raise ValueError("list is too large")
9802  *
9803  */
9804   __pyx_t_2 = ((__pyx_v_L > __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT) != 0);
9805   if (unlikely(__pyx_t_2)) {
9806 
9807     /* "ddtrace/internal/_encoding.pyx":435
9808  *         L = len(trace)
9809  *         if L > ITEM_LIMIT:
9810  *             raise ValueError("list is too large")             # <<<<<<<<<<<<<<
9811  *
9812  *         ret = msgpack_pack_array(&self.pk, L)
9813  */
9814     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 435, __pyx_L1_error)
9815     __Pyx_GOTREF(__pyx_t_3);
9816     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9817     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9818     __PYX_ERR(0, 435, __pyx_L1_error)
9819 
9820     /* "ddtrace/internal/_encoding.pyx":434
9821  *
9822  *         L = len(trace)
9823  *         if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
9824  *             raise ValueError("list is too large")
9825  *
9826  */
9827   }
9828 
9829   /* "ddtrace/internal/_encoding.pyx":437
9830  *             raise ValueError("list is too large")
9831  *
9832  *         ret = msgpack_pack_array(&self.pk, L)             # <<<<<<<<<<<<<<
9833  *         if ret != 0: raise RuntimeError("Couldn't pack trace")
9834  *
9835  */
9836   __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_L);
9837 
9838   /* "ddtrace/internal/_encoding.pyx":438
9839  *
9840  *         ret = msgpack_pack_array(&self.pk, L)
9841  *         if ret != 0: raise RuntimeError("Couldn't pack trace")             # <<<<<<<<<<<<<<
9842  *
9843  *         if L > 0 and trace[0].context is not None and trace[0].context.dd_origin is not None:
9844  */
9845   __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
9846   if (unlikely(__pyx_t_2)) {
9847     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error)
9848     __Pyx_GOTREF(__pyx_t_3);
9849     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9850     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9851     __PYX_ERR(0, 438, __pyx_L1_error)
9852   }
9853 
9854   /* "ddtrace/internal/_encoding.pyx":440
9855  *         if ret != 0: raise RuntimeError("Couldn't pack trace")
9856  *
9857  *         if L > 0 and trace[0].context is not None and trace[0].context.dd_origin is not None:             # <<<<<<<<<<<<<<
9858  *             dd_origin = self.get_dd_origin_ref(trace[0].context.dd_origin)
9859  *
9860  */
9861   __pyx_t_4 = ((__pyx_v_L > 0) != 0);
9862   if (__pyx_t_4) {
9863   } else {
9864     __pyx_t_2 = __pyx_t_4;
9865     goto __pyx_L6_bool_binop_done;
9866   }
9867   if (unlikely(__pyx_v_trace == Py_None)) {
9868     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9869     __PYX_ERR(0, 440, __pyx_L1_error)
9870   }
9871   __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_trace, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
9872   __Pyx_GOTREF(__pyx_t_3);
9873   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_context); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
9874   __Pyx_GOTREF(__pyx_t_5);
9875   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9876   __pyx_t_4 = (__pyx_t_5 != Py_None);
9877   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9878   __pyx_t_6 = (__pyx_t_4 != 0);
9879   if (__pyx_t_6) {
9880   } else {
9881     __pyx_t_2 = __pyx_t_6;
9882     goto __pyx_L6_bool_binop_done;
9883   }
9884   if (unlikely(__pyx_v_trace == Py_None)) {
9885     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9886     __PYX_ERR(0, 440, __pyx_L1_error)
9887   }
9888   __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_trace, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
9889   __Pyx_GOTREF(__pyx_t_5);
9890   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
9891   __Pyx_GOTREF(__pyx_t_3);
9892   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9893   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dd_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
9894   __Pyx_GOTREF(__pyx_t_5);
9895   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9896   __pyx_t_6 = (__pyx_t_5 != Py_None);
9897   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9898   __pyx_t_4 = (__pyx_t_6 != 0);
9899   __pyx_t_2 = __pyx_t_4;
9900   __pyx_L6_bool_binop_done:;
9901   if (__pyx_t_2) {
9902 
9903     /* "ddtrace/internal/_encoding.pyx":441
9904  *
9905  *         if L > 0 and trace[0].context is not None and trace[0].context.dd_origin is not None:
9906  *             dd_origin = self.get_dd_origin_ref(trace[0].context.dd_origin)             # <<<<<<<<<<<<<<
9907  *
9908  *         for span in trace:
9909  */
9910     if (unlikely(__pyx_v_trace == Py_None)) {
9911       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9912       __PYX_ERR(0, 441, __pyx_L1_error)
9913     }
9914     __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_trace, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
9915     __Pyx_GOTREF(__pyx_t_5);
9916     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error)
9917     __Pyx_GOTREF(__pyx_t_3);
9918     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9919     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dd_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
9920     __Pyx_GOTREF(__pyx_t_5);
9921     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9922     if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 441, __pyx_L1_error)
9923     __pyx_v_dd_origin = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self->__pyx_vtab)->get_dd_origin_ref(__pyx_v_self, ((PyObject*)__pyx_t_5));
9924     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9925 
9926     /* "ddtrace/internal/_encoding.pyx":440
9927  *         if ret != 0: raise RuntimeError("Couldn't pack trace")
9928  *
9929  *         if L > 0 and trace[0].context is not None and trace[0].context.dd_origin is not None:             # <<<<<<<<<<<<<<
9930  *             dd_origin = self.get_dd_origin_ref(trace[0].context.dd_origin)
9931  *
9932  */
9933   }
9934 
9935   /* "ddtrace/internal/_encoding.pyx":443
9936  *             dd_origin = self.get_dd_origin_ref(trace[0].context.dd_origin)
9937  *
9938  *         for span in trace:             # <<<<<<<<<<<<<<
9939  *             ret = self.pack_span(span, dd_origin)
9940  *             if ret != 0: raise RuntimeError("Couldn't pack span")
9941  */
9942   if (unlikely(__pyx_v_trace == Py_None)) {
9943     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9944     __PYX_ERR(0, 443, __pyx_L1_error)
9945   }
9946   __pyx_t_5 = __pyx_v_trace; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
9947   for (;;) {
9948     if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break;
9949     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9950     __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 443, __pyx_L1_error)
9951     #else
9952     __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error)
9953     __Pyx_GOTREF(__pyx_t_3);
9954     #endif
9955     __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_3);
9956     __pyx_t_3 = 0;
9957 
9958     /* "ddtrace/internal/_encoding.pyx":444
9959  *
9960  *         for span in trace:
9961  *             ret = self.pack_span(span, dd_origin)             # <<<<<<<<<<<<<<
9962  *             if ret != 0: raise RuntimeError("Couldn't pack span")
9963  *
9964  */
9965     __pyx_t_7 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self->__pyx_vtab)->pack_span(__pyx_v_self, __pyx_v_span, __pyx_v_dd_origin); if (unlikely(__pyx_t_7 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error)
9966     __pyx_v_ret = __pyx_t_7;
9967 
9968     /* "ddtrace/internal/_encoding.pyx":445
9969  *         for span in trace:
9970  *             ret = self.pack_span(span, dd_origin)
9971  *             if ret != 0: raise RuntimeError("Couldn't pack span")             # <<<<<<<<<<<<<<
9972  *
9973  *         return ret
9974  */
9975     __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
9976     if (unlikely(__pyx_t_2)) {
9977       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
9978       __Pyx_GOTREF(__pyx_t_3);
9979       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9980       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9981       __PYX_ERR(0, 445, __pyx_L1_error)
9982     }
9983 
9984     /* "ddtrace/internal/_encoding.pyx":443
9985  *             dd_origin = self.get_dd_origin_ref(trace[0].context.dd_origin)
9986  *
9987  *         for span in trace:             # <<<<<<<<<<<<<<
9988  *             ret = self.pack_span(span, dd_origin)
9989  *             if ret != 0: raise RuntimeError("Couldn't pack span")
9990  */
9991   }
9992   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9993 
9994   /* "ddtrace/internal/_encoding.pyx":447
9995  *             if ret != 0: raise RuntimeError("Couldn't pack span")
9996  *
9997  *         return ret             # <<<<<<<<<<<<<<
9998  *
9999  *     cpdef put(self, list trace):
10000  */
10001   __pyx_r = __pyx_v_ret;
10002   goto __pyx_L0;
10003 
10004   /* "ddtrace/internal/_encoding.pyx":428
10005  *         raise NotImplementedError()
10006  *
10007  *     cdef inline int _pack_trace(self, list trace) except? -1:             # <<<<<<<<<<<<<<
10008  *         cdef int ret
10009  *         cdef Py_ssize_t L
10010  */
10011 
10012   /* function exit code */
10013   __pyx_L1_error:;
10014   __Pyx_XDECREF(__pyx_t_3);
10015   __Pyx_XDECREF(__pyx_t_5);
10016   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase._pack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
10017   __pyx_r = -1;
10018   __pyx_L0:;
10019   __Pyx_XDECREF(__pyx_v_span);
10020   __Pyx_RefNannyFinishContext();
10021   return __pyx_r;
10022 }
10023 
10024 /* "ddtrace/internal/_encoding.pyx":449
10025  *         return ret
10026  *
10027  *     cpdef put(self, list trace):             # <<<<<<<<<<<<<<
10028  *         """Put a trace (i.e. a list of spans) in the buffer."""
10029  *         cdef int ret
10030  */
10031 
10032 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,PyObject * __pyx_v_trace,int __pyx_skip_dispatch)10033 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch) {
10034   int __pyx_v_ret;
10035   size_t __pyx_v_len_before;
10036   PyObject *__pyx_v_size_before = NULL;
10037   PyObject *__pyx_r = NULL;
10038   __Pyx_RefNannyDeclarations
10039   PyObject *__pyx_t_1 = NULL;
10040   PyObject *__pyx_t_2 = NULL;
10041   PyObject *__pyx_t_3 = NULL;
10042   PyObject *__pyx_t_4 = NULL;
10043   PyObject *__pyx_t_5 = NULL;
10044   PyObject *__pyx_t_6 = NULL;
10045   PyObject *__pyx_t_7 = NULL;
10046   PyObject *__pyx_t_8 = NULL;
10047   size_t __pyx_t_9;
10048   PyObject *__pyx_t_10 = NULL;
10049   PyObject *__pyx_t_11 = NULL;
10050   PyObject *__pyx_t_12 = NULL;
10051   int __pyx_t_13;
10052   int __pyx_t_14;
10053   int __pyx_t_15;
10054   int __pyx_lineno = 0;
10055   const char *__pyx_filename = NULL;
10056   int __pyx_clineno = 0;
10057   __Pyx_RefNannySetupContext("put", 0);
10058   /* Check if called by wrapper */
10059   if (unlikely(__pyx_skip_dispatch)) ;
10060   /* Check if overridden in Python */
10061   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
10062     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10063     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10064     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
10065       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10066       #endif
10067       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
10068       __Pyx_GOTREF(__pyx_t_1);
10069       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put)) {
10070         __Pyx_XDECREF(__pyx_r);
10071         __Pyx_INCREF(__pyx_t_1);
10072         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
10073         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10074           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
10075           if (likely(__pyx_t_4)) {
10076             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10077             __Pyx_INCREF(__pyx_t_4);
10078             __Pyx_INCREF(function);
10079             __Pyx_DECREF_SET(__pyx_t_3, function);
10080           }
10081         }
10082         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_trace) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trace);
10083         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10084         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
10085         __Pyx_GOTREF(__pyx_t_2);
10086         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10087         __pyx_r = __pyx_t_2;
10088         __pyx_t_2 = 0;
10089         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10090         goto __pyx_L0;
10091       }
10092       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10093       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10094       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
10095       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
10096         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10097       }
10098       #endif
10099       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10100       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10101     }
10102     #endif
10103   }
10104 
10105   /* "ddtrace/internal/_encoding.pyx":453
10106  *         cdef int ret
10107  *
10108  *         with self._lock:             # <<<<<<<<<<<<<<
10109  *             len_before = self.pk.length
10110  *             size_before = self.size
10111  */
10112   /*with:*/ {
10113     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
10114     __Pyx_GOTREF(__pyx_t_5);
10115     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L3_error)
10116     __Pyx_GOTREF(__pyx_t_2);
10117     __pyx_t_3 = NULL;
10118     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10119       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10120       if (likely(__pyx_t_3)) {
10121         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10122         __Pyx_INCREF(__pyx_t_3);
10123         __Pyx_INCREF(function);
10124         __Pyx_DECREF_SET(__pyx_t_2, function);
10125       }
10126     }
10127     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
10128     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10129     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L3_error)
10130     __Pyx_GOTREF(__pyx_t_1);
10131     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10132     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10133     /*try:*/ {
10134       {
10135         __Pyx_PyThreadState_declare
10136         __Pyx_PyThreadState_assign
10137         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
10138         __Pyx_XGOTREF(__pyx_t_6);
10139         __Pyx_XGOTREF(__pyx_t_7);
10140         __Pyx_XGOTREF(__pyx_t_8);
10141         /*try:*/ {
10142 
10143           /* "ddtrace/internal/_encoding.pyx":454
10144  *
10145  *         with self._lock:
10146  *             len_before = self.pk.length             # <<<<<<<<<<<<<<
10147  *             size_before = self.size
10148  *             try:
10149  */
10150           __pyx_t_9 = __pyx_v_self->pk.length;
10151           __pyx_v_len_before = __pyx_t_9;
10152 
10153           /* "ddtrace/internal/_encoding.pyx":455
10154  *         with self._lock:
10155  *             len_before = self.pk.length
10156  *             size_before = self.size             # <<<<<<<<<<<<<<
10157  *             try:
10158  *                 ret = self._pack_trace(trace)
10159  */
10160           __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L7_error)
10161           __Pyx_GOTREF(__pyx_t_1);
10162           __pyx_v_size_before = __pyx_t_1;
10163           __pyx_t_1 = 0;
10164 
10165           /* "ddtrace/internal/_encoding.pyx":456
10166  *             len_before = self.pk.length
10167  *             size_before = self.size
10168  *             try:             # <<<<<<<<<<<<<<
10169  *                 ret = self._pack_trace(trace)
10170  *                 if ret:  # should not happen.
10171  */
10172           {
10173             __Pyx_PyThreadState_declare
10174             __Pyx_PyThreadState_assign
10175             __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
10176             __Pyx_XGOTREF(__pyx_t_10);
10177             __Pyx_XGOTREF(__pyx_t_11);
10178             __Pyx_XGOTREF(__pyx_t_12);
10179             /*try:*/ {
10180 
10181               /* "ddtrace/internal/_encoding.pyx":457
10182  *             size_before = self.size
10183  *             try:
10184  *                 ret = self._pack_trace(trace)             # <<<<<<<<<<<<<<
10185  *                 if ret:  # should not happen.
10186  *                     raise RuntimeError("internal error")
10187  */
10188               __pyx_t_13 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace(__pyx_v_self, __pyx_v_trace); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L13_error)
10189               __pyx_v_ret = __pyx_t_13;
10190 
10191               /* "ddtrace/internal/_encoding.pyx":458
10192  *             try:
10193  *                 ret = self._pack_trace(trace)
10194  *                 if ret:  # should not happen.             # <<<<<<<<<<<<<<
10195  *                     raise RuntimeError("internal error")
10196  *
10197  */
10198               __pyx_t_14 = (__pyx_v_ret != 0);
10199               if (unlikely(__pyx_t_14)) {
10200 
10201                 /* "ddtrace/internal/_encoding.pyx":459
10202  *                 ret = self._pack_trace(trace)
10203  *                 if ret:  # should not happen.
10204  *                     raise RuntimeError("internal error")             # <<<<<<<<<<<<<<
10205  *
10206  *                 # DEV: msgpack avoids buffer overflows by calling PyMem_Realloc so
10207  */
10208                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L13_error)
10209                 __Pyx_GOTREF(__pyx_t_1);
10210                 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10211                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10212                 __PYX_ERR(0, 459, __pyx_L13_error)
10213 
10214                 /* "ddtrace/internal/_encoding.pyx":458
10215  *             try:
10216  *                 ret = self._pack_trace(trace)
10217  *                 if ret:  # should not happen.             # <<<<<<<<<<<<<<
10218  *                     raise RuntimeError("internal error")
10219  *
10220  */
10221               }
10222 
10223               /* "ddtrace/internal/_encoding.pyx":466
10224  *                 # grow arbitrarily because of the PyMem_Realloc and if it does then
10225  *                 # free and reallocate with the appropriate size.
10226  *                 if self.size - size_before > self.max_item_size:             # <<<<<<<<<<<<<<
10227  *                     raise BufferItemTooLarge(self.size - size_before)
10228  *
10229  */
10230               __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L13_error)
10231               __Pyx_GOTREF(__pyx_t_1);
10232               __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_size_before); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L13_error)
10233               __Pyx_GOTREF(__pyx_t_2);
10234               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10235               __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->__pyx_base.max_item_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L13_error)
10236               __Pyx_GOTREF(__pyx_t_1);
10237               __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L13_error)
10238               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10239               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10240               __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 466, __pyx_L13_error)
10241               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10242               if (unlikely(__pyx_t_14)) {
10243 
10244                 /* "ddtrace/internal/_encoding.pyx":467
10245  *                 # free and reallocate with the appropriate size.
10246  *                 if self.size - size_before > self.max_item_size:
10247  *                     raise BufferItemTooLarge(self.size - size_before)             # <<<<<<<<<<<<<<
10248  *
10249  *                 if self.size > self.max_size:
10250  */
10251                 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BufferItemTooLarge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L13_error)
10252                 __Pyx_GOTREF(__pyx_t_1);
10253                 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L13_error)
10254                 __Pyx_GOTREF(__pyx_t_2);
10255                 __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_v_size_before); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 467, __pyx_L13_error)
10256                 __Pyx_GOTREF(__pyx_t_4);
10257                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10258                 __pyx_t_2 = NULL;
10259                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10260                   __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
10261                   if (likely(__pyx_t_2)) {
10262                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10263                     __Pyx_INCREF(__pyx_t_2);
10264                     __Pyx_INCREF(function);
10265                     __Pyx_DECREF_SET(__pyx_t_1, function);
10266                   }
10267                 }
10268                 __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
10269                 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10270                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10271                 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L13_error)
10272                 __Pyx_GOTREF(__pyx_t_3);
10273                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10274                 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10275                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10276                 __PYX_ERR(0, 467, __pyx_L13_error)
10277 
10278                 /* "ddtrace/internal/_encoding.pyx":466
10279  *                 # grow arbitrarily because of the PyMem_Realloc and if it does then
10280  *                 # free and reallocate with the appropriate size.
10281  *                 if self.size - size_before > self.max_item_size:             # <<<<<<<<<<<<<<
10282  *                     raise BufferItemTooLarge(self.size - size_before)
10283  *
10284  */
10285               }
10286 
10287               /* "ddtrace/internal/_encoding.pyx":469
10288  *                     raise BufferItemTooLarge(self.size - size_before)
10289  *
10290  *                 if self.size > self.max_size:             # <<<<<<<<<<<<<<
10291  *                     raise BufferFull(self.size - size_before)
10292  *
10293  */
10294               __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L13_error)
10295               __Pyx_GOTREF(__pyx_t_3);
10296               __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->__pyx_base.max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L13_error)
10297               __Pyx_GOTREF(__pyx_t_1);
10298               __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L13_error)
10299               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10300               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10301               __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 469, __pyx_L13_error)
10302               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10303               if (unlikely(__pyx_t_14)) {
10304 
10305                 /* "ddtrace/internal/_encoding.pyx":470
10306  *
10307  *                 if self.size > self.max_size:
10308  *                     raise BufferFull(self.size - size_before)             # <<<<<<<<<<<<<<
10309  *
10310  *                 self._count += 1
10311  */
10312                 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BufferFull); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L13_error)
10313                 __Pyx_GOTREF(__pyx_t_1);
10314                 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L13_error)
10315                 __Pyx_GOTREF(__pyx_t_3);
10316                 __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_v_size_before); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L13_error)
10317                 __Pyx_GOTREF(__pyx_t_2);
10318                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10319                 __pyx_t_3 = NULL;
10320                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10321                   __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
10322                   if (likely(__pyx_t_3)) {
10323                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10324                     __Pyx_INCREF(__pyx_t_3);
10325                     __Pyx_INCREF(function);
10326                     __Pyx_DECREF_SET(__pyx_t_1, function);
10327                   }
10328                 }
10329                 __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
10330                 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10331                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10332                 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L13_error)
10333                 __Pyx_GOTREF(__pyx_t_4);
10334                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10335                 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
10336                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10337                 __PYX_ERR(0, 470, __pyx_L13_error)
10338 
10339                 /* "ddtrace/internal/_encoding.pyx":469
10340  *                     raise BufferItemTooLarge(self.size - size_before)
10341  *
10342  *                 if self.size > self.max_size:             # <<<<<<<<<<<<<<
10343  *                     raise BufferFull(self.size - size_before)
10344  *
10345  */
10346               }
10347 
10348               /* "ddtrace/internal/_encoding.pyx":472
10349  *                     raise BufferFull(self.size - size_before)
10350  *
10351  *                 self._count += 1             # <<<<<<<<<<<<<<
10352  *             except:
10353  *                 # rollback
10354  */
10355               __pyx_v_self->_count = (__pyx_v_self->_count + 1);
10356 
10357               /* "ddtrace/internal/_encoding.pyx":456
10358  *             len_before = self.pk.length
10359  *             size_before = self.size
10360  *             try:             # <<<<<<<<<<<<<<
10361  *                 ret = self._pack_trace(trace)
10362  *                 if ret:  # should not happen.
10363  */
10364             }
10365             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
10366             __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
10367             __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
10368             goto __pyx_L18_try_end;
10369             __pyx_L13_error:;
10370             __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10371             __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10372             __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10373             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10374 
10375             /* "ddtrace/internal/_encoding.pyx":473
10376  *
10377  *                 self._count += 1
10378  *             except:             # <<<<<<<<<<<<<<
10379  *                 # rollback
10380  *                 self.pk.length = len_before
10381  */
10382             /*except:*/ {
10383               __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
10384               if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 473, __pyx_L15_except_error)
10385               __Pyx_GOTREF(__pyx_t_4);
10386               __Pyx_GOTREF(__pyx_t_1);
10387               __Pyx_GOTREF(__pyx_t_2);
10388 
10389               /* "ddtrace/internal/_encoding.pyx":475
10390  *             except:
10391  *                 # rollback
10392  *                 self.pk.length = len_before             # <<<<<<<<<<<<<<
10393  *                 raise
10394  *
10395  */
10396               __pyx_v_self->pk.length = __pyx_v_len_before;
10397 
10398               /* "ddtrace/internal/_encoding.pyx":476
10399  *                 # rollback
10400  *                 self.pk.length = len_before
10401  *                 raise             # <<<<<<<<<<<<<<
10402  *
10403  *     @property
10404  */
10405               __Pyx_GIVEREF(__pyx_t_4);
10406               __Pyx_GIVEREF(__pyx_t_1);
10407               __Pyx_XGIVEREF(__pyx_t_2);
10408               __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_2);
10409               __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0;
10410               __PYX_ERR(0, 476, __pyx_L15_except_error)
10411             }
10412             __pyx_L15_except_error:;
10413 
10414             /* "ddtrace/internal/_encoding.pyx":456
10415  *             len_before = self.pk.length
10416  *             size_before = self.size
10417  *             try:             # <<<<<<<<<<<<<<
10418  *                 ret = self._pack_trace(trace)
10419  *                 if ret:  # should not happen.
10420  */
10421             __Pyx_XGIVEREF(__pyx_t_10);
10422             __Pyx_XGIVEREF(__pyx_t_11);
10423             __Pyx_XGIVEREF(__pyx_t_12);
10424             __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
10425             goto __pyx_L7_error;
10426             __pyx_L18_try_end:;
10427           }
10428 
10429           /* "ddtrace/internal/_encoding.pyx":453
10430  *         cdef int ret
10431  *
10432  *         with self._lock:             # <<<<<<<<<<<<<<
10433  *             len_before = self.pk.length
10434  *             size_before = self.size
10435  */
10436         }
10437         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10438         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10439         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10440         goto __pyx_L12_try_end;
10441         __pyx_L7_error:;
10442         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10443         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10444         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10445         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10446         /*except:*/ {
10447           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
10448           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 453, __pyx_L9_except_error)
10449           __Pyx_GOTREF(__pyx_t_2);
10450           __Pyx_GOTREF(__pyx_t_1);
10451           __Pyx_GOTREF(__pyx_t_4);
10452           __pyx_t_3 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L9_except_error)
10453           __Pyx_GOTREF(__pyx_t_3);
10454           __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL);
10455           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10456           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10457           if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 453, __pyx_L9_except_error)
10458           __Pyx_GOTREF(__pyx_t_12);
10459           __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12);
10460           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
10461           if (__pyx_t_14 < 0) __PYX_ERR(0, 453, __pyx_L9_except_error)
10462           __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
10463           if (__pyx_t_15) {
10464             __Pyx_GIVEREF(__pyx_t_2);
10465             __Pyx_GIVEREF(__pyx_t_1);
10466             __Pyx_XGIVEREF(__pyx_t_4);
10467             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_4);
10468             __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0;
10469             __PYX_ERR(0, 453, __pyx_L9_except_error)
10470           }
10471           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10472           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10473           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10474           goto __pyx_L8_exception_handled;
10475         }
10476         __pyx_L9_except_error:;
10477         __Pyx_XGIVEREF(__pyx_t_6);
10478         __Pyx_XGIVEREF(__pyx_t_7);
10479         __Pyx_XGIVEREF(__pyx_t_8);
10480         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
10481         goto __pyx_L1_error;
10482         __pyx_L8_exception_handled:;
10483         __Pyx_XGIVEREF(__pyx_t_6);
10484         __Pyx_XGIVEREF(__pyx_t_7);
10485         __Pyx_XGIVEREF(__pyx_t_8);
10486         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
10487         __pyx_L12_try_end:;
10488       }
10489     }
10490     /*finally:*/ {
10491       /*normal exit:*/{
10492         if (__pyx_t_5) {
10493           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
10494           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10495           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 453, __pyx_L1_error)
10496           __Pyx_GOTREF(__pyx_t_8);
10497           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10498         }
10499         goto __pyx_L6;
10500       }
10501       __pyx_L6:;
10502     }
10503     goto __pyx_L27;
10504     __pyx_L3_error:;
10505     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10506     goto __pyx_L1_error;
10507     __pyx_L27:;
10508   }
10509 
10510   /* "ddtrace/internal/_encoding.pyx":449
10511  *         return ret
10512  *
10513  *     cpdef put(self, list trace):             # <<<<<<<<<<<<<<
10514  *         """Put a trace (i.e. a list of spans) in the buffer."""
10515  *         cdef int ret
10516  */
10517 
10518   /* function exit code */
10519   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10520   goto __pyx_L0;
10521   __pyx_L1_error:;
10522   __Pyx_XDECREF(__pyx_t_1);
10523   __Pyx_XDECREF(__pyx_t_2);
10524   __Pyx_XDECREF(__pyx_t_3);
10525   __Pyx_XDECREF(__pyx_t_4);
10526   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
10527   __pyx_r = 0;
10528   __pyx_L0:;
10529   __Pyx_XDECREF(__pyx_v_size_before);
10530   __Pyx_XGIVEREF(__pyx_r);
10531   __Pyx_RefNannyFinishContext();
10532   return __pyx_r;
10533 }
10534 
10535 /* Python wrapper */
10536 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace); /*proto*/
10537 static char __pyx_doc_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put[] = "Put a trace (i.e. a list of spans) in the buffer.";
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put(PyObject * __pyx_v_self,PyObject * __pyx_v_trace)10538 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace) {
10539   int __pyx_lineno = 0;
10540   const char *__pyx_filename = NULL;
10541   int __pyx_clineno = 0;
10542   PyObject *__pyx_r = 0;
10543   __Pyx_RefNannyDeclarations
10544   __Pyx_RefNannySetupContext("put (wrapper)", 0);
10545   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trace), (&PyList_Type), 1, "trace", 1))) __PYX_ERR(0, 449, __pyx_L1_error)
10546   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self), ((PyObject*)__pyx_v_trace));
10547 
10548   /* function exit code */
10549   goto __pyx_L0;
10550   __pyx_L1_error:;
10551   __pyx_r = NULL;
10552   __pyx_L0:;
10553   __Pyx_RefNannyFinishContext();
10554   return __pyx_r;
10555 }
10556 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,PyObject * __pyx_v_trace)10557 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, PyObject *__pyx_v_trace) {
10558   PyObject *__pyx_r = NULL;
10559   __Pyx_RefNannyDeclarations
10560   PyObject *__pyx_t_1 = NULL;
10561   int __pyx_lineno = 0;
10562   const char *__pyx_filename = NULL;
10563   int __pyx_clineno = 0;
10564   __Pyx_RefNannySetupContext("put", 0);
10565   __Pyx_XDECREF(__pyx_r);
10566   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_put(__pyx_v_self, __pyx_v_trace, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
10567   __Pyx_GOTREF(__pyx_t_1);
10568   __pyx_r = __pyx_t_1;
10569   __pyx_t_1 = 0;
10570   goto __pyx_L0;
10571 
10572   /* function exit code */
10573   __pyx_L1_error:;
10574   __Pyx_XDECREF(__pyx_t_1);
10575   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
10576   __pyx_r = NULL;
10577   __pyx_L0:;
10578   __Pyx_XGIVEREF(__pyx_r);
10579   __Pyx_RefNannyFinishContext();
10580   return __pyx_r;
10581 }
10582 
10583 /* "ddtrace/internal/_encoding.pyx":479
10584  *
10585  *     @property
10586  *     def size(self):             # <<<<<<<<<<<<<<
10587  *         """Return the size in bytes of the encoder buffer."""
10588  *         with self._lock:
10589  */
10590 
10591 /* Python wrapper */
10592 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size_1__get__(PyObject * __pyx_v_self)10593 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size_1__get__(PyObject *__pyx_v_self) {
10594   PyObject *__pyx_r = 0;
10595   __Pyx_RefNannyDeclarations
10596   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10597   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
10598 
10599   /* function exit code */
10600   __Pyx_RefNannyFinishContext();
10601   return __pyx_r;
10602 }
10603 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)10604 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
10605   PyObject *__pyx_r = NULL;
10606   __Pyx_RefNannyDeclarations
10607   PyObject *__pyx_t_1 = NULL;
10608   PyObject *__pyx_t_2 = NULL;
10609   PyObject *__pyx_t_3 = NULL;
10610   PyObject *__pyx_t_4 = NULL;
10611   PyObject *__pyx_t_5 = NULL;
10612   PyObject *__pyx_t_6 = NULL;
10613   PyObject *__pyx_t_7 = NULL;
10614   PyObject *__pyx_t_8 = NULL;
10615   PyObject *__pyx_t_9 = NULL;
10616   int __pyx_t_10;
10617   int __pyx_t_11;
10618   int __pyx_lineno = 0;
10619   const char *__pyx_filename = NULL;
10620   int __pyx_clineno = 0;
10621   __Pyx_RefNannySetupContext("__get__", 0);
10622 
10623   /* "ddtrace/internal/_encoding.pyx":481
10624  *     def size(self):
10625  *         """Return the size in bytes of the encoder buffer."""
10626  *         with self._lock:             # <<<<<<<<<<<<<<
10627  *             return self.pk.length + array_prefix_size(self._count) - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE
10628  *
10629  */
10630   /*with:*/ {
10631     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
10632     __Pyx_GOTREF(__pyx_t_1);
10633     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L3_error)
10634     __Pyx_GOTREF(__pyx_t_3);
10635     __pyx_t_4 = NULL;
10636     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
10637       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
10638       if (likely(__pyx_t_4)) {
10639         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10640         __Pyx_INCREF(__pyx_t_4);
10641         __Pyx_INCREF(function);
10642         __Pyx_DECREF_SET(__pyx_t_3, function);
10643       }
10644     }
10645     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
10646     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10647     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L3_error)
10648     __Pyx_GOTREF(__pyx_t_2);
10649     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10650     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10651     /*try:*/ {
10652       {
10653         __Pyx_PyThreadState_declare
10654         __Pyx_PyThreadState_assign
10655         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
10656         __Pyx_XGOTREF(__pyx_t_5);
10657         __Pyx_XGOTREF(__pyx_t_6);
10658         __Pyx_XGOTREF(__pyx_t_7);
10659         /*try:*/ {
10660 
10661           /* "ddtrace/internal/_encoding.pyx":482
10662  *         """Return the size in bytes of the encoder buffer."""
10663  *         with self._lock:
10664  *             return self.pk.length + array_prefix_size(self._count) - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE             # <<<<<<<<<<<<<<
10665  *
10666  *     # ---- Abstract methods ----
10667  */
10668           __Pyx_XDECREF(__pyx_r);
10669           __pyx_t_2 = __Pyx_PyInt_FromSize_t(((__pyx_v_self->pk.length + __pyx_f_7ddtrace_8internal_9_encoding_array_prefix_size(__pyx_v_self->_count)) - 5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L7_error)
10670           __Pyx_GOTREF(__pyx_t_2);
10671           __pyx_r = __pyx_t_2;
10672           __pyx_t_2 = 0;
10673           goto __pyx_L11_try_return;
10674 
10675           /* "ddtrace/internal/_encoding.pyx":481
10676  *     def size(self):
10677  *         """Return the size in bytes of the encoder buffer."""
10678  *         with self._lock:             # <<<<<<<<<<<<<<
10679  *             return self.pk.length + array_prefix_size(self._count) - MSGPACK_ARRAY_LENGTH_PREFIX_SIZE
10680  *
10681  */
10682         }
10683         __pyx_L7_error:;
10684         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10685         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10686         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10687         /*except:*/ {
10688           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10689           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 481, __pyx_L9_except_error)
10690           __Pyx_GOTREF(__pyx_t_2);
10691           __Pyx_GOTREF(__pyx_t_3);
10692           __Pyx_GOTREF(__pyx_t_4);
10693           __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L9_except_error)
10694           __Pyx_GOTREF(__pyx_t_8);
10695           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL);
10696           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10697           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10698           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L9_except_error)
10699           __Pyx_GOTREF(__pyx_t_9);
10700           __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
10701           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10702           if (__pyx_t_10 < 0) __PYX_ERR(0, 481, __pyx_L9_except_error)
10703           __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
10704           if (__pyx_t_11) {
10705             __Pyx_GIVEREF(__pyx_t_2);
10706             __Pyx_GIVEREF(__pyx_t_3);
10707             __Pyx_XGIVEREF(__pyx_t_4);
10708             __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10709             __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
10710             __PYX_ERR(0, 481, __pyx_L9_except_error)
10711           }
10712           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10713           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10714           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10715           goto __pyx_L8_exception_handled;
10716         }
10717         __pyx_L9_except_error:;
10718         __Pyx_XGIVEREF(__pyx_t_5);
10719         __Pyx_XGIVEREF(__pyx_t_6);
10720         __Pyx_XGIVEREF(__pyx_t_7);
10721         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
10722         goto __pyx_L1_error;
10723         __pyx_L11_try_return:;
10724         __Pyx_XGIVEREF(__pyx_t_5);
10725         __Pyx_XGIVEREF(__pyx_t_6);
10726         __Pyx_XGIVEREF(__pyx_t_7);
10727         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
10728         goto __pyx_L4_return;
10729         __pyx_L8_exception_handled:;
10730         __Pyx_XGIVEREF(__pyx_t_5);
10731         __Pyx_XGIVEREF(__pyx_t_6);
10732         __Pyx_XGIVEREF(__pyx_t_7);
10733         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
10734       }
10735     }
10736     /*finally:*/ {
10737       /*normal exit:*/{
10738         if (__pyx_t_1) {
10739           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
10740           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10741           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 481, __pyx_L1_error)
10742           __Pyx_GOTREF(__pyx_t_7);
10743           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10744         }
10745         goto __pyx_L6;
10746       }
10747       __pyx_L4_return: {
10748         __pyx_t_7 = __pyx_r;
10749         __pyx_r = 0;
10750         if (__pyx_t_1) {
10751           __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
10752           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10753           if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error)
10754           __Pyx_GOTREF(__pyx_t_6);
10755           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10756         }
10757         __pyx_r = __pyx_t_7;
10758         __pyx_t_7 = 0;
10759         goto __pyx_L0;
10760       }
10761       __pyx_L6:;
10762     }
10763     goto __pyx_L16;
10764     __pyx_L3_error:;
10765     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10766     goto __pyx_L1_error;
10767     __pyx_L16:;
10768   }
10769 
10770   /* "ddtrace/internal/_encoding.pyx":479
10771  *
10772  *     @property
10773  *     def size(self):             # <<<<<<<<<<<<<<
10774  *         """Return the size in bytes of the encoder buffer."""
10775  *         with self._lock:
10776  */
10777 
10778   /* function exit code */
10779   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10780   goto __pyx_L0;
10781   __pyx_L1_error:;
10782   __Pyx_XDECREF(__pyx_t_2);
10783   __Pyx_XDECREF(__pyx_t_3);
10784   __Pyx_XDECREF(__pyx_t_4);
10785   __Pyx_XDECREF(__pyx_t_8);
10786   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10787   __pyx_r = NULL;
10788   __pyx_L0:;
10789   __Pyx_XGIVEREF(__pyx_r);
10790   __Pyx_RefNannyFinishContext();
10791   return __pyx_r;
10792 }
10793 
10794 /* "ddtrace/internal/_encoding.pyx":486
10795  *     # ---- Abstract methods ----
10796  *
10797  *     cpdef flush(self):             # <<<<<<<<<<<<<<
10798  *         raise NotImplementedError()
10799  *
10800  */
10801 
10802 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_flush(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,int __pyx_skip_dispatch)10803 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_flush(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, int __pyx_skip_dispatch) {
10804   PyObject *__pyx_r = NULL;
10805   __Pyx_RefNannyDeclarations
10806   PyObject *__pyx_t_1 = NULL;
10807   PyObject *__pyx_t_2 = NULL;
10808   PyObject *__pyx_t_3 = NULL;
10809   PyObject *__pyx_t_4 = NULL;
10810   int __pyx_lineno = 0;
10811   const char *__pyx_filename = NULL;
10812   int __pyx_clineno = 0;
10813   __Pyx_RefNannySetupContext("flush", 0);
10814   /* Check if called by wrapper */
10815   if (unlikely(__pyx_skip_dispatch)) ;
10816   /* Check if overridden in Python */
10817   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
10818     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10819     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10820     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
10821       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10822       #endif
10823       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
10824       __Pyx_GOTREF(__pyx_t_1);
10825       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush)) {
10826         __Pyx_XDECREF(__pyx_r);
10827         __Pyx_INCREF(__pyx_t_1);
10828         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
10829         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10830           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
10831           if (likely(__pyx_t_4)) {
10832             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10833             __Pyx_INCREF(__pyx_t_4);
10834             __Pyx_INCREF(function);
10835             __Pyx_DECREF_SET(__pyx_t_3, function);
10836           }
10837         }
10838         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
10839         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10840         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
10841         __Pyx_GOTREF(__pyx_t_2);
10842         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10843         __pyx_r = __pyx_t_2;
10844         __pyx_t_2 = 0;
10845         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10846         goto __pyx_L0;
10847       }
10848       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10849       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10850       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
10851       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
10852         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10853       }
10854       #endif
10855       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10856       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10857     }
10858     #endif
10859   }
10860 
10861   /* "ddtrace/internal/_encoding.pyx":487
10862  *
10863  *     cpdef flush(self):
10864  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
10865  *
10866  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:
10867  */
10868   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
10869   __Pyx_GOTREF(__pyx_t_1);
10870   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10871   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10872   __PYX_ERR(0, 487, __pyx_L1_error)
10873 
10874   /* "ddtrace/internal/_encoding.pyx":486
10875  *     # ---- Abstract methods ----
10876  *
10877  *     cpdef flush(self):             # <<<<<<<<<<<<<<
10878  *         raise NotImplementedError()
10879  *
10880  */
10881 
10882   /* function exit code */
10883   __pyx_L1_error:;
10884   __Pyx_XDECREF(__pyx_t_1);
10885   __Pyx_XDECREF(__pyx_t_2);
10886   __Pyx_XDECREF(__pyx_t_3);
10887   __Pyx_XDECREF(__pyx_t_4);
10888   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
10889   __pyx_r = 0;
10890   __pyx_L0:;
10891   __Pyx_XGIVEREF(__pyx_r);
10892   __Pyx_RefNannyFinishContext();
10893   return __pyx_r;
10894 }
10895 
10896 /* Python wrapper */
10897 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)10898 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10899   PyObject *__pyx_r = 0;
10900   __Pyx_RefNannyDeclarations
10901   __Pyx_RefNannySetupContext("flush (wrapper)", 0);
10902   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_12flush(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
10903 
10904   /* function exit code */
10905   __Pyx_RefNannyFinishContext();
10906   return __pyx_r;
10907 }
10908 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_12flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)10909 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_12flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
10910   PyObject *__pyx_r = NULL;
10911   __Pyx_RefNannyDeclarations
10912   PyObject *__pyx_t_1 = NULL;
10913   int __pyx_lineno = 0;
10914   const char *__pyx_filename = NULL;
10915   int __pyx_clineno = 0;
10916   __Pyx_RefNannySetupContext("flush", 0);
10917   __Pyx_XDECREF(__pyx_r);
10918   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_flush(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
10919   __Pyx_GOTREF(__pyx_t_1);
10920   __pyx_r = __pyx_t_1;
10921   __pyx_t_1 = 0;
10922   goto __pyx_L0;
10923 
10924   /* function exit code */
10925   __pyx_L1_error:;
10926   __Pyx_XDECREF(__pyx_t_1);
10927   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
10928   __pyx_r = NULL;
10929   __pyx_L0:;
10930   __Pyx_XGIVEREF(__pyx_r);
10931   __Pyx_RefNannyFinishContext();
10932   return __pyx_r;
10933 }
10934 
10935 /* "ddtrace/internal/_encoding.pyx":489
10936  *         raise NotImplementedError()
10937  *
10938  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
10939  *         raise NotImplementedError()
10940  *
10941  */
10942 
__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_pack_span(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_span,CYTHON_UNUSED void * __pyx_v_dd_origin)10943 static int __pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_pack_span(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_span, CYTHON_UNUSED void *__pyx_v_dd_origin) {
10944   int __pyx_r;
10945   __Pyx_RefNannyDeclarations
10946   PyObject *__pyx_t_1 = NULL;
10947   int __pyx_lineno = 0;
10948   const char *__pyx_filename = NULL;
10949   int __pyx_clineno = 0;
10950   __Pyx_RefNannySetupContext("pack_span", 0);
10951 
10952   /* "ddtrace/internal/_encoding.pyx":490
10953  *
10954  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:
10955  *         raise NotImplementedError()             # <<<<<<<<<<<<<<
10956  *
10957  *
10958  */
10959   __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
10960   __Pyx_GOTREF(__pyx_t_1);
10961   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10962   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10963   __PYX_ERR(0, 490, __pyx_L1_error)
10964 
10965   /* "ddtrace/internal/_encoding.pyx":489
10966  *         raise NotImplementedError()
10967  *
10968  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
10969  *         raise NotImplementedError()
10970  *
10971  */
10972 
10973   /* function exit code */
10974   __pyx_L1_error:;
10975   __Pyx_XDECREF(__pyx_t_1);
10976   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.pack_span", __pyx_clineno, __pyx_lineno, __pyx_filename);
10977   __pyx_r = -1;
10978   __Pyx_RefNannyFinishContext();
10979   return __pyx_r;
10980 }
10981 
10982 /* "(tree fragment)":1
10983  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10984  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10985  * def __setstate_cython__(self, __pyx_state):
10986  */
10987 
10988 /* Python wrapper */
10989 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_15__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)10990 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10991   PyObject *__pyx_r = 0;
10992   __Pyx_RefNannyDeclarations
10993   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
10994   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_14__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self));
10995 
10996   /* function exit code */
10997   __Pyx_RefNannyFinishContext();
10998   return __pyx_r;
10999 }
11000 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self)11001 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self) {
11002   PyObject *__pyx_r = NULL;
11003   __Pyx_RefNannyDeclarations
11004   PyObject *__pyx_t_1 = NULL;
11005   int __pyx_lineno = 0;
11006   const char *__pyx_filename = NULL;
11007   int __pyx_clineno = 0;
11008   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11009 
11010   /* "(tree fragment)":2
11011  * def __reduce_cython__(self):
11012  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11013  * def __setstate_cython__(self, __pyx_state):
11014  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11015  */
11016   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
11017   __Pyx_GOTREF(__pyx_t_1);
11018   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11019   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11020   __PYX_ERR(1, 2, __pyx_L1_error)
11021 
11022   /* "(tree fragment)":1
11023  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11024  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11025  * def __setstate_cython__(self, __pyx_state):
11026  */
11027 
11028   /* function exit code */
11029   __pyx_L1_error:;
11030   __Pyx_XDECREF(__pyx_t_1);
11031   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11032   __pyx_r = NULL;
11033   __Pyx_XGIVEREF(__pyx_r);
11034   __Pyx_RefNannyFinishContext();
11035   return __pyx_r;
11036 }
11037 
11038 /* "(tree fragment)":3
11039  * def __reduce_cython__(self):
11040  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11041  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11042  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11043  */
11044 
11045 /* Python wrapper */
11046 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_17__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)11047 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11048   PyObject *__pyx_r = 0;
11049   __Pyx_RefNannyDeclarations
11050   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11051   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_16__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11052 
11053   /* function exit code */
11054   __Pyx_RefNannyFinishContext();
11055   return __pyx_r;
11056 }
11057 
__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)11058 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11059   PyObject *__pyx_r = NULL;
11060   __Pyx_RefNannyDeclarations
11061   PyObject *__pyx_t_1 = NULL;
11062   int __pyx_lineno = 0;
11063   const char *__pyx_filename = NULL;
11064   int __pyx_clineno = 0;
11065   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11066 
11067   /* "(tree fragment)":4
11068  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11069  * def __setstate_cython__(self, __pyx_state):
11070  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11071  */
11072   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
11073   __Pyx_GOTREF(__pyx_t_1);
11074   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11075   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11076   __PYX_ERR(1, 4, __pyx_L1_error)
11077 
11078   /* "(tree fragment)":3
11079  * def __reduce_cython__(self):
11080  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11081  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11082  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11083  */
11084 
11085   /* function exit code */
11086   __pyx_L1_error:;
11087   __Pyx_XDECREF(__pyx_t_1);
11088   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderBase.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11089   __pyx_r = NULL;
11090   __Pyx_XGIVEREF(__pyx_r);
11091   __Pyx_RefNannyFinishContext();
11092   return __pyx_r;
11093 }
11094 
11095 /* "ddtrace/internal/_encoding.pyx":494
11096  *
11097  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):
11098  *     cpdef flush(self):             # <<<<<<<<<<<<<<
11099  *         with self._lock:
11100  *             try:
11101  */
11102 
11103 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,int __pyx_skip_dispatch)11104 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, int __pyx_skip_dispatch) {
11105   PyObject *__pyx_r = NULL;
11106   __Pyx_RefNannyDeclarations
11107   PyObject *__pyx_t_1 = NULL;
11108   PyObject *__pyx_t_2 = NULL;
11109   PyObject *__pyx_t_3 = NULL;
11110   PyObject *__pyx_t_4 = NULL;
11111   PyObject *__pyx_t_5 = NULL;
11112   PyObject *__pyx_t_6 = NULL;
11113   PyObject *__pyx_t_7 = NULL;
11114   PyObject *__pyx_t_8 = NULL;
11115   int __pyx_t_9;
11116   int __pyx_t_10;
11117   char const *__pyx_t_11;
11118   PyObject *__pyx_t_12 = NULL;
11119   PyObject *__pyx_t_13 = NULL;
11120   PyObject *__pyx_t_14 = NULL;
11121   PyObject *__pyx_t_15 = NULL;
11122   PyObject *__pyx_t_16 = NULL;
11123   PyObject *__pyx_t_17 = NULL;
11124   int __pyx_t_18;
11125   int __pyx_t_19;
11126   int __pyx_lineno = 0;
11127   const char *__pyx_filename = NULL;
11128   int __pyx_clineno = 0;
11129   __Pyx_RefNannySetupContext("flush", 0);
11130   /* Check if called by wrapper */
11131   if (unlikely(__pyx_skip_dispatch)) ;
11132   /* Check if overridden in Python */
11133   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
11134     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
11135     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
11136     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
11137       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
11138       #endif
11139       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
11140       __Pyx_GOTREF(__pyx_t_1);
11141       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush)) {
11142         __Pyx_XDECREF(__pyx_r);
11143         __Pyx_INCREF(__pyx_t_1);
11144         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
11145         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11146           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
11147           if (likely(__pyx_t_4)) {
11148             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11149             __Pyx_INCREF(__pyx_t_4);
11150             __Pyx_INCREF(function);
11151             __Pyx_DECREF_SET(__pyx_t_3, function);
11152           }
11153         }
11154         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
11155         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11156         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
11157         __Pyx_GOTREF(__pyx_t_2);
11158         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11159         __pyx_r = __pyx_t_2;
11160         __pyx_t_2 = 0;
11161         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11162         goto __pyx_L0;
11163       }
11164       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
11165       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
11166       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
11167       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
11168         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
11169       }
11170       #endif
11171       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11172       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
11173     }
11174     #endif
11175   }
11176 
11177   /* "ddtrace/internal/_encoding.pyx":495
11178  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):
11179  *     cpdef flush(self):
11180  *         with self._lock:             # <<<<<<<<<<<<<<
11181  *             try:
11182  *                 return self.get_bytes()
11183  */
11184   /*with:*/ {
11185     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L1_error)
11186     __Pyx_GOTREF(__pyx_t_5);
11187     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L3_error)
11188     __Pyx_GOTREF(__pyx_t_2);
11189     __pyx_t_3 = NULL;
11190     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
11191       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11192       if (likely(__pyx_t_3)) {
11193         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11194         __Pyx_INCREF(__pyx_t_3);
11195         __Pyx_INCREF(function);
11196         __Pyx_DECREF_SET(__pyx_t_2, function);
11197       }
11198     }
11199     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
11200     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11201     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L3_error)
11202     __Pyx_GOTREF(__pyx_t_1);
11203     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11204     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11205     /*try:*/ {
11206       {
11207         __Pyx_PyThreadState_declare
11208         __Pyx_PyThreadState_assign
11209         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
11210         __Pyx_XGOTREF(__pyx_t_6);
11211         __Pyx_XGOTREF(__pyx_t_7);
11212         __Pyx_XGOTREF(__pyx_t_8);
11213         /*try:*/ {
11214 
11215           /* "ddtrace/internal/_encoding.pyx":496
11216  *     cpdef flush(self):
11217  *         with self._lock:
11218  *             try:             # <<<<<<<<<<<<<<
11219  *                 return self.get_bytes()
11220  *             finally:
11221  */
11222           /*try:*/ {
11223 
11224             /* "ddtrace/internal/_encoding.pyx":497
11225  *         with self._lock:
11226  *             try:
11227  *                 return self.get_bytes()             # <<<<<<<<<<<<<<
11228  *             finally:
11229  *                 self._reset_buffer()
11230  */
11231             __Pyx_XDECREF(__pyx_r);
11232             __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_bytes(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L14_error)
11233             __Pyx_GOTREF(__pyx_t_1);
11234             __pyx_r = __pyx_t_1;
11235             __pyx_t_1 = 0;
11236             goto __pyx_L13_return;
11237           }
11238 
11239           /* "ddtrace/internal/_encoding.pyx":499
11240  *                 return self.get_bytes()
11241  *             finally:
11242  *                 self._reset_buffer()             # <<<<<<<<<<<<<<
11243  *
11244  *     cdef void * get_dd_origin_ref(self, str dd_origin):
11245  */
11246           /*finally:*/ {
11247             __pyx_L14_error:;
11248             /*exception exit:*/{
11249               __Pyx_PyThreadState_declare
11250               __Pyx_PyThreadState_assign
11251               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11252               __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11253               __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11254               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11255               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11256               if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
11257               if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
11258               __Pyx_XGOTREF(__pyx_t_12);
11259               __Pyx_XGOTREF(__pyx_t_13);
11260               __Pyx_XGOTREF(__pyx_t_14);
11261               __Pyx_XGOTREF(__pyx_t_15);
11262               __Pyx_XGOTREF(__pyx_t_16);
11263               __Pyx_XGOTREF(__pyx_t_17);
11264               __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
11265               {
11266                 __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._reset_buffer(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L17_error)
11267                 __Pyx_GOTREF(__pyx_t_1);
11268                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11269               }
11270               if (PY_MAJOR_VERSION >= 3) {
11271                 __Pyx_XGIVEREF(__pyx_t_15);
11272                 __Pyx_XGIVEREF(__pyx_t_16);
11273                 __Pyx_XGIVEREF(__pyx_t_17);
11274                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
11275               }
11276               __Pyx_XGIVEREF(__pyx_t_12);
11277               __Pyx_XGIVEREF(__pyx_t_13);
11278               __Pyx_XGIVEREF(__pyx_t_14);
11279               __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
11280               __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11281               __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
11282               goto __pyx_L7_error;
11283               __pyx_L17_error:;
11284               if (PY_MAJOR_VERSION >= 3) {
11285                 __Pyx_XGIVEREF(__pyx_t_15);
11286                 __Pyx_XGIVEREF(__pyx_t_16);
11287                 __Pyx_XGIVEREF(__pyx_t_17);
11288                 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
11289               }
11290               __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
11291               __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
11292               __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
11293               __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11294               goto __pyx_L7_error;
11295             }
11296             __pyx_L13_return: {
11297               __pyx_t_17 = __pyx_r;
11298               __pyx_r = 0;
11299               __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._reset_buffer(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L7_error)
11300               __Pyx_GOTREF(__pyx_t_1);
11301               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11302               __pyx_r = __pyx_t_17;
11303               __pyx_t_17 = 0;
11304               goto __pyx_L11_try_return;
11305             }
11306           }
11307 
11308           /* "ddtrace/internal/_encoding.pyx":495
11309  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):
11310  *     cpdef flush(self):
11311  *         with self._lock:             # <<<<<<<<<<<<<<
11312  *             try:
11313  *                 return self.get_bytes()
11314  */
11315         }
11316         __pyx_L7_error:;
11317         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11318         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11319         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11320         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11321         /*except:*/ {
11322           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
11323           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 495, __pyx_L9_except_error)
11324           __Pyx_GOTREF(__pyx_t_1);
11325           __Pyx_GOTREF(__pyx_t_2);
11326           __Pyx_GOTREF(__pyx_t_3);
11327           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L9_except_error)
11328           __Pyx_GOTREF(__pyx_t_4);
11329           __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
11330           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11331           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11332           if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 495, __pyx_L9_except_error)
11333           __Pyx_GOTREF(__pyx_t_17);
11334           __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
11335           __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
11336           if (__pyx_t_18 < 0) __PYX_ERR(0, 495, __pyx_L9_except_error)
11337           __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
11338           if (__pyx_t_19) {
11339             __Pyx_GIVEREF(__pyx_t_1);
11340             __Pyx_GIVEREF(__pyx_t_2);
11341             __Pyx_XGIVEREF(__pyx_t_3);
11342             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
11343             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
11344             __PYX_ERR(0, 495, __pyx_L9_except_error)
11345           }
11346           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11347           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11348           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11349           goto __pyx_L8_exception_handled;
11350         }
11351         __pyx_L9_except_error:;
11352         __Pyx_XGIVEREF(__pyx_t_6);
11353         __Pyx_XGIVEREF(__pyx_t_7);
11354         __Pyx_XGIVEREF(__pyx_t_8);
11355         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11356         goto __pyx_L1_error;
11357         __pyx_L11_try_return:;
11358         __Pyx_XGIVEREF(__pyx_t_6);
11359         __Pyx_XGIVEREF(__pyx_t_7);
11360         __Pyx_XGIVEREF(__pyx_t_8);
11361         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11362         goto __pyx_L4_return;
11363         __pyx_L8_exception_handled:;
11364         __Pyx_XGIVEREF(__pyx_t_6);
11365         __Pyx_XGIVEREF(__pyx_t_7);
11366         __Pyx_XGIVEREF(__pyx_t_8);
11367         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11368       }
11369     }
11370     /*finally:*/ {
11371       /*normal exit:*/{
11372         if (__pyx_t_5) {
11373           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
11374           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11375           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 495, __pyx_L1_error)
11376           __Pyx_GOTREF(__pyx_t_8);
11377           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11378         }
11379         goto __pyx_L6;
11380       }
11381       __pyx_L4_return: {
11382         __pyx_t_8 = __pyx_r;
11383         __pyx_r = 0;
11384         if (__pyx_t_5) {
11385           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
11386           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11387           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 495, __pyx_L1_error)
11388           __Pyx_GOTREF(__pyx_t_7);
11389           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11390         }
11391         __pyx_r = __pyx_t_8;
11392         __pyx_t_8 = 0;
11393         goto __pyx_L0;
11394       }
11395       __pyx_L6:;
11396     }
11397     goto __pyx_L21;
11398     __pyx_L3_error:;
11399     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11400     goto __pyx_L1_error;
11401     __pyx_L21:;
11402   }
11403 
11404   /* "ddtrace/internal/_encoding.pyx":494
11405  *
11406  * cdef class MsgpackEncoderV03(MsgpackEncoderBase):
11407  *     cpdef flush(self):             # <<<<<<<<<<<<<<
11408  *         with self._lock:
11409  *             try:
11410  */
11411 
11412   /* function exit code */
11413   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11414   goto __pyx_L0;
11415   __pyx_L1_error:;
11416   __Pyx_XDECREF(__pyx_t_1);
11417   __Pyx_XDECREF(__pyx_t_2);
11418   __Pyx_XDECREF(__pyx_t_3);
11419   __Pyx_XDECREF(__pyx_t_4);
11420   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
11421   __pyx_r = 0;
11422   __pyx_L0:;
11423   __Pyx_XGIVEREF(__pyx_r);
11424   __Pyx_RefNannyFinishContext();
11425   return __pyx_r;
11426 }
11427 
11428 /* Python wrapper */
11429 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11430 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11431   PyObject *__pyx_r = 0;
11432   __Pyx_RefNannyDeclarations
11433   __Pyx_RefNannySetupContext("flush (wrapper)", 0);
11434   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self));
11435 
11436   /* function exit code */
11437   __Pyx_RefNannyFinishContext();
11438   return __pyx_r;
11439 }
11440 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self)11441 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self) {
11442   PyObject *__pyx_r = NULL;
11443   __Pyx_RefNannyDeclarations
11444   PyObject *__pyx_t_1 = NULL;
11445   int __pyx_lineno = 0;
11446   const char *__pyx_filename = NULL;
11447   int __pyx_clineno = 0;
11448   __Pyx_RefNannySetupContext("flush", 0);
11449   __Pyx_XDECREF(__pyx_r);
11450   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
11451   __Pyx_GOTREF(__pyx_t_1);
11452   __pyx_r = __pyx_t_1;
11453   __pyx_t_1 = 0;
11454   goto __pyx_L0;
11455 
11456   /* function exit code */
11457   __pyx_L1_error:;
11458   __Pyx_XDECREF(__pyx_t_1);
11459   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
11460   __pyx_r = NULL;
11461   __pyx_L0:;
11462   __Pyx_XGIVEREF(__pyx_r);
11463   __Pyx_RefNannyFinishContext();
11464   return __pyx_r;
11465 }
11466 
11467 /* "ddtrace/internal/_encoding.pyx":501
11468  *                 self._reset_buffer()
11469  *
11470  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
11471  *         return string_to_buff(dd_origin)
11472  *
11473  */
11474 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,PyObject * __pyx_v_dd_origin)11475 static void *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_get_dd_origin_ref(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_dd_origin) {
11476   void *__pyx_r;
11477   __Pyx_RefNannyDeclarations
11478   __Pyx_RefNannySetupContext("get_dd_origin_ref", 0);
11479 
11480   /* "ddtrace/internal/_encoding.pyx":502
11481  *
11482  *     cdef void * get_dd_origin_ref(self, str dd_origin):
11483  *         return string_to_buff(dd_origin)             # <<<<<<<<<<<<<<
11484  *
11485  *     cdef inline int _pack_meta(self, object meta, char *dd_origin) except? -1:
11486  */
11487   __pyx_r = __pyx_f_7ddtrace_8internal_9_encoding_string_to_buff(__pyx_v_dd_origin);
11488   goto __pyx_L0;
11489 
11490   /* "ddtrace/internal/_encoding.pyx":501
11491  *                 self._reset_buffer()
11492  *
11493  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
11494  *         return string_to_buff(dd_origin)
11495  *
11496  */
11497 
11498   /* function exit code */
11499   __pyx_L0:;
11500   __Pyx_RefNannyFinishContext();
11501   return __pyx_r;
11502 }
11503 
11504 /* "ddtrace/internal/_encoding.pyx":504
11505  *         return string_to_buff(dd_origin)
11506  *
11507  *     cdef inline int _pack_meta(self, object meta, char *dd_origin) except? -1:             # <<<<<<<<<<<<<<
11508  *         cdef Py_ssize_t L
11509  *         cdef int ret
11510  */
11511 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,PyObject * __pyx_v_meta,char * __pyx_v_dd_origin)11512 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_meta, char *__pyx_v_dd_origin) {
11513   Py_ssize_t __pyx_v_L;
11514   int __pyx_v_ret;
11515   PyObject *__pyx_v_d = 0;
11516   PyObject *__pyx_v_k = NULL;
11517   PyObject *__pyx_v_v = NULL;
11518   int __pyx_r;
11519   __Pyx_RefNannyDeclarations
11520   int __pyx_t_1;
11521   PyObject *__pyx_t_2 = NULL;
11522   Py_ssize_t __pyx_t_3;
11523   PyObject *__pyx_t_4 = NULL;
11524   PyObject *(*__pyx_t_5)(PyObject *);
11525   PyObject *__pyx_t_6 = NULL;
11526   PyObject *__pyx_t_7 = NULL;
11527   PyObject *__pyx_t_8 = NULL;
11528   PyObject *(*__pyx_t_9)(PyObject *);
11529   int __pyx_t_10;
11530   int __pyx_lineno = 0;
11531   const char *__pyx_filename = NULL;
11532   int __pyx_clineno = 0;
11533   __Pyx_RefNannySetupContext("_pack_meta", 0);
11534 
11535   /* "ddtrace/internal/_encoding.pyx":509
11536  *         cdef dict d
11537  *
11538  *         if PyDict_CheckExact(meta):             # <<<<<<<<<<<<<<
11539  *             d = <dict> meta
11540  *             L = len(d)
11541  */
11542   __pyx_t_1 = (PyDict_CheckExact(__pyx_v_meta) != 0);
11543   if (__pyx_t_1) {
11544 
11545     /* "ddtrace/internal/_encoding.pyx":510
11546  *
11547  *         if PyDict_CheckExact(meta):
11548  *             d = <dict> meta             # <<<<<<<<<<<<<<
11549  *             L = len(d)
11550  *             if dd_origin is not NULL:
11551  */
11552     __pyx_t_2 = __pyx_v_meta;
11553     __Pyx_INCREF(__pyx_t_2);
11554     __pyx_v_d = ((PyObject*)__pyx_t_2);
11555     __pyx_t_2 = 0;
11556 
11557     /* "ddtrace/internal/_encoding.pyx":511
11558  *         if PyDict_CheckExact(meta):
11559  *             d = <dict> meta
11560  *             L = len(d)             # <<<<<<<<<<<<<<
11561  *             if dd_origin is not NULL:
11562  *                 L += 1
11563  */
11564     if (unlikely(__pyx_v_d == Py_None)) {
11565       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
11566       __PYX_ERR(0, 511, __pyx_L1_error)
11567     }
11568     __pyx_t_3 = PyDict_Size(__pyx_v_d); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 511, __pyx_L1_error)
11569     __pyx_v_L = __pyx_t_3;
11570 
11571     /* "ddtrace/internal/_encoding.pyx":512
11572  *             d = <dict> meta
11573  *             L = len(d)
11574  *             if dd_origin is not NULL:             # <<<<<<<<<<<<<<
11575  *                 L += 1
11576  *             if L > ITEM_LIMIT:
11577  */
11578     __pyx_t_1 = ((__pyx_v_dd_origin != NULL) != 0);
11579     if (__pyx_t_1) {
11580 
11581       /* "ddtrace/internal/_encoding.pyx":513
11582  *             L = len(d)
11583  *             if dd_origin is not NULL:
11584  *                 L += 1             # <<<<<<<<<<<<<<
11585  *             if L > ITEM_LIMIT:
11586  *                 raise ValueError("dict is too large")
11587  */
11588       __pyx_v_L = (__pyx_v_L + 1);
11589 
11590       /* "ddtrace/internal/_encoding.pyx":512
11591  *             d = <dict> meta
11592  *             L = len(d)
11593  *             if dd_origin is not NULL:             # <<<<<<<<<<<<<<
11594  *                 L += 1
11595  *             if L > ITEM_LIMIT:
11596  */
11597     }
11598 
11599     /* "ddtrace/internal/_encoding.pyx":514
11600  *             if dd_origin is not NULL:
11601  *                 L += 1
11602  *             if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
11603  *                 raise ValueError("dict is too large")
11604  *
11605  */
11606     __pyx_t_1 = ((__pyx_v_L > __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT) != 0);
11607     if (unlikely(__pyx_t_1)) {
11608 
11609       /* "ddtrace/internal/_encoding.pyx":515
11610  *                 L += 1
11611  *             if L > ITEM_LIMIT:
11612  *                 raise ValueError("dict is too large")             # <<<<<<<<<<<<<<
11613  *
11614  *             ret = msgpack_pack_map(&self.pk, L)
11615  */
11616       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
11617       __Pyx_GOTREF(__pyx_t_2);
11618       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11619       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11620       __PYX_ERR(0, 515, __pyx_L1_error)
11621 
11622       /* "ddtrace/internal/_encoding.pyx":514
11623  *             if dd_origin is not NULL:
11624  *                 L += 1
11625  *             if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
11626  *                 raise ValueError("dict is too large")
11627  *
11628  */
11629     }
11630 
11631     /* "ddtrace/internal/_encoding.pyx":517
11632  *                 raise ValueError("dict is too large")
11633  *
11634  *             ret = msgpack_pack_map(&self.pk, L)             # <<<<<<<<<<<<<<
11635  *             if ret == 0:
11636  *                 for k, v in d.items():
11637  */
11638     __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->__pyx_base.pk), __pyx_v_L);
11639 
11640     /* "ddtrace/internal/_encoding.pyx":518
11641  *
11642  *             ret = msgpack_pack_map(&self.pk, L)
11643  *             if ret == 0:             # <<<<<<<<<<<<<<
11644  *                 for k, v in d.items():
11645  *                     ret = pack_text(&self.pk, k)
11646  */
11647     __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
11648     if (__pyx_t_1) {
11649 
11650       /* "ddtrace/internal/_encoding.pyx":519
11651  *             ret = msgpack_pack_map(&self.pk, L)
11652  *             if ret == 0:
11653  *                 for k, v in d.items():             # <<<<<<<<<<<<<<
11654  *                     ret = pack_text(&self.pk, k)
11655  *                     if ret != 0: break
11656  */
11657       if (unlikely(__pyx_v_d == Py_None)) {
11658         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
11659         __PYX_ERR(0, 519, __pyx_L1_error)
11660       }
11661       __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
11662       __Pyx_GOTREF(__pyx_t_2);
11663       if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
11664         __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0;
11665         __pyx_t_5 = NULL;
11666       } else {
11667         __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 519, __pyx_L1_error)
11668         __Pyx_GOTREF(__pyx_t_4);
11669         __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error)
11670       }
11671       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11672       for (;;) {
11673         if (likely(!__pyx_t_5)) {
11674           if (likely(PyList_CheckExact(__pyx_t_4))) {
11675             if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
11676             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11677             __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 519, __pyx_L1_error)
11678             #else
11679             __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
11680             __Pyx_GOTREF(__pyx_t_2);
11681             #endif
11682           } else {
11683             if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
11684             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11685             __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 519, __pyx_L1_error)
11686             #else
11687             __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
11688             __Pyx_GOTREF(__pyx_t_2);
11689             #endif
11690           }
11691         } else {
11692           __pyx_t_2 = __pyx_t_5(__pyx_t_4);
11693           if (unlikely(!__pyx_t_2)) {
11694             PyObject* exc_type = PyErr_Occurred();
11695             if (exc_type) {
11696               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11697               else __PYX_ERR(0, 519, __pyx_L1_error)
11698             }
11699             break;
11700           }
11701           __Pyx_GOTREF(__pyx_t_2);
11702         }
11703         if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
11704           PyObject* sequence = __pyx_t_2;
11705           Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11706           if (unlikely(size != 2)) {
11707             if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11708             else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11709             __PYX_ERR(0, 519, __pyx_L1_error)
11710           }
11711           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11712           if (likely(PyTuple_CheckExact(sequence))) {
11713             __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
11714             __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
11715           } else {
11716             __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
11717             __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
11718           }
11719           __Pyx_INCREF(__pyx_t_6);
11720           __Pyx_INCREF(__pyx_t_7);
11721           #else
11722           __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 519, __pyx_L1_error)
11723           __Pyx_GOTREF(__pyx_t_6);
11724           __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 519, __pyx_L1_error)
11725           __Pyx_GOTREF(__pyx_t_7);
11726           #endif
11727           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11728         } else {
11729           Py_ssize_t index = -1;
11730           __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 519, __pyx_L1_error)
11731           __Pyx_GOTREF(__pyx_t_8);
11732           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11733           __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
11734           index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
11735           __Pyx_GOTREF(__pyx_t_6);
11736           index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
11737           __Pyx_GOTREF(__pyx_t_7);
11738           if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 519, __pyx_L1_error)
11739           __pyx_t_9 = NULL;
11740           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11741           goto __pyx_L10_unpacking_done;
11742           __pyx_L9_unpacking_failed:;
11743           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11744           __pyx_t_9 = NULL;
11745           if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
11746           __PYX_ERR(0, 519, __pyx_L1_error)
11747           __pyx_L10_unpacking_done:;
11748         }
11749         __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
11750         __pyx_t_6 = 0;
11751         __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
11752         __pyx_t_7 = 0;
11753 
11754         /* "ddtrace/internal/_encoding.pyx":520
11755  *             if ret == 0:
11756  *                 for k, v in d.items():
11757  *                     ret = pack_text(&self.pk, k)             # <<<<<<<<<<<<<<
11758  *                     if ret != 0: break
11759  *                     ret = pack_text(&self.pk, v)
11760  */
11761         __pyx_t_10 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_v_k); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L1_error)
11762         __pyx_v_ret = __pyx_t_10;
11763 
11764         /* "ddtrace/internal/_encoding.pyx":521
11765  *                 for k, v in d.items():
11766  *                     ret = pack_text(&self.pk, k)
11767  *                     if ret != 0: break             # <<<<<<<<<<<<<<
11768  *                     ret = pack_text(&self.pk, v)
11769  *                     if ret != 0: break
11770  */
11771         __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
11772         if (__pyx_t_1) {
11773           goto __pyx_L8_break;
11774         }
11775 
11776         /* "ddtrace/internal/_encoding.pyx":522
11777  *                     ret = pack_text(&self.pk, k)
11778  *                     if ret != 0: break
11779  *                     ret = pack_text(&self.pk, v)             # <<<<<<<<<<<<<<
11780  *                     if ret != 0: break
11781  *                 if dd_origin is not NULL:
11782  */
11783         __pyx_t_10 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_v_v); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L1_error)
11784         __pyx_v_ret = __pyx_t_10;
11785 
11786         /* "ddtrace/internal/_encoding.pyx":523
11787  *                     if ret != 0: break
11788  *                     ret = pack_text(&self.pk, v)
11789  *                     if ret != 0: break             # <<<<<<<<<<<<<<
11790  *                 if dd_origin is not NULL:
11791  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11792  */
11793         __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
11794         if (__pyx_t_1) {
11795           goto __pyx_L8_break;
11796         }
11797 
11798         /* "ddtrace/internal/_encoding.pyx":519
11799  *             ret = msgpack_pack_map(&self.pk, L)
11800  *             if ret == 0:
11801  *                 for k, v in d.items():             # <<<<<<<<<<<<<<
11802  *                     ret = pack_text(&self.pk, k)
11803  *                     if ret != 0: break
11804  */
11805       }
11806       __pyx_L8_break:;
11807       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11808 
11809       /* "ddtrace/internal/_encoding.pyx":524
11810  *                     ret = pack_text(&self.pk, v)
11811  *                     if ret != 0: break
11812  *                 if dd_origin is not NULL:             # <<<<<<<<<<<<<<
11813  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11814  *                     if ret == 0:
11815  */
11816       __pyx_t_1 = ((__pyx_v_dd_origin != NULL) != 0);
11817       if (__pyx_t_1) {
11818 
11819         /* "ddtrace/internal/_encoding.pyx":525
11820  *                     if ret != 0: break
11821  *                 if dd_origin is not NULL:
11822  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)             # <<<<<<<<<<<<<<
11823  *                     if ret == 0:
11824  *                         ret = pack_bytes(&self.pk, dd_origin, strlen(dd_origin))
11825  */
11826         __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), __pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY, __pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY_LEN);
11827 
11828         /* "ddtrace/internal/_encoding.pyx":526
11829  *                 if dd_origin is not NULL:
11830  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11831  *                     if ret == 0:             # <<<<<<<<<<<<<<
11832  *                         ret = pack_bytes(&self.pk, dd_origin, strlen(dd_origin))
11833  *             return ret
11834  */
11835         __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
11836         if (__pyx_t_1) {
11837 
11838           /* "ddtrace/internal/_encoding.pyx":527
11839  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11840  *                     if ret == 0:
11841  *                         ret = pack_bytes(&self.pk, dd_origin, strlen(dd_origin))             # <<<<<<<<<<<<<<
11842  *             return ret
11843  *
11844  */
11845           __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), __pyx_v_dd_origin, strlen(__pyx_v_dd_origin));
11846 
11847           /* "ddtrace/internal/_encoding.pyx":526
11848  *                 if dd_origin is not NULL:
11849  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11850  *                     if ret == 0:             # <<<<<<<<<<<<<<
11851  *                         ret = pack_bytes(&self.pk, dd_origin, strlen(dd_origin))
11852  *             return ret
11853  */
11854         }
11855 
11856         /* "ddtrace/internal/_encoding.pyx":524
11857  *                     ret = pack_text(&self.pk, v)
11858  *                     if ret != 0: break
11859  *                 if dd_origin is not NULL:             # <<<<<<<<<<<<<<
11860  *                     ret = pack_bytes(&self.pk, _ORIGIN_KEY, _ORIGIN_KEY_LEN)
11861  *                     if ret == 0:
11862  */
11863       }
11864 
11865       /* "ddtrace/internal/_encoding.pyx":518
11866  *
11867  *             ret = msgpack_pack_map(&self.pk, L)
11868  *             if ret == 0:             # <<<<<<<<<<<<<<
11869  *                 for k, v in d.items():
11870  *                     ret = pack_text(&self.pk, k)
11871  */
11872     }
11873 
11874     /* "ddtrace/internal/_encoding.pyx":528
11875  *                     if ret == 0:
11876  *                         ret = pack_bytes(&self.pk, dd_origin, strlen(dd_origin))
11877  *             return ret             # <<<<<<<<<<<<<<
11878  *
11879  *         raise TypeError("Unhandled meta type: %r" % type(meta))
11880  */
11881     __pyx_r = __pyx_v_ret;
11882     goto __pyx_L0;
11883 
11884     /* "ddtrace/internal/_encoding.pyx":509
11885  *         cdef dict d
11886  *
11887  *         if PyDict_CheckExact(meta):             # <<<<<<<<<<<<<<
11888  *             d = <dict> meta
11889  *             L = len(d)
11890  */
11891   }
11892 
11893   /* "ddtrace/internal/_encoding.pyx":530
11894  *             return ret
11895  *
11896  *         raise TypeError("Unhandled meta type: %r" % type(meta))             # <<<<<<<<<<<<<<
11897  *
11898  *     cdef inline int _pack_metrics(self, object metrics) except? -1:
11899  */
11900   __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_meta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
11901   __Pyx_GOTREF(__pyx_t_4);
11902   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unhandled_meta_type_r, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
11903   __Pyx_GOTREF(__pyx_t_2);
11904   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11905   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
11906   __Pyx_GOTREF(__pyx_t_4);
11907   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11908   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
11909   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11910   __PYX_ERR(0, 530, __pyx_L1_error)
11911 
11912   /* "ddtrace/internal/_encoding.pyx":504
11913  *         return string_to_buff(dd_origin)
11914  *
11915  *     cdef inline int _pack_meta(self, object meta, char *dd_origin) except? -1:             # <<<<<<<<<<<<<<
11916  *         cdef Py_ssize_t L
11917  *         cdef int ret
11918  */
11919 
11920   /* function exit code */
11921   __pyx_L1_error:;
11922   __Pyx_XDECREF(__pyx_t_2);
11923   __Pyx_XDECREF(__pyx_t_4);
11924   __Pyx_XDECREF(__pyx_t_6);
11925   __Pyx_XDECREF(__pyx_t_7);
11926   __Pyx_XDECREF(__pyx_t_8);
11927   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03._pack_meta", __pyx_clineno, __pyx_lineno, __pyx_filename);
11928   __pyx_r = -1;
11929   __pyx_L0:;
11930   __Pyx_XDECREF(__pyx_v_d);
11931   __Pyx_XDECREF(__pyx_v_k);
11932   __Pyx_XDECREF(__pyx_v_v);
11933   __Pyx_RefNannyFinishContext();
11934   return __pyx_r;
11935 }
11936 
11937 /* "ddtrace/internal/_encoding.pyx":532
11938  *         raise TypeError("Unhandled meta type: %r" % type(meta))
11939  *
11940  *     cdef inline int _pack_metrics(self, object metrics) except? -1:             # <<<<<<<<<<<<<<
11941  *         cdef Py_ssize_t L
11942  *         cdef int ret
11943  */
11944 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,PyObject * __pyx_v_metrics)11945 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_metrics) {
11946   Py_ssize_t __pyx_v_L;
11947   int __pyx_v_ret;
11948   PyObject *__pyx_v_d = 0;
11949   PyObject *__pyx_v_k = NULL;
11950   PyObject *__pyx_v_v = NULL;
11951   int __pyx_r;
11952   __Pyx_RefNannyDeclarations
11953   int __pyx_t_1;
11954   PyObject *__pyx_t_2 = NULL;
11955   Py_ssize_t __pyx_t_3;
11956   PyObject *__pyx_t_4 = NULL;
11957   PyObject *(*__pyx_t_5)(PyObject *);
11958   PyObject *__pyx_t_6 = NULL;
11959   PyObject *__pyx_t_7 = NULL;
11960   PyObject *__pyx_t_8 = NULL;
11961   PyObject *(*__pyx_t_9)(PyObject *);
11962   int __pyx_t_10;
11963   int __pyx_lineno = 0;
11964   const char *__pyx_filename = NULL;
11965   int __pyx_clineno = 0;
11966   __Pyx_RefNannySetupContext("_pack_metrics", 0);
11967 
11968   /* "ddtrace/internal/_encoding.pyx":537
11969  *         cdef dict d
11970  *
11971  *         if PyDict_CheckExact(metrics):             # <<<<<<<<<<<<<<
11972  *             d = <dict> metrics
11973  *             L = len(d)
11974  */
11975   __pyx_t_1 = (PyDict_CheckExact(__pyx_v_metrics) != 0);
11976   if (__pyx_t_1) {
11977 
11978     /* "ddtrace/internal/_encoding.pyx":538
11979  *
11980  *         if PyDict_CheckExact(metrics):
11981  *             d = <dict> metrics             # <<<<<<<<<<<<<<
11982  *             L = len(d)
11983  *             if L > ITEM_LIMIT:
11984  */
11985     __pyx_t_2 = __pyx_v_metrics;
11986     __Pyx_INCREF(__pyx_t_2);
11987     __pyx_v_d = ((PyObject*)__pyx_t_2);
11988     __pyx_t_2 = 0;
11989 
11990     /* "ddtrace/internal/_encoding.pyx":539
11991  *         if PyDict_CheckExact(metrics):
11992  *             d = <dict> metrics
11993  *             L = len(d)             # <<<<<<<<<<<<<<
11994  *             if L > ITEM_LIMIT:
11995  *                 raise ValueError("dict is too large")
11996  */
11997     if (unlikely(__pyx_v_d == Py_None)) {
11998       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
11999       __PYX_ERR(0, 539, __pyx_L1_error)
12000     }
12001     __pyx_t_3 = PyDict_Size(__pyx_v_d); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 539, __pyx_L1_error)
12002     __pyx_v_L = __pyx_t_3;
12003 
12004     /* "ddtrace/internal/_encoding.pyx":540
12005  *             d = <dict> metrics
12006  *             L = len(d)
12007  *             if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
12008  *                 raise ValueError("dict is too large")
12009  *
12010  */
12011     __pyx_t_1 = ((__pyx_v_L > __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT) != 0);
12012     if (unlikely(__pyx_t_1)) {
12013 
12014       /* "ddtrace/internal/_encoding.pyx":541
12015  *             L = len(d)
12016  *             if L > ITEM_LIMIT:
12017  *                 raise ValueError("dict is too large")             # <<<<<<<<<<<<<<
12018  *
12019  *             ret = msgpack_pack_map(&self.pk, L)
12020  */
12021       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error)
12022       __Pyx_GOTREF(__pyx_t_2);
12023       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12024       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12025       __PYX_ERR(0, 541, __pyx_L1_error)
12026 
12027       /* "ddtrace/internal/_encoding.pyx":540
12028  *             d = <dict> metrics
12029  *             L = len(d)
12030  *             if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
12031  *                 raise ValueError("dict is too large")
12032  *
12033  */
12034     }
12035 
12036     /* "ddtrace/internal/_encoding.pyx":543
12037  *                 raise ValueError("dict is too large")
12038  *
12039  *             ret = msgpack_pack_map(&self.pk, L)             # <<<<<<<<<<<<<<
12040  *             if ret == 0:
12041  *                 for k, v in d.items():
12042  */
12043     __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->__pyx_base.pk), __pyx_v_L);
12044 
12045     /* "ddtrace/internal/_encoding.pyx":544
12046  *
12047  *             ret = msgpack_pack_map(&self.pk, L)
12048  *             if ret == 0:             # <<<<<<<<<<<<<<
12049  *                 for k, v in d.items():
12050  *                     ret = pack_text(&self.pk, k)
12051  */
12052     __pyx_t_1 = ((__pyx_v_ret == 0) != 0);
12053     if (__pyx_t_1) {
12054 
12055       /* "ddtrace/internal/_encoding.pyx":545
12056  *             ret = msgpack_pack_map(&self.pk, L)
12057  *             if ret == 0:
12058  *                 for k, v in d.items():             # <<<<<<<<<<<<<<
12059  *                     ret = pack_text(&self.pk, k)
12060  *                     if ret != 0: break
12061  */
12062       if (unlikely(__pyx_v_d == Py_None)) {
12063         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
12064         __PYX_ERR(0, 545, __pyx_L1_error)
12065       }
12066       __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
12067       __Pyx_GOTREF(__pyx_t_2);
12068       if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
12069         __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0;
12070         __pyx_t_5 = NULL;
12071       } else {
12072         __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error)
12073         __Pyx_GOTREF(__pyx_t_4);
12074         __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error)
12075       }
12076       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12077       for (;;) {
12078         if (likely(!__pyx_t_5)) {
12079           if (likely(PyList_CheckExact(__pyx_t_4))) {
12080             if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
12081             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12082             __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
12083             #else
12084             __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
12085             __Pyx_GOTREF(__pyx_t_2);
12086             #endif
12087           } else {
12088             if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
12089             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12090             __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
12091             #else
12092             __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
12093             __Pyx_GOTREF(__pyx_t_2);
12094             #endif
12095           }
12096         } else {
12097           __pyx_t_2 = __pyx_t_5(__pyx_t_4);
12098           if (unlikely(!__pyx_t_2)) {
12099             PyObject* exc_type = PyErr_Occurred();
12100             if (exc_type) {
12101               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12102               else __PYX_ERR(0, 545, __pyx_L1_error)
12103             }
12104             break;
12105           }
12106           __Pyx_GOTREF(__pyx_t_2);
12107         }
12108         if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
12109           PyObject* sequence = __pyx_t_2;
12110           Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
12111           if (unlikely(size != 2)) {
12112             if (size > 2) __Pyx_RaiseTooManyValuesError(2);
12113             else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
12114             __PYX_ERR(0, 545, __pyx_L1_error)
12115           }
12116           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12117           if (likely(PyTuple_CheckExact(sequence))) {
12118             __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
12119             __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
12120           } else {
12121             __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
12122             __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
12123           }
12124           __Pyx_INCREF(__pyx_t_6);
12125           __Pyx_INCREF(__pyx_t_7);
12126           #else
12127           __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error)
12128           __Pyx_GOTREF(__pyx_t_6);
12129           __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
12130           __Pyx_GOTREF(__pyx_t_7);
12131           #endif
12132           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12133         } else {
12134           Py_ssize_t index = -1;
12135           __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 545, __pyx_L1_error)
12136           __Pyx_GOTREF(__pyx_t_8);
12137           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12138           __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
12139           index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
12140           __Pyx_GOTREF(__pyx_t_6);
12141           index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
12142           __Pyx_GOTREF(__pyx_t_7);
12143           if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 545, __pyx_L1_error)
12144           __pyx_t_9 = NULL;
12145           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12146           goto __pyx_L9_unpacking_done;
12147           __pyx_L8_unpacking_failed:;
12148           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12149           __pyx_t_9 = NULL;
12150           if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
12151           __PYX_ERR(0, 545, __pyx_L1_error)
12152           __pyx_L9_unpacking_done:;
12153         }
12154         __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
12155         __pyx_t_6 = 0;
12156         __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
12157         __pyx_t_7 = 0;
12158 
12159         /* "ddtrace/internal/_encoding.pyx":546
12160  *             if ret == 0:
12161  *                 for k, v in d.items():
12162  *                     ret = pack_text(&self.pk, k)             # <<<<<<<<<<<<<<
12163  *                     if ret != 0: break
12164  *                     ret = pack_number(&self.pk, v)
12165  */
12166         __pyx_t_10 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_v_k); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L1_error)
12167         __pyx_v_ret = __pyx_t_10;
12168 
12169         /* "ddtrace/internal/_encoding.pyx":547
12170  *                 for k, v in d.items():
12171  *                     ret = pack_text(&self.pk, k)
12172  *                     if ret != 0: break             # <<<<<<<<<<<<<<
12173  *                     ret = pack_number(&self.pk, v)
12174  *                     if ret != 0: break
12175  */
12176         __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
12177         if (__pyx_t_1) {
12178           goto __pyx_L7_break;
12179         }
12180 
12181         /* "ddtrace/internal/_encoding.pyx":548
12182  *                     ret = pack_text(&self.pk, k)
12183  *                     if ret != 0: break
12184  *                     ret = pack_number(&self.pk, v)             # <<<<<<<<<<<<<<
12185  *                     if ret != 0: break
12186  *             return ret
12187  */
12188         __pyx_t_10 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_v_v); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 548, __pyx_L1_error)
12189         __pyx_v_ret = __pyx_t_10;
12190 
12191         /* "ddtrace/internal/_encoding.pyx":549
12192  *                     if ret != 0: break
12193  *                     ret = pack_number(&self.pk, v)
12194  *                     if ret != 0: break             # <<<<<<<<<<<<<<
12195  *             return ret
12196  *
12197  */
12198         __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
12199         if (__pyx_t_1) {
12200           goto __pyx_L7_break;
12201         }
12202 
12203         /* "ddtrace/internal/_encoding.pyx":545
12204  *             ret = msgpack_pack_map(&self.pk, L)
12205  *             if ret == 0:
12206  *                 for k, v in d.items():             # <<<<<<<<<<<<<<
12207  *                     ret = pack_text(&self.pk, k)
12208  *                     if ret != 0: break
12209  */
12210       }
12211       __pyx_L7_break:;
12212       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12213 
12214       /* "ddtrace/internal/_encoding.pyx":544
12215  *
12216  *             ret = msgpack_pack_map(&self.pk, L)
12217  *             if ret == 0:             # <<<<<<<<<<<<<<
12218  *                 for k, v in d.items():
12219  *                     ret = pack_text(&self.pk, k)
12220  */
12221     }
12222 
12223     /* "ddtrace/internal/_encoding.pyx":550
12224  *                     ret = pack_number(&self.pk, v)
12225  *                     if ret != 0: break
12226  *             return ret             # <<<<<<<<<<<<<<
12227  *
12228  *         raise TypeError("Unhandled metrics type: %r" % type(metrics))
12229  */
12230     __pyx_r = __pyx_v_ret;
12231     goto __pyx_L0;
12232 
12233     /* "ddtrace/internal/_encoding.pyx":537
12234  *         cdef dict d
12235  *
12236  *         if PyDict_CheckExact(metrics):             # <<<<<<<<<<<<<<
12237  *             d = <dict> metrics
12238  *             L = len(d)
12239  */
12240   }
12241 
12242   /* "ddtrace/internal/_encoding.pyx":552
12243  *             return ret
12244  *
12245  *         raise TypeError("Unhandled metrics type: %r" % type(metrics))             # <<<<<<<<<<<<<<
12246  *
12247  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:
12248  */
12249   __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_metrics); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error)
12250   __Pyx_GOTREF(__pyx_t_4);
12251   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unhandled_metrics_type_r, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
12252   __Pyx_GOTREF(__pyx_t_2);
12253   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12254   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error)
12255   __Pyx_GOTREF(__pyx_t_4);
12256   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12257   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
12258   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12259   __PYX_ERR(0, 552, __pyx_L1_error)
12260 
12261   /* "ddtrace/internal/_encoding.pyx":532
12262  *         raise TypeError("Unhandled meta type: %r" % type(meta))
12263  *
12264  *     cdef inline int _pack_metrics(self, object metrics) except? -1:             # <<<<<<<<<<<<<<
12265  *         cdef Py_ssize_t L
12266  *         cdef int ret
12267  */
12268 
12269   /* function exit code */
12270   __pyx_L1_error:;
12271   __Pyx_XDECREF(__pyx_t_2);
12272   __Pyx_XDECREF(__pyx_t_4);
12273   __Pyx_XDECREF(__pyx_t_6);
12274   __Pyx_XDECREF(__pyx_t_7);
12275   __Pyx_XDECREF(__pyx_t_8);
12276   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03._pack_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
12277   __pyx_r = -1;
12278   __pyx_L0:;
12279   __Pyx_XDECREF(__pyx_v_d);
12280   __Pyx_XDECREF(__pyx_v_k);
12281   __Pyx_XDECREF(__pyx_v_v);
12282   __Pyx_RefNannyFinishContext();
12283   return __pyx_r;
12284 }
12285 
12286 /* "ddtrace/internal/_encoding.pyx":554
12287  *         raise TypeError("Unhandled metrics type: %r" % type(metrics))
12288  *
12289  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
12290  *         cdef int ret
12291  *         cdef Py_ssize_t L
12292  */
12293 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,PyObject * __pyx_v_span,void * __pyx_v_dd_origin)12294 static int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, PyObject *__pyx_v_span, void *__pyx_v_dd_origin) {
12295   int __pyx_v_ret;
12296   Py_ssize_t __pyx_v_L;
12297   int __pyx_v_has_span_type;
12298   int __pyx_v_has_meta;
12299   int __pyx_v_has_metrics;
12300   int __pyx_v_has_error;
12301   int __pyx_r;
12302   __Pyx_RefNannyDeclarations
12303   PyObject *__pyx_t_1 = NULL;
12304   PyObject *__pyx_t_2 = NULL;
12305   int __pyx_t_3;
12306   int __pyx_t_4;
12307   Py_ssize_t __pyx_t_5;
12308   int __pyx_lineno = 0;
12309   const char *__pyx_filename = NULL;
12310   int __pyx_clineno = 0;
12311   __Pyx_RefNannySetupContext("pack_span", 0);
12312 
12313   /* "ddtrace/internal/_encoding.pyx":561
12314  *         cdef int has_metrics
12315  *
12316  *         has_error = <bint> (span.error != 0)             # <<<<<<<<<<<<<<
12317  *         has_span_type = <bint> (span.span_type is not None)
12318  *         has_meta = <bint> (len(span.meta) > 0 or dd_origin is not NULL)
12319  */
12320   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
12321   __Pyx_GOTREF(__pyx_t_1);
12322   __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error)
12323   __Pyx_GOTREF(__pyx_t_2);
12324   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12325   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 561, __pyx_L1_error)
12326   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12327   __pyx_v_has_error = __pyx_t_3;
12328 
12329   /* "ddtrace/internal/_encoding.pyx":562
12330  *
12331  *         has_error = <bint> (span.error != 0)
12332  *         has_span_type = <bint> (span.span_type is not None)             # <<<<<<<<<<<<<<
12333  *         has_meta = <bint> (len(span.meta) > 0 or dd_origin is not NULL)
12334  *         has_metrics = <bint> (len(span.metrics) > 0)
12335  */
12336   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_span_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
12337   __Pyx_GOTREF(__pyx_t_2);
12338   __pyx_t_3 = (__pyx_t_2 != Py_None);
12339   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12340   __pyx_v_has_span_type = (__pyx_t_3 != 0);
12341 
12342   /* "ddtrace/internal/_encoding.pyx":563
12343  *         has_error = <bint> (span.error != 0)
12344  *         has_span_type = <bint> (span.span_type is not None)
12345  *         has_meta = <bint> (len(span.meta) > 0 or dd_origin is not NULL)             # <<<<<<<<<<<<<<
12346  *         has_metrics = <bint> (len(span.metrics) > 0)
12347  *
12348  */
12349   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_meta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
12350   __Pyx_GOTREF(__pyx_t_2);
12351   __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 563, __pyx_L1_error)
12352   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12353   __pyx_t_3 = ((__pyx_t_5 > 0) != 0);
12354   if (!__pyx_t_3) {
12355   } else {
12356     __pyx_t_4 = __pyx_t_3;
12357     goto __pyx_L3_bool_binop_done;
12358   }
12359   __pyx_t_3 = ((__pyx_v_dd_origin != NULL) != 0);
12360   __pyx_t_4 = __pyx_t_3;
12361   __pyx_L3_bool_binop_done:;
12362   __pyx_v_has_meta = __pyx_t_4;
12363 
12364   /* "ddtrace/internal/_encoding.pyx":564
12365  *         has_span_type = <bint> (span.span_type is not None)
12366  *         has_meta = <bint> (len(span.meta) > 0 or dd_origin is not NULL)
12367  *         has_metrics = <bint> (len(span.metrics) > 0)             # <<<<<<<<<<<<<<
12368  *
12369  *         L = 8 + has_span_type + has_meta + has_metrics + has_error
12370  */
12371   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_metrics); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
12372   __Pyx_GOTREF(__pyx_t_2);
12373   __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 564, __pyx_L1_error)
12374   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12375   __pyx_v_has_metrics = ((__pyx_t_5 > 0) != 0);
12376 
12377   /* "ddtrace/internal/_encoding.pyx":566
12378  *         has_metrics = <bint> (len(span.metrics) > 0)
12379  *
12380  *         L = 8 + has_span_type + has_meta + has_metrics + has_error             # <<<<<<<<<<<<<<
12381  *
12382  *         ret = msgpack_pack_map(&self.pk, L)
12383  */
12384   __pyx_v_L = ((((8 + __pyx_v_has_span_type) + __pyx_v_has_meta) + __pyx_v_has_metrics) + __pyx_v_has_error);
12385 
12386   /* "ddtrace/internal/_encoding.pyx":568
12387  *         L = 8 + has_span_type + has_meta + has_metrics + has_error
12388  *
12389  *         ret = msgpack_pack_map(&self.pk, L)             # <<<<<<<<<<<<<<
12390  *
12391  *         if ret == 0:
12392  */
12393   __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->__pyx_base.pk), __pyx_v_L);
12394 
12395   /* "ddtrace/internal/_encoding.pyx":570
12396  *         ret = msgpack_pack_map(&self.pk, L)
12397  *
12398  *         if ret == 0:             # <<<<<<<<<<<<<<
12399  *             ret = pack_bytes(&self.pk, <char *> b"trace_id", 8)
12400  *             if ret != 0: return ret
12401  */
12402   __pyx_t_3 = ((__pyx_v_ret == 0) != 0);
12403   if (__pyx_t_3) {
12404 
12405     /* "ddtrace/internal/_encoding.pyx":571
12406  *
12407  *         if ret == 0:
12408  *             ret = pack_bytes(&self.pk, <char *> b"trace_id", 8)             # <<<<<<<<<<<<<<
12409  *             if ret != 0: return ret
12410  *             ret = pack_number(&self.pk, span.trace_id)
12411  */
12412     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"trace_id")), 8);
12413 
12414     /* "ddtrace/internal/_encoding.pyx":572
12415  *         if ret == 0:
12416  *             ret = pack_bytes(&self.pk, <char *> b"trace_id", 8)
12417  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12418  *             ret = pack_number(&self.pk, span.trace_id)
12419  *             if ret != 0: return ret
12420  */
12421     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12422     if (__pyx_t_3) {
12423       __pyx_r = __pyx_v_ret;
12424       goto __pyx_L0;
12425     }
12426 
12427     /* "ddtrace/internal/_encoding.pyx":573
12428  *             ret = pack_bytes(&self.pk, <char *> b"trace_id", 8)
12429  *             if ret != 0: return ret
12430  *             ret = pack_number(&self.pk, span.trace_id)             # <<<<<<<<<<<<<<
12431  *             if ret != 0: return ret
12432  *
12433  */
12434     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_trace_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error)
12435     __Pyx_GOTREF(__pyx_t_2);
12436     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L1_error)
12437     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12438     __pyx_v_ret = __pyx_t_4;
12439 
12440     /* "ddtrace/internal/_encoding.pyx":574
12441  *             if ret != 0: return ret
12442  *             ret = pack_number(&self.pk, span.trace_id)
12443  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12444  *
12445  *             ret = pack_bytes(&self.pk, <char *> b"parent_id", 9)
12446  */
12447     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12448     if (__pyx_t_3) {
12449       __pyx_r = __pyx_v_ret;
12450       goto __pyx_L0;
12451     }
12452 
12453     /* "ddtrace/internal/_encoding.pyx":576
12454  *             if ret != 0: return ret
12455  *
12456  *             ret = pack_bytes(&self.pk, <char *> b"parent_id", 9)             # <<<<<<<<<<<<<<
12457  *             if ret != 0: return ret
12458  *             ret = pack_number(&self.pk, span.parent_id)
12459  */
12460     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"parent_id")), 9);
12461 
12462     /* "ddtrace/internal/_encoding.pyx":577
12463  *
12464  *             ret = pack_bytes(&self.pk, <char *> b"parent_id", 9)
12465  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12466  *             ret = pack_number(&self.pk, span.parent_id)
12467  *             if ret != 0: return ret
12468  */
12469     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12470     if (__pyx_t_3) {
12471       __pyx_r = __pyx_v_ret;
12472       goto __pyx_L0;
12473     }
12474 
12475     /* "ddtrace/internal/_encoding.pyx":578
12476  *             ret = pack_bytes(&self.pk, <char *> b"parent_id", 9)
12477  *             if ret != 0: return ret
12478  *             ret = pack_number(&self.pk, span.parent_id)             # <<<<<<<<<<<<<<
12479  *             if ret != 0: return ret
12480  *
12481  */
12482     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_parent_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
12483     __Pyx_GOTREF(__pyx_t_2);
12484     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error)
12485     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12486     __pyx_v_ret = __pyx_t_4;
12487 
12488     /* "ddtrace/internal/_encoding.pyx":579
12489  *             if ret != 0: return ret
12490  *             ret = pack_number(&self.pk, span.parent_id)
12491  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12492  *
12493  *             ret = pack_bytes(&self.pk, <char *> b"span_id", 7)
12494  */
12495     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12496     if (__pyx_t_3) {
12497       __pyx_r = __pyx_v_ret;
12498       goto __pyx_L0;
12499     }
12500 
12501     /* "ddtrace/internal/_encoding.pyx":581
12502  *             if ret != 0: return ret
12503  *
12504  *             ret = pack_bytes(&self.pk, <char *> b"span_id", 7)             # <<<<<<<<<<<<<<
12505  *             if ret != 0: return ret
12506  *             ret = pack_number(&self.pk, span.span_id)
12507  */
12508     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"span_id")), 7);
12509 
12510     /* "ddtrace/internal/_encoding.pyx":582
12511  *
12512  *             ret = pack_bytes(&self.pk, <char *> b"span_id", 7)
12513  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12514  *             ret = pack_number(&self.pk, span.span_id)
12515  *             if ret != 0: return ret
12516  */
12517     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12518     if (__pyx_t_3) {
12519       __pyx_r = __pyx_v_ret;
12520       goto __pyx_L0;
12521     }
12522 
12523     /* "ddtrace/internal/_encoding.pyx":583
12524  *             ret = pack_bytes(&self.pk, <char *> b"span_id", 7)
12525  *             if ret != 0: return ret
12526  *             ret = pack_number(&self.pk, span.span_id)             # <<<<<<<<<<<<<<
12527  *             if ret != 0: return ret
12528  *
12529  */
12530     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_span_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error)
12531     __Pyx_GOTREF(__pyx_t_2);
12532     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 583, __pyx_L1_error)
12533     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12534     __pyx_v_ret = __pyx_t_4;
12535 
12536     /* "ddtrace/internal/_encoding.pyx":584
12537  *             if ret != 0: return ret
12538  *             ret = pack_number(&self.pk, span.span_id)
12539  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12540  *
12541  *             ret = pack_bytes(&self.pk, <char *> b"service", 7)
12542  */
12543     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12544     if (__pyx_t_3) {
12545       __pyx_r = __pyx_v_ret;
12546       goto __pyx_L0;
12547     }
12548 
12549     /* "ddtrace/internal/_encoding.pyx":586
12550  *             if ret != 0: return ret
12551  *
12552  *             ret = pack_bytes(&self.pk, <char *> b"service", 7)             # <<<<<<<<<<<<<<
12553  *             if ret != 0: return ret
12554  *             ret = pack_text(&self.pk, span.service)
12555  */
12556     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"service")), 7);
12557 
12558     /* "ddtrace/internal/_encoding.pyx":587
12559  *
12560  *             ret = pack_bytes(&self.pk, <char *> b"service", 7)
12561  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12562  *             ret = pack_text(&self.pk, span.service)
12563  *             if ret != 0: return ret
12564  */
12565     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12566     if (__pyx_t_3) {
12567       __pyx_r = __pyx_v_ret;
12568       goto __pyx_L0;
12569     }
12570 
12571     /* "ddtrace/internal/_encoding.pyx":588
12572  *             ret = pack_bytes(&self.pk, <char *> b"service", 7)
12573  *             if ret != 0: return ret
12574  *             ret = pack_text(&self.pk, span.service)             # <<<<<<<<<<<<<<
12575  *             if ret != 0: return ret
12576  *
12577  */
12578     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_service); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
12579     __Pyx_GOTREF(__pyx_t_2);
12580     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 588, __pyx_L1_error)
12581     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12582     __pyx_v_ret = __pyx_t_4;
12583 
12584     /* "ddtrace/internal/_encoding.pyx":589
12585  *             if ret != 0: return ret
12586  *             ret = pack_text(&self.pk, span.service)
12587  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12588  *
12589  *             ret = pack_bytes(&self.pk, <char *> b"resource", 8)
12590  */
12591     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12592     if (__pyx_t_3) {
12593       __pyx_r = __pyx_v_ret;
12594       goto __pyx_L0;
12595     }
12596 
12597     /* "ddtrace/internal/_encoding.pyx":591
12598  *             if ret != 0: return ret
12599  *
12600  *             ret = pack_bytes(&self.pk, <char *> b"resource", 8)             # <<<<<<<<<<<<<<
12601  *             if ret != 0: return ret
12602  *             ret = pack_text(&self.pk, span.resource)
12603  */
12604     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"resource")), 8);
12605 
12606     /* "ddtrace/internal/_encoding.pyx":592
12607  *
12608  *             ret = pack_bytes(&self.pk, <char *> b"resource", 8)
12609  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12610  *             ret = pack_text(&self.pk, span.resource)
12611  *             if ret != 0: return ret
12612  */
12613     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12614     if (__pyx_t_3) {
12615       __pyx_r = __pyx_v_ret;
12616       goto __pyx_L0;
12617     }
12618 
12619     /* "ddtrace/internal/_encoding.pyx":593
12620  *             ret = pack_bytes(&self.pk, <char *> b"resource", 8)
12621  *             if ret != 0: return ret
12622  *             ret = pack_text(&self.pk, span.resource)             # <<<<<<<<<<<<<<
12623  *             if ret != 0: return ret
12624  *
12625  */
12626     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_resource); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
12627     __Pyx_GOTREF(__pyx_t_2);
12628     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 593, __pyx_L1_error)
12629     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12630     __pyx_v_ret = __pyx_t_4;
12631 
12632     /* "ddtrace/internal/_encoding.pyx":594
12633  *             if ret != 0: return ret
12634  *             ret = pack_text(&self.pk, span.resource)
12635  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12636  *
12637  *             ret = pack_bytes(&self.pk, <char *> b"name", 4)
12638  */
12639     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12640     if (__pyx_t_3) {
12641       __pyx_r = __pyx_v_ret;
12642       goto __pyx_L0;
12643     }
12644 
12645     /* "ddtrace/internal/_encoding.pyx":596
12646  *             if ret != 0: return ret
12647  *
12648  *             ret = pack_bytes(&self.pk, <char *> b"name", 4)             # <<<<<<<<<<<<<<
12649  *             if ret != 0: return ret
12650  *             ret = pack_text(&self.pk, span.name)
12651  */
12652     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"name")), 4);
12653 
12654     /* "ddtrace/internal/_encoding.pyx":597
12655  *
12656  *             ret = pack_bytes(&self.pk, <char *> b"name", 4)
12657  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12658  *             ret = pack_text(&self.pk, span.name)
12659  *             if ret != 0: return ret
12660  */
12661     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12662     if (__pyx_t_3) {
12663       __pyx_r = __pyx_v_ret;
12664       goto __pyx_L0;
12665     }
12666 
12667     /* "ddtrace/internal/_encoding.pyx":598
12668  *             ret = pack_bytes(&self.pk, <char *> b"name", 4)
12669  *             if ret != 0: return ret
12670  *             ret = pack_text(&self.pk, span.name)             # <<<<<<<<<<<<<<
12671  *             if ret != 0: return ret
12672  *
12673  */
12674     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
12675     __Pyx_GOTREF(__pyx_t_2);
12676     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 598, __pyx_L1_error)
12677     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12678     __pyx_v_ret = __pyx_t_4;
12679 
12680     /* "ddtrace/internal/_encoding.pyx":599
12681  *             if ret != 0: return ret
12682  *             ret = pack_text(&self.pk, span.name)
12683  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12684  *
12685  *             ret = pack_bytes(&self.pk, <char *> b"start", 5)
12686  */
12687     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12688     if (__pyx_t_3) {
12689       __pyx_r = __pyx_v_ret;
12690       goto __pyx_L0;
12691     }
12692 
12693     /* "ddtrace/internal/_encoding.pyx":601
12694  *             if ret != 0: return ret
12695  *
12696  *             ret = pack_bytes(&self.pk, <char *> b"start", 5)             # <<<<<<<<<<<<<<
12697  *             if ret != 0: return ret
12698  *             ret = pack_number(&self.pk, span.start_ns)
12699  */
12700     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"start")), 5);
12701 
12702     /* "ddtrace/internal/_encoding.pyx":602
12703  *
12704  *             ret = pack_bytes(&self.pk, <char *> b"start", 5)
12705  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12706  *             ret = pack_number(&self.pk, span.start_ns)
12707  *             if ret != 0: return ret
12708  */
12709     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12710     if (__pyx_t_3) {
12711       __pyx_r = __pyx_v_ret;
12712       goto __pyx_L0;
12713     }
12714 
12715     /* "ddtrace/internal/_encoding.pyx":603
12716  *             ret = pack_bytes(&self.pk, <char *> b"start", 5)
12717  *             if ret != 0: return ret
12718  *             ret = pack_number(&self.pk, span.start_ns)             # <<<<<<<<<<<<<<
12719  *             if ret != 0: return ret
12720  *
12721  */
12722     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_start_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
12723     __Pyx_GOTREF(__pyx_t_2);
12724     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 603, __pyx_L1_error)
12725     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12726     __pyx_v_ret = __pyx_t_4;
12727 
12728     /* "ddtrace/internal/_encoding.pyx":604
12729  *             if ret != 0: return ret
12730  *             ret = pack_number(&self.pk, span.start_ns)
12731  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12732  *
12733  *             ret = pack_bytes(&self.pk, <char *> b"duration", 8)
12734  */
12735     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12736     if (__pyx_t_3) {
12737       __pyx_r = __pyx_v_ret;
12738       goto __pyx_L0;
12739     }
12740 
12741     /* "ddtrace/internal/_encoding.pyx":606
12742  *             if ret != 0: return ret
12743  *
12744  *             ret = pack_bytes(&self.pk, <char *> b"duration", 8)             # <<<<<<<<<<<<<<
12745  *             if ret != 0: return ret
12746  *             ret = pack_number(&self.pk, span.duration_ns)
12747  */
12748     __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"duration")), 8);
12749 
12750     /* "ddtrace/internal/_encoding.pyx":607
12751  *
12752  *             ret = pack_bytes(&self.pk, <char *> b"duration", 8)
12753  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12754  *             ret = pack_number(&self.pk, span.duration_ns)
12755  *             if ret != 0: return ret
12756  */
12757     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12758     if (__pyx_t_3) {
12759       __pyx_r = __pyx_v_ret;
12760       goto __pyx_L0;
12761     }
12762 
12763     /* "ddtrace/internal/_encoding.pyx":608
12764  *             ret = pack_bytes(&self.pk, <char *> b"duration", 8)
12765  *             if ret != 0: return ret
12766  *             ret = pack_number(&self.pk, span.duration_ns)             # <<<<<<<<<<<<<<
12767  *             if ret != 0: return ret
12768  *
12769  */
12770     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_duration_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L1_error)
12771     __Pyx_GOTREF(__pyx_t_2);
12772     __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 608, __pyx_L1_error)
12773     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12774     __pyx_v_ret = __pyx_t_4;
12775 
12776     /* "ddtrace/internal/_encoding.pyx":609
12777  *             if ret != 0: return ret
12778  *             ret = pack_number(&self.pk, span.duration_ns)
12779  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
12780  *
12781  *             if has_error:
12782  */
12783     __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12784     if (__pyx_t_3) {
12785       __pyx_r = __pyx_v_ret;
12786       goto __pyx_L0;
12787     }
12788 
12789     /* "ddtrace/internal/_encoding.pyx":611
12790  *             if ret != 0: return ret
12791  *
12792  *             if has_error:             # <<<<<<<<<<<<<<
12793  *                 ret = pack_bytes(&self.pk, <char *> b"error", 5)
12794  *                 if ret != 0: return ret
12795  */
12796     __pyx_t_3 = (__pyx_v_has_error != 0);
12797     if (__pyx_t_3) {
12798 
12799       /* "ddtrace/internal/_encoding.pyx":612
12800  *
12801  *             if has_error:
12802  *                 ret = pack_bytes(&self.pk, <char *> b"error", 5)             # <<<<<<<<<<<<<<
12803  *                 if ret != 0: return ret
12804  *                 ret = msgpack_pack_long(&self.pk, <long> 1)
12805  */
12806       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"error")), 5);
12807 
12808       /* "ddtrace/internal/_encoding.pyx":613
12809  *             if has_error:
12810  *                 ret = pack_bytes(&self.pk, <char *> b"error", 5)
12811  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12812  *                 ret = msgpack_pack_long(&self.pk, <long> 1)
12813  *                 if ret != 0: return ret
12814  */
12815       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12816       if (__pyx_t_3) {
12817         __pyx_r = __pyx_v_ret;
12818         goto __pyx_L0;
12819       }
12820 
12821       /* "ddtrace/internal/_encoding.pyx":614
12822  *                 ret = pack_bytes(&self.pk, <char *> b"error", 5)
12823  *                 if ret != 0: return ret
12824  *                 ret = msgpack_pack_long(&self.pk, <long> 1)             # <<<<<<<<<<<<<<
12825  *                 if ret != 0: return ret
12826  *
12827  */
12828       __pyx_v_ret = msgpack_pack_long((&__pyx_v_self->__pyx_base.pk), ((long)1));
12829 
12830       /* "ddtrace/internal/_encoding.pyx":615
12831  *                 if ret != 0: return ret
12832  *                 ret = msgpack_pack_long(&self.pk, <long> 1)
12833  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12834  *
12835  *             if has_span_type:
12836  */
12837       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12838       if (__pyx_t_3) {
12839         __pyx_r = __pyx_v_ret;
12840         goto __pyx_L0;
12841       }
12842 
12843       /* "ddtrace/internal/_encoding.pyx":611
12844  *             if ret != 0: return ret
12845  *
12846  *             if has_error:             # <<<<<<<<<<<<<<
12847  *                 ret = pack_bytes(&self.pk, <char *> b"error", 5)
12848  *                 if ret != 0: return ret
12849  */
12850     }
12851 
12852     /* "ddtrace/internal/_encoding.pyx":617
12853  *                 if ret != 0: return ret
12854  *
12855  *             if has_span_type:             # <<<<<<<<<<<<<<
12856  *                 ret = pack_bytes(&self.pk, <char *> b"type", 4)
12857  *                 if ret != 0: return ret
12858  */
12859     __pyx_t_3 = (__pyx_v_has_span_type != 0);
12860     if (__pyx_t_3) {
12861 
12862       /* "ddtrace/internal/_encoding.pyx":618
12863  *
12864  *             if has_span_type:
12865  *                 ret = pack_bytes(&self.pk, <char *> b"type", 4)             # <<<<<<<<<<<<<<
12866  *                 if ret != 0: return ret
12867  *                 ret = pack_text(&self.pk, span.span_type)
12868  */
12869       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"type")), 4);
12870 
12871       /* "ddtrace/internal/_encoding.pyx":619
12872  *             if has_span_type:
12873  *                 ret = pack_bytes(&self.pk, <char *> b"type", 4)
12874  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12875  *                 ret = pack_text(&self.pk, span.span_type)
12876  *                 if ret != 0: return ret
12877  */
12878       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12879       if (__pyx_t_3) {
12880         __pyx_r = __pyx_v_ret;
12881         goto __pyx_L0;
12882       }
12883 
12884       /* "ddtrace/internal/_encoding.pyx":620
12885  *                 ret = pack_bytes(&self.pk, <char *> b"type", 4)
12886  *                 if ret != 0: return ret
12887  *                 ret = pack_text(&self.pk, span.span_type)             # <<<<<<<<<<<<<<
12888  *                 if ret != 0: return ret
12889  *
12890  */
12891       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_span_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
12892       __Pyx_GOTREF(__pyx_t_2);
12893       __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_pack_text((&__pyx_v_self->__pyx_base.pk), __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error)
12894       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12895       __pyx_v_ret = __pyx_t_4;
12896 
12897       /* "ddtrace/internal/_encoding.pyx":621
12898  *                 if ret != 0: return ret
12899  *                 ret = pack_text(&self.pk, span.span_type)
12900  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12901  *
12902  *             if has_meta:
12903  */
12904       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12905       if (__pyx_t_3) {
12906         __pyx_r = __pyx_v_ret;
12907         goto __pyx_L0;
12908       }
12909 
12910       /* "ddtrace/internal/_encoding.pyx":617
12911  *                 if ret != 0: return ret
12912  *
12913  *             if has_span_type:             # <<<<<<<<<<<<<<
12914  *                 ret = pack_bytes(&self.pk, <char *> b"type", 4)
12915  *                 if ret != 0: return ret
12916  */
12917     }
12918 
12919     /* "ddtrace/internal/_encoding.pyx":623
12920  *                 if ret != 0: return ret
12921  *
12922  *             if has_meta:             # <<<<<<<<<<<<<<
12923  *                 ret = pack_bytes(&self.pk, <char *> b"meta", 4)
12924  *                 if ret != 0: return ret
12925  */
12926     __pyx_t_3 = (__pyx_v_has_meta != 0);
12927     if (__pyx_t_3) {
12928 
12929       /* "ddtrace/internal/_encoding.pyx":624
12930  *
12931  *             if has_meta:
12932  *                 ret = pack_bytes(&self.pk, <char *> b"meta", 4)             # <<<<<<<<<<<<<<
12933  *                 if ret != 0: return ret
12934  *                 ret = self._pack_meta(span.meta, <char *> dd_origin)
12935  */
12936       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"meta")), 4);
12937 
12938       /* "ddtrace/internal/_encoding.pyx":625
12939  *             if has_meta:
12940  *                 ret = pack_bytes(&self.pk, <char *> b"meta", 4)
12941  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12942  *                 ret = self._pack_meta(span.meta, <char *> dd_origin)
12943  *                 if ret != 0: return ret
12944  */
12945       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12946       if (__pyx_t_3) {
12947         __pyx_r = __pyx_v_ret;
12948         goto __pyx_L0;
12949       }
12950 
12951       /* "ddtrace/internal/_encoding.pyx":626
12952  *                 ret = pack_bytes(&self.pk, <char *> b"meta", 4)
12953  *                 if ret != 0: return ret
12954  *                 ret = self._pack_meta(span.meta, <char *> dd_origin)             # <<<<<<<<<<<<<<
12955  *                 if ret != 0: return ret
12956  *
12957  */
12958       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_meta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error)
12959       __Pyx_GOTREF(__pyx_t_2);
12960       __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta(__pyx_v_self, __pyx_t_2, ((char *)__pyx_v_dd_origin)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error)
12961       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12962       __pyx_v_ret = __pyx_t_4;
12963 
12964       /* "ddtrace/internal/_encoding.pyx":627
12965  *                 if ret != 0: return ret
12966  *                 ret = self._pack_meta(span.meta, <char *> dd_origin)
12967  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
12968  *
12969  *             if has_metrics:
12970  */
12971       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
12972       if (__pyx_t_3) {
12973         __pyx_r = __pyx_v_ret;
12974         goto __pyx_L0;
12975       }
12976 
12977       /* "ddtrace/internal/_encoding.pyx":623
12978  *                 if ret != 0: return ret
12979  *
12980  *             if has_meta:             # <<<<<<<<<<<<<<
12981  *                 ret = pack_bytes(&self.pk, <char *> b"meta", 4)
12982  *                 if ret != 0: return ret
12983  */
12984     }
12985 
12986     /* "ddtrace/internal/_encoding.pyx":629
12987  *                 if ret != 0: return ret
12988  *
12989  *             if has_metrics:             # <<<<<<<<<<<<<<
12990  *                 ret = pack_bytes(&self.pk, <char *> b"metrics", 7)
12991  *                 if ret != 0: return ret
12992  */
12993     __pyx_t_3 = (__pyx_v_has_metrics != 0);
12994     if (__pyx_t_3) {
12995 
12996       /* "ddtrace/internal/_encoding.pyx":630
12997  *
12998  *             if has_metrics:
12999  *                 ret = pack_bytes(&self.pk, <char *> b"metrics", 7)             # <<<<<<<<<<<<<<
13000  *                 if ret != 0: return ret
13001  *                 ret = self._pack_metrics(span.metrics)
13002  */
13003       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_pack_bytes((&__pyx_v_self->__pyx_base.pk), ((char *)((char *)"metrics")), 7);
13004 
13005       /* "ddtrace/internal/_encoding.pyx":631
13006  *             if has_metrics:
13007  *                 ret = pack_bytes(&self.pk, <char *> b"metrics", 7)
13008  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
13009  *                 ret = self._pack_metrics(span.metrics)
13010  *                 if ret != 0: return ret
13011  */
13012       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
13013       if (__pyx_t_3) {
13014         __pyx_r = __pyx_v_ret;
13015         goto __pyx_L0;
13016       }
13017 
13018       /* "ddtrace/internal/_encoding.pyx":632
13019  *                 ret = pack_bytes(&self.pk, <char *> b"metrics", 7)
13020  *                 if ret != 0: return ret
13021  *                 ret = self._pack_metrics(span.metrics)             # <<<<<<<<<<<<<<
13022  *                 if ret != 0: return ret
13023  *
13024  */
13025       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_metrics); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error)
13026       __Pyx_GOTREF(__pyx_t_2);
13027       __pyx_t_4 = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics(__pyx_v_self, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 632, __pyx_L1_error)
13028       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13029       __pyx_v_ret = __pyx_t_4;
13030 
13031       /* "ddtrace/internal/_encoding.pyx":633
13032  *                 if ret != 0: return ret
13033  *                 ret = self._pack_metrics(span.metrics)
13034  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
13035  *
13036  *         return ret
13037  */
13038       __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
13039       if (__pyx_t_3) {
13040         __pyx_r = __pyx_v_ret;
13041         goto __pyx_L0;
13042       }
13043 
13044       /* "ddtrace/internal/_encoding.pyx":629
13045  *                 if ret != 0: return ret
13046  *
13047  *             if has_metrics:             # <<<<<<<<<<<<<<
13048  *                 ret = pack_bytes(&self.pk, <char *> b"metrics", 7)
13049  *                 if ret != 0: return ret
13050  */
13051     }
13052 
13053     /* "ddtrace/internal/_encoding.pyx":570
13054  *         ret = msgpack_pack_map(&self.pk, L)
13055  *
13056  *         if ret == 0:             # <<<<<<<<<<<<<<
13057  *             ret = pack_bytes(&self.pk, <char *> b"trace_id", 8)
13058  *             if ret != 0: return ret
13059  */
13060   }
13061 
13062   /* "ddtrace/internal/_encoding.pyx":635
13063  *                 if ret != 0: return ret
13064  *
13065  *         return ret             # <<<<<<<<<<<<<<
13066  *
13067  *
13068  */
13069   __pyx_r = __pyx_v_ret;
13070   goto __pyx_L0;
13071 
13072   /* "ddtrace/internal/_encoding.pyx":554
13073  *         raise TypeError("Unhandled metrics type: %r" % type(metrics))
13074  *
13075  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
13076  *         cdef int ret
13077  *         cdef Py_ssize_t L
13078  */
13079 
13080   /* function exit code */
13081   __pyx_L1_error:;
13082   __Pyx_XDECREF(__pyx_t_1);
13083   __Pyx_XDECREF(__pyx_t_2);
13084   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.pack_span", __pyx_clineno, __pyx_lineno, __pyx_filename);
13085   __pyx_r = -1;
13086   __pyx_L0:;
13087   __Pyx_RefNannyFinishContext();
13088   return __pyx_r;
13089 }
13090 
13091 /* "(tree fragment)":1
13092  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13093  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13094  * def __setstate_cython__(self, __pyx_state):
13095  */
13096 
13097 /* Python wrapper */
13098 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13099 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13100   PyObject *__pyx_r = 0;
13101   __Pyx_RefNannyDeclarations
13102   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
13103   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_2__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self));
13104 
13105   /* function exit code */
13106   __Pyx_RefNannyFinishContext();
13107   return __pyx_r;
13108 }
13109 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self)13110 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self) {
13111   PyObject *__pyx_r = NULL;
13112   __Pyx_RefNannyDeclarations
13113   PyObject *__pyx_t_1 = NULL;
13114   int __pyx_lineno = 0;
13115   const char *__pyx_filename = NULL;
13116   int __pyx_clineno = 0;
13117   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
13118 
13119   /* "(tree fragment)":2
13120  * def __reduce_cython__(self):
13121  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13122  * def __setstate_cython__(self, __pyx_state):
13123  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13124  */
13125   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
13126   __Pyx_GOTREF(__pyx_t_1);
13127   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13128   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13129   __PYX_ERR(1, 2, __pyx_L1_error)
13130 
13131   /* "(tree fragment)":1
13132  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13133  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13134  * def __setstate_cython__(self, __pyx_state):
13135  */
13136 
13137   /* function exit code */
13138   __pyx_L1_error:;
13139   __Pyx_XDECREF(__pyx_t_1);
13140   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13141   __pyx_r = NULL;
13142   __Pyx_XGIVEREF(__pyx_r);
13143   __Pyx_RefNannyFinishContext();
13144   return __pyx_r;
13145 }
13146 
13147 /* "(tree fragment)":3
13148  * def __reduce_cython__(self):
13149  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13150  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13151  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13152  */
13153 
13154 /* Python wrapper */
13155 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)13156 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13157   PyObject *__pyx_r = 0;
13158   __Pyx_RefNannyDeclarations
13159   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
13160   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_4__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13161 
13162   /* function exit code */
13163   __Pyx_RefNannyFinishContext();
13164   return __pyx_r;
13165 }
13166 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)13167 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13168   PyObject *__pyx_r = NULL;
13169   __Pyx_RefNannyDeclarations
13170   PyObject *__pyx_t_1 = NULL;
13171   int __pyx_lineno = 0;
13172   const char *__pyx_filename = NULL;
13173   int __pyx_clineno = 0;
13174   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
13175 
13176   /* "(tree fragment)":4
13177  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13178  * def __setstate_cython__(self, __pyx_state):
13179  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13180  */
13181   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
13182   __Pyx_GOTREF(__pyx_t_1);
13183   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13184   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13185   __PYX_ERR(1, 4, __pyx_L1_error)
13186 
13187   /* "(tree fragment)":3
13188  * def __reduce_cython__(self):
13189  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13190  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13191  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13192  */
13193 
13194   /* function exit code */
13195   __pyx_L1_error:;
13196   __Pyx_XDECREF(__pyx_t_1);
13197   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV03.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13198   __pyx_r = NULL;
13199   __Pyx_XGIVEREF(__pyx_r);
13200   __Pyx_RefNannyFinishContext();
13201   return __pyx_r;
13202 }
13203 
13204 /* "ddtrace/internal/_encoding.pyx":641
13205  *     cdef MsgpackStringTable _st
13206  *
13207  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
13208  *         self._st = MsgpackStringTable(max_size)
13209  *
13210  */
13211 
13212 /* Python wrapper */
13213 static int __pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13214 static int __pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13215   size_t __pyx_v_max_size;
13216   CYTHON_UNUSED size_t __pyx_v_max_item_size;
13217   int __pyx_lineno = 0;
13218   const char *__pyx_filename = NULL;
13219   int __pyx_clineno = 0;
13220   int __pyx_r;
13221   __Pyx_RefNannyDeclarations
13222   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
13223   {
13224     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_size,&__pyx_n_s_max_item_size,0};
13225     PyObject* values[2] = {0,0};
13226     if (unlikely(__pyx_kwds)) {
13227       Py_ssize_t kw_args;
13228       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13229       switch (pos_args) {
13230         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13231         CYTHON_FALLTHROUGH;
13232         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13233         CYTHON_FALLTHROUGH;
13234         case  0: break;
13235         default: goto __pyx_L5_argtuple_error;
13236       }
13237       kw_args = PyDict_Size(__pyx_kwds);
13238       switch (pos_args) {
13239         case  0:
13240         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_size)) != 0)) kw_args--;
13241         else goto __pyx_L5_argtuple_error;
13242         CYTHON_FALLTHROUGH;
13243         case  1:
13244         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_item_size)) != 0)) kw_args--;
13245         else {
13246           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 641, __pyx_L3_error)
13247         }
13248       }
13249       if (unlikely(kw_args > 0)) {
13250         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 641, __pyx_L3_error)
13251       }
13252     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
13253       goto __pyx_L5_argtuple_error;
13254     } else {
13255       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13256       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13257     }
13258     __pyx_v_max_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_max_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L3_error)
13259     __pyx_v_max_item_size = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_max_item_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L3_error)
13260   }
13261   goto __pyx_L4_argument_unpacking_done;
13262   __pyx_L5_argtuple_error:;
13263   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 641, __pyx_L3_error)
13264   __pyx_L3_error:;
13265   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13266   __Pyx_RefNannyFinishContext();
13267   return -1;
13268   __pyx_L4_argument_unpacking_done:;
13269   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05___cinit__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self), __pyx_v_max_size, __pyx_v_max_item_size);
13270 
13271   /* function exit code */
13272   __Pyx_RefNannyFinishContext();
13273   return __pyx_r;
13274 }
13275 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,size_t __pyx_v_max_size,CYTHON_UNUSED size_t __pyx_v_max_item_size)13276 static int __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05___cinit__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, size_t __pyx_v_max_size, CYTHON_UNUSED size_t __pyx_v_max_item_size) {
13277   int __pyx_r;
13278   __Pyx_RefNannyDeclarations
13279   PyObject *__pyx_t_1 = NULL;
13280   PyObject *__pyx_t_2 = NULL;
13281   int __pyx_lineno = 0;
13282   const char *__pyx_filename = NULL;
13283   int __pyx_clineno = 0;
13284   __Pyx_RefNannySetupContext("__cinit__", 0);
13285 
13286   /* "ddtrace/internal/_encoding.pyx":642
13287  *
13288  *     def __cinit__(self, size_t max_size, size_t max_item_size):
13289  *         self._st = MsgpackStringTable(max_size)             # <<<<<<<<<<<<<<
13290  *
13291  *     cpdef flush(self):
13292  */
13293   __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
13294   __Pyx_GOTREF(__pyx_t_1);
13295   __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error)
13296   __Pyx_GOTREF(__pyx_t_2);
13297   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13298   __Pyx_GIVEREF(__pyx_t_2);
13299   __Pyx_GOTREF(__pyx_v_self->_st);
13300   __Pyx_DECREF(((PyObject *)__pyx_v_self->_st));
13301   __pyx_v_self->_st = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_t_2);
13302   __pyx_t_2 = 0;
13303 
13304   /* "ddtrace/internal/_encoding.pyx":641
13305  *     cdef MsgpackStringTable _st
13306  *
13307  *     def __cinit__(self, size_t max_size, size_t max_item_size):             # <<<<<<<<<<<<<<
13308  *         self._st = MsgpackStringTable(max_size)
13309  *
13310  */
13311 
13312   /* function exit code */
13313   __pyx_r = 0;
13314   goto __pyx_L0;
13315   __pyx_L1_error:;
13316   __Pyx_XDECREF(__pyx_t_1);
13317   __Pyx_XDECREF(__pyx_t_2);
13318   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13319   __pyx_r = -1;
13320   __pyx_L0:;
13321   __Pyx_RefNannyFinishContext();
13322   return __pyx_r;
13323 }
13324 
13325 /* "ddtrace/internal/_encoding.pyx":644
13326  *         self._st = MsgpackStringTable(max_size)
13327  *
13328  *     cpdef flush(self):             # <<<<<<<<<<<<<<
13329  *         with self._lock:
13330  *             try:
13331  */
13332 
13333 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,int __pyx_skip_dispatch)13334 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, int __pyx_skip_dispatch) {
13335   PyObject *__pyx_r = NULL;
13336   __Pyx_RefNannyDeclarations
13337   PyObject *__pyx_t_1 = NULL;
13338   PyObject *__pyx_t_2 = NULL;
13339   PyObject *__pyx_t_3 = NULL;
13340   PyObject *__pyx_t_4 = NULL;
13341   PyObject *__pyx_t_5 = NULL;
13342   PyObject *__pyx_t_6 = NULL;
13343   PyObject *__pyx_t_7 = NULL;
13344   PyObject *__pyx_t_8 = NULL;
13345   long __pyx_t_9;
13346   Py_ssize_t __pyx_t_10;
13347   int __pyx_t_11;
13348   int __pyx_t_12;
13349   char const *__pyx_t_13;
13350   PyObject *__pyx_t_14 = NULL;
13351   PyObject *__pyx_t_15 = NULL;
13352   PyObject *__pyx_t_16 = NULL;
13353   PyObject *__pyx_t_17 = NULL;
13354   PyObject *__pyx_t_18 = NULL;
13355   PyObject *__pyx_t_19 = NULL;
13356   int __pyx_t_20;
13357   int __pyx_t_21;
13358   int __pyx_lineno = 0;
13359   const char *__pyx_filename = NULL;
13360   int __pyx_clineno = 0;
13361   __Pyx_RefNannySetupContext("flush", 0);
13362   /* Check if called by wrapper */
13363   if (unlikely(__pyx_skip_dispatch)) ;
13364   /* Check if overridden in Python */
13365   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
13366     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
13367     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
13368     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
13369       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
13370       #endif
13371       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
13372       __Pyx_GOTREF(__pyx_t_1);
13373       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush)) {
13374         __Pyx_XDECREF(__pyx_r);
13375         __Pyx_INCREF(__pyx_t_1);
13376         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
13377         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
13378           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
13379           if (likely(__pyx_t_4)) {
13380             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13381             __Pyx_INCREF(__pyx_t_4);
13382             __Pyx_INCREF(function);
13383             __Pyx_DECREF_SET(__pyx_t_3, function);
13384           }
13385         }
13386         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
13387         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13388         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error)
13389         __Pyx_GOTREF(__pyx_t_2);
13390         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13391         __pyx_r = __pyx_t_2;
13392         __pyx_t_2 = 0;
13393         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13394         goto __pyx_L0;
13395       }
13396       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
13397       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
13398       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
13399       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
13400         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
13401       }
13402       #endif
13403       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13404       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
13405     }
13406     #endif
13407   }
13408 
13409   /* "ddtrace/internal/_encoding.pyx":645
13410  *
13411  *     cpdef flush(self):
13412  *         with self._lock:             # <<<<<<<<<<<<<<
13413  *             try:
13414  *                 self._st.append_raw(PyLong_FromLong(<long> self.get_buffer()), <Py_ssize_t> super(MsgpackEncoderV05, self).size)
13415  */
13416   /*with:*/ {
13417     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error)
13418     __Pyx_GOTREF(__pyx_t_5);
13419     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L3_error)
13420     __Pyx_GOTREF(__pyx_t_2);
13421     __pyx_t_3 = NULL;
13422     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13423       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
13424       if (likely(__pyx_t_3)) {
13425         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13426         __Pyx_INCREF(__pyx_t_3);
13427         __Pyx_INCREF(function);
13428         __Pyx_DECREF_SET(__pyx_t_2, function);
13429       }
13430     }
13431     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
13432     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13433     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L3_error)
13434     __Pyx_GOTREF(__pyx_t_1);
13435     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13436     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13437     /*try:*/ {
13438       {
13439         __Pyx_PyThreadState_declare
13440         __Pyx_PyThreadState_assign
13441         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
13442         __Pyx_XGOTREF(__pyx_t_6);
13443         __Pyx_XGOTREF(__pyx_t_7);
13444         __Pyx_XGOTREF(__pyx_t_8);
13445         /*try:*/ {
13446 
13447           /* "ddtrace/internal/_encoding.pyx":646
13448  *     cpdef flush(self):
13449  *         with self._lock:
13450  *             try:             # <<<<<<<<<<<<<<
13451  *                 self._st.append_raw(PyLong_FromLong(<long> self.get_buffer()), <Py_ssize_t> super(MsgpackEncoderV05, self).size)
13452  *                 return self._st.flush()
13453  */
13454           /*try:*/ {
13455 
13456             /* "ddtrace/internal/_encoding.pyx":647
13457  *         with self._lock:
13458  *             try:
13459  *                 self._st.append_raw(PyLong_FromLong(<long> self.get_buffer()), <Py_ssize_t> super(MsgpackEncoderV05, self).size)             # <<<<<<<<<<<<<<
13460  *                 return self._st.flush()
13461  *             finally:
13462  */
13463             __pyx_t_1 = PyLong_FromLong(((long)((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_buffer(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L14_error)
13464             __Pyx_GOTREF(__pyx_t_1);
13465             __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L14_error)
13466             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13467             __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L14_error)
13468             __Pyx_GOTREF(__pyx_t_1);
13469             __Pyx_INCREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13470             __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13471             PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13472             __Pyx_INCREF(((PyObject *)__pyx_v_self));
13473             __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13474             PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
13475             __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L14_error)
13476             __Pyx_GOTREF(__pyx_t_2);
13477             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13478             __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L14_error)
13479             __Pyx_GOTREF(__pyx_t_1);
13480             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13481             __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L14_error)
13482             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13483             __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->append_raw(__pyx_v_self->_st, __pyx_t_9, ((Py_ssize_t)__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L14_error)
13484             __Pyx_GOTREF(__pyx_t_1);
13485             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13486 
13487             /* "ddtrace/internal/_encoding.pyx":648
13488  *             try:
13489  *                 self._st.append_raw(PyLong_FromLong(<long> self.get_buffer()), <Py_ssize_t> super(MsgpackEncoderV05, self).size)
13490  *                 return self._st.flush()             # <<<<<<<<<<<<<<
13491  *             finally:
13492  *                 self._reset_buffer()
13493  */
13494             __Pyx_XDECREF(__pyx_r);
13495             __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->flush(__pyx_v_self->_st, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L14_error)
13496             __Pyx_GOTREF(__pyx_t_1);
13497             __pyx_r = __pyx_t_1;
13498             __pyx_t_1 = 0;
13499             goto __pyx_L13_return;
13500           }
13501 
13502           /* "ddtrace/internal/_encoding.pyx":650
13503  *                 return self._st.flush()
13504  *             finally:
13505  *                 self._reset_buffer()             # <<<<<<<<<<<<<<
13506  *
13507  *     @property
13508  */
13509           /*finally:*/ {
13510             __pyx_L14_error:;
13511             /*exception exit:*/{
13512               __Pyx_PyThreadState_declare
13513               __Pyx_PyThreadState_assign
13514               __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
13515               __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
13516               __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13517               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13518               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13519               if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
13520               if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
13521               __Pyx_XGOTREF(__pyx_t_14);
13522               __Pyx_XGOTREF(__pyx_t_15);
13523               __Pyx_XGOTREF(__pyx_t_16);
13524               __Pyx_XGOTREF(__pyx_t_17);
13525               __Pyx_XGOTREF(__pyx_t_18);
13526               __Pyx_XGOTREF(__pyx_t_19);
13527               __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
13528               {
13529                 __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._reset_buffer(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L17_error)
13530                 __Pyx_GOTREF(__pyx_t_1);
13531                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13532               }
13533               if (PY_MAJOR_VERSION >= 3) {
13534                 __Pyx_XGIVEREF(__pyx_t_17);
13535                 __Pyx_XGIVEREF(__pyx_t_18);
13536                 __Pyx_XGIVEREF(__pyx_t_19);
13537                 __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
13538               }
13539               __Pyx_XGIVEREF(__pyx_t_14);
13540               __Pyx_XGIVEREF(__pyx_t_15);
13541               __Pyx_XGIVEREF(__pyx_t_16);
13542               __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
13543               __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
13544               __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
13545               goto __pyx_L7_error;
13546               __pyx_L17_error:;
13547               if (PY_MAJOR_VERSION >= 3) {
13548                 __Pyx_XGIVEREF(__pyx_t_17);
13549                 __Pyx_XGIVEREF(__pyx_t_18);
13550                 __Pyx_XGIVEREF(__pyx_t_19);
13551                 __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
13552               }
13553               __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
13554               __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
13555               __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
13556               __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
13557               goto __pyx_L7_error;
13558             }
13559             __pyx_L13_return: {
13560               __pyx_t_19 = __pyx_r;
13561               __pyx_r = 0;
13562               __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._reset_buffer(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L7_error)
13563               __Pyx_GOTREF(__pyx_t_1);
13564               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13565               __pyx_r = __pyx_t_19;
13566               __pyx_t_19 = 0;
13567               goto __pyx_L11_try_return;
13568             }
13569           }
13570 
13571           /* "ddtrace/internal/_encoding.pyx":645
13572  *
13573  *     cpdef flush(self):
13574  *         with self._lock:             # <<<<<<<<<<<<<<
13575  *             try:
13576  *                 self._st.append_raw(PyLong_FromLong(<long> self.get_buffer()), <Py_ssize_t> super(MsgpackEncoderV05, self).size)
13577  */
13578         }
13579         __pyx_L7_error:;
13580         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
13581         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13582         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13583         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13584         /*except:*/ {
13585           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
13586           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 645, __pyx_L9_except_error)
13587           __Pyx_GOTREF(__pyx_t_1);
13588           __Pyx_GOTREF(__pyx_t_2);
13589           __Pyx_GOTREF(__pyx_t_3);
13590           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L9_except_error)
13591           __Pyx_GOTREF(__pyx_t_4);
13592           __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
13593           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13594           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13595           if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 645, __pyx_L9_except_error)
13596           __Pyx_GOTREF(__pyx_t_19);
13597           __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_19);
13598           __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
13599           if (__pyx_t_20 < 0) __PYX_ERR(0, 645, __pyx_L9_except_error)
13600           __pyx_t_21 = ((!(__pyx_t_20 != 0)) != 0);
13601           if (__pyx_t_21) {
13602             __Pyx_GIVEREF(__pyx_t_1);
13603             __Pyx_GIVEREF(__pyx_t_2);
13604             __Pyx_XGIVEREF(__pyx_t_3);
13605             __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
13606             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
13607             __PYX_ERR(0, 645, __pyx_L9_except_error)
13608           }
13609           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
13610           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13611           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13612           goto __pyx_L8_exception_handled;
13613         }
13614         __pyx_L9_except_error:;
13615         __Pyx_XGIVEREF(__pyx_t_6);
13616         __Pyx_XGIVEREF(__pyx_t_7);
13617         __Pyx_XGIVEREF(__pyx_t_8);
13618         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
13619         goto __pyx_L1_error;
13620         __pyx_L11_try_return:;
13621         __Pyx_XGIVEREF(__pyx_t_6);
13622         __Pyx_XGIVEREF(__pyx_t_7);
13623         __Pyx_XGIVEREF(__pyx_t_8);
13624         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
13625         goto __pyx_L4_return;
13626         __pyx_L8_exception_handled:;
13627         __Pyx_XGIVEREF(__pyx_t_6);
13628         __Pyx_XGIVEREF(__pyx_t_7);
13629         __Pyx_XGIVEREF(__pyx_t_8);
13630         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
13631       }
13632     }
13633     /*finally:*/ {
13634       /*normal exit:*/{
13635         if (__pyx_t_5) {
13636           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
13637           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13638           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error)
13639           __Pyx_GOTREF(__pyx_t_8);
13640           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13641         }
13642         goto __pyx_L6;
13643       }
13644       __pyx_L4_return: {
13645         __pyx_t_8 = __pyx_r;
13646         __pyx_r = 0;
13647         if (__pyx_t_5) {
13648           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
13649           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13650           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 645, __pyx_L1_error)
13651           __Pyx_GOTREF(__pyx_t_7);
13652           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13653         }
13654         __pyx_r = __pyx_t_8;
13655         __pyx_t_8 = 0;
13656         goto __pyx_L0;
13657       }
13658       __pyx_L6:;
13659     }
13660     goto __pyx_L21;
13661     __pyx_L3_error:;
13662     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13663     goto __pyx_L1_error;
13664     __pyx_L21:;
13665   }
13666 
13667   /* "ddtrace/internal/_encoding.pyx":644
13668  *         self._st = MsgpackStringTable(max_size)
13669  *
13670  *     cpdef flush(self):             # <<<<<<<<<<<<<<
13671  *         with self._lock:
13672  *             try:
13673  */
13674 
13675   /* function exit code */
13676   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13677   goto __pyx_L0;
13678   __pyx_L1_error:;
13679   __Pyx_XDECREF(__pyx_t_1);
13680   __Pyx_XDECREF(__pyx_t_2);
13681   __Pyx_XDECREF(__pyx_t_3);
13682   __Pyx_XDECREF(__pyx_t_4);
13683   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
13684   __pyx_r = 0;
13685   __pyx_L0:;
13686   __Pyx_XGIVEREF(__pyx_r);
13687   __Pyx_RefNannyFinishContext();
13688   return __pyx_r;
13689 }
13690 
13691 /* Python wrapper */
13692 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13693 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13694   PyObject *__pyx_r = 0;
13695   __Pyx_RefNannyDeclarations
13696   __Pyx_RefNannySetupContext("flush (wrapper)", 0);
13697   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_2flush(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self));
13698 
13699   /* function exit code */
13700   __Pyx_RefNannyFinishContext();
13701   return __pyx_r;
13702 }
13703 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_2flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self)13704 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_2flush(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self) {
13705   PyObject *__pyx_r = NULL;
13706   __Pyx_RefNannyDeclarations
13707   PyObject *__pyx_t_1 = NULL;
13708   int __pyx_lineno = 0;
13709   const char *__pyx_filename = NULL;
13710   int __pyx_clineno = 0;
13711   __Pyx_RefNannySetupContext("flush", 0);
13712   __Pyx_XDECREF(__pyx_r);
13713   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_flush(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
13714   __Pyx_GOTREF(__pyx_t_1);
13715   __pyx_r = __pyx_t_1;
13716   __pyx_t_1 = 0;
13717   goto __pyx_L0;
13718 
13719   /* function exit code */
13720   __pyx_L1_error:;
13721   __Pyx_XDECREF(__pyx_t_1);
13722   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
13723   __pyx_r = NULL;
13724   __pyx_L0:;
13725   __Pyx_XGIVEREF(__pyx_r);
13726   __Pyx_RefNannyFinishContext();
13727   return __pyx_r;
13728 }
13729 
13730 /* "ddtrace/internal/_encoding.pyx":653
13731  *
13732  *     @property
13733  *     def size(self):             # <<<<<<<<<<<<<<
13734  *         """Return the size in bytes of the encoder buffer."""
13735  *         with self._lock:
13736  */
13737 
13738 /* Python wrapper */
13739 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size_1__get__(PyObject * __pyx_v_self)13740 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size_1__get__(PyObject *__pyx_v_self) {
13741   PyObject *__pyx_r = 0;
13742   __Pyx_RefNannyDeclarations
13743   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13744   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size___get__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self));
13745 
13746   /* function exit code */
13747   __Pyx_RefNannyFinishContext();
13748   return __pyx_r;
13749 }
13750 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self)13751 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size___get__(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self) {
13752   PyObject *__pyx_r = NULL;
13753   __Pyx_RefNannyDeclarations
13754   PyObject *__pyx_t_1 = NULL;
13755   PyObject *__pyx_t_2 = NULL;
13756   PyObject *__pyx_t_3 = NULL;
13757   PyObject *__pyx_t_4 = NULL;
13758   PyObject *__pyx_t_5 = NULL;
13759   PyObject *__pyx_t_6 = NULL;
13760   PyObject *__pyx_t_7 = NULL;
13761   PyObject *__pyx_t_8 = NULL;
13762   PyObject *__pyx_t_9 = NULL;
13763   int __pyx_t_10;
13764   int __pyx_t_11;
13765   int __pyx_lineno = 0;
13766   const char *__pyx_filename = NULL;
13767   int __pyx_clineno = 0;
13768   __Pyx_RefNannySetupContext("__get__", 0);
13769 
13770   /* "ddtrace/internal/_encoding.pyx":655
13771  *     def size(self):
13772  *         """Return the size in bytes of the encoder buffer."""
13773  *         with self._lock:             # <<<<<<<<<<<<<<
13774  *             return self._st.size + super(MsgpackEncoderV05, self).size
13775  *
13776  */
13777   /*with:*/ {
13778     __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
13779     __Pyx_GOTREF(__pyx_t_1);
13780     __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L3_error)
13781     __Pyx_GOTREF(__pyx_t_3);
13782     __pyx_t_4 = NULL;
13783     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
13784       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
13785       if (likely(__pyx_t_4)) {
13786         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13787         __Pyx_INCREF(__pyx_t_4);
13788         __Pyx_INCREF(function);
13789         __Pyx_DECREF_SET(__pyx_t_3, function);
13790       }
13791     }
13792     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
13793     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13794     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L3_error)
13795     __Pyx_GOTREF(__pyx_t_2);
13796     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13797     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13798     /*try:*/ {
13799       {
13800         __Pyx_PyThreadState_declare
13801         __Pyx_PyThreadState_assign
13802         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
13803         __Pyx_XGOTREF(__pyx_t_5);
13804         __Pyx_XGOTREF(__pyx_t_6);
13805         __Pyx_XGOTREF(__pyx_t_7);
13806         /*try:*/ {
13807 
13808           /* "ddtrace/internal/_encoding.pyx":656
13809  *         """Return the size in bytes of the encoder buffer."""
13810  *         with self._lock:
13811  *             return self._st.size + super(MsgpackEncoderV05, self).size             # <<<<<<<<<<<<<<
13812  *
13813  *     cpdef put(self, list trace):
13814  */
13815           __Pyx_XDECREF(__pyx_r);
13816           __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_st), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L7_error)
13817           __Pyx_GOTREF(__pyx_t_2);
13818           __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L7_error)
13819           __Pyx_GOTREF(__pyx_t_3);
13820           __Pyx_INCREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13821           __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13822           PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
13823           __Pyx_INCREF(((PyObject *)__pyx_v_self));
13824           __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13825           PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
13826           __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L7_error)
13827           __Pyx_GOTREF(__pyx_t_4);
13828           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13829           __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L7_error)
13830           __Pyx_GOTREF(__pyx_t_3);
13831           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13832           __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L7_error)
13833           __Pyx_GOTREF(__pyx_t_4);
13834           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13835           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13836           __pyx_r = __pyx_t_4;
13837           __pyx_t_4 = 0;
13838           goto __pyx_L11_try_return;
13839 
13840           /* "ddtrace/internal/_encoding.pyx":655
13841  *     def size(self):
13842  *         """Return the size in bytes of the encoder buffer."""
13843  *         with self._lock:             # <<<<<<<<<<<<<<
13844  *             return self._st.size + super(MsgpackEncoderV05, self).size
13845  *
13846  */
13847         }
13848         __pyx_L7_error:;
13849         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13850         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13851         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13852         /*except:*/ {
13853           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13854           if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 655, __pyx_L9_except_error)
13855           __Pyx_GOTREF(__pyx_t_4);
13856           __Pyx_GOTREF(__pyx_t_3);
13857           __Pyx_GOTREF(__pyx_t_2);
13858           __pyx_t_8 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 655, __pyx_L9_except_error)
13859           __Pyx_GOTREF(__pyx_t_8);
13860           __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL);
13861           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13862           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13863           if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 655, __pyx_L9_except_error)
13864           __Pyx_GOTREF(__pyx_t_9);
13865           __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
13866           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13867           if (__pyx_t_10 < 0) __PYX_ERR(0, 655, __pyx_L9_except_error)
13868           __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
13869           if (__pyx_t_11) {
13870             __Pyx_GIVEREF(__pyx_t_4);
13871             __Pyx_GIVEREF(__pyx_t_3);
13872             __Pyx_XGIVEREF(__pyx_t_2);
13873             __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_2);
13874             __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0;
13875             __PYX_ERR(0, 655, __pyx_L9_except_error)
13876           }
13877           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13878           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13879           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13880           goto __pyx_L8_exception_handled;
13881         }
13882         __pyx_L9_except_error:;
13883         __Pyx_XGIVEREF(__pyx_t_5);
13884         __Pyx_XGIVEREF(__pyx_t_6);
13885         __Pyx_XGIVEREF(__pyx_t_7);
13886         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
13887         goto __pyx_L1_error;
13888         __pyx_L11_try_return:;
13889         __Pyx_XGIVEREF(__pyx_t_5);
13890         __Pyx_XGIVEREF(__pyx_t_6);
13891         __Pyx_XGIVEREF(__pyx_t_7);
13892         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
13893         goto __pyx_L4_return;
13894         __pyx_L8_exception_handled:;
13895         __Pyx_XGIVEREF(__pyx_t_5);
13896         __Pyx_XGIVEREF(__pyx_t_6);
13897         __Pyx_XGIVEREF(__pyx_t_7);
13898         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
13899       }
13900     }
13901     /*finally:*/ {
13902       /*normal exit:*/{
13903         if (__pyx_t_1) {
13904           __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
13905           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13906           if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L1_error)
13907           __Pyx_GOTREF(__pyx_t_7);
13908           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13909         }
13910         goto __pyx_L6;
13911       }
13912       __pyx_L4_return: {
13913         __pyx_t_7 = __pyx_r;
13914         __pyx_r = 0;
13915         if (__pyx_t_1) {
13916           __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL);
13917           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13918           if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 655, __pyx_L1_error)
13919           __Pyx_GOTREF(__pyx_t_6);
13920           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13921         }
13922         __pyx_r = __pyx_t_7;
13923         __pyx_t_7 = 0;
13924         goto __pyx_L0;
13925       }
13926       __pyx_L6:;
13927     }
13928     goto __pyx_L16;
13929     __pyx_L3_error:;
13930     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13931     goto __pyx_L1_error;
13932     __pyx_L16:;
13933   }
13934 
13935   /* "ddtrace/internal/_encoding.pyx":653
13936  *
13937  *     @property
13938  *     def size(self):             # <<<<<<<<<<<<<<
13939  *         """Return the size in bytes of the encoder buffer."""
13940  *         with self._lock:
13941  */
13942 
13943   /* function exit code */
13944   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13945   goto __pyx_L0;
13946   __pyx_L1_error:;
13947   __Pyx_XDECREF(__pyx_t_2);
13948   __Pyx_XDECREF(__pyx_t_3);
13949   __Pyx_XDECREF(__pyx_t_4);
13950   __Pyx_XDECREF(__pyx_t_8);
13951   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13952   __pyx_r = NULL;
13953   __pyx_L0:;
13954   __Pyx_XGIVEREF(__pyx_r);
13955   __Pyx_RefNannyFinishContext();
13956   return __pyx_r;
13957 }
13958 
13959 /* "ddtrace/internal/_encoding.pyx":658
13960  *             return self._st.size + super(MsgpackEncoderV05, self).size
13961  *
13962  *     cpdef put(self, list trace):             # <<<<<<<<<<<<<<
13963  *         with self._lock:
13964  *             try:
13965  */
13966 
13967 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace); /*proto*/
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,PyObject * __pyx_v_trace,int __pyx_skip_dispatch)13968 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_trace, int __pyx_skip_dispatch) {
13969   PyObject *__pyx_r = NULL;
13970   __Pyx_RefNannyDeclarations
13971   PyObject *__pyx_t_1 = NULL;
13972   PyObject *__pyx_t_2 = NULL;
13973   PyObject *__pyx_t_3 = NULL;
13974   PyObject *__pyx_t_4 = NULL;
13975   PyObject *__pyx_t_5 = NULL;
13976   PyObject *__pyx_t_6 = NULL;
13977   PyObject *__pyx_t_7 = NULL;
13978   PyObject *__pyx_t_8 = NULL;
13979   PyObject *__pyx_t_9 = NULL;
13980   PyObject *__pyx_t_10 = NULL;
13981   PyObject *__pyx_t_11 = NULL;
13982   int __pyx_t_12;
13983   int __pyx_t_13;
13984   int __pyx_t_14;
13985   int __pyx_lineno = 0;
13986   const char *__pyx_filename = NULL;
13987   int __pyx_clineno = 0;
13988   __Pyx_RefNannySetupContext("put", 0);
13989   /* Check if called by wrapper */
13990   if (unlikely(__pyx_skip_dispatch)) ;
13991   /* Check if overridden in Python */
13992   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
13993     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
13994     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
13995     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
13996       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
13997       #endif
13998       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
13999       __Pyx_GOTREF(__pyx_t_1);
14000       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put)) {
14001         __Pyx_XDECREF(__pyx_r);
14002         __Pyx_INCREF(__pyx_t_1);
14003         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
14004         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14005           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14006           if (likely(__pyx_t_4)) {
14007             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14008             __Pyx_INCREF(__pyx_t_4);
14009             __Pyx_INCREF(function);
14010             __Pyx_DECREF_SET(__pyx_t_3, function);
14011           }
14012         }
14013         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_trace) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trace);
14014         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14015         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
14016         __Pyx_GOTREF(__pyx_t_2);
14017         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14018         __pyx_r = __pyx_t_2;
14019         __pyx_t_2 = 0;
14020         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14021         goto __pyx_L0;
14022       }
14023       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
14024       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
14025       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
14026       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
14027         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
14028       }
14029       #endif
14030       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14031       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
14032     }
14033     #endif
14034   }
14035 
14036   /* "ddtrace/internal/_encoding.pyx":659
14037  *
14038  *     cpdef put(self, list trace):
14039  *         with self._lock:             # <<<<<<<<<<<<<<
14040  *             try:
14041  *                 self._st.savepoint()
14042  */
14043   /*with:*/ {
14044     __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 659, __pyx_L1_error)
14045     __Pyx_GOTREF(__pyx_t_5);
14046     __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx_base.__pyx_base._lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L3_error)
14047     __Pyx_GOTREF(__pyx_t_2);
14048     __pyx_t_3 = NULL;
14049     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
14050       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
14051       if (likely(__pyx_t_3)) {
14052         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
14053         __Pyx_INCREF(__pyx_t_3);
14054         __Pyx_INCREF(function);
14055         __Pyx_DECREF_SET(__pyx_t_2, function);
14056       }
14057     }
14058     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
14059     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14060     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L3_error)
14061     __Pyx_GOTREF(__pyx_t_1);
14062     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14063     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14064     /*try:*/ {
14065       {
14066         __Pyx_PyThreadState_declare
14067         __Pyx_PyThreadState_assign
14068         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
14069         __Pyx_XGOTREF(__pyx_t_6);
14070         __Pyx_XGOTREF(__pyx_t_7);
14071         __Pyx_XGOTREF(__pyx_t_8);
14072         /*try:*/ {
14073 
14074           /* "ddtrace/internal/_encoding.pyx":660
14075  *     cpdef put(self, list trace):
14076  *         with self._lock:
14077  *             try:             # <<<<<<<<<<<<<<
14078  *                 self._st.savepoint()
14079  *                 super(MsgpackEncoderV05, self).put(trace)
14080  */
14081           {
14082             __Pyx_PyThreadState_declare
14083             __Pyx_PyThreadState_assign
14084             __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
14085             __Pyx_XGOTREF(__pyx_t_9);
14086             __Pyx_XGOTREF(__pyx_t_10);
14087             __Pyx_XGOTREF(__pyx_t_11);
14088             /*try:*/ {
14089 
14090               /* "ddtrace/internal/_encoding.pyx":661
14091  *         with self._lock:
14092  *             try:
14093  *                 self._st.savepoint()             # <<<<<<<<<<<<<<
14094  *                 super(MsgpackEncoderV05, self).put(trace)
14095  *             except Exception:
14096  */
14097               __pyx_t_1 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->savepoint(__pyx_v_self->_st); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L13_error)
14098               __Pyx_GOTREF(__pyx_t_1);
14099               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14100 
14101               /* "ddtrace/internal/_encoding.pyx":662
14102  *             try:
14103  *                 self._st.savepoint()
14104  *                 super(MsgpackEncoderV05, self).put(trace)             # <<<<<<<<<<<<<<
14105  *             except Exception:
14106  *                 self._st.rollback()
14107  */
14108               __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L13_error)
14109               __Pyx_GOTREF(__pyx_t_2);
14110               __Pyx_INCREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
14111               __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
14112               PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05));
14113               __Pyx_INCREF(((PyObject *)__pyx_v_self));
14114               __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
14115               PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
14116               __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L13_error)
14117               __Pyx_GOTREF(__pyx_t_3);
14118               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14119               __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_put); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L13_error)
14120               __Pyx_GOTREF(__pyx_t_2);
14121               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14122               __pyx_t_3 = NULL;
14123               if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
14124                 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
14125                 if (likely(__pyx_t_3)) {
14126                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
14127                   __Pyx_INCREF(__pyx_t_3);
14128                   __Pyx_INCREF(function);
14129                   __Pyx_DECREF_SET(__pyx_t_2, function);
14130                 }
14131               }
14132               __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_trace) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_trace);
14133               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14134               if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L13_error)
14135               __Pyx_GOTREF(__pyx_t_1);
14136               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14137               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14138 
14139               /* "ddtrace/internal/_encoding.pyx":660
14140  *     cpdef put(self, list trace):
14141  *         with self._lock:
14142  *             try:             # <<<<<<<<<<<<<<
14143  *                 self._st.savepoint()
14144  *                 super(MsgpackEncoderV05, self).put(trace)
14145  */
14146             }
14147             __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14148             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14149             __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
14150             goto __pyx_L18_try_end;
14151             __pyx_L13_error:;
14152             __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14153             __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14154             __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14155             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14156 
14157             /* "ddtrace/internal/_encoding.pyx":663
14158  *                 self._st.savepoint()
14159  *                 super(MsgpackEncoderV05, self).put(trace)
14160  *             except Exception:             # <<<<<<<<<<<<<<
14161  *                 self._st.rollback()
14162  *                 raise
14163  */
14164             __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
14165             if (__pyx_t_12) {
14166               __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
14167               if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 663, __pyx_L15_except_error)
14168               __Pyx_GOTREF(__pyx_t_1);
14169               __Pyx_GOTREF(__pyx_t_2);
14170               __Pyx_GOTREF(__pyx_t_3);
14171 
14172               /* "ddtrace/internal/_encoding.pyx":664
14173  *                 super(MsgpackEncoderV05, self).put(trace)
14174  *             except Exception:
14175  *                 self._st.rollback()             # <<<<<<<<<<<<<<
14176  *                 raise
14177  *
14178  */
14179               __pyx_t_4 = ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->rollback(__pyx_v_self->_st); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L15_except_error)
14180               __Pyx_GOTREF(__pyx_t_4);
14181               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14182 
14183               /* "ddtrace/internal/_encoding.pyx":665
14184  *             except Exception:
14185  *                 self._st.rollback()
14186  *                 raise             # <<<<<<<<<<<<<<
14187  *
14188  *     cdef inline int _pack_string(self, object string):
14189  */
14190               __Pyx_GIVEREF(__pyx_t_1);
14191               __Pyx_GIVEREF(__pyx_t_2);
14192               __Pyx_XGIVEREF(__pyx_t_3);
14193               __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
14194               __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
14195               __PYX_ERR(0, 665, __pyx_L15_except_error)
14196             }
14197             goto __pyx_L15_except_error;
14198             __pyx_L15_except_error:;
14199 
14200             /* "ddtrace/internal/_encoding.pyx":660
14201  *     cpdef put(self, list trace):
14202  *         with self._lock:
14203  *             try:             # <<<<<<<<<<<<<<
14204  *                 self._st.savepoint()
14205  *                 super(MsgpackEncoderV05, self).put(trace)
14206  */
14207             __Pyx_XGIVEREF(__pyx_t_9);
14208             __Pyx_XGIVEREF(__pyx_t_10);
14209             __Pyx_XGIVEREF(__pyx_t_11);
14210             __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
14211             goto __pyx_L7_error;
14212             __pyx_L18_try_end:;
14213           }
14214 
14215           /* "ddtrace/internal/_encoding.pyx":659
14216  *
14217  *     cpdef put(self, list trace):
14218  *         with self._lock:             # <<<<<<<<<<<<<<
14219  *             try:
14220  *                 self._st.savepoint()
14221  */
14222         }
14223         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14224         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14225         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
14226         goto __pyx_L12_try_end;
14227         __pyx_L7_error:;
14228         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14229         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14230         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14231         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14232         /*except:*/ {
14233           __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
14234           if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 659, __pyx_L9_except_error)
14235           __Pyx_GOTREF(__pyx_t_3);
14236           __Pyx_GOTREF(__pyx_t_2);
14237           __Pyx_GOTREF(__pyx_t_1);
14238           __pyx_t_4 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L9_except_error)
14239           __Pyx_GOTREF(__pyx_t_4);
14240           __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL);
14241           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14242           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14243           if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 659, __pyx_L9_except_error)
14244           __Pyx_GOTREF(__pyx_t_11);
14245           __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11);
14246           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14247           if (__pyx_t_13 < 0) __PYX_ERR(0, 659, __pyx_L9_except_error)
14248           __pyx_t_14 = ((!(__pyx_t_13 != 0)) != 0);
14249           if (__pyx_t_14) {
14250             __Pyx_GIVEREF(__pyx_t_3);
14251             __Pyx_GIVEREF(__pyx_t_2);
14252             __Pyx_XGIVEREF(__pyx_t_1);
14253             __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_1);
14254             __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
14255             __PYX_ERR(0, 659, __pyx_L9_except_error)
14256           }
14257           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14258           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14259           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14260           goto __pyx_L8_exception_handled;
14261         }
14262         __pyx_L9_except_error:;
14263         __Pyx_XGIVEREF(__pyx_t_6);
14264         __Pyx_XGIVEREF(__pyx_t_7);
14265         __Pyx_XGIVEREF(__pyx_t_8);
14266         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
14267         goto __pyx_L1_error;
14268         __pyx_L8_exception_handled:;
14269         __Pyx_XGIVEREF(__pyx_t_6);
14270         __Pyx_XGIVEREF(__pyx_t_7);
14271         __Pyx_XGIVEREF(__pyx_t_8);
14272         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
14273         __pyx_L12_try_end:;
14274       }
14275     }
14276     /*finally:*/ {
14277       /*normal exit:*/{
14278         if (__pyx_t_5) {
14279           __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL);
14280           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14281           if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 659, __pyx_L1_error)
14282           __Pyx_GOTREF(__pyx_t_8);
14283           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14284         }
14285         goto __pyx_L6;
14286       }
14287       __pyx_L6:;
14288     }
14289     goto __pyx_L24;
14290     __pyx_L3_error:;
14291     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14292     goto __pyx_L1_error;
14293     __pyx_L24:;
14294   }
14295 
14296   /* "ddtrace/internal/_encoding.pyx":658
14297  *             return self._st.size + super(MsgpackEncoderV05, self).size
14298  *
14299  *     cpdef put(self, list trace):             # <<<<<<<<<<<<<<
14300  *         with self._lock:
14301  *             try:
14302  */
14303 
14304   /* function exit code */
14305   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14306   goto __pyx_L0;
14307   __pyx_L1_error:;
14308   __Pyx_XDECREF(__pyx_t_1);
14309   __Pyx_XDECREF(__pyx_t_2);
14310   __Pyx_XDECREF(__pyx_t_3);
14311   __Pyx_XDECREF(__pyx_t_4);
14312   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
14313   __pyx_r = 0;
14314   __pyx_L0:;
14315   __Pyx_XGIVEREF(__pyx_r);
14316   __Pyx_RefNannyFinishContext();
14317   return __pyx_r;
14318 }
14319 
14320 /* Python wrapper */
14321 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put(PyObject * __pyx_v_self,PyObject * __pyx_v_trace)14322 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put(PyObject *__pyx_v_self, PyObject *__pyx_v_trace) {
14323   int __pyx_lineno = 0;
14324   const char *__pyx_filename = NULL;
14325   int __pyx_clineno = 0;
14326   PyObject *__pyx_r = 0;
14327   __Pyx_RefNannyDeclarations
14328   __Pyx_RefNannySetupContext("put (wrapper)", 0);
14329   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trace), (&PyList_Type), 1, "trace", 1))) __PYX_ERR(0, 658, __pyx_L1_error)
14330   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4put(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self), ((PyObject*)__pyx_v_trace));
14331 
14332   /* function exit code */
14333   goto __pyx_L0;
14334   __pyx_L1_error:;
14335   __pyx_r = NULL;
14336   __pyx_L0:;
14337   __Pyx_RefNannyFinishContext();
14338   return __pyx_r;
14339 }
14340 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,PyObject * __pyx_v_trace)14341 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4put(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_trace) {
14342   PyObject *__pyx_r = NULL;
14343   __Pyx_RefNannyDeclarations
14344   PyObject *__pyx_t_1 = NULL;
14345   int __pyx_lineno = 0;
14346   const char *__pyx_filename = NULL;
14347   int __pyx_clineno = 0;
14348   __Pyx_RefNannySetupContext("put", 0);
14349   __Pyx_XDECREF(__pyx_r);
14350   __pyx_t_1 = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_put(__pyx_v_self, __pyx_v_trace, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
14351   __Pyx_GOTREF(__pyx_t_1);
14352   __pyx_r = __pyx_t_1;
14353   __pyx_t_1 = 0;
14354   goto __pyx_L0;
14355 
14356   /* function exit code */
14357   __pyx_L1_error:;
14358   __Pyx_XDECREF(__pyx_t_1);
14359   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
14360   __pyx_r = NULL;
14361   __pyx_L0:;
14362   __Pyx_XGIVEREF(__pyx_r);
14363   __Pyx_RefNannyFinishContext();
14364   return __pyx_r;
14365 }
14366 
14367 /* "ddtrace/internal/_encoding.pyx":667
14368  *                 raise
14369  *
14370  *     cdef inline int _pack_string(self, object string):             # <<<<<<<<<<<<<<
14371  *         return msgpack_pack_uint32(&self.pk, self._st._index(string))
14372  *
14373  */
14374 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,PyObject * __pyx_v_string)14375 static CYTHON_INLINE int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_string) {
14376   int __pyx_r;
14377   __Pyx_RefNannyDeclarations
14378   __Pyx_RefNannySetupContext("_pack_string", 0);
14379 
14380   /* "ddtrace/internal/_encoding.pyx":668
14381  *
14382  *     cdef inline int _pack_string(self, object string):
14383  *         return msgpack_pack_uint32(&self.pk, self._st._index(string))             # <<<<<<<<<<<<<<
14384  *
14385  *     cdef void * get_dd_origin_ref(self, str dd_origin):
14386  */
14387   __pyx_r = msgpack_pack_uint32((&__pyx_v_self->__pyx_base.pk), ((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->__pyx_base._index(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->_st), __pyx_v_string));
14388   goto __pyx_L0;
14389 
14390   /* "ddtrace/internal/_encoding.pyx":667
14391  *                 raise
14392  *
14393  *     cdef inline int _pack_string(self, object string):             # <<<<<<<<<<<<<<
14394  *         return msgpack_pack_uint32(&self.pk, self._st._index(string))
14395  *
14396  */
14397 
14398   /* function exit code */
14399   __pyx_L0:;
14400   __Pyx_RefNannyFinishContext();
14401   return __pyx_r;
14402 }
14403 
14404 /* "ddtrace/internal/_encoding.pyx":670
14405  *         return msgpack_pack_uint32(&self.pk, self._st._index(string))
14406  *
14407  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
14408  *         return <void *> PyLong_AsLong(self._st._index(dd_origin))
14409  *
14410  */
14411 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_get_dd_origin_ref(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,PyObject * __pyx_v_dd_origin)14412 static void *__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_get_dd_origin_ref(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_dd_origin) {
14413   void *__pyx_r;
14414   __Pyx_RefNannyDeclarations
14415   PyObject *__pyx_t_1 = NULL;
14416   long __pyx_t_2;
14417   int __pyx_lineno = 0;
14418   const char *__pyx_filename = NULL;
14419   int __pyx_clineno = 0;
14420   __Pyx_RefNannySetupContext("get_dd_origin_ref", 0);
14421 
14422   /* "ddtrace/internal/_encoding.pyx":671
14423  *
14424  *     cdef void * get_dd_origin_ref(self, str dd_origin):
14425  *         return <void *> PyLong_AsLong(self._st._index(dd_origin))             # <<<<<<<<<<<<<<
14426  *
14427  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:
14428  */
14429   __pyx_t_1 = __Pyx_PyInt_From_uint32_t(((struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable *)__pyx_v_self->_st->__pyx_base.__pyx_vtab)->__pyx_base._index(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v_self->_st), __pyx_v_dd_origin)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error)
14430   __Pyx_GOTREF(__pyx_t_1);
14431   __pyx_t_2 = PyLong_AsLong(__pyx_t_1); if (unlikely(__pyx_t_2 == ((long)-1L) && PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L1_error)
14432   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14433   __pyx_r = ((void *)__pyx_t_2);
14434   goto __pyx_L0;
14435 
14436   /* "ddtrace/internal/_encoding.pyx":670
14437  *         return msgpack_pack_uint32(&self.pk, self._st._index(string))
14438  *
14439  *     cdef void * get_dd_origin_ref(self, str dd_origin):             # <<<<<<<<<<<<<<
14440  *         return <void *> PyLong_AsLong(self._st._index(dd_origin))
14441  *
14442  */
14443 
14444   /* function exit code */
14445   __pyx_L1_error:;
14446   __Pyx_XDECREF(__pyx_t_1);
14447   __Pyx_WriteUnraisable("ddtrace.internal._encoding.MsgpackEncoderV05.get_dd_origin_ref", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
14448   __pyx_r = 0;
14449   __pyx_L0:;
14450   __Pyx_RefNannyFinishContext();
14451   return __pyx_r;
14452 }
14453 
14454 /* "ddtrace/internal/_encoding.pyx":673
14455  *         return <void *> PyLong_AsLong(self._st._index(dd_origin))
14456  *
14457  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
14458  *         cdef int ret
14459  *
14460  */
14461 
__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,PyObject * __pyx_v_span,void * __pyx_v_dd_origin)14462 static int __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_pack_span(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, PyObject *__pyx_v_span, void *__pyx_v_dd_origin) {
14463   int __pyx_v_ret;
14464   PyObject *__pyx_v__ = NULL;
14465   PyObject *__pyx_v_k = NULL;
14466   PyObject *__pyx_v_v = NULL;
14467   int __pyx_r;
14468   __Pyx_RefNannyDeclarations
14469   int __pyx_t_1;
14470   PyObject *__pyx_t_2 = NULL;
14471   uint64_t __pyx_t_3;
14472   uint64_t __pyx_t_4;
14473   int64_t __pyx_t_5;
14474   int64_t __pyx_t_6;
14475   int32_t __pyx_t_7;
14476   int32_t __pyx_t_8;
14477   Py_ssize_t __pyx_t_9;
14478   PyObject *__pyx_t_10 = NULL;
14479   PyObject *__pyx_t_11 = NULL;
14480   PyObject *(*__pyx_t_12)(PyObject *);
14481   PyObject *__pyx_t_13 = NULL;
14482   PyObject *__pyx_t_14 = NULL;
14483   PyObject *(*__pyx_t_15)(PyObject *);
14484   int __pyx_t_16;
14485   int __pyx_lineno = 0;
14486   const char *__pyx_filename = NULL;
14487   int __pyx_clineno = 0;
14488   __Pyx_RefNannySetupContext("pack_span", 0);
14489 
14490   /* "ddtrace/internal/_encoding.pyx":676
14491  *         cdef int ret
14492  *
14493  *         ret = msgpack_pack_array(&self.pk, 12)             # <<<<<<<<<<<<<<
14494  *         if ret != 0: return ret
14495  *
14496  */
14497   __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->__pyx_base.pk), 12);
14498 
14499   /* "ddtrace/internal/_encoding.pyx":677
14500  *
14501  *         ret = msgpack_pack_array(&self.pk, 12)
14502  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14503  *
14504  *         ret = self._pack_string(span.service)
14505  */
14506   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14507   if (__pyx_t_1) {
14508     __pyx_r = __pyx_v_ret;
14509     goto __pyx_L0;
14510   }
14511 
14512   /* "ddtrace/internal/_encoding.pyx":679
14513  *         if ret != 0: return ret
14514  *
14515  *         ret = self._pack_string(span.service)             # <<<<<<<<<<<<<<
14516  *         if ret != 0: return ret
14517  *         ret = self._pack_string(span.name)
14518  */
14519   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_service); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error)
14520   __Pyx_GOTREF(__pyx_t_2);
14521   __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_t_2);
14522   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14523 
14524   /* "ddtrace/internal/_encoding.pyx":680
14525  *
14526  *         ret = self._pack_string(span.service)
14527  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14528  *         ret = self._pack_string(span.name)
14529  *         if ret != 0: return ret
14530  */
14531   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14532   if (__pyx_t_1) {
14533     __pyx_r = __pyx_v_ret;
14534     goto __pyx_L0;
14535   }
14536 
14537   /* "ddtrace/internal/_encoding.pyx":681
14538  *         ret = self._pack_string(span.service)
14539  *         if ret != 0: return ret
14540  *         ret = self._pack_string(span.name)             # <<<<<<<<<<<<<<
14541  *         if ret != 0: return ret
14542  *         ret = self._pack_string(span.resource)
14543  */
14544   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 681, __pyx_L1_error)
14545   __Pyx_GOTREF(__pyx_t_2);
14546   __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_t_2);
14547   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14548 
14549   /* "ddtrace/internal/_encoding.pyx":682
14550  *         if ret != 0: return ret
14551  *         ret = self._pack_string(span.name)
14552  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14553  *         ret = self._pack_string(span.resource)
14554  *         if ret != 0: return ret
14555  */
14556   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14557   if (__pyx_t_1) {
14558     __pyx_r = __pyx_v_ret;
14559     goto __pyx_L0;
14560   }
14561 
14562   /* "ddtrace/internal/_encoding.pyx":683
14563  *         ret = self._pack_string(span.name)
14564  *         if ret != 0: return ret
14565  *         ret = self._pack_string(span.resource)             # <<<<<<<<<<<<<<
14566  *         if ret != 0: return ret
14567  *
14568  */
14569   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_resource); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
14570   __Pyx_GOTREF(__pyx_t_2);
14571   __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_t_2);
14572   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14573 
14574   /* "ddtrace/internal/_encoding.pyx":684
14575  *         if ret != 0: return ret
14576  *         ret = self._pack_string(span.resource)
14577  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14578  *
14579  *         _ = span.trace_id
14580  */
14581   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14582   if (__pyx_t_1) {
14583     __pyx_r = __pyx_v_ret;
14584     goto __pyx_L0;
14585   }
14586 
14587   /* "ddtrace/internal/_encoding.pyx":686
14588  *         if ret != 0: return ret
14589  *
14590  *         _ = span.trace_id             # <<<<<<<<<<<<<<
14591  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14592  *         if ret != 0: return ret
14593  */
14594   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_trace_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
14595   __Pyx_GOTREF(__pyx_t_2);
14596   __pyx_v__ = __pyx_t_2;
14597   __pyx_t_2 = 0;
14598 
14599   /* "ddtrace/internal/_encoding.pyx":687
14600  *
14601  *         _ = span.trace_id
14602  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14603  *         if ret != 0: return ret
14604  *
14605  */
14606   __pyx_t_1 = (__pyx_v__ != Py_None);
14607   if ((__pyx_t_1 != 0)) {
14608     __pyx_t_4 = __Pyx_PyInt_As_uint64_t(__pyx_v__); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error)
14609     __pyx_t_3 = __pyx_t_4;
14610   } else {
14611     __pyx_t_3 = 0;
14612   }
14613   __pyx_v_ret = msgpack_pack_uint64((&__pyx_v_self->__pyx_base.pk), __pyx_t_3);
14614 
14615   /* "ddtrace/internal/_encoding.pyx":688
14616  *         _ = span.trace_id
14617  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14618  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14619  *
14620  *         _ = span.span_id
14621  */
14622   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14623   if (__pyx_t_1) {
14624     __pyx_r = __pyx_v_ret;
14625     goto __pyx_L0;
14626   }
14627 
14628   /* "ddtrace/internal/_encoding.pyx":690
14629  *         if ret != 0: return ret
14630  *
14631  *         _ = span.span_id             # <<<<<<<<<<<<<<
14632  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14633  *         if ret != 0: return ret
14634  */
14635   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_span_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
14636   __Pyx_GOTREF(__pyx_t_2);
14637   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
14638   __pyx_t_2 = 0;
14639 
14640   /* "ddtrace/internal/_encoding.pyx":691
14641  *
14642  *         _ = span.span_id
14643  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14644  *         if ret != 0: return ret
14645  *
14646  */
14647   __pyx_t_1 = (__pyx_v__ != Py_None);
14648   if ((__pyx_t_1 != 0)) {
14649     __pyx_t_4 = __Pyx_PyInt_As_uint64_t(__pyx_v__); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
14650     __pyx_t_3 = __pyx_t_4;
14651   } else {
14652     __pyx_t_3 = 0;
14653   }
14654   __pyx_v_ret = msgpack_pack_uint64((&__pyx_v_self->__pyx_base.pk), __pyx_t_3);
14655 
14656   /* "ddtrace/internal/_encoding.pyx":692
14657  *         _ = span.span_id
14658  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14659  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14660  *
14661  *         _ = span.parent_id
14662  */
14663   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14664   if (__pyx_t_1) {
14665     __pyx_r = __pyx_v_ret;
14666     goto __pyx_L0;
14667   }
14668 
14669   /* "ddtrace/internal/_encoding.pyx":694
14670  *         if ret != 0: return ret
14671  *
14672  *         _ = span.parent_id             # <<<<<<<<<<<<<<
14673  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14674  *         if ret != 0: return ret
14675  */
14676   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_parent_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
14677   __Pyx_GOTREF(__pyx_t_2);
14678   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
14679   __pyx_t_2 = 0;
14680 
14681   /* "ddtrace/internal/_encoding.pyx":695
14682  *
14683  *         _ = span.parent_id
14684  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14685  *         if ret != 0: return ret
14686  *
14687  */
14688   __pyx_t_1 = (__pyx_v__ != Py_None);
14689   if ((__pyx_t_1 != 0)) {
14690     __pyx_t_4 = __Pyx_PyInt_As_uint64_t(__pyx_v__); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L1_error)
14691     __pyx_t_3 = __pyx_t_4;
14692   } else {
14693     __pyx_t_3 = 0;
14694   }
14695   __pyx_v_ret = msgpack_pack_uint64((&__pyx_v_self->__pyx_base.pk), __pyx_t_3);
14696 
14697   /* "ddtrace/internal/_encoding.pyx":696
14698  *         _ = span.parent_id
14699  *         ret = msgpack_pack_uint64(&self.pk, _ if _ is not None else 0)
14700  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14701  *
14702  *         _ = span.start_ns
14703  */
14704   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14705   if (__pyx_t_1) {
14706     __pyx_r = __pyx_v_ret;
14707     goto __pyx_L0;
14708   }
14709 
14710   /* "ddtrace/internal/_encoding.pyx":698
14711  *         if ret != 0: return ret
14712  *
14713  *         _ = span.start_ns             # <<<<<<<<<<<<<<
14714  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)
14715  *         if ret != 0: return ret
14716  */
14717   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_start_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
14718   __Pyx_GOTREF(__pyx_t_2);
14719   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
14720   __pyx_t_2 = 0;
14721 
14722   /* "ddtrace/internal/_encoding.pyx":699
14723  *
14724  *         _ = span.start_ns
14725  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14726  *         if ret != 0: return ret
14727  *
14728  */
14729   __pyx_t_1 = (__pyx_v__ != Py_None);
14730   if ((__pyx_t_1 != 0)) {
14731     __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_v__); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L1_error)
14732     __pyx_t_5 = __pyx_t_6;
14733   } else {
14734     __pyx_t_5 = 0;
14735   }
14736   __pyx_v_ret = msgpack_pack_int64((&__pyx_v_self->__pyx_base.pk), __pyx_t_5);
14737 
14738   /* "ddtrace/internal/_encoding.pyx":700
14739  *         _ = span.start_ns
14740  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)
14741  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14742  *
14743  *         _ = span.duration_ns
14744  */
14745   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14746   if (__pyx_t_1) {
14747     __pyx_r = __pyx_v_ret;
14748     goto __pyx_L0;
14749   }
14750 
14751   /* "ddtrace/internal/_encoding.pyx":702
14752  *         if ret != 0: return ret
14753  *
14754  *         _ = span.duration_ns             # <<<<<<<<<<<<<<
14755  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)
14756  *         if ret != 0: return ret
14757  */
14758   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_duration_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
14759   __Pyx_GOTREF(__pyx_t_2);
14760   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
14761   __pyx_t_2 = 0;
14762 
14763   /* "ddtrace/internal/_encoding.pyx":703
14764  *
14765  *         _ = span.duration_ns
14766  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14767  *         if ret != 0: return ret
14768  *
14769  */
14770   __pyx_t_1 = (__pyx_v__ != Py_None);
14771   if ((__pyx_t_1 != 0)) {
14772     __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_v__); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 703, __pyx_L1_error)
14773     __pyx_t_5 = __pyx_t_6;
14774   } else {
14775     __pyx_t_5 = 0;
14776   }
14777   __pyx_v_ret = msgpack_pack_int64((&__pyx_v_self->__pyx_base.pk), __pyx_t_5);
14778 
14779   /* "ddtrace/internal/_encoding.pyx":704
14780  *         _ = span.duration_ns
14781  *         ret = msgpack_pack_int64(&self.pk, _ if _ is not None else 0)
14782  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14783  *
14784  *         _ = span.error
14785  */
14786   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14787   if (__pyx_t_1) {
14788     __pyx_r = __pyx_v_ret;
14789     goto __pyx_L0;
14790   }
14791 
14792   /* "ddtrace/internal/_encoding.pyx":706
14793  *         if ret != 0: return ret
14794  *
14795  *         _ = span.error             # <<<<<<<<<<<<<<
14796  *         ret = msgpack_pack_int32(&self.pk, _ if _ is not None else 0)
14797  *         if ret != 0: return ret
14798  */
14799   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error)
14800   __Pyx_GOTREF(__pyx_t_2);
14801   __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
14802   __pyx_t_2 = 0;
14803 
14804   /* "ddtrace/internal/_encoding.pyx":707
14805  *
14806  *         _ = span.error
14807  *         ret = msgpack_pack_int32(&self.pk, _ if _ is not None else 0)             # <<<<<<<<<<<<<<
14808  *         if ret != 0: return ret
14809  *
14810  */
14811   __pyx_t_1 = (__pyx_v__ != Py_None);
14812   if ((__pyx_t_1 != 0)) {
14813     __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_v__); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 707, __pyx_L1_error)
14814     __pyx_t_7 = __pyx_t_8;
14815   } else {
14816     __pyx_t_7 = 0;
14817   }
14818   __pyx_v_ret = msgpack_pack_int32((&__pyx_v_self->__pyx_base.pk), __pyx_t_7);
14819 
14820   /* "ddtrace/internal/_encoding.pyx":708
14821  *         _ = span.error
14822  *         ret = msgpack_pack_int32(&self.pk, _ if _ is not None else 0)
14823  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14824  *
14825  *         ret = msgpack_pack_map(&self.pk, len(span.meta) + (dd_origin is not NULL))
14826  */
14827   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14828   if (__pyx_t_1) {
14829     __pyx_r = __pyx_v_ret;
14830     goto __pyx_L0;
14831   }
14832 
14833   /* "ddtrace/internal/_encoding.pyx":710
14834  *         if ret != 0: return ret
14835  *
14836  *         ret = msgpack_pack_map(&self.pk, len(span.meta) + (dd_origin is not NULL))             # <<<<<<<<<<<<<<
14837  *         if ret != 0: return ret
14838  *         if span.meta:
14839  */
14840   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_meta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L1_error)
14841   __Pyx_GOTREF(__pyx_t_2);
14842   __pyx_t_9 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 710, __pyx_L1_error)
14843   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14844   __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->__pyx_base.pk), (__pyx_t_9 + (__pyx_v_dd_origin != NULL)));
14845 
14846   /* "ddtrace/internal/_encoding.pyx":711
14847  *
14848  *         ret = msgpack_pack_map(&self.pk, len(span.meta) + (dd_origin is not NULL))
14849  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
14850  *         if span.meta:
14851  *             for k, v in span.meta.items():
14852  */
14853   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
14854   if (__pyx_t_1) {
14855     __pyx_r = __pyx_v_ret;
14856     goto __pyx_L0;
14857   }
14858 
14859   /* "ddtrace/internal/_encoding.pyx":712
14860  *         ret = msgpack_pack_map(&self.pk, len(span.meta) + (dd_origin is not NULL))
14861  *         if ret != 0: return ret
14862  *         if span.meta:             # <<<<<<<<<<<<<<
14863  *             for k, v in span.meta.items():
14864  *                 ret = self._pack_string(k)
14865  */
14866   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_meta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
14867   __Pyx_GOTREF(__pyx_t_2);
14868   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 712, __pyx_L1_error)
14869   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14870   if (__pyx_t_1) {
14871 
14872     /* "ddtrace/internal/_encoding.pyx":713
14873  *         if ret != 0: return ret
14874  *         if span.meta:
14875  *             for k, v in span.meta.items():             # <<<<<<<<<<<<<<
14876  *                 ret = self._pack_string(k)
14877  *                 if ret != 0: return ret
14878  */
14879     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_meta); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 713, __pyx_L1_error)
14880     __Pyx_GOTREF(__pyx_t_10);
14881     __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_items); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 713, __pyx_L1_error)
14882     __Pyx_GOTREF(__pyx_t_11);
14883     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14884     __pyx_t_10 = NULL;
14885     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
14886       __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
14887       if (likely(__pyx_t_10)) {
14888         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
14889         __Pyx_INCREF(__pyx_t_10);
14890         __Pyx_INCREF(function);
14891         __Pyx_DECREF_SET(__pyx_t_11, function);
14892       }
14893     }
14894     __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
14895     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14896     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
14897     __Pyx_GOTREF(__pyx_t_2);
14898     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14899     if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
14900       __pyx_t_11 = __pyx_t_2; __Pyx_INCREF(__pyx_t_11); __pyx_t_9 = 0;
14901       __pyx_t_12 = NULL;
14902     } else {
14903       __pyx_t_9 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 713, __pyx_L1_error)
14904       __Pyx_GOTREF(__pyx_t_11);
14905       __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 713, __pyx_L1_error)
14906     }
14907     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14908     for (;;) {
14909       if (likely(!__pyx_t_12)) {
14910         if (likely(PyList_CheckExact(__pyx_t_11))) {
14911           if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_11)) break;
14912           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14913           __pyx_t_2 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 713, __pyx_L1_error)
14914           #else
14915           __pyx_t_2 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
14916           __Pyx_GOTREF(__pyx_t_2);
14917           #endif
14918         } else {
14919           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
14920           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14921           __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 713, __pyx_L1_error)
14922           #else
14923           __pyx_t_2 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
14924           __Pyx_GOTREF(__pyx_t_2);
14925           #endif
14926         }
14927       } else {
14928         __pyx_t_2 = __pyx_t_12(__pyx_t_11);
14929         if (unlikely(!__pyx_t_2)) {
14930           PyObject* exc_type = PyErr_Occurred();
14931           if (exc_type) {
14932             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14933             else __PYX_ERR(0, 713, __pyx_L1_error)
14934           }
14935           break;
14936         }
14937         __Pyx_GOTREF(__pyx_t_2);
14938       }
14939       if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
14940         PyObject* sequence = __pyx_t_2;
14941         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14942         if (unlikely(size != 2)) {
14943           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14944           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14945           __PYX_ERR(0, 713, __pyx_L1_error)
14946         }
14947         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14948         if (likely(PyTuple_CheckExact(sequence))) {
14949           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
14950           __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
14951         } else {
14952           __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
14953           __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
14954         }
14955         __Pyx_INCREF(__pyx_t_10);
14956         __Pyx_INCREF(__pyx_t_13);
14957         #else
14958         __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 713, __pyx_L1_error)
14959         __Pyx_GOTREF(__pyx_t_10);
14960         __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 713, __pyx_L1_error)
14961         __Pyx_GOTREF(__pyx_t_13);
14962         #endif
14963         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14964       } else {
14965         Py_ssize_t index = -1;
14966         __pyx_t_14 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 713, __pyx_L1_error)
14967         __Pyx_GOTREF(__pyx_t_14);
14968         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14969         __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
14970         index = 0; __pyx_t_10 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
14971         __Pyx_GOTREF(__pyx_t_10);
14972         index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L17_unpacking_failed;
14973         __Pyx_GOTREF(__pyx_t_13);
14974         if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 713, __pyx_L1_error)
14975         __pyx_t_15 = NULL;
14976         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
14977         goto __pyx_L18_unpacking_done;
14978         __pyx_L17_unpacking_failed:;
14979         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
14980         __pyx_t_15 = NULL;
14981         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14982         __PYX_ERR(0, 713, __pyx_L1_error)
14983         __pyx_L18_unpacking_done:;
14984       }
14985       __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_10);
14986       __pyx_t_10 = 0;
14987       __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_13);
14988       __pyx_t_13 = 0;
14989 
14990       /* "ddtrace/internal/_encoding.pyx":714
14991  *         if span.meta:
14992  *             for k, v in span.meta.items():
14993  *                 ret = self._pack_string(k)             # <<<<<<<<<<<<<<
14994  *                 if ret != 0: return ret
14995  *                 ret = self._pack_string(v)
14996  */
14997       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_v_k);
14998 
14999       /* "ddtrace/internal/_encoding.pyx":715
15000  *             for k, v in span.meta.items():
15001  *                 ret = self._pack_string(k)
15002  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
15003  *                 ret = self._pack_string(v)
15004  *                 if ret != 0: return ret
15005  */
15006       __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15007       if (__pyx_t_1) {
15008         __pyx_r = __pyx_v_ret;
15009         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15010         goto __pyx_L0;
15011       }
15012 
15013       /* "ddtrace/internal/_encoding.pyx":716
15014  *                 ret = self._pack_string(k)
15015  *                 if ret != 0: return ret
15016  *                 ret = self._pack_string(v)             # <<<<<<<<<<<<<<
15017  *                 if ret != 0: return ret
15018  *         if dd_origin is not NULL:
15019  */
15020       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_v_v);
15021 
15022       /* "ddtrace/internal/_encoding.pyx":717
15023  *                 if ret != 0: return ret
15024  *                 ret = self._pack_string(v)
15025  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
15026  *         if dd_origin is not NULL:
15027  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)
15028  */
15029       __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15030       if (__pyx_t_1) {
15031         __pyx_r = __pyx_v_ret;
15032         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15033         goto __pyx_L0;
15034       }
15035 
15036       /* "ddtrace/internal/_encoding.pyx":713
15037  *         if ret != 0: return ret
15038  *         if span.meta:
15039  *             for k, v in span.meta.items():             # <<<<<<<<<<<<<<
15040  *                 ret = self._pack_string(k)
15041  *                 if ret != 0: return ret
15042  */
15043     }
15044     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15045 
15046     /* "ddtrace/internal/_encoding.pyx":712
15047  *         ret = msgpack_pack_map(&self.pk, len(span.meta) + (dd_origin is not NULL))
15048  *         if ret != 0: return ret
15049  *         if span.meta:             # <<<<<<<<<<<<<<
15050  *             for k, v in span.meta.items():
15051  *                 ret = self._pack_string(k)
15052  */
15053   }
15054 
15055   /* "ddtrace/internal/_encoding.pyx":718
15056  *                 ret = self._pack_string(v)
15057  *                 if ret != 0: return ret
15058  *         if dd_origin is not NULL:             # <<<<<<<<<<<<<<
15059  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)
15060  *             if ret != 0: return ret
15061  */
15062   __pyx_t_1 = ((__pyx_v_dd_origin != NULL) != 0);
15063   if (__pyx_t_1) {
15064 
15065     /* "ddtrace/internal/_encoding.pyx":719
15066  *                 if ret != 0: return ret
15067  *         if dd_origin is not NULL:
15068  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)             # <<<<<<<<<<<<<<
15069  *             if ret != 0: return ret
15070  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> dd_origin)
15071  */
15072     __pyx_v_ret = msgpack_pack_uint32((&__pyx_v_self->__pyx_base.pk), ((uint32_t)1));
15073 
15074     /* "ddtrace/internal/_encoding.pyx":720
15075  *         if dd_origin is not NULL:
15076  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)
15077  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
15078  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> dd_origin)
15079  *             if ret != 0: return ret
15080  */
15081     __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15082     if (__pyx_t_1) {
15083       __pyx_r = __pyx_v_ret;
15084       goto __pyx_L0;
15085     }
15086 
15087     /* "ddtrace/internal/_encoding.pyx":721
15088  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)
15089  *             if ret != 0: return ret
15090  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> dd_origin)             # <<<<<<<<<<<<<<
15091  *             if ret != 0: return ret
15092  *
15093  */
15094     __pyx_v_ret = msgpack_pack_uint32((&__pyx_v_self->__pyx_base.pk), ((uint32_t)__pyx_v_dd_origin));
15095 
15096     /* "ddtrace/internal/_encoding.pyx":722
15097  *             if ret != 0: return ret
15098  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> dd_origin)
15099  *             if ret != 0: return ret             # <<<<<<<<<<<<<<
15100  *
15101  *         ret = msgpack_pack_map(&self.pk, len(span.metrics))
15102  */
15103     __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15104     if (__pyx_t_1) {
15105       __pyx_r = __pyx_v_ret;
15106       goto __pyx_L0;
15107     }
15108 
15109     /* "ddtrace/internal/_encoding.pyx":718
15110  *                 ret = self._pack_string(v)
15111  *                 if ret != 0: return ret
15112  *         if dd_origin is not NULL:             # <<<<<<<<<<<<<<
15113  *             ret = msgpack_pack_uint32(&self.pk, <stdint.uint32_t> 1)
15114  *             if ret != 0: return ret
15115  */
15116   }
15117 
15118   /* "ddtrace/internal/_encoding.pyx":724
15119  *             if ret != 0: return ret
15120  *
15121  *         ret = msgpack_pack_map(&self.pk, len(span.metrics))             # <<<<<<<<<<<<<<
15122  *         if ret != 0: return ret
15123  *         if span.metrics:
15124  */
15125   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_metrics); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 724, __pyx_L1_error)
15126   __Pyx_GOTREF(__pyx_t_11);
15127   __pyx_t_9 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 724, __pyx_L1_error)
15128   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15129   __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->__pyx_base.pk), __pyx_t_9);
15130 
15131   /* "ddtrace/internal/_encoding.pyx":725
15132  *
15133  *         ret = msgpack_pack_map(&self.pk, len(span.metrics))
15134  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
15135  *         if span.metrics:
15136  *             for k, v in span.metrics.items():
15137  */
15138   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15139   if (__pyx_t_1) {
15140     __pyx_r = __pyx_v_ret;
15141     goto __pyx_L0;
15142   }
15143 
15144   /* "ddtrace/internal/_encoding.pyx":726
15145  *         ret = msgpack_pack_map(&self.pk, len(span.metrics))
15146  *         if ret != 0: return ret
15147  *         if span.metrics:             # <<<<<<<<<<<<<<
15148  *             for k, v in span.metrics.items():
15149  *                 ret = self._pack_string(k)
15150  */
15151   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_metrics); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 726, __pyx_L1_error)
15152   __Pyx_GOTREF(__pyx_t_11);
15153   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 726, __pyx_L1_error)
15154   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15155   if (__pyx_t_1) {
15156 
15157     /* "ddtrace/internal/_encoding.pyx":727
15158  *         if ret != 0: return ret
15159  *         if span.metrics:
15160  *             for k, v in span.metrics.items():             # <<<<<<<<<<<<<<
15161  *                 ret = self._pack_string(k)
15162  *                 if ret != 0: return ret
15163  */
15164     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_metrics); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
15165     __Pyx_GOTREF(__pyx_t_2);
15166     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 727, __pyx_L1_error)
15167     __Pyx_GOTREF(__pyx_t_13);
15168     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15169     __pyx_t_2 = NULL;
15170     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
15171       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_13);
15172       if (likely(__pyx_t_2)) {
15173         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
15174         __Pyx_INCREF(__pyx_t_2);
15175         __Pyx_INCREF(function);
15176         __Pyx_DECREF_SET(__pyx_t_13, function);
15177       }
15178     }
15179     __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
15180     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15181     if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 727, __pyx_L1_error)
15182     __Pyx_GOTREF(__pyx_t_11);
15183     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15184     if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
15185       __pyx_t_13 = __pyx_t_11; __Pyx_INCREF(__pyx_t_13); __pyx_t_9 = 0;
15186       __pyx_t_12 = NULL;
15187     } else {
15188       __pyx_t_9 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 727, __pyx_L1_error)
15189       __Pyx_GOTREF(__pyx_t_13);
15190       __pyx_t_12 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 727, __pyx_L1_error)
15191     }
15192     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15193     for (;;) {
15194       if (likely(!__pyx_t_12)) {
15195         if (likely(PyList_CheckExact(__pyx_t_13))) {
15196           if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_13)) break;
15197           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15198           __pyx_t_11 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 727, __pyx_L1_error)
15199           #else
15200           __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 727, __pyx_L1_error)
15201           __Pyx_GOTREF(__pyx_t_11);
15202           #endif
15203         } else {
15204           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
15205           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15206           __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 727, __pyx_L1_error)
15207           #else
15208           __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 727, __pyx_L1_error)
15209           __Pyx_GOTREF(__pyx_t_11);
15210           #endif
15211         }
15212       } else {
15213         __pyx_t_11 = __pyx_t_12(__pyx_t_13);
15214         if (unlikely(!__pyx_t_11)) {
15215           PyObject* exc_type = PyErr_Occurred();
15216           if (exc_type) {
15217             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15218             else __PYX_ERR(0, 727, __pyx_L1_error)
15219           }
15220           break;
15221         }
15222         __Pyx_GOTREF(__pyx_t_11);
15223       }
15224       if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
15225         PyObject* sequence = __pyx_t_11;
15226         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
15227         if (unlikely(size != 2)) {
15228           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
15229           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
15230           __PYX_ERR(0, 727, __pyx_L1_error)
15231         }
15232         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15233         if (likely(PyTuple_CheckExact(sequence))) {
15234           __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
15235           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
15236         } else {
15237           __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
15238           __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
15239         }
15240         __Pyx_INCREF(__pyx_t_2);
15241         __Pyx_INCREF(__pyx_t_10);
15242         #else
15243         __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
15244         __Pyx_GOTREF(__pyx_t_2);
15245         __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 727, __pyx_L1_error)
15246         __Pyx_GOTREF(__pyx_t_10);
15247         #endif
15248         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15249       } else {
15250         Py_ssize_t index = -1;
15251         __pyx_t_14 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 727, __pyx_L1_error)
15252         __Pyx_GOTREF(__pyx_t_14);
15253         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15254         __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
15255         index = 0; __pyx_t_2 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_2)) goto __pyx_L28_unpacking_failed;
15256         __Pyx_GOTREF(__pyx_t_2);
15257         index = 1; __pyx_t_10 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L28_unpacking_failed;
15258         __Pyx_GOTREF(__pyx_t_10);
15259         if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 727, __pyx_L1_error)
15260         __pyx_t_15 = NULL;
15261         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
15262         goto __pyx_L29_unpacking_done;
15263         __pyx_L28_unpacking_failed:;
15264         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
15265         __pyx_t_15 = NULL;
15266         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
15267         __PYX_ERR(0, 727, __pyx_L1_error)
15268         __pyx_L29_unpacking_done:;
15269       }
15270       __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2);
15271       __pyx_t_2 = 0;
15272       __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_10);
15273       __pyx_t_10 = 0;
15274 
15275       /* "ddtrace/internal/_encoding.pyx":728
15276  *         if span.metrics:
15277  *             for k, v in span.metrics.items():
15278  *                 ret = self._pack_string(k)             # <<<<<<<<<<<<<<
15279  *                 if ret != 0: return ret
15280  *                 ret = pack_number(&self.pk, v)
15281  */
15282       __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_v_k);
15283 
15284       /* "ddtrace/internal/_encoding.pyx":729
15285  *             for k, v in span.metrics.items():
15286  *                 ret = self._pack_string(k)
15287  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
15288  *                 ret = pack_number(&self.pk, v)
15289  *                 if ret != 0: return ret
15290  */
15291       __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15292       if (__pyx_t_1) {
15293         __pyx_r = __pyx_v_ret;
15294         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15295         goto __pyx_L0;
15296       }
15297 
15298       /* "ddtrace/internal/_encoding.pyx":730
15299  *                 ret = self._pack_string(k)
15300  *                 if ret != 0: return ret
15301  *                 ret = pack_number(&self.pk, v)             # <<<<<<<<<<<<<<
15302  *                 if ret != 0: return ret
15303  *
15304  */
15305       __pyx_t_16 = __pyx_f_7ddtrace_8internal_9_encoding_pack_number((&__pyx_v_self->__pyx_base.pk), __pyx_v_v); if (unlikely(__pyx_t_16 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L1_error)
15306       __pyx_v_ret = __pyx_t_16;
15307 
15308       /* "ddtrace/internal/_encoding.pyx":731
15309  *                 if ret != 0: return ret
15310  *                 ret = pack_number(&self.pk, v)
15311  *                 if ret != 0: return ret             # <<<<<<<<<<<<<<
15312  *
15313  *         ret = self._pack_string(span.span_type)
15314  */
15315       __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15316       if (__pyx_t_1) {
15317         __pyx_r = __pyx_v_ret;
15318         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15319         goto __pyx_L0;
15320       }
15321 
15322       /* "ddtrace/internal/_encoding.pyx":727
15323  *         if ret != 0: return ret
15324  *         if span.metrics:
15325  *             for k, v in span.metrics.items():             # <<<<<<<<<<<<<<
15326  *                 ret = self._pack_string(k)
15327  *                 if ret != 0: return ret
15328  */
15329     }
15330     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15331 
15332     /* "ddtrace/internal/_encoding.pyx":726
15333  *         ret = msgpack_pack_map(&self.pk, len(span.metrics))
15334  *         if ret != 0: return ret
15335  *         if span.metrics:             # <<<<<<<<<<<<<<
15336  *             for k, v in span.metrics.items():
15337  *                 ret = self._pack_string(k)
15338  */
15339   }
15340 
15341   /* "ddtrace/internal/_encoding.pyx":733
15342  *                 if ret != 0: return ret
15343  *
15344  *         ret = self._pack_string(span.span_type)             # <<<<<<<<<<<<<<
15345  *         if ret != 0: return ret
15346  *
15347  */
15348   __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_n_s_span_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 733, __pyx_L1_error)
15349   __Pyx_GOTREF(__pyx_t_13);
15350   __pyx_v_ret = __pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string(__pyx_v_self, __pyx_t_13);
15351   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15352 
15353   /* "ddtrace/internal/_encoding.pyx":734
15354  *
15355  *         ret = self._pack_string(span.span_type)
15356  *         if ret != 0: return ret             # <<<<<<<<<<<<<<
15357  *
15358  *         return 0
15359  */
15360   __pyx_t_1 = ((__pyx_v_ret != 0) != 0);
15361   if (__pyx_t_1) {
15362     __pyx_r = __pyx_v_ret;
15363     goto __pyx_L0;
15364   }
15365 
15366   /* "ddtrace/internal/_encoding.pyx":736
15367  *         if ret != 0: return ret
15368  *
15369  *         return 0             # <<<<<<<<<<<<<<
15370  */
15371   __pyx_r = 0;
15372   goto __pyx_L0;
15373 
15374   /* "ddtrace/internal/_encoding.pyx":673
15375  *         return <void *> PyLong_AsLong(self._st._index(dd_origin))
15376  *
15377  *     cdef int pack_span(self, object span, void *dd_origin) except? -1:             # <<<<<<<<<<<<<<
15378  *         cdef int ret
15379  *
15380  */
15381 
15382   /* function exit code */
15383   __pyx_L1_error:;
15384   __Pyx_XDECREF(__pyx_t_2);
15385   __Pyx_XDECREF(__pyx_t_10);
15386   __Pyx_XDECREF(__pyx_t_11);
15387   __Pyx_XDECREF(__pyx_t_13);
15388   __Pyx_XDECREF(__pyx_t_14);
15389   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.pack_span", __pyx_clineno, __pyx_lineno, __pyx_filename);
15390   __pyx_r = -1;
15391   __pyx_L0:;
15392   __Pyx_XDECREF(__pyx_v__);
15393   __Pyx_XDECREF(__pyx_v_k);
15394   __Pyx_XDECREF(__pyx_v_v);
15395   __Pyx_RefNannyFinishContext();
15396   return __pyx_r;
15397 }
15398 
15399 /* "(tree fragment)":1
15400  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15401  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15402  * def __setstate_cython__(self, __pyx_state):
15403  */
15404 
15405 /* Python wrapper */
15406 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_7__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15407 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15408   PyObject *__pyx_r = 0;
15409   __Pyx_RefNannyDeclarations
15410   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15411   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_6__reduce_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self));
15412 
15413   /* function exit code */
15414   __Pyx_RefNannyFinishContext();
15415   return __pyx_r;
15416 }
15417 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self)15418 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self) {
15419   PyObject *__pyx_r = NULL;
15420   __Pyx_RefNannyDeclarations
15421   PyObject *__pyx_t_1 = NULL;
15422   int __pyx_lineno = 0;
15423   const char *__pyx_filename = NULL;
15424   int __pyx_clineno = 0;
15425   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15426 
15427   /* "(tree fragment)":2
15428  * def __reduce_cython__(self):
15429  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15430  * def __setstate_cython__(self, __pyx_state):
15431  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15432  */
15433   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
15434   __Pyx_GOTREF(__pyx_t_1);
15435   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15436   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15437   __PYX_ERR(1, 2, __pyx_L1_error)
15438 
15439   /* "(tree fragment)":1
15440  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15441  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15442  * def __setstate_cython__(self, __pyx_state):
15443  */
15444 
15445   /* function exit code */
15446   __pyx_L1_error:;
15447   __Pyx_XDECREF(__pyx_t_1);
15448   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15449   __pyx_r = NULL;
15450   __Pyx_XGIVEREF(__pyx_r);
15451   __Pyx_RefNannyFinishContext();
15452   return __pyx_r;
15453 }
15454 
15455 /* "(tree fragment)":3
15456  * def __reduce_cython__(self):
15457  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15458  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15459  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15460  */
15461 
15462 /* Python wrapper */
15463 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_9__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)15464 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
15465   PyObject *__pyx_r = 0;
15466   __Pyx_RefNannyDeclarations
15467   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
15468   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_8__setstate_cython__(((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
15469 
15470   /* function exit code */
15471   __Pyx_RefNannyFinishContext();
15472   return __pyx_r;
15473 }
15474 
__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)15475 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
15476   PyObject *__pyx_r = NULL;
15477   __Pyx_RefNannyDeclarations
15478   PyObject *__pyx_t_1 = NULL;
15479   int __pyx_lineno = 0;
15480   const char *__pyx_filename = NULL;
15481   int __pyx_clineno = 0;
15482   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
15483 
15484   /* "(tree fragment)":4
15485  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15486  * def __setstate_cython__(self, __pyx_state):
15487  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15488  */
15489   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
15490   __Pyx_GOTREF(__pyx_t_1);
15491   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15492   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15493   __PYX_ERR(1, 4, __pyx_L1_error)
15494 
15495   /* "(tree fragment)":3
15496  * def __reduce_cython__(self):
15497  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15498  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15499  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15500  */
15501 
15502   /* function exit code */
15503   __pyx_L1_error:;
15504   __Pyx_XDECREF(__pyx_t_1);
15505   __Pyx_AddTraceback("ddtrace.internal._encoding.MsgpackEncoderV05.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15506   __pyx_r = NULL;
15507   __Pyx_XGIVEREF(__pyx_r);
15508   __Pyx_RefNannyFinishContext();
15509   return __pyx_r;
15510 }
15511 
15512 /* "(tree fragment)":1
15513  * def __pyx_unpickle_StringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
15514  *     cdef object __pyx_PickleError
15515  *     cdef object __pyx_result
15516  */
15517 
15518 /* Python wrapper */
15519 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15520 static PyMethodDef __pyx_mdef_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable = {"__pyx_unpickle_StringTable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15521 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15522   PyObject *__pyx_v___pyx_type = 0;
15523   long __pyx_v___pyx_checksum;
15524   PyObject *__pyx_v___pyx_state = 0;
15525   int __pyx_lineno = 0;
15526   const char *__pyx_filename = NULL;
15527   int __pyx_clineno = 0;
15528   PyObject *__pyx_r = 0;
15529   __Pyx_RefNannyDeclarations
15530   __Pyx_RefNannySetupContext("__pyx_unpickle_StringTable (wrapper)", 0);
15531   {
15532     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
15533     PyObject* values[3] = {0,0,0};
15534     if (unlikely(__pyx_kwds)) {
15535       Py_ssize_t kw_args;
15536       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15537       switch (pos_args) {
15538         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15539         CYTHON_FALLTHROUGH;
15540         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15541         CYTHON_FALLTHROUGH;
15542         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15543         CYTHON_FALLTHROUGH;
15544         case  0: break;
15545         default: goto __pyx_L5_argtuple_error;
15546       }
15547       kw_args = PyDict_Size(__pyx_kwds);
15548       switch (pos_args) {
15549         case  0:
15550         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
15551         else goto __pyx_L5_argtuple_error;
15552         CYTHON_FALLTHROUGH;
15553         case  1:
15554         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
15555         else {
15556           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_StringTable", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
15557         }
15558         CYTHON_FALLTHROUGH;
15559         case  2:
15560         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
15561         else {
15562           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_StringTable", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
15563         }
15564       }
15565       if (unlikely(kw_args > 0)) {
15566         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_StringTable") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
15567       }
15568     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
15569       goto __pyx_L5_argtuple_error;
15570     } else {
15571       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15572       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15573       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15574     }
15575     __pyx_v___pyx_type = values[0];
15576     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
15577     __pyx_v___pyx_state = values[2];
15578   }
15579   goto __pyx_L4_argument_unpacking_done;
15580   __pyx_L5_argtuple_error:;
15581   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_StringTable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
15582   __pyx_L3_error:;
15583   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_StringTable", __pyx_clineno, __pyx_lineno, __pyx_filename);
15584   __Pyx_RefNannyFinishContext();
15585   return NULL;
15586   __pyx_L4_argument_unpacking_done:;
15587   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
15588 
15589   /* function exit code */
15590   __Pyx_RefNannyFinishContext();
15591   return __pyx_r;
15592 }
15593 
__pyx_pf_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)15594 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
15595   PyObject *__pyx_v___pyx_PickleError = 0;
15596   PyObject *__pyx_v___pyx_result = 0;
15597   PyObject *__pyx_r = NULL;
15598   __Pyx_RefNannyDeclarations
15599   int __pyx_t_1;
15600   PyObject *__pyx_t_2 = NULL;
15601   PyObject *__pyx_t_3 = NULL;
15602   PyObject *__pyx_t_4 = NULL;
15603   PyObject *__pyx_t_5 = NULL;
15604   int __pyx_t_6;
15605   int __pyx_lineno = 0;
15606   const char *__pyx_filename = NULL;
15607   int __pyx_clineno = 0;
15608   __Pyx_RefNannySetupContext("__pyx_unpickle_StringTable", 0);
15609 
15610   /* "(tree fragment)":4
15611  *     cdef object __pyx_PickleError
15612  *     cdef object __pyx_result
15613  *     if __pyx_checksum != 0xb9d0cd9:             # <<<<<<<<<<<<<<
15614  *         from pickle import PickleError as __pyx_PickleError
15615  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15616  */
15617   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb9d0cd9) != 0);
15618   if (__pyx_t_1) {
15619 
15620     /* "(tree fragment)":5
15621  *     cdef object __pyx_result
15622  *     if __pyx_checksum != 0xb9d0cd9:
15623  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
15624  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15625  *     __pyx_result = StringTable.__new__(__pyx_type)
15626  */
15627     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
15628     __Pyx_GOTREF(__pyx_t_2);
15629     __Pyx_INCREF(__pyx_n_s_PickleError);
15630     __Pyx_GIVEREF(__pyx_n_s_PickleError);
15631     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
15632     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
15633     __Pyx_GOTREF(__pyx_t_3);
15634     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15635     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
15636     __Pyx_GOTREF(__pyx_t_2);
15637     __Pyx_INCREF(__pyx_t_2);
15638     __pyx_v___pyx_PickleError = __pyx_t_2;
15639     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15640     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15641 
15642     /* "(tree fragment)":6
15643  *     if __pyx_checksum != 0xb9d0cd9:
15644  *         from pickle import PickleError as __pyx_PickleError
15645  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)             # <<<<<<<<<<<<<<
15646  *     __pyx_result = StringTable.__new__(__pyx_type)
15647  *     if __pyx_state is not None:
15648  */
15649     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
15650     __Pyx_GOTREF(__pyx_t_2);
15651     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
15652     __Pyx_GOTREF(__pyx_t_4);
15653     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15654     __Pyx_INCREF(__pyx_v___pyx_PickleError);
15655     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
15656     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
15657       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
15658       if (likely(__pyx_t_5)) {
15659         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15660         __Pyx_INCREF(__pyx_t_5);
15661         __Pyx_INCREF(function);
15662         __Pyx_DECREF_SET(__pyx_t_2, function);
15663       }
15664     }
15665     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
15666     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15667     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15668     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
15669     __Pyx_GOTREF(__pyx_t_3);
15670     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15671     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15672     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15673     __PYX_ERR(1, 6, __pyx_L1_error)
15674 
15675     /* "(tree fragment)":4
15676  *     cdef object __pyx_PickleError
15677  *     cdef object __pyx_result
15678  *     if __pyx_checksum != 0xb9d0cd9:             # <<<<<<<<<<<<<<
15679  *         from pickle import PickleError as __pyx_PickleError
15680  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15681  */
15682   }
15683 
15684   /* "(tree fragment)":7
15685  *         from pickle import PickleError as __pyx_PickleError
15686  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15687  *     __pyx_result = StringTable.__new__(__pyx_type)             # <<<<<<<<<<<<<<
15688  *     if __pyx_state is not None:
15689  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15690  */
15691   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_StringTable), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
15692   __Pyx_GOTREF(__pyx_t_2);
15693   __pyx_t_4 = NULL;
15694   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
15695     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
15696     if (likely(__pyx_t_4)) {
15697       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15698       __Pyx_INCREF(__pyx_t_4);
15699       __Pyx_INCREF(function);
15700       __Pyx_DECREF_SET(__pyx_t_2, function);
15701     }
15702   }
15703   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
15704   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15705   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
15706   __Pyx_GOTREF(__pyx_t_3);
15707   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15708   __pyx_v___pyx_result = __pyx_t_3;
15709   __pyx_t_3 = 0;
15710 
15711   /* "(tree fragment)":8
15712  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15713  *     __pyx_result = StringTable.__new__(__pyx_type)
15714  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
15715  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15716  *     return __pyx_result
15717  */
15718   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
15719   __pyx_t_6 = (__pyx_t_1 != 0);
15720   if (__pyx_t_6) {
15721 
15722     /* "(tree fragment)":9
15723  *     __pyx_result = StringTable.__new__(__pyx_type)
15724  *     if __pyx_state is not None:
15725  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
15726  *     return __pyx_result
15727  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):
15728  */
15729     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
15730     __pyx_t_3 = __pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable__set_state(((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
15731     __Pyx_GOTREF(__pyx_t_3);
15732     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15733 
15734     /* "(tree fragment)":8
15735  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb9d0cd9 = (_next_id, _table))" % __pyx_checksum)
15736  *     __pyx_result = StringTable.__new__(__pyx_type)
15737  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
15738  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15739  *     return __pyx_result
15740  */
15741   }
15742 
15743   /* "(tree fragment)":10
15744  *     if __pyx_state is not None:
15745  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15746  *     return __pyx_result             # <<<<<<<<<<<<<<
15747  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):
15748  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15749  */
15750   __Pyx_XDECREF(__pyx_r);
15751   __Pyx_INCREF(__pyx_v___pyx_result);
15752   __pyx_r = __pyx_v___pyx_result;
15753   goto __pyx_L0;
15754 
15755   /* "(tree fragment)":1
15756  * def __pyx_unpickle_StringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
15757  *     cdef object __pyx_PickleError
15758  *     cdef object __pyx_result
15759  */
15760 
15761   /* function exit code */
15762   __pyx_L1_error:;
15763   __Pyx_XDECREF(__pyx_t_2);
15764   __Pyx_XDECREF(__pyx_t_3);
15765   __Pyx_XDECREF(__pyx_t_4);
15766   __Pyx_XDECREF(__pyx_t_5);
15767   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_StringTable", __pyx_clineno, __pyx_lineno, __pyx_filename);
15768   __pyx_r = NULL;
15769   __pyx_L0:;
15770   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
15771   __Pyx_XDECREF(__pyx_v___pyx_result);
15772   __Pyx_XGIVEREF(__pyx_r);
15773   __Pyx_RefNannyFinishContext();
15774   return __pyx_r;
15775 }
15776 
15777 /* "(tree fragment)":11
15778  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15779  *     return __pyx_result
15780  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
15781  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15782  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
15783  */
15784 
__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)15785 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_StringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
15786   PyObject *__pyx_r = NULL;
15787   __Pyx_RefNannyDeclarations
15788   PyObject *__pyx_t_1 = NULL;
15789   uint32_t __pyx_t_2;
15790   int __pyx_t_3;
15791   Py_ssize_t __pyx_t_4;
15792   int __pyx_t_5;
15793   int __pyx_t_6;
15794   PyObject *__pyx_t_7 = NULL;
15795   PyObject *__pyx_t_8 = NULL;
15796   PyObject *__pyx_t_9 = NULL;
15797   int __pyx_lineno = 0;
15798   const char *__pyx_filename = NULL;
15799   int __pyx_clineno = 0;
15800   __Pyx_RefNannySetupContext("__pyx_unpickle_StringTable__set_state", 0);
15801 
15802   /* "(tree fragment)":12
15803  *     return __pyx_result
15804  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):
15805  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]             # <<<<<<<<<<<<<<
15806  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
15807  *         __pyx_result.__dict__.update(__pyx_state[2])
15808  */
15809   if (unlikely(__pyx_v___pyx_state == Py_None)) {
15810     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15811     __PYX_ERR(1, 12, __pyx_L1_error)
15812   }
15813   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
15814   __Pyx_GOTREF(__pyx_t_1);
15815   __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
15816   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15817   __pyx_v___pyx_result->_next_id = __pyx_t_2;
15818   if (unlikely(__pyx_v___pyx_state == Py_None)) {
15819     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15820     __PYX_ERR(1, 12, __pyx_L1_error)
15821   }
15822   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
15823   __Pyx_GOTREF(__pyx_t_1);
15824   if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
15825   __Pyx_GIVEREF(__pyx_t_1);
15826   __Pyx_GOTREF(__pyx_v___pyx_result->_table);
15827   __Pyx_DECREF(__pyx_v___pyx_result->_table);
15828   __pyx_v___pyx_result->_table = ((PyObject*)__pyx_t_1);
15829   __pyx_t_1 = 0;
15830 
15831   /* "(tree fragment)":13
15832  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):
15833  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15834  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
15835  *         __pyx_result.__dict__.update(__pyx_state[2])
15836  */
15837   if (unlikely(__pyx_v___pyx_state == Py_None)) {
15838     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
15839     __PYX_ERR(1, 13, __pyx_L1_error)
15840   }
15841   __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
15842   __pyx_t_5 = ((__pyx_t_4 > 2) != 0);
15843   if (__pyx_t_5) {
15844   } else {
15845     __pyx_t_3 = __pyx_t_5;
15846     goto __pyx_L4_bool_binop_done;
15847   }
15848   __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
15849   __pyx_t_6 = (__pyx_t_5 != 0);
15850   __pyx_t_3 = __pyx_t_6;
15851   __pyx_L4_bool_binop_done:;
15852   if (__pyx_t_3) {
15853 
15854     /* "(tree fragment)":14
15855  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15856  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
15857  *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
15858  */
15859     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
15860     __Pyx_GOTREF(__pyx_t_7);
15861     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
15862     __Pyx_GOTREF(__pyx_t_8);
15863     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15864     if (unlikely(__pyx_v___pyx_state == Py_None)) {
15865       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15866       __PYX_ERR(1, 14, __pyx_L1_error)
15867     }
15868     __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
15869     __Pyx_GOTREF(__pyx_t_7);
15870     __pyx_t_9 = NULL;
15871     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
15872       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
15873       if (likely(__pyx_t_9)) {
15874         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
15875         __Pyx_INCREF(__pyx_t_9);
15876         __Pyx_INCREF(function);
15877         __Pyx_DECREF_SET(__pyx_t_8, function);
15878       }
15879     }
15880     __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
15881     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
15882     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15883     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
15884     __Pyx_GOTREF(__pyx_t_1);
15885     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15886     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15887 
15888     /* "(tree fragment)":13
15889  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):
15890  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15891  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
15892  *         __pyx_result.__dict__.update(__pyx_state[2])
15893  */
15894   }
15895 
15896   /* "(tree fragment)":11
15897  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
15898  *     return __pyx_result
15899  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
15900  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
15901  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
15902  */
15903 
15904   /* function exit code */
15905   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15906   goto __pyx_L0;
15907   __pyx_L1_error:;
15908   __Pyx_XDECREF(__pyx_t_1);
15909   __Pyx_XDECREF(__pyx_t_7);
15910   __Pyx_XDECREF(__pyx_t_8);
15911   __Pyx_XDECREF(__pyx_t_9);
15912   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_StringTable__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
15913   __pyx_r = 0;
15914   __pyx_L0:;
15915   __Pyx_XGIVEREF(__pyx_r);
15916   __Pyx_RefNannyFinishContext();
15917   return __pyx_r;
15918 }
15919 
15920 /* "(tree fragment)":1
15921  * def __pyx_unpickle_ListStringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
15922  *     cdef object __pyx_PickleError
15923  *     cdef object __pyx_result
15924  */
15925 
15926 /* Python wrapper */
15927 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15928 static PyMethodDef __pyx_mdef_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable = {"__pyx_unpickle_ListStringTable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15929 static PyObject *__pyx_pw_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15930   PyObject *__pyx_v___pyx_type = 0;
15931   long __pyx_v___pyx_checksum;
15932   PyObject *__pyx_v___pyx_state = 0;
15933   int __pyx_lineno = 0;
15934   const char *__pyx_filename = NULL;
15935   int __pyx_clineno = 0;
15936   PyObject *__pyx_r = 0;
15937   __Pyx_RefNannyDeclarations
15938   __Pyx_RefNannySetupContext("__pyx_unpickle_ListStringTable (wrapper)", 0);
15939   {
15940     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
15941     PyObject* values[3] = {0,0,0};
15942     if (unlikely(__pyx_kwds)) {
15943       Py_ssize_t kw_args;
15944       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15945       switch (pos_args) {
15946         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15947         CYTHON_FALLTHROUGH;
15948         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15949         CYTHON_FALLTHROUGH;
15950         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15951         CYTHON_FALLTHROUGH;
15952         case  0: break;
15953         default: goto __pyx_L5_argtuple_error;
15954       }
15955       kw_args = PyDict_Size(__pyx_kwds);
15956       switch (pos_args) {
15957         case  0:
15958         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
15959         else goto __pyx_L5_argtuple_error;
15960         CYTHON_FALLTHROUGH;
15961         case  1:
15962         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
15963         else {
15964           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ListStringTable", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
15965         }
15966         CYTHON_FALLTHROUGH;
15967         case  2:
15968         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
15969         else {
15970           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ListStringTable", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
15971         }
15972       }
15973       if (unlikely(kw_args > 0)) {
15974         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ListStringTable") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
15975       }
15976     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
15977       goto __pyx_L5_argtuple_error;
15978     } else {
15979       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15980       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15981       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15982     }
15983     __pyx_v___pyx_type = values[0];
15984     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
15985     __pyx_v___pyx_state = values[2];
15986   }
15987   goto __pyx_L4_argument_unpacking_done;
15988   __pyx_L5_argtuple_error:;
15989   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ListStringTable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
15990   __pyx_L3_error:;
15991   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_ListStringTable", __pyx_clineno, __pyx_lineno, __pyx_filename);
15992   __Pyx_RefNannyFinishContext();
15993   return NULL;
15994   __pyx_L4_argument_unpacking_done:;
15995   __pyx_r = __pyx_pf_7ddtrace_8internal_9_encoding_2__pyx_unpickle_ListStringTable(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
15996 
15997   /* function exit code */
15998   __Pyx_RefNannyFinishContext();
15999   return __pyx_r;
16000 }
16001 
__pyx_pf_7ddtrace_8internal_9_encoding_2__pyx_unpickle_ListStringTable(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)16002 static PyObject *__pyx_pf_7ddtrace_8internal_9_encoding_2__pyx_unpickle_ListStringTable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
16003   PyObject *__pyx_v___pyx_PickleError = 0;
16004   PyObject *__pyx_v___pyx_result = 0;
16005   PyObject *__pyx_r = NULL;
16006   __Pyx_RefNannyDeclarations
16007   int __pyx_t_1;
16008   PyObject *__pyx_t_2 = NULL;
16009   PyObject *__pyx_t_3 = NULL;
16010   PyObject *__pyx_t_4 = NULL;
16011   PyObject *__pyx_t_5 = NULL;
16012   int __pyx_t_6;
16013   int __pyx_lineno = 0;
16014   const char *__pyx_filename = NULL;
16015   int __pyx_clineno = 0;
16016   __Pyx_RefNannySetupContext("__pyx_unpickle_ListStringTable", 0);
16017 
16018   /* "(tree fragment)":4
16019  *     cdef object __pyx_PickleError
16020  *     cdef object __pyx_result
16021  *     if __pyx_checksum != 0xae267b1:             # <<<<<<<<<<<<<<
16022  *         from pickle import PickleError as __pyx_PickleError
16023  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16024  */
16025   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xae267b1) != 0);
16026   if (__pyx_t_1) {
16027 
16028     /* "(tree fragment)":5
16029  *     cdef object __pyx_result
16030  *     if __pyx_checksum != 0xae267b1:
16031  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
16032  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16033  *     __pyx_result = ListStringTable.__new__(__pyx_type)
16034  */
16035     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
16036     __Pyx_GOTREF(__pyx_t_2);
16037     __Pyx_INCREF(__pyx_n_s_PickleError);
16038     __Pyx_GIVEREF(__pyx_n_s_PickleError);
16039     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
16040     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
16041     __Pyx_GOTREF(__pyx_t_3);
16042     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16043     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
16044     __Pyx_GOTREF(__pyx_t_2);
16045     __Pyx_INCREF(__pyx_t_2);
16046     __pyx_v___pyx_PickleError = __pyx_t_2;
16047     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16048     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16049 
16050     /* "(tree fragment)":6
16051  *     if __pyx_checksum != 0xae267b1:
16052  *         from pickle import PickleError as __pyx_PickleError
16053  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)             # <<<<<<<<<<<<<<
16054  *     __pyx_result = ListStringTable.__new__(__pyx_type)
16055  *     if __pyx_state is not None:
16056  */
16057     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
16058     __Pyx_GOTREF(__pyx_t_2);
16059     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xae, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
16060     __Pyx_GOTREF(__pyx_t_4);
16061     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16062     __Pyx_INCREF(__pyx_v___pyx_PickleError);
16063     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
16064     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
16065       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
16066       if (likely(__pyx_t_5)) {
16067         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
16068         __Pyx_INCREF(__pyx_t_5);
16069         __Pyx_INCREF(function);
16070         __Pyx_DECREF_SET(__pyx_t_2, function);
16071       }
16072     }
16073     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
16074     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16075     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16076     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
16077     __Pyx_GOTREF(__pyx_t_3);
16078     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16079     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16080     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16081     __PYX_ERR(1, 6, __pyx_L1_error)
16082 
16083     /* "(tree fragment)":4
16084  *     cdef object __pyx_PickleError
16085  *     cdef object __pyx_result
16086  *     if __pyx_checksum != 0xae267b1:             # <<<<<<<<<<<<<<
16087  *         from pickle import PickleError as __pyx_PickleError
16088  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16089  */
16090   }
16091 
16092   /* "(tree fragment)":7
16093  *         from pickle import PickleError as __pyx_PickleError
16094  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16095  *     __pyx_result = ListStringTable.__new__(__pyx_type)             # <<<<<<<<<<<<<<
16096  *     if __pyx_state is not None:
16097  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16098  */
16099   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
16100   __Pyx_GOTREF(__pyx_t_2);
16101   __pyx_t_4 = NULL;
16102   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
16103     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
16104     if (likely(__pyx_t_4)) {
16105       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
16106       __Pyx_INCREF(__pyx_t_4);
16107       __Pyx_INCREF(function);
16108       __Pyx_DECREF_SET(__pyx_t_2, function);
16109     }
16110   }
16111   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
16112   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
16113   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
16114   __Pyx_GOTREF(__pyx_t_3);
16115   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16116   __pyx_v___pyx_result = __pyx_t_3;
16117   __pyx_t_3 = 0;
16118 
16119   /* "(tree fragment)":8
16120  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16121  *     __pyx_result = ListStringTable.__new__(__pyx_type)
16122  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
16123  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16124  *     return __pyx_result
16125  */
16126   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
16127   __pyx_t_6 = (__pyx_t_1 != 0);
16128   if (__pyx_t_6) {
16129 
16130     /* "(tree fragment)":9
16131  *     __pyx_result = ListStringTable.__new__(__pyx_type)
16132  *     if __pyx_state is not None:
16133  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
16134  *     return __pyx_result
16135  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):
16136  */
16137     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
16138     __pyx_t_3 = __pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_ListStringTable__set_state(((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
16139     __Pyx_GOTREF(__pyx_t_3);
16140     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16141 
16142     /* "(tree fragment)":8
16143  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xae267b1 = (_list, _next_id, _table))" % __pyx_checksum)
16144  *     __pyx_result = ListStringTable.__new__(__pyx_type)
16145  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
16146  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16147  *     return __pyx_result
16148  */
16149   }
16150 
16151   /* "(tree fragment)":10
16152  *     if __pyx_state is not None:
16153  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16154  *     return __pyx_result             # <<<<<<<<<<<<<<
16155  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):
16156  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16157  */
16158   __Pyx_XDECREF(__pyx_r);
16159   __Pyx_INCREF(__pyx_v___pyx_result);
16160   __pyx_r = __pyx_v___pyx_result;
16161   goto __pyx_L0;
16162 
16163   /* "(tree fragment)":1
16164  * def __pyx_unpickle_ListStringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
16165  *     cdef object __pyx_PickleError
16166  *     cdef object __pyx_result
16167  */
16168 
16169   /* function exit code */
16170   __pyx_L1_error:;
16171   __Pyx_XDECREF(__pyx_t_2);
16172   __Pyx_XDECREF(__pyx_t_3);
16173   __Pyx_XDECREF(__pyx_t_4);
16174   __Pyx_XDECREF(__pyx_t_5);
16175   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_ListStringTable", __pyx_clineno, __pyx_lineno, __pyx_filename);
16176   __pyx_r = NULL;
16177   __pyx_L0:;
16178   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
16179   __Pyx_XDECREF(__pyx_v___pyx_result);
16180   __Pyx_XGIVEREF(__pyx_r);
16181   __Pyx_RefNannyFinishContext();
16182   return __pyx_r;
16183 }
16184 
16185 /* "(tree fragment)":11
16186  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16187  *     return __pyx_result
16188  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
16189  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16190  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
16191  */
16192 
__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_ListStringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)16193 static PyObject *__pyx_f_7ddtrace_8internal_9_encoding___pyx_unpickle_ListStringTable__set_state(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
16194   PyObject *__pyx_r = NULL;
16195   __Pyx_RefNannyDeclarations
16196   PyObject *__pyx_t_1 = NULL;
16197   uint32_t __pyx_t_2;
16198   int __pyx_t_3;
16199   Py_ssize_t __pyx_t_4;
16200   int __pyx_t_5;
16201   int __pyx_t_6;
16202   PyObject *__pyx_t_7 = NULL;
16203   PyObject *__pyx_t_8 = NULL;
16204   PyObject *__pyx_t_9 = NULL;
16205   int __pyx_lineno = 0;
16206   const char *__pyx_filename = NULL;
16207   int __pyx_clineno = 0;
16208   __Pyx_RefNannySetupContext("__pyx_unpickle_ListStringTable__set_state", 0);
16209 
16210   /* "(tree fragment)":12
16211  *     return __pyx_result
16212  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):
16213  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]             # <<<<<<<<<<<<<<
16214  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
16215  *         __pyx_result.__dict__.update(__pyx_state[3])
16216  */
16217   if (unlikely(__pyx_v___pyx_state == Py_None)) {
16218     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
16219     __PYX_ERR(1, 12, __pyx_L1_error)
16220   }
16221   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
16222   __Pyx_GOTREF(__pyx_t_1);
16223   if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
16224   __Pyx_GIVEREF(__pyx_t_1);
16225   __Pyx_GOTREF(__pyx_v___pyx_result->_list);
16226   __Pyx_DECREF(__pyx_v___pyx_result->_list);
16227   __pyx_v___pyx_result->_list = ((PyObject*)__pyx_t_1);
16228   __pyx_t_1 = 0;
16229   if (unlikely(__pyx_v___pyx_state == Py_None)) {
16230     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
16231     __PYX_ERR(1, 12, __pyx_L1_error)
16232   }
16233   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
16234   __Pyx_GOTREF(__pyx_t_1);
16235   __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
16236   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16237   __pyx_v___pyx_result->__pyx_base._next_id = __pyx_t_2;
16238   if (unlikely(__pyx_v___pyx_state == Py_None)) {
16239     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
16240     __PYX_ERR(1, 12, __pyx_L1_error)
16241   }
16242   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
16243   __Pyx_GOTREF(__pyx_t_1);
16244   if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
16245   __Pyx_GIVEREF(__pyx_t_1);
16246   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._table);
16247   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._table);
16248   __pyx_v___pyx_result->__pyx_base._table = ((PyObject*)__pyx_t_1);
16249   __pyx_t_1 = 0;
16250 
16251   /* "(tree fragment)":13
16252  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):
16253  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16254  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
16255  *         __pyx_result.__dict__.update(__pyx_state[3])
16256  */
16257   if (unlikely(__pyx_v___pyx_state == Py_None)) {
16258     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
16259     __PYX_ERR(1, 13, __pyx_L1_error)
16260   }
16261   __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
16262   __pyx_t_5 = ((__pyx_t_4 > 3) != 0);
16263   if (__pyx_t_5) {
16264   } else {
16265     __pyx_t_3 = __pyx_t_5;
16266     goto __pyx_L4_bool_binop_done;
16267   }
16268   __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
16269   __pyx_t_6 = (__pyx_t_5 != 0);
16270   __pyx_t_3 = __pyx_t_6;
16271   __pyx_L4_bool_binop_done:;
16272   if (__pyx_t_3) {
16273 
16274     /* "(tree fragment)":14
16275  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16276  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
16277  *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
16278  */
16279     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
16280     __Pyx_GOTREF(__pyx_t_7);
16281     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
16282     __Pyx_GOTREF(__pyx_t_8);
16283     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16284     if (unlikely(__pyx_v___pyx_state == Py_None)) {
16285       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
16286       __PYX_ERR(1, 14, __pyx_L1_error)
16287     }
16288     __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
16289     __Pyx_GOTREF(__pyx_t_7);
16290     __pyx_t_9 = NULL;
16291     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
16292       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
16293       if (likely(__pyx_t_9)) {
16294         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
16295         __Pyx_INCREF(__pyx_t_9);
16296         __Pyx_INCREF(function);
16297         __Pyx_DECREF_SET(__pyx_t_8, function);
16298       }
16299     }
16300     __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
16301     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
16302     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16303     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
16304     __Pyx_GOTREF(__pyx_t_1);
16305     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16306     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16307 
16308     /* "(tree fragment)":13
16309  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):
16310  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16311  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
16312  *         __pyx_result.__dict__.update(__pyx_state[3])
16313  */
16314   }
16315 
16316   /* "(tree fragment)":11
16317  *         __pyx_unpickle_ListStringTable__set_state(<ListStringTable> __pyx_result, __pyx_state)
16318  *     return __pyx_result
16319  * cdef __pyx_unpickle_ListStringTable__set_state(ListStringTable __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
16320  *     __pyx_result._list = __pyx_state[0]; __pyx_result._next_id = __pyx_state[1]; __pyx_result._table = __pyx_state[2]
16321  *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
16322  */
16323 
16324   /* function exit code */
16325   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16326   goto __pyx_L0;
16327   __pyx_L1_error:;
16328   __Pyx_XDECREF(__pyx_t_1);
16329   __Pyx_XDECREF(__pyx_t_7);
16330   __Pyx_XDECREF(__pyx_t_8);
16331   __Pyx_XDECREF(__pyx_t_9);
16332   __Pyx_AddTraceback("ddtrace.internal._encoding.__pyx_unpickle_ListStringTable__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
16333   __pyx_r = 0;
16334   __pyx_L0:;
16335   __Pyx_XGIVEREF(__pyx_r);
16336   __Pyx_RefNannyFinishContext();
16337   return __pyx_r;
16338 }
16339 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable __pyx_vtable_7ddtrace_8internal_9_encoding_StringTable;
16340 
__pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)16341 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
16342   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *p;
16343   PyObject *o;
16344   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
16345     o = (*t->tp_alloc)(t, 0);
16346   } else {
16347     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
16348   }
16349   if (unlikely(!o)) return 0;
16350   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)o);
16351   p->__pyx_vtab = __pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable;
16352   p->_table = ((PyObject*)Py_None); Py_INCREF(Py_None);
16353   return o;
16354 }
16355 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_StringTable(PyObject * o)16356 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_StringTable(PyObject *o) {
16357   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)o;
16358   #if CYTHON_USE_TP_FINALIZE
16359   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
16360     if (PyObject_CallFinalizerFromDealloc(o)) return;
16361   }
16362   #endif
16363   PyObject_GC_UnTrack(o);
16364   Py_CLEAR(p->_table);
16365   (*Py_TYPE(o)->tp_free)(o);
16366 }
16367 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_StringTable(PyObject * o,visitproc v,void * a)16368 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_StringTable(PyObject *o, visitproc v, void *a) {
16369   int e;
16370   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)o;
16371   if (p->_table) {
16372     e = (*v)(p->_table, a); if (e) return e;
16373   }
16374   return 0;
16375 }
16376 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_StringTable(PyObject * o)16377 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_StringTable(PyObject *o) {
16378   PyObject* tmp;
16379   struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *)o;
16380   tmp = ((PyObject*)p->_table);
16381   p->_table = ((PyObject*)Py_None); Py_INCREF(Py_None);
16382   Py_XDECREF(tmp);
16383   return 0;
16384 }
16385 
16386 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_StringTable[] = {
16387   {"index", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_3index, METH_O, 0},
16388   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_9__reduce_cython__, METH_NOARGS, 0},
16389   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_11__setstate_cython__, METH_O, 0},
16390   {0, 0, 0, 0}
16391 };
16392 
16393 static PySequenceMethods __pyx_tp_as_sequence_StringTable = {
16394   __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_5__len__, /*sq_length*/
16395   0, /*sq_concat*/
16396   0, /*sq_repeat*/
16397   0, /*sq_item*/
16398   0, /*sq_slice*/
16399   0, /*sq_ass_item*/
16400   0, /*sq_ass_slice*/
16401   __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_7__contains__, /*sq_contains*/
16402   0, /*sq_inplace_concat*/
16403   0, /*sq_inplace_repeat*/
16404 };
16405 
16406 static PyMappingMethods __pyx_tp_as_mapping_StringTable = {
16407   __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_5__len__, /*mp_length*/
16408   0, /*mp_subscript*/
16409   0, /*mp_ass_subscript*/
16410 };
16411 
16412 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_StringTable = {
16413   PyVarObject_HEAD_INIT(0, 0)
16414   "ddtrace.internal._encoding.StringTable", /*tp_name*/
16415   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable), /*tp_basicsize*/
16416   0, /*tp_itemsize*/
16417   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_StringTable, /*tp_dealloc*/
16418   #if PY_VERSION_HEX < 0x030800b4
16419   0, /*tp_print*/
16420   #endif
16421   #if PY_VERSION_HEX >= 0x030800b4
16422   0, /*tp_vectorcall_offset*/
16423   #endif
16424   0, /*tp_getattr*/
16425   0, /*tp_setattr*/
16426   #if PY_MAJOR_VERSION < 3
16427   0, /*tp_compare*/
16428   #endif
16429   #if PY_MAJOR_VERSION >= 3
16430   0, /*tp_as_async*/
16431   #endif
16432   0, /*tp_repr*/
16433   0, /*tp_as_number*/
16434   &__pyx_tp_as_sequence_StringTable, /*tp_as_sequence*/
16435   &__pyx_tp_as_mapping_StringTable, /*tp_as_mapping*/
16436   0, /*tp_hash*/
16437   0, /*tp_call*/
16438   0, /*tp_str*/
16439   0, /*tp_getattro*/
16440   0, /*tp_setattro*/
16441   0, /*tp_as_buffer*/
16442   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16443   0, /*tp_doc*/
16444   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_StringTable, /*tp_traverse*/
16445   __pyx_tp_clear_7ddtrace_8internal_9_encoding_StringTable, /*tp_clear*/
16446   0, /*tp_richcompare*/
16447   0, /*tp_weaklistoffset*/
16448   0, /*tp_iter*/
16449   0, /*tp_iternext*/
16450   __pyx_methods_7ddtrace_8internal_9_encoding_StringTable, /*tp_methods*/
16451   0, /*tp_members*/
16452   0, /*tp_getset*/
16453   0, /*tp_base*/
16454   0, /*tp_dict*/
16455   0, /*tp_descr_get*/
16456   0, /*tp_descr_set*/
16457   0, /*tp_dictoffset*/
16458   __pyx_pw_7ddtrace_8internal_9_encoding_11StringTable_1__init__, /*tp_init*/
16459   0, /*tp_alloc*/
16460   __pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable, /*tp_new*/
16461   0, /*tp_free*/
16462   0, /*tp_is_gc*/
16463   0, /*tp_bases*/
16464   0, /*tp_mro*/
16465   0, /*tp_cache*/
16466   0, /*tp_subclasses*/
16467   0, /*tp_weaklist*/
16468   0, /*tp_del*/
16469   0, /*tp_version_tag*/
16470   #if PY_VERSION_HEX >= 0x030400a1
16471   0, /*tp_finalize*/
16472   #endif
16473   #if PY_VERSION_HEX >= 0x030800b1
16474   0, /*tp_vectorcall*/
16475   #endif
16476   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16477   0, /*tp_print*/
16478   #endif
16479 };
16480 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListStringTable __pyx_vtable_7ddtrace_8internal_9_encoding_ListStringTable;
16481 
__pyx_tp_new_7ddtrace_8internal_9_encoding_ListStringTable(PyTypeObject * t,PyObject * a,PyObject * k)16482 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_ListStringTable(PyTypeObject *t, PyObject *a, PyObject *k) {
16483   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *p;
16484   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable(t, a, k);
16485   if (unlikely(!o)) return 0;
16486   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)o);
16487   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable*)__pyx_vtabptr_7ddtrace_8internal_9_encoding_ListStringTable;
16488   p->_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
16489   return o;
16490 }
16491 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListStringTable(PyObject * o)16492 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListStringTable(PyObject *o) {
16493   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)o;
16494   #if CYTHON_USE_TP_FINALIZE
16495   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
16496     if (PyObject_CallFinalizerFromDealloc(o)) return;
16497   }
16498   #endif
16499   PyObject_GC_UnTrack(o);
16500   Py_CLEAR(p->_list);
16501   PyObject_GC_Track(o);
16502   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_StringTable(o);
16503 }
16504 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListStringTable(PyObject * o,visitproc v,void * a)16505 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListStringTable(PyObject *o, visitproc v, void *a) {
16506   int e;
16507   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)o;
16508   e = __pyx_tp_traverse_7ddtrace_8internal_9_encoding_StringTable(o, v, a); if (e) return e;
16509   if (p->_list) {
16510     e = (*v)(p->_list, a); if (e) return e;
16511   }
16512   return 0;
16513 }
16514 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_ListStringTable(PyObject * o)16515 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_ListStringTable(PyObject *o) {
16516   PyObject* tmp;
16517   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable *)o;
16518   __pyx_tp_clear_7ddtrace_8internal_9_encoding_StringTable(o);
16519   tmp = ((PyObject*)p->_list);
16520   p->_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
16521   Py_XDECREF(tmp);
16522   return 0;
16523 }
16524 
16525 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_ListStringTable[] = {
16526   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_5__reduce_cython__, METH_NOARGS, 0},
16527   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_7__setstate_cython__, METH_O, 0},
16528   {0, 0, 0, 0}
16529 };
16530 
16531 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_ListStringTable = {
16532   PyVarObject_HEAD_INIT(0, 0)
16533   "ddtrace.internal._encoding.ListStringTable", /*tp_name*/
16534   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListStringTable), /*tp_basicsize*/
16535   0, /*tp_itemsize*/
16536   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListStringTable, /*tp_dealloc*/
16537   #if PY_VERSION_HEX < 0x030800b4
16538   0, /*tp_print*/
16539   #endif
16540   #if PY_VERSION_HEX >= 0x030800b4
16541   0, /*tp_vectorcall_offset*/
16542   #endif
16543   0, /*tp_getattr*/
16544   0, /*tp_setattr*/
16545   #if PY_MAJOR_VERSION < 3
16546   0, /*tp_compare*/
16547   #endif
16548   #if PY_MAJOR_VERSION >= 3
16549   0, /*tp_as_async*/
16550   #endif
16551   0, /*tp_repr*/
16552   0, /*tp_as_number*/
16553   0, /*tp_as_sequence*/
16554   0, /*tp_as_mapping*/
16555   0, /*tp_hash*/
16556   0, /*tp_call*/
16557   0, /*tp_str*/
16558   0, /*tp_getattro*/
16559   0, /*tp_setattro*/
16560   0, /*tp_as_buffer*/
16561   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16562   0, /*tp_doc*/
16563   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListStringTable, /*tp_traverse*/
16564   __pyx_tp_clear_7ddtrace_8internal_9_encoding_ListStringTable, /*tp_clear*/
16565   0, /*tp_richcompare*/
16566   0, /*tp_weaklistoffset*/
16567   __pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_3__iter__, /*tp_iter*/
16568   0, /*tp_iternext*/
16569   __pyx_methods_7ddtrace_8internal_9_encoding_ListStringTable, /*tp_methods*/
16570   0, /*tp_members*/
16571   0, /*tp_getset*/
16572   0, /*tp_base*/
16573   0, /*tp_dict*/
16574   0, /*tp_descr_get*/
16575   0, /*tp_descr_set*/
16576   0, /*tp_dictoffset*/
16577   __pyx_pw_7ddtrace_8internal_9_encoding_15ListStringTable_1__init__, /*tp_init*/
16578   0, /*tp_alloc*/
16579   __pyx_tp_new_7ddtrace_8internal_9_encoding_ListStringTable, /*tp_new*/
16580   0, /*tp_free*/
16581   0, /*tp_is_gc*/
16582   0, /*tp_bases*/
16583   0, /*tp_mro*/
16584   0, /*tp_cache*/
16585   0, /*tp_subclasses*/
16586   0, /*tp_weaklist*/
16587   0, /*tp_del*/
16588   0, /*tp_version_tag*/
16589   #if PY_VERSION_HEX >= 0x030400a1
16590   0, /*tp_finalize*/
16591   #endif
16592   #if PY_VERSION_HEX >= 0x030800b1
16593   0, /*tp_vectorcall*/
16594   #endif
16595   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16596   0, /*tp_print*/
16597   #endif
16598 };
16599 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackStringTable __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable;
16600 
__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyTypeObject * t,PyObject * a,PyObject * k)16601 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyTypeObject *t, PyObject *a, PyObject *k) {
16602   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *p;
16603   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_StringTable(t, a, k);
16604   if (unlikely(!o)) return 0;
16605   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)o);
16606   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_StringTable*)__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackStringTable;
16607   p->_lock = Py_None; Py_INCREF(Py_None);
16608   return o;
16609 }
16610 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject * o)16611 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject *o) {
16612   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)o;
16613   #if CYTHON_USE_TP_FINALIZE
16614   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
16615     if (PyObject_CallFinalizerFromDealloc(o)) return;
16616   }
16617   #endif
16618   PyObject_GC_UnTrack(o);
16619   {
16620     PyObject *etype, *eval, *etb;
16621     PyErr_Fetch(&etype, &eval, &etb);
16622     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
16623     __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_3__dealloc__(o);
16624     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
16625     PyErr_Restore(etype, eval, etb);
16626   }
16627   Py_CLEAR(p->_lock);
16628   PyObject_GC_Track(o);
16629   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_StringTable(o);
16630 }
16631 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject * o,visitproc v,void * a)16632 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject *o, visitproc v, void *a) {
16633   int e;
16634   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)o;
16635   e = __pyx_tp_traverse_7ddtrace_8internal_9_encoding_StringTable(o, v, a); if (e) return e;
16636   if (p->_lock) {
16637     e = (*v)(p->_lock, a); if (e) return e;
16638   }
16639   return 0;
16640 }
16641 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject * o)16642 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackStringTable(PyObject *o) {
16643   PyObject* tmp;
16644   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)o;
16645   __pyx_tp_clear_7ddtrace_8internal_9_encoding_StringTable(o);
16646   tmp = ((PyObject*)p->_lock);
16647   p->_lock = Py_None; Py_INCREF(Py_None);
16648   Py_XDECREF(tmp);
16649   return 0;
16650 }
16651 
__pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackStringTable_size(PyObject * o,CYTHON_UNUSED void * x)16652 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackStringTable_size(PyObject *o, CYTHON_UNUSED void *x) {
16653   return __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_4size_1__get__(o);
16654 }
16655 
16656 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackStringTable[] = {
16657   {"flush", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_5flush, METH_NOARGS, 0},
16658   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_7__reduce_cython__, METH_NOARGS, 0},
16659   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_9__setstate_cython__, METH_O, 0},
16660   {0, 0, 0, 0}
16661 };
16662 
16663 static struct PyGetSetDef __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackStringTable[] = {
16664   {(char *)"size", __pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackStringTable_size, 0, (char *)0, 0},
16665   {0, 0, 0, 0, 0}
16666 };
16667 
16668 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable = {
16669   PyVarObject_HEAD_INIT(0, 0)
16670   "ddtrace.internal._encoding.MsgpackStringTable", /*tp_name*/
16671   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable), /*tp_basicsize*/
16672   0, /*tp_itemsize*/
16673   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_dealloc*/
16674   #if PY_VERSION_HEX < 0x030800b4
16675   0, /*tp_print*/
16676   #endif
16677   #if PY_VERSION_HEX >= 0x030800b4
16678   0, /*tp_vectorcall_offset*/
16679   #endif
16680   0, /*tp_getattr*/
16681   0, /*tp_setattr*/
16682   #if PY_MAJOR_VERSION < 3
16683   0, /*tp_compare*/
16684   #endif
16685   #if PY_MAJOR_VERSION >= 3
16686   0, /*tp_as_async*/
16687   #endif
16688   0, /*tp_repr*/
16689   0, /*tp_as_number*/
16690   0, /*tp_as_sequence*/
16691   0, /*tp_as_mapping*/
16692   0, /*tp_hash*/
16693   0, /*tp_call*/
16694   0, /*tp_str*/
16695   0, /*tp_getattro*/
16696   0, /*tp_setattro*/
16697   0, /*tp_as_buffer*/
16698   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16699   0, /*tp_doc*/
16700   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_traverse*/
16701   __pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_clear*/
16702   0, /*tp_richcompare*/
16703   0, /*tp_weaklistoffset*/
16704   0, /*tp_iter*/
16705   0, /*tp_iternext*/
16706   __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_methods*/
16707   0, /*tp_members*/
16708   __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_getset*/
16709   0, /*tp_base*/
16710   0, /*tp_dict*/
16711   0, /*tp_descr_get*/
16712   0, /*tp_descr_set*/
16713   0, /*tp_dictoffset*/
16714   __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackStringTable_1__init__, /*tp_init*/
16715   0, /*tp_alloc*/
16716   __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackStringTable, /*tp_new*/
16717   0, /*tp_free*/
16718   0, /*tp_is_gc*/
16719   0, /*tp_bases*/
16720   0, /*tp_mro*/
16721   0, /*tp_cache*/
16722   0, /*tp_subclasses*/
16723   0, /*tp_weaklist*/
16724   0, /*tp_del*/
16725   0, /*tp_version_tag*/
16726   #if PY_VERSION_HEX >= 0x030400a1
16727   0, /*tp_finalize*/
16728   #endif
16729   #if PY_VERSION_HEX >= 0x030800b1
16730   0, /*tp_vectorcall*/
16731   #endif
16732   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16733   0, /*tp_print*/
16734   #endif
16735 };
16736 
__pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder(PyTypeObject * t,PyObject * a,PyObject * k)16737 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder(PyTypeObject *t, PyObject *a, PyObject *k) {
16738   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *p;
16739   PyObject *o;
16740   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
16741     o = (*t->tp_alloc)(t, 0);
16742   } else {
16743     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
16744   }
16745   if (unlikely(!o)) return 0;
16746   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)o);
16747   p->_lock = Py_None; Py_INCREF(Py_None);
16748   if (unlikely(__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_1__cinit__(o, a, k) < 0)) goto bad;
16749   return o;
16750   bad:
16751   Py_DECREF(o); o = 0;
16752   return NULL;
16753 }
16754 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject * o)16755 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject *o) {
16756   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)o;
16757   #if CYTHON_USE_TP_FINALIZE
16758   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
16759     if (PyObject_CallFinalizerFromDealloc(o)) return;
16760   }
16761   #endif
16762   PyObject_GC_UnTrack(o);
16763   Py_CLEAR(p->_lock);
16764   (*Py_TYPE(o)->tp_free)(o);
16765 }
16766 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject * o,visitproc v,void * a)16767 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject *o, visitproc v, void *a) {
16768   int e;
16769   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)o;
16770   if (p->_lock) {
16771     e = (*v)(p->_lock, a); if (e) return e;
16772   }
16773   return 0;
16774 }
16775 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject * o)16776 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder(PyObject *o) {
16777   PyObject* tmp;
16778   struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder *)o;
16779   tmp = ((PyObject*)p->_lock);
16780   p->_lock = Py_None; Py_INCREF(Py_None);
16781   Py_XDECREF(tmp);
16782   return 0;
16783 }
16784 
__pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size(PyObject * o,CYTHON_UNUSED void * x)16785 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size(PyObject *o, CYTHON_UNUSED void *x) {
16786   return __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_1__get__(o);
16787 }
16788 
__pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)16789 static int __pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
16790   if (v) {
16791     return __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_8max_size_3__set__(o, v);
16792   }
16793   else {
16794     PyErr_SetString(PyExc_NotImplementedError, "__del__");
16795     return -1;
16796   }
16797 }
16798 
__pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size(PyObject * o,CYTHON_UNUSED void * x)16799 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size(PyObject *o, CYTHON_UNUSED void *x) {
16800   return __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_1__get__(o);
16801 }
16802 
__pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)16803 static int __pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
16804   if (v) {
16805     return __pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_13max_item_size_3__set__(o, v);
16806   }
16807   else {
16808     PyErr_SetString(PyExc_NotImplementedError, "__del__");
16809     return -1;
16810   }
16811 }
16812 
16813 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_BufferedEncoder[] = {
16814   {"put", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_3put, METH_O, 0},
16815   {"encode", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_5encode, METH_NOARGS, 0},
16816   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_7__reduce_cython__, METH_NOARGS, 0},
16817   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_15BufferedEncoder_9__setstate_cython__, METH_O, 0},
16818   {0, 0, 0, 0}
16819 };
16820 
16821 static struct PyGetSetDef __pyx_getsets_7ddtrace_8internal_9_encoding_BufferedEncoder[] = {
16822   {(char *)"max_size", __pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size, __pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_size, (char *)0, 0},
16823   {(char *)"max_item_size", __pyx_getprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size, __pyx_setprop_7ddtrace_8internal_9_encoding_15BufferedEncoder_max_item_size, (char *)0, 0},
16824   {0, 0, 0, 0, 0}
16825 };
16826 
16827 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder = {
16828   PyVarObject_HEAD_INIT(0, 0)
16829   "ddtrace.internal._encoding.BufferedEncoder", /*tp_name*/
16830   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_BufferedEncoder), /*tp_basicsize*/
16831   0, /*tp_itemsize*/
16832   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_dealloc*/
16833   #if PY_VERSION_HEX < 0x030800b4
16834   0, /*tp_print*/
16835   #endif
16836   #if PY_VERSION_HEX >= 0x030800b4
16837   0, /*tp_vectorcall_offset*/
16838   #endif
16839   0, /*tp_getattr*/
16840   0, /*tp_setattr*/
16841   #if PY_MAJOR_VERSION < 3
16842   0, /*tp_compare*/
16843   #endif
16844   #if PY_MAJOR_VERSION >= 3
16845   0, /*tp_as_async*/
16846   #endif
16847   0, /*tp_repr*/
16848   0, /*tp_as_number*/
16849   0, /*tp_as_sequence*/
16850   0, /*tp_as_mapping*/
16851   0, /*tp_hash*/
16852   0, /*tp_call*/
16853   0, /*tp_str*/
16854   0, /*tp_getattro*/
16855   0, /*tp_setattro*/
16856   0, /*tp_as_buffer*/
16857   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16858   0, /*tp_doc*/
16859   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_traverse*/
16860   __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_clear*/
16861   0, /*tp_richcompare*/
16862   0, /*tp_weaklistoffset*/
16863   0, /*tp_iter*/
16864   0, /*tp_iternext*/
16865   __pyx_methods_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_methods*/
16866   0, /*tp_members*/
16867   __pyx_getsets_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_getset*/
16868   0, /*tp_base*/
16869   0, /*tp_dict*/
16870   0, /*tp_descr_get*/
16871   0, /*tp_descr_set*/
16872   0, /*tp_dictoffset*/
16873   0, /*tp_init*/
16874   0, /*tp_alloc*/
16875   __pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_new*/
16876   0, /*tp_free*/
16877   0, /*tp_is_gc*/
16878   0, /*tp_bases*/
16879   0, /*tp_mro*/
16880   0, /*tp_cache*/
16881   0, /*tp_subclasses*/
16882   0, /*tp_weaklist*/
16883   0, /*tp_del*/
16884   0, /*tp_version_tag*/
16885   #if PY_VERSION_HEX >= 0x030400a1
16886   0, /*tp_finalize*/
16887   #endif
16888   #if PY_VERSION_HEX >= 0x030800b1
16889   0, /*tp_vectorcall*/
16890   #endif
16891   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16892   0, /*tp_print*/
16893   #endif
16894 };
16895 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_ListBufferedEncoder __pyx_vtable_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
16896 
__pyx_tp_new_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyTypeObject * t,PyObject * a,PyObject * k)16897 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyTypeObject *t, PyObject *a, PyObject *k) {
16898   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *p;
16899   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder(t, a, k);
16900   if (unlikely(!o)) return 0;
16901   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)o);
16902   p->__pyx_vtab = __pyx_vtabptr_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
16903   p->_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None);
16904   if (unlikely(__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_1__cinit__(o, a, k) < 0)) goto bad;
16905   return o;
16906   bad:
16907   Py_DECREF(o); o = 0;
16908   return NULL;
16909 }
16910 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject * o)16911 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject *o) {
16912   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)o;
16913   #if CYTHON_USE_TP_FINALIZE
16914   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
16915     if (PyObject_CallFinalizerFromDealloc(o)) return;
16916   }
16917   #endif
16918   PyObject_GC_UnTrack(o);
16919   Py_CLEAR(p->_buffer);
16920   PyObject_GC_Track(o);
16921   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_BufferedEncoder(o);
16922 }
16923 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject * o,visitproc v,void * a)16924 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject *o, visitproc v, void *a) {
16925   int e;
16926   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)o;
16927   e = __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder(o, v, a); if (e) return e;
16928   if (p->_buffer) {
16929     e = (*v)(p->_buffer, a); if (e) return e;
16930   }
16931   return 0;
16932 }
16933 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject * o)16934 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_ListBufferedEncoder(PyObject *o) {
16935   PyObject* tmp;
16936   struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *)o;
16937   __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder(o);
16938   tmp = ((PyObject*)p->_buffer);
16939   p->_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None);
16940   Py_XDECREF(tmp);
16941   return 0;
16942 }
16943 
__pyx_getprop_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_size(PyObject * o,CYTHON_UNUSED void * x)16944 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_size(PyObject *o, CYTHON_UNUSED void *x) {
16945   return __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4size_1__get__(o);
16946 }
16947 
16948 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_ListBufferedEncoder[] = {
16949   {"put", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_5put, METH_O, __pyx_doc_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_4put},
16950   {"get", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_7get, METH_NOARGS, __pyx_doc_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_6get},
16951   {"encode_item", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_9encode_item, METH_O, 0},
16952   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_11__reduce_cython__, METH_NOARGS, 0},
16953   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_13__setstate_cython__, METH_O, 0},
16954   {0, 0, 0, 0}
16955 };
16956 
16957 static struct PyGetSetDef __pyx_getsets_7ddtrace_8internal_9_encoding_ListBufferedEncoder[] = {
16958   {(char *)"size", __pyx_getprop_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_size, 0, (char *)0, 0},
16959   {0, 0, 0, 0, 0}
16960 };
16961 
16962 static PySequenceMethods __pyx_tp_as_sequence_ListBufferedEncoder = {
16963   __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_3__len__, /*sq_length*/
16964   0, /*sq_concat*/
16965   0, /*sq_repeat*/
16966   0, /*sq_item*/
16967   0, /*sq_slice*/
16968   0, /*sq_ass_item*/
16969   0, /*sq_ass_slice*/
16970   0, /*sq_contains*/
16971   0, /*sq_inplace_concat*/
16972   0, /*sq_inplace_repeat*/
16973 };
16974 
16975 static PyMappingMethods __pyx_tp_as_mapping_ListBufferedEncoder = {
16976   __pyx_pw_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_3__len__, /*mp_length*/
16977   0, /*mp_subscript*/
16978   0, /*mp_ass_subscript*/
16979 };
16980 
16981 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder = {
16982   PyVarObject_HEAD_INIT(0, 0)
16983   "ddtrace.internal._encoding.ListBufferedEncoder", /*tp_name*/
16984   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder), /*tp_basicsize*/
16985   0, /*tp_itemsize*/
16986   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_dealloc*/
16987   #if PY_VERSION_HEX < 0x030800b4
16988   0, /*tp_print*/
16989   #endif
16990   #if PY_VERSION_HEX >= 0x030800b4
16991   0, /*tp_vectorcall_offset*/
16992   #endif
16993   0, /*tp_getattr*/
16994   0, /*tp_setattr*/
16995   #if PY_MAJOR_VERSION < 3
16996   0, /*tp_compare*/
16997   #endif
16998   #if PY_MAJOR_VERSION >= 3
16999   0, /*tp_as_async*/
17000   #endif
17001   0, /*tp_repr*/
17002   0, /*tp_as_number*/
17003   &__pyx_tp_as_sequence_ListBufferedEncoder, /*tp_as_sequence*/
17004   &__pyx_tp_as_mapping_ListBufferedEncoder, /*tp_as_mapping*/
17005   0, /*tp_hash*/
17006   0, /*tp_call*/
17007   0, /*tp_str*/
17008   0, /*tp_getattro*/
17009   0, /*tp_setattro*/
17010   0, /*tp_as_buffer*/
17011   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
17012   0, /*tp_doc*/
17013   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_traverse*/
17014   __pyx_tp_clear_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_clear*/
17015   0, /*tp_richcompare*/
17016   0, /*tp_weaklistoffset*/
17017   0, /*tp_iter*/
17018   0, /*tp_iternext*/
17019   __pyx_methods_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_methods*/
17020   0, /*tp_members*/
17021   __pyx_getsets_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_getset*/
17022   0, /*tp_base*/
17023   0, /*tp_dict*/
17024   0, /*tp_descr_get*/
17025   0, /*tp_descr_set*/
17026   0, /*tp_dictoffset*/
17027   0, /*tp_init*/
17028   0, /*tp_alloc*/
17029   __pyx_tp_new_7ddtrace_8internal_9_encoding_ListBufferedEncoder, /*tp_new*/
17030   0, /*tp_free*/
17031   0, /*tp_is_gc*/
17032   0, /*tp_bases*/
17033   0, /*tp_mro*/
17034   0, /*tp_cache*/
17035   0, /*tp_subclasses*/
17036   0, /*tp_weaklist*/
17037   0, /*tp_del*/
17038   0, /*tp_version_tag*/
17039   #if PY_VERSION_HEX >= 0x030400a1
17040   0, /*tp_finalize*/
17041   #endif
17042   #if PY_VERSION_HEX >= 0x030800b1
17043   0, /*tp_vectorcall*/
17044   #endif
17045   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
17046   0, /*tp_print*/
17047   #endif
17048 };
17049 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
17050 
__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(PyTypeObject * t,PyObject * a,PyObject * k)17051 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(PyTypeObject *t, PyObject *a, PyObject *k) {
17052   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *p;
17053   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_BufferedEncoder(t, a, k);
17054   if (unlikely(!o)) return 0;
17055   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *)o);
17056   p->__pyx_vtab = __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
17057   if (unlikely(__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_1__cinit__(o, a, k) < 0)) goto bad;
17058   return o;
17059   bad:
17060   Py_DECREF(o); o = 0;
17061   return NULL;
17062 }
17063 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(PyObject * o)17064 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(PyObject *o) {
17065   #if CYTHON_USE_TP_FINALIZE
17066   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
17067     if (PyObject_CallFinalizerFromDealloc(o)) return;
17068   }
17069   #endif
17070   PyObject_GC_UnTrack(o);
17071   {
17072     PyObject *etype, *eval, *etb;
17073     PyErr_Fetch(&etype, &eval, &etb);
17074     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
17075     __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_3__dealloc__(o);
17076     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
17077     PyErr_Restore(etype, eval, etb);
17078   }
17079   PyObject_GC_Track(o);
17080   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_BufferedEncoder(o);
17081 }
17082 
__pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_size(PyObject * o,CYTHON_UNUSED void * x)17083 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_size(PyObject *o, CYTHON_UNUSED void *x) {
17084   return __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_4size_1__get__(o);
17085 }
17086 
17087 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderBase[] = {
17088   {"_decode", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_7_decode, METH_O, 0},
17089   {"encode", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_9encode, METH_NOARGS, 0},
17090   {"put", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_11put, METH_O, __pyx_doc_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_10put},
17091   {"flush", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_13flush, METH_NOARGS, 0},
17092   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_15__reduce_cython__, METH_NOARGS, 0},
17093   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_17__setstate_cython__, METH_O, 0},
17094   {0, 0, 0, 0}
17095 };
17096 
17097 static struct PyGetSetDef __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackEncoderBase[] = {
17098   {(char *)"size", __pyx_getprop_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_size, 0, (char *)"Return the size in bytes of the encoder buffer.", 0},
17099   {0, 0, 0, 0, 0}
17100 };
17101 
17102 static PySequenceMethods __pyx_tp_as_sequence_MsgpackEncoderBase = {
17103   __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_5__len__, /*sq_length*/
17104   0, /*sq_concat*/
17105   0, /*sq_repeat*/
17106   0, /*sq_item*/
17107   0, /*sq_slice*/
17108   0, /*sq_ass_item*/
17109   0, /*sq_ass_slice*/
17110   0, /*sq_contains*/
17111   0, /*sq_inplace_concat*/
17112   0, /*sq_inplace_repeat*/
17113 };
17114 
17115 static PyMappingMethods __pyx_tp_as_mapping_MsgpackEncoderBase = {
17116   __pyx_pw_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_5__len__, /*mp_length*/
17117   0, /*mp_subscript*/
17118   0, /*mp_ass_subscript*/
17119 };
17120 
17121 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase = {
17122   PyVarObject_HEAD_INIT(0, 0)
17123   "ddtrace.internal._encoding.MsgpackEncoderBase", /*tp_name*/
17124   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase), /*tp_basicsize*/
17125   0, /*tp_itemsize*/
17126   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderBase, /*tp_dealloc*/
17127   #if PY_VERSION_HEX < 0x030800b4
17128   0, /*tp_print*/
17129   #endif
17130   #if PY_VERSION_HEX >= 0x030800b4
17131   0, /*tp_vectorcall_offset*/
17132   #endif
17133   0, /*tp_getattr*/
17134   0, /*tp_setattr*/
17135   #if PY_MAJOR_VERSION < 3
17136   0, /*tp_compare*/
17137   #endif
17138   #if PY_MAJOR_VERSION >= 3
17139   0, /*tp_as_async*/
17140   #endif
17141   0, /*tp_repr*/
17142   0, /*tp_as_number*/
17143   &__pyx_tp_as_sequence_MsgpackEncoderBase, /*tp_as_sequence*/
17144   &__pyx_tp_as_mapping_MsgpackEncoderBase, /*tp_as_mapping*/
17145   0, /*tp_hash*/
17146   0, /*tp_call*/
17147   0, /*tp_str*/
17148   0, /*tp_getattro*/
17149   0, /*tp_setattro*/
17150   0, /*tp_as_buffer*/
17151   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
17152   0, /*tp_doc*/
17153   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_traverse*/
17154   __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_clear*/
17155   0, /*tp_richcompare*/
17156   0, /*tp_weaklistoffset*/
17157   0, /*tp_iter*/
17158   0, /*tp_iternext*/
17159   __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderBase, /*tp_methods*/
17160   0, /*tp_members*/
17161   __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackEncoderBase, /*tp_getset*/
17162   0, /*tp_base*/
17163   0, /*tp_dict*/
17164   0, /*tp_descr_get*/
17165   0, /*tp_descr_set*/
17166   0, /*tp_dictoffset*/
17167   0, /*tp_init*/
17168   0, /*tp_alloc*/
17169   __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase, /*tp_new*/
17170   0, /*tp_free*/
17171   0, /*tp_is_gc*/
17172   0, /*tp_bases*/
17173   0, /*tp_mro*/
17174   0, /*tp_cache*/
17175   0, /*tp_subclasses*/
17176   0, /*tp_weaklist*/
17177   0, /*tp_del*/
17178   0, /*tp_version_tag*/
17179   #if PY_VERSION_HEX >= 0x030400a1
17180   0, /*tp_finalize*/
17181   #endif
17182   #if PY_VERSION_HEX >= 0x030800b1
17183   0, /*tp_vectorcall*/
17184   #endif
17185   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
17186   0, /*tp_print*/
17187   #endif
17188 };
17189 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
17190 
__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV03(PyTypeObject * t,PyObject * a,PyObject * k)17191 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV03(PyTypeObject *t, PyObject *a, PyObject *k) {
17192   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *p;
17193   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(t, a, k);
17194   if (unlikely(!o)) return 0;
17195   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *)o);
17196   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase*)__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
17197   return o;
17198 }
17199 
17200 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderV03[] = {
17201   {"flush", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_1flush, METH_NOARGS, 0},
17202   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_3__reduce_cython__, METH_NOARGS, 0},
17203   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_5__setstate_cython__, METH_O, 0},
17204   {0, 0, 0, 0}
17205 };
17206 
17207 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 = {
17208   PyVarObject_HEAD_INIT(0, 0)
17209   "ddtrace.internal._encoding.MsgpackEncoderV03", /*tp_name*/
17210   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03), /*tp_basicsize*/
17211   0, /*tp_itemsize*/
17212   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderBase, /*tp_dealloc*/
17213   #if PY_VERSION_HEX < 0x030800b4
17214   0, /*tp_print*/
17215   #endif
17216   #if PY_VERSION_HEX >= 0x030800b4
17217   0, /*tp_vectorcall_offset*/
17218   #endif
17219   0, /*tp_getattr*/
17220   0, /*tp_setattr*/
17221   #if PY_MAJOR_VERSION < 3
17222   0, /*tp_compare*/
17223   #endif
17224   #if PY_MAJOR_VERSION >= 3
17225   0, /*tp_as_async*/
17226   #endif
17227   0, /*tp_repr*/
17228   0, /*tp_as_number*/
17229   0, /*tp_as_sequence*/
17230   0, /*tp_as_mapping*/
17231   0, /*tp_hash*/
17232   0, /*tp_call*/
17233   0, /*tp_str*/
17234   0, /*tp_getattro*/
17235   0, /*tp_setattro*/
17236   0, /*tp_as_buffer*/
17237   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
17238   0, /*tp_doc*/
17239   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_traverse*/
17240   __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder, /*tp_clear*/
17241   0, /*tp_richcompare*/
17242   0, /*tp_weaklistoffset*/
17243   0, /*tp_iter*/
17244   0, /*tp_iternext*/
17245   __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderV03, /*tp_methods*/
17246   0, /*tp_members*/
17247   0, /*tp_getset*/
17248   0, /*tp_base*/
17249   0, /*tp_dict*/
17250   0, /*tp_descr_get*/
17251   0, /*tp_descr_set*/
17252   0, /*tp_dictoffset*/
17253   0, /*tp_init*/
17254   0, /*tp_alloc*/
17255   __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV03, /*tp_new*/
17256   0, /*tp_free*/
17257   0, /*tp_is_gc*/
17258   0, /*tp_bases*/
17259   0, /*tp_mro*/
17260   0, /*tp_cache*/
17261   0, /*tp_subclasses*/
17262   0, /*tp_weaklist*/
17263   0, /*tp_del*/
17264   0, /*tp_version_tag*/
17265   #if PY_VERSION_HEX >= 0x030400a1
17266   0, /*tp_finalize*/
17267   #endif
17268   #if PY_VERSION_HEX >= 0x030800b1
17269   0, /*tp_vectorcall*/
17270   #endif
17271   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
17272   0, /*tp_print*/
17273   #endif
17274 };
17275 static struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
17276 
__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyTypeObject * t,PyObject * a,PyObject * k)17277 static PyObject *__pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyTypeObject *t, PyObject *a, PyObject *k) {
17278   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *p;
17279   PyObject *o = __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(t, a, k);
17280   if (unlikely(!o)) return 0;
17281   p = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)o);
17282   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7ddtrace_8internal_9_encoding_MsgpackEncoderBase*)__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
17283   p->_st = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)Py_None); Py_INCREF(Py_None);
17284   if (unlikely(__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_1__cinit__(o, a, k) < 0)) goto bad;
17285   return o;
17286   bad:
17287   Py_DECREF(o); o = 0;
17288   return NULL;
17289 }
17290 
__pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject * o)17291 static void __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject *o) {
17292   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)o;
17293   #if CYTHON_USE_TP_FINALIZE
17294   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
17295     if (PyObject_CallFinalizerFromDealloc(o)) return;
17296   }
17297   #endif
17298   PyObject_GC_UnTrack(o);
17299   Py_CLEAR(p->_st);
17300   PyObject_GC_Track(o);
17301   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderBase(o);
17302 }
17303 
__pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject * o,visitproc v,void * a)17304 static int __pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject *o, visitproc v, void *a) {
17305   int e;
17306   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)o;
17307   e = __pyx_tp_traverse_7ddtrace_8internal_9_encoding_BufferedEncoder(o, v, a); if (e) return e;
17308   if (p->_st) {
17309     e = (*v)(((PyObject *)p->_st), a); if (e) return e;
17310   }
17311   return 0;
17312 }
17313 
__pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject * o)17314 static int __pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackEncoderV05(PyObject *o) {
17315   PyObject* tmp;
17316   struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *p = (struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *)o;
17317   __pyx_tp_clear_7ddtrace_8internal_9_encoding_BufferedEncoder(o);
17318   tmp = ((PyObject*)p->_st);
17319   p->_st = ((struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *)Py_None); Py_INCREF(Py_None);
17320   Py_XDECREF(tmp);
17321   return 0;
17322 }
17323 
__pyx_getprop_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_size(PyObject * o,CYTHON_UNUSED void * x)17324 static PyObject *__pyx_getprop_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_size(PyObject *o, CYTHON_UNUSED void *x) {
17325   return __pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_4size_1__get__(o);
17326 }
17327 
17328 static PyMethodDef __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderV05[] = {
17329   {"flush", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_3flush, METH_NOARGS, 0},
17330   {"put", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_5put, METH_O, 0},
17331   {"__reduce_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_7__reduce_cython__, METH_NOARGS, 0},
17332   {"__setstate_cython__", (PyCFunction)__pyx_pw_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_9__setstate_cython__, METH_O, 0},
17333   {0, 0, 0, 0}
17334 };
17335 
17336 static struct PyGetSetDef __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackEncoderV05[] = {
17337   {(char *)"size", __pyx_getprop_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_size, 0, (char *)"Return the size in bytes of the encoder buffer.", 0},
17338   {0, 0, 0, 0, 0}
17339 };
17340 
17341 static PyTypeObject __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 = {
17342   PyVarObject_HEAD_INIT(0, 0)
17343   "ddtrace.internal._encoding.MsgpackEncoderV05", /*tp_name*/
17344   sizeof(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05), /*tp_basicsize*/
17345   0, /*tp_itemsize*/
17346   __pyx_tp_dealloc_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_dealloc*/
17347   #if PY_VERSION_HEX < 0x030800b4
17348   0, /*tp_print*/
17349   #endif
17350   #if PY_VERSION_HEX >= 0x030800b4
17351   0, /*tp_vectorcall_offset*/
17352   #endif
17353   0, /*tp_getattr*/
17354   0, /*tp_setattr*/
17355   #if PY_MAJOR_VERSION < 3
17356   0, /*tp_compare*/
17357   #endif
17358   #if PY_MAJOR_VERSION >= 3
17359   0, /*tp_as_async*/
17360   #endif
17361   0, /*tp_repr*/
17362   0, /*tp_as_number*/
17363   0, /*tp_as_sequence*/
17364   0, /*tp_as_mapping*/
17365   0, /*tp_hash*/
17366   0, /*tp_call*/
17367   0, /*tp_str*/
17368   0, /*tp_getattro*/
17369   0, /*tp_setattro*/
17370   0, /*tp_as_buffer*/
17371   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
17372   0, /*tp_doc*/
17373   __pyx_tp_traverse_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_traverse*/
17374   __pyx_tp_clear_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_clear*/
17375   0, /*tp_richcompare*/
17376   0, /*tp_weaklistoffset*/
17377   0, /*tp_iter*/
17378   0, /*tp_iternext*/
17379   __pyx_methods_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_methods*/
17380   0, /*tp_members*/
17381   __pyx_getsets_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_getset*/
17382   0, /*tp_base*/
17383   0, /*tp_dict*/
17384   0, /*tp_descr_get*/
17385   0, /*tp_descr_set*/
17386   0, /*tp_dictoffset*/
17387   0, /*tp_init*/
17388   0, /*tp_alloc*/
17389   __pyx_tp_new_7ddtrace_8internal_9_encoding_MsgpackEncoderV05, /*tp_new*/
17390   0, /*tp_free*/
17391   0, /*tp_is_gc*/
17392   0, /*tp_bases*/
17393   0, /*tp_mro*/
17394   0, /*tp_cache*/
17395   0, /*tp_subclasses*/
17396   0, /*tp_weaklist*/
17397   0, /*tp_del*/
17398   0, /*tp_version_tag*/
17399   #if PY_VERSION_HEX >= 0x030400a1
17400   0, /*tp_finalize*/
17401   #endif
17402   #if PY_VERSION_HEX >= 0x030800b1
17403   0, /*tp_vectorcall*/
17404   #endif
17405   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
17406   0, /*tp_print*/
17407   #endif
17408 };
17409 
17410 static PyMethodDef __pyx_methods[] = {
17411   {0, 0, 0, 0}
17412 };
17413 
17414 #if PY_MAJOR_VERSION >= 3
17415 #if CYTHON_PEP489_MULTI_PHASE_INIT
17416 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
17417 static int __pyx_pymod_exec__encoding(PyObject* module); /*proto*/
17418 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
17419   {Py_mod_create, (void*)__pyx_pymod_create},
17420   {Py_mod_exec, (void*)__pyx_pymod_exec__encoding},
17421   {0, NULL}
17422 };
17423 #endif
17424 
17425 static struct PyModuleDef __pyx_moduledef = {
17426     PyModuleDef_HEAD_INIT,
17427     "_encoding",
17428     0, /* m_doc */
17429   #if CYTHON_PEP489_MULTI_PHASE_INIT
17430     0, /* m_size */
17431   #else
17432     -1, /* m_size */
17433   #endif
17434     __pyx_methods /* m_methods */,
17435   #if CYTHON_PEP489_MULTI_PHASE_INIT
17436     __pyx_moduledef_slots, /* m_slots */
17437   #else
17438     NULL, /* m_reload */
17439   #endif
17440     NULL, /* m_traverse */
17441     NULL, /* m_clear */
17442     NULL /* m_free */
17443 };
17444 #endif
17445 #ifndef CYTHON_SMALL_CODE
17446 #if defined(__clang__)
17447     #define CYTHON_SMALL_CODE
17448 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
17449     #define CYTHON_SMALL_CODE __attribute__((cold))
17450 #else
17451     #define CYTHON_SMALL_CODE
17452 #endif
17453 #endif
17454 
17455 static __Pyx_StringTabEntry __pyx_string_tab[] = {
17456   {&__pyx_n_s_BufferFull, __pyx_k_BufferFull, sizeof(__pyx_k_BufferFull), 0, 0, 1, 1},
17457   {&__pyx_n_s_BufferItemTooLarge, __pyx_k_BufferItemTooLarge, sizeof(__pyx_k_BufferItemTooLarge), 0, 0, 1, 1},
17458   {&__pyx_n_s_BufferedEncoder, __pyx_k_BufferedEncoder, sizeof(__pyx_k_BufferedEncoder), 0, 0, 1, 1},
17459   {&__pyx_kp_s_Cannot_insert_s_string_table_is, __pyx_k_Cannot_insert_s_string_table_is, sizeof(__pyx_k_Cannot_insert_s_string_table_is), 0, 0, 1, 0},
17460   {&__pyx_kp_s_Couldn_t_pack_span, __pyx_k_Couldn_t_pack_span, sizeof(__pyx_k_Couldn_t_pack_span), 0, 0, 1, 0},
17461   {&__pyx_kp_s_Couldn_t_pack_trace, __pyx_k_Couldn_t_pack_trace, sizeof(__pyx_k_Couldn_t_pack_trace), 0, 0, 1, 0},
17462   {&__pyx_kp_s_Failed_to_add_string_to_msgpack, __pyx_k_Failed_to_add_string_to_msgpack, sizeof(__pyx_k_Failed_to_add_string_to_msgpack), 0, 0, 1, 0},
17463   {&__pyx_kp_s_Failed_to_append_raw_bytes_to_ms, __pyx_k_Failed_to_append_raw_bytes_to_ms, sizeof(__pyx_k_Failed_to_append_raw_bytes_to_ms), 0, 0, 1, 0},
17464   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xae, __pyx_k_Incompatible_checksums_s_vs_0xae, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xae), 0, 0, 1, 0},
17465   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb9, __pyx_k_Incompatible_checksums_s_vs_0xb9, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb9), 0, 0, 1, 0},
17466   {&__pyx_kp_s_Integer_value_out_of_range, __pyx_k_Integer_value_out_of_range, sizeof(__pyx_k_Integer_value_out_of_range), 0, 0, 1, 0},
17467   {&__pyx_n_s_ListBufferedEncoder, __pyx_k_ListBufferedEncoder, sizeof(__pyx_k_ListBufferedEncoder), 0, 0, 1, 1},
17468   {&__pyx_n_s_ListStringTable, __pyx_k_ListStringTable, sizeof(__pyx_k_ListStringTable), 0, 0, 1, 1},
17469   {&__pyx_n_s_Lock, __pyx_k_Lock, sizeof(__pyx_k_Lock), 0, 0, 1, 1},
17470   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
17471   {&__pyx_n_s_MsgpackEncoderBase, __pyx_k_MsgpackEncoderBase, sizeof(__pyx_k_MsgpackEncoderBase), 0, 0, 1, 1},
17472   {&__pyx_n_s_MsgpackEncoderV03, __pyx_k_MsgpackEncoderV03, sizeof(__pyx_k_MsgpackEncoderV03), 0, 0, 1, 1},
17473   {&__pyx_n_s_MsgpackEncoderV05, __pyx_k_MsgpackEncoderV05, sizeof(__pyx_k_MsgpackEncoderV05), 0, 0, 1, 1},
17474   {&__pyx_n_s_MsgpackStringTable, __pyx_k_MsgpackStringTable, sizeof(__pyx_k_MsgpackStringTable), 0, 0, 1, 1},
17475   {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
17476   {&__pyx_n_s_ORIGIN_KEY, __pyx_k_ORIGIN_KEY, sizeof(__pyx_k_ORIGIN_KEY), 0, 0, 1, 1},
17477   {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
17478   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
17479   {&__pyx_kp_s_Pickling_of_struct_members_such, __pyx_k_Pickling_of_struct_members_such, sizeof(__pyx_k_Pickling_of_struct_members_such), 0, 0, 1, 0},
17480   {&__pyx_n_s_RLock, __pyx_k_RLock, sizeof(__pyx_k_RLock), 0, 0, 1, 1},
17481   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
17482   {&__pyx_n_s_StringTable, __pyx_k_StringTable, sizeof(__pyx_k_StringTable), 0, 0, 1, 1},
17483   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
17484   {&__pyx_kp_s_Unable_to_allocate_internal_buff, __pyx_k_Unable_to_allocate_internal_buff, sizeof(__pyx_k_Unable_to_allocate_internal_buff), 0, 0, 1, 0},
17485   {&__pyx_kp_s_Unhandled_meta_type_r, __pyx_k_Unhandled_meta_type_r, sizeof(__pyx_k_Unhandled_meta_type_r), 0, 0, 1, 0},
17486   {&__pyx_kp_s_Unhandled_metrics_type_r, __pyx_k_Unhandled_metrics_type_r, sizeof(__pyx_k_Unhandled_metrics_type_r), 0, 0, 1, 0},
17487   {&__pyx_kp_s_Unhandled_numeric_type_r, __pyx_k_Unhandled_numeric_type_r, sizeof(__pyx_k_Unhandled_numeric_type_r), 0, 0, 1, 0},
17488   {&__pyx_kp_s_Unhandled_text_type_r, __pyx_k_Unhandled_text_type_r, sizeof(__pyx_k_Unhandled_text_type_r), 0, 0, 1, 0},
17489   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
17490   {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
17491   {&__pyx_kp_s_application_msgpack, __pyx_k_application_msgpack, sizeof(__pyx_k_application_msgpack), 0, 0, 1, 0},
17492   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
17493   {&__pyx_n_s_content_type, __pyx_k_content_type, sizeof(__pyx_k_content_type), 0, 0, 1, 1},
17494   {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
17495   {&__pyx_n_s_dd_origin, __pyx_k_dd_origin, sizeof(__pyx_k_dd_origin), 0, 0, 1, 1},
17496   {&__pyx_n_s_ddtrace_constants, __pyx_k_ddtrace_constants, sizeof(__pyx_k_ddtrace_constants), 0, 0, 1, 1},
17497   {&__pyx_n_s_ddtrace_internal__encoding, __pyx_k_ddtrace_internal__encoding, sizeof(__pyx_k_ddtrace_internal__encoding), 0, 0, 1, 1},
17498   {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
17499   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
17500   {&__pyx_kp_s_dict_is_too_large, __pyx_k_dict_is_too_large, sizeof(__pyx_k_dict_is_too_large), 0, 0, 1, 0},
17501   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
17502   {&__pyx_n_s_duration_ns, __pyx_k_duration_ns, sizeof(__pyx_k_duration_ns), 0, 0, 1, 1},
17503   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
17504   {&__pyx_n_s_encode_item, __pyx_k_encode_item, sizeof(__pyx_k_encode_item), 0, 0, 1, 1},
17505   {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
17506   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
17507   {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
17508   {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
17509   {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
17510   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
17511   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
17512   {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
17513   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
17514   {&__pyx_kp_s_internal_error, __pyx_k_internal_error, sizeof(__pyx_k_internal_error), 0, 0, 1, 0},
17515   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
17516   {&__pyx_kp_s_list_is_too_large, __pyx_k_list_is_too_large, sizeof(__pyx_k_list_is_too_large), 0, 0, 1, 0},
17517   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
17518   {&__pyx_n_s_max_item_size, __pyx_k_max_item_size, sizeof(__pyx_k_max_item_size), 0, 0, 1, 1},
17519   {&__pyx_n_s_max_size, __pyx_k_max_size, sizeof(__pyx_k_max_size), 0, 0, 1, 1},
17520   {&__pyx_n_s_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 0, 1, 1},
17521   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
17522   {&__pyx_n_s_metrics, __pyx_k_metrics, sizeof(__pyx_k_metrics), 0, 0, 1, 1},
17523   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
17524   {&__pyx_n_s_msgpack, __pyx_k_msgpack, sizeof(__pyx_k_msgpack), 0, 0, 1, 1},
17525   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
17526   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
17527   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
17528   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
17529   {&__pyx_n_s_parent_id, __pyx_k_parent_id, sizeof(__pyx_k_parent_id), 0, 0, 1, 1},
17530   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
17531   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
17532   {&__pyx_n_s_put, __pyx_k_put, sizeof(__pyx_k_put), 0, 0, 1, 1},
17533   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
17534   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
17535   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
17536   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
17537   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
17538   {&__pyx_n_s_pyx_unpickle_ListStringTable, __pyx_k_pyx_unpickle_ListStringTable, sizeof(__pyx_k_pyx_unpickle_ListStringTable), 0, 0, 1, 1},
17539   {&__pyx_n_s_pyx_unpickle_StringTable, __pyx_k_pyx_unpickle_StringTable, sizeof(__pyx_k_pyx_unpickle_StringTable), 0, 0, 1, 1},
17540   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
17541   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
17542   {&__pyx_n_s_raw, __pyx_k_raw, sizeof(__pyx_k_raw), 0, 0, 1, 1},
17543   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
17544   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
17545   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
17546   {&__pyx_n_s_resource, __pyx_k_resource, sizeof(__pyx_k_resource), 0, 0, 1, 1},
17547   {&__pyx_n_s_service, __pyx_k_service, sizeof(__pyx_k_service), 0, 0, 1, 1},
17548   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
17549   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
17550   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
17551   {&__pyx_n_s_span_id, __pyx_k_span_id, sizeof(__pyx_k_span_id), 0, 0, 1, 1},
17552   {&__pyx_n_s_span_type, __pyx_k_span_type, sizeof(__pyx_k_span_type), 0, 0, 1, 1},
17553   {&__pyx_n_s_start_ns, __pyx_k_start_ns, sizeof(__pyx_k_start_ns), 0, 0, 1, 1},
17554   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
17555   {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
17556   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
17557   {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
17558   {&__pyx_n_s_trace_id, __pyx_k_trace_id, sizeof(__pyx_k_trace_id), 0, 0, 1, 1},
17559   {&__pyx_kp_s_unicode_string_is_too_large, __pyx_k_unicode_string_is_too_large, sizeof(__pyx_k_unicode_string_is_too_large), 0, 0, 1, 0},
17560   {&__pyx_n_s_unpackb, __pyx_k_unpackb, sizeof(__pyx_k_unpackb), 0, 0, 1, 1},
17561   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
17562   {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
17563   {0, 0, 0, 0, 0, 0, 0}
17564 };
__Pyx_InitCachedBuiltins(void)17565 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
17566   __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 92, __pyx_L1_error)
17567   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 101, __pyx_L1_error)
17568   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 114, __pyx_L1_error)
17569   __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 186, __pyx_L1_error)
17570   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 207, __pyx_L1_error)
17571   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 233, __pyx_L1_error)
17572   __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 310, __pyx_L1_error)
17573   return 0;
17574   __pyx_L1_error:;
17575   return -1;
17576 }
17577 
__Pyx_InitCachedConstants(void)17578 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
17579   __Pyx_RefNannyDeclarations
17580   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
17581 
17582   /* "ddtrace/internal/_encoding.pyx":93
17583  *             return msgpack_pack_long_long(pk, <long long> n)
17584  *         except OverflowError as oe:
17585  *             raise OverflowError("Integer value out of range")             # <<<<<<<<<<<<<<
17586  *
17587  *     if PyInt_Check(n):
17588  */
17589   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Integer_value_out_of_range); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 93, __pyx_L1_error)
17590   __Pyx_GOTREF(__pyx_tuple_);
17591   __Pyx_GIVEREF(__pyx_tuple_);
17592 
17593   /* "ddtrace/internal/_encoding.pyx":124
17594  *             ret = msgpack_pack_unicode(pk, text, ITEM_LIMIT)
17595  *             if ret == -2:
17596  *                 raise ValueError("unicode string is too large")             # <<<<<<<<<<<<<<
17597  *         ELSE:
17598  *             text = PyUnicode_AsEncodedString(text, "utf-8", NULL)
17599  */
17600   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_unicode_string_is_too_large); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 124, __pyx_L1_error)
17601   __Pyx_GOTREF(__pyx_tuple__2);
17602   __Pyx_GIVEREF(__pyx_tuple__2);
17603 
17604   /* "ddtrace/internal/_encoding.pyx":207
17605  *         self.pk.buf = <char*> PyMem_Malloc(self.pk.buf_size)
17606  *         if self.pk.buf == NULL:
17607  *             raise MemoryError("Unable to allocate internal buffer.")             # <<<<<<<<<<<<<<
17608  *         self.max_size = max_size
17609  *         self.pk.length = MSGPACK_STRING_TABLE_LENGTH_PREFIX_SIZE
17610  */
17611   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_allocate_internal_buff); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 207, __pyx_L1_error)
17612   __Pyx_GOTREF(__pyx_tuple__4);
17613   __Pyx_GIVEREF(__pyx_tuple__4);
17614 
17615   /* "ddtrace/internal/_encoding.pyx":233
17616  *         ret = pack_text(&self.pk, string)
17617  *         if ret != 0:
17618  *             raise RuntimeError("Failed to add string to msgpack string table")             # <<<<<<<<<<<<<<
17619  *
17620  *     cdef savepoint(self):
17621  */
17622   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_add_string_to_msgpack); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 233, __pyx_L1_error)
17623   __Pyx_GOTREF(__pyx_tuple__5);
17624   __Pyx_GIVEREF(__pyx_tuple__5);
17625 
17626   /* "ddtrace/internal/_encoding.pyx":250
17627  *         cdef int old_pos = self.pk.length
17628  *
17629  *         with self._lock:             # <<<<<<<<<<<<<<
17630  *             # Update table size prefix
17631  *             self.pk.length = offset
17632  */
17633   __pyx_tuple__6 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 250, __pyx_L1_error)
17634   __Pyx_GOTREF(__pyx_tuple__6);
17635   __Pyx_GIVEREF(__pyx_tuple__6);
17636 
17637   /* "ddtrace/internal/_encoding.pyx":276
17638  *             res = msgpack_pack_raw_body(&self.pk, <char *>PyLong_AsLong(src), size)
17639  *             if res != 0:
17640  *                 raise RuntimeError("Failed to append raw bytes to msgpack string table")             # <<<<<<<<<<<<<<
17641  *
17642  *     cdef reset(self):
17643  */
17644   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_append_raw_bytes_to_ms); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 276, __pyx_L1_error)
17645   __Pyx_GOTREF(__pyx_tuple__7);
17646   __Pyx_GIVEREF(__pyx_tuple__7);
17647 
17648   /* "(tree fragment)":2
17649  * def __reduce_cython__(self):
17650  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")             # <<<<<<<<<<<<<<
17651  * def __setstate_cython__(self, __pyx_state):
17652  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
17653  */
17654   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Pickling_of_struct_members_such); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 2, __pyx_L1_error)
17655   __Pyx_GOTREF(__pyx_tuple__8);
17656   __Pyx_GIVEREF(__pyx_tuple__8);
17657 
17658   /* "(tree fragment)":4
17659  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")
17660  * def __setstate_cython__(self, __pyx_state):
17661  *     raise TypeError("Pickling of struct members such as self.pk must be explicitly requested with @auto_pickle(True)")             # <<<<<<<<<<<<<<
17662  */
17663   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Pickling_of_struct_members_such); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 4, __pyx_L1_error)
17664   __Pyx_GOTREF(__pyx_tuple__9);
17665   __Pyx_GIVEREF(__pyx_tuple__9);
17666 
17667   /* "(tree fragment)":2
17668  * def __reduce_cython__(self):
17669  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17670  * def __setstate_cython__(self, __pyx_state):
17671  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17672  */
17673   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error)
17674   __Pyx_GOTREF(__pyx_tuple__10);
17675   __Pyx_GIVEREF(__pyx_tuple__10);
17676 
17677   /* "(tree fragment)":4
17678  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17679  * def __setstate_cython__(self, __pyx_state):
17680  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17681  */
17682   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error)
17683   __Pyx_GOTREF(__pyx_tuple__11);
17684   __Pyx_GIVEREF(__pyx_tuple__11);
17685 
17686   /* "(tree fragment)":2
17687  * def __reduce_cython__(self):
17688  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17689  * def __setstate_cython__(self, __pyx_state):
17690  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17691  */
17692   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 2, __pyx_L1_error)
17693   __Pyx_GOTREF(__pyx_tuple__12);
17694   __Pyx_GIVEREF(__pyx_tuple__12);
17695 
17696   /* "(tree fragment)":4
17697  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17698  * def __setstate_cython__(self, __pyx_state):
17699  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17700  */
17701   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error)
17702   __Pyx_GOTREF(__pyx_tuple__13);
17703   __Pyx_GIVEREF(__pyx_tuple__13);
17704 
17705   /* "ddtrace/internal/_encoding.pyx":389
17706  *     cpdef _decode(self, data):
17707  *         import msgpack
17708  *         if msgpack.version[:2] < (0, 6):             # <<<<<<<<<<<<<<
17709  *             return msgpack.unpackb(data)
17710  *         return msgpack.unpackb(data, raw=True)
17711  */
17712   __pyx_slice__14 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 389, __pyx_L1_error)
17713   __Pyx_GOTREF(__pyx_slice__14);
17714   __Pyx_GIVEREF(__pyx_slice__14);
17715   __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_6); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 389, __pyx_L1_error)
17716   __Pyx_GOTREF(__pyx_tuple__15);
17717   __Pyx_GIVEREF(__pyx_tuple__15);
17718 
17719   /* "ddtrace/internal/_encoding.pyx":435
17720  *         L = len(trace)
17721  *         if L > ITEM_LIMIT:
17722  *             raise ValueError("list is too large")             # <<<<<<<<<<<<<<
17723  *
17724  *         ret = msgpack_pack_array(&self.pk, L)
17725  */
17726   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_list_is_too_large); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 435, __pyx_L1_error)
17727   __Pyx_GOTREF(__pyx_tuple__16);
17728   __Pyx_GIVEREF(__pyx_tuple__16);
17729 
17730   /* "ddtrace/internal/_encoding.pyx":438
17731  *
17732  *         ret = msgpack_pack_array(&self.pk, L)
17733  *         if ret != 0: raise RuntimeError("Couldn't pack trace")             # <<<<<<<<<<<<<<
17734  *
17735  *         if L > 0 and trace[0].context is not None and trace[0].context.dd_origin is not None:
17736  */
17737   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Couldn_t_pack_trace); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 438, __pyx_L1_error)
17738   __Pyx_GOTREF(__pyx_tuple__17);
17739   __Pyx_GIVEREF(__pyx_tuple__17);
17740 
17741   /* "ddtrace/internal/_encoding.pyx":445
17742  *         for span in trace:
17743  *             ret = self.pack_span(span, dd_origin)
17744  *             if ret != 0: raise RuntimeError("Couldn't pack span")             # <<<<<<<<<<<<<<
17745  *
17746  *         return ret
17747  */
17748   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Couldn_t_pack_span); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 445, __pyx_L1_error)
17749   __Pyx_GOTREF(__pyx_tuple__18);
17750   __Pyx_GIVEREF(__pyx_tuple__18);
17751 
17752   /* "ddtrace/internal/_encoding.pyx":459
17753  *                 ret = self._pack_trace(trace)
17754  *                 if ret:  # should not happen.
17755  *                     raise RuntimeError("internal error")             # <<<<<<<<<<<<<<
17756  *
17757  *                 # DEV: msgpack avoids buffer overflows by calling PyMem_Realloc so
17758  */
17759   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_internal_error); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 459, __pyx_L1_error)
17760   __Pyx_GOTREF(__pyx_tuple__19);
17761   __Pyx_GIVEREF(__pyx_tuple__19);
17762 
17763   /* "(tree fragment)":2
17764  * def __reduce_cython__(self):
17765  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17766  * def __setstate_cython__(self, __pyx_state):
17767  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17768  */
17769   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
17770   __Pyx_GOTREF(__pyx_tuple__20);
17771   __Pyx_GIVEREF(__pyx_tuple__20);
17772 
17773   /* "(tree fragment)":4
17774  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17775  * def __setstate_cython__(self, __pyx_state):
17776  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17777  */
17778   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
17779   __Pyx_GOTREF(__pyx_tuple__21);
17780   __Pyx_GIVEREF(__pyx_tuple__21);
17781 
17782   /* "ddtrace/internal/_encoding.pyx":515
17783  *                 L += 1
17784  *             if L > ITEM_LIMIT:
17785  *                 raise ValueError("dict is too large")             # <<<<<<<<<<<<<<
17786  *
17787  *             ret = msgpack_pack_map(&self.pk, L)
17788  */
17789   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_dict_is_too_large); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 515, __pyx_L1_error)
17790   __Pyx_GOTREF(__pyx_tuple__22);
17791   __Pyx_GIVEREF(__pyx_tuple__22);
17792 
17793   /* "(tree fragment)":2
17794  * def __reduce_cython__(self):
17795  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17796  * def __setstate_cython__(self, __pyx_state):
17797  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17798  */
17799   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
17800   __Pyx_GOTREF(__pyx_tuple__23);
17801   __Pyx_GIVEREF(__pyx_tuple__23);
17802 
17803   /* "(tree fragment)":4
17804  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17805  * def __setstate_cython__(self, __pyx_state):
17806  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17807  */
17808   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
17809   __Pyx_GOTREF(__pyx_tuple__24);
17810   __Pyx_GIVEREF(__pyx_tuple__24);
17811 
17812   /* "(tree fragment)":2
17813  * def __reduce_cython__(self):
17814  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17815  * def __setstate_cython__(self, __pyx_state):
17816  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17817  */
17818   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 2, __pyx_L1_error)
17819   __Pyx_GOTREF(__pyx_tuple__25);
17820   __Pyx_GIVEREF(__pyx_tuple__25);
17821 
17822   /* "(tree fragment)":4
17823  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17824  * def __setstate_cython__(self, __pyx_state):
17825  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
17826  */
17827   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error)
17828   __Pyx_GOTREF(__pyx_tuple__26);
17829   __Pyx_GIVEREF(__pyx_tuple__26);
17830 
17831   /* "(tree fragment)":1
17832  * def __pyx_unpickle_StringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
17833  *     cdef object __pyx_PickleError
17834  *     cdef object __pyx_result
17835  */
17836   __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 1, __pyx_L1_error)
17837   __Pyx_GOTREF(__pyx_tuple__27);
17838   __Pyx_GIVEREF(__pyx_tuple__27);
17839   __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_StringTable, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 1, __pyx_L1_error)
17840   __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 1, __pyx_L1_error)
17841   __Pyx_GOTREF(__pyx_tuple__29);
17842   __Pyx_GIVEREF(__pyx_tuple__29);
17843   __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ListStringTable, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 1, __pyx_L1_error)
17844   __Pyx_RefNannyFinishContext();
17845   return 0;
17846   __pyx_L1_error:;
17847   __Pyx_RefNannyFinishContext();
17848   return -1;
17849 }
17850 
__Pyx_InitGlobals(void)17851 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
17852   __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
17853   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
17854   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
17855   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
17856   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
17857   __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
17858   __pyx_int_182609841 = PyInt_FromLong(182609841L); if (unlikely(!__pyx_int_182609841)) __PYX_ERR(0, 1, __pyx_L1_error)
17859   __pyx_int_194841817 = PyInt_FromLong(194841817L); if (unlikely(!__pyx_int_194841817)) __PYX_ERR(0, 1, __pyx_L1_error)
17860   return 0;
17861   __pyx_L1_error:;
17862   return -1;
17863 }
17864 
17865 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
17866 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
17867 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
17868 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
17869 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
17870 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
17871 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
17872 
__Pyx_modinit_global_init_code(void)17873 static int __Pyx_modinit_global_init_code(void) {
17874   __Pyx_RefNannyDeclarations
17875   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
17876   /*--- Global init code ---*/
17877   __Pyx_RefNannyFinishContext();
17878   return 0;
17879 }
17880 
__Pyx_modinit_variable_export_code(void)17881 static int __Pyx_modinit_variable_export_code(void) {
17882   __Pyx_RefNannyDeclarations
17883   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
17884   /*--- Variable export code ---*/
17885   __Pyx_RefNannyFinishContext();
17886   return 0;
17887 }
17888 
__Pyx_modinit_function_export_code(void)17889 static int __Pyx_modinit_function_export_code(void) {
17890   __Pyx_RefNannyDeclarations
17891   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
17892   /*--- Function export code ---*/
17893   __Pyx_RefNannyFinishContext();
17894   return 0;
17895 }
17896 
__Pyx_modinit_type_init_code(void)17897 static int __Pyx_modinit_type_init_code(void) {
17898   __Pyx_RefNannyDeclarations
17899   int __pyx_lineno = 0;
17900   const char *__pyx_filename = NULL;
17901   int __pyx_clineno = 0;
17902   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
17903   /*--- Type init code ---*/
17904   __pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable = &__pyx_vtable_7ddtrace_8internal_9_encoding_StringTable;
17905   __pyx_vtable_7ddtrace_8internal_9_encoding_StringTable.insert = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_insert;
17906   __pyx_vtable_7ddtrace_8internal_9_encoding_StringTable._index = (uint32_t (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_11StringTable__index;
17907   __pyx_vtable_7ddtrace_8internal_9_encoding_StringTable.index = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_index;
17908   __pyx_vtable_7ddtrace_8internal_9_encoding_StringTable.reset = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *))__pyx_f_7ddtrace_8internal_9_encoding_11StringTable_reset;
17909   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_StringTable) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
17910   #if PY_VERSION_HEX < 0x030800B1
17911   __pyx_type_7ddtrace_8internal_9_encoding_StringTable.tp_print = 0;
17912   #endif
17913   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_StringTable.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_StringTable.tp_getattro == PyObject_GenericGetAttr)) {
17914     __pyx_type_7ddtrace_8internal_9_encoding_StringTable.tp_getattro = __Pyx_PyObject_GenericGetAttr;
17915   }
17916   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_StringTable.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
17917   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_StringTable, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_StringTable) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
17918   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_StringTable) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
17919   __pyx_ptype_7ddtrace_8internal_9_encoding_StringTable = &__pyx_type_7ddtrace_8internal_9_encoding_StringTable;
17920   __pyx_vtabptr_7ddtrace_8internal_9_encoding_ListStringTable = &__pyx_vtable_7ddtrace_8internal_9_encoding_ListStringTable;
17921   __pyx_vtable_7ddtrace_8internal_9_encoding_ListStringTable.__pyx_base = *__pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable;
17922   __pyx_vtable_7ddtrace_8internal_9_encoding_ListStringTable.__pyx_base.insert = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_15ListStringTable_insert;
17923   __pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_StringTable;
17924   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
17925   #if PY_VERSION_HEX < 0x030800B1
17926   __pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_print = 0;
17927   #endif
17928   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_getattro == PyObject_GenericGetAttr)) {
17929     __pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_getattro = __Pyx_PyObject_GenericGetAttr;
17930   }
17931   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_ListStringTable) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
17932   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ListStringTable, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
17933   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
17934   __pyx_ptype_7ddtrace_8internal_9_encoding_ListStringTable = &__pyx_type_7ddtrace_8internal_9_encoding_ListStringTable;
17935   __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackStringTable = &__pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable;
17936   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.__pyx_base = *__pyx_vtabptr_7ddtrace_8internal_9_encoding_StringTable;
17937   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.__pyx_base.insert = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_insert;
17938   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_StringTable *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_reset;
17939   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.savepoint = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_savepoint;
17940   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.rollback = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_rollback;
17941   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.get_bytes = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_get_bytes;
17942   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.append_raw = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *, long, Py_ssize_t))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_append_raw;
17943   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackStringTable.flush = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackStringTable *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackStringTable_flush;
17944   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_StringTable;
17945   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
17946   #if PY_VERSION_HEX < 0x030800B1
17947   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_print = 0;
17948   #endif
17949   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_getattro == PyObject_GenericGetAttr)) {
17950     __pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_getattro = __Pyx_PyObject_GenericGetAttr;
17951   }
17952   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackStringTable) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
17953   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MsgpackStringTable, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
17954   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
17955   __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackStringTable = &__pyx_type_7ddtrace_8internal_9_encoding_MsgpackStringTable;
17956   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
17957   #if PY_VERSION_HEX < 0x030800B1
17958   __pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder.tp_print = 0;
17959   #endif
17960   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder.tp_getattro == PyObject_GenericGetAttr)) {
17961     __pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder.tp_getattro = __Pyx_PyObject_GenericGetAttr;
17962   }
17963   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BufferedEncoder, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
17964   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
17965   __pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder = &__pyx_type_7ddtrace_8internal_9_encoding_BufferedEncoder;
17966   __pyx_vtabptr_7ddtrace_8internal_9_encoding_ListBufferedEncoder = &__pyx_vtable_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
17967   __pyx_vtable_7ddtrace_8internal_9_encoding_ListBufferedEncoder.put = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_put;
17968   __pyx_vtable_7ddtrace_8internal_9_encoding_ListBufferedEncoder.get = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_ListBufferedEncoder *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_19ListBufferedEncoder_get;
17969   __pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder;
17970   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
17971   #if PY_VERSION_HEX < 0x030800B1
17972   __pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_print = 0;
17973   #endif
17974   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_getattro == PyObject_GenericGetAttr)) {
17975     __pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_getattro = __Pyx_PyObject_GenericGetAttr;
17976   }
17977   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_ListBufferedEncoder) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
17978   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ListBufferedEncoder, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
17979   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
17980   __pyx_ptype_7ddtrace_8internal_9_encoding_ListBufferedEncoder = &__pyx_type_7ddtrace_8internal_9_encoding_ListBufferedEncoder;
17981   __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase = &__pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
17982   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase._decode = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__decode;
17983   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase._reset_buffer = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__reset_buffer;
17984   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.encode = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_encode;
17985   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase._update_array_len = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__update_array_len;
17986   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.get_bytes = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_bytes;
17987   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.get_buffer = (char *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_buffer;
17988   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.get_dd_origin_ref = (void *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_get_dd_origin_ref;
17989   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase._pack_trace = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase__pack_trace;
17990   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.put = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_put;
17991   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.flush = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_flush;
17992   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.pack_span = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, void *))__pyx_f_7ddtrace_8internal_9_encoding_18MsgpackEncoderBase_pack_span;
17993   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder;
17994   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
17995   #if PY_VERSION_HEX < 0x030800B1
17996   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_print = 0;
17997   #endif
17998   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_getattro == PyObject_GenericGetAttr)) {
17999     __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_getattro = __Pyx_PyObject_GenericGetAttr;
18000   }
18001   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
18002   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MsgpackEncoderBase, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
18003   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
18004   __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase = &__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
18005   __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 = &__pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
18006   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.__pyx_base = *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
18007   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.__pyx_base.get_dd_origin_ref = (void *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_get_dd_origin_ref;
18008   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.__pyx_base.flush = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_flush;
18009   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.__pyx_base.pack_span = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, void *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03_pack_span;
18010   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03._pack_meta = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *, char *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_meta;
18011   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV03._pack_metrics = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV03__pack_metrics;
18012   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
18013   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
18014   #if PY_VERSION_HEX < 0x030800B1
18015   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_print = 0;
18016   #endif
18017   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_getattro == PyObject_GenericGetAttr)) {
18018     __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_getattro = __Pyx_PyObject_GenericGetAttr;
18019   }
18020   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV03) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
18021   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MsgpackEncoderV03, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
18022   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03) < 0) __PYX_ERR(0, 493, __pyx_L1_error)
18023   __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV03 = &__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV03;
18024   __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 = &__pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
18025   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.__pyx_base = *__pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
18026   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.__pyx_base.get_dd_origin_ref = (void *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_get_dd_origin_ref;
18027   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.__pyx_base.put = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_put;
18028   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.__pyx_base.flush = (PyObject *(*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, int __pyx_skip_dispatch))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_flush;
18029   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.__pyx_base.pack_span = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderBase *, PyObject *, void *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05_pack_span;
18030   __pyx_vtable_7ddtrace_8internal_9_encoding_MsgpackEncoderV05._pack_string = (int (*)(struct __pyx_obj_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 *, PyObject *))__pyx_f_7ddtrace_8internal_9_encoding_17MsgpackEncoderV05__pack_string;
18031   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_base = __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase;
18032   if (PyType_Ready(&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05) < 0) __PYX_ERR(0, 638, __pyx_L1_error)
18033   #if PY_VERSION_HEX < 0x030800B1
18034   __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_print = 0;
18035   #endif
18036   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_dictoffset && __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_getattro == PyObject_GenericGetAttr)) {
18037     __pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_getattro = __Pyx_PyObject_GenericGetAttr;
18038   }
18039   if (__Pyx_SetVtable(__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05.tp_dict, __pyx_vtabptr_7ddtrace_8internal_9_encoding_MsgpackEncoderV05) < 0) __PYX_ERR(0, 638, __pyx_L1_error)
18040   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MsgpackEncoderV05, (PyObject *)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05) < 0) __PYX_ERR(0, 638, __pyx_L1_error)
18041   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05) < 0) __PYX_ERR(0, 638, __pyx_L1_error)
18042   __pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderV05 = &__pyx_type_7ddtrace_8internal_9_encoding_MsgpackEncoderV05;
18043   __Pyx_RefNannyFinishContext();
18044   return 0;
18045   __pyx_L1_error:;
18046   __Pyx_RefNannyFinishContext();
18047   return -1;
18048 }
18049 
__Pyx_modinit_type_import_code(void)18050 static int __Pyx_modinit_type_import_code(void) {
18051   __Pyx_RefNannyDeclarations
18052   PyObject *__pyx_t_1 = NULL;
18053   int __pyx_lineno = 0;
18054   const char *__pyx_filename = NULL;
18055   int __pyx_clineno = 0;
18056   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
18057   /*--- Type import code ---*/
18058   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
18059   __Pyx_GOTREF(__pyx_t_1);
18060   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
18061   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
18062   sizeof(PyTypeObject),
18063   #else
18064   sizeof(PyHeapTypeObject),
18065   #endif
18066   __Pyx_ImportType_CheckSize_Warn);
18067    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
18068   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18069   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
18070   __Pyx_GOTREF(__pyx_t_1);
18071   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
18072    if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error)
18073   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18074   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
18075   __Pyx_GOTREF(__pyx_t_1);
18076   __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
18077    if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
18078   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18079   __Pyx_RefNannyFinishContext();
18080   return 0;
18081   __pyx_L1_error:;
18082   __Pyx_XDECREF(__pyx_t_1);
18083   __Pyx_RefNannyFinishContext();
18084   return -1;
18085 }
18086 
__Pyx_modinit_variable_import_code(void)18087 static int __Pyx_modinit_variable_import_code(void) {
18088   __Pyx_RefNannyDeclarations
18089   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
18090   /*--- Variable import code ---*/
18091   __Pyx_RefNannyFinishContext();
18092   return 0;
18093 }
18094 
__Pyx_modinit_function_import_code(void)18095 static int __Pyx_modinit_function_import_code(void) {
18096   __Pyx_RefNannyDeclarations
18097   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
18098   /*--- Function import code ---*/
18099   __Pyx_RefNannyFinishContext();
18100   return 0;
18101 }
18102 
18103 
18104 #ifndef CYTHON_NO_PYINIT_EXPORT
18105 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
18106 #elif PY_MAJOR_VERSION < 3
18107 #ifdef __cplusplus
18108 #define __Pyx_PyMODINIT_FUNC extern "C" void
18109 #else
18110 #define __Pyx_PyMODINIT_FUNC void
18111 #endif
18112 #else
18113 #ifdef __cplusplus
18114 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
18115 #else
18116 #define __Pyx_PyMODINIT_FUNC PyObject *
18117 #endif
18118 #endif
18119 
18120 
18121 #if PY_MAJOR_VERSION < 3
18122 __Pyx_PyMODINIT_FUNC init_encoding(void) CYTHON_SMALL_CODE; /*proto*/
init_encoding(void)18123 __Pyx_PyMODINIT_FUNC init_encoding(void)
18124 #else
18125 __Pyx_PyMODINIT_FUNC PyInit__encoding(void) CYTHON_SMALL_CODE; /*proto*/
18126 __Pyx_PyMODINIT_FUNC PyInit__encoding(void)
18127 #if CYTHON_PEP489_MULTI_PHASE_INIT
18128 {
18129   return PyModuleDef_Init(&__pyx_moduledef);
18130 }
18131 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
18132     #if PY_VERSION_HEX >= 0x030700A1
18133     static PY_INT64_T main_interpreter_id = -1;
18134     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
18135     if (main_interpreter_id == -1) {
18136         main_interpreter_id = current_id;
18137         return (unlikely(current_id == -1)) ? -1 : 0;
18138     } else if (unlikely(main_interpreter_id != current_id))
18139     #else
18140     static PyInterpreterState *main_interpreter = NULL;
18141     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
18142     if (!main_interpreter) {
18143         main_interpreter = current_interpreter;
18144     } else if (unlikely(main_interpreter != current_interpreter))
18145     #endif
18146     {
18147         PyErr_SetString(
18148             PyExc_ImportError,
18149             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
18150         return -1;
18151     }
18152     return 0;
18153 }
18154 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
18155     PyObject *value = PyObject_GetAttrString(spec, from_name);
18156     int result = 0;
18157     if (likely(value)) {
18158         if (allow_none || value != Py_None) {
18159             result = PyDict_SetItemString(moddict, to_name, value);
18160         }
18161         Py_DECREF(value);
18162     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
18163         PyErr_Clear();
18164     } else {
18165         result = -1;
18166     }
18167     return result;
18168 }
18169 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
18170     PyObject *module = NULL, *moddict, *modname;
18171     if (__Pyx_check_single_interpreter())
18172         return NULL;
18173     if (__pyx_m)
18174         return __Pyx_NewRef(__pyx_m);
18175     modname = PyObject_GetAttrString(spec, "name");
18176     if (unlikely(!modname)) goto bad;
18177     module = PyModule_NewObject(modname);
18178     Py_DECREF(modname);
18179     if (unlikely(!module)) goto bad;
18180     moddict = PyModule_GetDict(module);
18181     if (unlikely(!moddict)) goto bad;
18182     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
18183     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
18184     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
18185     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
18186     return module;
18187 bad:
18188     Py_XDECREF(module);
18189     return NULL;
18190 }
18191 
18192 
18193 static CYTHON_SMALL_CODE int __pyx_pymod_exec__encoding(PyObject *__pyx_pyinit_module)
18194 #endif
18195 #endif
18196 {
18197   PyObject *__pyx_t_1 = NULL;
18198   PyObject *__pyx_t_2 = NULL;
18199   PyObject *__pyx_t_3 = NULL;
18200   PyObject *__pyx_t_4 = NULL;
18201   Py_ssize_t __pyx_t_5;
18202   int __pyx_lineno = 0;
18203   const char *__pyx_filename = NULL;
18204   int __pyx_clineno = 0;
18205   __Pyx_RefNannyDeclarations
18206   #if CYTHON_PEP489_MULTI_PHASE_INIT
18207   if (__pyx_m) {
18208     if (__pyx_m == __pyx_pyinit_module) return 0;
18209     PyErr_SetString(PyExc_RuntimeError, "Module '_encoding' has already been imported. Re-initialisation is not supported.");
18210     return -1;
18211   }
18212   #elif PY_MAJOR_VERSION >= 3
18213   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
18214   #endif
18215   #if CYTHON_REFNANNY
18216 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
18217 if (!__Pyx_RefNanny) {
18218   PyErr_Clear();
18219   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
18220   if (!__Pyx_RefNanny)
18221       Py_FatalError("failed to import 'refnanny' module");
18222 }
18223 #endif
18224   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__encoding(void)", 0);
18225   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18226   #ifdef __Pxy_PyFrame_Initialize_Offsets
18227   __Pxy_PyFrame_Initialize_Offsets();
18228   #endif
18229   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
18230   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
18231   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
18232   #ifdef __Pyx_CyFunction_USED
18233   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18234   #endif
18235   #ifdef __Pyx_FusedFunction_USED
18236   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18237   #endif
18238   #ifdef __Pyx_Coroutine_USED
18239   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18240   #endif
18241   #ifdef __Pyx_Generator_USED
18242   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18243   #endif
18244   #ifdef __Pyx_AsyncGen_USED
18245   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18246   #endif
18247   #ifdef __Pyx_StopAsyncIteration_USED
18248   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18249   #endif
18250   /*--- Library function declarations ---*/
18251   /*--- Threads initialization code ---*/
18252   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
18253   PyEval_InitThreads();
18254   #endif
18255   /*--- Module creation code ---*/
18256   #if CYTHON_PEP489_MULTI_PHASE_INIT
18257   __pyx_m = __pyx_pyinit_module;
18258   Py_INCREF(__pyx_m);
18259   #else
18260   #if PY_MAJOR_VERSION < 3
18261   __pyx_m = Py_InitModule4("_encoding", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
18262   #else
18263   __pyx_m = PyModule_Create(&__pyx_moduledef);
18264   #endif
18265   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
18266   #endif
18267   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
18268   Py_INCREF(__pyx_d);
18269   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
18270   Py_INCREF(__pyx_b);
18271   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
18272   Py_INCREF(__pyx_cython_runtime);
18273   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
18274   /*--- Initialize various global constants etc. ---*/
18275   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18276   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
18277   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18278   #endif
18279   if (__pyx_module_is_main_ddtrace__internal___encoding) {
18280     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18281   }
18282   #if PY_MAJOR_VERSION >= 3
18283   {
18284     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
18285     if (!PyDict_GetItemString(modules, "ddtrace.internal._encoding")) {
18286       if (unlikely(PyDict_SetItemString(modules, "ddtrace.internal._encoding", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
18287     }
18288   }
18289   #endif
18290   /*--- Builtin init code ---*/
18291   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18292   /*--- Constants init code ---*/
18293   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18294   /*--- Global type/function init code ---*/
18295   (void)__Pyx_modinit_global_init_code();
18296   (void)__Pyx_modinit_variable_export_code();
18297   (void)__Pyx_modinit_function_export_code();
18298   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
18299   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
18300   (void)__Pyx_modinit_variable_import_code();
18301   (void)__Pyx_modinit_function_import_code();
18302   /*--- Execution code ---*/
18303   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
18304   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18305   #endif
18306 
18307   /* "ddtrace/internal/_encoding.pyx":5
18308  * from libc cimport stdint
18309  * from libc.string cimport strlen
18310  * import threading             # <<<<<<<<<<<<<<
18311  * from ._utils cimport PyBytesLike_Check
18312  *
18313  */
18314   __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
18315   __Pyx_GOTREF(__pyx_t_1);
18316   if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
18317   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18318 
18319   /* "ddtrace/internal/_encoding.pyx":8
18320  * from ._utils cimport PyBytesLike_Check
18321  *
18322  * from ddtrace.constants import ORIGIN_KEY             # <<<<<<<<<<<<<<
18323  *
18324  *
18325  */
18326   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
18327   __Pyx_GOTREF(__pyx_t_1);
18328   __Pyx_INCREF(__pyx_n_s_ORIGIN_KEY);
18329   __Pyx_GIVEREF(__pyx_n_s_ORIGIN_KEY);
18330   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ORIGIN_KEY);
18331   __pyx_t_2 = __Pyx_Import(__pyx_n_s_ddtrace_constants, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
18332   __Pyx_GOTREF(__pyx_t_2);
18333   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18334   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ORIGIN_KEY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
18335   __Pyx_GOTREF(__pyx_t_1);
18336   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ORIGIN_KEY, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
18337   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18338   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18339 
18340   /* "ddtrace/internal/_encoding.pyx":40
18341  *
18342  *
18343  * cdef long long ITEM_LIMIT = (2**32)-1             # <<<<<<<<<<<<<<
18344  *
18345  *
18346  */
18347   __pyx_v_7ddtrace_8internal_9_encoding_ITEM_LIMIT = 0xFFFFFFFF;
18348 
18349   /* "ddtrace/internal/_encoding.pyx":43
18350  *
18351  *
18352  * class BufferFull(Exception):             # <<<<<<<<<<<<<<
18353  *     pass
18354  *
18355  */
18356   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
18357   __Pyx_GOTREF(__pyx_t_2);
18358   __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18359   __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18360   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18361   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
18362   __Pyx_GOTREF(__pyx_t_1);
18363   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_BufferFull, __pyx_n_s_BufferFull, (PyObject *) NULL, __pyx_n_s_ddtrace_internal__encoding, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
18364   __Pyx_GOTREF(__pyx_t_3);
18365   __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_BufferFull, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
18366   __Pyx_GOTREF(__pyx_t_4);
18367   if (PyDict_SetItem(__pyx_d, __pyx_n_s_BufferFull, __pyx_t_4) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
18368   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18369   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18370   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18371   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18372 
18373   /* "ddtrace/internal/_encoding.pyx":47
18374  *
18375  *
18376  * class BufferItemTooLarge(Exception):             # <<<<<<<<<<<<<<
18377  *     pass
18378  *
18379  */
18380   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
18381   __Pyx_GOTREF(__pyx_t_2);
18382   __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18383   __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18384   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
18385   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
18386   __Pyx_GOTREF(__pyx_t_1);
18387   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_BufferItemTooLarge, __pyx_n_s_BufferItemTooLarge, (PyObject *) NULL, __pyx_n_s_ddtrace_internal__encoding, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
18388   __Pyx_GOTREF(__pyx_t_3);
18389   __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_BufferItemTooLarge, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
18390   __Pyx_GOTREF(__pyx_t_4);
18391   if (PyDict_SetItem(__pyx_d, __pyx_n_s_BufferItemTooLarge, __pyx_t_4) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
18392   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18393   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18394   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18395   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18396 
18397   /* "ddtrace/internal/_encoding.pyx":60
18398  * # This is a borrowed reference but should be fine as we don't expect ORIGIN_KEY
18399  * # to get GC'd.
18400  * cdef const char * _ORIGIN_KEY = string_to_buff(ORIGIN_KEY)             # <<<<<<<<<<<<<<
18401  * cdef size_t _ORIGIN_KEY_LEN = <size_t> len(ORIGIN_KEY)
18402  *
18403  */
18404   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ORIGIN_KEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
18405   __Pyx_GOTREF(__pyx_t_2);
18406   if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 60, __pyx_L1_error)
18407   __pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY = __pyx_f_7ddtrace_8internal_9_encoding_string_to_buff(((PyObject*)__pyx_t_2));
18408   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18409 
18410   /* "ddtrace/internal/_encoding.pyx":61
18411  * # to get GC'd.
18412  * cdef const char * _ORIGIN_KEY = string_to_buff(ORIGIN_KEY)
18413  * cdef size_t _ORIGIN_KEY_LEN = <size_t> len(ORIGIN_KEY)             # <<<<<<<<<<<<<<
18414  *
18415  *
18416  */
18417   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ORIGIN_KEY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
18418   __Pyx_GOTREF(__pyx_t_2);
18419   __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 61, __pyx_L1_error)
18420   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18421   __pyx_v_7ddtrace_8internal_9_encoding__ORIGIN_KEY_LEN = ((size_t)__pyx_t_5);
18422 
18423   /* "ddtrace/internal/_encoding.pyx":296
18424  *
18425  * cdef class BufferedEncoder(object):
18426  *     content_type: str = None             # <<<<<<<<<<<<<<
18427  *
18428  *     cdef public size_t max_size
18429  */
18430   if (PyDict_SetItem((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder->tp_dict, __pyx_n_s_content_type, Py_None) < 0) __PYX_ERR(0, 296, __pyx_L1_error)
18431   PyType_Modified(__pyx_ptype_7ddtrace_8internal_9_encoding_BufferedEncoder);
18432 
18433   /* "ddtrace/internal/_encoding.pyx":363
18434  *
18435  * cdef class MsgpackEncoderBase(BufferedEncoder):
18436  *     content_type = "application/msgpack"             # <<<<<<<<<<<<<<
18437  *
18438  *     cdef msgpack_packer pk
18439  */
18440   if (PyDict_SetItem((PyObject *)__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase->tp_dict, __pyx_n_s_content_type, __pyx_kp_s_application_msgpack) < 0) __PYX_ERR(0, 363, __pyx_L1_error)
18441   PyType_Modified(__pyx_ptype_7ddtrace_8internal_9_encoding_MsgpackEncoderBase);
18442 
18443   /* "(tree fragment)":1
18444  * def __pyx_unpickle_StringTable(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
18445  *     cdef object __pyx_PickleError
18446  *     cdef object __pyx_result
18447  */
18448   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7ddtrace_8internal_9_encoding_1__pyx_unpickle_StringTable, NULL, __pyx_n_s_ddtrace_internal__encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
18449   __Pyx_GOTREF(__pyx_t_2);
18450   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_StringTable, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
18451   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18452 
18453   /* "(tree fragment)":11
18454  *         __pyx_unpickle_StringTable__set_state(<StringTable> __pyx_result, __pyx_state)
18455  *     return __pyx_result
18456  * cdef __pyx_unpickle_StringTable__set_state(StringTable __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
18457  *     __pyx_result._next_id = __pyx_state[0]; __pyx_result._table = __pyx_state[1]
18458  *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
18459  */
18460   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7ddtrace_8internal_9_encoding_3__pyx_unpickle_ListStringTable, NULL, __pyx_n_s_ddtrace_internal__encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
18461   __Pyx_GOTREF(__pyx_t_2);
18462   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ListStringTable, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
18463   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18464 
18465   /* "ddtrace/internal/_encoding.pyx":1
18466  * from cpython cimport *             # <<<<<<<<<<<<<<
18467  * from cpython.bytearray cimport PyByteArray_Check
18468  * from libc cimport stdint
18469  */
18470   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
18471   __Pyx_GOTREF(__pyx_t_2);
18472   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
18473   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18474 
18475   /*--- Wrapped vars code ---*/
18476 
18477   goto __pyx_L0;
18478   __pyx_L1_error:;
18479   __Pyx_XDECREF(__pyx_t_1);
18480   __Pyx_XDECREF(__pyx_t_2);
18481   __Pyx_XDECREF(__pyx_t_3);
18482   __Pyx_XDECREF(__pyx_t_4);
18483   if (__pyx_m) {
18484     if (__pyx_d) {
18485       __Pyx_AddTraceback("init ddtrace.internal._encoding", __pyx_clineno, __pyx_lineno, __pyx_filename);
18486     }
18487     Py_CLEAR(__pyx_m);
18488   } else if (!PyErr_Occurred()) {
18489     PyErr_SetString(PyExc_ImportError, "init ddtrace.internal._encoding");
18490   }
18491   __pyx_L0:;
18492   __Pyx_RefNannyFinishContext();
18493   #if CYTHON_PEP489_MULTI_PHASE_INIT
18494   return (__pyx_m != NULL) ? 0 : -1;
18495   #elif PY_MAJOR_VERSION >= 3
18496   return __pyx_m;
18497   #else
18498   return;
18499   #endif
18500 }
18501 
18502 /* --- Runtime support code --- */
18503 /* Refnanny */
18504 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)18505 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
18506     PyObject *m = NULL, *p = NULL;
18507     void *r = NULL;
18508     m = PyImport_ImportModule(modname);
18509     if (!m) goto end;
18510     p = PyObject_GetAttrString(m, "RefNannyAPI");
18511     if (!p) goto end;
18512     r = PyLong_AsVoidPtr(p);
18513 end:
18514     Py_XDECREF(p);
18515     Py_XDECREF(m);
18516     return (__Pyx_RefNannyAPIStruct *)r;
18517 }
18518 #endif
18519 
18520 /* PyObjectGetAttrStr */
18521 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)18522 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
18523     PyTypeObject* tp = Py_TYPE(obj);
18524     if (likely(tp->tp_getattro))
18525         return tp->tp_getattro(obj, attr_name);
18526 #if PY_MAJOR_VERSION < 3
18527     if (likely(tp->tp_getattr))
18528         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
18529 #endif
18530     return PyObject_GetAttr(obj, attr_name);
18531 }
18532 #endif
18533 
18534 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)18535 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
18536     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
18537     if (unlikely(!result)) {
18538         PyErr_Format(PyExc_NameError,
18539 #if PY_MAJOR_VERSION >= 3
18540             "name '%U' is not defined", name);
18541 #else
18542             "name '%.200s' is not defined", PyString_AS_STRING(name));
18543 #endif
18544     }
18545     return result;
18546 }
18547 
18548 /* GetTopmostException */
18549 #if CYTHON_USE_EXC_INFO_STACK
18550 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)18551 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
18552 {
18553     _PyErr_StackItem *exc_info = tstate->exc_info;
18554     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
18555            exc_info->previous_item != NULL)
18556     {
18557         exc_info = exc_info->previous_item;
18558     }
18559     return exc_info;
18560 }
18561 #endif
18562 
18563 /* SaveResetException */
18564 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18565 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
18566     #if CYTHON_USE_EXC_INFO_STACK
18567     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
18568     *type = exc_info->exc_type;
18569     *value = exc_info->exc_value;
18570     *tb = exc_info->exc_traceback;
18571     #else
18572     *type = tstate->exc_type;
18573     *value = tstate->exc_value;
18574     *tb = tstate->exc_traceback;
18575     #endif
18576     Py_XINCREF(*type);
18577     Py_XINCREF(*value);
18578     Py_XINCREF(*tb);
18579 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)18580 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
18581     PyObject *tmp_type, *tmp_value, *tmp_tb;
18582     #if CYTHON_USE_EXC_INFO_STACK
18583     _PyErr_StackItem *exc_info = tstate->exc_info;
18584     tmp_type = exc_info->exc_type;
18585     tmp_value = exc_info->exc_value;
18586     tmp_tb = exc_info->exc_traceback;
18587     exc_info->exc_type = type;
18588     exc_info->exc_value = value;
18589     exc_info->exc_traceback = tb;
18590     #else
18591     tmp_type = tstate->exc_type;
18592     tmp_value = tstate->exc_value;
18593     tmp_tb = tstate->exc_traceback;
18594     tstate->exc_type = type;
18595     tstate->exc_value = value;
18596     tstate->exc_traceback = tb;
18597     #endif
18598     Py_XDECREF(tmp_type);
18599     Py_XDECREF(tmp_value);
18600     Py_XDECREF(tmp_tb);
18601 }
18602 #endif
18603 
18604 /* PyErrExceptionMatches */
18605 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)18606 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
18607     Py_ssize_t i, n;
18608     n = PyTuple_GET_SIZE(tuple);
18609 #if PY_MAJOR_VERSION >= 3
18610     for (i=0; i<n; i++) {
18611         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
18612     }
18613 #endif
18614     for (i=0; i<n; i++) {
18615         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
18616     }
18617     return 0;
18618 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)18619 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
18620     PyObject *exc_type = tstate->curexc_type;
18621     if (exc_type == err) return 1;
18622     if (unlikely(!exc_type)) return 0;
18623     if (unlikely(PyTuple_Check(err)))
18624         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
18625     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
18626 }
18627 #endif
18628 
18629 /* GetException */
18630 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18631 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
18632 #else
18633 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
18634 #endif
18635 {
18636     PyObject *local_type, *local_value, *local_tb;
18637 #if CYTHON_FAST_THREAD_STATE
18638     PyObject *tmp_type, *tmp_value, *tmp_tb;
18639     local_type = tstate->curexc_type;
18640     local_value = tstate->curexc_value;
18641     local_tb = tstate->curexc_traceback;
18642     tstate->curexc_type = 0;
18643     tstate->curexc_value = 0;
18644     tstate->curexc_traceback = 0;
18645 #else
18646     PyErr_Fetch(&local_type, &local_value, &local_tb);
18647 #endif
18648     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
18649 #if CYTHON_FAST_THREAD_STATE
18650     if (unlikely(tstate->curexc_type))
18651 #else
18652     if (unlikely(PyErr_Occurred()))
18653 #endif
18654         goto bad;
18655     #if PY_MAJOR_VERSION >= 3
18656     if (local_tb) {
18657         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
18658             goto bad;
18659     }
18660     #endif
18661     Py_XINCREF(local_tb);
18662     Py_XINCREF(local_type);
18663     Py_XINCREF(local_value);
18664     *type = local_type;
18665     *value = local_value;
18666     *tb = local_tb;
18667 #if CYTHON_FAST_THREAD_STATE
18668     #if CYTHON_USE_EXC_INFO_STACK
18669     {
18670         _PyErr_StackItem *exc_info = tstate->exc_info;
18671         tmp_type = exc_info->exc_type;
18672         tmp_value = exc_info->exc_value;
18673         tmp_tb = exc_info->exc_traceback;
18674         exc_info->exc_type = local_type;
18675         exc_info->exc_value = local_value;
18676         exc_info->exc_traceback = local_tb;
18677     }
18678     #else
18679     tmp_type = tstate->exc_type;
18680     tmp_value = tstate->exc_value;
18681     tmp_tb = tstate->exc_traceback;
18682     tstate->exc_type = local_type;
18683     tstate->exc_value = local_value;
18684     tstate->exc_traceback = local_tb;
18685     #endif
18686     Py_XDECREF(tmp_type);
18687     Py_XDECREF(tmp_value);
18688     Py_XDECREF(tmp_tb);
18689 #else
18690     PyErr_SetExcInfo(local_type, local_value, local_tb);
18691 #endif
18692     return 0;
18693 bad:
18694     *type = 0;
18695     *value = 0;
18696     *tb = 0;
18697     Py_XDECREF(local_type);
18698     Py_XDECREF(local_value);
18699     Py_XDECREF(local_tb);
18700     return -1;
18701 }
18702 
18703 /* PyObjectCall */
18704 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)18705 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
18706     PyObject *result;
18707     ternaryfunc call = Py_TYPE(func)->tp_call;
18708     if (unlikely(!call))
18709         return PyObject_Call(func, arg, kw);
18710     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
18711         return NULL;
18712     result = (*call)(func, arg, kw);
18713     Py_LeaveRecursiveCall();
18714     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
18715         PyErr_SetString(
18716             PyExc_SystemError,
18717             "NULL result without error in PyObject_Call");
18718     }
18719     return result;
18720 }
18721 #endif
18722 
18723 /* PyErrFetchRestore */
18724 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)18725 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
18726     PyObject *tmp_type, *tmp_value, *tmp_tb;
18727     tmp_type = tstate->curexc_type;
18728     tmp_value = tstate->curexc_value;
18729     tmp_tb = tstate->curexc_traceback;
18730     tstate->curexc_type = type;
18731     tstate->curexc_value = value;
18732     tstate->curexc_traceback = tb;
18733     Py_XDECREF(tmp_type);
18734     Py_XDECREF(tmp_value);
18735     Py_XDECREF(tmp_tb);
18736 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18737 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
18738     *type = tstate->curexc_type;
18739     *value = tstate->curexc_value;
18740     *tb = tstate->curexc_traceback;
18741     tstate->curexc_type = 0;
18742     tstate->curexc_value = 0;
18743     tstate->curexc_traceback = 0;
18744 }
18745 #endif
18746 
18747 /* RaiseException */
18748 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)18749 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
18750                         CYTHON_UNUSED PyObject *cause) {
18751     __Pyx_PyThreadState_declare
18752     Py_XINCREF(type);
18753     if (!value || value == Py_None)
18754         value = NULL;
18755     else
18756         Py_INCREF(value);
18757     if (!tb || tb == Py_None)
18758         tb = NULL;
18759     else {
18760         Py_INCREF(tb);
18761         if (!PyTraceBack_Check(tb)) {
18762             PyErr_SetString(PyExc_TypeError,
18763                 "raise: arg 3 must be a traceback or None");
18764             goto raise_error;
18765         }
18766     }
18767     if (PyType_Check(type)) {
18768 #if CYTHON_COMPILING_IN_PYPY
18769         if (!value) {
18770             Py_INCREF(Py_None);
18771             value = Py_None;
18772         }
18773 #endif
18774         PyErr_NormalizeException(&type, &value, &tb);
18775     } else {
18776         if (value) {
18777             PyErr_SetString(PyExc_TypeError,
18778                 "instance exception may not have a separate value");
18779             goto raise_error;
18780         }
18781         value = type;
18782         type = (PyObject*) Py_TYPE(type);
18783         Py_INCREF(type);
18784         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
18785             PyErr_SetString(PyExc_TypeError,
18786                 "raise: exception class must be a subclass of BaseException");
18787             goto raise_error;
18788         }
18789     }
18790     __Pyx_PyThreadState_assign
18791     __Pyx_ErrRestore(type, value, tb);
18792     return;
18793 raise_error:
18794     Py_XDECREF(value);
18795     Py_XDECREF(type);
18796     Py_XDECREF(tb);
18797     return;
18798 }
18799 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)18800 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
18801     PyObject* owned_instance = NULL;
18802     if (tb == Py_None) {
18803         tb = 0;
18804     } else if (tb && !PyTraceBack_Check(tb)) {
18805         PyErr_SetString(PyExc_TypeError,
18806             "raise: arg 3 must be a traceback or None");
18807         goto bad;
18808     }
18809     if (value == Py_None)
18810         value = 0;
18811     if (PyExceptionInstance_Check(type)) {
18812         if (value) {
18813             PyErr_SetString(PyExc_TypeError,
18814                 "instance exception may not have a separate value");
18815             goto bad;
18816         }
18817         value = type;
18818         type = (PyObject*) Py_TYPE(value);
18819     } else if (PyExceptionClass_Check(type)) {
18820         PyObject *instance_class = NULL;
18821         if (value && PyExceptionInstance_Check(value)) {
18822             instance_class = (PyObject*) Py_TYPE(value);
18823             if (instance_class != type) {
18824                 int is_subclass = PyObject_IsSubclass(instance_class, type);
18825                 if (!is_subclass) {
18826                     instance_class = NULL;
18827                 } else if (unlikely(is_subclass == -1)) {
18828                     goto bad;
18829                 } else {
18830                     type = instance_class;
18831                 }
18832             }
18833         }
18834         if (!instance_class) {
18835             PyObject *args;
18836             if (!value)
18837                 args = PyTuple_New(0);
18838             else if (PyTuple_Check(value)) {
18839                 Py_INCREF(value);
18840                 args = value;
18841             } else
18842                 args = PyTuple_Pack(1, value);
18843             if (!args)
18844                 goto bad;
18845             owned_instance = PyObject_Call(type, args, NULL);
18846             Py_DECREF(args);
18847             if (!owned_instance)
18848                 goto bad;
18849             value = owned_instance;
18850             if (!PyExceptionInstance_Check(value)) {
18851                 PyErr_Format(PyExc_TypeError,
18852                              "calling %R should have returned an instance of "
18853                              "BaseException, not %R",
18854                              type, Py_TYPE(value));
18855                 goto bad;
18856             }
18857         }
18858     } else {
18859         PyErr_SetString(PyExc_TypeError,
18860             "raise: exception class must be a subclass of BaseException");
18861         goto bad;
18862     }
18863     if (cause) {
18864         PyObject *fixed_cause;
18865         if (cause == Py_None) {
18866             fixed_cause = NULL;
18867         } else if (PyExceptionClass_Check(cause)) {
18868             fixed_cause = PyObject_CallObject(cause, NULL);
18869             if (fixed_cause == NULL)
18870                 goto bad;
18871         } else if (PyExceptionInstance_Check(cause)) {
18872             fixed_cause = cause;
18873             Py_INCREF(fixed_cause);
18874         } else {
18875             PyErr_SetString(PyExc_TypeError,
18876                             "exception causes must derive from "
18877                             "BaseException");
18878             goto bad;
18879         }
18880         PyException_SetCause(value, fixed_cause);
18881     }
18882     PyErr_SetObject(type, value);
18883     if (tb) {
18884 #if CYTHON_COMPILING_IN_PYPY
18885         PyObject *tmp_type, *tmp_value, *tmp_tb;
18886         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
18887         Py_INCREF(tb);
18888         PyErr_Restore(tmp_type, tmp_value, tb);
18889         Py_XDECREF(tmp_tb);
18890 #else
18891         PyThreadState *tstate = __Pyx_PyThreadState_Current;
18892         PyObject* tmp_tb = tstate->curexc_traceback;
18893         if (tb != tmp_tb) {
18894             Py_INCREF(tb);
18895             tstate->curexc_traceback = tb;
18896             Py_XDECREF(tmp_tb);
18897         }
18898 #endif
18899     }
18900 bad:
18901     Py_XDECREF(owned_instance);
18902     return;
18903 }
18904 #endif
18905 
18906 /* PyCFunctionFastCall */
18907 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)18908 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
18909     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
18910     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
18911     PyObject *self = PyCFunction_GET_SELF(func);
18912     int flags = PyCFunction_GET_FLAGS(func);
18913     assert(PyCFunction_Check(func));
18914     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
18915     assert(nargs >= 0);
18916     assert(nargs == 0 || args != NULL);
18917     /* _PyCFunction_FastCallDict() must not be called with an exception set,
18918        because it may clear it (directly or indirectly) and so the
18919        caller loses its exception */
18920     assert(!PyErr_Occurred());
18921     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
18922         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
18923     } else {
18924         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
18925     }
18926 }
18927 #endif
18928 
18929 /* PyFunctionFastCall */
18930 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)18931 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
18932                                                PyObject *globals) {
18933     PyFrameObject *f;
18934     PyThreadState *tstate = __Pyx_PyThreadState_Current;
18935     PyObject **fastlocals;
18936     Py_ssize_t i;
18937     PyObject *result;
18938     assert(globals != NULL);
18939     /* XXX Perhaps we should create a specialized
18940        PyFrame_New() that doesn't take locals, but does
18941        take builtins without sanity checking them.
18942        */
18943     assert(tstate != NULL);
18944     f = PyFrame_New(tstate, co, globals, NULL);
18945     if (f == NULL) {
18946         return NULL;
18947     }
18948     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
18949     for (i = 0; i < na; i++) {
18950         Py_INCREF(*args);
18951         fastlocals[i] = *args++;
18952     }
18953     result = PyEval_EvalFrameEx(f,0);
18954     ++tstate->recursion_depth;
18955     Py_DECREF(f);
18956     --tstate->recursion_depth;
18957     return result;
18958 }
18959 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)18960 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
18961     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
18962     PyObject *globals = PyFunction_GET_GLOBALS(func);
18963     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
18964     PyObject *closure;
18965 #if PY_MAJOR_VERSION >= 3
18966     PyObject *kwdefs;
18967 #endif
18968     PyObject *kwtuple, **k;
18969     PyObject **d;
18970     Py_ssize_t nd;
18971     Py_ssize_t nk;
18972     PyObject *result;
18973     assert(kwargs == NULL || PyDict_Check(kwargs));
18974     nk = kwargs ? PyDict_Size(kwargs) : 0;
18975     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
18976         return NULL;
18977     }
18978     if (
18979 #if PY_MAJOR_VERSION >= 3
18980             co->co_kwonlyargcount == 0 &&
18981 #endif
18982             likely(kwargs == NULL || nk == 0) &&
18983             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
18984         if (argdefs == NULL && co->co_argcount == nargs) {
18985             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
18986             goto done;
18987         }
18988         else if (nargs == 0 && argdefs != NULL
18989                  && co->co_argcount == Py_SIZE(argdefs)) {
18990             /* function called with no arguments, but all parameters have
18991                a default value: use default values as arguments .*/
18992             args = &PyTuple_GET_ITEM(argdefs, 0);
18993             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
18994             goto done;
18995         }
18996     }
18997     if (kwargs != NULL) {
18998         Py_ssize_t pos, i;
18999         kwtuple = PyTuple_New(2 * nk);
19000         if (kwtuple == NULL) {
19001             result = NULL;
19002             goto done;
19003         }
19004         k = &PyTuple_GET_ITEM(kwtuple, 0);
19005         pos = i = 0;
19006         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
19007             Py_INCREF(k[i]);
19008             Py_INCREF(k[i+1]);
19009             i += 2;
19010         }
19011         nk = i / 2;
19012     }
19013     else {
19014         kwtuple = NULL;
19015         k = NULL;
19016     }
19017     closure = PyFunction_GET_CLOSURE(func);
19018 #if PY_MAJOR_VERSION >= 3
19019     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
19020 #endif
19021     if (argdefs != NULL) {
19022         d = &PyTuple_GET_ITEM(argdefs, 0);
19023         nd = Py_SIZE(argdefs);
19024     }
19025     else {
19026         d = NULL;
19027         nd = 0;
19028     }
19029 #if PY_MAJOR_VERSION >= 3
19030     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
19031                                args, (int)nargs,
19032                                k, (int)nk,
19033                                d, (int)nd, kwdefs, closure);
19034 #else
19035     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
19036                                args, (int)nargs,
19037                                k, (int)nk,
19038                                d, (int)nd, closure);
19039 #endif
19040     Py_XDECREF(kwtuple);
19041 done:
19042     Py_LeaveRecursiveCall();
19043     return result;
19044 }
19045 #endif
19046 #endif
19047 
19048 /* PyObjectCallMethO */
19049 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)19050 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
19051     PyObject *self, *result;
19052     PyCFunction cfunc;
19053     cfunc = PyCFunction_GET_FUNCTION(func);
19054     self = PyCFunction_GET_SELF(func);
19055     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
19056         return NULL;
19057     result = cfunc(self, arg);
19058     Py_LeaveRecursiveCall();
19059     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
19060         PyErr_SetString(
19061             PyExc_SystemError,
19062             "NULL result without error in PyObject_Call");
19063     }
19064     return result;
19065 }
19066 #endif
19067 
19068 /* PyObjectCallOneArg */
19069 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)19070 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
19071     PyObject *result;
19072     PyObject *args = PyTuple_New(1);
19073     if (unlikely(!args)) return NULL;
19074     Py_INCREF(arg);
19075     PyTuple_SET_ITEM(args, 0, arg);
19076     result = __Pyx_PyObject_Call(func, args, NULL);
19077     Py_DECREF(args);
19078     return result;
19079 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)19080 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
19081 #if CYTHON_FAST_PYCALL
19082     if (PyFunction_Check(func)) {
19083         return __Pyx_PyFunction_FastCall(func, &arg, 1);
19084     }
19085 #endif
19086     if (likely(PyCFunction_Check(func))) {
19087         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
19088             return __Pyx_PyObject_CallMethO(func, arg);
19089 #if CYTHON_FAST_PYCCALL
19090         } else if (__Pyx_PyFastCFunction_Check(func)) {
19091             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
19092 #endif
19093         }
19094     }
19095     return __Pyx__PyObject_CallOneArg(func, arg);
19096 }
19097 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)19098 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
19099     PyObject *result;
19100     PyObject *args = PyTuple_Pack(1, arg);
19101     if (unlikely(!args)) return NULL;
19102     result = __Pyx_PyObject_Call(func, args, NULL);
19103     Py_DECREF(args);
19104     return result;
19105 }
19106 #endif
19107 
19108 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)19109 static void __Pyx_RaiseArgtupleInvalid(
19110     const char* func_name,
19111     int exact,
19112     Py_ssize_t num_min,
19113     Py_ssize_t num_max,
19114     Py_ssize_t num_found)
19115 {
19116     Py_ssize_t num_expected;
19117     const char *more_or_less;
19118     if (num_found < num_min) {
19119         num_expected = num_min;
19120         more_or_less = "at least";
19121     } else {
19122         num_expected = num_max;
19123         more_or_less = "at most";
19124     }
19125     if (exact) {
19126         more_or_less = "exactly";
19127     }
19128     PyErr_Format(PyExc_TypeError,
19129                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
19130                  func_name, more_or_less, num_expected,
19131                  (num_expected == 1) ? "" : "s", num_found);
19132 }
19133 
19134 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)19135 static int __Pyx_CheckKeywordStrings(
19136     PyObject *kwdict,
19137     const char* function_name,
19138     int kw_allowed)
19139 {
19140     PyObject* key = 0;
19141     Py_ssize_t pos = 0;
19142 #if CYTHON_COMPILING_IN_PYPY
19143     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
19144         goto invalid_keyword;
19145     return 1;
19146 #else
19147     while (PyDict_Next(kwdict, &pos, &key, 0)) {
19148         #if PY_MAJOR_VERSION < 3
19149         if (unlikely(!PyString_Check(key)))
19150         #endif
19151             if (unlikely(!PyUnicode_Check(key)))
19152                 goto invalid_keyword_type;
19153     }
19154     if ((!kw_allowed) && unlikely(key))
19155         goto invalid_keyword;
19156     return 1;
19157 invalid_keyword_type:
19158     PyErr_Format(PyExc_TypeError,
19159         "%.200s() keywords must be strings", function_name);
19160     return 0;
19161 #endif
19162 invalid_keyword:
19163     PyErr_Format(PyExc_TypeError,
19164     #if PY_MAJOR_VERSION < 3
19165         "%.200s() got an unexpected keyword argument '%.200s'",
19166         function_name, PyString_AsString(key));
19167     #else
19168         "%s() got an unexpected keyword argument '%U'",
19169         function_name, key);
19170     #endif
19171     return 0;
19172 }
19173 
19174 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)19175 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
19176                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
19177                                   int full_traceback, CYTHON_UNUSED int nogil) {
19178     PyObject *old_exc, *old_val, *old_tb;
19179     PyObject *ctx;
19180     __Pyx_PyThreadState_declare
19181 #ifdef WITH_THREAD
19182     PyGILState_STATE state;
19183     if (nogil)
19184         state = PyGILState_Ensure();
19185 #ifdef _MSC_VER
19186     else state = (PyGILState_STATE)-1;
19187 #endif
19188 #endif
19189     __Pyx_PyThreadState_assign
19190     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
19191     if (full_traceback) {
19192         Py_XINCREF(old_exc);
19193         Py_XINCREF(old_val);
19194         Py_XINCREF(old_tb);
19195         __Pyx_ErrRestore(old_exc, old_val, old_tb);
19196         PyErr_PrintEx(1);
19197     }
19198     #if PY_MAJOR_VERSION < 3
19199     ctx = PyString_FromString(name);
19200     #else
19201     ctx = PyUnicode_FromString(name);
19202     #endif
19203     __Pyx_ErrRestore(old_exc, old_val, old_tb);
19204     if (!ctx) {
19205         PyErr_WriteUnraisable(Py_None);
19206     } else {
19207         PyErr_WriteUnraisable(ctx);
19208         Py_DECREF(ctx);
19209     }
19210 #ifdef WITH_THREAD
19211     if (nogil)
19212         PyGILState_Release(state);
19213 #endif
19214 }
19215 
19216 /* PyDictVersioning */
19217 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)19218 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
19219     PyObject *dict = Py_TYPE(obj)->tp_dict;
19220     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
19221 }
__Pyx_get_object_dict_version(PyObject * obj)19222 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
19223     PyObject **dictptr = NULL;
19224     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
19225     if (offset) {
19226 #if CYTHON_COMPILING_IN_CPYTHON
19227         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
19228 #else
19229         dictptr = _PyObject_GetDictPtr(obj);
19230 #endif
19231     }
19232     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
19233 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)19234 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
19235     PyObject *dict = Py_TYPE(obj)->tp_dict;
19236     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
19237         return 0;
19238     return obj_dict_version == __Pyx_get_object_dict_version(obj);
19239 }
19240 #endif
19241 
19242 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)19243 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
19244     PyObject *args, *result = NULL;
19245     #if CYTHON_FAST_PYCALL
19246     if (PyFunction_Check(function)) {
19247         PyObject *args[2] = {arg1, arg2};
19248         return __Pyx_PyFunction_FastCall(function, args, 2);
19249     }
19250     #endif
19251     #if CYTHON_FAST_PYCCALL
19252     if (__Pyx_PyFastCFunction_Check(function)) {
19253         PyObject *args[2] = {arg1, arg2};
19254         return __Pyx_PyCFunction_FastCall(function, args, 2);
19255     }
19256     #endif
19257     args = PyTuple_New(2);
19258     if (unlikely(!args)) goto done;
19259     Py_INCREF(arg1);
19260     PyTuple_SET_ITEM(args, 0, arg1);
19261     Py_INCREF(arg2);
19262     PyTuple_SET_ITEM(args, 1, arg2);
19263     Py_INCREF(function);
19264     result = __Pyx_PyObject_Call(function, args, NULL);
19265     Py_DECREF(args);
19266     Py_DECREF(function);
19267 done:
19268     return result;
19269 }
19270 
19271 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)19272 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
19273 #if CYTHON_USE_TYPE_SLOTS
19274 #if PY_MAJOR_VERSION >= 3
19275     if (likely(PyUnicode_Check(n)))
19276 #else
19277     if (likely(PyString_Check(n)))
19278 #endif
19279         return __Pyx_PyObject_GetAttrStr(o, n);
19280 #endif
19281     return PyObject_GetAttr(o, n);
19282 }
19283 
19284 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)19285 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
19286     __Pyx_PyThreadState_declare
19287     __Pyx_PyThreadState_assign
19288     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
19289         return NULL;
19290     __Pyx_PyErr_Clear();
19291     Py_INCREF(d);
19292     return d;
19293 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)19294 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
19295     PyObject *r = __Pyx_GetAttr(o, n);
19296     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
19297 }
19298 
19299 /* GetModuleGlobalName */
19300 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)19301 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
19302 #else
19303 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
19304 #endif
19305 {
19306     PyObject *result;
19307 #if !CYTHON_AVOID_BORROWED_REFS
19308 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
19309     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
19310     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
19311     if (likely(result)) {
19312         return __Pyx_NewRef(result);
19313     } else if (unlikely(PyErr_Occurred())) {
19314         return NULL;
19315     }
19316 #else
19317     result = PyDict_GetItem(__pyx_d, name);
19318     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
19319     if (likely(result)) {
19320         return __Pyx_NewRef(result);
19321     }
19322 #endif
19323 #else
19324     result = PyObject_GetItem(__pyx_d, name);
19325     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
19326     if (likely(result)) {
19327         return __Pyx_NewRef(result);
19328     }
19329     PyErr_Clear();
19330 #endif
19331     return __Pyx_GetBuiltinName(name);
19332 }
19333 
19334 /* PyObjectCallNoArg */
19335 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)19336 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
19337 #if CYTHON_FAST_PYCALL
19338     if (PyFunction_Check(func)) {
19339         return __Pyx_PyFunction_FastCall(func, NULL, 0);
19340     }
19341 #endif
19342 #ifdef __Pyx_CyFunction_USED
19343     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
19344 #else
19345     if (likely(PyCFunction_Check(func)))
19346 #endif
19347     {
19348         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
19349             return __Pyx_PyObject_CallMethO(func, NULL);
19350         }
19351     }
19352     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
19353 }
19354 #endif
19355 
19356 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)19357 static void __Pyx_RaiseDoubleKeywordsError(
19358     const char* func_name,
19359     PyObject* kw_name)
19360 {
19361     PyErr_Format(PyExc_TypeError,
19362         #if PY_MAJOR_VERSION >= 3
19363         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
19364         #else
19365         "%s() got multiple values for keyword argument '%s'", func_name,
19366         PyString_AsString(kw_name));
19367         #endif
19368 }
19369 
19370 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)19371 static int __Pyx_ParseOptionalKeywords(
19372     PyObject *kwds,
19373     PyObject **argnames[],
19374     PyObject *kwds2,
19375     PyObject *values[],
19376     Py_ssize_t num_pos_args,
19377     const char* function_name)
19378 {
19379     PyObject *key = 0, *value = 0;
19380     Py_ssize_t pos = 0;
19381     PyObject*** name;
19382     PyObject*** first_kw_arg = argnames + num_pos_args;
19383     while (PyDict_Next(kwds, &pos, &key, &value)) {
19384         name = first_kw_arg;
19385         while (*name && (**name != key)) name++;
19386         if (*name) {
19387             values[name-argnames] = value;
19388             continue;
19389         }
19390         name = first_kw_arg;
19391         #if PY_MAJOR_VERSION < 3
19392         if (likely(PyString_Check(key))) {
19393             while (*name) {
19394                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
19395                         && _PyString_Eq(**name, key)) {
19396                     values[name-argnames] = value;
19397                     break;
19398                 }
19399                 name++;
19400             }
19401             if (*name) continue;
19402             else {
19403                 PyObject*** argname = argnames;
19404                 while (argname != first_kw_arg) {
19405                     if ((**argname == key) || (
19406                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
19407                              && _PyString_Eq(**argname, key))) {
19408                         goto arg_passed_twice;
19409                     }
19410                     argname++;
19411                 }
19412             }
19413         } else
19414         #endif
19415         if (likely(PyUnicode_Check(key))) {
19416             while (*name) {
19417                 int cmp = (**name == key) ? 0 :
19418                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
19419                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
19420                 #endif
19421                     PyUnicode_Compare(**name, key);
19422                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
19423                 if (cmp == 0) {
19424                     values[name-argnames] = value;
19425                     break;
19426                 }
19427                 name++;
19428             }
19429             if (*name) continue;
19430             else {
19431                 PyObject*** argname = argnames;
19432                 while (argname != first_kw_arg) {
19433                     int cmp = (**argname == key) ? 0 :
19434                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
19435                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
19436                     #endif
19437                         PyUnicode_Compare(**argname, key);
19438                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
19439                     if (cmp == 0) goto arg_passed_twice;
19440                     argname++;
19441                 }
19442             }
19443         } else
19444             goto invalid_keyword_type;
19445         if (kwds2) {
19446             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
19447         } else {
19448             goto invalid_keyword;
19449         }
19450     }
19451     return 0;
19452 arg_passed_twice:
19453     __Pyx_RaiseDoubleKeywordsError(function_name, key);
19454     goto bad;
19455 invalid_keyword_type:
19456     PyErr_Format(PyExc_TypeError,
19457         "%.200s() keywords must be strings", function_name);
19458     goto bad;
19459 invalid_keyword:
19460     PyErr_Format(PyExc_TypeError,
19461     #if PY_MAJOR_VERSION < 3
19462         "%.200s() got an unexpected keyword argument '%.200s'",
19463         function_name, PyString_AsString(key));
19464     #else
19465         "%s() got an unexpected keyword argument '%U'",
19466         function_name, key);
19467     #endif
19468 bad:
19469     return -1;
19470 }
19471 
19472 /* PyIntCompare */
__Pyx_PyInt_EqObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)19473 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
19474     if (op1 == op2) {
19475         Py_RETURN_TRUE;
19476     }
19477     #if PY_MAJOR_VERSION < 3
19478     if (likely(PyInt_CheckExact(op1))) {
19479         const long b = intval;
19480         long a = PyInt_AS_LONG(op1);
19481         if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19482     }
19483     #endif
19484     #if CYTHON_USE_PYLONG_INTERNALS
19485     if (likely(PyLong_CheckExact(op1))) {
19486         int unequal;
19487         unsigned long uintval;
19488         Py_ssize_t size = Py_SIZE(op1);
19489         const digit* digits = ((PyLongObject*)op1)->ob_digit;
19490         if (intval == 0) {
19491             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19492         } else if (intval < 0) {
19493             if (size >= 0)
19494                 Py_RETURN_FALSE;
19495             intval = -intval;
19496             size = -size;
19497         } else {
19498             if (size <= 0)
19499                 Py_RETURN_FALSE;
19500         }
19501         uintval = (unsigned long) intval;
19502 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
19503         if (uintval >> (PyLong_SHIFT * 4)) {
19504             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19505                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19506         } else
19507 #endif
19508 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
19509         if (uintval >> (PyLong_SHIFT * 3)) {
19510             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19511                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19512         } else
19513 #endif
19514 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
19515         if (uintval >> (PyLong_SHIFT * 2)) {
19516             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19517                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19518         } else
19519 #endif
19520 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
19521         if (uintval >> (PyLong_SHIFT * 1)) {
19522             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19523                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19524         } else
19525 #endif
19526             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
19527         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19528     }
19529     #endif
19530     if (PyFloat_CheckExact(op1)) {
19531         const long b = intval;
19532         double a = PyFloat_AS_DOUBLE(op1);
19533         if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19534     }
19535     return (
19536         PyObject_RichCompare(op1, op2, Py_EQ));
19537 }
19538 
19539 /* SwapException */
19540 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)19541 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
19542     PyObject *tmp_type, *tmp_value, *tmp_tb;
19543     #if CYTHON_USE_EXC_INFO_STACK
19544     _PyErr_StackItem *exc_info = tstate->exc_info;
19545     tmp_type = exc_info->exc_type;
19546     tmp_value = exc_info->exc_value;
19547     tmp_tb = exc_info->exc_traceback;
19548     exc_info->exc_type = *type;
19549     exc_info->exc_value = *value;
19550     exc_info->exc_traceback = *tb;
19551     #else
19552     tmp_type = tstate->exc_type;
19553     tmp_value = tstate->exc_value;
19554     tmp_tb = tstate->exc_traceback;
19555     tstate->exc_type = *type;
19556     tstate->exc_value = *value;
19557     tstate->exc_traceback = *tb;
19558     #endif
19559     *type = tmp_type;
19560     *value = tmp_value;
19561     *tb = tmp_tb;
19562 }
19563 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)19564 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
19565     PyObject *tmp_type, *tmp_value, *tmp_tb;
19566     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
19567     PyErr_SetExcInfo(*type, *value, *tb);
19568     *type = tmp_type;
19569     *value = tmp_value;
19570     *tb = tmp_tb;
19571 }
19572 #endif
19573 
19574 /* SliceObject */
__Pyx_PyObject_SetSlice(PyObject * obj,PyObject * value,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)19575 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
19576         Py_ssize_t cstart, Py_ssize_t cstop,
19577         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
19578         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
19579 #if CYTHON_USE_TYPE_SLOTS
19580     PyMappingMethods* mp;
19581 #if PY_MAJOR_VERSION < 3
19582     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
19583     if (likely(ms && ms->sq_ass_slice)) {
19584         if (!has_cstart) {
19585             if (_py_start && (*_py_start != Py_None)) {
19586                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
19587                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19588             } else
19589                 cstart = 0;
19590         }
19591         if (!has_cstop) {
19592             if (_py_stop && (*_py_stop != Py_None)) {
19593                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
19594                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19595             } else
19596                 cstop = PY_SSIZE_T_MAX;
19597         }
19598         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
19599             Py_ssize_t l = ms->sq_length(obj);
19600             if (likely(l >= 0)) {
19601                 if (cstop < 0) {
19602                     cstop += l;
19603                     if (cstop < 0) cstop = 0;
19604                 }
19605                 if (cstart < 0) {
19606                     cstart += l;
19607                     if (cstart < 0) cstart = 0;
19608                 }
19609             } else {
19610                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19611                     goto bad;
19612                 PyErr_Clear();
19613             }
19614         }
19615         return ms->sq_ass_slice(obj, cstart, cstop, value);
19616     }
19617 #endif
19618     mp = Py_TYPE(obj)->tp_as_mapping;
19619     if (likely(mp && mp->mp_ass_subscript))
19620 #endif
19621     {
19622         int result;
19623         PyObject *py_slice, *py_start, *py_stop;
19624         if (_py_slice) {
19625             py_slice = *_py_slice;
19626         } else {
19627             PyObject* owned_start = NULL;
19628             PyObject* owned_stop = NULL;
19629             if (_py_start) {
19630                 py_start = *_py_start;
19631             } else {
19632                 if (has_cstart) {
19633                     owned_start = py_start = PyInt_FromSsize_t(cstart);
19634                     if (unlikely(!py_start)) goto bad;
19635                 } else
19636                     py_start = Py_None;
19637             }
19638             if (_py_stop) {
19639                 py_stop = *_py_stop;
19640             } else {
19641                 if (has_cstop) {
19642                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
19643                     if (unlikely(!py_stop)) {
19644                         Py_XDECREF(owned_start);
19645                         goto bad;
19646                     }
19647                 } else
19648                     py_stop = Py_None;
19649             }
19650             py_slice = PySlice_New(py_start, py_stop, Py_None);
19651             Py_XDECREF(owned_start);
19652             Py_XDECREF(owned_stop);
19653             if (unlikely(!py_slice)) goto bad;
19654         }
19655 #if CYTHON_USE_TYPE_SLOTS
19656         result = mp->mp_ass_subscript(obj, py_slice, value);
19657 #else
19658         result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
19659 #endif
19660         if (!_py_slice) {
19661             Py_DECREF(py_slice);
19662         }
19663         return result;
19664     }
19665     PyErr_Format(PyExc_TypeError,
19666         "'%.200s' object does not support slice %.10s",
19667         Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
19668 bad:
19669     return -1;
19670 }
19671 
19672 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)19673 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
19674     PyObject *empty_list = 0;
19675     PyObject *module = 0;
19676     PyObject *global_dict = 0;
19677     PyObject *empty_dict = 0;
19678     PyObject *list;
19679     #if PY_MAJOR_VERSION < 3
19680     PyObject *py_import;
19681     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
19682     if (!py_import)
19683         goto bad;
19684     #endif
19685     if (from_list)
19686         list = from_list;
19687     else {
19688         empty_list = PyList_New(0);
19689         if (!empty_list)
19690             goto bad;
19691         list = empty_list;
19692     }
19693     global_dict = PyModule_GetDict(__pyx_m);
19694     if (!global_dict)
19695         goto bad;
19696     empty_dict = PyDict_New();
19697     if (!empty_dict)
19698         goto bad;
19699     {
19700         #if PY_MAJOR_VERSION >= 3
19701         if (level == -1) {
19702             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
19703                 module = PyImport_ImportModuleLevelObject(
19704                     name, global_dict, empty_dict, list, 1);
19705                 if (!module) {
19706                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
19707                         goto bad;
19708                     PyErr_Clear();
19709                 }
19710             }
19711             level = 0;
19712         }
19713         #endif
19714         if (!module) {
19715             #if PY_MAJOR_VERSION < 3
19716             PyObject *py_level = PyInt_FromLong(level);
19717             if (!py_level)
19718                 goto bad;
19719             module = PyObject_CallFunctionObjArgs(py_import,
19720                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
19721             Py_DECREF(py_level);
19722             #else
19723             module = PyImport_ImportModuleLevelObject(
19724                 name, global_dict, empty_dict, list, level);
19725             #endif
19726         }
19727     }
19728 bad:
19729     #if PY_MAJOR_VERSION < 3
19730     Py_XDECREF(py_import);
19731     #endif
19732     Py_XDECREF(empty_list);
19733     Py_XDECREF(empty_dict);
19734     return module;
19735 }
19736 
19737 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)19738 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
19739         Py_ssize_t cstart, Py_ssize_t cstop,
19740         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
19741         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
19742 #if CYTHON_USE_TYPE_SLOTS
19743     PyMappingMethods* mp;
19744 #if PY_MAJOR_VERSION < 3
19745     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
19746     if (likely(ms && ms->sq_slice)) {
19747         if (!has_cstart) {
19748             if (_py_start && (*_py_start != Py_None)) {
19749                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
19750                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19751             } else
19752                 cstart = 0;
19753         }
19754         if (!has_cstop) {
19755             if (_py_stop && (*_py_stop != Py_None)) {
19756                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
19757                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19758             } else
19759                 cstop = PY_SSIZE_T_MAX;
19760         }
19761         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
19762             Py_ssize_t l = ms->sq_length(obj);
19763             if (likely(l >= 0)) {
19764                 if (cstop < 0) {
19765                     cstop += l;
19766                     if (cstop < 0) cstop = 0;
19767                 }
19768                 if (cstart < 0) {
19769                     cstart += l;
19770                     if (cstart < 0) cstart = 0;
19771                 }
19772             } else {
19773                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19774                     goto bad;
19775                 PyErr_Clear();
19776             }
19777         }
19778         return ms->sq_slice(obj, cstart, cstop);
19779     }
19780 #endif
19781     mp = Py_TYPE(obj)->tp_as_mapping;
19782     if (likely(mp && mp->mp_subscript))
19783 #endif
19784     {
19785         PyObject* result;
19786         PyObject *py_slice, *py_start, *py_stop;
19787         if (_py_slice) {
19788             py_slice = *_py_slice;
19789         } else {
19790             PyObject* owned_start = NULL;
19791             PyObject* owned_stop = NULL;
19792             if (_py_start) {
19793                 py_start = *_py_start;
19794             } else {
19795                 if (has_cstart) {
19796                     owned_start = py_start = PyInt_FromSsize_t(cstart);
19797                     if (unlikely(!py_start)) goto bad;
19798                 } else
19799                     py_start = Py_None;
19800             }
19801             if (_py_stop) {
19802                 py_stop = *_py_stop;
19803             } else {
19804                 if (has_cstop) {
19805                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
19806                     if (unlikely(!py_stop)) {
19807                         Py_XDECREF(owned_start);
19808                         goto bad;
19809                     }
19810                 } else
19811                     py_stop = Py_None;
19812             }
19813             py_slice = PySlice_New(py_start, py_stop, Py_None);
19814             Py_XDECREF(owned_start);
19815             Py_XDECREF(owned_stop);
19816             if (unlikely(!py_slice)) goto bad;
19817         }
19818 #if CYTHON_USE_TYPE_SLOTS
19819         result = mp->mp_subscript(obj, py_slice);
19820 #else
19821         result = PyObject_GetItem(obj, py_slice);
19822 #endif
19823         if (!_py_slice) {
19824             Py_DECREF(py_slice);
19825         }
19826         return result;
19827     }
19828     PyErr_Format(PyExc_TypeError,
19829         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
19830 bad:
19831     return NULL;
19832 }
19833 
19834 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)19835 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
19836     PyObject *r;
19837     if (!j) return NULL;
19838     r = PyObject_GetItem(o, j);
19839     Py_DECREF(j);
19840     return r;
19841 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)19842 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
19843                                                               CYTHON_NCP_UNUSED int wraparound,
19844                                                               CYTHON_NCP_UNUSED int boundscheck) {
19845 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19846     Py_ssize_t wrapped_i = i;
19847     if (wraparound & unlikely(i < 0)) {
19848         wrapped_i += PyList_GET_SIZE(o);
19849     }
19850     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
19851         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
19852         Py_INCREF(r);
19853         return r;
19854     }
19855     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19856 #else
19857     return PySequence_GetItem(o, i);
19858 #endif
19859 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)19860 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
19861                                                               CYTHON_NCP_UNUSED int wraparound,
19862                                                               CYTHON_NCP_UNUSED int boundscheck) {
19863 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19864     Py_ssize_t wrapped_i = i;
19865     if (wraparound & unlikely(i < 0)) {
19866         wrapped_i += PyTuple_GET_SIZE(o);
19867     }
19868     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
19869         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
19870         Py_INCREF(r);
19871         return r;
19872     }
19873     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19874 #else
19875     return PySequence_GetItem(o, i);
19876 #endif
19877 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)19878 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
19879                                                      CYTHON_NCP_UNUSED int wraparound,
19880                                                      CYTHON_NCP_UNUSED int boundscheck) {
19881 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
19882     if (is_list || PyList_CheckExact(o)) {
19883         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
19884         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
19885             PyObject *r = PyList_GET_ITEM(o, n);
19886             Py_INCREF(r);
19887             return r;
19888         }
19889     }
19890     else if (PyTuple_CheckExact(o)) {
19891         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
19892         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
19893             PyObject *r = PyTuple_GET_ITEM(o, n);
19894             Py_INCREF(r);
19895             return r;
19896         }
19897     } else {
19898         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
19899         if (likely(m && m->sq_item)) {
19900             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
19901                 Py_ssize_t l = m->sq_length(o);
19902                 if (likely(l >= 0)) {
19903                     i += l;
19904                 } else {
19905                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19906                         return NULL;
19907                     PyErr_Clear();
19908                 }
19909             }
19910             return m->sq_item(o, i);
19911         }
19912     }
19913 #else
19914     if (is_list || PySequence_Check(o)) {
19915         return PySequence_GetItem(o, i);
19916     }
19917 #endif
19918     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19919 }
19920 
19921 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)19922 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
19923 {
19924     if (unlikely(!type)) {
19925         PyErr_SetString(PyExc_SystemError, "Missing type object");
19926         return 0;
19927     }
19928     else if (exact) {
19929         #if PY_MAJOR_VERSION == 2
19930         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
19931         #endif
19932     }
19933     else {
19934         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
19935     }
19936     PyErr_Format(PyExc_TypeError,
19937         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
19938         name, type->tp_name, Py_TYPE(obj)->tp_name);
19939     return 0;
19940 }
19941 
19942 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)19943 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
19944     PyObject *method;
19945     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
19946     if (unlikely(!method))
19947         return -1;
19948     target->method = method;
19949 #if CYTHON_COMPILING_IN_CPYTHON
19950     #if PY_MAJOR_VERSION >= 3
19951     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
19952     #endif
19953     {
19954         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
19955         target->func = descr->d_method->ml_meth;
19956         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
19957     }
19958 #endif
19959     return 0;
19960 }
19961 
19962 /* CallUnboundCMethod0 */
__Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction * cfunc,PyObject * self)19963 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
19964     PyObject *args, *result = NULL;
19965     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
19966 #if CYTHON_ASSUME_SAFE_MACROS
19967     args = PyTuple_New(1);
19968     if (unlikely(!args)) goto bad;
19969     Py_INCREF(self);
19970     PyTuple_SET_ITEM(args, 0, self);
19971 #else
19972     args = PyTuple_Pack(1, self);
19973     if (unlikely(!args)) goto bad;
19974 #endif
19975     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
19976     Py_DECREF(args);
19977 bad:
19978     return result;
19979 }
19980 
19981 /* py_dict_items */
__Pyx_PyDict_Items(PyObject * d)19982 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
19983     if (PY_MAJOR_VERSION >= 3)
19984         return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
19985     else
19986         return PyDict_Items(d);
19987 }
19988 
19989 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)19990 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
19991     PyErr_Format(PyExc_ValueError,
19992                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
19993 }
19994 
19995 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)19996 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
19997     PyErr_Format(PyExc_ValueError,
19998                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
19999                  index, (index == 1) ? "" : "s");
20000 }
20001 
20002 /* IterFinish */
__Pyx_IterFinish(void)20003 static CYTHON_INLINE int __Pyx_IterFinish(void) {
20004 #if CYTHON_FAST_THREAD_STATE
20005     PyThreadState *tstate = __Pyx_PyThreadState_Current;
20006     PyObject* exc_type = tstate->curexc_type;
20007     if (unlikely(exc_type)) {
20008         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
20009             PyObject *exc_value, *exc_tb;
20010             exc_value = tstate->curexc_value;
20011             exc_tb = tstate->curexc_traceback;
20012             tstate->curexc_type = 0;
20013             tstate->curexc_value = 0;
20014             tstate->curexc_traceback = 0;
20015             Py_DECREF(exc_type);
20016             Py_XDECREF(exc_value);
20017             Py_XDECREF(exc_tb);
20018             return 0;
20019         } else {
20020             return -1;
20021         }
20022     }
20023     return 0;
20024 #else
20025     if (unlikely(PyErr_Occurred())) {
20026         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
20027             PyErr_Clear();
20028             return 0;
20029         } else {
20030             return -1;
20031         }
20032     }
20033     return 0;
20034 #endif
20035 }
20036 
20037 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)20038 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
20039     if (unlikely(retval)) {
20040         Py_DECREF(retval);
20041         __Pyx_RaiseTooManyValuesError(expected);
20042         return -1;
20043     } else {
20044         return __Pyx_IterFinish();
20045     }
20046     return 0;
20047 }
20048 
20049 /* PyIntCompare */
__Pyx_PyInt_NeObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)20050 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
20051     if (op1 == op2) {
20052         Py_RETURN_FALSE;
20053     }
20054     #if PY_MAJOR_VERSION < 3
20055     if (likely(PyInt_CheckExact(op1))) {
20056         const long b = intval;
20057         long a = PyInt_AS_LONG(op1);
20058         if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20059     }
20060     #endif
20061     #if CYTHON_USE_PYLONG_INTERNALS
20062     if (likely(PyLong_CheckExact(op1))) {
20063         int unequal;
20064         unsigned long uintval;
20065         Py_ssize_t size = Py_SIZE(op1);
20066         const digit* digits = ((PyLongObject*)op1)->ob_digit;
20067         if (intval == 0) {
20068             if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20069         } else if (intval < 0) {
20070             if (size >= 0)
20071                 Py_RETURN_TRUE;
20072             intval = -intval;
20073             size = -size;
20074         } else {
20075             if (size <= 0)
20076                 Py_RETURN_TRUE;
20077         }
20078         uintval = (unsigned long) intval;
20079 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
20080         if (uintval >> (PyLong_SHIFT * 4)) {
20081             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
20082                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
20083         } else
20084 #endif
20085 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
20086         if (uintval >> (PyLong_SHIFT * 3)) {
20087             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
20088                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
20089         } else
20090 #endif
20091 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
20092         if (uintval >> (PyLong_SHIFT * 2)) {
20093             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
20094                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
20095         } else
20096 #endif
20097 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
20098         if (uintval >> (PyLong_SHIFT * 1)) {
20099             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
20100                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
20101         } else
20102 #endif
20103             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
20104         if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20105     }
20106     #endif
20107     if (PyFloat_CheckExact(op1)) {
20108         const long b = intval;
20109         double a = PyFloat_AS_DOUBLE(op1);
20110         if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20111     }
20112     return (
20113         PyObject_RichCompare(op1, op2, Py_NE));
20114 }
20115 
20116 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)20117 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
20118     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
20119     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20120         PyErr_Format(PyExc_ImportError,
20121         #if PY_MAJOR_VERSION < 3
20122             "cannot import name %.230s", PyString_AS_STRING(name));
20123         #else
20124             "cannot import name %S", name);
20125         #endif
20126     }
20127     return value;
20128 }
20129 
20130 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)20131 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
20132     PyObject *r;
20133     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
20134         PyErr_SetString(PyExc_TypeError,
20135                         "hasattr(): attribute name must be string");
20136         return -1;
20137     }
20138     r = __Pyx_GetAttr(o, n);
20139     if (unlikely(!r)) {
20140         PyErr_Clear();
20141         return 0;
20142     } else {
20143         Py_DECREF(r);
20144         return 1;
20145     }
20146 }
20147 
20148 /* PyObject_GenericGetAttrNoDict */
20149 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)20150 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
20151     PyErr_Format(PyExc_AttributeError,
20152 #if PY_MAJOR_VERSION >= 3
20153                  "'%.50s' object has no attribute '%U'",
20154                  tp->tp_name, attr_name);
20155 #else
20156                  "'%.50s' object has no attribute '%.400s'",
20157                  tp->tp_name, PyString_AS_STRING(attr_name));
20158 #endif
20159     return NULL;
20160 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)20161 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
20162     PyObject *descr;
20163     PyTypeObject *tp = Py_TYPE(obj);
20164     if (unlikely(!PyString_Check(attr_name))) {
20165         return PyObject_GenericGetAttr(obj, attr_name);
20166     }
20167     assert(!tp->tp_dictoffset);
20168     descr = _PyType_Lookup(tp, attr_name);
20169     if (unlikely(!descr)) {
20170         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
20171     }
20172     Py_INCREF(descr);
20173     #if PY_MAJOR_VERSION < 3
20174     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
20175     #endif
20176     {
20177         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
20178         if (unlikely(f)) {
20179             PyObject *res = f(descr, obj, (PyObject *)tp);
20180             Py_DECREF(descr);
20181             return res;
20182         }
20183     }
20184     return descr;
20185 }
20186 #endif
20187 
20188 /* PyObject_GenericGetAttr */
20189 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)20190 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
20191     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
20192         return PyObject_GenericGetAttr(obj, attr_name);
20193     }
20194     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
20195 }
20196 #endif
20197 
20198 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)20199 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
20200 #if PY_VERSION_HEX >= 0x02070000
20201     PyObject *ob = PyCapsule_New(vtable, 0, 0);
20202 #else
20203     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
20204 #endif
20205     if (!ob)
20206         goto bad;
20207     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
20208         goto bad;
20209     Py_DECREF(ob);
20210     return 0;
20211 bad:
20212     Py_XDECREF(ob);
20213     return -1;
20214 }
20215 
20216 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)20217 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
20218     __Pyx_PyThreadState_declare
20219     __Pyx_PyThreadState_assign
20220     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
20221         __Pyx_PyErr_Clear();
20222 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)20223 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
20224     PyObject *result;
20225 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
20226     PyTypeObject* tp = Py_TYPE(obj);
20227     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
20228         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
20229     }
20230 #endif
20231     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
20232     if (unlikely(!result)) {
20233         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
20234     }
20235     return result;
20236 }
20237 
20238 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)20239 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
20240   int ret;
20241   PyObject *name_attr;
20242   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
20243   if (likely(name_attr)) {
20244       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
20245   } else {
20246       ret = -1;
20247   }
20248   if (unlikely(ret < 0)) {
20249       PyErr_Clear();
20250       ret = 0;
20251   }
20252   Py_XDECREF(name_attr);
20253   return ret;
20254 }
__Pyx_setup_reduce(PyObject * type_obj)20255 static int __Pyx_setup_reduce(PyObject* type_obj) {
20256     int ret = 0;
20257     PyObject *object_reduce = NULL;
20258     PyObject *object_reduce_ex = NULL;
20259     PyObject *reduce = NULL;
20260     PyObject *reduce_ex = NULL;
20261     PyObject *reduce_cython = NULL;
20262     PyObject *setstate = NULL;
20263     PyObject *setstate_cython = NULL;
20264 #if CYTHON_USE_PYTYPE_LOOKUP
20265     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
20266 #else
20267     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
20268 #endif
20269 #if CYTHON_USE_PYTYPE_LOOKUP
20270     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
20271 #else
20272     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
20273 #endif
20274     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
20275     if (reduce_ex == object_reduce_ex) {
20276 #if CYTHON_USE_PYTYPE_LOOKUP
20277         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
20278 #else
20279         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
20280 #endif
20281         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
20282         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
20283             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
20284             if (likely(reduce_cython)) {
20285                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
20286                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
20287             } else if (reduce == object_reduce || PyErr_Occurred()) {
20288                 goto __PYX_BAD;
20289             }
20290             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
20291             if (!setstate) PyErr_Clear();
20292             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
20293                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
20294                 if (likely(setstate_cython)) {
20295                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
20296                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
20297                 } else if (!setstate || PyErr_Occurred()) {
20298                     goto __PYX_BAD;
20299                 }
20300             }
20301             PyType_Modified((PyTypeObject*)type_obj);
20302         }
20303     }
20304     goto __PYX_GOOD;
20305 __PYX_BAD:
20306     if (!PyErr_Occurred())
20307         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
20308     ret = -1;
20309 __PYX_GOOD:
20310 #if !CYTHON_USE_PYTYPE_LOOKUP
20311     Py_XDECREF(object_reduce);
20312     Py_XDECREF(object_reduce_ex);
20313 #endif
20314     Py_XDECREF(reduce);
20315     Py_XDECREF(reduce_ex);
20316     Py_XDECREF(reduce_cython);
20317     Py_XDECREF(setstate);
20318     Py_XDECREF(setstate_cython);
20319     return ret;
20320 }
20321 
20322 /* TypeImport */
20323 #ifndef __PYX_HAVE_RT_ImportType
20324 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)20325 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
20326     size_t size, enum __Pyx_ImportType_CheckSize check_size)
20327 {
20328     PyObject *result = 0;
20329     char warning[200];
20330     Py_ssize_t basicsize;
20331 #ifdef Py_LIMITED_API
20332     PyObject *py_basicsize;
20333 #endif
20334     result = PyObject_GetAttrString(module, class_name);
20335     if (!result)
20336         goto bad;
20337     if (!PyType_Check(result)) {
20338         PyErr_Format(PyExc_TypeError,
20339             "%.200s.%.200s is not a type object",
20340             module_name, class_name);
20341         goto bad;
20342     }
20343 #ifndef Py_LIMITED_API
20344     basicsize = ((PyTypeObject *)result)->tp_basicsize;
20345 #else
20346     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
20347     if (!py_basicsize)
20348         goto bad;
20349     basicsize = PyLong_AsSsize_t(py_basicsize);
20350     Py_DECREF(py_basicsize);
20351     py_basicsize = 0;
20352     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
20353         goto bad;
20354 #endif
20355     if ((size_t)basicsize < size) {
20356         PyErr_Format(PyExc_ValueError,
20357             "%.200s.%.200s size changed, may indicate binary incompatibility. "
20358             "Expected %zd from C header, got %zd from PyObject",
20359             module_name, class_name, size, basicsize);
20360         goto bad;
20361     }
20362     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
20363         PyErr_Format(PyExc_ValueError,
20364             "%.200s.%.200s size changed, may indicate binary incompatibility. "
20365             "Expected %zd from C header, got %zd from PyObject",
20366             module_name, class_name, size, basicsize);
20367         goto bad;
20368     }
20369     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
20370         PyOS_snprintf(warning, sizeof(warning),
20371             "%s.%s size changed, may indicate binary incompatibility. "
20372             "Expected %zd from C header, got %zd from PyObject",
20373             module_name, class_name, size, basicsize);
20374         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
20375     }
20376     return (PyTypeObject *)result;
20377 bad:
20378     Py_XDECREF(result);
20379     return NULL;
20380 }
20381 #endif
20382 
20383 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)20384 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
20385     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
20386     for (i=0; i < nbases; i++) {
20387         PyTypeObject *tmptype;
20388         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
20389         tmptype = Py_TYPE(tmp);
20390 #if PY_MAJOR_VERSION < 3
20391         if (tmptype == &PyClass_Type)
20392             continue;
20393 #endif
20394         if (!metaclass) {
20395             metaclass = tmptype;
20396             continue;
20397         }
20398         if (PyType_IsSubtype(metaclass, tmptype))
20399             continue;
20400         if (PyType_IsSubtype(tmptype, metaclass)) {
20401             metaclass = tmptype;
20402             continue;
20403         }
20404         PyErr_SetString(PyExc_TypeError,
20405                         "metaclass conflict: "
20406                         "the metaclass of a derived class "
20407                         "must be a (non-strict) subclass "
20408                         "of the metaclasses of all its bases");
20409         return NULL;
20410     }
20411     if (!metaclass) {
20412 #if PY_MAJOR_VERSION < 3
20413         metaclass = &PyClass_Type;
20414 #else
20415         metaclass = &PyType_Type;
20416 #endif
20417     }
20418     Py_INCREF((PyObject*) metaclass);
20419     return (PyObject*) metaclass;
20420 }
20421 
20422 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)20423 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
20424                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
20425     PyObject *ns;
20426     if (metaclass) {
20427         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
20428         if (prep) {
20429             PyObject *pargs = PyTuple_Pack(2, name, bases);
20430             if (unlikely(!pargs)) {
20431                 Py_DECREF(prep);
20432                 return NULL;
20433             }
20434             ns = PyObject_Call(prep, pargs, mkw);
20435             Py_DECREF(prep);
20436             Py_DECREF(pargs);
20437         } else {
20438             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
20439                 return NULL;
20440             PyErr_Clear();
20441             ns = PyDict_New();
20442         }
20443     } else {
20444         ns = PyDict_New();
20445     }
20446     if (unlikely(!ns))
20447         return NULL;
20448     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
20449     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
20450     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
20451     return ns;
20452 bad:
20453     Py_DECREF(ns);
20454     return NULL;
20455 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)20456 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
20457                                       PyObject *dict, PyObject *mkw,
20458                                       int calculate_metaclass, int allow_py2_metaclass) {
20459     PyObject *result, *margs;
20460     PyObject *owned_metaclass = NULL;
20461     if (allow_py2_metaclass) {
20462         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
20463         if (owned_metaclass) {
20464             metaclass = owned_metaclass;
20465         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
20466             PyErr_Clear();
20467         } else {
20468             return NULL;
20469         }
20470     }
20471     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
20472         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
20473         Py_XDECREF(owned_metaclass);
20474         if (unlikely(!metaclass))
20475             return NULL;
20476         owned_metaclass = metaclass;
20477     }
20478     margs = PyTuple_Pack(3, name, bases, dict);
20479     if (unlikely(!margs)) {
20480         result = NULL;
20481     } else {
20482         result = PyObject_Call(metaclass, margs, mkw);
20483         Py_DECREF(margs);
20484     }
20485     Py_XDECREF(owned_metaclass);
20486     return result;
20487 }
20488 
20489 /* CLineInTraceback */
20490 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)20491 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
20492     PyObject *use_cline;
20493     PyObject *ptype, *pvalue, *ptraceback;
20494 #if CYTHON_COMPILING_IN_CPYTHON
20495     PyObject **cython_runtime_dict;
20496 #endif
20497     if (unlikely(!__pyx_cython_runtime)) {
20498         return c_line;
20499     }
20500     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
20501 #if CYTHON_COMPILING_IN_CPYTHON
20502     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
20503     if (likely(cython_runtime_dict)) {
20504         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
20505             use_cline, *cython_runtime_dict,
20506             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
20507     } else
20508 #endif
20509     {
20510       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
20511       if (use_cline_obj) {
20512         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
20513         Py_DECREF(use_cline_obj);
20514       } else {
20515         PyErr_Clear();
20516         use_cline = NULL;
20517       }
20518     }
20519     if (!use_cline) {
20520         c_line = 0;
20521         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
20522     }
20523     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
20524         c_line = 0;
20525     }
20526     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
20527     return c_line;
20528 }
20529 #endif
20530 
20531 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)20532 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
20533     int start = 0, mid = 0, end = count - 1;
20534     if (end >= 0 && code_line > entries[end].code_line) {
20535         return count;
20536     }
20537     while (start < end) {
20538         mid = start + (end - start) / 2;
20539         if (code_line < entries[mid].code_line) {
20540             end = mid;
20541         } else if (code_line > entries[mid].code_line) {
20542              start = mid + 1;
20543         } else {
20544             return mid;
20545         }
20546     }
20547     if (code_line <= entries[mid].code_line) {
20548         return mid;
20549     } else {
20550         return mid + 1;
20551     }
20552 }
__pyx_find_code_object(int code_line)20553 static PyCodeObject *__pyx_find_code_object(int code_line) {
20554     PyCodeObject* code_object;
20555     int pos;
20556     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
20557         return NULL;
20558     }
20559     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
20560     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
20561         return NULL;
20562     }
20563     code_object = __pyx_code_cache.entries[pos].code_object;
20564     Py_INCREF(code_object);
20565     return code_object;
20566 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)20567 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
20568     int pos, i;
20569     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
20570     if (unlikely(!code_line)) {
20571         return;
20572     }
20573     if (unlikely(!entries)) {
20574         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
20575         if (likely(entries)) {
20576             __pyx_code_cache.entries = entries;
20577             __pyx_code_cache.max_count = 64;
20578             __pyx_code_cache.count = 1;
20579             entries[0].code_line = code_line;
20580             entries[0].code_object = code_object;
20581             Py_INCREF(code_object);
20582         }
20583         return;
20584     }
20585     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
20586     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
20587         PyCodeObject* tmp = entries[pos].code_object;
20588         entries[pos].code_object = code_object;
20589         Py_DECREF(tmp);
20590         return;
20591     }
20592     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
20593         int new_max = __pyx_code_cache.max_count + 64;
20594         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
20595             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
20596         if (unlikely(!entries)) {
20597             return;
20598         }
20599         __pyx_code_cache.entries = entries;
20600         __pyx_code_cache.max_count = new_max;
20601     }
20602     for (i=__pyx_code_cache.count; i>pos; i--) {
20603         entries[i] = entries[i-1];
20604     }
20605     entries[pos].code_line = code_line;
20606     entries[pos].code_object = code_object;
20607     __pyx_code_cache.count++;
20608     Py_INCREF(code_object);
20609 }
20610 
20611 /* AddTraceback */
20612 #include "compile.h"
20613 #include "frameobject.h"
20614 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)20615 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
20616             const char *funcname, int c_line,
20617             int py_line, const char *filename) {
20618     PyCodeObject *py_code = 0;
20619     PyObject *py_srcfile = 0;
20620     PyObject *py_funcname = 0;
20621     #if PY_MAJOR_VERSION < 3
20622     py_srcfile = PyString_FromString(filename);
20623     #else
20624     py_srcfile = PyUnicode_FromString(filename);
20625     #endif
20626     if (!py_srcfile) goto bad;
20627     if (c_line) {
20628         #if PY_MAJOR_VERSION < 3
20629         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
20630         #else
20631         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
20632         #endif
20633     }
20634     else {
20635         #if PY_MAJOR_VERSION < 3
20636         py_funcname = PyString_FromString(funcname);
20637         #else
20638         py_funcname = PyUnicode_FromString(funcname);
20639         #endif
20640     }
20641     if (!py_funcname) goto bad;
20642     py_code = __Pyx_PyCode_New(
20643         0,
20644         0,
20645         0,
20646         0,
20647         0,
20648         __pyx_empty_bytes, /*PyObject *code,*/
20649         __pyx_empty_tuple, /*PyObject *consts,*/
20650         __pyx_empty_tuple, /*PyObject *names,*/
20651         __pyx_empty_tuple, /*PyObject *varnames,*/
20652         __pyx_empty_tuple, /*PyObject *freevars,*/
20653         __pyx_empty_tuple, /*PyObject *cellvars,*/
20654         py_srcfile,   /*PyObject *filename,*/
20655         py_funcname,  /*PyObject *name,*/
20656         py_line,
20657         __pyx_empty_bytes  /*PyObject *lnotab*/
20658     );
20659     Py_DECREF(py_srcfile);
20660     Py_DECREF(py_funcname);
20661     return py_code;
20662 bad:
20663     Py_XDECREF(py_srcfile);
20664     Py_XDECREF(py_funcname);
20665     return NULL;
20666 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)20667 static void __Pyx_AddTraceback(const char *funcname, int c_line,
20668                                int py_line, const char *filename) {
20669     PyCodeObject *py_code = 0;
20670     PyFrameObject *py_frame = 0;
20671     PyThreadState *tstate = __Pyx_PyThreadState_Current;
20672     if (c_line) {
20673         c_line = __Pyx_CLineForTraceback(tstate, c_line);
20674     }
20675     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
20676     if (!py_code) {
20677         py_code = __Pyx_CreateCodeObjectForTraceback(
20678             funcname, c_line, py_line, filename);
20679         if (!py_code) goto bad;
20680         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
20681     }
20682     py_frame = PyFrame_New(
20683         tstate,            /*PyThreadState *tstate,*/
20684         py_code,           /*PyCodeObject *code,*/
20685         __pyx_d,    /*PyObject *globals,*/
20686         0                  /*PyObject *locals*/
20687     );
20688     if (!py_frame) goto bad;
20689     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
20690     PyTraceBack_Here(py_frame);
20691 bad:
20692     Py_XDECREF(py_code);
20693     Py_XDECREF(py_frame);
20694 }
20695 
20696 /* CIntFromPyVerify */
20697 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
20698     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
20699 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
20700     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
20701 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
20702     {\
20703         func_type value = func_value;\
20704         if (sizeof(target_type) < sizeof(func_type)) {\
20705             if (unlikely(value != (func_type) (target_type) value)) {\
20706                 func_type zero = 0;\
20707                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
20708                     return (target_type) -1;\
20709                 if (is_unsigned && unlikely(value < zero))\
20710                     goto raise_neg_overflow;\
20711                 else\
20712                     goto raise_overflow;\
20713             }\
20714         }\
20715         return (target_type) value;\
20716     }
20717 
20718 /* CIntToPy */
__Pyx_PyInt_From_uint32_t(uint32_t value)20719 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
20720 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20721 #pragma GCC diagnostic push
20722 #pragma GCC diagnostic ignored "-Wconversion"
20723 #endif
20724     const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
20725 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20726 #pragma GCC diagnostic pop
20727 #endif
20728     const int is_unsigned = neg_one > const_zero;
20729     if (is_unsigned) {
20730         if (sizeof(uint32_t) < sizeof(long)) {
20731             return PyInt_FromLong((long) value);
20732         } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
20733             return PyLong_FromUnsignedLong((unsigned long) value);
20734 #ifdef HAVE_LONG_LONG
20735         } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
20736             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
20737 #endif
20738         }
20739     } else {
20740         if (sizeof(uint32_t) <= sizeof(long)) {
20741             return PyInt_FromLong((long) value);
20742 #ifdef HAVE_LONG_LONG
20743         } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
20744             return PyLong_FromLongLong((PY_LONG_LONG) value);
20745 #endif
20746         }
20747     }
20748     {
20749         int one = 1; int little = (int)*(unsigned char *)&one;
20750         unsigned char *bytes = (unsigned char *)&value;
20751         return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
20752                                      little, !is_unsigned);
20753     }
20754 }
20755 
20756 /* CIntFromPy */
__Pyx_PyInt_As_uint32_t(PyObject * x)20757 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
20758 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20759 #pragma GCC diagnostic push
20760 #pragma GCC diagnostic ignored "-Wconversion"
20761 #endif
20762     const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
20763 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20764 #pragma GCC diagnostic pop
20765 #endif
20766     const int is_unsigned = neg_one > const_zero;
20767 #if PY_MAJOR_VERSION < 3
20768     if (likely(PyInt_Check(x))) {
20769         if (sizeof(uint32_t) < sizeof(long)) {
20770             __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
20771         } else {
20772             long val = PyInt_AS_LONG(x);
20773             if (is_unsigned && unlikely(val < 0)) {
20774                 goto raise_neg_overflow;
20775             }
20776             return (uint32_t) val;
20777         }
20778     } else
20779 #endif
20780     if (likely(PyLong_Check(x))) {
20781         if (is_unsigned) {
20782 #if CYTHON_USE_PYLONG_INTERNALS
20783             const digit* digits = ((PyLongObject*)x)->ob_digit;
20784             switch (Py_SIZE(x)) {
20785                 case  0: return (uint32_t) 0;
20786                 case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
20787                 case 2:
20788                     if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
20789                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20790                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20791                         } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
20792                             return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
20793                         }
20794                     }
20795                     break;
20796                 case 3:
20797                     if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
20798                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20799                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20800                         } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
20801                             return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
20802                         }
20803                     }
20804                     break;
20805                 case 4:
20806                     if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
20807                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20808                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20809                         } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
20810                             return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
20811                         }
20812                     }
20813                     break;
20814             }
20815 #endif
20816 #if CYTHON_COMPILING_IN_CPYTHON
20817             if (unlikely(Py_SIZE(x) < 0)) {
20818                 goto raise_neg_overflow;
20819             }
20820 #else
20821             {
20822                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
20823                 if (unlikely(result < 0))
20824                     return (uint32_t) -1;
20825                 if (unlikely(result == 1))
20826                     goto raise_neg_overflow;
20827             }
20828 #endif
20829             if (sizeof(uint32_t) <= sizeof(unsigned long)) {
20830                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
20831 #ifdef HAVE_LONG_LONG
20832             } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
20833                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
20834 #endif
20835             }
20836         } else {
20837 #if CYTHON_USE_PYLONG_INTERNALS
20838             const digit* digits = ((PyLongObject*)x)->ob_digit;
20839             switch (Py_SIZE(x)) {
20840                 case  0: return (uint32_t) 0;
20841                 case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
20842                 case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +digits[0])
20843                 case -2:
20844                     if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
20845                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20846                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20847                         } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
20848                             return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20849                         }
20850                     }
20851                     break;
20852                 case 2:
20853                     if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
20854                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20855                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20856                         } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
20857                             return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20858                         }
20859                     }
20860                     break;
20861                 case -3:
20862                     if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
20863                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20864                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20865                         } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
20866                             return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20867                         }
20868                     }
20869                     break;
20870                 case 3:
20871                     if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
20872                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20873                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20874                         } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
20875                             return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20876                         }
20877                     }
20878                     break;
20879                 case -4:
20880                     if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
20881                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20882                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20883                         } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
20884                             return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20885                         }
20886                     }
20887                     break;
20888                 case 4:
20889                     if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
20890                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20891                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20892                         } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
20893                             return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
20894                         }
20895                     }
20896                     break;
20897             }
20898 #endif
20899             if (sizeof(uint32_t) <= sizeof(long)) {
20900                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
20901 #ifdef HAVE_LONG_LONG
20902             } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
20903                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
20904 #endif
20905             }
20906         }
20907         {
20908 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
20909             PyErr_SetString(PyExc_RuntimeError,
20910                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
20911 #else
20912             uint32_t val;
20913             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
20914  #if PY_MAJOR_VERSION < 3
20915             if (likely(v) && !PyLong_Check(v)) {
20916                 PyObject *tmp = v;
20917                 v = PyNumber_Long(tmp);
20918                 Py_DECREF(tmp);
20919             }
20920  #endif
20921             if (likely(v)) {
20922                 int one = 1; int is_little = (int)*(unsigned char *)&one;
20923                 unsigned char *bytes = (unsigned char *)&val;
20924                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
20925                                               bytes, sizeof(val),
20926                                               is_little, !is_unsigned);
20927                 Py_DECREF(v);
20928                 if (likely(!ret))
20929                     return val;
20930             }
20931 #endif
20932             return (uint32_t) -1;
20933         }
20934     } else {
20935         uint32_t val;
20936         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
20937         if (!tmp) return (uint32_t) -1;
20938         val = __Pyx_PyInt_As_uint32_t(tmp);
20939         Py_DECREF(tmp);
20940         return val;
20941     }
20942 raise_overflow:
20943     PyErr_SetString(PyExc_OverflowError,
20944         "value too large to convert to uint32_t");
20945     return (uint32_t) -1;
20946 raise_neg_overflow:
20947     PyErr_SetString(PyExc_OverflowError,
20948         "can't convert negative value to uint32_t");
20949     return (uint32_t) -1;
20950 }
20951 
20952 /* CIntFromPy */
__Pyx_PyInt_As_size_t(PyObject * x)20953 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
20954 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20955 #pragma GCC diagnostic push
20956 #pragma GCC diagnostic ignored "-Wconversion"
20957 #endif
20958     const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
20959 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
20960 #pragma GCC diagnostic pop
20961 #endif
20962     const int is_unsigned = neg_one > const_zero;
20963 #if PY_MAJOR_VERSION < 3
20964     if (likely(PyInt_Check(x))) {
20965         if (sizeof(size_t) < sizeof(long)) {
20966             __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
20967         } else {
20968             long val = PyInt_AS_LONG(x);
20969             if (is_unsigned && unlikely(val < 0)) {
20970                 goto raise_neg_overflow;
20971             }
20972             return (size_t) val;
20973         }
20974     } else
20975 #endif
20976     if (likely(PyLong_Check(x))) {
20977         if (is_unsigned) {
20978 #if CYTHON_USE_PYLONG_INTERNALS
20979             const digit* digits = ((PyLongObject*)x)->ob_digit;
20980             switch (Py_SIZE(x)) {
20981                 case  0: return (size_t) 0;
20982                 case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
20983                 case 2:
20984                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
20985                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20986                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20987                         } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
20988                             return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
20989                         }
20990                     }
20991                     break;
20992                 case 3:
20993                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
20994                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20995                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20996                         } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
20997                             return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
20998                         }
20999                     }
21000                     break;
21001                 case 4:
21002                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
21003                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21004                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21005                         } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
21006                             return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
21007                         }
21008                     }
21009                     break;
21010             }
21011 #endif
21012 #if CYTHON_COMPILING_IN_CPYTHON
21013             if (unlikely(Py_SIZE(x) < 0)) {
21014                 goto raise_neg_overflow;
21015             }
21016 #else
21017             {
21018                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21019                 if (unlikely(result < 0))
21020                     return (size_t) -1;
21021                 if (unlikely(result == 1))
21022                     goto raise_neg_overflow;
21023             }
21024 #endif
21025             if (sizeof(size_t) <= sizeof(unsigned long)) {
21026                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
21027 #ifdef HAVE_LONG_LONG
21028             } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
21029                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21030 #endif
21031             }
21032         } else {
21033 #if CYTHON_USE_PYLONG_INTERNALS
21034             const digit* digits = ((PyLongObject*)x)->ob_digit;
21035             switch (Py_SIZE(x)) {
21036                 case  0: return (size_t) 0;
21037                 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
21038                 case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
21039                 case -2:
21040                     if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
21041                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21042                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21043                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
21044                             return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21045                         }
21046                     }
21047                     break;
21048                 case 2:
21049                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
21050                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21051                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21052                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
21053                             return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21054                         }
21055                     }
21056                     break;
21057                 case -3:
21058                     if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
21059                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21060                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21061                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
21062                             return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21063                         }
21064                     }
21065                     break;
21066                 case 3:
21067                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
21068                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21069                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21070                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
21071                             return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21072                         }
21073                     }
21074                     break;
21075                 case -4:
21076                     if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
21077                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21078                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21079                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
21080                             return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21081                         }
21082                     }
21083                     break;
21084                 case 4:
21085                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
21086                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21087                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21088                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
21089                             return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
21090                         }
21091                     }
21092                     break;
21093             }
21094 #endif
21095             if (sizeof(size_t) <= sizeof(long)) {
21096                 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
21097 #ifdef HAVE_LONG_LONG
21098             } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
21099                 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
21100 #endif
21101             }
21102         }
21103         {
21104 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21105             PyErr_SetString(PyExc_RuntimeError,
21106                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21107 #else
21108             size_t val;
21109             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21110  #if PY_MAJOR_VERSION < 3
21111             if (likely(v) && !PyLong_Check(v)) {
21112                 PyObject *tmp = v;
21113                 v = PyNumber_Long(tmp);
21114                 Py_DECREF(tmp);
21115             }
21116  #endif
21117             if (likely(v)) {
21118                 int one = 1; int is_little = (int)*(unsigned char *)&one;
21119                 unsigned char *bytes = (unsigned char *)&val;
21120                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
21121                                               bytes, sizeof(val),
21122                                               is_little, !is_unsigned);
21123                 Py_DECREF(v);
21124                 if (likely(!ret))
21125                     return val;
21126             }
21127 #endif
21128             return (size_t) -1;
21129         }
21130     } else {
21131         size_t val;
21132         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21133         if (!tmp) return (size_t) -1;
21134         val = __Pyx_PyInt_As_size_t(tmp);
21135         Py_DECREF(tmp);
21136         return val;
21137     }
21138 raise_overflow:
21139     PyErr_SetString(PyExc_OverflowError,
21140         "value too large to convert to size_t");
21141     return (size_t) -1;
21142 raise_neg_overflow:
21143     PyErr_SetString(PyExc_OverflowError,
21144         "can't convert negative value to size_t");
21145     return (size_t) -1;
21146 }
21147 
21148 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)21149 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
21150 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21151 #pragma GCC diagnostic push
21152 #pragma GCC diagnostic ignored "-Wconversion"
21153 #endif
21154     const long neg_one = (long) -1, const_zero = (long) 0;
21155 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21156 #pragma GCC diagnostic pop
21157 #endif
21158     const int is_unsigned = neg_one > const_zero;
21159 #if PY_MAJOR_VERSION < 3
21160     if (likely(PyInt_Check(x))) {
21161         if (sizeof(long) < sizeof(long)) {
21162             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
21163         } else {
21164             long val = PyInt_AS_LONG(x);
21165             if (is_unsigned && unlikely(val < 0)) {
21166                 goto raise_neg_overflow;
21167             }
21168             return (long) val;
21169         }
21170     } else
21171 #endif
21172     if (likely(PyLong_Check(x))) {
21173         if (is_unsigned) {
21174 #if CYTHON_USE_PYLONG_INTERNALS
21175             const digit* digits = ((PyLongObject*)x)->ob_digit;
21176             switch (Py_SIZE(x)) {
21177                 case  0: return (long) 0;
21178                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
21179                 case 2:
21180                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
21181                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21182                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21183                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
21184                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
21185                         }
21186                     }
21187                     break;
21188                 case 3:
21189                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
21190                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21191                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21192                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
21193                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
21194                         }
21195                     }
21196                     break;
21197                 case 4:
21198                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
21199                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21200                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21201                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
21202                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
21203                         }
21204                     }
21205                     break;
21206             }
21207 #endif
21208 #if CYTHON_COMPILING_IN_CPYTHON
21209             if (unlikely(Py_SIZE(x) < 0)) {
21210                 goto raise_neg_overflow;
21211             }
21212 #else
21213             {
21214                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21215                 if (unlikely(result < 0))
21216                     return (long) -1;
21217                 if (unlikely(result == 1))
21218                     goto raise_neg_overflow;
21219             }
21220 #endif
21221             if (sizeof(long) <= sizeof(unsigned long)) {
21222                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
21223 #ifdef HAVE_LONG_LONG
21224             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
21225                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21226 #endif
21227             }
21228         } else {
21229 #if CYTHON_USE_PYLONG_INTERNALS
21230             const digit* digits = ((PyLongObject*)x)->ob_digit;
21231             switch (Py_SIZE(x)) {
21232                 case  0: return (long) 0;
21233                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
21234                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
21235                 case -2:
21236                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
21237                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21238                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21239                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21240                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21241                         }
21242                     }
21243                     break;
21244                 case 2:
21245                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
21246                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21247                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21248                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21249                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21250                         }
21251                     }
21252                     break;
21253                 case -3:
21254                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21255                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21256                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21257                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21258                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21259                         }
21260                     }
21261                     break;
21262                 case 3:
21263                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
21264                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21265                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21266                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21267                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21268                         }
21269                     }
21270                     break;
21271                 case -4:
21272                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21273                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21274                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21275                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21276                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21277                         }
21278                     }
21279                     break;
21280                 case 4:
21281                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
21282                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21283                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21284                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21285                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
21286                         }
21287                     }
21288                     break;
21289             }
21290 #endif
21291             if (sizeof(long) <= sizeof(long)) {
21292                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
21293 #ifdef HAVE_LONG_LONG
21294             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
21295                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
21296 #endif
21297             }
21298         }
21299         {
21300 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21301             PyErr_SetString(PyExc_RuntimeError,
21302                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21303 #else
21304             long val;
21305             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21306  #if PY_MAJOR_VERSION < 3
21307             if (likely(v) && !PyLong_Check(v)) {
21308                 PyObject *tmp = v;
21309                 v = PyNumber_Long(tmp);
21310                 Py_DECREF(tmp);
21311             }
21312  #endif
21313             if (likely(v)) {
21314                 int one = 1; int is_little = (int)*(unsigned char *)&one;
21315                 unsigned char *bytes = (unsigned char *)&val;
21316                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
21317                                               bytes, sizeof(val),
21318                                               is_little, !is_unsigned);
21319                 Py_DECREF(v);
21320                 if (likely(!ret))
21321                     return val;
21322             }
21323 #endif
21324             return (long) -1;
21325         }
21326     } else {
21327         long val;
21328         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21329         if (!tmp) return (long) -1;
21330         val = __Pyx_PyInt_As_long(tmp);
21331         Py_DECREF(tmp);
21332         return val;
21333     }
21334 raise_overflow:
21335     PyErr_SetString(PyExc_OverflowError,
21336         "value too large to convert to long");
21337     return (long) -1;
21338 raise_neg_overflow:
21339     PyErr_SetString(PyExc_OverflowError,
21340         "can't convert negative value to long");
21341     return (long) -1;
21342 }
21343 
21344 /* CIntFromPy */
__Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject * x)21345 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) {
21346 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21347 #pragma GCC diagnostic push
21348 #pragma GCC diagnostic ignored "-Wconversion"
21349 #endif
21350     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0;
21351 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21352 #pragma GCC diagnostic pop
21353 #endif
21354     const int is_unsigned = neg_one > const_zero;
21355 #if PY_MAJOR_VERSION < 3
21356     if (likely(PyInt_Check(x))) {
21357         if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
21358             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, PyInt_AS_LONG(x))
21359         } else {
21360             long val = PyInt_AS_LONG(x);
21361             if (is_unsigned && unlikely(val < 0)) {
21362                 goto raise_neg_overflow;
21363             }
21364             return (unsigned PY_LONG_LONG) val;
21365         }
21366     } else
21367 #endif
21368     if (likely(PyLong_Check(x))) {
21369         if (is_unsigned) {
21370 #if CYTHON_USE_PYLONG_INTERNALS
21371             const digit* digits = ((PyLongObject*)x)->ob_digit;
21372             switch (Py_SIZE(x)) {
21373                 case  0: return (unsigned PY_LONG_LONG) 0;
21374                 case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, digits[0])
21375                 case 2:
21376                     if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
21377                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21378                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21379                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
21380                             return (unsigned PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21381                         }
21382                     }
21383                     break;
21384                 case 3:
21385                     if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
21386                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21387                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21388                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
21389                             return (unsigned PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21390                         }
21391                     }
21392                     break;
21393                 case 4:
21394                     if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
21395                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21396                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21397                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
21398                             return (unsigned PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21399                         }
21400                     }
21401                     break;
21402             }
21403 #endif
21404 #if CYTHON_COMPILING_IN_CPYTHON
21405             if (unlikely(Py_SIZE(x) < 0)) {
21406                 goto raise_neg_overflow;
21407             }
21408 #else
21409             {
21410                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21411                 if (unlikely(result < 0))
21412                     return (unsigned PY_LONG_LONG) -1;
21413                 if (unlikely(result == 1))
21414                     goto raise_neg_overflow;
21415             }
21416 #endif
21417             if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
21418                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
21419 #ifdef HAVE_LONG_LONG
21420             } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
21421                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21422 #endif
21423             }
21424         } else {
21425 #if CYTHON_USE_PYLONG_INTERNALS
21426             const digit* digits = ((PyLongObject*)x)->ob_digit;
21427             switch (Py_SIZE(x)) {
21428                 case  0: return (unsigned PY_LONG_LONG) 0;
21429                 case -1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
21430                 case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG,  digit, +digits[0])
21431                 case -2:
21432                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
21433                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21434                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21435                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21436                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21437                         }
21438                     }
21439                     break;
21440                 case 2:
21441                     if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
21442                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21443                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21444                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21445                             return (unsigned PY_LONG_LONG) ((((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21446                         }
21447                     }
21448                     break;
21449                 case -3:
21450                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21451                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21452                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21453                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21454                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21455                         }
21456                     }
21457                     break;
21458                 case 3:
21459                     if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
21460                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21461                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21462                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21463                             return (unsigned PY_LONG_LONG) ((((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21464                         }
21465                     }
21466                     break;
21467                 case -4:
21468                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21469                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21470                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21471                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21472                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21473                         }
21474                     }
21475                     break;
21476                 case 4:
21477                     if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
21478                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21479                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21480                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21481                             return (unsigned PY_LONG_LONG) ((((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
21482                         }
21483                     }
21484                     break;
21485             }
21486 #endif
21487             if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
21488                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, long, PyLong_AsLong(x))
21489 #ifdef HAVE_LONG_LONG
21490             } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
21491                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
21492 #endif
21493             }
21494         }
21495         {
21496 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21497             PyErr_SetString(PyExc_RuntimeError,
21498                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21499 #else
21500             unsigned PY_LONG_LONG val;
21501             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21502  #if PY_MAJOR_VERSION < 3
21503             if (likely(v) && !PyLong_Check(v)) {
21504                 PyObject *tmp = v;
21505                 v = PyNumber_Long(tmp);
21506                 Py_DECREF(tmp);
21507             }
21508  #endif
21509             if (likely(v)) {
21510                 int one = 1; int is_little = (int)*(unsigned char *)&one;
21511                 unsigned char *bytes = (unsigned char *)&val;
21512                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
21513                                               bytes, sizeof(val),
21514                                               is_little, !is_unsigned);
21515                 Py_DECREF(v);
21516                 if (likely(!ret))
21517                     return val;
21518             }
21519 #endif
21520             return (unsigned PY_LONG_LONG) -1;
21521         }
21522     } else {
21523         unsigned PY_LONG_LONG val;
21524         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21525         if (!tmp) return (unsigned PY_LONG_LONG) -1;
21526         val = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(tmp);
21527         Py_DECREF(tmp);
21528         return val;
21529     }
21530 raise_overflow:
21531     PyErr_SetString(PyExc_OverflowError,
21532         "value too large to convert to unsigned PY_LONG_LONG");
21533     return (unsigned PY_LONG_LONG) -1;
21534 raise_neg_overflow:
21535     PyErr_SetString(PyExc_OverflowError,
21536         "can't convert negative value to unsigned PY_LONG_LONG");
21537     return (unsigned PY_LONG_LONG) -1;
21538 }
21539 
21540 /* CIntFromPy */
__Pyx_PyInt_As_PY_LONG_LONG(PyObject * x)21541 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
21542 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21543 #pragma GCC diagnostic push
21544 #pragma GCC diagnostic ignored "-Wconversion"
21545 #endif
21546     const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
21547 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21548 #pragma GCC diagnostic pop
21549 #endif
21550     const int is_unsigned = neg_one > const_zero;
21551 #if PY_MAJOR_VERSION < 3
21552     if (likely(PyInt_Check(x))) {
21553         if (sizeof(PY_LONG_LONG) < sizeof(long)) {
21554             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
21555         } else {
21556             long val = PyInt_AS_LONG(x);
21557             if (is_unsigned && unlikely(val < 0)) {
21558                 goto raise_neg_overflow;
21559             }
21560             return (PY_LONG_LONG) val;
21561         }
21562     } else
21563 #endif
21564     if (likely(PyLong_Check(x))) {
21565         if (is_unsigned) {
21566 #if CYTHON_USE_PYLONG_INTERNALS
21567             const digit* digits = ((PyLongObject*)x)->ob_digit;
21568             switch (Py_SIZE(x)) {
21569                 case  0: return (PY_LONG_LONG) 0;
21570                 case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
21571                 case 2:
21572                     if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
21573                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21574                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21575                         } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
21576                             return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
21577                         }
21578                     }
21579                     break;
21580                 case 3:
21581                     if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
21582                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21583                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21584                         } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
21585                             return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
21586                         }
21587                     }
21588                     break;
21589                 case 4:
21590                     if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
21591                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21592                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21593                         } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
21594                             return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
21595                         }
21596                     }
21597                     break;
21598             }
21599 #endif
21600 #if CYTHON_COMPILING_IN_CPYTHON
21601             if (unlikely(Py_SIZE(x) < 0)) {
21602                 goto raise_neg_overflow;
21603             }
21604 #else
21605             {
21606                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21607                 if (unlikely(result < 0))
21608                     return (PY_LONG_LONG) -1;
21609                 if (unlikely(result == 1))
21610                     goto raise_neg_overflow;
21611             }
21612 #endif
21613             if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
21614                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
21615 #ifdef HAVE_LONG_LONG
21616             } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
21617                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21618 #endif
21619             }
21620         } else {
21621 #if CYTHON_USE_PYLONG_INTERNALS
21622             const digit* digits = ((PyLongObject*)x)->ob_digit;
21623             switch (Py_SIZE(x)) {
21624                 case  0: return (PY_LONG_LONG) 0;
21625                 case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
21626                 case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG,  digit, +digits[0])
21627                 case -2:
21628                     if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
21629                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21630                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21631                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21632                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21633                         }
21634                     }
21635                     break;
21636                 case 2:
21637                     if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
21638                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21639                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21640                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21641                             return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21642                         }
21643                     }
21644                     break;
21645                 case -3:
21646                     if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21647                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21648                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21649                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21650                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21651                         }
21652                     }
21653                     break;
21654                 case 3:
21655                     if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
21656                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21657                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21658                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21659                             return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21660                         }
21661                     }
21662                     break;
21663                 case -4:
21664                     if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21665                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21666                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21667                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21668                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21669                         }
21670                     }
21671                     break;
21672                 case 4:
21673                     if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
21674                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21675                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21676                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21677                             return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
21678                         }
21679                     }
21680                     break;
21681             }
21682 #endif
21683             if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
21684                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
21685 #ifdef HAVE_LONG_LONG
21686             } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
21687                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
21688 #endif
21689             }
21690         }
21691         {
21692 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21693             PyErr_SetString(PyExc_RuntimeError,
21694                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21695 #else
21696             PY_LONG_LONG val;
21697             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21698  #if PY_MAJOR_VERSION < 3
21699             if (likely(v) && !PyLong_Check(v)) {
21700                 PyObject *tmp = v;
21701                 v = PyNumber_Long(tmp);
21702                 Py_DECREF(tmp);
21703             }
21704  #endif
21705             if (likely(v)) {
21706                 int one = 1; int is_little = (int)*(unsigned char *)&one;
21707                 unsigned char *bytes = (unsigned char *)&val;
21708                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
21709                                               bytes, sizeof(val),
21710                                               is_little, !is_unsigned);
21711                 Py_DECREF(v);
21712                 if (likely(!ret))
21713                     return val;
21714             }
21715 #endif
21716             return (PY_LONG_LONG) -1;
21717         }
21718     } else {
21719         PY_LONG_LONG val;
21720         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21721         if (!tmp) return (PY_LONG_LONG) -1;
21722         val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
21723         Py_DECREF(tmp);
21724         return val;
21725     }
21726 raise_overflow:
21727     PyErr_SetString(PyExc_OverflowError,
21728         "value too large to convert to PY_LONG_LONG");
21729     return (PY_LONG_LONG) -1;
21730 raise_neg_overflow:
21731     PyErr_SetString(PyExc_OverflowError,
21732         "can't convert negative value to PY_LONG_LONG");
21733     return (PY_LONG_LONG) -1;
21734 }
21735 
21736 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)21737 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
21738 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21739 #pragma GCC diagnostic push
21740 #pragma GCC diagnostic ignored "-Wconversion"
21741 #endif
21742     const int neg_one = (int) -1, const_zero = (int) 0;
21743 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21744 #pragma GCC diagnostic pop
21745 #endif
21746     const int is_unsigned = neg_one > const_zero;
21747 #if PY_MAJOR_VERSION < 3
21748     if (likely(PyInt_Check(x))) {
21749         if (sizeof(int) < sizeof(long)) {
21750             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
21751         } else {
21752             long val = PyInt_AS_LONG(x);
21753             if (is_unsigned && unlikely(val < 0)) {
21754                 goto raise_neg_overflow;
21755             }
21756             return (int) val;
21757         }
21758     } else
21759 #endif
21760     if (likely(PyLong_Check(x))) {
21761         if (is_unsigned) {
21762 #if CYTHON_USE_PYLONG_INTERNALS
21763             const digit* digits = ((PyLongObject*)x)->ob_digit;
21764             switch (Py_SIZE(x)) {
21765                 case  0: return (int) 0;
21766                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
21767                 case 2:
21768                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
21769                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21770                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21771                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
21772                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21773                         }
21774                     }
21775                     break;
21776                 case 3:
21777                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
21778                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21779                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21780                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
21781                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21782                         }
21783                     }
21784                     break;
21785                 case 4:
21786                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
21787                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21788                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21789                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
21790                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21791                         }
21792                     }
21793                     break;
21794             }
21795 #endif
21796 #if CYTHON_COMPILING_IN_CPYTHON
21797             if (unlikely(Py_SIZE(x) < 0)) {
21798                 goto raise_neg_overflow;
21799             }
21800 #else
21801             {
21802                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21803                 if (unlikely(result < 0))
21804                     return (int) -1;
21805                 if (unlikely(result == 1))
21806                     goto raise_neg_overflow;
21807             }
21808 #endif
21809             if (sizeof(int) <= sizeof(unsigned long)) {
21810                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
21811 #ifdef HAVE_LONG_LONG
21812             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
21813                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21814 #endif
21815             }
21816         } else {
21817 #if CYTHON_USE_PYLONG_INTERNALS
21818             const digit* digits = ((PyLongObject*)x)->ob_digit;
21819             switch (Py_SIZE(x)) {
21820                 case  0: return (int) 0;
21821                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
21822                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
21823                 case -2:
21824                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
21825                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21826                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21827                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21828                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21829                         }
21830                     }
21831                     break;
21832                 case 2:
21833                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
21834                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21835                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21836                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21837                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21838                         }
21839                     }
21840                     break;
21841                 case -3:
21842                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21843                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21844                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21845                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21846                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21847                         }
21848                     }
21849                     break;
21850                 case 3:
21851                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
21852                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21853                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21854                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21855                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21856                         }
21857                     }
21858                     break;
21859                 case -4:
21860                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21861                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21862                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21863                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
21864                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21865                         }
21866                     }
21867                     break;
21868                 case 4:
21869                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
21870                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21871                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21872                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
21873                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21874                         }
21875                     }
21876                     break;
21877             }
21878 #endif
21879             if (sizeof(int) <= sizeof(long)) {
21880                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
21881 #ifdef HAVE_LONG_LONG
21882             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
21883                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
21884 #endif
21885             }
21886         }
21887         {
21888 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21889             PyErr_SetString(PyExc_RuntimeError,
21890                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21891 #else
21892             int val;
21893             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21894  #if PY_MAJOR_VERSION < 3
21895             if (likely(v) && !PyLong_Check(v)) {
21896                 PyObject *tmp = v;
21897                 v = PyNumber_Long(tmp);
21898                 Py_DECREF(tmp);
21899             }
21900  #endif
21901             if (likely(v)) {
21902                 int one = 1; int is_little = (int)*(unsigned char *)&one;
21903                 unsigned char *bytes = (unsigned char *)&val;
21904                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
21905                                               bytes, sizeof(val),
21906                                               is_little, !is_unsigned);
21907                 Py_DECREF(v);
21908                 if (likely(!ret))
21909                     return val;
21910             }
21911 #endif
21912             return (int) -1;
21913         }
21914     } else {
21915         int val;
21916         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21917         if (!tmp) return (int) -1;
21918         val = __Pyx_PyInt_As_int(tmp);
21919         Py_DECREF(tmp);
21920         return val;
21921     }
21922 raise_overflow:
21923     PyErr_SetString(PyExc_OverflowError,
21924         "value too large to convert to int");
21925     return (int) -1;
21926 raise_neg_overflow:
21927     PyErr_SetString(PyExc_OverflowError,
21928         "can't convert negative value to int");
21929     return (int) -1;
21930 }
21931 
21932 /* CIntToPy */
__Pyx_PyInt_From_long(long value)21933 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
21934 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21935 #pragma GCC diagnostic push
21936 #pragma GCC diagnostic ignored "-Wconversion"
21937 #endif
21938     const long neg_one = (long) -1, const_zero = (long) 0;
21939 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21940 #pragma GCC diagnostic pop
21941 #endif
21942     const int is_unsigned = neg_one > const_zero;
21943     if (is_unsigned) {
21944         if (sizeof(long) < sizeof(long)) {
21945             return PyInt_FromLong((long) value);
21946         } else if (sizeof(long) <= sizeof(unsigned long)) {
21947             return PyLong_FromUnsignedLong((unsigned long) value);
21948 #ifdef HAVE_LONG_LONG
21949         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
21950             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
21951 #endif
21952         }
21953     } else {
21954         if (sizeof(long) <= sizeof(long)) {
21955             return PyInt_FromLong((long) value);
21956 #ifdef HAVE_LONG_LONG
21957         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
21958             return PyLong_FromLongLong((PY_LONG_LONG) value);
21959 #endif
21960         }
21961     }
21962     {
21963         int one = 1; int little = (int)*(unsigned char *)&one;
21964         unsigned char *bytes = (unsigned char *)&value;
21965         return _PyLong_FromByteArray(bytes, sizeof(long),
21966                                      little, !is_unsigned);
21967     }
21968 }
21969 
21970 /* CIntToPy */
__Pyx_PyInt_From_int(int value)21971 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
21972 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21973 #pragma GCC diagnostic push
21974 #pragma GCC diagnostic ignored "-Wconversion"
21975 #endif
21976     const int neg_one = (int) -1, const_zero = (int) 0;
21977 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21978 #pragma GCC diagnostic pop
21979 #endif
21980     const int is_unsigned = neg_one > const_zero;
21981     if (is_unsigned) {
21982         if (sizeof(int) < sizeof(long)) {
21983             return PyInt_FromLong((long) value);
21984         } else if (sizeof(int) <= sizeof(unsigned long)) {
21985             return PyLong_FromUnsignedLong((unsigned long) value);
21986 #ifdef HAVE_LONG_LONG
21987         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
21988             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
21989 #endif
21990         }
21991     } else {
21992         if (sizeof(int) <= sizeof(long)) {
21993             return PyInt_FromLong((long) value);
21994 #ifdef HAVE_LONG_LONG
21995         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
21996             return PyLong_FromLongLong((PY_LONG_LONG) value);
21997 #endif
21998         }
21999     }
22000     {
22001         int one = 1; int little = (int)*(unsigned char *)&one;
22002         unsigned char *bytes = (unsigned char *)&value;
22003         return _PyLong_FromByteArray(bytes, sizeof(int),
22004                                      little, !is_unsigned);
22005     }
22006 }
22007 
22008 /* CIntFromPy */
__Pyx_PyInt_As_uint64_t(PyObject * x)22009 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
22010 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22011 #pragma GCC diagnostic push
22012 #pragma GCC diagnostic ignored "-Wconversion"
22013 #endif
22014     const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
22015 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22016 #pragma GCC diagnostic pop
22017 #endif
22018     const int is_unsigned = neg_one > const_zero;
22019 #if PY_MAJOR_VERSION < 3
22020     if (likely(PyInt_Check(x))) {
22021         if (sizeof(uint64_t) < sizeof(long)) {
22022             __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
22023         } else {
22024             long val = PyInt_AS_LONG(x);
22025             if (is_unsigned && unlikely(val < 0)) {
22026                 goto raise_neg_overflow;
22027             }
22028             return (uint64_t) val;
22029         }
22030     } else
22031 #endif
22032     if (likely(PyLong_Check(x))) {
22033         if (is_unsigned) {
22034 #if CYTHON_USE_PYLONG_INTERNALS
22035             const digit* digits = ((PyLongObject*)x)->ob_digit;
22036             switch (Py_SIZE(x)) {
22037                 case  0: return (uint64_t) 0;
22038                 case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
22039                 case 2:
22040                     if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
22041                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22042                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22043                         } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
22044                             return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
22045                         }
22046                     }
22047                     break;
22048                 case 3:
22049                     if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
22050                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22051                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22052                         } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
22053                             return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
22054                         }
22055                     }
22056                     break;
22057                 case 4:
22058                     if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
22059                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22060                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22061                         } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
22062                             return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
22063                         }
22064                     }
22065                     break;
22066             }
22067 #endif
22068 #if CYTHON_COMPILING_IN_CPYTHON
22069             if (unlikely(Py_SIZE(x) < 0)) {
22070                 goto raise_neg_overflow;
22071             }
22072 #else
22073             {
22074                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22075                 if (unlikely(result < 0))
22076                     return (uint64_t) -1;
22077                 if (unlikely(result == 1))
22078                     goto raise_neg_overflow;
22079             }
22080 #endif
22081             if (sizeof(uint64_t) <= sizeof(unsigned long)) {
22082                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
22083 #ifdef HAVE_LONG_LONG
22084             } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
22085                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22086 #endif
22087             }
22088         } else {
22089 #if CYTHON_USE_PYLONG_INTERNALS
22090             const digit* digits = ((PyLongObject*)x)->ob_digit;
22091             switch (Py_SIZE(x)) {
22092                 case  0: return (uint64_t) 0;
22093                 case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
22094                 case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +digits[0])
22095                 case -2:
22096                     if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
22097                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22098                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22099                         } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
22100                             return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22101                         }
22102                     }
22103                     break;
22104                 case 2:
22105                     if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
22106                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22107                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22108                         } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
22109                             return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22110                         }
22111                     }
22112                     break;
22113                 case -3:
22114                     if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
22115                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22116                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22117                         } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
22118                             return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22119                         }
22120                     }
22121                     break;
22122                 case 3:
22123                     if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
22124                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22125                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22126                         } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
22127                             return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22128                         }
22129                     }
22130                     break;
22131                 case -4:
22132                     if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
22133                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22134                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22135                         } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
22136                             return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22137                         }
22138                     }
22139                     break;
22140                 case 4:
22141                     if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
22142                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22143                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22144                         } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
22145                             return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
22146                         }
22147                     }
22148                     break;
22149             }
22150 #endif
22151             if (sizeof(uint64_t) <= sizeof(long)) {
22152                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
22153 #ifdef HAVE_LONG_LONG
22154             } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
22155                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
22156 #endif
22157             }
22158         }
22159         {
22160 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
22161             PyErr_SetString(PyExc_RuntimeError,
22162                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
22163 #else
22164             uint64_t val;
22165             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
22166  #if PY_MAJOR_VERSION < 3
22167             if (likely(v) && !PyLong_Check(v)) {
22168                 PyObject *tmp = v;
22169                 v = PyNumber_Long(tmp);
22170                 Py_DECREF(tmp);
22171             }
22172  #endif
22173             if (likely(v)) {
22174                 int one = 1; int is_little = (int)*(unsigned char *)&one;
22175                 unsigned char *bytes = (unsigned char *)&val;
22176                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
22177                                               bytes, sizeof(val),
22178                                               is_little, !is_unsigned);
22179                 Py_DECREF(v);
22180                 if (likely(!ret))
22181                     return val;
22182             }
22183 #endif
22184             return (uint64_t) -1;
22185         }
22186     } else {
22187         uint64_t val;
22188         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
22189         if (!tmp) return (uint64_t) -1;
22190         val = __Pyx_PyInt_As_uint64_t(tmp);
22191         Py_DECREF(tmp);
22192         return val;
22193     }
22194 raise_overflow:
22195     PyErr_SetString(PyExc_OverflowError,
22196         "value too large to convert to uint64_t");
22197     return (uint64_t) -1;
22198 raise_neg_overflow:
22199     PyErr_SetString(PyExc_OverflowError,
22200         "can't convert negative value to uint64_t");
22201     return (uint64_t) -1;
22202 }
22203 
22204 /* CIntFromPy */
__Pyx_PyInt_As_int64_t(PyObject * x)22205 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
22206 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22207 #pragma GCC diagnostic push
22208 #pragma GCC diagnostic ignored "-Wconversion"
22209 #endif
22210     const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
22211 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22212 #pragma GCC diagnostic pop
22213 #endif
22214     const int is_unsigned = neg_one > const_zero;
22215 #if PY_MAJOR_VERSION < 3
22216     if (likely(PyInt_Check(x))) {
22217         if (sizeof(int64_t) < sizeof(long)) {
22218             __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
22219         } else {
22220             long val = PyInt_AS_LONG(x);
22221             if (is_unsigned && unlikely(val < 0)) {
22222                 goto raise_neg_overflow;
22223             }
22224             return (int64_t) val;
22225         }
22226     } else
22227 #endif
22228     if (likely(PyLong_Check(x))) {
22229         if (is_unsigned) {
22230 #if CYTHON_USE_PYLONG_INTERNALS
22231             const digit* digits = ((PyLongObject*)x)->ob_digit;
22232             switch (Py_SIZE(x)) {
22233                 case  0: return (int64_t) 0;
22234                 case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
22235                 case 2:
22236                     if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
22237                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22238                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22239                         } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
22240                             return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
22241                         }
22242                     }
22243                     break;
22244                 case 3:
22245                     if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
22246                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22247                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22248                         } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
22249                             return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
22250                         }
22251                     }
22252                     break;
22253                 case 4:
22254                     if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
22255                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22256                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22257                         } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
22258                             return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
22259                         }
22260                     }
22261                     break;
22262             }
22263 #endif
22264 #if CYTHON_COMPILING_IN_CPYTHON
22265             if (unlikely(Py_SIZE(x) < 0)) {
22266                 goto raise_neg_overflow;
22267             }
22268 #else
22269             {
22270                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22271                 if (unlikely(result < 0))
22272                     return (int64_t) -1;
22273                 if (unlikely(result == 1))
22274                     goto raise_neg_overflow;
22275             }
22276 #endif
22277             if (sizeof(int64_t) <= sizeof(unsigned long)) {
22278                 __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
22279 #ifdef HAVE_LONG_LONG
22280             } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
22281                 __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22282 #endif
22283             }
22284         } else {
22285 #if CYTHON_USE_PYLONG_INTERNALS
22286             const digit* digits = ((PyLongObject*)x)->ob_digit;
22287             switch (Py_SIZE(x)) {
22288                 case  0: return (int64_t) 0;
22289                 case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
22290                 case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
22291                 case -2:
22292                     if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
22293                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22294                             __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22295                         } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
22296                             return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22297                         }
22298                     }
22299                     break;
22300                 case 2:
22301                     if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
22302                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22303                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22304                         } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
22305                             return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22306                         }
22307                     }
22308                     break;
22309                 case -3:
22310                     if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
22311                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22312                             __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22313                         } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
22314                             return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22315                         }
22316                     }
22317                     break;
22318                 case 3:
22319                     if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
22320                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22321                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22322                         } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
22323                             return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22324                         }
22325                     }
22326                     break;
22327                 case -4:
22328                     if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
22329                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22330                             __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22331                         } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
22332                             return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22333                         }
22334                     }
22335                     break;
22336                 case 4:
22337                     if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
22338                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22339                             __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22340                         } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
22341                             return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
22342                         }
22343                     }
22344                     break;
22345             }
22346 #endif
22347             if (sizeof(int64_t) <= sizeof(long)) {
22348                 __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
22349 #ifdef HAVE_LONG_LONG
22350             } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
22351                 __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
22352 #endif
22353             }
22354         }
22355         {
22356 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
22357             PyErr_SetString(PyExc_RuntimeError,
22358                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
22359 #else
22360             int64_t val;
22361             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
22362  #if PY_MAJOR_VERSION < 3
22363             if (likely(v) && !PyLong_Check(v)) {
22364                 PyObject *tmp = v;
22365                 v = PyNumber_Long(tmp);
22366                 Py_DECREF(tmp);
22367             }
22368  #endif
22369             if (likely(v)) {
22370                 int one = 1; int is_little = (int)*(unsigned char *)&one;
22371                 unsigned char *bytes = (unsigned char *)&val;
22372                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
22373                                               bytes, sizeof(val),
22374                                               is_little, !is_unsigned);
22375                 Py_DECREF(v);
22376                 if (likely(!ret))
22377                     return val;
22378             }
22379 #endif
22380             return (int64_t) -1;
22381         }
22382     } else {
22383         int64_t val;
22384         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
22385         if (!tmp) return (int64_t) -1;
22386         val = __Pyx_PyInt_As_int64_t(tmp);
22387         Py_DECREF(tmp);
22388         return val;
22389     }
22390 raise_overflow:
22391     PyErr_SetString(PyExc_OverflowError,
22392         "value too large to convert to int64_t");
22393     return (int64_t) -1;
22394 raise_neg_overflow:
22395     PyErr_SetString(PyExc_OverflowError,
22396         "can't convert negative value to int64_t");
22397     return (int64_t) -1;
22398 }
22399 
22400 /* CIntFromPy */
__Pyx_PyInt_As_int32_t(PyObject * x)22401 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
22402 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22403 #pragma GCC diagnostic push
22404 #pragma GCC diagnostic ignored "-Wconversion"
22405 #endif
22406     const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
22407 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22408 #pragma GCC diagnostic pop
22409 #endif
22410     const int is_unsigned = neg_one > const_zero;
22411 #if PY_MAJOR_VERSION < 3
22412     if (likely(PyInt_Check(x))) {
22413         if (sizeof(int32_t) < sizeof(long)) {
22414             __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
22415         } else {
22416             long val = PyInt_AS_LONG(x);
22417             if (is_unsigned && unlikely(val < 0)) {
22418                 goto raise_neg_overflow;
22419             }
22420             return (int32_t) val;
22421         }
22422     } else
22423 #endif
22424     if (likely(PyLong_Check(x))) {
22425         if (is_unsigned) {
22426 #if CYTHON_USE_PYLONG_INTERNALS
22427             const digit* digits = ((PyLongObject*)x)->ob_digit;
22428             switch (Py_SIZE(x)) {
22429                 case  0: return (int32_t) 0;
22430                 case  1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0])
22431                 case 2:
22432                     if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
22433                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22434                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22435                         } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) {
22436                             return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
22437                         }
22438                     }
22439                     break;
22440                 case 3:
22441                     if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
22442                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22443                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22444                         } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) {
22445                             return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
22446                         }
22447                     }
22448                     break;
22449                 case 4:
22450                     if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
22451                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22452                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22453                         } else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) {
22454                             return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
22455                         }
22456                     }
22457                     break;
22458             }
22459 #endif
22460 #if CYTHON_COMPILING_IN_CPYTHON
22461             if (unlikely(Py_SIZE(x) < 0)) {
22462                 goto raise_neg_overflow;
22463             }
22464 #else
22465             {
22466                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22467                 if (unlikely(result < 0))
22468                     return (int32_t) -1;
22469                 if (unlikely(result == 1))
22470                     goto raise_neg_overflow;
22471             }
22472 #endif
22473             if (sizeof(int32_t) <= sizeof(unsigned long)) {
22474                 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
22475 #ifdef HAVE_LONG_LONG
22476             } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
22477                 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22478 #endif
22479             }
22480         } else {
22481 #if CYTHON_USE_PYLONG_INTERNALS
22482             const digit* digits = ((PyLongObject*)x)->ob_digit;
22483             switch (Py_SIZE(x)) {
22484                 case  0: return (int32_t) 0;
22485                 case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
22486                 case  1: __PYX_VERIFY_RETURN_INT(int32_t,  digit, +digits[0])
22487                 case -2:
22488                     if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) {
22489                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22490                             __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22491                         } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
22492                             return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22493                         }
22494                     }
22495                     break;
22496                 case 2:
22497                     if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
22498                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22499                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22500                         } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
22501                             return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22502                         }
22503                     }
22504                     break;
22505                 case -3:
22506                     if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
22507                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22508                             __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22509                         } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
22510                             return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22511                         }
22512                     }
22513                     break;
22514                 case 3:
22515                     if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
22516                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22517                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22518                         } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
22519                             return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22520                         }
22521                     }
22522                     break;
22523                 case -4:
22524                     if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
22525                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22526                             __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22527                         } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
22528                             return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22529                         }
22530                     }
22531                     break;
22532                 case 4:
22533                     if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
22534                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22535                             __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22536                         } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) {
22537                             return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
22538                         }
22539                     }
22540                     break;
22541             }
22542 #endif
22543             if (sizeof(int32_t) <= sizeof(long)) {
22544                 __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
22545 #ifdef HAVE_LONG_LONG
22546             } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
22547                 __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
22548 #endif
22549             }
22550         }
22551         {
22552 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
22553             PyErr_SetString(PyExc_RuntimeError,
22554                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
22555 #else
22556             int32_t val;
22557             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
22558  #if PY_MAJOR_VERSION < 3
22559             if (likely(v) && !PyLong_Check(v)) {
22560                 PyObject *tmp = v;
22561                 v = PyNumber_Long(tmp);
22562                 Py_DECREF(tmp);
22563             }
22564  #endif
22565             if (likely(v)) {
22566                 int one = 1; int is_little = (int)*(unsigned char *)&one;
22567                 unsigned char *bytes = (unsigned char *)&val;
22568                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
22569                                               bytes, sizeof(val),
22570                                               is_little, !is_unsigned);
22571                 Py_DECREF(v);
22572                 if (likely(!ret))
22573                     return val;
22574             }
22575 #endif
22576             return (int32_t) -1;
22577         }
22578     } else {
22579         int32_t val;
22580         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
22581         if (!tmp) return (int32_t) -1;
22582         val = __Pyx_PyInt_As_int32_t(tmp);
22583         Py_DECREF(tmp);
22584         return val;
22585     }
22586 raise_overflow:
22587     PyErr_SetString(PyExc_OverflowError,
22588         "value too large to convert to int32_t");
22589     return (int32_t) -1;
22590 raise_neg_overflow:
22591     PyErr_SetString(PyExc_OverflowError,
22592         "can't convert negative value to int32_t");
22593     return (int32_t) -1;
22594 }
22595 
22596 /* FastTypeChecks */
22597 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)22598 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
22599     while (a) {
22600         a = a->tp_base;
22601         if (a == b)
22602             return 1;
22603     }
22604     return b == &PyBaseObject_Type;
22605 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)22606 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
22607     PyObject *mro;
22608     if (a == b) return 1;
22609     mro = a->tp_mro;
22610     if (likely(mro)) {
22611         Py_ssize_t i, n;
22612         n = PyTuple_GET_SIZE(mro);
22613         for (i = 0; i < n; i++) {
22614             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
22615                 return 1;
22616         }
22617         return 0;
22618     }
22619     return __Pyx_InBases(a, b);
22620 }
22621 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22622 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
22623     PyObject *exception, *value, *tb;
22624     int res;
22625     __Pyx_PyThreadState_declare
22626     __Pyx_PyThreadState_assign
22627     __Pyx_ErrFetch(&exception, &value, &tb);
22628     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
22629     if (unlikely(res == -1)) {
22630         PyErr_WriteUnraisable(err);
22631         res = 0;
22632     }
22633     if (!res) {
22634         res = PyObject_IsSubclass(err, exc_type2);
22635         if (unlikely(res == -1)) {
22636             PyErr_WriteUnraisable(err);
22637             res = 0;
22638         }
22639     }
22640     __Pyx_ErrRestore(exception, value, tb);
22641     return res;
22642 }
22643 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22644 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
22645     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
22646     if (!res) {
22647         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
22648     }
22649     return res;
22650 }
22651 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)22652 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22653     Py_ssize_t i, n;
22654     assert(PyExceptionClass_Check(exc_type));
22655     n = PyTuple_GET_SIZE(tuple);
22656 #if PY_MAJOR_VERSION >= 3
22657     for (i=0; i<n; i++) {
22658         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22659     }
22660 #endif
22661     for (i=0; i<n; i++) {
22662         PyObject *t = PyTuple_GET_ITEM(tuple, i);
22663         #if PY_MAJOR_VERSION < 3
22664         if (likely(exc_type == t)) return 1;
22665         #endif
22666         if (likely(PyExceptionClass_Check(t))) {
22667             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
22668         } else {
22669         }
22670     }
22671     return 0;
22672 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)22673 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
22674     if (likely(err == exc_type)) return 1;
22675     if (likely(PyExceptionClass_Check(err))) {
22676         if (likely(PyExceptionClass_Check(exc_type))) {
22677             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
22678         } else if (likely(PyTuple_Check(exc_type))) {
22679             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
22680         } else {
22681         }
22682     }
22683     return PyErr_GivenExceptionMatches(err, exc_type);
22684 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22685 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
22686     assert(PyExceptionClass_Check(exc_type1));
22687     assert(PyExceptionClass_Check(exc_type2));
22688     if (likely(err == exc_type1 || err == exc_type2)) return 1;
22689     if (likely(PyExceptionClass_Check(err))) {
22690         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
22691     }
22692     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
22693 }
22694 #endif
22695 
22696 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)22697 static int __Pyx_check_binary_version(void) {
22698     char ctversion[4], rtversion[4];
22699     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
22700     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
22701     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
22702         char message[200];
22703         PyOS_snprintf(message, sizeof(message),
22704                       "compiletime version %s of module '%.100s' "
22705                       "does not match runtime version %s",
22706                       ctversion, __Pyx_MODULE_NAME, rtversion);
22707         return PyErr_WarnEx(NULL, message, 1);
22708     }
22709     return 0;
22710 }
22711 
22712 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)22713 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
22714     while (t->p) {
22715         #if PY_MAJOR_VERSION < 3
22716         if (t->is_unicode) {
22717             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
22718         } else if (t->intern) {
22719             *t->p = PyString_InternFromString(t->s);
22720         } else {
22721             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
22722         }
22723         #else
22724         if (t->is_unicode | t->is_str) {
22725             if (t->intern) {
22726                 *t->p = PyUnicode_InternFromString(t->s);
22727             } else if (t->encoding) {
22728                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
22729             } else {
22730                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
22731             }
22732         } else {
22733             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
22734         }
22735         #endif
22736         if (!*t->p)
22737             return -1;
22738         if (PyObject_Hash(*t->p) == -1)
22739             return -1;
22740         ++t;
22741     }
22742     return 0;
22743 }
22744 
__Pyx_PyUnicode_FromString(const char * c_str)22745 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
22746     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
22747 }
__Pyx_PyObject_AsString(PyObject * o)22748 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
22749     Py_ssize_t ignore;
22750     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
22751 }
22752 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
22753 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)22754 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
22755     char* defenc_c;
22756     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
22757     if (!defenc) return NULL;
22758     defenc_c = PyBytes_AS_STRING(defenc);
22759 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
22760     {
22761         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
22762         char* c;
22763         for (c = defenc_c; c < end; c++) {
22764             if ((unsigned char) (*c) >= 128) {
22765                 PyUnicode_AsASCIIString(o);
22766                 return NULL;
22767             }
22768         }
22769     }
22770 #endif
22771     *length = PyBytes_GET_SIZE(defenc);
22772     return defenc_c;
22773 }
22774 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)22775 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
22776     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
22777 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
22778     if (likely(PyUnicode_IS_ASCII(o))) {
22779         *length = PyUnicode_GET_LENGTH(o);
22780         return PyUnicode_AsUTF8(o);
22781     } else {
22782         PyUnicode_AsASCIIString(o);
22783         return NULL;
22784     }
22785 #else
22786     return PyUnicode_AsUTF8AndSize(o, length);
22787 #endif
22788 }
22789 #endif
22790 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)22791 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
22792 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
22793     if (
22794 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
22795             __Pyx_sys_getdefaultencoding_not_ascii &&
22796 #endif
22797             PyUnicode_Check(o)) {
22798         return __Pyx_PyUnicode_AsStringAndSize(o, length);
22799     } else
22800 #endif
22801 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
22802     if (PyByteArray_Check(o)) {
22803         *length = PyByteArray_GET_SIZE(o);
22804         return PyByteArray_AS_STRING(o);
22805     } else
22806 #endif
22807     {
22808         char* result;
22809         int r = PyBytes_AsStringAndSize(o, &result, length);
22810         if (unlikely(r < 0)) {
22811             return NULL;
22812         } else {
22813             return result;
22814         }
22815     }
22816 }
__Pyx_PyObject_IsTrue(PyObject * x)22817 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
22818    int is_true = x == Py_True;
22819    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
22820    else return PyObject_IsTrue(x);
22821 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)22822 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
22823     int retval;
22824     if (unlikely(!x)) return -1;
22825     retval = __Pyx_PyObject_IsTrue(x);
22826     Py_DECREF(x);
22827     return retval;
22828 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)22829 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
22830 #if PY_MAJOR_VERSION >= 3
22831     if (PyLong_Check(result)) {
22832         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
22833                 "__int__ returned non-int (type %.200s).  "
22834                 "The ability to return an instance of a strict subclass of int "
22835                 "is deprecated, and may be removed in a future version of Python.",
22836                 Py_TYPE(result)->tp_name)) {
22837             Py_DECREF(result);
22838             return NULL;
22839         }
22840         return result;
22841     }
22842 #endif
22843     PyErr_Format(PyExc_TypeError,
22844                  "__%.4s__ returned non-%.4s (type %.200s)",
22845                  type_name, type_name, Py_TYPE(result)->tp_name);
22846     Py_DECREF(result);
22847     return NULL;
22848 }
__Pyx_PyNumber_IntOrLong(PyObject * x)22849 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
22850 #if CYTHON_USE_TYPE_SLOTS
22851   PyNumberMethods *m;
22852 #endif
22853   const char *name = NULL;
22854   PyObject *res = NULL;
22855 #if PY_MAJOR_VERSION < 3
22856   if (likely(PyInt_Check(x) || PyLong_Check(x)))
22857 #else
22858   if (likely(PyLong_Check(x)))
22859 #endif
22860     return __Pyx_NewRef(x);
22861 #if CYTHON_USE_TYPE_SLOTS
22862   m = Py_TYPE(x)->tp_as_number;
22863   #if PY_MAJOR_VERSION < 3
22864   if (m && m->nb_int) {
22865     name = "int";
22866     res = m->nb_int(x);
22867   }
22868   else if (m && m->nb_long) {
22869     name = "long";
22870     res = m->nb_long(x);
22871   }
22872   #else
22873   if (likely(m && m->nb_int)) {
22874     name = "int";
22875     res = m->nb_int(x);
22876   }
22877   #endif
22878 #else
22879   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
22880     res = PyNumber_Int(x);
22881   }
22882 #endif
22883   if (likely(res)) {
22884 #if PY_MAJOR_VERSION < 3
22885     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
22886 #else
22887     if (unlikely(!PyLong_CheckExact(res))) {
22888 #endif
22889         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
22890     }
22891   }
22892   else if (!PyErr_Occurred()) {
22893     PyErr_SetString(PyExc_TypeError,
22894                     "an integer is required");
22895   }
22896   return res;
22897 }
22898 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
22899   Py_ssize_t ival;
22900   PyObject *x;
22901 #if PY_MAJOR_VERSION < 3
22902   if (likely(PyInt_CheckExact(b))) {
22903     if (sizeof(Py_ssize_t) >= sizeof(long))
22904         return PyInt_AS_LONG(b);
22905     else
22906         return PyInt_AsSsize_t(b);
22907   }
22908 #endif
22909   if (likely(PyLong_CheckExact(b))) {
22910     #if CYTHON_USE_PYLONG_INTERNALS
22911     const digit* digits = ((PyLongObject*)b)->ob_digit;
22912     const Py_ssize_t size = Py_SIZE(b);
22913     if (likely(__Pyx_sst_abs(size) <= 1)) {
22914         ival = likely(size) ? digits[0] : 0;
22915         if (size == -1) ival = -ival;
22916         return ival;
22917     } else {
22918       switch (size) {
22919          case 2:
22920            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
22921              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22922            }
22923            break;
22924          case -2:
22925            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
22926              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22927            }
22928            break;
22929          case 3:
22930            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
22931              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22932            }
22933            break;
22934          case -3:
22935            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
22936              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22937            }
22938            break;
22939          case 4:
22940            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
22941              return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22942            }
22943            break;
22944          case -4:
22945            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
22946              return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
22947            }
22948            break;
22949       }
22950     }
22951     #endif
22952     return PyLong_AsSsize_t(b);
22953   }
22954   x = PyNumber_Index(b);
22955   if (!x) return -1;
22956   ival = PyInt_AsSsize_t(x);
22957   Py_DECREF(x);
22958   return ival;
22959 }
22960 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
22961   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
22962 }
22963 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
22964     return PyInt_FromSize_t(ival);
22965 }
22966 
22967 
22968 #endif /* Py_PYTHON_H */
22969