/* Generated by Cython 3.2.4 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "_FILE_OFFSET_BITS",
                "64"
            ],
            [
                "USE_MEMRAY_TLS_MODEL",
                "1"
            ]
        ],
        "depends": [
            "src/memray/_memray/compat.h",
            "src/memray/_memray/hooks.h",
            "src/memray/_memray/logging.h",
            "src/memray/_memray/native_resolver.h",
            "src/memray/_memray/record_reader.h",
            "src/memray/_memray/record_writer.h",
            "src/memray/_memray/records.h",
            "src/memray/_memray/sink.h",
            "src/memray/_memray/snapshot.h",
            "src/memray/_memray/socket_reader_thread.h",
            "src/memray/_memray/source.h",
            "src/memray/_memray/tracking_api.h"
        ],
        "extra_compile_args": [
            "-std=c++17",
            "-Wall",
            "-flto",
            "-fvisibility=hidden"
        ],
        "extra_link_args": [
            "-std=c++17",
            "-flto"
        ],
        "extra_objects": [
            "/build/memray/src/memray/src/vendor/libbacktrace/install/lib/libbacktrace.a"
        ],
        "include_dirs": [
            "src/memray/_memray",
            "src",
            "/build/memray/src/memray/src/vendor/libbacktrace/install/include"
        ],
        "language": "c++",
        "libraries": [
            "lz4",
            "unwind",
            "debuginfod",
            "dl"
        ],
        "name": "memray._memray",
        "sources": [
            "src/memray/_memray.pyx",
            "src/memray/_memray/compat.cpp",
            "src/memray/_memray/hooks.cpp",
            "src/memray/_memray/tracking_api.cpp",
            "src/memray/_memray/elf_shenanigans.cpp",
            "src/memray/_memray/logging.cpp",
            "src/memray/_memray/python_helpers.cpp",
            "src/memray/_memray/source.cpp",
            "src/memray/_memray/sink.cpp",
            "src/memray/_memray/records.cpp",
            "src/memray/_memray/record_reader.cpp",
            "src/memray/_memray/record_writer.cpp",
            "src/memray/_memray/snapshot.cpp",
            "src/memray/_memray/socket_reader_thread.cpp",
            "src/memray/_memray/native_resolver.cpp"
        ]
    },
    "module_name": "memray._memray"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_4"
#define CYTHON_HEX_VERSION 0x030204F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CppInitCode */
#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
    template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
    template<typename U> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
    template<typename U> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
  private:
    T *ptr;
};

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
    #define __PYX_EXTERN_C extern "C++"
#endif

#define __PYX_HAVE__memray___memray
#define __PYX_HAVE_API__memray___memray
/* Early includes */
#include <sys/types.h>
#include <signal.h>
#include <sys/time.h>
#include "hooks.h"
#include <stdint.h>
#include <string.h>
#include <string_view>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <string>
#include <vector>
#include "records.h"
#include <optional>
#include <algorithm>
#include "logging.h"
#include "native_resolver.h"
#include "source.h"
#include <memory>
#include "record_reader.h"
#include "sink.h"
#include <utility>

    #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
    // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include "compat.h"
#include "record_writer.h"
#include <functional>
#include <unordered_map>
#include "snapshot.h"

    std::vector<memray::tracking_api::AggregatedAllocation>
    collectAllocations(const memray::api::HighWaterMarkAggregator& aggregator)
    {
        std::vector<memray::tracking_api::AggregatedAllocation> ret;
        aggregator.visitAllocations([&](const memray::tracking_api::AggregatedAllocation& agg) {
            if (agg.n_allocations_in_high_water_mark || agg.n_allocations_leaked) {
                ret.push_back(agg);
            }
            return true;
        });
        return ret;
    }
    
#include "socket_reader_thread.h"
#include <stdio.h>

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE PyObject *
    __Pyx_CAPI_PyList_GetItemRef(PyObject *list, Py_ssize_t index)
    {
        PyObject *item = PyList_GetItem(list, index);
        Py_XINCREF(item);
        return item;
    }
    #else
    #define __Pyx_CAPI_PyList_GetItemRef PyList_GetItemRef
    #endif

    #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Extend(PyObject *list, PyObject *iterable)
    {
        return PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable);
    }

    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Clear(PyObject *list)
    {
        return PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL);
    }
    #else
    #define __Pyx_CAPI_PyList_Extend PyList_Extend
    #define __Pyx_CAPI_PyList_Clear PyList_Clear
    #endif
    

    #if PY_MAJOR_VERSION >= 3
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj)
    #else
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj, NULL)
    #endif
    
#include <stddef.h>

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result)
    {
        int res;
        PyObject *key_obj = PyUnicode_FromString(key);
        if (key_obj == NULL) {
            *result = NULL;
            return -1;
        }
        res = __Pyx_PyDict_GetItemRef(mp, key_obj, result);
        Py_DECREF(key_obj);
        return res;
    }
    #else
    #define __Pyx_CAPI_PyDict_GetItemStringRef PyDict_GetItemStringRef
    #endif
    #if PY_VERSION_HEX < 0x030d0000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030F0000)
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_SetDefaultRef(PyObject *d, PyObject *key, PyObject *default_value,
                        PyObject **result)
    {
        PyObject *value;
        if (__Pyx_PyDict_GetItemRef(d, key, &value) < 0) {
            // get error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (value != NULL) {
            // present
            if (result) {
                *result = value;
            }
            else {
                Py_DECREF(value);
            }
            return 1;
        }

        // missing: set the item
        if (PyDict_SetItem(d, key, default_value) < 0) {
            // set error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (result) {
            Py_INCREF(default_value);
            *result = default_value;
        }
        return 0;
    }
    #else
    #define __Pyx_CAPI_PyDict_SetDefaultRef PyDict_SetDefaultRef
    #endif
    

    #if PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int __Pyx_PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
    {
        PyObject *obj = PyWeakref_GetObject(ref);
        if (obj == NULL) {
            // SystemError if ref is NULL
            *pobj = NULL;
            return -1;
        }
        if (obj == Py_None) {
            *pobj = NULL;
            return 0;
        }
        Py_INCREF(obj);
        *pobj = obj;
        return 1;
    }
    #else
    #define __Pyx_PyWeakref_GetRef PyWeakref_GetRef
    #endif
    
#include "pythread.h"

    #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600) && !defined(PyContextVar_Get)
    #define PyContextVar_Get(var, d, v)         ((d) ?             ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) :             ((v)[0] = NULL, 0)         )
    #endif
    
#include <unordered_set>
#include "tracking_api.h"
#include <math.h>
#include <limits>
#include <dlfcn.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 1
#define __Pyx_PyObject_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "src/memray/_memray.pyx",
  "cfunc.to_py",
  "cpython/contextvars.pxd",
  "cpython/type.pxd",
  "cpython/bool.pxd",
  "cpython/complex.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by CythonFunctionShared) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* #### Code section: numeric_typedefs ### */
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_6memray_7_memray_AllocationRecord;
struct __pyx_obj_6memray_7_memray_TrackedObjectRecord;
struct __pyx_obj_6memray_7_memray_Interval;
struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord;
struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator;
struct __pyx_obj_6memray_7_memray_Tracker;
struct __pyx_obj_6memray_7_memray_ProgressIndicator;
struct __pyx_obj_6memray_7_memray_FileReader;
struct __pyx_obj_6memray_7_memray_SocketReader;
struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness;
struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness;
struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations;
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations;
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_;
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0;
struct __pyx_opt_args_7cpython_11contextvars_get_value;
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;

/* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value {
  int __pyx_n;
  PyObject *default_value;
};

/* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
  int __pyx_n;
  PyObject *default_value;
};
struct __pyx_opt_args_6memray_7_memray_stack_trace;
struct __pyx_opt_args_6memray_7_memray_native_stack_trace;
struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace;

/* "memray/_memray.pyx":115
 * 
 * 
 * cpdef enum AllocatorType:             # <<<<<<<<<<<<<<
 *     PYMALLOC_FREE = 1
 *     PYMALLOC_MALLOC = 2
*/
enum __pyx_t_6memray_7_memray_AllocatorType {
  __pyx_e_6memray_7_memray_PYMALLOC_FREE = 1,
  __pyx_e_6memray_7_memray_PYMALLOC_MALLOC = 2,
  __pyx_e_6memray_7_memray_PYMALLOC_CALLOC = 3,
  __pyx_e_6memray_7_memray_PYMALLOC_REALLOC = 4,
  __pyx_e_6memray_7_memray_FREE = 5,
  __pyx_e_6memray_7_memray_MALLOC = 6,
  __pyx_e_6memray_7_memray_REALLOC = 7,
  __pyx_e_6memray_7_memray_CALLOC = 8,
  __pyx_e_6memray_7_memray_POSIX_MEMALIGN = 9,
  __pyx_e_6memray_7_memray_ALIGNED_ALLOC = 10,
  __pyx_e_6memray_7_memray_MEMALIGN = 11,
  __pyx_e_6memray_7_memray_VALLOC = 12,
  __pyx_e_6memray_7_memray_PVALLOC = 13,
  __pyx_e_6memray_7_memray_MMAP = 14,
  __pyx_e_6memray_7_memray_MUNMAP = 15
};

/* "memray/_memray.pyx":134
 * # Note: enumerator values are negative because they must be unique
 * #       from the enumerator values of the AllocatorType enum above
 * cpdef enum ObjectTrackingEvent:             # <<<<<<<<<<<<<<
 *     OBJECT_CREATED = -1
 *     OBJECT_DESTROYED = -2
*/
enum __pyx_t_6memray_7_memray_ObjectTrackingEvent {
  __pyx_e_6memray_7_memray_OBJECT_CREATED = -1L,
  __pyx_e_6memray_7_memray_OBJECT_DESTROYED = -2L
};

/* "memray/_memray.pyx":138
 *     OBJECT_DESTROYED = -2
 * 
 * cpdef enum PythonAllocatorType:             # <<<<<<<<<<<<<<
 *     PYTHON_ALLOCATOR_PYMALLOC = 1
 *     PYTHON_ALLOCATOR_PYMALLOC_DEBUG = 2
*/
enum __pyx_t_6memray_7_memray_PythonAllocatorType {
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC = 1,
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC_DEBUG = 2,
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MALLOC = 3,
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_OTHER = 4,
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC = 5,
  __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC_DEBUG = 6
};

/* "memray/_memray.pyx":146
 *     PYTHON_ALLOCATOR_MIMALLOC_DEBUG = 6
 * 
 * cpdef enum FileFormat:             # <<<<<<<<<<<<<<
 *     ALL_ALLOCATIONS = _FileFormat.ALL_ALLOCATIONS
 *     AGGREGATED_ALLOCATIONS = _FileFormat.AGGREGATED_ALLOCATIONS
*/
enum __pyx_t_6memray_7_memray_FileFormat {

  /* "memray/_memray.pyx":148
 * cpdef enum FileFormat:
 *     ALL_ALLOCATIONS = _FileFormat.ALL_ALLOCATIONS
 *     AGGREGATED_ALLOCATIONS = _FileFormat.AGGREGATED_ALLOCATIONS             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_e_6memray_7_memray_ALL_ALLOCATIONS = memray::tracking_api::FileFormat::ALL_ALLOCATIONS,
  __pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS = memray::tracking_api::FileFormat::AGGREGATED_ALLOCATIONS
};

/* "memray/_memray.pyx":1659
 *             yield alloc
 * 
 * cpdef enum SymbolicSupport:             # <<<<<<<<<<<<<<
 *     NONE = 1
 *     FUNCTION_NAME_ONLY = 2
*/
enum __pyx_t_6memray_7_memray_SymbolicSupport {
  __pyx_e_6memray_7_memray_NONE = 1,
  __pyx_e_6memray_7_memray_FUNCTION_NAME_ONLY = 2,
  __pyx_e_6memray_7_memray_TOTAL = 3
};

/* "memray/_memray.pyx":160
 * # Memray core
 * 
 * cdef stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/
struct __pyx_opt_args_6memray_7_memray_stack_trace {
  int __pyx_n;
  PyObject *max_stacks;
};

/* "memray/_memray.pyx":185
 * 
 * 
 * cdef native_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     allocator,
*/
struct __pyx_opt_args_6memray_7_memray_native_stack_trace {
  int __pyx_n;
  PyObject *max_stacks;
};

/* "memray/_memray.pyx":201
 * 
 * 
 * cdef hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/
struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace {
  int __pyx_n;
  PyObject *max_stacks;
};

/* "memray/_memray.pyx":289
 * 
 * 
 * @cython.freelist(1024)             # <<<<<<<<<<<<<<
 * cdef class AllocationRecord:
 *     cdef object _tuple
*/
struct __pyx_obj_6memray_7_memray_AllocationRecord {
  PyObject_HEAD
  PyObject *_tuple;
  PyObject *_stack_trace_cache;
  std::shared_ptr<memray::api::RecordReader>  _reader;
};


/* "memray/_memray.pyx":392
 * 
 * 
 * @cython.freelist(1024)             # <<<<<<<<<<<<<<
 * cdef class TrackedObjectRecord:
 *     cdef object _tuple
*/
struct __pyx_obj_6memray_7_memray_TrackedObjectRecord {
  PyObject_HEAD
  PyObject *_tuple;
  PyObject *_stack_trace_cache;
  std::shared_ptr<memray::api::RecordReader>  _reader;
};


/* "memray/_memray.pyx":494
 * 
 * 
 * @cython.freelist(1024)             # <<<<<<<<<<<<<<
 * cdef class Interval:
 *     cdef public size_t allocated_before_snapshot
*/
struct __pyx_obj_6memray_7_memray_Interval {
  PyObject_HEAD
  size_t allocated_before_snapshot;
  PyObject *deallocated_before_snapshot;
  size_t n_allocations;
  size_t n_bytes;
};


/* "memray/_memray.pyx":537
 * 
 * 
 * @cython.freelist(1024)             # <<<<<<<<<<<<<<
 * cdef class TemporalAllocationRecord:
 *     cdef object _tuple
*/
struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord {
  PyObject_HEAD
  PyObject *_tuple;
  PyObject *_stack_trace_cache;
  std::shared_ptr<memray::api::RecordReader>  _reader;
  PyObject *intervals;
};


/* "memray/_memray.pyx":638
 * 
 * 
 * cdef class TemporalAllocationGenerator:             # <<<<<<<<<<<<<<
 *     cdef vector[AllocationLifetime] lifetimes
 *     cdef shared_ptr[RecordReader] reader
*/
struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *__pyx_vtab;
  std::vector<memray::api::AllocationLifetime>  lifetimes;
  std::shared_ptr<memray::api::RecordReader>  reader;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *curr_record;
  memray::api::HighWaterMarkLocationKey last_key;
  size_t idx;
};


/* "memray/_memray.pyx":701
 * 
 * 
 * cdef class Tracker:             # <<<<<<<<<<<<<<
 *     """Context manager for tracking memory allocations in a Python script.
 * 
*/
struct __pyx_obj_6memray_7_memray_Tracker {
  PyObject_HEAD
  struct __pyx_vtabstruct_6memray_7_memray_Tracker *__pyx_vtab;
  bool _native_traces;
  bool _track_object_lifetimes;
  unsigned int _memory_interval_ms;
  bool _follow_fork;
  bool _trace_python_allocators;
  PyObject *_previous_profile_func;
  PyObject *_previous_thread_profile_func;
  std::unique_ptr<memray::tracking_api::RecordWriter>  _writer;
  PyObject *_surviving_objects;
};


/* "memray/_memray.pyx":963
 * 
 * 
 * cdef class ProgressIndicator:             # <<<<<<<<<<<<<<
 *     cdef bool _report_progress
 *     cdef object _indicator
*/
struct __pyx_obj_6memray_7_memray_ProgressIndicator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *__pyx_vtab;
  bool _report_progress;
  PyObject *_indicator;
  PyObject *_context_manager;
  PyObject *_task;
  PyObject *_task_description;
  PyObject *_total;
  size_t _cumulative_num_processed;
  size_t _update_interval;
  size_t _ns_between_refreshes;
  struct timespec _next_refresh;
};


/* "memray/_memray.pyx":1053
 * 
 * 
 * cdef class FileReader:             # <<<<<<<<<<<<<<
 *     cdef cppstring _path
 * 
*/
struct __pyx_obj_6memray_7_memray_FileReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_6memray_7_memray_FileReader *__pyx_vtab;
  std::string _path;
  PyObject *_file;
  std::vector<struct memray::tracking_api::MemorySnapshot>  _memory_snapshots;
  struct memray::api::HighWatermark _high_watermark;
  PyObject *_header;
  bool _report_progress;
  size_t _memory_snapshot_stride;
};


/* "memray/_memray.pyx":1575
 * 
 * 
 * cdef class SocketReader:             # <<<<<<<<<<<<<<
 *     cdef BackgroundSocketReader* _impl
 *     cdef shared_ptr[RecordReader] _reader
*/
struct __pyx_obj_6memray_7_memray_SocketReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_6memray_7_memray_SocketReader *__pyx_vtab;
  memray::socket_thread::BackgroundSocketReader *_impl;
  std::shared_ptr<memray::api::RecordReader>  _reader;
  PyObject *_header;
  PyObject *_port;
};


/* "memray/_memray.pyx":1717
 * 
 * 
 * cdef class HighWaterMarkAggregatorTestHarness:             # <<<<<<<<<<<<<<
 *     cdef HighWaterMarkAggregator aggregator
 * 
*/
struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness {
  PyObject_HEAD
  memray::api::HighWaterMarkAggregator aggregator;
};


/* "memray/_memray.pyx":1775
 * 
 * 
 * cdef class AllocationLifetimeAggregatorTestHarness:             # <<<<<<<<<<<<<<
 *     cdef AllocationLifetimeAggregator aggregator
 * 
*/
struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness {
  PyObject_HEAD
  memray::api::AllocationLifetimeAggregator aggregator;
};


/* "memray/_memray.pyx":1809
 * 
 * 
 * cdef class RecordWriterTestHarness:             # <<<<<<<<<<<<<<
 *     """A Python wrapper around the C++ RecordWriter class for testing purposes."""
 * 
*/
struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness {
  PyObject_HEAD
  std::unique_ptr<memray::tracking_api::RecordWriter>  _writer;
};


/* "memray/_memray.pyx":824
 *         )
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ {
  PyObject_HEAD
  PyObject *__pyx_v_orig_set_os_name;
};


/* "memray/_memray.pyx":1158
 *         self.close()
 * 
 *     def _reaggregate_allocations(             # <<<<<<<<<<<<<<
 *         self, size_t records_to_process, bool merge_threads, bool leaks
 *     ):
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations {
  PyObject_HEAD
  memray::api::AggregatedCaptureReaggregator __pyx_v_aggregator;
  struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_alloc;
  PyObject *__pyx_v_elem;
  bool __pyx_v_leaks;
  bool __pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator;
  memray::api::RecordReader *__pyx_v_reader;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  memray::tracking_api::AggregatedAllocation __pyx_v_record;
  size_t __pyx_v_records_to_process;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "memray/_memray.pyx":1207
 *         reader.close()
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,             # <<<<<<<<<<<<<<
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations {
  PyObject_HEAD
  memray::api::AbstractAggregator *__pyx_v_aggregator;
  struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_alloc;
  PyObject *__pyx_v_elem;
  bool __pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator;
  memray::api::RecordReader *__pyx_v_reader;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  size_t __pyx_v_records_to_process;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
  size_t __pyx_v_temporary_buffer_size;
  std::unique_ptr<memray::api::AbstractAggregator>  __pyx_v_the_aggregator;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "memray/_memray.pyx":1253
 *         reader.close()
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records {
  PyObject_HEAD
  size_t __pyx_v_max_records;
  PyObject *__pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
};


/* "memray/_memray.pyx":1267
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records {
  PyObject_HEAD
  size_t __pyx_v_max_records;
  PyObject *__pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
};


/* "memray/_memray.pyx":1280
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records {
  PyObject_HEAD
  size_t __pyx_v_max_records;
  PyObject *__pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
  PyObject *__pyx_v_threshold;
};


/* "memray/_memray.pyx":1294
 *         )
 * 
 *     def get_temporal_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records {
  PyObject_HEAD
  memray::api::AllocationLifetimeAggregator __pyx_v_aggregator;
  memray::tracking_api::Allocation __pyx_v_allocation;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_gen;
  size_t __pyx_v_memory_records_seen;
  PyObject *__pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator;
  memray::api::RecordReader *__pyx_v_reader;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  size_t __pyx_v_records_to_process;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
};


/* "memray/_memray.pyx":1391
 *         return gen, hwm_by_snapshot
 * 
 *     def get_allocation_records(self):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records {
  PyObject_HEAD
  struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_alloc;
  memray::api::RecordReader *__pyx_v_reader;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
};


/* "memray/_memray.pyx":1419
 *         reader.close()
 * 
 *     def get_memory_snapshots(self):             # <<<<<<<<<<<<<<
 *         for record in self._memory_snapshots:
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots {
  PyObject_HEAD
  struct memray::tracking_api::MemorySnapshot __pyx_v_record;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
  std::vector<struct memray::tracking_api::MemorySnapshot> ::iterator __pyx_t_0;
};


/* "memray/_memray.pyx":1423
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
 *     def get_object_lifetime_events(self, included_objects=None):             # <<<<<<<<<<<<<<
 *         """Return all object lifetime events recorded in the file.
 * 
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events {
  PyObject_HEAD
  PyObject *__pyx_v_header;
  PyObject *__pyx_v_included_objects;
  PyObject *__pyx_7genexpr__pyx_v_obj;
  PyObject *__pyx_v_object_ids;
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_object_record;
  memray::api::RecordReader *__pyx_v_reader;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self;
  memray::tracking_api::TrackedObject __pyx_v_tracked_object;
};


/* "memray/_memray.pyx":1649
 *         return self._header["native_traces"]
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):             # <<<<<<<<<<<<<<
 *         if self._impl is NULL:
 *             return
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot {
  PyObject_HEAD
  struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_alloc;
  PyObject *__pyx_v_elem;
  bool __pyx_v_merge_threads;
  struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self;
  PyObject *__pyx_v_snapshot_allocations;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "memray/_memray.pyx":1750
 *         return self.aggregator.getCurrentHeapSize()
 * 
 *     def get_temporal_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations {
  PyObject_HEAD
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_gen;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader;
  struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self;
};


/* "memray/_memray.pyx":1802
 *         return self.aggregator.captureSnapshot()
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations {
  PyObject_HEAD
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_gen;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader;
  struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self;
};


/* "cfunc.to_py":65
 * 
 * 
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")             # <<<<<<<<<<<<<<
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():
*/
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ {
  PyObject_HEAD
  void (*__pyx_v_f)(void);
};

struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 {
  PyObject_HEAD
  void (*__pyx_v_f)(uint64_t, char const *);
};



/* "memray/_memray.pyx":638
 * 
 * 
 * cdef class TemporalAllocationGenerator:             # <<<<<<<<<<<<<<
 *     cdef vector[AllocationLifetime] lifetimes
 *     cdef shared_ptr[RecordReader] reader
*/

struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator {
  PyObject *(*setup)(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *, std::vector<memray::api::AllocationLifetime>  &&, std::shared_ptr<memray::api::RecordReader> );
};
static struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *__pyx_vtabptr_6memray_7_memray_TemporalAllocationGenerator;


/* "memray/_memray.pyx":701
 * 
 * 
 * cdef class Tracker:             # <<<<<<<<<<<<<<
 *     """Context manager for tracking memory allocations in a Python script.
 * 
*/

struct __pyx_vtabstruct_6memray_7_memray_Tracker {
  std::unique_ptr<memray::io::Sink>  (*_make_writer)(struct __pyx_obj_6memray_7_memray_Tracker *, PyObject *);
  void (*_populate_surviving_objects)(struct __pyx_obj_6memray_7_memray_Tracker *);
};
static struct __pyx_vtabstruct_6memray_7_memray_Tracker *__pyx_vtabptr_6memray_7_memray_Tracker;


/* "memray/_memray.pyx":963
 * 
 * 
 * cdef class ProgressIndicator:             # <<<<<<<<<<<<<<
 *     cdef bool _report_progress
 *     cdef object _indicator
*/

struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator {
  bool (*_time_for_refresh)(struct __pyx_obj_6memray_7_memray_ProgressIndicator *);
  PyObject *(*update)(struct __pyx_obj_6memray_7_memray_ProgressIndicator *, size_t);
};
static struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *__pyx_vtabptr_6memray_7_memray_ProgressIndicator;


/* "memray/_memray.pyx":1053
 * 
 * 
 * cdef class FileReader:             # <<<<<<<<<<<<<<
 *     cdef cppstring _path
 * 
*/

struct __pyx_vtabstruct_6memray_7_memray_FileReader {
  PyObject *(*close)(struct __pyx_obj_6memray_7_memray_FileReader *, int __pyx_skip_dispatch);
  void (*_ensure_not_closed)(struct __pyx_obj_6memray_7_memray_FileReader *);
};
static struct __pyx_vtabstruct_6memray_7_memray_FileReader *__pyx_vtabptr_6memray_7_memray_FileReader;


/* "memray/_memray.pyx":1575
 * 
 * 
 * cdef class SocketReader:             # <<<<<<<<<<<<<<
 *     cdef BackgroundSocketReader* _impl
 *     cdef shared_ptr[RecordReader] _reader
*/

struct __pyx_vtabstruct_6memray_7_memray_SocketReader {
  PyObject *(*_teardown)(struct __pyx_obj_6memray_7_memray_SocketReader *);
  std::unique_ptr<memray::io::SocketSource>  (*_make_source)(struct __pyx_obj_6memray_7_memray_SocketReader *);
};
static struct __pyx_vtabstruct_6memray_7_memray_SocketReader *__pyx_vtabptr_6memray_7_memray_SocketReader;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_XINCREF(r)  do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

/* BytesEquals.proto (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* dict_setdefault.proto (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto (used by FetchCommonType) */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* CallTypeTraverse.proto (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* PyObjectCall.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywordsImpl.export */
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name
);
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* DictGetItem.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyKeyError_Check.proto */
#define __Pyx_PyExc_KeyError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_KeyError)

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

/* RaiseException.export */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* MoveIfSupported.proto */
#if CYTHON_USE_CPP_STD_MOVE
  #include <utility>
  #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
#else
  #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
#endif

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* JoinPyUnicode.export */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyNotImplementedError_Check.proto */
#define __Pyx_PyExc_NotImplementedError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_NotImplementedError)

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __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, int wraparound);

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyNumber_Hex.proto */
#define __Pyx_PyNumber_Hex(obj) PyNumber_ToBase((obj), 16)

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* RejectKeywords.export */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

/* PyTypeError_Check.proto */
#define __Pyx_PyExc_TypeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_TypeError)

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_size_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_size_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_size_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char);

/* ListAppend.proto (used by append) */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

/* PyObjectCallMethod1.proto (used by append) */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyOSError_Check.proto */
#define __Pyx_PyExc_OSError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_OSError)

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyRuntimeError_Check.proto */
#define __Pyx_PyExc_RuntimeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_RuntimeError)

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __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, int wraparound);

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* RaiseClosureNameError.proto */
static void __Pyx_RaiseClosureNameError(const char *varname);

/* HasAttr.proto */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* PyObjectDelAttr.proto */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL)
#else
#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n)
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_MultiplyObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2))
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_RemainderObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
#endif

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

/* ArgTypeTestFunc.export */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* IterNextPlain.proto (used by CoroutineBase) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* PyObjectCallNoArg.proto (used by CoroutineBase) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

/* Generator.proto (used by GeneratorYieldFrom) */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* GeneratorYieldFrom.proto */
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval);

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* pyfrozenset_new.proto (used by PySetContains) */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* IterFinish.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectCallMethod0.proto (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto (used by UnpackTuple2) */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto (used by UnpackItemEndCheck) */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto (used by UnpackTupleError) */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyIOError_Check.proto */
#define __Pyx_PyExc_IOError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_IOError)

/* pyint_simplify.proto */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);

/* RaiseKeywordRequired.proto */
static void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name);

/* ImportImpl.export */
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* DefaultPlacementNew.proto */
#include <new>
template<typename T>
void __Pyx_default_placement_construct(T* x) {
    new (static_cast<void*>(x)) T();
}

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* DelItemOnTypeDict.proto (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_4
#define __PYX_HAVE_RT_ImportType_proto_3_2_4
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_4(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_4 {
   __Pyx_ImportType_CheckSize_Error_3_2_4 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_4 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_4 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size);
#endif

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* ListPack.proto */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);

/* GetAttr.proto (used by Globals) */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* Globals.proto */
static PyObject* __Pyx_Globals(void);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   __Pyx_PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_TrackerStats(struct memray::tracking_api::TrackerStats s);
static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(struct memray::tracking_api::HeaderRecord s);
static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(struct memray::tracking_api::MemorySnapshot s);
/* LengthHint.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_PyObject_LengthHint(o, defaultval)  (defaultval)
#else
#define __Pyx_PyObject_LengthHint(o, defaultval)  PyObject_LengthHint(o, defaultval)
#endif

static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(struct memray::tracking_api::Segment s);
/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_6memray_7_memray_FileFormat __Pyx_PyLong_As_enum____pyx_t_6memray_7_memray_FileFormat(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_PY_LONG_LONG(PY_LONG_LONG value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum memray::tracking_api::FileFormat __Pyx_PyLong_As_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE memray::tracking_api::thread_id_t __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned char __Pyx_PyLong_As_unsigned_char(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_char(unsigned char value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(enum memray::tracking_api::FileFormat value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_memray_3a__3a_tracking_api_3a__3a_thread_id_t(memray::tracking_api::thread_id_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(enum __pyx_t_6memray_7_memray_AllocatorType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(enum __pyx_t_6memray_7_memray_FileFormat value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(enum __pyx_t_6memray_7_memray_PythonAllocatorType value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(enum __pyx_t_6memray_7_memray_SymbolicSupport value);

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
#endif
static PyObject *__pyx_f_6memray_7_memray_27TemporalAllocationGenerator_setup(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self, std::vector<memray::api::AllocationLifetime>  &&__pyx_v_lifetimes, std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader); /* proto*/
static std::unique_ptr<memray::io::Sink>  __pyx_f_6memray_7_memray_7Tracker__make_writer(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, PyObject *__pyx_v_destination); /* proto*/
static void __pyx_f_6memray_7_memray_7Tracker__populate_surviving_objects(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self); /* proto*/
static bool __pyx_f_6memray_7_memray_17ProgressIndicator__time_for_refresh(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_6memray_7_memray_17ProgressIndicator_update(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, size_t __pyx_v_n_processed); /* proto*/
static PyObject *__pyx_f_6memray_7_memray_10FileReader_close(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_6memray_7_memray_10FileReader__ensure_not_closed(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_6memray_7_memray_12SocketReader__teardown(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto*/
static std::unique_ptr<memray::io::SocketSource>  __pyx_f_6memray_7_memray_12SocketReader__make_source(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto*/

/* Module declarations from "cython" */

/* Module declarations from "posix.types" */

/* Module declarations from "posix.signal" */

/* Module declarations from "posix.time" */

/* Module declarations from "_memray" */

/* Module declarations from "libcpp" */

/* Module declarations from "_memray.hooks" */

/* Module declarations from "libc.stdint" */

/* Module declarations from "libc.string" */

/* Module declarations from "libcpp.string_view" */

/* Module declarations from "libcpp.string" */

/* Module declarations from "libcpp.vector" */

/* Module declarations from "_memray.records" */

/* Module declarations from "_memray.algorithm" */

/* Module declarations from "_memray.logging" */

/* Module declarations from "_memray.native_resolver" */

/* Module declarations from "_memray.source" */

/* Module declarations from "libcpp.memory" */

/* Module declarations from "_memray.record_reader" */

/* Module declarations from "_memray.sink" */

/* Module declarations from "libcpp.utility" */

/* Module declarations from "_memray.record_writer" */

/* Module declarations from "libcpp.functional" */

/* Module declarations from "libcpp.unordered_map" */

/* Module declarations from "_memray.snapshot" */

/* Module declarations from "_memray.socket_reader_thread" */

/* Module declarations from "cpython.version" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "libc.stdio" */

/* Module declarations from "cpython.object" */

/* Module declarations from "cpython.ref" */

/* Module declarations from "cpython.exc" */

/* Module declarations from "cpython.module" */

/* Module declarations from "cpython.mem" */

/* Module declarations from "cpython.tuple" */

/* Module declarations from "cpython.list" */

/* Module declarations from "cpython.sequence" */

/* Module declarations from "cpython.mapping" */

/* Module declarations from "cpython.iterator" */

/* Module declarations from "cpython.number" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.bool" */

/* Module declarations from "cpython.long" */

/* Module declarations from "cpython.float" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.complex" */

/* Module declarations from "libc.stddef" */

/* Module declarations from "cpython.unicode" */

/* Module declarations from "cpython.pyport" */

/* Module declarations from "cpython.dict" */

/* Module declarations from "cpython.instance" */

/* Module declarations from "cpython.function" */

/* Module declarations from "cpython.method" */

/* Module declarations from "cpython.weakref" */

/* Module declarations from "cpython.getargs" */

/* Module declarations from "cpython.pythread" */

/* Module declarations from "cpython.pystate" */

/* Module declarations from "cpython.set" */

/* Module declarations from "cpython.buffer" */

/* Module declarations from "cpython.bytes" */

/* Module declarations from "cpython.pycapsule" */

/* Module declarations from "cpython.contextvars" */

/* Module declarations from "cpython" */

/* Module declarations from "libcpp.unordered_set" */

/* Module declarations from "_memray.tracking_api" */

/* Module declarations from "libc.math" */

/* Module declarations from "libcpp.limits" */

/* Module declarations from "memray._memray" */
static PyObject *__Pyx_EnumBase = 0;
static PyObject *__Pyx_FlagBase = 0;
static PyObject *__pyx_f_6memray_7_memray_stack_trace(memray::api::RecordReader *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_6memray_7_memray_stack_trace *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_6memray_7_memray_native_stack_trace(memray::api::RecordReader *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_6memray_7_memray_native_stack_trace *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_6memray_7_memray_hybrid_stack_trace(memray::api::RecordReader *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_6memray_7_memray_create_temporal_allocation_record(memray::api::HighWaterMarkLocationKey const &, std::shared_ptr<memray::api::RecordReader> ); /*proto*/
static PyObject *__pyx_f_6memray_7_memray_millis_to_dt(PyObject *); /*proto*/
static PyObject *__pyx_f_6memray_7_memray__create_metadata(PyObject *, PyObject *); /*proto*/
static PyObject *__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*)(void)); /*proto*/
static PyObject *__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_AllocatorType); /*proto*/
static PyObject *__Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
static std::string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(PyObject *); /*proto*/
static PyObject *__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*)(uint64_t, char const *)); /*proto*/
static PyObject *__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_PythonAllocatorType); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(std::vector<struct memray::tracking_api::MemorySnapshot>  const &); /*proto*/
static struct memray::tracking_api::MemorySnapshot __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(PyObject *); /*proto*/
static PyObject *__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(enum __pyx_t_6memray_7_memray_FileFormat); /*proto*/
static PyObject *__pyx_convert_vector_to_py_size_t(std::vector<size_t>  const &); /*proto*/
static PyObject *__pyx_convert_unordered_map_to_py_int____uint64_t(std::unordered_map<int,uint64_t>  const &); /*proto*/
static PyObject *__pyx_convert_unordered_map_to_py_size_t____uint64_t(std::unordered_map<size_t,uint64_t>  const &); /*proto*/
static PyObject *__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_SymbolicSupport); /*proto*/
static struct memray::tracking_api::Segment __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(PyObject *); /*proto*/
static struct memray::tracking_api::ImageSegments __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(std::vector<struct memray::tracking_api::Segment>  const &); /*proto*/
static std::vector<struct memray::tracking_api::MemorySnapshot>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(PyObject *); /*proto*/
static std::vector<struct memray::tracking_api::Segment>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(PyObject *); /*proto*/
static std::vector<struct memray::tracking_api::ImageSegments>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "memray._memray"
extern int __pyx_module_is_main_memray___memray;
int __pyx_module_is_main_memray___memray = 0;

/* Implementation of "memray._memray" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_id;
/* #### Code section: string_decls ### */
static const char __pyx_k_a_mapping[] = "a mapping";
/* #### Code section: decls ### */
static PyObject *__pyx_pf_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__wrap(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_wrap(PyObject *__pyx_self, uint64_t __pyx_v_arg0, char const *__pyx_v_arg1); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_set_log_level(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_level); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_2size_fmt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num, PyObject *__pyx_v_suffix); /* proto */
static int __pyx_pf_6memray_7_memray_16AllocationRecord___init__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_2__eq__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static Py_hash_t __pyx_pf_6memray_7_memray_16AllocationRecord_4__hash__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_7address___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_4size___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_9allocator___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_13n_allocations___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_12__repr__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_19TrackedObjectRecord___init__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_2__eq__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static Py_hash_t __pyx_pf_6memray_7_memray_19TrackedObjectRecord_4__hash__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_7address___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_10is_created___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_12__repr__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval___cinit__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, size_t __pyx_v_allocated_before_snapshot, PyObject *__pyx_v_deallocated_before_snapshot, size_t __pyx_v_n_allocations, size_t __pyx_v_n_bytes); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_2__eq__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_4__repr__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_4__del__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_13n_allocations___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval_13n_allocations_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_7n_bytes___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static int __pyx_pf_6memray_7_memray_8Interval_7n_bytes_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8Interval_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord___cinit__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_2__eq__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static Py_hash_t __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_4__hash__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9allocator___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_2__set__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_4__del__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator___iter__(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_2__next__(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_7Tracker___cinit__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, PyObject *__pyx_v_file_name, PyObject *__pyx_v_destination, bool __pyx_v_native_traces, unsigned int __pyx_v_memory_interval_ms, bool __pyx_v_follow_fork, bool __pyx_v_trace_python_allocators, bool __pyx_v_track_object_lifetimes, enum __pyx_t_6memray_7_memray_FileFormat __pyx_v_file_format); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_9__enter___set_os_name_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_2__enter__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_4__exit__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_6get_surviving_objects(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_7Tracker_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_4start_thread_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_frame, PyObject *__pyx_v_event, CYTHON_UNUSED PyObject *__pyx_v_arg); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_6greenlet_trace_function(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_event, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_8print_greenlet_warning(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_6memray_7_memray_17ProgressIndicator___init__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, PyObject *__pyx_v_task_description, PyObject *__pyx_v_total, bool __pyx_v_report_progress, size_t __pyx_v_refresh_per_second); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_2__enter__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_4__exit__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_traceback); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_13num_processed___get__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_10FileReader___cinit__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_file_name, bool __pyx_v_report_progress, int __pyx_v_max_memory_records); /* proto */
static void __pyx_pf_6memray_7_memray_10FileReader_2__dealloc__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_4close(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_6closed___get__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_6__enter__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_8__exit__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_10_reaggregate_allocations(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, size_t __pyx_v_records_to_process, bool __pyx_v_merge_threads, bool __pyx_v_leaks); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_13_aggregate_allocations(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, size_t __pyx_v_records_to_process, bool __pyx_v_merge_threads, size_t __pyx_v_temporary_buffer_size); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_19get_leaked_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_22get_temporary_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads, PyObject *__pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_25get_temporal_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_30get_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_33get_memory_snapshots(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_36get_object_lifetime_events(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_included_objects); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_8metadata___get__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10FileReader_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_10compute_statistics(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_name, PyObject *__pyx_v_report_progress, PyObject *__pyx_v_num_largest); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12dump_all_records(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_name); /* proto */
static int __pyx_pf_6memray_7_memray_12SocketReader___cinit__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED int __pyx_v_port); /* proto */
static int __pyx_pf_6memray_7_memray_12SocketReader_2__init__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, PyObject *__pyx_v_port); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_4__enter__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_6__exit__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback); /* proto */
static void __pyx_pf_6memray_7_memray_12SocketReader_8__dealloc__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_12command_line___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_9is_active___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_3pid___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_17has_native_traces___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_10get_current_snapshot(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, bool __pyx_v_merge_threads); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_14get_symbolic_support(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_16_rss_from_proc_status_for_testing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_proc_status); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_address, PyObject *__pyx_v_size, PyObject *__pyx_v_allocator, PyObject *__pyx_v_native_frame_id, PyObject *__pyx_v_frame_index, PyObject *__pyx_v_native_segment_generation); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_address, PyObject *__pyx_v_size, PyObject *__pyx_v_allocator, PyObject *__pyx_v_native_frame_id, PyObject *__pyx_v_frame_index, PyObject *__pyx_v_native_segment_generation); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6memray_7_memray_23RecordWriterTestHarness___cinit__(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, PyObject *__pyx_v_file_path, bool __pyx_v_native_traces, bool __pyx_v_trace_python_allocators, PyObject *__pyx_v_track_object_lifetimes, enum memray::tracking_api::FileFormat __pyx_v_file_format, memray::tracking_api::thread_id_t __pyx_v_main_tid, size_t __pyx_v_skipped_frames, PyObject *__pyx_v_command_line); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_2write_header(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, bool __pyx_v_seek_to_start); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, uint64_t __pyx_v_ms_since_epoch, size_t __pyx_v_rss); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_6write_code_object(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::code_object_id_t __pyx_v_id, PyObject *__pyx_v_function_name, PyObject *__pyx_v_filename, PyObject *__pyx_v_linetable, int __pyx_v_firstlineno); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_8get_linetable(PyObject *__pyx_v_code_object); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_10get_lasti(PyObject *__pyx_v_frame_object); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, uintptr_t __pyx_v_ip, size_t __pyx_v_index); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, uintptr_t __pyx_v_address, size_t __pyx_v_size, unsigned char __pyx_v_allocator, size_t __pyx_v_native_frame_id); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, memray::tracking_api::code_object_id_t __pyx_v_code_object_id, int __pyx_v_instruction_offset, bool __pyx_v_is_entry_frame); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, size_t __pyx_v_count); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_22write_mappings(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, PyObject *__pyx_v_mappings); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_24write_object_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, uintptr_t __pyx_v_address, bool __pyx_v_is_created, memray::tracking_api::frame_id_t __pyx_v_native_frame_id); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_26write_trailer(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_6memray_7_memray_AllocationRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_TrackedObjectRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_Interval(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_TemporalAllocationRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_TemporalAllocationGenerator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_Tracker(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_ProgressIndicator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_FileReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_SocketReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_HighWaterMarkAggregatorTestHarness(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_AllocationLifetimeAggregatorTestHarness(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray_RecordWriterTestHarness(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct____enter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_7_get_allocation_records(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_12_get_allocations(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  PyObject *__pyx_type_6memray_7_memray_AllocationRecord;
  PyObject *__pyx_type_6memray_7_memray_TrackedObjectRecord;
  PyObject *__pyx_type_6memray_7_memray_Interval;
  PyObject *__pyx_type_6memray_7_memray_TemporalAllocationRecord;
  PyObject *__pyx_type_6memray_7_memray_TemporalAllocationGenerator;
  PyObject *__pyx_type_6memray_7_memray_Tracker;
  PyObject *__pyx_type_6memray_7_memray_ProgressIndicator;
  PyObject *__pyx_type_6memray_7_memray_FileReader;
  PyObject *__pyx_type_6memray_7_memray_SocketReader;
  PyObject *__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness;
  PyObject *__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness;
  PyObject *__pyx_type_6memray_7_memray_RecordWriterTestHarness;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct____enter__;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations;
  PyObject *__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations;
  PyObject *__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_;
  PyObject *__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0;
  PyTypeObject *__pyx_ptype_6memray_7_memray_AllocationRecord;
  PyTypeObject *__pyx_ptype_6memray_7_memray_TrackedObjectRecord;
  PyTypeObject *__pyx_ptype_6memray_7_memray_Interval;
  PyTypeObject *__pyx_ptype_6memray_7_memray_TemporalAllocationRecord;
  PyTypeObject *__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator;
  PyTypeObject *__pyx_ptype_6memray_7_memray_Tracker;
  PyTypeObject *__pyx_ptype_6memray_7_memray_ProgressIndicator;
  PyTypeObject *__pyx_ptype_6memray_7_memray_FileReader;
  PyTypeObject *__pyx_ptype_6memray_7_memray_SocketReader;
  PyTypeObject *__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness;
  PyTypeObject *__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness;
  PyTypeObject *__pyx_ptype_6memray_7_memray_RecordWriterTestHarness;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations;
  PyTypeObject *__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations;
  PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_;
  PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  enum __pyx_t_6memray_7_memray_FileFormat __pyx_k__4;
  enum memray::tracking_api::FileFormat __pyx_k__10;
  PyObject *__pyx_slice[1];
  PyObject *__pyx_tuple[12];
  PyObject *__pyx_codeobj_tab[88];
  PyObject *__pyx_string_tab[607];
  PyObject *__pyx_number_tab[10];
/* #### Code section: module_state_contents ### */
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;

/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;


#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_freelist_6memray_7_memray_AllocationRecord[1024];
int __pyx_freecount_6memray_7_memray_AllocationRecord;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_freelist_6memray_7_memray_TrackedObjectRecord[1024];
int __pyx_freecount_6memray_7_memray_TrackedObjectRecord;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray_Interval *__pyx_freelist_6memray_7_memray_Interval[1024];
int __pyx_freecount_6memray_7_memray_Interval;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_freelist_6memray_7_memray_TemporalAllocationRecord[1024];
int __pyx_freecount_6memray_7_memray_TemporalAllocationRecord;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *__pyx_freelist_6memray_7_memray___pyx_scope_struct____enter__[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct____enter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *__pyx_freelist_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *__pyx_freelist_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *__pyx_freelist_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *__pyx_freelist_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *__pyx_freelist_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *__pyx_freelist_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *__pyx_freelist_6memray_7_memray___pyx_scope_struct_7_get_allocation_records[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_7_get_allocation_records;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *__pyx_freelist_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *__pyx_freelist_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *__pyx_freelist_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *__pyx_freelist_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *__pyx_freelist_6memray_7_memray___pyx_scope_struct_12_get_allocations[8];
int __pyx_freecount_6memray_7_memray___pyx_scope_struct_12_get_allocations;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_[8];
int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0[8];
int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_1f __pyx_string_tab[1]
#define __pyx_kp_u_5_3f __pyx_string_tab[2]
#define __pyx_kp_u_AGGREGATED_ALLOCATIONS_requires __pyx_string_tab[3]
#define __pyx_kp_u_AllocationRecord_tid __pyx_string_tab[4]
#define __pyx_kp_u_Attempting_to_use_stale_output_h __pyx_string_tab[5]
#define __pyx_kp_u_Calculating_high_watermark __pyx_string_tab[6]
#define __pyx_kp_u_Can_not_enter_the_context_of_a_S __pyx_string_tab[7]
#define __pyx_kp_u_Can_t_compute_statistics_using_a __pyx_string_tab[8]
#define __pyx_kp_u_Can_t_find_temporary_allocations __pyx_string_tab[9]
#define __pyx_kp_u_Can_t_get_all_allocations_from_a __pyx_string_tab[10]
#define __pyx_kp_u_Can_t_get_allocation_history_usi __pyx_string_tab[11]
#define __pyx_kp_u_Cannot_get_stack_trace_without_r __pyx_string_tab[12]
#define __pyx_kp_u_Cannot_get_thread_name_without_r __pyx_string_tab[13]
#define __pyx_kp_u_Computing_statistics __pyx_string_tab[14]
#define __pyx_kp_u_Could_not_open_file __pyx_string_tab[15]
#define __pyx_kp_u_Exactly_one_of_file_name_or_dest __pyx_string_tab[16]
#define __pyx_kp_u_Expected_a_code_object __pyx_string_tab[17]
#define __pyx_kp_u_Expected_a_frame_object __pyx_string_tab[18]
#define __pyx_kp_u_Failed_to_parse_VmRSS_from_proc __pyx_string_tab[19]
#define __pyx_kp_u_Failed_to_write_header __pyx_string_tab[20]
#define __pyx_kp_u_Interval_allocated_before_snapsh __pyx_string_tab[21]
#define __pyx_kp_u_N_A __pyx_string_tab[22]
#define __pyx_kp_u_No_more_than_one_Tracker_instanc __pyx_string_tab[23]
#define __pyx_kp_u_No_such_file __pyx_string_tab[24]
#define __pyx_kp_u_No_value_specified_for_struct_at __pyx_string_tab[25]
#define __pyx_kp_u_No_value_specified_for_struct_at_2 __pyx_string_tab[26]
#define __pyx_kp_u_No_value_specified_for_struct_at_3 __pyx_string_tab[27]
#define __pyx_kp_u_No_value_specified_for_struct_at_4 __pyx_string_tab[28]
#define __pyx_kp_u_No_value_specified_for_struct_at_5 __pyx_string_tab[29]
#define __pyx_kp_u_No_value_specified_for_struct_at_6 __pyx_string_tab[30]
#define __pyx_kp_u_No_value_specified_for_struct_at_7 __pyx_string_tab[31]
#define __pyx_kp_u_No_value_specified_for_struct_at_8 __pyx_string_tab[32]
#define __pyx_kp_u_None __pyx_string_tab[33]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[34]
#define __pyx_kp_u_Object_lifetime_events_are_not_a __pyx_string_tab[35]
#define __pyx_kp_u_Operation_on_a_closed_FileReader __pyx_string_tab[36]
#define __pyx_kp_u_Pickling_of_struct_members_such __pyx_string_tab[37]
#define __pyx_kp_u_Processing_allocation_records __pyx_string_tab[38]
#define __pyx_kp_u_Python_object_reference_tracking __pyx_string_tab[39]
#define __pyx_kp_u_Stack_traces_for_deallocations_a __pyx_string_tab[40]
#define __pyx_kp_u_TrackedObjectRecord_tid __pyx_string_tab[41]
#define __pyx_kp_u_Tracking_was_never_started_or_ha __pyx_string_tab[42]
#define __pyx_kp_u__11 __pyx_string_tab[43]
#define __pyx_kp_u__2 __pyx_string_tab[44]
#define __pyx_kp_u__3 __pyx_string_tab[45]
#define __pyx_kp_u__5 __pyx_string_tab[46]
#define __pyx_kp_u__6 __pyx_string_tab[47]
#define __pyx_kp_u__7 __pyx_string_tab[48]
#define __pyx_kp_u__8 __pyx_string_tab[49]
#define __pyx_kp_u__9 __pyx_string_tab[50]
#define __pyx_kp_u_add_note __pyx_string_tab[51]
#define __pyx_kp_u_address __pyx_string_tab[52]
#define __pyx_kp_u_allocations __pyx_string_tab[53]
#define __pyx_kp_u_allocator_2 __pyx_string_tab[54]
#define __pyx_kp_u_cfunc_to_py __pyx_string_tab[55]
#define __pyx_kp_u_cyan __pyx_string_tab[56]
#define __pyx_kp_u_deallocated_before_snapshot_2 __pyx_string_tab[57]
#define __pyx_kp_u_destination_must_be_a_SocketDest __pyx_string_tab[58]
#define __pyx_kp_u_dev_null __pyx_string_tab[59]
#define __pyx_kp_u_disable __pyx_string_tab[60]
#define __pyx_kp_u_enable __pyx_string_tab[61]
#define __pyx_kp_u_follow_fork_requires_an_output_f __pyx_string_tab[62]
#define __pyx_kp_u_gc __pyx_string_tab[63]
#define __pyx_kp_u_is_created_2 __pyx_string_tab[64]
#define __pyx_kp_u_isenabled __pyx_string_tab[65]
#define __pyx_kp_u_llvm __pyx_string_tab[66]
#define __pyx_kp_u_memray__destination __pyx_string_tab[67]
#define __pyx_kp_u_memray__memray __pyx_string_tab[68]
#define __pyx_kp_u_memray__metadata __pyx_string_tab[69]
#define __pyx_kp_u_memray__stats __pyx_string_tab[70]
#define __pyx_kp_u_memray__thread_name_interceptor __pyx_string_tab[71]
#define __pyx_kp_u_memray_test_harness __pyx_string_tab[72]
#define __pyx_kp_u_merged_thread __pyx_string_tab[73]
#define __pyx_kp_u_mimalloc_debug __pyx_string_tab[74]
#define __pyx_kp_u_n_allocations_2 __pyx_string_tab[75]
#define __pyx_kp_u_n_bytes_2 __pyx_string_tab[76]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[77]
#define __pyx_kp_u_proc_self_fd __pyx_string_tab[78]
#define __pyx_kp_u_pymalloc_debug __pyx_string_tab[79]
#define __pyx_kp_u_self__reader_cannot_be_converted __pyx_string_tab[80]
#define __pyx_kp_u_self_aggregator_cannot_be_conver __pyx_string_tab[81]
#define __pyx_kp_u_self_last_key_self_lifetimes_sel __pyx_string_tab[82]
#define __pyx_kp_u_size __pyx_string_tab[83]
#define __pyx_kp_u_src_memray__memray_pyx __pyx_string_tab[84]
#define __pyx_kp_u_stack_id_2 __pyx_string_tab[85]
#define __pyx_kp_u_time_rss_heap __pyx_string_tab[86]
#define __pyx_kp_u_track_object_lifetimes_True_was __pyx_string_tab[87]
#define __pyx_kp_u_tree_fragment __pyx_string_tab[88]
#define __pyx_kp_u_unknown_2 __pyx_string_tab[89]
#define __pyx_kp_u_utf_8 __pyx_string_tab[90]
#define __pyx_kp_u_warning_bold_red_Memray_support __pyx_string_tab[91]
#define __pyx_n_u_AGGREGATED_ALLOCATIONS __pyx_string_tab[92]
#define __pyx_n_u_ALIGNED_ALLOC __pyx_string_tab[93]
#define __pyx_n_u_ALL_ALLOCATIONS __pyx_string_tab[94]
#define __pyx_n_u_AllocationLifetimeAggregatorTest __pyx_string_tab[95]
#define __pyx_n_u_AllocationLifetimeAggregatorTest_2 __pyx_string_tab[96]
#define __pyx_n_u_AllocationLifetimeAggregatorTest_3 __pyx_string_tab[97]
#define __pyx_n_u_AllocationLifetimeAggregatorTest_4 __pyx_string_tab[98]
#define __pyx_n_u_AllocationLifetimeAggregatorTest_5 __pyx_string_tab[99]
#define __pyx_n_u_AllocationLifetimeAggregatorTest_6 __pyx_string_tab[100]
#define __pyx_n_u_AllocationRecord __pyx_string_tab[101]
#define __pyx_n_u_AllocationRecord___reduce_cython __pyx_string_tab[102]
#define __pyx_n_u_AllocationRecord___setstate_cyth __pyx_string_tab[103]
#define __pyx_n_u_AllocationRecord_hybrid_stack_tr __pyx_string_tab[104]
#define __pyx_n_u_AllocationRecord_native_stack_tr __pyx_string_tab[105]
#define __pyx_n_u_AllocationRecord_stack_trace __pyx_string_tab[106]
#define __pyx_n_u_AllocatorType __pyx_string_tab[107]
#define __pyx_n_u_B __pyx_string_tab[108]
#define __pyx_n_u_CALLOC __pyx_string_tab[109]
#define __pyx_n_u_CodeType __pyx_string_tab[110]
#define __pyx_n_u_Destination __pyx_string_tab[111]
#define __pyx_n_u_E __pyx_string_tab[112]
#define __pyx_n_u_FREE __pyx_string_tab[113]
#define __pyx_n_u_FUNCTION_NAME_ONLY __pyx_string_tab[114]
#define __pyx_n_u_FileDestination __pyx_string_tab[115]
#define __pyx_n_u_FileFormat __pyx_string_tab[116]
#define __pyx_n_u_FileReader __pyx_string_tab[117]
#define __pyx_n_u_FileReader___enter __pyx_string_tab[118]
#define __pyx_n_u_FileReader___exit __pyx_string_tab[119]
#define __pyx_n_u_FileReader___reduce_cython __pyx_string_tab[120]
#define __pyx_n_u_FileReader___setstate_cython __pyx_string_tab[121]
#define __pyx_n_u_FileReader__aggregate_allocation __pyx_string_tab[122]
#define __pyx_n_u_FileReader__reaggregate_allocati __pyx_string_tab[123]
#define __pyx_n_u_FileReader_close __pyx_string_tab[124]
#define __pyx_n_u_FileReader_get_allocation_record __pyx_string_tab[125]
#define __pyx_n_u_FileReader_get_high_watermark_al __pyx_string_tab[126]
#define __pyx_n_u_FileReader_get_leaked_allocation __pyx_string_tab[127]
#define __pyx_n_u_FileReader_get_memory_snapshots __pyx_string_tab[128]
#define __pyx_n_u_FileReader_get_object_lifetime_e __pyx_string_tab[129]
#define __pyx_n_u_FileReader_get_temporal_allocati __pyx_string_tab[130]
#define __pyx_n_u_FileReader_get_temporal_high_wat __pyx_string_tab[131]
#define __pyx_n_u_FileReader_get_temporary_allocat __pyx_string_tab[132]
#define __pyx_n_u_FrameType __pyx_string_tab[133]
#define __pyx_n_u_G __pyx_string_tab[134]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne __pyx_string_tab[135]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_2 __pyx_string_tab[136]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_3 __pyx_string_tab[137]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_4 __pyx_string_tab[138]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_5 __pyx_string_tab[139]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_6 __pyx_string_tab[140]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_7 __pyx_string_tab[141]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_8 __pyx_string_tab[142]
#define __pyx_n_u_HighWaterMarkAggregatorTestHarne_9 __pyx_string_tab[143]
#define __pyx_n_u_IntEnum __pyx_string_tab[144]
#define __pyx_n_u_IntFlag __pyx_string_tab[145]
#define __pyx_n_u_Interval __pyx_string_tab[146]
#define __pyx_n_u_Interval___reduce_cython __pyx_string_tab[147]
#define __pyx_n_u_Interval___setstate_cython __pyx_string_tab[148]
#define __pyx_n_u_Linux __pyx_string_tab[149]
#define __pyx_n_u_Lock __pyx_string_tab[150]
#define __pyx_n_u_M __pyx_string_tab[151]
#define __pyx_n_u_MALLOC __pyx_string_tab[152]
#define __pyx_n_u_MEMALIGN __pyx_string_tab[153]
#define __pyx_n_u_MMAP __pyx_string_tab[154]
#define __pyx_n_u_MUNMAP __pyx_string_tab[155]
#define __pyx_n_u_MemorySnapshot __pyx_string_tab[156]
#define __pyx_n_u_Metadata __pyx_string_tab[157]
#define __pyx_n_u_NONE __pyx_string_tab[158]
#define __pyx_n_u_None __pyx_string_tab[159]
#define __pyx_n_u_NotImplemented __pyx_string_tab[160]
#define __pyx_n_u_OBJECT_CREATED __pyx_string_tab[161]
#define __pyx_n_u_OBJECT_DESTROYED __pyx_string_tab[162]
#define __pyx_n_u_ObjectTrackingEvent __pyx_string_tab[163]
#define __pyx_n_u_P __pyx_string_tab[164]
#define __pyx_n_u_POSIX_MEMALIGN __pyx_string_tab[165]
#define __pyx_n_u_PVALLOC __pyx_string_tab[166]
#define __pyx_n_u_PYMALLOC_CALLOC __pyx_string_tab[167]
#define __pyx_n_u_PYMALLOC_FREE __pyx_string_tab[168]
#define __pyx_n_u_PYMALLOC_MALLOC __pyx_string_tab[169]
#define __pyx_n_u_PYMALLOC_REALLOC __pyx_string_tab[170]
#define __pyx_n_u_PYTHON_ALLOCATOR_MALLOC __pyx_string_tab[171]
#define __pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC __pyx_string_tab[172]
#define __pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC_DEBUG __pyx_string_tab[173]
#define __pyx_n_u_PYTHON_ALLOCATOR_OTHER __pyx_string_tab[174]
#define __pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC __pyx_string_tab[175]
#define __pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC_DEBUG __pyx_string_tab[176]
#define __pyx_n_u_Path __pyx_string_tab[177]
#define __pyx_n_u_Progress __pyx_string_tab[178]
#define __pyx_n_u_ProgressIndicator __pyx_string_tab[179]
#define __pyx_n_u_ProgressIndicator___enter __pyx_string_tab[180]
#define __pyx_n_u_ProgressIndicator___exit __pyx_string_tab[181]
#define __pyx_n_u_ProgressIndicator___reduce_cytho __pyx_string_tab[182]
#define __pyx_n_u_ProgressIndicator___setstate_cyt __pyx_string_tab[183]
#define __pyx_n_u_PyEval_EvalFrameDefault __pyx_string_tab[184]
#define __pyx_n_u_PythonAllocatorType __pyx_string_tab[185]
#define __pyx_n_u_Pyx_CFunc_7Tracker_void__lPare __pyx_string_tab[186]
#define __pyx_n_u_Pyx_CFunc_e0b72e__7Tracker_voi __pyx_string_tab[187]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[188]
#define __pyx_n_u_REALLOC __pyx_string_tab[189]
#define __pyx_n_u_RTLD_DEFAULT __pyx_string_tab[190]
#define __pyx_n_u_RTLD_NOW __pyx_string_tab[191]
#define __pyx_n_u_RecordWriterTestHarness __pyx_string_tab[192]
#define __pyx_n_u_RecordWriterTestHarness___reduce __pyx_string_tab[193]
#define __pyx_n_u_RecordWriterTestHarness___setsta __pyx_string_tab[194]
#define __pyx_n_u_RecordWriterTestHarness_get_last __pyx_string_tab[195]
#define __pyx_n_u_RecordWriterTestHarness_get_line __pyx_string_tab[196]
#define __pyx_n_u_RecordWriterTestHarness_write_al __pyx_string_tab[197]
#define __pyx_n_u_RecordWriterTestHarness_write_co __pyx_string_tab[198]
#define __pyx_n_u_RecordWriterTestHarness_write_fr __pyx_string_tab[199]
#define __pyx_n_u_RecordWriterTestHarness_write_fr_2 __pyx_string_tab[200]
#define __pyx_n_u_RecordWriterTestHarness_write_he __pyx_string_tab[201]
#define __pyx_n_u_RecordWriterTestHarness_write_ma __pyx_string_tab[202]
#define __pyx_n_u_RecordWriterTestHarness_write_me __pyx_string_tab[203]
#define __pyx_n_u_RecordWriterTestHarness_write_ob __pyx_string_tab[204]
#define __pyx_n_u_RecordWriterTestHarness_write_th __pyx_string_tab[205]
#define __pyx_n_u_RecordWriterTestHarness_write_tr __pyx_string_tab[206]
#define __pyx_n_u_RecordWriterTestHarness_write_un __pyx_string_tab[207]
#define __pyx_n_u_SocketDestination __pyx_string_tab[208]
#define __pyx_n_u_SocketReader __pyx_string_tab[209]
#define __pyx_n_u_SocketReader___enter __pyx_string_tab[210]
#define __pyx_n_u_SocketReader___exit __pyx_string_tab[211]
#define __pyx_n_u_SocketReader___reduce_cython __pyx_string_tab[212]
#define __pyx_n_u_SocketReader___setstate_cython __pyx_string_tab[213]
#define __pyx_n_u_SocketReader_get_current_snapsho __pyx_string_tab[214]
#define __pyx_n_u_SpinnerColumn __pyx_string_tab[215]
#define __pyx_n_u_Stats __pyx_string_tab[216]
#define __pyx_n_u_SymbolicSupport __pyx_string_tab[217]
#define __pyx_n_u_T __pyx_string_tab[218]
#define __pyx_n_u_TAIL_CALL __pyx_string_tab[219]
#define __pyx_n_u_TOTAL __pyx_string_tab[220]
#define __pyx_n_u_TemporalAllocationGenerator __pyx_string_tab[221]
#define __pyx_n_u_TemporalAllocationGenerator___re __pyx_string_tab[222]
#define __pyx_n_u_TemporalAllocationGenerator___se __pyx_string_tab[223]
#define __pyx_n_u_TemporalAllocationRecord __pyx_string_tab[224]
#define __pyx_n_u_TemporalAllocationRecord___reduc __pyx_string_tab[225]
#define __pyx_n_u_TemporalAllocationRecord___setst __pyx_string_tab[226]
#define __pyx_n_u_TemporalAllocationRecord_hybrid __pyx_string_tab[227]
#define __pyx_n_u_TemporalAllocationRecord_native __pyx_string_tab[228]
#define __pyx_n_u_TemporalAllocationRecord_stack_t __pyx_string_tab[229]
#define __pyx_n_u_Thread __pyx_string_tab[230]
#define __pyx_n_u_ThreadNameInterceptor __pyx_string_tab[231]
#define __pyx_n_u_TrackedObjectRecord __pyx_string_tab[232]
#define __pyx_n_u_TrackedObjectRecord___reduce_cyt __pyx_string_tab[233]
#define __pyx_n_u_TrackedObjectRecord___setstate_c __pyx_string_tab[234]
#define __pyx_n_u_TrackedObjectRecord_hybrid_stack __pyx_string_tab[235]
#define __pyx_n_u_TrackedObjectRecord_native_stack __pyx_string_tab[236]
#define __pyx_n_u_TrackedObjectRecord_stack_trace __pyx_string_tab[237]
#define __pyx_n_u_Tracker __pyx_string_tab[238]
#define __pyx_n_u_Tracker___enter __pyx_string_tab[239]
#define __pyx_n_u_Tracker___exit __pyx_string_tab[240]
#define __pyx_n_u_Tracker___reduce_cython __pyx_string_tab[241]
#define __pyx_n_u_Tracker___setstate_cython __pyx_string_tab[242]
#define __pyx_n_u_Tracker_get_surviving_objects __pyx_string_tab[243]
#define __pyx_n_u_VALLOC __pyx_string_tab[244]
#define __pyx_n_u_Y __pyx_string_tab[245]
#define __pyx_n_u_Z __pyx_string_tab[246]
#define __pyx_n_u_add_allocation __pyx_string_tab[247]
#define __pyx_n_u_add_task __pyx_string_tab[248]
#define __pyx_n_u_addr __pyx_string_tab[249]
#define __pyx_n_u_address_2 __pyx_string_tab[250]
#define __pyx_n_u_after_in_child __pyx_string_tab[251]
#define __pyx_n_u_aggregate_allocations __pyx_string_tab[252]
#define __pyx_n_u_aggregator __pyx_string_tab[253]
#define __pyx_n_u_alloc __pyx_string_tab[254]
#define __pyx_n_u_allocated_before_snapshot __pyx_string_tab[255]
#define __pyx_n_u_allocation __pyx_string_tab[256]
#define __pyx_n_u_allocation_count_by_allocator __pyx_string_tab[257]
#define __pyx_n_u_allocation_count_by_size __pyx_string_tab[258]
#define __pyx_n_u_allocator __pyx_string_tab[259]
#define __pyx_n_u_append __pyx_string_tab[260]
#define __pyx_n_u_arg __pyx_string_tab[261]
#define __pyx_n_u_arg0 __pyx_string_tab[262]
#define __pyx_n_u_arg1 __pyx_string_tab[263]
#define __pyx_n_u_args __pyx_string_tab[264]
#define __pyx_n_u_argv __pyx_string_tab[265]
#define __pyx_n_u_astimezone __pyx_string_tab[266]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[267]
#define __pyx_n_u_attr __pyx_string_tab[268]
#define __pyx_n_u_auto_refresh __pyx_string_tab[269]
#define __pyx_n_u_bool __pyx_string_tab[270]
#define __pyx_n_u_bytes_in_high_water_mark __pyx_string_tab[271]
#define __pyx_n_u_bytes_leaked __pyx_string_tab[272]
#define __pyx_n_u_c_call __pyx_string_tab[273]
#define __pyx_n_u_cache_key __pyx_string_tab[274]
#define __pyx_n_u_call __pyx_string_tab[275]
#define __pyx_n_u_capture_snapshot __pyx_string_tab[276]
#define __pyx_n_u_cfunc_to_py __pyx_string_tab[277]
#define __pyx_n_u_class_getitem __pyx_string_tab[278]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[279]
#define __pyx_n_u_close __pyx_string_tab[280]
#define __pyx_n_u_code_object __pyx_string_tab[281]
#define __pyx_n_u_code_object_id __pyx_string_tab[282]
#define __pyx_n_u_collections __pyx_string_tab[283]
#define __pyx_n_u_command_line __pyx_string_tab[284]
#define __pyx_n_u_completed __pyx_string_tab[285]
#define __pyx_n_u_compress_on_exit __pyx_string_tab[286]
#define __pyx_n_u_compute_statistics __pyx_string_tab[287]
#define __pyx_n_u_contextlib __pyx_string_tab[288]
#define __pyx_n_u_count __pyx_string_tab[289]
#define __pyx_n_u_count_and_loc __pyx_string_tab[290]
#define __pyx_n_u_datetime __pyx_string_tab[291]
#define __pyx_n_u_deallocated_before_snapshot __pyx_string_tab[292]
#define __pyx_n_u_destination __pyx_string_tab[293]
#define __pyx_n_u_destination_2 __pyx_string_tab[294]
#define __pyx_n_u_dict __pyx_string_tab[295]
#define __pyx_n_u_dump_all_records __pyx_string_tab[296]
#define __pyx_n_u_elem __pyx_string_tab[297]
#define __pyx_n_u_encode __pyx_string_tab[298]
#define __pyx_n_u_encoded_proc_status __pyx_string_tab[299]
#define __pyx_n_u_end_time __pyx_string_tab[300]
#define __pyx_n_u_enter __pyx_string_tab[301]
#define __pyx_n_u_enter___locals_set_os_name_wra __pyx_string_tab[302]
#define __pyx_n_u_enum __pyx_string_tab[303]
#define __pyx_n_u_event __pyx_string_tab[304]
#define __pyx_n_u_exc_traceback __pyx_string_tab[305]
#define __pyx_n_u_exc_type __pyx_string_tab[306]
#define __pyx_n_u_exc_value __pyx_string_tab[307]
#define __pyx_n_u_exists __pyx_string_tab[308]
#define __pyx_n_u_exit __pyx_string_tab[309]
#define __pyx_n_u_file __pyx_string_tab[310]
#define __pyx_n_u_file_format __pyx_string_tab[311]
#define __pyx_n_u_file_name __pyx_string_tab[312]
#define __pyx_n_u_file_path __pyx_string_tab[313]
#define __pyx_n_u_filename __pyx_string_tab[314]
#define __pyx_n_u_fileno __pyx_string_tab[315]
#define __pyx_n_u_firstlineno __pyx_string_tab[316]
#define __pyx_n_u_follow_fork __pyx_string_tab[317]
#define __pyx_n_u_frame __pyx_string_tab[318]
#define __pyx_n_u_frame_index __pyx_string_tab[319]
#define __pyx_n_u_frame_object __pyx_string_tab[320]
#define __pyx_n_u_fromtimestamp __pyx_string_tab[321]
#define __pyx_n_u_fsencode __pyx_string_tab[322]
#define __pyx_n_u_func __pyx_string_tab[323]
#define __pyx_n_u_function __pyx_string_tab[324]
#define __pyx_n_u_function_name __pyx_string_tab[325]
#define __pyx_n_u_gen __pyx_string_tab[326]
#define __pyx_n_u_get __pyx_string_tab[327]
#define __pyx_n_u_get_allocation_records __pyx_string_tab[328]
#define __pyx_n_u_get_allocations __pyx_string_tab[329]
#define __pyx_n_u_get_current_heap_size __pyx_string_tab[330]
#define __pyx_n_u_get_current_snapshot __pyx_string_tab[331]
#define __pyx_n_u_get_default_columns __pyx_string_tab[332]
#define __pyx_n_u_get_high_watermark_allocation_re __pyx_string_tab[333]
#define __pyx_n_u_get_lasti __pyx_string_tab[334]
#define __pyx_n_u_get_leaked_allocation_records __pyx_string_tab[335]
#define __pyx_n_u_get_linetable __pyx_string_tab[336]
#define __pyx_n_u_get_memory_snapshots __pyx_string_tab[337]
#define __pyx_n_u_get_object_lifetime_events __pyx_string_tab[338]
#define __pyx_n_u_get_surviving_objects __pyx_string_tab[339]
#define __pyx_n_u_get_symbolic_support __pyx_string_tab[340]
#define __pyx_n_u_get_temporal_allocation_records __pyx_string_tab[341]
#define __pyx_n_u_get_temporal_allocations __pyx_string_tab[342]
#define __pyx_n_u_get_temporal_high_water_mark_all __pyx_string_tab[343]
#define __pyx_n_u_get_temporary_allocation_records __pyx_string_tab[344]
#define __pyx_n_u_getprofile __pyx_string_tab[345]
#define __pyx_n_u_getstate __pyx_string_tab[346]
#define __pyx_n_u_greenlet __pyx_string_tab[347]
#define __pyx_n_u_greenlet_trace_function __pyx_string_tab[348]
#define __pyx_n_u_guard __pyx_string_tab[349]
#define __pyx_n_u_has_native_traces __pyx_string_tab[350]
#define __pyx_n_u_header __pyx_string_tab[351]
#define __pyx_n_u_heap __pyx_string_tab[352]
#define __pyx_n_u_high_water_mark_bytes_by_snapsho __pyx_string_tab[353]
#define __pyx_n_u_hwm_by_snapshot __pyx_string_tab[354]
#define __pyx_n_u_hybrid __pyx_string_tab[355]
#define __pyx_n_u_hybrid_stack_trace __pyx_string_tab[356]
#define __pyx_n_u_id __pyx_string_tab[357]
#define __pyx_n_u_ident __pyx_string_tab[358]
#define __pyx_n_u_included_objects __pyx_string_tab[359]
#define __pyx_n_u_index __pyx_string_tab[360]
#define __pyx_n_u_instruction_offset __pyx_string_tab[361]
#define __pyx_n_u_intervals __pyx_string_tab[362]
#define __pyx_n_u_ip __pyx_string_tab[363]
#define __pyx_n_u_is_coroutine __pyx_string_tab[364]
#define __pyx_n_u_is_created __pyx_string_tab[365]
#define __pyx_n_u_is_entry_frame __pyx_string_tab[366]
#define __pyx_n_u_is_python_frame_boundary __pyx_string_tab[367]
#define __pyx_n_u_items __pyx_string_tab[368]
#define __pyx_n_u_k __pyx_string_tab[369]
#define __pyx_n_u_leaks __pyx_string_tab[370]
#define __pyx_n_u_level __pyx_string_tab[371]
#define __pyx_n_u_line __pyx_string_tab[372]
#define __pyx_n_u_linetable __pyx_string_tab[373]
#define __pyx_n_u_location __pyx_string_tab[374]
#define __pyx_n_u_locations __pyx_string_tab[375]
#define __pyx_n_u_main __pyx_string_tab[376]
#define __pyx_n_u_main_thread_id __pyx_string_tab[377]
#define __pyx_n_u_main_tid __pyx_string_tab[378]
#define __pyx_n_u_malloc __pyx_string_tab[379]
#define __pyx_n_u_map __pyx_string_tab[380]
#define __pyx_n_u_mapping __pyx_string_tab[381]
#define __pyx_n_u_mappings __pyx_string_tab[382]
#define __pyx_n_u_max_memory_records __pyx_string_tab[383]
#define __pyx_n_u_max_records __pyx_string_tab[384]
#define __pyx_n_u_max_stacks __pyx_string_tab[385]
#define __pyx_n_u_member_names __pyx_string_tab[386]
#define __pyx_n_u_members __pyx_string_tab[387]
#define __pyx_n_u_memory_interval_ms __pyx_string_tab[388]
#define __pyx_n_u_memory_records_seen __pyx_string_tab[389]
#define __pyx_n_u_memray__memray __pyx_string_tab[390]
#define __pyx_n_u_memsz __pyx_string_tab[391]
#define __pyx_n_u_merge_threads __pyx_string_tab[392]
#define __pyx_n_u_metadata __pyx_string_tab[393]
#define __pyx_n_u_metadata_2 __pyx_string_tab[394]
#define __pyx_n_u_microsecond __pyx_string_tab[395]
#define __pyx_n_u_mimalloc __pyx_string_tab[396]
#define __pyx_n_u_module __pyx_string_tab[397]
#define __pyx_n_u_module_2 __pyx_string_tab[398]
#define __pyx_n_u_modules __pyx_string_tab[399]
#define __pyx_n_u_ms_since_epoch __pyx_string_tab[400]
#define __pyx_n_u_n_allocations __pyx_string_tab[401]
#define __pyx_n_u_n_allocations_in_high_water_mark __pyx_string_tab[402]
#define __pyx_n_u_n_allocations_leaked __pyx_string_tab[403]
#define __pyx_n_u_n_bytes __pyx_string_tab[404]
#define __pyx_n_u_n_frames __pyx_string_tab[405]
#define __pyx_n_u_name __pyx_string_tab[406]
#define __pyx_n_u_name_2 __pyx_string_tab[407]
#define __pyx_n_u_name_3 __pyx_string_tab[408]
#define __pyx_n_u_name_bytes __pyx_string_tab[409]
#define __pyx_n_u_namedtuple __pyx_string_tab[410]
#define __pyx_n_u_native __pyx_string_tab[411]
#define __pyx_n_u_native_frame_id __pyx_string_tab[412]
#define __pyx_n_u_native_segment_generation __pyx_string_tab[413]
#define __pyx_n_u_native_stack_id __pyx_string_tab[414]
#define __pyx_n_u_native_stack_trace __pyx_string_tab[415]
#define __pyx_n_u_native_traces __pyx_string_tab[416]
#define __pyx_n_u_next __pyx_string_tab[417]
#define __pyx_n_u_num __pyx_string_tab[418]
#define __pyx_n_u_num_largest __pyx_string_tab[419]
#define __pyx_n_u_num_processed __pyx_string_tab[420]
#define __pyx_n_u_obj __pyx_string_tab[421]
#define __pyx_n_u_object_ids __pyx_string_tab[422]
#define __pyx_n_u_object_record __pyx_string_tab[423]
#define __pyx_n_u_open __pyx_string_tab[424]
#define __pyx_n_u_orig_set_os_name __pyx_string_tab[425]
#define __pyx_n_u_os __pyx_string_tab[426]
#define __pyx_n_u_overwrite __pyx_string_tab[427]
#define __pyx_n_u_path __pyx_string_tab[428]
#define __pyx_n_u_pathlib __pyx_string_tab[429]
#define __pyx_n_u_peak_memory __pyx_string_tab[430]
#define __pyx_n_u_peak_memory_allocated __pyx_string_tab[431]
#define __pyx_n_u_pid __pyx_string_tab[432]
#define __pyx_n_u_platform __pyx_string_tab[433]
#define __pyx_n_u_pop __pyx_string_tab[434]
#define __pyx_n_u_port __pyx_string_tab[435]
#define __pyx_n_u_pprint __pyx_string_tab[436]
#define __pyx_n_u_print __pyx_string_tab[437]
#define __pyx_n_u_print_greenlet_warning __pyx_string_tab[438]
#define __pyx_n_u_proc_status __pyx_string_tab[439]
#define __pyx_n_u_profile_hook __pyx_string_tab[440]
#define __pyx_n_u_progress_indicator __pyx_string_tab[441]
#define __pyx_n_u_pymalloc __pyx_string_tab[442]
#define __pyx_n_u_python __pyx_string_tab[443]
#define __pyx_n_u_python_allocator __pyx_string_tab[444]
#define __pyx_n_u_pyx_state __pyx_string_tab[445]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[446]
#define __pyx_n_u_qualname __pyx_string_tab[447]
#define __pyx_n_u_reader __pyx_string_tab[448]
#define __pyx_n_u_reader_2 __pyx_string_tab[449]
#define __pyx_n_u_reader_sp __pyx_string_tab[450]
#define __pyx_n_u_reaggregate_allocations __pyx_string_tab[451]
#define __pyx_n_u_record __pyx_string_tab[452]
#define __pyx_n_u_records_to_process __pyx_string_tab[453]
#define __pyx_n_u_reduce __pyx_string_tab[454]
#define __pyx_n_u_reduce_cython __pyx_string_tab[455]
#define __pyx_n_u_reduce_ex __pyx_string_tab[456]
#define __pyx_n_u_refresh __pyx_string_tab[457]
#define __pyx_n_u_refresh_per_second __pyx_string_tab[458]
#define __pyx_n_u_register_at_fork __pyx_string_tab[459]
#define __pyx_n_u_replace __pyx_string_tab[460]
#define __pyx_n_u_report_progress __pyx_string_tab[461]
#define __pyx_n_u_ret __pyx_string_tab[462]
#define __pyx_n_u_return __pyx_string_tab[463]
#define __pyx_n_u_reverse __pyx_string_tab[464]
#define __pyx_n_u_rich __pyx_string_tab[465]
#define __pyx_n_u_rich_progress __pyx_string_tab[466]
#define __pyx_n_u_rss __pyx_string_tab[467]
#define __pyx_n_u_rss_from_proc_status_for_testin __pyx_string_tab[468]
#define __pyx_n_u_rss_in_bytes __pyx_string_tab[469]
#define __pyx_n_u_samefile __pyx_string_tab[470]
#define __pyx_n_u_seek_to_start __pyx_string_tab[471]
#define __pyx_n_u_seg __pyx_string_tab[472]
#define __pyx_n_u_segments __pyx_string_tab[473]
#define __pyx_n_u_self __pyx_string_tab[474]
#define __pyx_n_u_send __pyx_string_tab[475]
#define __pyx_n_u_server_port __pyx_string_tab[476]
#define __pyx_n_u_set_log_level __pyx_string_tab[477]
#define __pyx_n_u_set_name __pyx_string_tab[478]
#define __pyx_n_u_set_os_name __pyx_string_tab[479]
#define __pyx_n_u_set_os_name_wrapper __pyx_string_tab[480]
#define __pyx_n_u_setdefault __pyx_string_tab[481]
#define __pyx_n_u_setprofile __pyx_string_tab[482]
#define __pyx_n_u_setstate __pyx_string_tab[483]
#define __pyx_n_u_setstate_cython __pyx_string_tab[484]
#define __pyx_n_u_size_2 __pyx_string_tab[485]
#define __pyx_n_u_size_and_loc __pyx_string_tab[486]
#define __pyx_n_u_size_fmt __pyx_string_tab[487]
#define __pyx_n_u_skipped_frames __pyx_string_tab[488]
#define __pyx_n_u_skipped_frames_on_main_tid __pyx_string_tab[489]
#define __pyx_n_u_snapshot_allocations __pyx_string_tab[490]
#define __pyx_n_u_stack_id __pyx_string_tab[491]
#define __pyx_n_u_stack_trace __pyx_string_tab[492]
#define __pyx_n_u_start_thread_trace __pyx_string_tab[493]
#define __pyx_n_u_start_time __pyx_string_tab[494]
#define __pyx_n_u_startswith __pyx_string_tab[495]
#define __pyx_n_u_staticmethod __pyx_string_tab[496]
#define __pyx_n_u_stats __pyx_string_tab[497]
#define __pyx_n_u_stats_2 __pyx_string_tab[498]
#define __pyx_n_u_stderr __pyx_string_tab[499]
#define __pyx_n_u_strerror __pyx_string_tab[500]
#define __pyx_n_u_suffix __pyx_string_tab[501]
#define __pyx_n_u_suppress __pyx_string_tab[502]
#define __pyx_n_u_switch __pyx_string_tab[503]
#define __pyx_n_u_sys __pyx_string_tab[504]
#define __pyx_n_u_system __pyx_string_tab[505]
#define __pyx_n_u_task_description __pyx_string_tab[506]
#define __pyx_n_u_temporary_buffer_size __pyx_string_tab[507]
#define __pyx_n_u_test __pyx_string_tab[508]
#define __pyx_n_u_the_aggregator __pyx_string_tab[509]
#define __pyx_n_u_thread_name_interceptor __pyx_string_tab[510]
#define __pyx_n_u_threading __pyx_string_tab[511]
#define __pyx_n_u_threshold __pyx_string_tab[512]
#define __pyx_n_u_throw __pyx_string_tab[513]
#define __pyx_n_u_tid __pyx_string_tab[514]
#define __pyx_n_u_tmp __pyx_string_tab[515]
#define __pyx_n_u_top_locations_by_count __pyx_string_tab[516]
#define __pyx_n_u_top_locations_by_size __pyx_string_tab[517]
#define __pyx_n_u_total __pyx_string_tab[518]
#define __pyx_n_u_total_allocations __pyx_string_tab[519]
#define __pyx_n_u_total_frames __pyx_string_tab[520]
#define __pyx_n_u_total_memory_allocated __pyx_string_tab[521]
#define __pyx_n_u_total_num_allocations __pyx_string_tab[522]
#define __pyx_n_u_trace_python_allocators __pyx_string_tab[523]
#define __pyx_n_u_traceback __pyx_string_tab[524]
#define __pyx_n_u_track_object_lifetimes __pyx_string_tab[525]
#define __pyx_n_u_tracked_object __pyx_string_tab[526]
#define __pyx_n_u_tracker_creation_lock __pyx_string_tab[527]
#define __pyx_n_u_transient __pyx_string_tab[528]
#define __pyx_n_u_type __pyx_string_tab[529]
#define __pyx_n_u_types __pyx_string_tab[530]
#define __pyx_n_u_unit __pyx_string_tab[531]
#define __pyx_n_u_unknown __pyx_string_tab[532]
#define __pyx_n_u_update __pyx_string_tab[533]
#define __pyx_n_u_v __pyx_string_tab[534]
#define __pyx_n_u_vaddr __pyx_string_tab[535]
#define __pyx_n_u_value __pyx_string_tab[536]
#define __pyx_n_u_values __pyx_string_tab[537]
#define __pyx_n_u_version __pyx_string_tab[538]
#define __pyx_n_u_version_info __pyx_string_tab[539]
#define __pyx_n_u_wrap __pyx_string_tab[540]
#define __pyx_n_u_write_allocation_record __pyx_string_tab[541]
#define __pyx_n_u_write_code_object __pyx_string_tab[542]
#define __pyx_n_u_write_frame_pop __pyx_string_tab[543]
#define __pyx_n_u_write_frame_push __pyx_string_tab[544]
#define __pyx_n_u_write_header __pyx_string_tab[545]
#define __pyx_n_u_write_mappings __pyx_string_tab[546]
#define __pyx_n_u_write_memory_record __pyx_string_tab[547]
#define __pyx_n_u_write_object_record __pyx_string_tab[548]
#define __pyx_n_u_write_thread_record __pyx_string_tab[549]
#define __pyx_n_u_write_trailer __pyx_string_tab[550]
#define __pyx_n_u_write_unresolved_native_frame __pyx_string_tab[551]
#define __pyx_n_u_writer __pyx_string_tab[552]
#define __pyx_kp_b_iso88591_1A __pyx_string_tab[553]
#define __pyx_kp_b_iso88591_2_4t84r_Qa_aq __pyx_string_tab[554]
#define __pyx_kp_b_iso88591_A __pyx_string_tab[555]
#define __pyx_kp_b_iso88591_A_2 __pyx_string_tab[556]
#define __pyx_kp_b_iso88591_A_3 __pyx_string_tab[557]
#define __pyx_kp_b_iso88591_A_4 __pyx_string_tab[558]
#define __pyx_kp_b_iso88591_A_4q_A_4q_Q_q __pyx_string_tab[559]
#define __pyx_kp_b_iso88591_A_4t1_1_Kz_IT_1_AT_a_q __pyx_string_tab[560]
#define __pyx_kp_b_iso88591_A_4t1_WAT_4q_t_IQfG1 __pyx_string_tab[561]
#define __pyx_kp_b_iso88591_A_4t1_a_4_3a_a_uAT __pyx_string_tab[562]
#define __pyx_kp_b_iso88591_A_4wgQ_4q_a __pyx_string_tab[563]
#define __pyx_kp_b_iso88591_A_4wgQ_A_K_Qd_q_Kt84r_1_I_q_A_F __pyx_string_tab[564]
#define __pyx_kp_b_iso88591_A_4z_Q_1A_A_Q __pyx_string_tab[565]
#define __pyx_kp_b_iso88591_A_4z_uA_1A_q_AQ_wd_A __pyx_string_tab[566]
#define __pyx_kp_b_iso88591_A_5 __pyx_string_tab[567]
#define __pyx_kp_b_iso88591_A_B_k_ha_m_a_t84r_1E __pyx_string_tab[568]
#define __pyx_kp_b_iso88591_A_F __pyx_string_tab[569]
#define __pyx_kp_b_iso88591_A_Ks_Q_l_1_t9Cq_l_1_T_a_t7_9IQ_q __pyx_string_tab[570]
#define __pyx_kp_b_iso88591_A_Q_q_Q_q_1_K_Qa __pyx_string_tab[571]
#define __pyx_kp_b_iso88591_A_Zq_6d_WD_1M1C1_HD_A_A_t_aq __pyx_string_tab[572]
#define __pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_A_A_t_aq __pyx_string_tab[573]
#define __pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_A_t_aq __pyx_string_tab[574]
#define __pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_t_aq __pyx_string_tab[575]
#define __pyx_kp_b_iso88591_A_a_N_AT_wa_m1E_1_Ja_j_5Zq_1_Zq __pyx_string_tab[576]
#define __pyx_kp_b_iso88591_A_f_a_f_f_a_t84r_1E __pyx_string_tab[577]
#define __pyx_kp_b_iso88591_A_k_nA_t84r_1E __pyx_string_tab[578]
#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[579]
#define __pyx_kp_b_iso88591_A_t7_Ja_HD __pyx_string_tab[580]
#define __pyx_kp_b_iso88591_A_t84r_Q_B_G1 __pyx_string_tab[581]
#define __pyx_kp_b_iso88591_A_t_1 __pyx_string_tab[582]
#define __pyx_kp_b_iso88591_A_t_1_2 __pyx_string_tab[583]
#define __pyx_kp_b_iso88591_A_t_a __pyx_string_tab[584]
#define __pyx_kp_b_iso88591_A_xvQa_9C_J_Kq_t9Cq_4q_4q_a __pyx_string_tab[585]
#define __pyx_kp_b_iso88591_B_2 __pyx_string_tab[586]
#define __pyx_kp_b_iso88591_Cq_t7_q_WA_gQ_q_K_Q_4r __pyx_string_tab[587]
#define __pyx_kp_b_iso88591_D_D_D_A_3auBa_2Qc_q_Qa_q_2Qc_q __pyx_string_tab[588]
#define __pyx_kp_b_iso88591_G1A_t_q_5Qa_j_1 __pyx_string_tab[589]
#define __pyx_kp_b_iso88591_H_G1A_ha_t84r_1E __pyx_string_tab[590]
#define __pyx_kp_b_iso88591_H_iq_t84r_1E __pyx_string_tab[591]
#define __pyx_kp_b_iso88591_J_gQ_t84r_Qa __pyx_string_tab[592]
#define __pyx_kp_b_iso88591_K1_fA_iq_t84r_Qa __pyx_string_tab[593]
#define __pyx_kp_b_iso88591_KGWWX_AQ __pyx_string_tab[594]
#define __pyx_kp_b_iso88591_LA_q_4xq_A_Q_3_1_a_IT_XQhaq_44E __pyx_string_tab[595]
#define __pyx_kp_b_iso88591_MQ __pyx_string_tab[596]
#define __pyx_kp_b_iso88591_Q __pyx_string_tab[597]
#define __pyx_kp_b_iso88591_Q_Zq_6d_WD_1M_A_HD_A_A_t_aq __pyx_string_tab[598]
#define __pyx_kp_b_iso88591_Q_Zq_WD_1M_A_HD_A_A_A_t_aq __pyx_string_tab[599]
#define __pyx_kp_b_iso88591_S __pyx_string_tab[600]
#define __pyx_kp_b_iso88591__12 __pyx_string_tab[601]
#define __pyx_kp_b_iso88591_k_q_a_Qa_Q_F_81_S_vQo_10A_a_a_1 __pyx_string_tab[602]
#define __pyx_kp_b_iso88591_q_t84r_a __pyx_string_tab[603]
#define __pyx_kp_b_iso88591_q_t84r_q_1Kwaq_1A_1Jc_G7_1_Kq __pyx_string_tab[604]
#define __pyx_kp_b_iso88591_vT_1_4q_D __pyx_string_tab[605]
#define __pyx_kp_b_iso88591_vT_a_1 __pyx_string_tab[606]
#define __pyx_float_1000_0 __pyx_number_tab[0]
#define __pyx_int_0 __pyx_number_tab[1]
#define __pyx_int_neg_1 __pyx_number_tab[2]
#define __pyx_int_1 __pyx_number_tab[3]
#define __pyx_int_3 __pyx_number_tab[4]
#define __pyx_int_5 __pyx_number_tab[5]
#define __pyx_int_10 __pyx_number_tab[6]
#define __pyx_int_13 __pyx_number_tab[7]
#define __pyx_int_1000 __pyx_number_tab[8]
#define __pyx_int_2048 __pyx_number_tab[9]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_AllocationRecord);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_AllocationRecord);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_TrackedObjectRecord);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_TrackedObjectRecord);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_Interval);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_Interval);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_TemporalAllocationRecord);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_TemporalAllocationGenerator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_Tracker);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_Tracker);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_ProgressIndicator);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_ProgressIndicator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_FileReader);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_FileReader);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_SocketReader);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_SocketReader);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray_RecordWriterTestHarness);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct____enter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations);
  Py_CLEAR(clear_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations);
  Py_CLEAR(clear_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations);
  Py_CLEAR(clear_module_state->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_);
  Py_CLEAR(clear_module_state->__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_);
  Py_CLEAR(clear_module_state->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0);
  Py_CLEAR(clear_module_state->__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0);
  for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<88; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<607; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<10; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_AllocationRecord);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_AllocationRecord);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_TrackedObjectRecord);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_TrackedObjectRecord);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_Interval);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_Interval);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_TemporalAllocationRecord);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_TemporalAllocationGenerator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_Tracker);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_Tracker);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_ProgressIndicator);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_ProgressIndicator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_FileReader);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_FileReader);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_SocketReader);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_SocketReader);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray_RecordWriterTestHarness);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct____enter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations);
  Py_VISIT(traverse_module_state->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations);
  Py_VISIT(traverse_module_state->__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations);
  Py_VISIT(traverse_module_state->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_);
  Py_VISIT(traverse_module_state->__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_);
  Py_VISIT(traverse_module_state->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0);
  Py_VISIT(traverse_module_state->__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0);
  for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<88; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<607; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<10; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():             # <<<<<<<<<<<<<<
 *         """wrap() -> 'void'"""
 *         f()
*/

/* Python wrapper */
static PyObject *__pyx_pw_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__1wrap(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__wrap, "wrap() -> 'void'");
static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__1wrap, METH_NOARGS, __pyx_doc_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__wrap};
static PyObject *__pyx_pw_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__1wrap(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__wrap(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__wrap(PyObject *__pyx_self) {
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *__pyx_cur_scope;
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap", 0);
  __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cfunc.to_py":69
 *     def wrap():
 *         """wrap() -> 'void'"""
 *         f()             # <<<<<<<<<<<<<<
 *     return wrap
 * 
*/
  __pyx_cur_scope->__pyx_v_f(); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 69, __pyx_L1_error)

  /* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():             # <<<<<<<<<<<<<<
 *         """wrap() -> 'void'"""
 *         f()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cfunc.to_py":65
 * 
 * 
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")             # <<<<<<<<<<<<<<
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():
*/

static PyObject *__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*__pyx_v_f)(void)) {
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *__pyx_cur_scope;
  PyObject *__pyx_v_wrap = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_", 0);
  __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(__pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 65, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_f = __pyx_v_f;

  /* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():             # <<<<<<<<<<<<<<
 *         """wrap() -> 'void'"""
 *         f()
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_69__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__1wrap, 0, __pyx_mstate_global->__pyx_n_u_Pyx_CFunc_7Tracker_void__lPare, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_cfunc_to_py, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_wrap = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cfunc.to_py":70
 *         """wrap() -> 'void'"""
 *         f()
 *     return wrap             # <<<<<<<<<<<<<<
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_wrap);
  __pyx_r = __pyx_v_wrap;
  goto __pyx_L0;

  /* "cfunc.to_py":65
 * 
 * 
 * @cname("__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_")             # <<<<<<<<<<<<<<
 * cdef object __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(void (*f)() except *):
 *     def wrap():
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_wrap);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(AllocatorType c_val):
 *     cdef object __pyx_enum
*/

static PyObject *__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_AllocatorType __pyx_v_c_val) {
  PyObject *__pyx_v___pyx_enum = 0;
  int __pyx_v_underlying_c_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", 0);

  /* "EnumTypeToPy":5
 * cdef __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(AllocatorType c_val):
 *     cdef object __pyx_enum
 *     __pyx_enum = AllocatorType             # <<<<<<<<<<<<<<
 * 
 *     if 0:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_AllocatorType); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___pyx_enum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "EnumTypeToPy":7
 *     __pyx_enum = AllocatorType
 * 
 *     if 0:             # <<<<<<<<<<<<<<
 *         pass
 *     elif c_val == AllocatorType.PYMALLOC_FREE:
*/
  switch (__pyx_v_c_val) {
    case __pyx_e_6memray_7_memray_PYMALLOC_FREE:

    /* "EnumTypeToPy":10
 *         pass
 *     elif c_val == AllocatorType.PYMALLOC_FREE:
 *         return __pyx_enum.PYMALLOC_FREE             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.PYMALLOC_MALLOC:
 *         return __pyx_enum.PYMALLOC_MALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYMALLOC_FREE); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == AllocatorType.PYMALLOC_FREE:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYMALLOC_FREE
 *     elif c_val == AllocatorType.PYMALLOC_MALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PYMALLOC_MALLOC:

    /* "EnumTypeToPy":12
 *         return __pyx_enum.PYMALLOC_FREE
 *     elif c_val == AllocatorType.PYMALLOC_MALLOC:
 *         return __pyx_enum.PYMALLOC_MALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.PYMALLOC_CALLOC:
 *         return __pyx_enum.PYMALLOC_CALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYMALLOC_MALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":11
 *     elif c_val == AllocatorType.PYMALLOC_FREE:
 *         return __pyx_enum.PYMALLOC_FREE
 *     elif c_val == AllocatorType.PYMALLOC_MALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYMALLOC_MALLOC
 *     elif c_val == AllocatorType.PYMALLOC_CALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PYMALLOC_CALLOC:

    /* "EnumTypeToPy":14
 *         return __pyx_enum.PYMALLOC_MALLOC
 *     elif c_val == AllocatorType.PYMALLOC_CALLOC:
 *         return __pyx_enum.PYMALLOC_CALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.PYMALLOC_REALLOC:
 *         return __pyx_enum.PYMALLOC_REALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYMALLOC_CALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":13
 *     elif c_val == AllocatorType.PYMALLOC_MALLOC:
 *         return __pyx_enum.PYMALLOC_MALLOC
 *     elif c_val == AllocatorType.PYMALLOC_CALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYMALLOC_CALLOC
 *     elif c_val == AllocatorType.PYMALLOC_REALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PYMALLOC_REALLOC:

    /* "EnumTypeToPy":16
 *         return __pyx_enum.PYMALLOC_CALLOC
 *     elif c_val == AllocatorType.PYMALLOC_REALLOC:
 *         return __pyx_enum.PYMALLOC_REALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.FREE:
 *         return __pyx_enum.FREE
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYMALLOC_REALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":15
 *     elif c_val == AllocatorType.PYMALLOC_CALLOC:
 *         return __pyx_enum.PYMALLOC_CALLOC
 *     elif c_val == AllocatorType.PYMALLOC_REALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYMALLOC_REALLOC
 *     elif c_val == AllocatorType.FREE:
*/
    break;
    case __pyx_e_6memray_7_memray_FREE:

    /* "EnumTypeToPy":18
 *         return __pyx_enum.PYMALLOC_REALLOC
 *     elif c_val == AllocatorType.FREE:
 *         return __pyx_enum.FREE             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.MALLOC:
 *         return __pyx_enum.MALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_FREE); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":17
 *     elif c_val == AllocatorType.PYMALLOC_REALLOC:
 *         return __pyx_enum.PYMALLOC_REALLOC
 *     elif c_val == AllocatorType.FREE:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.FREE
 *     elif c_val == AllocatorType.MALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_MALLOC:

    /* "EnumTypeToPy":20
 *         return __pyx_enum.FREE
 *     elif c_val == AllocatorType.MALLOC:
 *         return __pyx_enum.MALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.REALLOC:
 *         return __pyx_enum.REALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_MALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":19
 *     elif c_val == AllocatorType.FREE:
 *         return __pyx_enum.FREE
 *     elif c_val == AllocatorType.MALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.MALLOC
 *     elif c_val == AllocatorType.REALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_REALLOC:

    /* "EnumTypeToPy":22
 *         return __pyx_enum.MALLOC
 *     elif c_val == AllocatorType.REALLOC:
 *         return __pyx_enum.REALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.CALLOC:
 *         return __pyx_enum.CALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_REALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":21
 *     elif c_val == AllocatorType.MALLOC:
 *         return __pyx_enum.MALLOC
 *     elif c_val == AllocatorType.REALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.REALLOC
 *     elif c_val == AllocatorType.CALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_CALLOC:

    /* "EnumTypeToPy":24
 *         return __pyx_enum.REALLOC
 *     elif c_val == AllocatorType.CALLOC:
 *         return __pyx_enum.CALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.POSIX_MEMALIGN:
 *         return __pyx_enum.POSIX_MEMALIGN
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_CALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":23
 *     elif c_val == AllocatorType.REALLOC:
 *         return __pyx_enum.REALLOC
 *     elif c_val == AllocatorType.CALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.CALLOC
 *     elif c_val == AllocatorType.POSIX_MEMALIGN:
*/
    break;
    case __pyx_e_6memray_7_memray_POSIX_MEMALIGN:

    /* "EnumTypeToPy":26
 *         return __pyx_enum.CALLOC
 *     elif c_val == AllocatorType.POSIX_MEMALIGN:
 *         return __pyx_enum.POSIX_MEMALIGN             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.ALIGNED_ALLOC:
 *         return __pyx_enum.ALIGNED_ALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_POSIX_MEMALIGN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":25
 *     elif c_val == AllocatorType.CALLOC:
 *         return __pyx_enum.CALLOC
 *     elif c_val == AllocatorType.POSIX_MEMALIGN:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.POSIX_MEMALIGN
 *     elif c_val == AllocatorType.ALIGNED_ALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_ALIGNED_ALLOC:

    /* "EnumTypeToPy":28
 *         return __pyx_enum.POSIX_MEMALIGN
 *     elif c_val == AllocatorType.ALIGNED_ALLOC:
 *         return __pyx_enum.ALIGNED_ALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.MEMALIGN:
 *         return __pyx_enum.MEMALIGN
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_ALIGNED_ALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":27
 *     elif c_val == AllocatorType.POSIX_MEMALIGN:
 *         return __pyx_enum.POSIX_MEMALIGN
 *     elif c_val == AllocatorType.ALIGNED_ALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.ALIGNED_ALLOC
 *     elif c_val == AllocatorType.MEMALIGN:
*/
    break;
    case __pyx_e_6memray_7_memray_MEMALIGN:

    /* "EnumTypeToPy":30
 *         return __pyx_enum.ALIGNED_ALLOC
 *     elif c_val == AllocatorType.MEMALIGN:
 *         return __pyx_enum.MEMALIGN             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.VALLOC:
 *         return __pyx_enum.VALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_MEMALIGN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":29
 *     elif c_val == AllocatorType.ALIGNED_ALLOC:
 *         return __pyx_enum.ALIGNED_ALLOC
 *     elif c_val == AllocatorType.MEMALIGN:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.MEMALIGN
 *     elif c_val == AllocatorType.VALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_VALLOC:

    /* "EnumTypeToPy":32
 *         return __pyx_enum.MEMALIGN
 *     elif c_val == AllocatorType.VALLOC:
 *         return __pyx_enum.VALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.PVALLOC:
 *         return __pyx_enum.PVALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_VALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":31
 *     elif c_val == AllocatorType.MEMALIGN:
 *         return __pyx_enum.MEMALIGN
 *     elif c_val == AllocatorType.VALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.VALLOC
 *     elif c_val == AllocatorType.PVALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PVALLOC:

    /* "EnumTypeToPy":34
 *         return __pyx_enum.VALLOC
 *     elif c_val == AllocatorType.PVALLOC:
 *         return __pyx_enum.PVALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.MMAP:
 *         return __pyx_enum.MMAP
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PVALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":33
 *     elif c_val == AllocatorType.VALLOC:
 *         return __pyx_enum.VALLOC
 *     elif c_val == AllocatorType.PVALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PVALLOC
 *     elif c_val == AllocatorType.MMAP:
*/
    break;
    case __pyx_e_6memray_7_memray_MMAP:

    /* "EnumTypeToPy":36
 *         return __pyx_enum.PVALLOC
 *     elif c_val == AllocatorType.MMAP:
 *         return __pyx_enum.MMAP             # <<<<<<<<<<<<<<
 *     elif c_val == AllocatorType.MUNMAP:
 *         return __pyx_enum.MUNMAP
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_MMAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":35
 *     elif c_val == AllocatorType.PVALLOC:
 *         return __pyx_enum.PVALLOC
 *     elif c_val == AllocatorType.MMAP:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.MMAP
 *     elif c_val == AllocatorType.MUNMAP:
*/
    break;
    case __pyx_e_6memray_7_memray_MUNMAP:

    /* "EnumTypeToPy":38
 *         return __pyx_enum.MMAP
 *     elif c_val == AllocatorType.MUNMAP:
 *         return __pyx_enum.MUNMAP             # <<<<<<<<<<<<<<
 *     else:
 *         underlying_c_val = <int>c_val
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_MUNMAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":37
 *     elif c_val == AllocatorType.MMAP:
 *         return __pyx_enum.MMAP
 *     elif c_val == AllocatorType.MUNMAP:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.MUNMAP
 *     else:
*/
    break;
    default:

    /* "EnumTypeToPy":40
 *         return __pyx_enum.MUNMAP
 *     else:
 *         underlying_c_val = <int>c_val             # <<<<<<<<<<<<<<
 *         return __pyx_enum(underlying_c_val)
*/
    __pyx_v_underlying_c_val = ((int)__pyx_v_c_val);

    /* "EnumTypeToPy":41
 *     else:
 *         underlying_c_val = <int>c_val
 *         return __pyx_enum(underlying_c_val)             # <<<<<<<<<<<<<<
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v___pyx_enum);
    __pyx_t_3 = __pyx_v___pyx_enum; 
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
  }

  /* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(AllocatorType c_val):
 *     cdef object __pyx_enum
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_enum);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent __pyx_v_c_val) {
  PyObject *__pyx_v___pyx_enum = 0;
  int __pyx_v_underlying_c_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", 0);

  /* "EnumTypeToPy":5
 * cdef __Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(ObjectTrackingEvent c_val):
 *     cdef object __pyx_enum
 *     __pyx_enum = ObjectTrackingEvent             # <<<<<<<<<<<<<<
 * 
 *     if 0:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ObjectTrackingEvent); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___pyx_enum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "EnumTypeToPy":7
 *     __pyx_enum = ObjectTrackingEvent
 * 
 *     if 0:             # <<<<<<<<<<<<<<
 *         pass
 *     elif c_val == ObjectTrackingEvent.OBJECT_CREATED:
*/
  switch (__pyx_v_c_val) {
    case __pyx_e_6memray_7_memray_OBJECT_CREATED:

    /* "EnumTypeToPy":10
 *         pass
 *     elif c_val == ObjectTrackingEvent.OBJECT_CREATED:
 *         return __pyx_enum.OBJECT_CREATED             # <<<<<<<<<<<<<<
 *     elif c_val == ObjectTrackingEvent.OBJECT_DESTROYED:
 *         return __pyx_enum.OBJECT_DESTROYED
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_OBJECT_CREATED); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == ObjectTrackingEvent.OBJECT_CREATED:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.OBJECT_CREATED
 *     elif c_val == ObjectTrackingEvent.OBJECT_DESTROYED:
*/
    break;
    case __pyx_e_6memray_7_memray_OBJECT_DESTROYED:

    /* "EnumTypeToPy":12
 *         return __pyx_enum.OBJECT_CREATED
 *     elif c_val == ObjectTrackingEvent.OBJECT_DESTROYED:
 *         return __pyx_enum.OBJECT_DESTROYED             # <<<<<<<<<<<<<<
 *     else:
 *         underlying_c_val = <int>c_val
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_OBJECT_DESTROYED); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":11
 *     elif c_val == ObjectTrackingEvent.OBJECT_CREATED:
 *         return __pyx_enum.OBJECT_CREATED
 *     elif c_val == ObjectTrackingEvent.OBJECT_DESTROYED:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.OBJECT_DESTROYED
 *     else:
*/
    break;
    default:

    /* "EnumTypeToPy":14
 *         return __pyx_enum.OBJECT_DESTROYED
 *     else:
 *         underlying_c_val = <int>c_val             # <<<<<<<<<<<<<<
 *         return __pyx_enum(underlying_c_val)
*/
    __pyx_v_underlying_c_val = ((int)__pyx_v_c_val);

    /* "EnumTypeToPy":15
 *     else:
 *         underlying_c_val = <int>c_val
 *         return __pyx_enum(underlying_c_val)             # <<<<<<<<<<<<<<
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v___pyx_enum);
    __pyx_t_3 = __pyx_v___pyx_enum; 
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
  }

  /* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(ObjectTrackingEvent c_val):
 *     cdef object __pyx_enum
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_enum);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 *     cdef object __Pyx_PyObject_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", 0);

  /* "string.to_py":33
 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  __pyx_t_1 = (__pyx_v_s.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "string.to_py":34
 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
 * cdef extern from *:
*/
    PyErr_NoMemory(); __PYX_ERR(1, 34, __pyx_L1_error)

    /* "string.to_py":33
 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  }

  /* "string.to_py":35
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), <Py_ssize_t> s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), ((Py_ssize_t)__pyx_v_s.size())); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 *     cdef object __Pyx_PyObject_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":39
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", 0);

  /* "string.to_py":41
 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  __pyx_t_1 = (__pyx_v_s.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "string.to_py":42
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
 * cdef extern from *:
*/
    PyErr_NoMemory(); __PYX_ERR(1, 42, __pyx_L1_error)

    /* "string.to_py":41
 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  }

  /* "string.to_py":43
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), <Py_ssize_t> s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), ((Py_ssize_t)__pyx_v_s.size())); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "string.to_py":39
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":47
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", 0);

  /* "string.to_py":49
 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  __pyx_t_1 = (__pyx_v_s.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "string.to_py":50
 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
 * cdef extern from *:
*/
    PyErr_NoMemory(); __PYX_ERR(1, 50, __pyx_L1_error)

    /* "string.to_py":49
 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  }

  /* "string.to_py":51
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), <Py_ssize_t> s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), ((Py_ssize_t)__pyx_v_s.size())); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "string.to_py":47
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", 0);

  /* "string.to_py":57
 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  __pyx_t_1 = (__pyx_v_s.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "string.to_py":58
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
    PyErr_NoMemory(); __PYX_ERR(1, 58, __pyx_L1_error)

    /* "string.to_py":57
 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), <Py_ssize_t> s.size())
*/
  }

  /* "string.to_py":59
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), <Py_ssize_t> s.size())             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), ((Py_ssize_t)__pyx_v_s.size())); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
 *     if s.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":12
 *     cdef const char* __Pyx_PyObject_AsStringAndSize(object, Py_ssize_t*) except NULL
 * 
 * @cname("__pyx_convert_string_from_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
*/

static std::string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  char const *__pyx_t_1;
  std::string __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "string.from_py":14
 * @cname("__pyx_convert_string_from_py_6libcpp_6string_std__in_string")
 * cdef string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0             # <<<<<<<<<<<<<<
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, <size_t> length)
*/
  __pyx_v_length = 0;

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, <size_t> length)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, <size_t> length)             # <<<<<<<<<<<<<<
 * 
*/
  try {
    __pyx_t_2 = std::string(__pyx_v_data, ((size_t)__pyx_v_length));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(1, 16, __pyx_L1_error)
  }
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "string.from_py":12
 *     cdef const char* __Pyx_PyObject_AsStringAndSize(object, Py_ssize_t*) except NULL
 * 
 * @cname("__pyx_convert_string_from_py_6libcpp_6string_std__in_string")             # <<<<<<<<<<<<<<
 * cdef string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  return __pyx_r;
}

/* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0")
 * cdef object __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*f)(uint64_t, const char *) except *):
 *     def wrap(uint64_t arg0, const char * arg1):             # <<<<<<<<<<<<<<
 *         """wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'"""
 *         f(arg0, arg1)
*/

/* Python wrapper */
static PyObject *__pyx_pw_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_1wrap(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_wrap, "wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'");
static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_1wrap = {"wrap", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_1wrap, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_wrap};
static PyObject *__pyx_pw_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_1wrap(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  uint64_t __pyx_v_arg0;
  char const *__pyx_v_arg1;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arg0,&__pyx_mstate_global->__pyx_n_u_arg1,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 67, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 67, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 67, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wrap", 0) < (0)) __PYX_ERR(1, 67, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, i); __PYX_ERR(1, 67, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 67, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 67, __pyx_L3_error)
    }
    __pyx_v_arg0 = __Pyx_PyLong_As_uint64_t(values[0]); if (unlikely((__pyx_v_arg0 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L3_error)
    __pyx_v_arg1 = __Pyx_PyObject_AsString(values[1]); if (unlikely((!__pyx_v_arg1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wrap", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 67, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_wrap(__pyx_self, __pyx_v_arg0, __pyx_v_arg1);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_wrap(PyObject *__pyx_self, uint64_t __pyx_v_arg0, char const *__pyx_v_arg1) {
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *__pyx_cur_scope;
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap", 0);
  __pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cfunc.to_py":69
 *     def wrap(uint64_t arg0, const char * arg1):
 *         """wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'"""
 *         f(arg0, arg1)             # <<<<<<<<<<<<<<
 *     return wrap
 * 
*/
  __pyx_cur_scope->__pyx_v_f(__pyx_v_arg0, __pyx_v_arg1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 69, __pyx_L1_error)

  /* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0")
 * cdef object __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*f)(uint64_t, const char *) except *):
 *     def wrap(uint64_t arg0, const char * arg1):             # <<<<<<<<<<<<<<
 *         """wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'"""
 *         f(arg0, arg1)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cfunc.to_py":65
 * 
 * 
 * @cname("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0")             # <<<<<<<<<<<<<<
 * cdef object __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*f)(uint64_t, const char *) except *):
 *     def wrap(uint64_t arg0, const char * arg1):
*/

static PyObject *__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*__pyx_v_f)(uint64_t, char const *)) {
  struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *__pyx_cur_scope;
  PyObject *__pyx_v_wrap = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0", 0);
  __pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(__pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 65, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_f = __pyx_v_f;

  /* "cfunc.to_py":67
 * @cname("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0")
 * cdef object __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*f)(uint64_t, const char *) except *):
 *     def wrap(uint64_t arg0, const char * arg1):             # <<<<<<<<<<<<<<
 *         """wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'"""
 *         f(arg0, arg1)
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_81__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_1wrap, 0, __pyx_mstate_global->__pyx_n_u_Pyx_CFunc_e0b72e__7Tracker_voi, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_cfunc_to_py, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_wrap = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cfunc.to_py":70
 *         """wrap(arg0: 'uint64_t', arg1: 'const char *') -> 'void'"""
 *         f(arg0, arg1)
 *     return wrap             # <<<<<<<<<<<<<<
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_wrap);
  __pyx_r = __pyx_v_wrap;
  goto __pyx_L0;

  /* "cfunc.to_py":65
 * 
 * 
 * @cname("__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0")             # <<<<<<<<<<<<<<
 * cdef object __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(void (*f)(uint64_t, const char *) except *):
 *     def wrap(uint64_t arg0, const char * arg1):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_wrap);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(PythonAllocatorType c_val):
 *     cdef object __pyx_enum
*/

static PyObject *__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_PythonAllocatorType __pyx_v_c_val) {
  PyObject *__pyx_v___pyx_enum = 0;
  int __pyx_v_underlying_c_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", 0);

  /* "EnumTypeToPy":5
 * cdef __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(PythonAllocatorType c_val):
 *     cdef object __pyx_enum
 *     __pyx_enum = PythonAllocatorType             # <<<<<<<<<<<<<<
 * 
 *     if 0:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_PythonAllocatorType); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___pyx_enum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "EnumTypeToPy":7
 *     __pyx_enum = PythonAllocatorType
 * 
 *     if 0:             # <<<<<<<<<<<<<<
 *         pass
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC:
*/
  switch (__pyx_v_c_val) {
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC:

    /* "EnumTypeToPy":10
 *         pass
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG:
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC_DEBUG
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG:
*/
    break;
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC_DEBUG:

    /* "EnumTypeToPy":12
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG:
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC_DEBUG             # <<<<<<<<<<<<<<
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC_DEBUG); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":11
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC_DEBUG
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MALLOC:

    /* "EnumTypeToPy":14
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC_DEBUG
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_OTHER:
 *         return __pyx_enum.PYTHON_ALLOCATOR_OTHER
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":13
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG:
 *         return __pyx_enum.PYTHON_ALLOCATOR_PYMALLOC_DEBUG
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_MALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_OTHER:
*/
    break;
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_OTHER:

    /* "EnumTypeToPy":16
 *         return __pyx_enum.PYTHON_ALLOCATOR_MALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_OTHER:
 *         return __pyx_enum.PYTHON_ALLOCATOR_OTHER             # <<<<<<<<<<<<<<
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_OTHER); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":15
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_OTHER:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_OTHER
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC:
*/
    break;
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC:

    /* "EnumTypeToPy":18
 *         return __pyx_enum.PYTHON_ALLOCATOR_OTHER
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC             # <<<<<<<<<<<<<<
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC_DEBUG
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":17
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_OTHER:
 *         return __pyx_enum.PYTHON_ALLOCATOR_OTHER
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG:
*/
    break;
    case __pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC_DEBUG:

    /* "EnumTypeToPy":20
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC_DEBUG             # <<<<<<<<<<<<<<
 *     else:
 *         underlying_c_val = <int>c_val
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC_DEBUG); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":19
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC:
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC
 *     elif c_val == PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC_DEBUG
 *     else:
*/
    break;
    default:

    /* "EnumTypeToPy":22
 *         return __pyx_enum.PYTHON_ALLOCATOR_MIMALLOC_DEBUG
 *     else:
 *         underlying_c_val = <int>c_val             # <<<<<<<<<<<<<<
 *         return __pyx_enum(underlying_c_val)
*/
    __pyx_v_underlying_c_val = ((int)__pyx_v_c_val);

    /* "EnumTypeToPy":23
 *     else:
 *         underlying_c_val = <int>c_val
 *         return __pyx_enum(underlying_c_val)             # <<<<<<<<<<<<<<
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v___pyx_enum);
    __pyx_t_3 = __pyx_v___pyx_enum; 
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
  }

  /* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(PythonAllocatorType c_val):
 *     cdef object __pyx_enum
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_enum);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

static PyObject *__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(std::vector<struct memray::tracking_api::MemorySnapshot>  const &__pyx_v_v) {
  Py_ssize_t __pyx_v_v_size_signed;
  PyObject *__pyx_v_o = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", 0);

  /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "vector.to_py":82
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)

    /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  }

  /* "vector.to_py":83
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()             # <<<<<<<<<<<<<<
 * 
 *     o = PyList_New(v_size_signed)
*/
  __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size());

  /* "vector.to_py":85
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
 *     o = PyList_New(v_size_signed)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t i
*/
  __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_o = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "vector.to_py":90
 *     cdef object item
 * 
 *     for i in range(v_size_signed):             # <<<<<<<<<<<<<<
 *         item = v[i]
 *         Py_INCREF(item)
*/
  __pyx_t_3 = __pyx_v_v_size_signed;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "vector.to_py":91
 * 
 *     for i in range(v_size_signed):
 *         item = v[i]             # <<<<<<<<<<<<<<
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)
*/
    __pyx_t_2 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "vector.to_py":92
 *     for i in range(v_size_signed):
 *         item = v[i]
 *         Py_INCREF(item)             # <<<<<<<<<<<<<<
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
*/
    Py_INCREF(__pyx_v_item);

    /* "vector.to_py":93
 *         item = v[i]
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)             # <<<<<<<<<<<<<<
 * 
 *     return o
*/
    __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error)
  }

  /* "vector.to_py":95
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
 *     return o             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "FromPyStructUtility":11
 *     int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0
 * 
 * @cname("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(obj) except *:
 *     cdef struct_type result
*/

static struct memray::tracking_api::MemorySnapshot __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(PyObject *__pyx_v_obj) {
  struct memray::tracking_api::MemorySnapshot __pyx_v_result;
  PyObject *__pyx_v_value = NULL;
  struct memray::tracking_api::MemorySnapshot __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  uint64_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", 0);

  /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj));
  if (__pyx_t_1) {

    /* "FromPyStructUtility":15
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(__pyx_k_a_mapping, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error)

    /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  }

  /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['ms_since_epoch']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "FromPyStructUtility":18
 * 
 *     try:
 *         value = obj['ms_since_epoch']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
*/
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_ms_since_epoch); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_value = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['ms_since_epoch']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "FromPyStructUtility":19
 *     try:
 *         value = obj['ms_since_epoch']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
 *     result.ms_since_epoch = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "FromPyStructUtility":20
 *         value = obj['ms_since_epoch']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")             # <<<<<<<<<<<<<<
 *     result.ms_since_epoch = value
 *     try:
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 20, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;

    /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['ms_since_epoch']
 *     except KeyError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "FromPyStructUtility":21
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
 *     result.ms_since_epoch = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['rss']
*/
  __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error)
  __pyx_v_result.ms_since_epoch = __pyx_t_12;

  /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
 *     result.ms_since_epoch = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['rss']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "FromPyStructUtility":23
 *     result.ms_since_epoch = value
 *     try:
 *         value = obj['rss']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'rss'")
*/
      __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_rss); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
 *     result.ms_since_epoch = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['rss']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L17_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "FromPyStructUtility":24
 *     try:
 *         value = obj['rss']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'rss'")
 *     result.rss = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "FromPyStructUtility":25
 *         value = obj['rss']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'rss'")             # <<<<<<<<<<<<<<
 *     result.rss = value
 *     try:
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_2};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 25, __pyx_L14_except_error)
    }
    goto __pyx_L14_except_error;

    /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'ms_since_epoch'")
 *     result.ms_since_epoch = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['rss']
 *     except KeyError:
*/
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L17_try_end:;
  }

  /* "FromPyStructUtility":26
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'rss'")
 *     result.rss = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['heap']
*/
  __pyx_t_11 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_v_result.rss = __pyx_t_11;

  /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'rss'")
 *     result.rss = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['heap']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "FromPyStructUtility":28
 *     result.rss = value
 *     try:
 *         value = obj['heap']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'heap'")
*/
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_heap); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 28, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'rss'")
 *     result.rss = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['heap']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L25_try_end;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "FromPyStructUtility":29
 *     try:
 *         value = obj['heap']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'heap'")
 *     result.heap = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 29, __pyx_L22_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "FromPyStructUtility":30
 *         value = obj['heap']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'heap'")             # <<<<<<<<<<<<<<
 *     result.heap = value
 *     return result
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_3};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 30, __pyx_L22_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 30, __pyx_L22_except_error)
    }
    goto __pyx_L22_except_error;

    /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'rss'")
 *     result.rss = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['heap']
 *     except KeyError:
*/
    __pyx_L22_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L25_try_end:;
  }

  /* "FromPyStructUtility":31
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'heap'")
 *     result.heap = value             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_11 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error)
  __pyx_v_result.heap = __pyx_t_11;

  /* "FromPyStructUtility":32
 *         raise ValueError("No value specified for struct attribute 'heap'")
 *     result.heap = value
 *     return result             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "FromPyStructUtility":11
 *     int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0
 * 
 * @cname("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(obj) except *:
 *     cdef struct_type result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(FileFormat c_val):
 *     cdef object __pyx_enum
*/

static PyObject *__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(enum __pyx_t_6memray_7_memray_FileFormat __pyx_v_c_val) {
  PyObject *__pyx_v___pyx_enum = 0;
  int __pyx_v_underlying_c_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py", 0);

  /* "EnumTypeToPy":5
 * cdef __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(FileFormat c_val):
 *     cdef object __pyx_enum
 *     __pyx_enum = FileFormat             # <<<<<<<<<<<<<<
 * 
 *     if 0:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FileFormat); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___pyx_enum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == FileFormat.ALL_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.ALL_ALLOCATIONS
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_2 = (__pyx_v_c_val == __pyx_e_6memray_7_memray_ALL_ALLOCATIONS);
  if (__pyx_t_2) {

    /* "EnumTypeToPy":10
 *         pass
 *     elif c_val == FileFormat.ALL_ALLOCATIONS:
 *         return __pyx_enum.ALL_ALLOCATIONS             # <<<<<<<<<<<<<<
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:
 *         return __pyx_enum.AGGREGATED_ALLOCATIONS
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_ALL_ALLOCATIONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == FileFormat.ALL_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.ALL_ALLOCATIONS
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  }

  /* "EnumTypeToPy":11
 *     elif c_val == FileFormat.ALL_ALLOCATIONS:
 *         return __pyx_enum.ALL_ALLOCATIONS
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.AGGREGATED_ALLOCATIONS
 *     else:
*/
  __pyx_t_2 = (__pyx_v_c_val == __pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS);
  if (__pyx_t_2) {

    /* "EnumTypeToPy":12
 *         return __pyx_enum.ALL_ALLOCATIONS
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:
 *         return __pyx_enum.AGGREGATED_ALLOCATIONS             # <<<<<<<<<<<<<<
 *     else:
 *         underlying_c_val = <int>c_val
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":11
 *     elif c_val == FileFormat.ALL_ALLOCATIONS:
 *         return __pyx_enum.ALL_ALLOCATIONS
 *     elif c_val == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.AGGREGATED_ALLOCATIONS
 *     else:
*/
  }

  /* "EnumTypeToPy":14
 *         return __pyx_enum.AGGREGATED_ALLOCATIONS
 *     else:
 *         underlying_c_val = <int>c_val             # <<<<<<<<<<<<<<
 *         return __pyx_enum(underlying_c_val)
*/
  /*else*/ {
    __pyx_v_underlying_c_val = ((int)__pyx_v_c_val);

    /* "EnumTypeToPy":15
 *     else:
 *         underlying_c_val = <int>c_val
 *         return __pyx_enum(underlying_c_val)             # <<<<<<<<<<<<<<
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v___pyx_enum);
    __pyx_t_4 = __pyx_v___pyx_enum; 
    __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(FileFormat c_val):
 *     cdef object __pyx_enum
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_enum);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_size_t")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_size_t(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

static PyObject *__pyx_convert_vector_to_py_size_t(std::vector<size_t>  const &__pyx_v_v) {
  Py_ssize_t __pyx_v_v_size_signed;
  PyObject *__pyx_v_o = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_size_t", 0);

  /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_size_t")
 * cdef object __pyx_convert_vector_to_py_size_t(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "vector.to_py":82
 * cdef object __pyx_convert_vector_to_py_size_t(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)

    /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_size_t")
 * cdef object __pyx_convert_vector_to_py_size_t(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  }

  /* "vector.to_py":83
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()             # <<<<<<<<<<<<<<
 * 
 *     o = PyList_New(v_size_signed)
*/
  __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size());

  /* "vector.to_py":85
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
 *     o = PyList_New(v_size_signed)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t i
*/
  __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_o = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "vector.to_py":90
 *     cdef object item
 * 
 *     for i in range(v_size_signed):             # <<<<<<<<<<<<<<
 *         item = v[i]
 *         Py_INCREF(item)
*/
  __pyx_t_3 = __pyx_v_v_size_signed;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "vector.to_py":91
 * 
 *     for i in range(v_size_signed):
 *         item = v[i]             # <<<<<<<<<<<<<<
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)
*/
    __pyx_t_2 = __Pyx_PyLong_FromSize_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "vector.to_py":92
 *     for i in range(v_size_signed):
 *         item = v[i]
 *         Py_INCREF(item)             # <<<<<<<<<<<<<<
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
*/
    Py_INCREF(__pyx_v_item);

    /* "vector.to_py":93
 *         item = v[i]
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)             # <<<<<<<<<<<<<<
 * 
 *     return o
*/
    __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error)
  }

  /* "vector.to_py":95
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
 *     return o             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_size_t")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_size_t(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_size_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.to_py":245
 *         const_iterator end()
 * 
 * @cname("__pyx_convert_unordered_map_to_py_int____uint64_t")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_unordered_map_to_py_int____uint64_t(const map[X,Y]& s):
 *     o = {}
*/

static PyObject *__pyx_convert_unordered_map_to_py_int____uint64_t(std::unordered_map<int,uint64_t>  const &__pyx_v_s) {
  PyObject *__pyx_v_o = NULL;
  std::unordered_map<int,uint64_t> ::value_type const *__pyx_v_key_value;
  std::unordered_map<int,uint64_t> ::const_iterator __pyx_v_iter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_int____uint64_t", 0);

  /* "map.to_py":247
 * @cname("__pyx_convert_unordered_map_to_py_int____uint64_t")
 * cdef object __pyx_convert_unordered_map_to_py_int____uint64_t(const map[X,Y]& s):
 *     o = {}             # <<<<<<<<<<<<<<
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_o = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.to_py":249
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()             # <<<<<<<<<<<<<<
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
*/
  __pyx_v_iter = __pyx_v_s.begin();

  /* "map.to_py":250
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():             # <<<<<<<<<<<<<<
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_iter != __pyx_v_s.end());
    if (!__pyx_t_2) break;

    /* "map.to_py":251
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)             # <<<<<<<<<<<<<<
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
*/
    __pyx_v_key_value = (&(*__pyx_v_iter));

    /* "map.to_py":252
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second             # <<<<<<<<<<<<<<
 *         cython.operator.preincrement(iter)
 *     return o
*/
    __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely((PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0))) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "map.to_py":253
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
 *     return o
 * 
*/
    (void)((++__pyx_v_iter));
  }

  /* "map.to_py":254
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 *     return o             # <<<<<<<<<<<<<<
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "map.to_py":245
 *         const_iterator end()
 * 
 * @cname("__pyx_convert_unordered_map_to_py_int____uint64_t")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_unordered_map_to_py_int____uint64_t(const map[X,Y]& s):
 *     o = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_int____uint64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_unordered_map_to_py_size_t____uint64_t(std::unordered_map<size_t,uint64_t>  const &__pyx_v_s) {
  PyObject *__pyx_v_o = NULL;
  std::unordered_map<size_t,uint64_t> ::value_type const *__pyx_v_key_value;
  std::unordered_map<size_t,uint64_t> ::const_iterator __pyx_v_iter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_size_t____uint64_t", 0);

  /* "map.to_py":247
 * @cname("__pyx_convert_unordered_map_to_py_size_t____uint64_t")
 * cdef object __pyx_convert_unordered_map_to_py_size_t____uint64_t(const map[X,Y]& s):
 *     o = {}             # <<<<<<<<<<<<<<
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_o = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.to_py":249
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()             # <<<<<<<<<<<<<<
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
*/
  __pyx_v_iter = __pyx_v_s.begin();

  /* "map.to_py":250
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():             # <<<<<<<<<<<<<<
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
*/
  while (1) {
    __pyx_t_2 = (__pyx_v_iter != __pyx_v_s.end());
    if (!__pyx_t_2) break;

    /* "map.to_py":251
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)             # <<<<<<<<<<<<<<
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
*/
    __pyx_v_key_value = (&(*__pyx_v_iter));

    /* "map.to_py":252
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second             # <<<<<<<<<<<<<<
 *         cython.operator.preincrement(iter)
 *     return o
*/
    __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyLong_FromSize_t(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely((PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0))) __PYX_ERR(1, 252, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "map.to_py":253
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
 *     return o
 * 
*/
    (void)((++__pyx_v_iter));
  }

  /* "map.to_py":254
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 *     return o             # <<<<<<<<<<<<<<
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "map.to_py":245
 *         const_iterator end()
 * 
 * @cname("__pyx_convert_unordered_map_to_py_size_t____uint64_t")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_unordered_map_to_py_size_t____uint64_t(const map[X,Y]& s):
 *     o = {}
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_size_t____uint64_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(SymbolicSupport c_val):
 *     cdef object __pyx_enum
*/

static PyObject *__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(enum __pyx_t_6memray_7_memray_SymbolicSupport __pyx_v_c_val) {
  PyObject *__pyx_v___pyx_enum = 0;
  int __pyx_v_underlying_c_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", 0);

  /* "EnumTypeToPy":5
 * cdef __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(SymbolicSupport c_val):
 *     cdef object __pyx_enum
 *     __pyx_enum = SymbolicSupport             # <<<<<<<<<<<<<<
 * 
 *     if 0:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_SymbolicSupport); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___pyx_enum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "EnumTypeToPy":7
 *     __pyx_enum = SymbolicSupport
 * 
 *     if 0:             # <<<<<<<<<<<<<<
 *         pass
 *     elif c_val == SymbolicSupport.NONE:
*/
  switch (__pyx_v_c_val) {
    case __pyx_e_6memray_7_memray_NONE:

    /* "EnumTypeToPy":10
 *         pass
 *     elif c_val == SymbolicSupport.NONE:
 *         return __pyx_enum.NONE             # <<<<<<<<<<<<<<
 *     elif c_val == SymbolicSupport.FUNCTION_NAME_ONLY:
 *         return __pyx_enum.FUNCTION_NAME_ONLY
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":9
 *     if 0:
 *         pass
 *     elif c_val == SymbolicSupport.NONE:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.NONE
 *     elif c_val == SymbolicSupport.FUNCTION_NAME_ONLY:
*/
    break;
    case __pyx_e_6memray_7_memray_FUNCTION_NAME_ONLY:

    /* "EnumTypeToPy":12
 *         return __pyx_enum.NONE
 *     elif c_val == SymbolicSupport.FUNCTION_NAME_ONLY:
 *         return __pyx_enum.FUNCTION_NAME_ONLY             # <<<<<<<<<<<<<<
 *     elif c_val == SymbolicSupport.TOTAL:
 *         return __pyx_enum.TOTAL
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_FUNCTION_NAME_ONLY); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":11
 *     elif c_val == SymbolicSupport.NONE:
 *         return __pyx_enum.NONE
 *     elif c_val == SymbolicSupport.FUNCTION_NAME_ONLY:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.FUNCTION_NAME_ONLY
 *     elif c_val == SymbolicSupport.TOTAL:
*/
    break;
    case __pyx_e_6memray_7_memray_TOTAL:

    /* "EnumTypeToPy":14
 *         return __pyx_enum.FUNCTION_NAME_ONLY
 *     elif c_val == SymbolicSupport.TOTAL:
 *         return __pyx_enum.TOTAL             # <<<<<<<<<<<<<<
 *     else:
 *         underlying_c_val = <int>c_val
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_TOTAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "EnumTypeToPy":13
 *     elif c_val == SymbolicSupport.FUNCTION_NAME_ONLY:
 *         return __pyx_enum.FUNCTION_NAME_ONLY
 *     elif c_val == SymbolicSupport.TOTAL:             # <<<<<<<<<<<<<<
 *         return __pyx_enum.TOTAL
 *     else:
*/
    break;
    default:

    /* "EnumTypeToPy":16
 *         return __pyx_enum.TOTAL
 *     else:
 *         underlying_c_val = <int>c_val             # <<<<<<<<<<<<<<
 *         return __pyx_enum(underlying_c_val)
*/
    __pyx_v_underlying_c_val = ((int)__pyx_v_c_val);

    /* "EnumTypeToPy":17
 *     else:
 *         underlying_c_val = <int>c_val
 *         return __pyx_enum(underlying_c_val)             # <<<<<<<<<<<<<<
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v___pyx_enum);
    __pyx_t_3 = __pyx_v___pyx_enum; 
    __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
  }

  /* "EnumTypeToPy":2
 * 
 * @cname("__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py")             # <<<<<<<<<<<<<<
 * cdef __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(SymbolicSupport c_val):
 *     cdef object __pyx_enum
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_enum);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "FromPyStructUtility":11
 *     int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0
 * 
 * @cname("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")             # <<<<<<<<<<<<<<
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(obj) except *:
 *     cdef struct_type result
*/

static struct memray::tracking_api::Segment __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(PyObject *__pyx_v_obj) {
  struct memray::tracking_api::Segment __pyx_v_result;
  PyObject *__pyx_v_value = NULL;
  struct memray::tracking_api::Segment __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  uintptr_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", 0);

  /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj));
  if (__pyx_t_1) {

    /* "FromPyStructUtility":15
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(__pyx_k_a_mapping, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error)

    /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  }

  /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['vaddr']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "FromPyStructUtility":18
 * 
 *     try:
 *         value = obj['vaddr']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
*/
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_vaddr); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_value = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['vaddr']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "FromPyStructUtility":19
 *     try:
 *         value = obj['vaddr']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
 *     result.vaddr = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "FromPyStructUtility":20
 *         value = obj['vaddr']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'vaddr'")             # <<<<<<<<<<<<<<
 *     result.vaddr = value
 *     try:
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_4};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 20, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;

    /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['vaddr']
 *     except KeyError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "FromPyStructUtility":21
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
 *     result.vaddr = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['memsz']
*/
  __pyx_t_12 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error)
  __pyx_v_result.vaddr = __pyx_t_12;

  /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
 *     result.vaddr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['memsz']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "FromPyStructUtility":23
 *     result.vaddr = value
 *     try:
 *         value = obj['memsz']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'memsz'")
*/
      __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_memsz); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
 *     result.vaddr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['memsz']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L17_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "FromPyStructUtility":24
 *     try:
 *         value = obj['memsz']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'memsz'")
 *     result.memsz = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "FromPyStructUtility":25
 *         value = obj['memsz']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'memsz'")             # <<<<<<<<<<<<<<
 *     result.memsz = value
 *     return result
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_5};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 25, __pyx_L14_except_error)
    }
    goto __pyx_L14_except_error;

    /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'vaddr'")
 *     result.vaddr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['memsz']
 *     except KeyError:
*/
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L17_try_end:;
  }

  /* "FromPyStructUtility":26
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'memsz'")
 *     result.memsz = value             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_11 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_v_result.memsz = __pyx_t_11;

  /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'memsz'")
 *     result.memsz = value
 *     return result             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "FromPyStructUtility":11
 *     int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0
 * 
 * @cname("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")             # <<<<<<<<<<<<<<
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(obj) except *:
 *     cdef struct_type result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static struct memray::tracking_api::ImageSegments __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(PyObject *__pyx_v_obj) {
  struct memray::tracking_api::ImageSegments __pyx_v_result;
  PyObject *__pyx_v_value = NULL;
  struct memray::tracking_api::ImageSegments __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  std::string __pyx_t_12;
  uintptr_t __pyx_t_13;
  std::vector<struct memray::tracking_api::Segment>  __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", 0);

  /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj));
  if (__pyx_t_1) {

    /* "FromPyStructUtility":15
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)             # <<<<<<<<<<<<<<
 * 
 *     try:
*/
    __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(__pyx_k_a_mapping, __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error)

    /* "FromPyStructUtility":14
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(obj) except *:
 *     cdef struct_type result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
*/
  }

  /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['filename']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "FromPyStructUtility":18
 * 
 *     try:
 *         value = obj['filename']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'filename'")
*/
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_filename); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_value = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['filename']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "FromPyStructUtility":19
 *     try:
 *         value = obj['filename']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'filename'")
 *     result.filename = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "FromPyStructUtility":20
 *         value = obj['filename']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'filename'")             # <<<<<<<<<<<<<<
 *     result.filename = value
 *     try:
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_6};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 20, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;

    /* "FromPyStructUtility":17
 *         __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['filename']
 *     except KeyError:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "FromPyStructUtility":21
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'filename'")
 *     result.filename = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['addr']
*/
  __pyx_t_12 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error)
  __pyx_v_result.filename = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12);

  /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'filename'")
 *     result.filename = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['addr']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "FromPyStructUtility":23
 *     result.filename = value
 *     try:
 *         value = obj['addr']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'addr'")
*/
      __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_addr); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'filename'")
 *     result.filename = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['addr']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L17_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "FromPyStructUtility":24
 *     try:
 *         value = obj['addr']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'addr'")
 *     result.addr = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error)
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);

      /* "FromPyStructUtility":25
 *         value = obj['addr']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'addr'")             # <<<<<<<<<<<<<<
 *     result.addr = value
 *     try:
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_7};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 25, __pyx_L14_except_error)
    }
    goto __pyx_L14_except_error;

    /* "FromPyStructUtility":22
 *         raise ValueError("No value specified for struct attribute 'filename'")
 *     result.filename = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['addr']
 *     except KeyError:
*/
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L17_try_end:;
  }

  /* "FromPyStructUtility":26
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'addr'")
 *     result.addr = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['segments']
*/
  __pyx_t_13 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_13 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_v_result.addr = __pyx_t_13;

  /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'addr'")
 *     result.addr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['segments']
 *     except KeyError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "FromPyStructUtility":28
 *     result.addr = value
 *     try:
 *         value = obj['segments']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'segments'")
*/
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_segments); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 28, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'addr'")
 *     result.addr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['segments']
 *     except KeyError:
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L25_try_end;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "FromPyStructUtility":29
 *     try:
 *         value = obj['segments']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'segments'")
 *     result.segments = value
*/
    __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError))));
    if (__pyx_t_2) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 29, __pyx_L22_except_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);

      /* "FromPyStructUtility":30
 *         value = obj['segments']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'segments'")             # <<<<<<<<<<<<<<
 *     result.segments = value
 *     return result
*/
      __pyx_t_10 = NULL;
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_8};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 30, __pyx_L22_except_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(1, 30, __pyx_L22_except_error)
    }
    goto __pyx_L22_except_error;

    /* "FromPyStructUtility":27
 *         raise ValueError("No value specified for struct attribute 'addr'")
 *     result.addr = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['segments']
 *     except KeyError:
*/
    __pyx_L22_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L25_try_end:;
  }

  /* "FromPyStructUtility":31
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'segments'")
 *     result.segments = value             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
  __pyx_t_14 = __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error)
  __pyx_v_result.segments = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_14);

  /* "FromPyStructUtility":32
 *         raise ValueError("No value specified for struct attribute 'segments'")
 *     result.segments = value
 *     return result             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "FromPyStructUtility":11
 *     int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0
 * 
 * @cname("__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments")             # <<<<<<<<<<<<<<
 * cdef struct_type __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(obj) except *:
 *     cdef struct_type result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

static PyObject *__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(std::vector<struct memray::tracking_api::Segment>  const &__pyx_v_v) {
  Py_ssize_t __pyx_v_v_size_signed;
  PyObject *__pyx_v_o = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", 0);

  /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX));
  if (unlikely(__pyx_t_1)) {

    /* "vector.to_py":82
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
*/
    PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)

    /* "vector.to_py":81
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()
*/
  }

  /* "vector.to_py":83
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
 *         raise MemoryError()
 *     v_size_signed = <Py_ssize_t> v.size()             # <<<<<<<<<<<<<<
 * 
 *     o = PyList_New(v_size_signed)
*/
  __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size());

  /* "vector.to_py":85
 *     v_size_signed = <Py_ssize_t> v.size()
 * 
 *     o = PyList_New(v_size_signed)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t i
*/
  __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_o = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "vector.to_py":90
 *     cdef object item
 * 
 *     for i in range(v_size_signed):             # <<<<<<<<<<<<<<
 *         item = v[i]
 *         Py_INCREF(item)
*/
  __pyx_t_3 = __pyx_v_v_size_signed;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "vector.to_py":91
 * 
 *     for i in range(v_size_signed):
 *         item = v[i]             # <<<<<<<<<<<<<<
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)
*/
    __pyx_t_2 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "vector.to_py":92
 *     for i in range(v_size_signed):
 *         item = v[i]
 *         Py_INCREF(item)             # <<<<<<<<<<<<<<
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
*/
    Py_INCREF(__pyx_v_item);

    /* "vector.to_py":93
 *         item = v[i]
 *         Py_INCREF(item)
 *         __Pyx_PyList_SET_ITEM(o, i, item)             # <<<<<<<<<<<<<<
 * 
 *     return o
*/
    __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error)
  }

  /* "vector.to_py":95
 *         __Pyx_PyList_SET_ITEM(o, i, item)
 * 
 *     return o             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "vector.to_py":79
 *     const Py_ssize_t PY_SSIZE_T_MAX
 * 
 * @cname("__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")             # <<<<<<<<<<<<<<
 * cdef object __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(const vector[X]& v):
 *     if v.size() > <size_t> PY_SSIZE_T_MAX:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":51
 *     cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1
 * 
 * @cname("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef vector[X] __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(object o) except *:
 * 
*/

static std::vector<struct memray::tracking_api::MemorySnapshot>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(PyObject *__pyx_v_o) {
  std::vector<struct memray::tracking_api::MemorySnapshot>  __pyx_v_v;
  Py_ssize_t __pyx_v_s;
  PyObject *__pyx_v_item = NULL;
  std::vector<struct memray::tracking_api::MemorySnapshot>  __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  struct memray::tracking_api::MemorySnapshot __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", 0);

  /* "vector.from_py":55
 * 
 *     cdef vector[X] v
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)             # <<<<<<<<<<<<<<
 * 
 *     if s > 0:
*/
  __pyx_t_1 = __Pyx_PyObject_LengthHint(__pyx_v_o, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L))) __PYX_ERR(1, 55, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  __pyx_t_2 = (__pyx_v_s > 0);
  if (__pyx_t_2) {

    /* "vector.from_py":58
 * 
 *     if s > 0:
 *         v.reserve(<size_t> s)             # <<<<<<<<<<<<<<
 * 
 *     for item in o:
*/
    try {
      __pyx_v_v.reserve(((size_t)__pyx_v_s));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 58, __pyx_L1_error)
    }

    /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  }

  /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 60, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_1;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_1);
        #endif
        ++__pyx_t_1;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 60, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 60, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "vector.from_py":61
 * 
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 * 
 *     return v
*/
    __pyx_t_6 = __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L1_error)
    try {
      __pyx_v_v.push_back(__pyx_t_6);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 61, __pyx_L1_error)
    }

    /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "vector.from_py":63
 *         v.push_back(<X>item)
 * 
 *     return v             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":51
 *     cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1
 * 
 * @cname("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot")             # <<<<<<<<<<<<<<
 * cdef vector[X] __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(object o) except *:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::vector<struct memray::tracking_api::Segment>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(PyObject *__pyx_v_o) {
  std::vector<struct memray::tracking_api::Segment>  __pyx_v_v;
  Py_ssize_t __pyx_v_s;
  PyObject *__pyx_v_item = NULL;
  std::vector<struct memray::tracking_api::Segment>  __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  struct memray::tracking_api::Segment __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", 0);

  /* "vector.from_py":55
 * 
 *     cdef vector[X] v
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)             # <<<<<<<<<<<<<<
 * 
 *     if s > 0:
*/
  __pyx_t_1 = __Pyx_PyObject_LengthHint(__pyx_v_o, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L))) __PYX_ERR(1, 55, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  __pyx_t_2 = (__pyx_v_s > 0);
  if (__pyx_t_2) {

    /* "vector.from_py":58
 * 
 *     if s > 0:
 *         v.reserve(<size_t> s)             # <<<<<<<<<<<<<<
 * 
 *     for item in o:
*/
    try {
      __pyx_v_v.reserve(((size_t)__pyx_v_s));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 58, __pyx_L1_error)
    }

    /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  }

  /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 60, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_1;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_1);
        #endif
        ++__pyx_t_1;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 60, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 60, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "vector.from_py":61
 * 
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 * 
 *     return v
*/
    __pyx_t_6 = __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L1_error)
    try {
      __pyx_v_v.push_back(__pyx_t_6);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 61, __pyx_L1_error)
    }

    /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "vector.from_py":63
 *         v.push_back(<X>item)
 * 
 *     return v             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":51
 *     cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1
 * 
 * @cname("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment")             # <<<<<<<<<<<<<<
 * cdef vector[X] __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(object o) except *:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::vector<struct memray::tracking_api::ImageSegments>  __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(PyObject *__pyx_v_o) {
  std::vector<struct memray::tracking_api::ImageSegments>  __pyx_v_v;
  Py_ssize_t __pyx_v_s;
  PyObject *__pyx_v_item = NULL;
  std::vector<struct memray::tracking_api::ImageSegments>  __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  struct memray::tracking_api::ImageSegments __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", 0);

  /* "vector.from_py":55
 * 
 *     cdef vector[X] v
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)             # <<<<<<<<<<<<<<
 * 
 *     if s > 0:
*/
  __pyx_t_1 = __Pyx_PyObject_LengthHint(__pyx_v_o, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L))) __PYX_ERR(1, 55, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  __pyx_t_2 = (__pyx_v_s > 0);
  if (__pyx_t_2) {

    /* "vector.from_py":58
 * 
 *     if s > 0:
 *         v.reserve(<size_t> s)             # <<<<<<<<<<<<<<
 * 
 *     for item in o:
*/
    try {
      __pyx_v_v.reserve(((size_t)__pyx_v_s));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 58, __pyx_L1_error)
    }

    /* "vector.from_py":57
 *     cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0)
 * 
 *     if s > 0:             # <<<<<<<<<<<<<<
 *         v.reserve(<size_t> s)
 * 
*/
  }

  /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 60, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_1;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error)
          #endif
          if (__pyx_t_1 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_1);
        #endif
        ++__pyx_t_1;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 60, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 60, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "vector.from_py":61
 * 
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 * 
 *     return v
*/
    __pyx_t_6 = __pyx_convert__from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L1_error)
    try {
      __pyx_v_v.push_back(__pyx_t_6);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 61, __pyx_L1_error)
    }

    /* "vector.from_py":60
 *         v.reserve(<size_t> s)
 * 
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "vector.from_py":63
 *         v.push_back(<X>item)
 * 
 *     return v             # <<<<<<<<<<<<<<
 * 
*/
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":51
 *     cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1
 * 
 * @cname("__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments")             # <<<<<<<<<<<<<<
 * cdef vector[X] __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(object o) except *:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":23
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         # unavailable in limited API
*/
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":29
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
 *             return self.cval.imag             # <<<<<<<<<<<<<<
 * 
 *     # PyTypeObject PyComplex_Type
*/
  __pyx_r = __pyx_v_self->cval.imag;
  goto __pyx_L0;

  /* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":121
 *     or None if no such value or default was found.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":122
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)             # <<<<<<<<<<<<<<
 *     if value is NULL:
 *         # context variable does not have a default
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 122, __pyx_L1_error)

  /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
  __pyx_t_2 = (__pyx_v_value == NULL);
  if (__pyx_t_2) {

    /* "cpython/contextvars.pxd":125
 *     if value is NULL:
 *         # context variable does not have a default
 *         pyvalue = default_value             # <<<<<<<<<<<<<<
 *     else:
 *         # value or default value of context variable
*/
    __Pyx_INCREF(__pyx_v_default_value);
    __pyx_v_pyvalue = __pyx_v_default_value;

    /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
    goto __pyx_L3;
  }

  /* "cpython/contextvars.pxd":128
 *     else:
 *         # value or default value of context variable
 *         pyvalue = <object>value             # <<<<<<<<<<<<<<
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_value);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_pyvalue = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cpython/contextvars.pxd":129
 *         # value or default value of context variable
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
 * 
*/
    Py_XDECREF(__pyx_v_value);
  }
  __pyx_L3:;

  /* "cpython/contextvars.pxd":130
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_no_default", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":140
 *     Ignores the default value of the context variable, if any.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":141
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)             # <<<<<<<<<<<<<<
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 141, __pyx_L1_error)

  /* "cpython/contextvars.pxd":143
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value             # <<<<<<<<<<<<<<
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_value);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pyvalue = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cpython/contextvars.pxd":144
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
*/
  Py_XDECREF(__pyx_v_value);

  /* "cpython/contextvars.pxd":145
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "memray/_memray.pyx":102
 * 
 * 
 * def set_log_level(int level):             # <<<<<<<<<<<<<<
 *     """Configure which log messages will be printed to stderr by memray.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_1set_log_level(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_set_log_level, "set_log_level(int level)\n\nConfigure which log messages will be printed to stderr by memray.\n\nBy default, only log records of severity `logging.WARNING` or higher will\nbe printed, but you can adjust this threshold.\n\nArgs:\n    level (int): The lowest severity level that a log record can have and\n        still be printed.");
static PyMethodDef __pyx_mdef_6memray_7_memray_1set_log_level = {"set_log_level", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_1set_log_level, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_set_log_level};
static PyObject *__pyx_pw_6memray_7_memray_1set_log_level(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_level;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_log_level (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_level,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 102, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 102, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_log_level", 0) < (0)) __PYX_ERR(0, 102, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_log_level", 1, 1, 1, i); __PYX_ERR(0, 102, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 102, __pyx_L3_error)
    }
    __pyx_v_level = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_log_level", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 102, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.set_log_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_set_log_level(__pyx_self, __pyx_v_level);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_set_log_level(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_level) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_log_level", 0);

  /* "memray/_memray.pyx":112
 *             still be printed.
 *     """
 *     setLogThreshold(level)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  memray::setLogThreshold(__pyx_v_level);

  /* "memray/_memray.pyx":102
 * 
 * 
 * def set_log_level(int level):             # <<<<<<<<<<<<<<
 *     """Configure which log messages will be printed to stderr by memray.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":151
 * 
 * 
 * def size_fmt(num, suffix='B'):             # <<<<<<<<<<<<<<
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_3size_fmt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_2size_fmt, "size_fmt(num, suffix='B')");
static PyMethodDef __pyx_mdef_6memray_7_memray_3size_fmt = {"size_fmt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_3size_fmt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_2size_fmt};
static PyObject *__pyx_pw_6memray_7_memray_3size_fmt(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_num = 0;
  PyObject *__pyx_v_suffix = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size_fmt (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_num,&__pyx_mstate_global->__pyx_n_u_suffix,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "size_fmt", 0) < (0)) __PYX_ERR(0, 151, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_B)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("size_fmt", 0, 1, 2, i); __PYX_ERR(0, 151, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_B)));
    }
    __pyx_v_num = values[0];
    __pyx_v_suffix = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("size_fmt", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 151, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.size_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_2size_fmt(__pyx_self, __pyx_v_num, __pyx_v_suffix);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_2size_fmt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num, PyObject *__pyx_v_suffix) {
  PyObject *__pyx_v_unit = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("size_fmt", 0);
  __Pyx_INCREF(__pyx_v_num);

  /* "memray/_memray.pyx":152
 * 
 * def size_fmt(num, suffix='B'):
 *     for unit in ['','k','M','G','T','P','E','Z']:             # <<<<<<<<<<<<<<
 *         if abs(num) < 1000.0:
 *             return f"{num:5.3f}{unit}{suffix}"
*/
  __pyx_t_1 = __pyx_mstate_global->__pyx_tuple[0]; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= 8) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_unit, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "memray/_memray.pyx":153
 * def size_fmt(num, suffix='B'):
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:             # <<<<<<<<<<<<<<
 *             return f"{num:5.3f}{unit}{suffix}"
 *         num /= 1000.0
*/
    __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_mstate_global->__pyx_float_1000_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "memray/_memray.pyx":154
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:
 *             return f"{num:5.3f}{unit}{suffix}"             # <<<<<<<<<<<<<<
 *         num /= 1000.0
 *     return f"{num:.1f}Y{suffix}"
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_Format(__pyx_v_num, __pyx_mstate_global->__pyx_kp_u_5_3f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_unit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_suffix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7[0] = __pyx_t_4;
      __pyx_t_7[1] = __pyx_t_3;
      __pyx_t_7[2] = __pyx_t_6;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "memray/_memray.pyx":153
 * def size_fmt(num, suffix='B'):
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:             # <<<<<<<<<<<<<<
 *             return f"{num:5.3f}{unit}{suffix}"
 *         num /= 1000.0
*/
    }

    /* "memray/_memray.pyx":155
 *         if abs(num) < 1000.0:
 *             return f"{num:5.3f}{unit}{suffix}"
 *         num /= 1000.0             # <<<<<<<<<<<<<<
 *     return f"{num:.1f}Y{suffix}"
 * 
*/
    __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_num, __pyx_mstate_global->__pyx_float_1000_0, 1000.0, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "memray/_memray.pyx":152
 * 
 * def size_fmt(num, suffix='B'):
 *     for unit in ['','k','M','G','T','P','E','Z']:             # <<<<<<<<<<<<<<
 *         if abs(num) < 1000.0:
 *             return f"{num:5.3f}{unit}{suffix}"
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":156
 *             return f"{num:5.3f}{unit}{suffix}"
 *         num /= 1000.0
 *     return f"{num:.1f}Y{suffix}"             # <<<<<<<<<<<<<<
 * 
 * # Memray core
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_Format(__pyx_v_num, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_suffix, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7[0] = __pyx_t_1;
  __pyx_t_7[1] = __pyx_mstate_global->__pyx_n_u_Y;
  __pyx_t_7[2] = __pyx_t_8;
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":151
 * 
 * 
 * def size_fmt(num, suffix='B'):             # <<<<<<<<<<<<<<
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("memray._memray.size_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_unit);
  __Pyx_XDECREF(__pyx_v_num);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":160
 * # Memray core
 * 
 * cdef stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/

static PyObject *__pyx_f_6memray_7_memray_stack_trace(memray::api::RecordReader *__pyx_v_reader, PyObject *__pyx_v_tid, PyObject *__pyx_v_allocator, PyObject *__pyx_v_python_stack_id, struct __pyx_opt_args_6memray_7_memray_stack_trace *__pyx_optional_args) {

  /* "memray/_memray.pyx":165
 *     allocator,
 *     python_stack_id,
 *     max_stacks=None,             # <<<<<<<<<<<<<<
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP, ObjectTrackingEvent.OBJECT_DESTROYED):
*/
  PyObject *__pyx_v_max_stacks = ((PyObject *)Py_None);
  Py_ssize_t __pyx_v_to_skip;
  Py_ssize_t __pyx_v_to_keep;
  PyObject *__pyx_v_stack_trace = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  long __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stack_trace", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_max_stacks = __pyx_optional_args->max_stacks;
    }
  }

  /* "memray/_memray.pyx":167
 *     max_stacks=None,
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP, ObjectTrackingEvent.OBJECT_DESTROYED):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
*/
  __Pyx_INCREF(__pyx_v_allocator);
  __pyx_t_1 = __pyx_v_allocator;
  __pyx_t_3 = __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_FREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_MUNMAP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_OBJECT_DESTROYED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_t_2;
  if (unlikely(__pyx_t_5)) {

    /* "memray/_memray.pyx":168
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP, ObjectTrackingEvent.OBJECT_DESTROYED):
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")             # <<<<<<<<<<<<<<
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Stack_traces_for_deallocations_a};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 168, __pyx_L1_error)

    /* "memray/_memray.pyx":167
 *     max_stacks=None,
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP, ObjectTrackingEvent.OBJECT_DESTROYED):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
*/
  }

  /* "memray/_memray.pyx":170
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."             # <<<<<<<<<<<<<<
 *     cdef ssize_t to_skip
 *     cdef ssize_t to_keep
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = (__pyx_v_reader != NULL);
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Cannot_get_stack_trace_without_r, 0, 0);
      __PYX_ERR(0, 170, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 170, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":174
 *     cdef ssize_t to_keep
 * 
 *     if max_stacks is not None:             # <<<<<<<<<<<<<<
 *         return reader.Py_GetStackFrame(python_stack_id, max_stacks)
 * 
*/
  __pyx_t_5 = (__pyx_v_max_stacks != Py_None);
  if (__pyx_t_5) {

    /* "memray/_memray.pyx":175
 * 
 *     if max_stacks is not None:
 *         return reader.Py_GetStackFrame(python_stack_id, max_stacks)             # <<<<<<<<<<<<<<
 * 
 *     stack_trace = reader.Py_GetStackFrame(python_stack_id)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyLong_As_size_t(__pyx_v_python_stack_id); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyLong_As_size_t(__pyx_v_max_stacks); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
    try {
      __pyx_t_1 = __pyx_v_reader->Py_GetStackFrame(__pyx_t_6, __pyx_t_7);
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 175, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "memray/_memray.pyx":174
 *     cdef ssize_t to_keep
 * 
 *     if max_stacks is not None:             # <<<<<<<<<<<<<<
 *         return reader.Py_GetStackFrame(python_stack_id, max_stacks)
 * 
*/
  }

  /* "memray/_memray.pyx":177
 *         return reader.Py_GetStackFrame(python_stack_id, max_stacks)
 * 
 *     stack_trace = reader.Py_GetStackFrame(python_stack_id)             # <<<<<<<<<<<<<<
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()
*/
  __pyx_t_7 = __Pyx_PyLong_As_size_t(__pyx_v_python_stack_id); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error)
  try {
    __pyx_t_1 = __pyx_v_reader->Py_GetStackFrame(__pyx_t_7);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 177, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_stack_trace = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":178
 * 
 *     stack_trace = reader.Py_GetStackFrame(python_stack_id)
 *     if tid == reader.getMainThreadTid():             # <<<<<<<<<<<<<<
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *         to_keep = max(len(stack_trace) - to_skip, 0)
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_reader->getMainThreadTid()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "memray/_memray.pyx":179
 *     stack_trace = reader.Py_GetStackFrame(python_stack_id)
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()             # <<<<<<<<<<<<<<
 *         to_keep = max(len(stack_trace) - to_skip, 0)
 *         del stack_trace[to_keep:]
*/
    __pyx_v_to_skip = __pyx_v_reader->getSkippedFramesOnMainThread();

    /* "memray/_memray.pyx":180
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *         to_keep = max(len(stack_trace) - to_skip, 0)             # <<<<<<<<<<<<<<
 *         del stack_trace[to_keep:]
 *     return stack_trace
*/
    __pyx_t_8 = 0;
    __pyx_t_9 = PyObject_Length(__pyx_v_stack_trace); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 180, __pyx_L1_error)
    __pyx_t_10 = (__pyx_t_9 - __pyx_v_to_skip);
    __pyx_t_5 = (__pyx_t_8 > __pyx_t_10);
    if (__pyx_t_5) {
      __pyx_t_11 = __pyx_t_8;
    } else {
      __pyx_t_11 = __pyx_t_10;
    }
    __pyx_v_to_keep = __pyx_t_11;

    /* "memray/_memray.pyx":181
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *         to_keep = max(len(stack_trace) - to_skip, 0)
 *         del stack_trace[to_keep:]             # <<<<<<<<<<<<<<
 *     return stack_trace
 * 
*/
    if (__Pyx_PyObject_DelSlice(__pyx_v_stack_trace, __pyx_v_to_keep, 0, NULL, NULL, NULL, 1, 0, 0) < (0)) __PYX_ERR(0, 181, __pyx_L1_error)

    /* "memray/_memray.pyx":178
 * 
 *     stack_trace = reader.Py_GetStackFrame(python_stack_id)
 *     if tid == reader.getMainThreadTid():             # <<<<<<<<<<<<<<
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *         to_keep = max(len(stack_trace) - to_skip, 0)
*/
  }

  /* "memray/_memray.pyx":182
 *         to_keep = max(len(stack_trace) - to_skip, 0)
 *         del stack_trace[to_keep:]
 *     return stack_trace             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_stack_trace);
  __pyx_r = __pyx_v_stack_trace;
  goto __pyx_L0;

  /* "memray/_memray.pyx":160
 * # Memray core
 * 
 * cdef stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stack_trace);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":185
 * 
 * 
 * cdef native_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     allocator,
*/

static PyObject *__pyx_f_6memray_7_memray_native_stack_trace(memray::api::RecordReader *__pyx_v_reader, PyObject *__pyx_v_allocator, PyObject *__pyx_v_native_stack_id, PyObject *__pyx_v_generation, struct __pyx_opt_args_6memray_7_memray_native_stack_trace *__pyx_optional_args) {

  /* "memray/_memray.pyx":190
 *     native_stack_id,
 *     generation,
 *     max_stacks=None,             # <<<<<<<<<<<<<<
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP):
*/
  PyObject *__pyx_v_max_stacks = ((PyObject *)Py_None);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("native_stack_trace", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_max_stacks = __pyx_optional_args->max_stacks;
    }
  }

  /* "memray/_memray.pyx":192
 *     max_stacks=None,
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
*/
  __Pyx_INCREF(__pyx_v_allocator);
  __pyx_t_1 = __pyx_v_allocator;
  __pyx_t_3 = __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_FREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_Enum_689d72__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_MUNMAP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_t_2;
  if (unlikely(__pyx_t_5)) {

    /* "memray/_memray.pyx":193
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP):
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")             # <<<<<<<<<<<<<<
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."
*/
    __pyx_t_3 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Stack_traces_for_deallocations_a};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 193, __pyx_L1_error)

    /* "memray/_memray.pyx":192
 *     max_stacks=None,
 * ):
 *     if allocator in (AllocatorType.FREE, AllocatorType.MUNMAP):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
*/
  }

  /* "memray/_memray.pyx":195
 *         raise NotImplementedError("Stack traces for deallocations aren't captured.")
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."             # <<<<<<<<<<<<<<
 *     if max_stacks is None:
 *         return reader.Py_GetNativeStackFrame(native_stack_id, generation)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = (__pyx_v_reader != NULL);
    if (unlikely(!__pyx_t_5)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Cannot_get_stack_trace_without_r, 0, 0);
      __PYX_ERR(0, 195, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 195, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":196
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."
 *     if max_stacks is None:             # <<<<<<<<<<<<<<
 *         return reader.Py_GetNativeStackFrame(native_stack_id, generation)
 *     return reader.Py_GetNativeStackFrame(native_stack_id, generation, max_stacks)
*/
  __pyx_t_5 = (__pyx_v_max_stacks == Py_None);
  if (__pyx_t_5) {

    /* "memray/_memray.pyx":197
 *     assert reader != NULL, "Cannot get stack trace without reader."
 *     if max_stacks is None:
 *         return reader.Py_GetNativeStackFrame(native_stack_id, generation)             # <<<<<<<<<<<<<<
 *     return reader.Py_GetNativeStackFrame(native_stack_id, generation, max_stacks)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_v_native_stack_id); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyLong_As_size_t(__pyx_v_generation); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
    try {
      __pyx_t_1 = __pyx_v_reader->Py_GetNativeStackFrame(__pyx_t_7, __pyx_t_6);
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 197, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "memray/_memray.pyx":196
 * 
 *     assert reader != NULL, "Cannot get stack trace without reader."
 *     if max_stacks is None:             # <<<<<<<<<<<<<<
 *         return reader.Py_GetNativeStackFrame(native_stack_id, generation)
 *     return reader.Py_GetNativeStackFrame(native_stack_id, generation, max_stacks)
*/
  }

  /* "memray/_memray.pyx":198
 *     if max_stacks is None:
 *         return reader.Py_GetNativeStackFrame(native_stack_id, generation)
 *     return reader.Py_GetNativeStackFrame(native_stack_id, generation, max_stacks)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_v_native_stack_id); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyLong_As_size_t(__pyx_v_generation); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyLong_As_size_t(__pyx_v_max_stacks); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  try {
    __pyx_t_1 = __pyx_v_reader->Py_GetNativeStackFrame(__pyx_t_7, __pyx_t_6, __pyx_t_8);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 198, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":185
 * 
 * 
 * cdef native_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     allocator,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":201
 * 
 * 
 * cdef hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/

static PyObject *__pyx_f_6memray_7_memray_hybrid_stack_trace(memray::api::RecordReader *__pyx_v_reader, PyObject *__pyx_v_tid, PyObject *__pyx_v_allocator, PyObject *__pyx_v_python_stack_id, PyObject *__pyx_v_native_stack_id, PyObject *__pyx_v_generation, struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace *__pyx_optional_args) {

  /* "memray/_memray.pyx":208
 *     native_stack_id,
 *     generation,
 *     max_stacks=None,             # <<<<<<<<<<<<<<
 * ):
 *     # This function merges a Python stack and a native stack into
*/
  PyObject *__pyx_v_max_stacks = ((PyObject *)Py_None);
  std::vector<unsigned char>  __pyx_v_is_entry_frame;
  PyObject *__pyx_v_native_stack = NULL;
  PyObject *__pyx_v_python_stack = NULL;
  Py_ssize_t __pyx_v_num_non_entry_frames;
  PyObject *__pyx_v_hybrid_stack = NULL;
  Py_ssize_t __pyx_v_pidx;
  Py_ssize_t __pyx_v_hidx;
  Py_ssize_t __pyx_v_to_skip;
  Py_ssize_t __pyx_v_first_kept_frame;
  PyObject *__pyx_v_native_frame = NULL;
  PyObject *__pyx_v_symbol = NULL;
  PyObject *__pyx_v_is_python_frame_boundary = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hybrid_stack_trace", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_max_stacks = __pyx_optional_args->max_stacks;
    }
  }

  /* "memray/_memray.pyx":227
 *     #    have extra Python frames left after pairing.
 *     cdef vector[unsigned char] is_entry_frame
 *     native_stack = native_stack_trace(reader, allocator, native_stack_id, generation)             # <<<<<<<<<<<<<<
 *     python_stack = reader.Py_GetStackFrameAndEntryInfo(python_stack_id, &is_entry_frame)
 * 
*/
  __pyx_t_1 = __pyx_f_6memray_7_memray_native_stack_trace(__pyx_v_reader, __pyx_v_allocator, __pyx_v_native_stack_id, __pyx_v_generation, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_native_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":228
 *     cdef vector[unsigned char] is_entry_frame
 *     native_stack = native_stack_trace(reader, allocator, native_stack_id, generation)
 *     python_stack = reader.Py_GetStackFrameAndEntryInfo(python_stack_id, &is_entry_frame)             # <<<<<<<<<<<<<<
 * 
 *     cdef ssize_t num_non_entry_frames = count(
*/
  __pyx_t_2 = __Pyx_PyLong_As_size_t(__pyx_v_python_stack_id); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error)
  try {
    __pyx_t_1 = __pyx_v_reader->Py_GetStackFrameAndEntryInfo(__pyx_t_2, (&__pyx_v_is_entry_frame));
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 228, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_python_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":230
 *     python_stack = reader.Py_GetStackFrameAndEntryInfo(python_stack_id, &is_entry_frame)
 * 
 *     cdef ssize_t num_non_entry_frames = count(             # <<<<<<<<<<<<<<
 *         is_entry_frame.begin(), is_entry_frame.end(), 0
 *     )
*/
  __pyx_v_num_non_entry_frames = std::count<std::vector<unsigned char> ::iterator,long>(__pyx_v_is_entry_frame.begin(), __pyx_v_is_entry_frame.end(), 0);

  /* "memray/_memray.pyx":235
 * 
 *     # Entry frames replace native frames; non-entry frames are inserted.
 *     hybrid_stack = [None] * (len(native_stack) + num_non_entry_frames)             # <<<<<<<<<<<<<<
 * 
 *     # Both stacks are from most recent to least, but we must pair things up
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_native_stack); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 235, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 + __pyx_v_num_non_entry_frames);
  __pyx_t_1 = PyList_New(1 * ((__pyx_t_4<0) ? 0:__pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_t_4; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 235, __pyx_L1_error);
    }
  }
  __pyx_v_hybrid_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":240
 *     # least recent to most to handle cases where _PyFrame_EvalFrameDefault
 *     # allocated memory before calling the profile function.
 *     native_stack.reverse()             # <<<<<<<<<<<<<<
 *     cdef ssize_t pidx = len(python_stack) - 1
 *     cdef ssize_t hidx = len(hybrid_stack) - 1
*/
  __pyx_t_5 = __pyx_v_native_stack;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_2 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reverse, __pyx_callargs+__pyx_t_2, (1-__pyx_t_2) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":241
 *     # allocated memory before calling the profile function.
 *     native_stack.reverse()
 *     cdef ssize_t pidx = len(python_stack) - 1             # <<<<<<<<<<<<<<
 *     cdef ssize_t hidx = len(hybrid_stack) - 1
 * 
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_python_stack); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 241, __pyx_L1_error)
  __pyx_v_pidx = (__pyx_t_3 - 1);

  /* "memray/_memray.pyx":242
 *     native_stack.reverse()
 *     cdef ssize_t pidx = len(python_stack) - 1
 *     cdef ssize_t hidx = len(hybrid_stack) - 1             # <<<<<<<<<<<<<<
 * 
 *     cdef ssize_t to_skip = 0
*/
  __pyx_t_3 = __Pyx_PyList_GET_SIZE(__pyx_v_hybrid_stack); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 242, __pyx_L1_error)
  __pyx_v_hidx = (__pyx_t_3 - 1);

  /* "memray/_memray.pyx":244
 *     cdef ssize_t hidx = len(hybrid_stack) - 1
 * 
 *     cdef ssize_t to_skip = 0             # <<<<<<<<<<<<<<
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()
*/
  __pyx_v_to_skip = 0;

  /* "memray/_memray.pyx":245
 * 
 *     cdef ssize_t to_skip = 0
 *     if tid == reader.getMainThreadTid():             # <<<<<<<<<<<<<<
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *     cdef ssize_t first_kept_frame = pidx - to_skip
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_reader->getMainThreadTid()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {

    /* "memray/_memray.pyx":246
 *     cdef ssize_t to_skip = 0
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()             # <<<<<<<<<<<<<<
 *     cdef ssize_t first_kept_frame = pidx - to_skip
 * 
*/
    __pyx_v_to_skip = __pyx_v_reader->getSkippedFramesOnMainThread();

    /* "memray/_memray.pyx":245
 * 
 *     cdef ssize_t to_skip = 0
 *     if tid == reader.getMainThreadTid():             # <<<<<<<<<<<<<<
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *     cdef ssize_t first_kept_frame = pidx - to_skip
*/
  }

  /* "memray/_memray.pyx":247
 *     if tid == reader.getMainThreadTid():
 *         to_skip = reader.getSkippedFramesOnMainThread()
 *     cdef ssize_t first_kept_frame = pidx - to_skip             # <<<<<<<<<<<<<<
 * 
 *     for native_frame in native_stack:
*/
  __pyx_v_first_kept_frame = (__pyx_v_pidx - __pyx_v_to_skip);

  /* "memray/_memray.pyx":249
 *     cdef ssize_t first_kept_frame = pidx - to_skip
 * 
 *     for native_frame in native_stack:             # <<<<<<<<<<<<<<
 *         symbol = native_frame[0]
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
*/
  if (likely(PyList_CheckExact(__pyx_v_native_stack)) || PyTuple_CheckExact(__pyx_v_native_stack)) {
    __pyx_t_5 = __pyx_v_native_stack; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_native_stack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 249, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 249, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 249, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_native_frame, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":250
 * 
 *     for native_frame in native_stack:
 *         symbol = native_frame[0]             # <<<<<<<<<<<<<<
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_native_frame, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_symbol, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":253
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
 *         is_python_frame_boundary = "_PyEval_EvalFrameDefault" in symbol or (             # <<<<<<<<<<<<<<
 *             symbol.startswith("_TAIL_CALL_") and ".llvm." in symbol
 *         )
*/
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_PyEval_EvalFrameDefault, __pyx_v_symbol, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 253, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_t_8;
      __pyx_t_8 = 0;
      goto __pyx_L6_bool_binop_done;
    }

    /* "memray/_memray.pyx":254
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
 *         is_python_frame_boundary = "_PyEval_EvalFrameDefault" in symbol or (
 *             symbol.startswith("_TAIL_CALL_") and ".llvm." in symbol             # <<<<<<<<<<<<<<
 *         )
 *         if pidx >= 0 and is_python_frame_boundary:
*/
    __pyx_t_9 = __pyx_v_symbol;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_2 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_n_u_TAIL_CALL};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_2, (2-__pyx_t_2) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 254, __pyx_L1_error)
    if (__pyx_t_6) {
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_1 = __pyx_t_8;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u_llvm, __pyx_v_symbol, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 254, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_L6_bool_binop_done:;
    __Pyx_XDECREF_SET(__pyx_v_is_python_frame_boundary, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":256
 *             symbol.startswith("_TAIL_CALL_") and ".llvm." in symbol
 *         )
 *         if pidx >= 0 and is_python_frame_boundary:             # <<<<<<<<<<<<<<
 *             while True:
 *                 # If we're not keeping all frames and we've reached the
*/
    __pyx_t_10 = (__pyx_v_pidx >= 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_6 = __pyx_t_10;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_is_python_frame_boundary); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 256, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_10;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_6) {

      /* "memray/_memray.pyx":257
 *         )
 *         if pidx >= 0 and is_python_frame_boundary:
 *             while True:             # <<<<<<<<<<<<<<
 *                 # If we're not keeping all frames and we've reached the
 *                 # first one we want to keep, remove frames above it.
*/
      while (1) {

        /* "memray/_memray.pyx":260
 *                 # If we're not keeping all frames and we've reached the
 *                 # first one we want to keep, remove frames above it.
 *                 if to_skip != 0 and pidx == first_kept_frame:             # <<<<<<<<<<<<<<
 *                     del hybrid_stack[hidx + 1:]
 * 
*/
        __pyx_t_10 = (__pyx_v_to_skip != 0);
        if (__pyx_t_10) {
        } else {
          __pyx_t_6 = __pyx_t_10;
          goto __pyx_L15_bool_binop_done;
        }
        __pyx_t_10 = (__pyx_v_pidx == __pyx_v_first_kept_frame);
        __pyx_t_6 = __pyx_t_10;
        __pyx_L15_bool_binop_done:;
        if (__pyx_t_6) {

          /* "memray/_memray.pyx":261
 *                 # first one we want to keep, remove frames above it.
 *                 if to_skip != 0 and pidx == first_kept_frame:
 *                     del hybrid_stack[hidx + 1:]             # <<<<<<<<<<<<<<
 * 
 *                 assert hidx >= 0
*/
          if (__Pyx_PyObject_DelSlice(__pyx_v_hybrid_stack, (__pyx_v_hidx + 1), 0, NULL, NULL, NULL, 1, 0, 0) < (0)) __PYX_ERR(0, 261, __pyx_L1_error)

          /* "memray/_memray.pyx":260
 *                 # If we're not keeping all frames and we've reached the
 *                 # first one we want to keep, remove frames above it.
 *                 if to_skip != 0 and pidx == first_kept_frame:             # <<<<<<<<<<<<<<
 *                     del hybrid_stack[hidx + 1:]
 * 
*/
        }

        /* "memray/_memray.pyx":263
 *                     del hybrid_stack[hidx + 1:]
 * 
 *                 assert hidx >= 0             # <<<<<<<<<<<<<<
 *                 hybrid_stack[hidx] = python_stack[pidx]
 *                 hidx -= 1
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_6 = (__pyx_v_hidx >= 0);
          if (unlikely(!__pyx_t_6)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
            __PYX_ERR(0, 263, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(0, 263, __pyx_L1_error)
        #endif

        /* "memray/_memray.pyx":264
 * 
 *                 assert hidx >= 0
 *                 hybrid_stack[hidx] = python_stack[pidx]             # <<<<<<<<<<<<<<
 *                 hidx -= 1
 *                 pidx -= 1
*/
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_python_stack, __pyx_v_pidx, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely((__Pyx_SetItemInt(__pyx_v_hybrid_stack, __pyx_v_hidx, __pyx_t_1, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 264, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "memray/_memray.pyx":265
 *                 assert hidx >= 0
 *                 hybrid_stack[hidx] = python_stack[pidx]
 *                 hidx -= 1             # <<<<<<<<<<<<<<
 *                 pidx -= 1
 * 
*/
        __pyx_v_hidx = (__pyx_v_hidx - 1);

        /* "memray/_memray.pyx":266
 *                 hybrid_stack[hidx] = python_stack[pidx]
 *                 hidx -= 1
 *                 pidx -= 1             # <<<<<<<<<<<<<<
 * 
 *                 # Stop when we either run out of Python frames or reach the
*/
        __pyx_v_pidx = (__pyx_v_pidx - 1);

        /* "memray/_memray.pyx":270
 *                 # Stop when we either run out of Python frames or reach the
 *                 # entry frame being evaluated by the next eval loop.
 *                 if pidx < 0 or is_entry_frame[pidx]:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
*/
        __pyx_t_10 = (__pyx_v_pidx < 0);
        if (!__pyx_t_10) {
        } else {
          __pyx_t_6 = __pyx_t_10;
          goto __pyx_L18_bool_binop_done;
        }
        __pyx_t_10 = ((__pyx_v_is_entry_frame[__pyx_v_pidx]) != 0);
        __pyx_t_6 = __pyx_t_10;
        __pyx_L18_bool_binop_done:;
        if (__pyx_t_6) {

          /* "memray/_memray.pyx":271
 *                 # entry frame being evaluated by the next eval loop.
 *                 if pidx < 0 or is_entry_frame[pidx]:
 *                     break             # <<<<<<<<<<<<<<
 *         else:
 *             assert hidx >= 0
*/
          goto __pyx_L13_break;

          /* "memray/_memray.pyx":270
 *                 # Stop when we either run out of Python frames or reach the
 *                 # entry frame being evaluated by the next eval loop.
 *                 if pidx < 0 or is_entry_frame[pidx]:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
*/
        }
      }
      __pyx_L13_break:;

      /* "memray/_memray.pyx":256
 *             symbol.startswith("_TAIL_CALL_") and ".llvm." in symbol
 *         )
 *         if pidx >= 0 and is_python_frame_boundary:             # <<<<<<<<<<<<<<
 *             while True:
 *                 # If we're not keeping all frames and we've reached the
*/
      goto __pyx_L9;
    }

    /* "memray/_memray.pyx":273
 *                     break
 *         else:
 *             assert hidx >= 0             # <<<<<<<<<<<<<<
 *             hybrid_stack[hidx] = native_frame
 *             hidx -= 1
*/
    /*else*/ {
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_6 = (__pyx_v_hidx >= 0);
        if (unlikely(!__pyx_t_6)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(0, 273, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(0, 273, __pyx_L1_error)
      #endif

      /* "memray/_memray.pyx":274
 *         else:
 *             assert hidx >= 0
 *             hybrid_stack[hidx] = native_frame             # <<<<<<<<<<<<<<
 *             hidx -= 1
 * 
*/
      if (unlikely((__Pyx_SetItemInt(__pyx_v_hybrid_stack, __pyx_v_hidx, __pyx_v_native_frame, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 274, __pyx_L1_error)

      /* "memray/_memray.pyx":275
 *             assert hidx >= 0
 *             hybrid_stack[hidx] = native_frame
 *             hidx -= 1             # <<<<<<<<<<<<<<
 * 
 *     if pidx >= 0:
*/
      __pyx_v_hidx = (__pyx_v_hidx - 1);
    }
    __pyx_L9:;

    /* "memray/_memray.pyx":249
 *     cdef ssize_t first_kept_frame = pidx - to_skip
 * 
 *     for native_frame in native_stack:             # <<<<<<<<<<<<<<
 *         symbol = native_frame[0]
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
*/
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "memray/_memray.pyx":277
 *             hidx -= 1
 * 
 *     if pidx >= 0:             # <<<<<<<<<<<<<<
 *         # We ran out of native frames without using up all of our Python
 *         # frames. We've seen this happen on stripped interpreters on Alpine
*/
  __pyx_t_6 = (__pyx_v_pidx >= 0);
  if (__pyx_t_6) {

    /* "memray/_memray.pyx":283
 *         # symbolify some of the Python frame boundaries (_PyEval_EvalFrameDefault
 *         # or Python 3.14 tail call interpreter functions).
 *         return python_stack             # <<<<<<<<<<<<<<
 *     assert hidx == -1
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_python_stack);
    __pyx_r = __pyx_v_python_stack;
    goto __pyx_L0;

    /* "memray/_memray.pyx":277
 *             hidx -= 1
 * 
 *     if pidx >= 0:             # <<<<<<<<<<<<<<
 *         # We ran out of native frames without using up all of our Python
 *         # frames. We've seen this happen on stripped interpreters on Alpine
*/
  }

  /* "memray/_memray.pyx":284
 *         # or Python 3.14 tail call interpreter functions).
 *         return python_stack
 *     assert hidx == -1             # <<<<<<<<<<<<<<
 * 
 *     return hybrid_stack[:max_stacks]
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_6 = (__pyx_v_hidx == -1L);
    if (unlikely(!__pyx_t_6)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 284, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 284, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":286
 *     assert hidx == -1
 * 
 *     return hybrid_stack[:max_stacks]             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __pyx_t_5 = __pyx_v_max_stacks;
  __pyx_t_6 = (__pyx_t_5 == Py_None);
  if (__pyx_t_6) {
    __pyx_t_3 = PY_SSIZE_T_MAX;
  } else {
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_11;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyList_GetSlice(__pyx_v_hybrid_stack, 0, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":201
 * 
 * 
 * cdef hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *     RecordReader* reader,
 *     tid,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("memray._memray.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_native_stack);
  __Pyx_XDECREF(__pyx_v_python_stack);
  __Pyx_XDECREF(__pyx_v_hybrid_stack);
  __Pyx_XDECREF(__pyx_v_native_frame);
  __Pyx_XDECREF(__pyx_v_symbol);
  __Pyx_XDECREF(__pyx_v_is_python_frame_boundary);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":295
 *     cdef shared_ptr[RecordReader] _reader
 * 
 *     def __init__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_16AllocationRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_16AllocationRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_record = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_record,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 295, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 295, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 295, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 295, __pyx_L3_error)
    }
    __pyx_v_record = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 295, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord___init__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), __pyx_v_record);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_16AllocationRecord___init__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_record) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "memray/_memray.pyx":296
 * 
 *     def __init__(self, record):
 *         self._tuple = record             # <<<<<<<<<<<<<<
 *         self._stack_trace_cache = {}
 * 
*/
  __Pyx_INCREF(__pyx_v_record);
  __Pyx_GIVEREF(__pyx_v_record);
  __Pyx_GOTREF(__pyx_v_self->_tuple);
  __Pyx_DECREF(__pyx_v_self->_tuple);
  __pyx_v_self->_tuple = __pyx_v_record;

  /* "memray/_memray.pyx":297
 *     def __init__(self, record):
 *         self._tuple = record
 *         self._stack_trace_cache = {}             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_stack_trace_cache);
  __Pyx_DECREF(__pyx_v_self->_stack_trace_cache);
  __pyx_v_self->_stack_trace_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":295
 *     cdef shared_ptr[RecordReader] _reader
 * 
 *     def __init__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":299
 *         self._stack_trace_cache = {}
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef AllocationRecord _other
 *         if isinstance(other, AllocationRecord):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_2__eq__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_2__eq__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v__other = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "memray/_memray.pyx":301
 *     def __eq__(self, other):
 *         cdef AllocationRecord _other
 *         if isinstance(other, AllocationRecord):             # <<<<<<<<<<<<<<
 *             _other = other
 *             return self._tuple == _other._tuple
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord); 
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":302
 *         cdef AllocationRecord _other
 *         if isinstance(other, AllocationRecord):
 *             _other = other             # <<<<<<<<<<<<<<
 *             return self._tuple == _other._tuple
 *         return NotImplemented
*/
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord))))) __PYX_ERR(0, 302, __pyx_L1_error)
    __pyx_v__other = ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "memray/_memray.pyx":303
 *         if isinstance(other, AllocationRecord):
 *             _other = other
 *             return self._tuple == _other._tuple             # <<<<<<<<<<<<<<
 *         return NotImplemented
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->_tuple, __pyx_v__other->_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "memray/_memray.pyx":301
 *     def __eq__(self, other):
 *         cdef AllocationRecord _other
 *         if isinstance(other, AllocationRecord):             # <<<<<<<<<<<<<<
 *             _other = other
 *             return self._tuple == _other._tuple
*/
  }

  /* "memray/_memray.pyx":304
 *             _other = other
 *             return self._tuple == _other._tuple
 *         return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_builtin_NotImplemented);
  __pyx_r = __pyx_builtin_NotImplemented;
  goto __pyx_L0;

  /* "memray/_memray.pyx":299
 *         self._stack_trace_cache = {}
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef AllocationRecord _other
 *         if isinstance(other, AllocationRecord):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":306
 *         return NotImplemented
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_6memray_7_memray_16AllocationRecord_5__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_6memray_7_memray_16AllocationRecord_5__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_4__hash__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_6memray_7_memray_16AllocationRecord_4__hash__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "memray/_memray.pyx":307
 * 
 *     def __hash__(self):
 *         return hash(self._tuple)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_1 = __pyx_v_self->_tuple;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "memray/_memray.pyx":306
 *         return NotImplemented
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":309
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_3tid_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_3tid___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":311
 *     @property
 *     def tid(self):
 *         return self._tuple[0]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":309
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":313
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def address(self):
 *         return self._tuple[1]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_7address_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_7address_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_7address___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_7address___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":315
 *     @property
 *     def address(self):
 *         return self._tuple[1]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":313
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def address(self):
 *         return self._tuple[1]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.address.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":317
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         return self._tuple[2]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_4size_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_4size___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_4size___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":319
 *     @property
 *     def size(self):
 *         return self._tuple[2]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":317
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         return self._tuple[2]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":321
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allocator(self):
 *         return self._tuple[3]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_9allocator_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_9allocator_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_9allocator___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_9allocator___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":323
 *     @property
 *     def allocator(self):
 *         return self._tuple[3]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":321
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allocator(self):
 *         return self._tuple[3]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.allocator.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":325
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[4]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_8stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_8stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_8stack_id___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":327
 *     @property
 *     def stack_id(self):
 *         return self._tuple[4]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":325
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[4]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":329
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def n_allocations(self):
 *         return self._tuple[5]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_13n_allocations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_13n_allocations_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_13n_allocations___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_13n_allocations___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":331
 *     @property
 *     def n_allocations(self):
 *         return self._tuple[5]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":329
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def n_allocations(self):
 *         return self._tuple[5]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.n_allocations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":333
 *         return self._tuple[5]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[6]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_15native_stack_id___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":335
 *     @property
 *     def native_stack_id(self):
 *         return self._tuple[6]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 6, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":333
 *         return self._tuple[5]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[6]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.native_stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":337
 *         return self._tuple[6]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[7]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_25native_segment_generation___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":339
 *     @property
 *     def native_segment_generation(self):
 *         return self._tuple[7]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 7, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":337
 *         return self._tuple[6]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[7]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.native_segment_generation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":341
 *         return self._tuple[7]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         if self.tid == -1:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_11thread_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_11thread_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_11thread_name___get__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":343
 *     @property
 *     def thread_name(self):
 *         if self.tid == -1:             # <<<<<<<<<<<<<<
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":344
 *     def thread_name(self):
 *         if self.tid == -1:
 *             return "merged thread"             # <<<<<<<<<<<<<<
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
 *         return self._reader.get().getThreadName(self.tid)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_merged_thread);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u_merged_thread;
    goto __pyx_L0;

    /* "memray/_memray.pyx":343
 *     @property
 *     def thread_name(self):
 *         if self.tid == -1:             # <<<<<<<<<<<<<<
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/
  }

  /* "memray/_memray.pyx":345
 *         if self.tid == -1:
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."             # <<<<<<<<<<<<<<
 *         return self._reader.get().getThreadName(self.tid)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_self->_reader.get() != NULL);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Cannot_get_thread_name_without_r, 0, 0);
      __PYX_ERR(0, 345, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 345, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":346
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
 *         return self._reader.get().getThreadName(self.tid)             # <<<<<<<<<<<<<<
 * 
 *     def stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyLong_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_t_4 = __pyx_v_self->_reader.get()->getThreadName(__pyx_t_3);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 346, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":341
 *         return self._tuple[7]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         if self.tid == -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.thread_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":348
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16AllocationRecord_6stack_trace, "AllocationRecord.stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_16AllocationRecord_7stack_trace = {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_6stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 348, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "stack_trace", 0) < (0)) __PYX_ERR(0, 348, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 348, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_6stack_trace(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_6memray_7_memray_stack_trace __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stack_trace", 0);

  /* "memray/_memray.pyx":349
 * 
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_python);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_python);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_python) != (0)) __PYX_ERR(0, 349, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 349, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":350
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 350, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 350, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":353
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 self.allocator,
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":354
 *                 self._reader.get(),
 *                 self.tid,
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.stack_id,
 *                 max_stacks,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":355
 *                 self.tid,
 *                 self.allocator,
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":351
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.max_stacks = __pyx_v_max_stacks;
    __pyx_t_5 = __pyx_f_6memray_7_memray_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, &__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 351, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_5) < 0))) __PYX_ERR(0, 351, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "memray/_memray.pyx":350
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":358
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def native_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 358, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":348
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":360
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16AllocationRecord_8native_stack_trace, "AllocationRecord.native_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_16AllocationRecord_9native_stack_trace = {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_8native_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("native_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 360, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 360, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "native_stack_trace", 0) < (0)) __PYX_ERR(0, 360, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 360, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("native_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 360, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_8native_stack_trace(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_6memray_7_memray_native_stack_trace __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("native_stack_trace", 0);

  /* "memray/_memray.pyx":361
 * 
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_native);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_native);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_native) != (0)) __PYX_ERR(0, 361, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 361, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":362
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 362, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 362, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":365
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":366
 *                 self._reader.get(),
 *                 self.allocator,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":367
 *                 self.allocator,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":363
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = native_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.allocator,
*/
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.max_stacks = __pyx_v_max_stacks;
    __pyx_t_5 = __pyx_f_6memray_7_memray_native_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, &__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 363, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_5) < 0))) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "memray/_memray.pyx":362
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":370
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 370, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":360
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":372
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace, "AllocationRecord.hybrid_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace = {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hybrid_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 372, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 372, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "hybrid_stack_trace", 0) < (0)) __PYX_ERR(0, 372, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 372, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hybrid_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 372, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hybrid_stack_trace", 0);

  /* "memray/_memray.pyx":373
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_hybrid) != (0)) __PYX_ERR(0, 373, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 373, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":374
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 374, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":377
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 self.allocator,
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":378
 *                 self._reader.get(),
 *                 self.tid,
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.stack_id,
 *                 self.native_stack_id,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":379
 *                 self.tid,
 *                 self.allocator,
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":380
 *                 self.allocator,
 *                 self.stack_id,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":381
 *                 self.stack_id,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "memray/_memray.pyx":375
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.max_stacks = __pyx_v_max_stacks;
    __pyx_t_7 = __pyx_f_6memray_7_memray_hybrid_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, &__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 375, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_7) < 0))) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "memray/_memray.pyx":374
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":384
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 384, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":372
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":386
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_12__repr__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_12__repr__(struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[11];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "memray/_memray.pyx":387
 * 
 *     def __repr__(self):
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "             # <<<<<<<<<<<<<<
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "
 *                 f"allocations={self.n_allocations}>")
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Hex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_address_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Hex(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "memray/_memray.pyx":388
 *     def __repr__(self):
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "             # <<<<<<<<<<<<<<
 *                 f"allocations={self.n_allocations}>")
 * 
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (__pyx_t_6) {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_N_A);
    __pyx_t_3 = __pyx_mstate_global->__pyx_kp_u_N_A;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_size_fmt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "memray/_memray.pyx":389
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "
 *                 f"allocations={self.n_allocations}>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_AllocationRecord_tid;
  __pyx_t_9[1] = __pyx_t_1;
  __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_address;
  __pyx_t_9[3] = __pyx_t_2;
  __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u_size;
  __pyx_t_9[5] = __pyx_t_8;
  __pyx_t_9[6] = __pyx_mstate_global->__pyx_kp_u_allocator_2;
  __pyx_t_9[7] = __pyx_t_7;
  __pyx_t_9[8] = __pyx_mstate_global->__pyx_kp_u_allocations;
  __pyx_t_9[9] = __pyx_t_4;
  __pyx_t_9[10] = __pyx_mstate_global->__pyx_kp_u__2;

  /* "memray/_memray.pyx":387
 * 
 *     def __repr__(self):
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "             # <<<<<<<<<<<<<<
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "
 *                 f"allocations={self.n_allocations}>")
*/
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 11, 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":386
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f"AllocationRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"size={'N/A' if not self.size else size_fmt(self.size)}, allocator={self.allocator!r}, "
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16AllocationRecord_14__reduce_cython__, "AllocationRecord.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_16AllocationRecord_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_14__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_14__reduce_cython__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self__reader_cannot_be_converted, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16AllocationRecord_16__setstate_cython__, "AllocationRecord.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_16AllocationRecord_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_16__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_16AllocationRecord_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_16AllocationRecord_16__setstate_cython__(((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16AllocationRecord_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self__reader_cannot_be_converted, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":398
 *     cdef shared_ptr[RecordReader] _reader
 * 
 *     def __init__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_19TrackedObjectRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_19TrackedObjectRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_record = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_record,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 398, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 398, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 398, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 398, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 398, __pyx_L3_error)
    }
    __pyx_v_record = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 398, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord___init__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), __pyx_v_record);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_19TrackedObjectRecord___init__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_record) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "memray/_memray.pyx":399
 * 
 *     def __init__(self, record):
 *         self._tuple = record             # <<<<<<<<<<<<<<
 *         self._stack_trace_cache = {}
 * 
*/
  __Pyx_INCREF(__pyx_v_record);
  __Pyx_GIVEREF(__pyx_v_record);
  __Pyx_GOTREF(__pyx_v_self->_tuple);
  __Pyx_DECREF(__pyx_v_self->_tuple);
  __pyx_v_self->_tuple = __pyx_v_record;

  /* "memray/_memray.pyx":400
 *     def __init__(self, record):
 *         self._tuple = record
 *         self._stack_trace_cache = {}             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_stack_trace_cache);
  __Pyx_DECREF(__pyx_v_self->_stack_trace_cache);
  __pyx_v_self->_stack_trace_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":398
 *     cdef shared_ptr[RecordReader] _reader
 * 
 *     def __init__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":402
 *         self._stack_trace_cache = {}
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef TrackedObjectRecord _other
 *         if isinstance(other, TrackedObjectRecord):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_2__eq__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_2__eq__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v__other = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "memray/_memray.pyx":404
 *     def __eq__(self, other):
 *         cdef TrackedObjectRecord _other
 *         if isinstance(other, TrackedObjectRecord):             # <<<<<<<<<<<<<<
 *             _other = other
 *             return self._tuple == _other._tuple
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord); 
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":405
 *         cdef TrackedObjectRecord _other
 *         if isinstance(other, TrackedObjectRecord):
 *             _other = other             # <<<<<<<<<<<<<<
 *             return self._tuple == _other._tuple
 *         return NotImplemented
*/
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord))))) __PYX_ERR(0, 405, __pyx_L1_error)
    __pyx_v__other = ((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "memray/_memray.pyx":406
 *         if isinstance(other, TrackedObjectRecord):
 *             _other = other
 *             return self._tuple == _other._tuple             # <<<<<<<<<<<<<<
 *         return NotImplemented
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->_tuple, __pyx_v__other->_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "memray/_memray.pyx":404
 *     def __eq__(self, other):
 *         cdef TrackedObjectRecord _other
 *         if isinstance(other, TrackedObjectRecord):             # <<<<<<<<<<<<<<
 *             _other = other
 *             return self._tuple == _other._tuple
*/
  }

  /* "memray/_memray.pyx":407
 *             _other = other
 *             return self._tuple == _other._tuple
 *         return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_builtin_NotImplemented);
  __pyx_r = __pyx_builtin_NotImplemented;
  goto __pyx_L0;

  /* "memray/_memray.pyx":402
 *         self._stack_trace_cache = {}
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef TrackedObjectRecord _other
 *         if isinstance(other, TrackedObjectRecord):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":409
 *         return NotImplemented
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_6memray_7_memray_19TrackedObjectRecord_5__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_6memray_7_memray_19TrackedObjectRecord_5__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_4__hash__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_6memray_7_memray_19TrackedObjectRecord_4__hash__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "memray/_memray.pyx":410
 * 
 *     def __hash__(self):
 *         return hash(self._tuple)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_1 = __pyx_v_self->_tuple;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 410, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "memray/_memray.pyx":409
 *         return NotImplemented
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":412
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_3tid_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_3tid___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":414
 *     @property
 *     def tid(self):
 *         return self._tuple[0]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":412
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":416
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def address(self):
 *         return self._tuple[1]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7address_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7address_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_7address___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_7address___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":418
 *     @property
 *     def address(self):
 *         return self._tuple[1]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":416
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def address(self):
 *         return self._tuple[1]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.address.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":420
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_created(self):
 *         return self._tuple[2]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_10is_created_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_10is_created_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_10is_created___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_10is_created___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":422
 *     @property
 *     def is_created(self):
 *         return self._tuple[2]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":420
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_created(self):
 *         return self._tuple[2]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.is_created.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":424
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[3]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_8stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_8stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_8stack_id___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":426
 *     @property
 *     def stack_id(self):
 *         return self._tuple[3]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":424
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[3]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":428
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[4]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_15native_stack_id___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":430
 *     @property
 *     def native_stack_id(self):
 *         return self._tuple[4]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":428
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[4]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.native_stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":432
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[5]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":434
 *     @property
 *     def native_segment_generation(self):
 *         return self._tuple[5]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":432
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[5]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.native_segment_generation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":436
 *         return self._tuple[5]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         if self.tid == -1:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11thread_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11thread_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_11thread_name___get__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":438
 *     @property
 *     def thread_name(self):
 *         if self.tid == -1:             # <<<<<<<<<<<<<<
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 438, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":439
 *     def thread_name(self):
 *         if self.tid == -1:
 *             return "merged thread"             # <<<<<<<<<<<<<<
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
 *         return self._reader.get().getThreadName(self.tid)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_merged_thread);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u_merged_thread;
    goto __pyx_L0;

    /* "memray/_memray.pyx":438
 *     @property
 *     def thread_name(self):
 *         if self.tid == -1:             # <<<<<<<<<<<<<<
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/
  }

  /* "memray/_memray.pyx":440
 *         if self.tid == -1:
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."             # <<<<<<<<<<<<<<
 *         return self._reader.get().getThreadName(self.tid)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_self->_reader.get() != NULL);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Cannot_get_thread_name_without_r, 0, 0);
      __PYX_ERR(0, 440, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 440, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":441
 *             return "merged thread"
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
 *         return self._reader.get().getThreadName(self.tid)             # <<<<<<<<<<<<<<
 * 
 *     def stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyLong_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_t_4 = __pyx_v_self->_reader.get()->getThreadName(__pyx_t_3);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 441, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":436
 *         return self._tuple[5]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         if self.tid == -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.thread_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":443
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         event = (
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_19TrackedObjectRecord_6stack_trace, "TrackedObjectRecord.stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_19TrackedObjectRecord_7stack_trace = {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_6stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 443, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 443, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "stack_trace", 0) < (0)) __PYX_ERR(0, 443, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 443, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 443, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_6stack_trace(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  enum __pyx_t_6memray_7_memray_ObjectTrackingEvent __pyx_v_event;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  enum __pyx_t_6memray_7_memray_ObjectTrackingEvent __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_6memray_7_memray_stack_trace __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stack_trace", 0);

  /* "memray/_memray.pyx":444
 * 
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)             # <<<<<<<<<<<<<<
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_python);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_python);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_python) != (0)) __PYX_ERR(0, 444, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 444, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":446
 *         cache_key = ("python", max_stacks)
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created             # <<<<<<<<<<<<<<
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_created); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {
    __pyx_t_2 = __pyx_e_6memray_7_memray_OBJECT_CREATED;
  } else {

    /* "memray/_memray.pyx":447
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED             # <<<<<<<<<<<<<<
 *         )
 *         if cache_key not in self._stack_trace_cache:
*/
    __pyx_t_2 = __pyx_e_6memray_7_memray_OBJECT_DESTROYED;
  }
  __pyx_v_event = __pyx_t_2;

  /* "memray/_memray.pyx":449
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 449, __pyx_L1_error)
  }
  __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 449, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "memray/_memray.pyx":452
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 event,
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":453
 *                 self._reader.get(),
 *                 self.tid,
 *                 event,             # <<<<<<<<<<<<<<
 *                 self.stack_id,
 *                 max_stacks,
*/
    __pyx_t_4 = __Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_v_event); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":454
 *                 self.tid,
 *                 event,
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":450
 *         )
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.max_stacks = __pyx_v_max_stacks;
    __pyx_t_6 = __pyx_f_6memray_7_memray_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_4, __pyx_t_5, &__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 450, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_6) < 0))) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":449
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":457
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def native_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 457, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":443
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         event = (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":459
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         event = (
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace, "TrackedObjectRecord.native_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace = {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("native_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 459, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "native_stack_trace", 0) < (0)) __PYX_ERR(0, 459, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("native_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 459, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  enum __pyx_t_6memray_7_memray_ObjectTrackingEvent __pyx_v_event;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  enum __pyx_t_6memray_7_memray_ObjectTrackingEvent __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_6memray_7_memray_native_stack_trace __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("native_stack_trace", 0);

  /* "memray/_memray.pyx":460
 * 
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)             # <<<<<<<<<<<<<<
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_native);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_native);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_native) != (0)) __PYX_ERR(0, 460, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 460, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":462
 *         cache_key = ("native", max_stacks)
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created             # <<<<<<<<<<<<<<
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_created); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {
    __pyx_t_2 = __pyx_e_6memray_7_memray_OBJECT_CREATED;
  } else {

    /* "memray/_memray.pyx":463
 *         event = (
 *                 ObjectTrackingEvent.OBJECT_CREATED if self.is_created
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED             # <<<<<<<<<<<<<<
 *         )
 *         if cache_key not in self._stack_trace_cache:
*/
    __pyx_t_2 = __pyx_e_6memray_7_memray_OBJECT_DESTROYED;
  }
  __pyx_v_event = __pyx_t_2;

  /* "memray/_memray.pyx":465
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 465, __pyx_L1_error)
  }
  __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 465, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "memray/_memray.pyx":468
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
 *                 event,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_1 = __Pyx_Enum_ae96d7__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_v_event); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":469
 *                 self._reader.get(),
 *                 event,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":470
 *                 event,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":466
 *         )
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = native_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 event,
*/
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.max_stacks = __pyx_v_max_stacks;
    __pyx_t_6 = __pyx_f_6memray_7_memray_native_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_4, __pyx_t_5, &__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 466, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_6) < 0))) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":465
 *                 else ObjectTrackingEvent.OBJECT_DESTROYED
 *         )
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":473
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 473, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":459
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         event = (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":475
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace, "TrackedObjectRecord.hybrid_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace = {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hybrid_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 475, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 475, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "hybrid_stack_trace", 0) < (0)) __PYX_ERR(0, 475, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 475, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hybrid_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 475, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hybrid_stack_trace", 0);

  /* "memray/_memray.pyx":476
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_hybrid) != (0)) __PYX_ERR(0, 476, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 476, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":477
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 477, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":480
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 None,  # No allocator for objects
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":482
 *                 self.tid,
 *                 None,  # No allocator for objects
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":483
 *                 None,  # No allocator for objects
 *                 self.stack_id,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":484
 *                 self.stack_id,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":478
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.max_stacks = __pyx_v_max_stacks;
    __pyx_t_6 = __pyx_f_6memray_7_memray_hybrid_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, Py_None, __pyx_t_3, __pyx_t_4, __pyx_t_5, &__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 478, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_6) < 0))) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":477
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":487
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 487, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":475
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":489
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f"TrackedObjectRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"is_created={self.is_created}, stack_id={self.stack_id}>")
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_13__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_12__repr__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_12__repr__(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[9];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "memray/_memray.pyx":490
 * 
 *     def __repr__(self):
 *         return (f"TrackedObjectRecord<tid={hex(self.tid)}, address={hex(self.address)}, "             # <<<<<<<<<<<<<<
 *                 f"is_created={self.is_created}, stack_id={self.stack_id}>")
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Hex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_address_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Hex(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "memray/_memray.pyx":491
 *     def __repr__(self):
 *         return (f"TrackedObjectRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"is_created={self.is_created}, stack_id={self.stack_id}>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_created); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_TrackedObjectRecord_tid;
  __pyx_t_6[1] = __pyx_t_1;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_address;
  __pyx_t_6[3] = __pyx_t_2;
  __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u_is_created_2;
  __pyx_t_6[5] = __pyx_t_4;
  __pyx_t_6[6] = __pyx_mstate_global->__pyx_kp_u_stack_id_2;
  __pyx_t_6[7] = __pyx_t_5;
  __pyx_t_6[8] = __pyx_mstate_global->__pyx_kp_u__2;

  /* "memray/_memray.pyx":490
 * 
 *     def __repr__(self):
 *         return (f"TrackedObjectRecord<tid={hex(self.tid)}, address={hex(self.address)}, "             # <<<<<<<<<<<<<<
 *                 f"is_created={self.is_created}, stack_id={self.stack_id}>")
 * 
*/
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 9, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":489
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f"TrackedObjectRecord<tid={hex(self.tid)}, address={hex(self.address)}, "
 *                 f"is_created={self.is_created}, stack_id={self.stack_id}>")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__, "TrackedObjectRecord.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self__reader_cannot_be_converted, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__, "TrackedObjectRecord.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__(((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self__reader_cannot_be_converted, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TrackedObjectRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":501
 *     cdef public size_t n_bytes
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         size_t allocated_before_snapshot,
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_allocated_before_snapshot;
  PyObject *__pyx_v_deallocated_before_snapshot = 0;
  size_t __pyx_v_n_allocations;
  size_t __pyx_v_n_bytes;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_allocated_before_snapshot,&__pyx_mstate_global->__pyx_n_u_deallocated_before_snapshot,&__pyx_mstate_global->__pyx_n_u_n_allocations,&__pyx_mstate_global->__pyx_n_u_n_bytes,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 501, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 501, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 501, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 501, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 501, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 501, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, i); __PYX_ERR(0, 501, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 501, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 501, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 501, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 501, __pyx_L3_error)
    }
    __pyx_v_allocated_before_snapshot = __Pyx_PyLong_As_size_t(values[0]); if (unlikely((__pyx_v_allocated_before_snapshot == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L3_error)
    __pyx_v_deallocated_before_snapshot = values[1];
    __pyx_v_n_allocations = __Pyx_PyLong_As_size_t(values[2]); if (unlikely((__pyx_v_n_allocations == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L3_error)
    __pyx_v_n_bytes = __Pyx_PyLong_As_size_t(values[3]); if (unlikely((__pyx_v_n_bytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 506, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 501, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Interval.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval___cinit__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), __pyx_v_allocated_before_snapshot, __pyx_v_deallocated_before_snapshot, __pyx_v_n_allocations, __pyx_v_n_bytes);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval___cinit__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, size_t __pyx_v_allocated_before_snapshot, PyObject *__pyx_v_deallocated_before_snapshot, size_t __pyx_v_n_allocations, size_t __pyx_v_n_bytes) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "memray/_memray.pyx":508
 *         size_t n_bytes,
 *     ):
 *         self.allocated_before_snapshot = allocated_before_snapshot             # <<<<<<<<<<<<<<
 *         self.deallocated_before_snapshot = deallocated_before_snapshot
 *         self.n_allocations = n_allocations
*/
  __pyx_v_self->allocated_before_snapshot = __pyx_v_allocated_before_snapshot;

  /* "memray/_memray.pyx":509
 *     ):
 *         self.allocated_before_snapshot = allocated_before_snapshot
 *         self.deallocated_before_snapshot = deallocated_before_snapshot             # <<<<<<<<<<<<<<
 *         self.n_allocations = n_allocations
 *         self.n_bytes = n_bytes
*/
  __Pyx_INCREF(__pyx_v_deallocated_before_snapshot);
  __Pyx_GIVEREF(__pyx_v_deallocated_before_snapshot);
  __Pyx_GOTREF(__pyx_v_self->deallocated_before_snapshot);
  __Pyx_DECREF(__pyx_v_self->deallocated_before_snapshot);
  __pyx_v_self->deallocated_before_snapshot = __pyx_v_deallocated_before_snapshot;

  /* "memray/_memray.pyx":510
 *         self.allocated_before_snapshot = allocated_before_snapshot
 *         self.deallocated_before_snapshot = deallocated_before_snapshot
 *         self.n_allocations = n_allocations             # <<<<<<<<<<<<<<
 *         self.n_bytes = n_bytes
 * 
*/
  __pyx_v_self->n_allocations = __pyx_v_n_allocations;

  /* "memray/_memray.pyx":511
 *         self.deallocated_before_snapshot = deallocated_before_snapshot
 *         self.n_allocations = n_allocations
 *         self.n_bytes = n_bytes             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_v_self->n_bytes = __pyx_v_n_bytes;

  /* "memray/_memray.pyx":501
 *     cdef public size_t n_bytes
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         size_t allocated_before_snapshot,
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":513
 *         self.n_bytes = n_bytes
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if type(other) is not Interval:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_2__eq__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_2__eq__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "memray/_memray.pyx":514
 * 
 *     def __eq__(self, other):
 *         if type(other) is not Interval:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return (
*/
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_other)) != ((PyObject *)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_Interval));
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":515
 *     def __eq__(self, other):
 *         if type(other) is not Interval:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return (
 *             self.allocated_before_snapshot,
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;

    /* "memray/_memray.pyx":514
 * 
 *     def __eq__(self, other):
 *         if type(other) is not Interval:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return (
*/
  }

  /* "memray/_memray.pyx":516
 *         if type(other) is not Interval:
 *             return NotImplemented
 *         return (             # <<<<<<<<<<<<<<
 *             self.allocated_before_snapshot,
 *             self.deallocated_before_snapshot,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "memray/_memray.pyx":517
 *             return NotImplemented
 *         return (
 *             self.allocated_before_snapshot,             # <<<<<<<<<<<<<<
 *             self.deallocated_before_snapshot,
 *             self.n_allocations,
*/
  __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_self->allocated_before_snapshot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "memray/_memray.pyx":519
 *             self.allocated_before_snapshot,
 *             self.deallocated_before_snapshot,
 *             self.n_allocations,             # <<<<<<<<<<<<<<
 *             self.n_bytes,
 *         ) == (
*/
  __pyx_t_3 = __Pyx_PyLong_FromSize_t(__pyx_v_self->n_allocations); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":520
 *             self.deallocated_before_snapshot,
 *             self.n_allocations,
 *             self.n_bytes,             # <<<<<<<<<<<<<<
 *         ) == (
 *             other.allocated_before_snapshot,
*/
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_self->n_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "memray/_memray.pyx":517
 *             return NotImplemented
 *         return (
 *             self.allocated_before_snapshot,             # <<<<<<<<<<<<<<
 *             self.deallocated_before_snapshot,
 *             self.n_allocations,
*/
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 517, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->deallocated_before_snapshot);
  __Pyx_GIVEREF(__pyx_v_self->deallocated_before_snapshot);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self->deallocated_before_snapshot) != (0)) __PYX_ERR(0, 517, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 517, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 517, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":522
 *             self.n_bytes,
 *         ) == (
 *             other.allocated_before_snapshot,             # <<<<<<<<<<<<<<
 *             other.deallocated_before_snapshot,
 *             other.n_allocations,
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_allocated_before_snapshot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "memray/_memray.pyx":523
 *         ) == (
 *             other.allocated_before_snapshot,
 *             other.deallocated_before_snapshot,             # <<<<<<<<<<<<<<
 *             other.n_allocations,
 *             other.n_bytes,
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_deallocated_before_snapshot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":524
 *             other.allocated_before_snapshot,
 *             other.deallocated_before_snapshot,
 *             other.n_allocations,             # <<<<<<<<<<<<<<
 *             other.n_bytes,
 *         )
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "memray/_memray.pyx":525
 *             other.deallocated_before_snapshot,
 *             other.n_allocations,
 *             other.n_bytes,             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_n_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "memray/_memray.pyx":522
 *             self.n_bytes,
 *         ) == (
 *             other.allocated_before_snapshot,             # <<<<<<<<<<<<<<
 *             other.deallocated_before_snapshot,
 *             other.n_allocations,
*/
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 522, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 522, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 522, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 522, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":513
 *         self.n_bytes = n_bytes
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if type(other) is not Interval:
 *             return NotImplemented
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.Interval.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":528
 *         )
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_5__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_4__repr__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_4__repr__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[9];
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "memray/_memray.pyx":529
 * 
 *     def __repr__(self):
 *         return (             # <<<<<<<<<<<<<<
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"
*/
  __Pyx_XDECREF(__pyx_r);

  /* "memray/_memray.pyx":530
 *     def __repr__(self):
 *         return (
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"             # <<<<<<<<<<<<<<
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"
 *             f" n_allocations={self.n_allocations},"
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_size_t(__pyx_v_self->allocated_before_snapshot, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "memray/_memray.pyx":531
 *         return (
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"             # <<<<<<<<<<<<<<
 *             f" n_allocations={self.n_allocations},"
 *             f" n_bytes={self.n_bytes})"
*/
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_self->deallocated_before_snapshot, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "memray/_memray.pyx":532
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"
 *             f" n_allocations={self.n_allocations},"             # <<<<<<<<<<<<<<
 *             f" n_bytes={self.n_bytes})"
 *         )
*/
  __pyx_t_3 = __Pyx_PyUnicode_From_size_t(__pyx_v_self->n_allocations, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":533
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"
 *             f" n_allocations={self.n_allocations},"
 *             f" n_bytes={self.n_bytes})"             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_4 = __Pyx_PyUnicode_From_size_t(__pyx_v_self->n_bytes, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Interval_allocated_before_snapsh;
  __pyx_t_5[1] = __pyx_t_1;
  __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_deallocated_before_snapshot_2;
  __pyx_t_5[3] = __pyx_t_2;
  __pyx_t_5[4] = __pyx_mstate_global->__pyx_kp_u_n_allocations_2;
  __pyx_t_5[5] = __pyx_t_3;
  __pyx_t_5[6] = __pyx_mstate_global->__pyx_kp_u_n_bytes_2;
  __pyx_t_5[7] = __pyx_t_4;
  __pyx_t_5[8] = __pyx_mstate_global->__pyx_kp_u__3;

  /* "memray/_memray.pyx":530
 *     def __repr__(self):
 *         return (
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"             # <<<<<<<<<<<<<<
 *             f" deallocated_before_snapshot={self.deallocated_before_snapshot},"
 *             f" n_allocations={self.n_allocations},"
*/
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 9, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":528
 *         )
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (
 *             f"Interval(allocated_before_snapshot={self.allocated_before_snapshot},"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.Interval.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":496
 * @cython.freelist(1024)
 * cdef class Interval:
 *     cdef public size_t allocated_before_snapshot             # <<<<<<<<<<<<<<
 *     cdef public object deallocated_before_snapshot
 *     cdef public size_t n_allocations
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot___get__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_self->allocated_before_snapshot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.Interval.allocated_before_snapshot.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot_2__set__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval_25allocated_before_snapshot_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  size_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __pyx_t_1 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
  __pyx_v_self->allocated_before_snapshot = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Interval.allocated_before_snapshot.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "memray/_memray.pyx":497
 * cdef class Interval:
 *     cdef public size_t allocated_before_snapshot
 *     cdef public object deallocated_before_snapshot             # <<<<<<<<<<<<<<
 *     cdef public size_t n_allocations
 *     cdef public size_t n_bytes
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot___get__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->deallocated_before_snapshot);
  __pyx_r = __pyx_v_self->deallocated_before_snapshot;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_2__set__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->deallocated_before_snapshot);
  __Pyx_DECREF(__pyx_v_self->deallocated_before_snapshot);
  __pyx_v_self->deallocated_before_snapshot = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_4__del__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval_27deallocated_before_snapshot_4__del__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->deallocated_before_snapshot);
  __Pyx_DECREF(__pyx_v_self->deallocated_before_snapshot);
  __pyx_v_self->deallocated_before_snapshot = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":498
 *     cdef public size_t allocated_before_snapshot
 *     cdef public object deallocated_before_snapshot
 *     cdef public size_t n_allocations             # <<<<<<<<<<<<<<
 *     cdef public size_t n_bytes
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_13n_allocations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_13n_allocations_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_13n_allocations___get__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_13n_allocations___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_self->n_allocations); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.Interval.n_allocations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_13n_allocations_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_13n_allocations_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_13n_allocations_2__set__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval_13n_allocations_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  size_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __pyx_t_1 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 498, __pyx_L1_error)
  __pyx_v_self->n_allocations = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Interval.n_allocations.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "memray/_memray.pyx":499
 *     cdef public object deallocated_before_snapshot
 *     cdef public size_t n_allocations
 *     cdef public size_t n_bytes             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_7n_bytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_8Interval_7n_bytes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_7n_bytes___get__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_7n_bytes___get__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_self->n_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.Interval.n_bytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_8Interval_7n_bytes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6memray_7_memray_8Interval_7n_bytes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_7n_bytes_2__set__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_8Interval_7n_bytes_2__set__(struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  size_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __pyx_t_1 = __Pyx_PyLong_As_size_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L1_error)
  __pyx_v_self->n_bytes = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Interval.n_bytes.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_8Interval_6__reduce_cython__, "Interval.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_8Interval_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_8Interval_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_8Interval_6__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_8Interval_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_6__reduce_cython__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Interval.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_8Interval_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_8Interval_8__setstate_cython__, "Interval.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_8Interval_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_8Interval_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_8Interval_8__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_8Interval_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Interval.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_8Interval_8__setstate_cython__(((struct __pyx_obj_6memray_7_memray_Interval *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8Interval_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Interval *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Interval.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":544
 *     cdef public object intervals
 * 
 *     def __cinit__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_record = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_record,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 544, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 544, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 544, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 544, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 544, __pyx_L3_error)
    }
    __pyx_v_record = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 544, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord___cinit__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), __pyx_v_record);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord___cinit__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_record) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "memray/_memray.pyx":545
 * 
 *     def __cinit__(self, record):
 *         self._tuple = record             # <<<<<<<<<<<<<<
 *         self._stack_trace_cache = {}
 *         self.intervals = []
*/
  __Pyx_INCREF(__pyx_v_record);
  __Pyx_GIVEREF(__pyx_v_record);
  __Pyx_GOTREF(__pyx_v_self->_tuple);
  __Pyx_DECREF(__pyx_v_self->_tuple);
  __pyx_v_self->_tuple = __pyx_v_record;

  /* "memray/_memray.pyx":546
 *     def __cinit__(self, record):
 *         self._tuple = record
 *         self._stack_trace_cache = {}             # <<<<<<<<<<<<<<
 *         self.intervals = []
 * 
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_stack_trace_cache);
  __Pyx_DECREF(__pyx_v_self->_stack_trace_cache);
  __pyx_v_self->_stack_trace_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":547
 *         self._tuple = record
 *         self._stack_trace_cache = {}
 *         self.intervals = []             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->intervals);
  __Pyx_DECREF(__pyx_v_self->intervals);
  __pyx_v_self->intervals = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":544
 *     cdef public object intervals
 * 
 *     def __cinit__(self, record):             # <<<<<<<<<<<<<<
 *         self._tuple = record
 *         self._stack_trace_cache = {}
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":549
 *         self.intervals = []
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if type(other) != TemporalAllocationRecord:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_2__eq__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_2__eq__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_o = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "memray/_memray.pyx":550
 * 
 *     def __eq__(self, other):
 *         if type(other) != TemporalAllocationRecord:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         cdef TemporalAllocationRecord o = other
*/
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_other)), ((PyObject *)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":551
 *     def __eq__(self, other):
 *         if type(other) != TemporalAllocationRecord:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         cdef TemporalAllocationRecord o = other
 *         return self._tuple == o._tuple and self._intervals == o._intervals
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;

    /* "memray/_memray.pyx":550
 * 
 *     def __eq__(self, other):
 *         if type(other) != TemporalAllocationRecord:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         cdef TemporalAllocationRecord o = other
*/
  }

  /* "memray/_memray.pyx":552
 *         if type(other) != TemporalAllocationRecord:
 *             return NotImplemented
 *         cdef TemporalAllocationRecord o = other             # <<<<<<<<<<<<<<
 *         return self._tuple == o._tuple and self._intervals == o._intervals
 * 
*/
  __pyx_t_1 = __pyx_v_other;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord))))) __PYX_ERR(0, 552, __pyx_L1_error)
  __pyx_v_o = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":553
 *             return NotImplemented
 *         cdef TemporalAllocationRecord o = other
 *         return self._tuple == o._tuple and self._intervals == o._intervals             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_self->_tuple, __pyx_v_o->_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 553, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_intervals); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_o), __pyx_mstate_global->__pyx_n_u_intervals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":549
 *         self.intervals = []
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if type(other) != TemporalAllocationRecord:
 *             return NotImplemented
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":555
 *         return self._tuple == o._tuple and self._intervals == o._intervals
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_5__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_5__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_4__hash__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_4__hash__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "memray/_memray.pyx":556
 * 
 *     def __hash__(self):
 *         return hash(self._tuple)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_1 = __pyx_v_self->_tuple;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "memray/_memray.pyx":555
 *         return self._tuple == o._tuple and self._intervals == o._intervals
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._tuple)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":558
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3tid_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_3tid___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_3tid___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":560
 *     @property
 *     def tid(self):
 *         return self._tuple[0]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":558
 *         return hash(self._tuple)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tid(self):
 *         return self._tuple[0]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":562
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allocator(self):
 *         return self._tuple[1]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9allocator_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9allocator_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9allocator___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9allocator___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":564
 *     @property
 *     def allocator(self):
 *         return self._tuple[1]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":562
 *         return self._tuple[0]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allocator(self):
 *         return self._tuple[1]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.allocator.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":566
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[2]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_8stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_8stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8stack_id___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8stack_id___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":568
 *     @property
 *     def stack_id(self):
 *         return self._tuple[2]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":566
 *         return self._tuple[1]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stack_id(self):
 *         return self._tuple[2]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":570
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[3]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":572
 *     @property
 *     def native_stack_id(self):
 *         return self._tuple[3]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":570
 *         return self._tuple[2]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_stack_id(self):
 *         return self._tuple[3]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.native_stack_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":574
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[4]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":576
 *     @property
 *     def native_segment_generation(self):
 *         return self._tuple[4]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->_tuple, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":574
 *         return self._tuple[3]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def native_segment_generation(self):
 *         return self._tuple[4]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.native_segment_generation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":578
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11thread_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11thread_name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_11thread_name___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_11thread_name___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  long __pyx_t_3;
  std::string __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":580
 *     @property
 *     def thread_name(self):
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."             # <<<<<<<<<<<<<<
 *         return self._reader.get().getThreadName(self.tid)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_reader.get() != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_mstate_global->__pyx_kp_u_Cannot_get_thread_name_without_r, 0, 0);
      __PYX_ERR(0, 580, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 580, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":581
 *     def thread_name(self):
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
 *         return self._reader.get().getThreadName(self.tid)             # <<<<<<<<<<<<<<
 * 
 *     def stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_As_long(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 581, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  try {
    __pyx_t_4 = __pyx_v_self->_reader.get()->getThreadName(__pyx_t_3);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 581, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":578
 *         return self._tuple[4]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def thread_name(self):
 *         assert self._reader.get() != NULL, "Cannot get thread name without reader."
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.thread_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":583
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_24TemporalAllocationRecord_6stack_trace, "TemporalAllocationRecord.stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_7stack_trace = {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_6stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_7stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 583, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 583, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "stack_trace", 0) < (0)) __PYX_ERR(0, 583, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 583, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 583, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_6stack_trace(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_6stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_6memray_7_memray_stack_trace __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stack_trace", 0);

  /* "memray/_memray.pyx":584
 * 
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_python);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_python);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_python) != (0)) __PYX_ERR(0, 584, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 584, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":585
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 585, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 585, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":588
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 self.allocator,
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":589
 *                 self._reader.get(),
 *                 self.tid,
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.stack_id,
 *                 max_stacks,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":590
 *                 self.tid,
 *                 self.allocator,
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":586
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.max_stacks = __pyx_v_max_stacks;
    __pyx_t_5 = __pyx_f_6memray_7_memray_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, &__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 586, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_5) < 0))) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "memray/_memray.pyx":585
 *     def stack_trace(self, max_stacks=None):
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":593
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def native_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 593, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":583
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":595
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace, "TemporalAllocationRecord.native_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace = {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("native_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 595, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 595, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "native_stack_trace", 0) < (0)) __PYX_ERR(0, 595, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 595, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("native_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 595, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_6memray_7_memray_native_stack_trace __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("native_stack_trace", 0);

  /* "memray/_memray.pyx":596
 * 
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_native);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_native);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_native) != (0)) __PYX_ERR(0, 596, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 596, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":597
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 597, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 597, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":600
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":601
 *                 self._reader.get(),
 *                 self.allocator,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":602
 *                 self.allocator,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":598
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = native_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.allocator,
*/
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.max_stacks = __pyx_v_max_stacks;
    __pyx_t_5 = __pyx_f_6memray_7_memray_native_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, &__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 598, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_5) < 0))) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "memray/_memray.pyx":597
 *     def native_stack_trace(self, max_stacks=None):
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = native_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":605
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 605, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":595
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.native_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":607
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace, "TemporalAllocationRecord.hybrid_stack_trace(self, max_stacks=None)");
static PyMethodDef __pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace = {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace};
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_stacks = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hybrid_stack_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_stacks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 607, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 607, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "hybrid_stack_trace", 0) < (0)) __PYX_ERR(0, 607, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 607, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_max_stacks = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hybrid_stack_trace", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 607, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), __pyx_v_max_stacks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_max_stacks) {
  PyObject *__pyx_v_cache_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  struct __pyx_opt_args_6memray_7_memray_hybrid_stack_trace __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hybrid_stack_trace", 0);

  /* "memray/_memray.pyx":608
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)             # <<<<<<<<<<<<<<
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_hybrid);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_hybrid) != (0)) __PYX_ERR(0, 608, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_stacks);
  __Pyx_GIVEREF(__pyx_v_max_stacks);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_max_stacks) != (0)) __PYX_ERR(0, 608, __pyx_L1_error);
  __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":609
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 609, __pyx_L1_error)
  }
  __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_cache_key, __pyx_v_self->_stack_trace_cache, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 609, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":612
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
 *                 self.tid,             # <<<<<<<<<<<<<<
 *                 self.allocator,
 *                 self.stack_id,
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":613
 *                 self._reader.get(),
 *                 self.tid,
 *                 self.allocator,             # <<<<<<<<<<<<<<
 *                 self.stack_id,
 *                 self.native_stack_id,
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_allocator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "memray/_memray.pyx":614
 *                 self.tid,
 *                 self.allocator,
 *                 self.stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_stack_id,
 *                 self.native_segment_generation,
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_stack_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":615
 *                 self.allocator,
 *                 self.stack_id,
 *                 self.native_stack_id,             # <<<<<<<<<<<<<<
 *                 self.native_segment_generation,
 *                 max_stacks,
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_stack_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":616
 *                 self.stack_id,
 *                 self.native_stack_id,
 *                 self.native_segment_generation,             # <<<<<<<<<<<<<<
 *                 max_stacks,
 *             )
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_native_segment_generation); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "memray/_memray.pyx":610
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(             # <<<<<<<<<<<<<<
 *                 self._reader.get(),
 *                 self.tid,
*/
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.max_stacks = __pyx_v_max_stacks;
    __pyx_t_7 = __pyx_f_6memray_7_memray_hybrid_stack_trace(__pyx_v_self->_reader.get(), __pyx_t_1, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, &__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 610, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key, __pyx_t_7) < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "memray/_memray.pyx":609
 *     def hybrid_stack_trace(self, max_stacks=None):
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:             # <<<<<<<<<<<<<<
 *             self._stack_trace_cache[cache_key] = hybrid_stack_trace(
 *                 self._reader.get(),
*/
  }

  /* "memray/_memray.pyx":619
 *                 max_stacks,
 *             )
 *         return self._stack_trace_cache[cache_key]             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_stack_trace_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 619, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_self->_stack_trace_cache, __pyx_v_cache_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":607
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.hybrid_stack_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":542
 *     cdef dict _stack_trace_cache
 *     cdef shared_ptr[RecordReader] _reader
 *     cdef public object intervals             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, record):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals___get__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals___get__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->intervals);
  __pyx_r = __pyx_v_self->intervals;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_2__set__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_2__set__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->intervals);
  __Pyx_DECREF(__pyx_v_self->intervals);
  __pyx_v_self->intervals = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_4__del__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_9intervals_4__del__(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->intervals);
  __Pyx_DECREF(__pyx_v_self->intervals);
  __pyx_v_self->intervals = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__, "TemporalAllocationRecord.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__, "TemporalAllocationRecord.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TemporalAllocationRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":622
 * 
 * 
 * cdef create_temporal_allocation_record(             # <<<<<<<<<<<<<<
 *     const HighWaterMarkLocationKey& key,
 *     shared_ptr[RecordReader] reader,
*/

static PyObject *__pyx_f_6memray_7_memray_create_temporal_allocation_record(memray::api::HighWaterMarkLocationKey const &__pyx_v_key, std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader) {
  PyObject *__pyx_v_elem = 0;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_alloc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_temporal_allocation_record", 0);

  /* "memray/_memray.pyx":627
 * ):
 *     cdef object elem = (
 *         key.thread_id,             # <<<<<<<<<<<<<<
 *         <int>key.allocator,
 *         key.python_frame_id,
*/
  __pyx_t_1 = __Pyx_PyLong_From_unsigned_long(__pyx_v_key.thread_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "memray/_memray.pyx":628
 *     cdef object elem = (
 *         key.thread_id,
 *         <int>key.allocator,             # <<<<<<<<<<<<<<
 *         key.python_frame_id,
 *         key.native_frame_id,
*/
  __pyx_t_2 = __Pyx_PyLong_From_int(((int)__pyx_v_key.allocator)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "memray/_memray.pyx":629
 *         key.thread_id,
 *         <int>key.allocator,
 *         key.python_frame_id,             # <<<<<<<<<<<<<<
 *         key.native_frame_id,
 *         key.native_segment_generation,
*/
  __pyx_t_3 = __Pyx_PyLong_FromSize_t(__pyx_v_key.python_frame_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":630
 *         <int>key.allocator,
 *         key.python_frame_id,
 *         key.native_frame_id,             # <<<<<<<<<<<<<<
 *         key.native_segment_generation,
 *     )
*/
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_key.native_frame_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "memray/_memray.pyx":631
 *         key.python_frame_id,
 *         key.native_frame_id,
 *         key.native_segment_generation,             # <<<<<<<<<<<<<<
 *     )
 *     cdef TemporalAllocationRecord alloc = TemporalAllocationRecord(elem)
*/
  __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_v_key.native_segment_generation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "memray/_memray.pyx":627
 * ):
 *     cdef object elem = (
 *         key.thread_id,             # <<<<<<<<<<<<<<
 *         <int>key.allocator,
 *         key.python_frame_id,
*/
  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 627, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 627, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 627, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 627, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5) != (0)) __PYX_ERR(0, 627, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_v_elem = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "memray/_memray.pyx":633
 *         key.native_segment_generation,
 *     )
 *     cdef TemporalAllocationRecord alloc = TemporalAllocationRecord(elem)             # <<<<<<<<<<<<<<
 *     alloc._reader = reader
 *     return alloc
*/
  __pyx_t_5 = NULL;
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_elem};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_6);
  }
  __pyx_v_alloc = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "memray/_memray.pyx":634
 *     )
 *     cdef TemporalAllocationRecord alloc = TemporalAllocationRecord(elem)
 *     alloc._reader = reader             # <<<<<<<<<<<<<<
 *     return alloc
 * 
*/
  __pyx_v_alloc->_reader = __pyx_v_reader;

  /* "memray/_memray.pyx":635
 *     cdef TemporalAllocationRecord alloc = TemporalAllocationRecord(elem)
 *     alloc._reader = reader
 *     return alloc             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_alloc);
  __pyx_r = ((PyObject *)__pyx_v_alloc);
  goto __pyx_L0;

  /* "memray/_memray.pyx":622
 * 
 * 
 * cdef create_temporal_allocation_record(             # <<<<<<<<<<<<<<
 *     const HighWaterMarkLocationKey& key,
 *     shared_ptr[RecordReader] reader,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.create_temporal_allocation_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF((PyObject *)__pyx_v_alloc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":646
 *     cdef size_t idx
 * 
 *     cdef setup(             # <<<<<<<<<<<<<<
 *         self,
 *         vector[AllocationLifetime]&& lifetimes,
*/

static PyObject *__pyx_f_6memray_7_memray_27TemporalAllocationGenerator_setup(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self, std::vector<memray::api::AllocationLifetime>  &&__pyx_v_lifetimes, std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setup", 0);

  /* "memray/_memray.pyx":651
 *         shared_ptr[RecordReader] reader,
 *     ):
 *         self.lifetimes = move(lifetimes)             # <<<<<<<<<<<<<<
 *         self.reader = move(reader)
 * 
*/
  __pyx_v_self->lifetimes = cython_std::move<std::vector<memray::api::AllocationLifetime>  &&>(__pyx_v_lifetimes);

  /* "memray/_memray.pyx":652
 *     ):
 *         self.lifetimes = move(lifetimes)
 *         self.reader = move(reader)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_v_self->reader = cython_std::move<std::shared_ptr<memray::api::RecordReader> >(__pyx_v_reader);

  /* "memray/_memray.pyx":646
 *     cdef size_t idx
 * 
 *     cdef setup(             # <<<<<<<<<<<<<<
 *         self,
 *         vector[AllocationLifetime]&& lifetimes,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":654
 *         self.reader = move(reader)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_27TemporalAllocationGenerator___iter__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator___iter__(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "memray/_memray.pyx":655
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "memray/_memray.pyx":654
 *         self.reader = move(reader)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":657
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         to_return = None
 *         cdef AllocationLifetime lifetime
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_2__next__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_2__next__(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *__pyx_v_to_return = NULL;
  memray::api::AllocationLifetime __pyx_v_lifetime;
  PyObject *__pyx_v_deallocated_before_snapshot = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  memray::api::HighWaterMarkLocationKey __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "memray/_memray.pyx":658
 * 
 *     def __next__(self):
 *         to_return = None             # <<<<<<<<<<<<<<
 *         cdef AllocationLifetime lifetime
 *         while self.idx < self.lifetimes.size():
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_to_return = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)Py_None);

  /* "memray/_memray.pyx":660
 *         to_return = None
 *         cdef AllocationLifetime lifetime
 *         while self.idx < self.lifetimes.size():             # <<<<<<<<<<<<<<
 *             lifetime = self.lifetimes[self.idx]
 *             self.idx += 1
*/
  while (1) {
    __pyx_t_1 = (__pyx_v_self->idx < __pyx_v_self->lifetimes.size());
    if (!__pyx_t_1) break;

    /* "memray/_memray.pyx":661
 *         cdef AllocationLifetime lifetime
 *         while self.idx < self.lifetimes.size():
 *             lifetime = self.lifetimes[self.idx]             # <<<<<<<<<<<<<<
 *             self.idx += 1
 * 
*/
    __pyx_v_lifetime = (__pyx_v_self->lifetimes[__pyx_v_self->idx]);

    /* "memray/_memray.pyx":662
 *         while self.idx < self.lifetimes.size():
 *             lifetime = self.lifetimes[self.idx]
 *             self.idx += 1             # <<<<<<<<<<<<<<
 * 
 *             if lifetime.key != self.last_key:
*/
    __pyx_v_self->idx = (__pyx_v_self->idx + 1);

    /* "memray/_memray.pyx":664
 *             self.idx += 1
 * 
 *             if lifetime.key != self.last_key:             # <<<<<<<<<<<<<<
 *                 if self.curr_record is not None:
 *                     to_return = self.curr_record
*/
    __pyx_t_1 = ((__pyx_v_lifetime.key != __pyx_v_self->last_key) != 0);
    if (__pyx_t_1) {

      /* "memray/_memray.pyx":665
 * 
 *             if lifetime.key != self.last_key:
 *                 if self.curr_record is not None:             # <<<<<<<<<<<<<<
 *                     to_return = self.curr_record
 *                 self.last_key = lifetime.key
*/
      __pyx_t_1 = (((PyObject *)__pyx_v_self->curr_record) != Py_None);
      if (__pyx_t_1) {

        /* "memray/_memray.pyx":666
 *             if lifetime.key != self.last_key:
 *                 if self.curr_record is not None:
 *                     to_return = self.curr_record             # <<<<<<<<<<<<<<
 *                 self.last_key = lifetime.key
 *                 self.curr_record = create_temporal_allocation_record(
*/
        __pyx_t_2 = ((PyObject *)__pyx_v_self->curr_record);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_to_return, ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "memray/_memray.pyx":665
 * 
 *             if lifetime.key != self.last_key:
 *                 if self.curr_record is not None:             # <<<<<<<<<<<<<<
 *                     to_return = self.curr_record
 *                 self.last_key = lifetime.key
*/
      }

      /* "memray/_memray.pyx":667
 *                 if self.curr_record is not None:
 *                     to_return = self.curr_record
 *                 self.last_key = lifetime.key             # <<<<<<<<<<<<<<
 *                 self.curr_record = create_temporal_allocation_record(
 *                     lifetime.key, self.reader
*/
      __pyx_t_3 = __pyx_v_lifetime.key;
      __pyx_v_self->last_key = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);

      /* "memray/_memray.pyx":668
 *                     to_return = self.curr_record
 *                 self.last_key = lifetime.key
 *                 self.curr_record = create_temporal_allocation_record(             # <<<<<<<<<<<<<<
 *                     lifetime.key, self.reader
 *                 )
*/
      __pyx_t_2 = __pyx_f_6memray_7_memray_create_temporal_allocation_record(__pyx_v_lifetime.key, __pyx_v_self->reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord))))) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->curr_record);
      __Pyx_DECREF((PyObject *)__pyx_v_self->curr_record);
      __pyx_v_self->curr_record = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "memray/_memray.pyx":664
 *             self.idx += 1
 * 
 *             if lifetime.key != self.last_key:             # <<<<<<<<<<<<<<
 *                 if self.curr_record is not None:
 *                     to_return = self.curr_record
*/
    }

    /* "memray/_memray.pyx":672
 *                 )
 * 
 *             if lifetime.deallocatedBeforeSnapshot == <size_t>(-1):             # <<<<<<<<<<<<<<
 *                 deallocated_before_snapshot = None
 *             else:
*/
    __pyx_t_1 = (__pyx_v_lifetime.deallocatedBeforeSnapshot == ((size_t)-1L));
    if (__pyx_t_1) {

      /* "memray/_memray.pyx":673
 * 
 *             if lifetime.deallocatedBeforeSnapshot == <size_t>(-1):
 *                 deallocated_before_snapshot = None             # <<<<<<<<<<<<<<
 *             else:
 *                 deallocated_before_snapshot = lifetime.deallocatedBeforeSnapshot
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_deallocated_before_snapshot, Py_None);

      /* "memray/_memray.pyx":672
 *                 )
 * 
 *             if lifetime.deallocatedBeforeSnapshot == <size_t>(-1):             # <<<<<<<<<<<<<<
 *                 deallocated_before_snapshot = None
 *             else:
*/
      goto __pyx_L7;
    }

    /* "memray/_memray.pyx":675
 *                 deallocated_before_snapshot = None
 *             else:
 *                 deallocated_before_snapshot = lifetime.deallocatedBeforeSnapshot             # <<<<<<<<<<<<<<
 * 
 *             self.curr_record.intervals.append(
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_lifetime.deallocatedBeforeSnapshot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_deallocated_before_snapshot, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L7:;

    /* "memray/_memray.pyx":678
 * 
 *             self.curr_record.intervals.append(
 *                 Interval(             # <<<<<<<<<<<<<<
 *                     lifetime.allocatedBeforeSnapshot,
 *                     deallocated_before_snapshot,
*/
    __pyx_t_4 = NULL;

    /* "memray/_memray.pyx":679
 *             self.curr_record.intervals.append(
 *                 Interval(
 *                     lifetime.allocatedBeforeSnapshot,             # <<<<<<<<<<<<<<
 *                     deallocated_before_snapshot,
 *                     lifetime.n_allocations,
*/
    __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_v_lifetime.allocatedBeforeSnapshot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "memray/_memray.pyx":681
 *                     lifetime.allocatedBeforeSnapshot,
 *                     deallocated_before_snapshot,
 *                     lifetime.n_allocations,             # <<<<<<<<<<<<<<
 *                     lifetime.n_bytes,
 *                 )
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_lifetime.n_allocations); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "memray/_memray.pyx":682
 *                     deallocated_before_snapshot,
 *                     lifetime.n_allocations,
 *                     lifetime.n_bytes,             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/
    __pyx_t_7 = __Pyx_PyLong_FromSize_t(__pyx_v_lifetime.n_bytes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_t_5, __pyx_v_deallocated_before_snapshot, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_Interval, __pyx_callargs+__pyx_t_8, (5-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_2);
    }

    /* "memray/_memray.pyx":677
 *                 deallocated_before_snapshot = lifetime.deallocatedBeforeSnapshot
 * 
 *             self.curr_record.intervals.append(             # <<<<<<<<<<<<<<
 *                 Interval(
 *                     lifetime.allocatedBeforeSnapshot,
*/
    __pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_self->curr_record->intervals, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 677, __pyx_L1_error)
    __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;

    /* "memray/_memray.pyx":686
 *             )
 * 
 *             if to_return is not None:             # <<<<<<<<<<<<<<
 *                 return to_return
 * 
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_to_return) != Py_None);
    if (__pyx_t_1) {

      /* "memray/_memray.pyx":687
 * 
 *             if to_return is not None:
 *                 return to_return             # <<<<<<<<<<<<<<
 * 
 *         if self.curr_record is not None:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_to_return);
      __pyx_r = ((PyObject *)__pyx_v_to_return);
      goto __pyx_L0;

      /* "memray/_memray.pyx":686
 *             )
 * 
 *             if to_return is not None:             # <<<<<<<<<<<<<<
 *                 return to_return
 * 
*/
    }
  }

  /* "memray/_memray.pyx":689
 *                 return to_return
 * 
 *         if self.curr_record is not None:             # <<<<<<<<<<<<<<
 *             to_return = self.curr_record
 *             self.curr_record = None
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_self->curr_record) != Py_None);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":690
 * 
 *         if self.curr_record is not None:
 *             to_return = self.curr_record             # <<<<<<<<<<<<<<
 *             self.curr_record = None
 *             return to_return
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self->curr_record);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_to_return, ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "memray/_memray.pyx":691
 *         if self.curr_record is not None:
 *             to_return = self.curr_record
 *             self.curr_record = None             # <<<<<<<<<<<<<<
 *             return to_return
 *         raise StopIteration
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->curr_record);
    __Pyx_DECREF((PyObject *)__pyx_v_self->curr_record);
    __pyx_v_self->curr_record = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)Py_None);

    /* "memray/_memray.pyx":692
 *             to_return = self.curr_record
 *             self.curr_record = None
 *             return to_return             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_to_return);
    __pyx_r = ((PyObject *)__pyx_v_to_return);
    goto __pyx_L0;

    /* "memray/_memray.pyx":689
 *                 return to_return
 * 
 *         if self.curr_record is not None:             # <<<<<<<<<<<<<<
 *             to_return = self.curr_record
 *             self.curr_record = None
*/
  }

  /* "memray/_memray.pyx":693
 *             self.curr_record = None
 *             return to_return
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_error_without_exception = 1;
  goto __pyx_L1_error;;

  /* "memray/_memray.pyx":657
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         to_return = None
 *         cdef AllocationLifetime lifetime
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("memray._memray.TemporalAllocationGenerator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_to_return);
  __Pyx_XDECREF(__pyx_v_deallocated_before_snapshot);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__, "TemporalAllocationGenerator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_last_key_self_lifetimes_sel, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TemporalAllocationGenerator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__, "TemporalAllocationGenerator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.TemporalAllocationGenerator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__(((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_last_key_self_lifetimes_sel, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.TemporalAllocationGenerator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":761
 *     cdef object _surviving_objects
 * 
 *     cdef unique_ptr[Sink] _make_writer(self, destination) except*:             # <<<<<<<<<<<<<<
 *         # Creating a Sink can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
*/

static std::unique_ptr<memray::io::Sink>  __pyx_f_6memray_7_memray_7Tracker__make_writer(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, PyObject *__pyx_v_destination) {
  int __pyx_v_is_dev_null;
  std::unique_ptr<memray::io::Sink>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  memray::io::NullSink *__pyx_t_15;
  std::string __pyx_t_16;
  bool __pyx_t_17;
  bool __pyx_t_18;
  memray::io::FileSink *__pyx_t_19;
  unsigned int __pyx_t_20;
  memray::io::SocketSink *__pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_writer", 0);

  /* "memray/_memray.pyx":764
 *         # Creating a Sink can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
 *         if isinstance(destination, FileDestination):             # <<<<<<<<<<<<<<
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FileDestination); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_destination, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":765
 *         # handlers). If this happens, this method will propagate the appropriate exception.
 *         if isinstance(destination, FileDestination):
 *             is_dev_null = False             # <<<<<<<<<<<<<<
 *             with contextlib.suppress(OSError):
 *                 if pathlib.Path("/dev/null").samefile(destination.path):
*/
    __pyx_v_is_dev_null = 0;

    /* "memray/_memray.pyx":766
 *         if isinstance(destination, FileDestination):
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):             # <<<<<<<<<<<<<<
 *                 if pathlib.Path("/dev/null").samefile(destination.path):
 *                     is_dev_null = True
*/
    /*with:*/ {
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_contextlib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_suppress); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)(((PyTypeObject*)PyExc_OSError)))};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      /*try:*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          /*try:*/ {

            /* "memray/_memray.pyx":767
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):
 *                 if pathlib.Path("/dev/null").samefile(destination.path):             # <<<<<<<<<<<<<<
 *                     is_dev_null = True
 * 
*/
            __pyx_t_3 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_pathlib); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 767, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 767, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_dev_null};
              __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_4);
            }
            __pyx_t_5 = __pyx_t_4;
            __Pyx_INCREF(__pyx_t_5);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_path); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 767, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_6 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_samefile, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 767, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (__pyx_t_2) {

              /* "memray/_memray.pyx":768
 *             with contextlib.suppress(OSError):
 *                 if pathlib.Path("/dev/null").samefile(destination.path):
 *                     is_dev_null = True             # <<<<<<<<<<<<<<
 * 
 *             if is_dev_null:
*/
              __pyx_v_is_dev_null = 1;

              /* "memray/_memray.pyx":767
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):
 *                 if pathlib.Path("/dev/null").samefile(destination.path):             # <<<<<<<<<<<<<<
 *                     is_dev_null = True
 * 
*/
            }

            /* "memray/_memray.pyx":766
 *         if isinstance(destination, FileDestination):
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):             # <<<<<<<<<<<<<<
 *                 if pathlib.Path("/dev/null").samefile(destination.path):
 *                     is_dev_null = True
*/
          }
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          goto __pyx_L13_try_end;
          __pyx_L8_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("memray._memray.Tracker._make_writer", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_12) < 0) __PYX_ERR(0, 766, __pyx_L10_except_error)
            __Pyx_XGOTREF(__pyx_t_1);
            __Pyx_XGOTREF(__pyx_t_4);
            __Pyx_XGOTREF(__pyx_t_12);
            __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 766, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (__pyx_t_2 < (0)) __PYX_ERR(0, 766, __pyx_L10_except_error)
            __pyx_t_14 = (!__pyx_t_2);
            if (unlikely(__pyx_t_14)) {
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_4);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_4, __pyx_t_12);
              __pyx_t_1 = 0;  __pyx_t_4 = 0;  __pyx_t_12 = 0; 
              __PYX_ERR(0, 766, __pyx_L10_except_error)
            }
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L9_exception_handled;
          }
          __pyx_L10_except_error:;
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          goto __pyx_L1_error;
          __pyx_L9_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          __pyx_L13_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_7) {
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[1], NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 766, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
      goto __pyx_L18;
      __pyx_L4_error:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L1_error;
      __pyx_L18:;
    }

    /* "memray/_memray.pyx":770
 *                     is_dev_null = True
 * 
 *             if is_dev_null:             # <<<<<<<<<<<<<<
 *                 return unique_ptr[Sink](new NullSink())
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),
*/
    if (__pyx_v_is_dev_null) {

      /* "memray/_memray.pyx":771
 * 
 *             if is_dev_null:
 *                 return unique_ptr[Sink](new NullSink())             # <<<<<<<<<<<<<<
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),
 *                                                  destination.overwrite,
*/
      try {
        __pyx_t_15 = new memray::io::NullSink();
      } catch(...) {
        try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
        __PYX_ERR(0, 771, __pyx_L1_error)
      }
      __pyx_r = std::unique_ptr<memray::io::Sink> (__pyx_t_15);
      goto __pyx_L0;

      /* "memray/_memray.pyx":770
 *                     is_dev_null = True
 * 
 *             if is_dev_null:             # <<<<<<<<<<<<<<
 *                 return unique_ptr[Sink](new NullSink())
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),
*/
    }

    /* "memray/_memray.pyx":772
 *             if is_dev_null:
 *                 return unique_ptr[Sink](new NullSink())
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),             # <<<<<<<<<<<<<<
 *                                                  destination.overwrite,
 *                                                  destination.compress_on_exit))
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_fsencode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_1};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __pyx_t_16 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "memray/_memray.pyx":773
 *                 return unique_ptr[Sink](new NullSink())
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),
 *                                                  destination.overwrite,             # <<<<<<<<<<<<<<
 *                                                  destination.compress_on_exit))
 * 
*/
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_overwrite); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "memray/_memray.pyx":774
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),
 *                                                  destination.overwrite,
 *                                                  destination.compress_on_exit))             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(destination, SocketDestination):
*/
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_compress_on_exit); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    /* "memray/_memray.pyx":772
 *             if is_dev_null:
 *                 return unique_ptr[Sink](new NullSink())
 *             return unique_ptr[Sink](new FileSink(os.fsencode(destination.path),             # <<<<<<<<<<<<<<
 *                                                  destination.overwrite,
 *                                                  destination.compress_on_exit))
*/
    try {
      __pyx_t_19 = new memray::io::FileSink(__pyx_t_16, __pyx_t_17, __pyx_t_18);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
      __PYX_ERR(0, 772, __pyx_L1_error)
    }
    __pyx_r = std::unique_ptr<memray::io::Sink> (__pyx_t_19);
    goto __pyx_L0;

    /* "memray/_memray.pyx":764
 *         # Creating a Sink can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
 *         if isinstance(destination, FileDestination):             # <<<<<<<<<<<<<<
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):
*/
  }

  /* "memray/_memray.pyx":776
 *                                                  destination.compress_on_exit))
 * 
 *         elif isinstance(destination, SocketDestination):             # <<<<<<<<<<<<<<
 *             return unique_ptr[Sink](new SocketSink(destination.address, destination.server_port))
 *         else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_SocketDestination); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = PyObject_IsInstance(__pyx_v_destination, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (likely(__pyx_t_14)) {

    /* "memray/_memray.pyx":777
 * 
 *         elif isinstance(destination, SocketDestination):
 *             return unique_ptr[Sink](new SocketSink(destination.address, destination.server_port))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError("destination must be a SocketDestination or FileDestination")
*/
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_address_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_16 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination, __pyx_mstate_global->__pyx_n_u_server_port); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_20 = __Pyx_PyLong_As_unsigned_int(__pyx_t_12); if (unlikely((__pyx_t_20 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    try {
      __pyx_t_21 = new memray::io::SocketSink(__pyx_t_16, __pyx_t_20);
    } catch(...) {
      try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
      __PYX_ERR(0, 777, __pyx_L1_error)
    }
    __pyx_r = std::unique_ptr<memray::io::Sink> (__pyx_t_21);
    goto __pyx_L0;

    /* "memray/_memray.pyx":776
 *                                                  destination.compress_on_exit))
 * 
 *         elif isinstance(destination, SocketDestination):             # <<<<<<<<<<<<<<
 *             return unique_ptr[Sink](new SocketSink(destination.address, destination.server_port))
 *         else:
*/
  }

  /* "memray/_memray.pyx":779
 *             return unique_ptr[Sink](new SocketSink(destination.address, destination.server_port))
 *         else:
 *             raise TypeError("destination must be a SocketDestination or FileDestination")             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, object file_name=None, *, object destination=None,
*/
  /*else*/ {
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_destination_must_be_a_SocketDest};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 779, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 779, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":761
 *     cdef object _surviving_objects
 * 
 *     cdef unique_ptr[Sink] _make_writer(self, destination) except*:             # <<<<<<<<<<<<<<
 *         # Creating a Sink can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("memray._memray.Tracker._make_writer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":781
 *             raise TypeError("destination must be a SocketDestination or FileDestination")
 * 
 *     def __cinit__(self, object file_name=None, *, object destination=None,             # <<<<<<<<<<<<<<
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,
 *                   bool follow_fork=False, bool trace_python_allocators=False,
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_7Tracker_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_7Tracker_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file_name = 0;
  PyObject *__pyx_v_destination = 0;
  bool __pyx_v_native_traces;
  unsigned int __pyx_v_memory_interval_ms;
  bool __pyx_v_follow_fork;
  bool __pyx_v_trace_python_allocators;
  bool __pyx_v_track_object_lifetimes;
  enum __pyx_t_6memray_7_memray_FileFormat __pyx_v_file_format;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file_name,&__pyx_mstate_global->__pyx_n_u_destination,&__pyx_mstate_global->__pyx_n_u_native_traces,&__pyx_mstate_global->__pyx_n_u_memory_interval_ms,&__pyx_mstate_global->__pyx_n_u_follow_fork,&__pyx_mstate_global->__pyx_n_u_trace_python_allocators,&__pyx_mstate_global->__pyx_n_u_track_object_lifetimes,&__pyx_mstate_global->__pyx_n_u_file_format,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 781, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 781, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 781, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 781, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_file_name = values[0];
    __pyx_v_destination = values[1];
    if (values[2]) {
      __pyx_v_native_traces = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_native_traces == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 782, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":782
 * 
 *     def __cinit__(self, object file_name=None, *, object destination=None,
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,             # <<<<<<<<<<<<<<
 *                   bool follow_fork=False, bool trace_python_allocators=False,
 *                   bool track_object_lifetimes=False,
*/
      __pyx_v_native_traces = ((bool)0);
    }
    if (values[3]) {
      __pyx_v_memory_interval_ms = __Pyx_PyLong_As_unsigned_int(values[3]); if (unlikely((__pyx_v_memory_interval_ms == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 782, __pyx_L3_error)
    } else {
      __pyx_v_memory_interval_ms = ((unsigned int)10);
    }
    if (values[4]) {
      __pyx_v_follow_fork = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_follow_fork == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":783
 *     def __cinit__(self, object file_name=None, *, object destination=None,
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,
 *                   bool follow_fork=False, bool trace_python_allocators=False,             # <<<<<<<<<<<<<<
 *                   bool track_object_lifetimes=False,
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):
*/
      __pyx_v_follow_fork = ((bool)0);
    }
    if (values[5]) {
      __pyx_v_trace_python_allocators = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_trace_python_allocators == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
    } else {
      __pyx_v_trace_python_allocators = ((bool)0);
    }
    if (values[6]) {
      __pyx_v_track_object_lifetimes = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_track_object_lifetimes == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":784
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,
 *                   bool follow_fork=False, bool trace_python_allocators=False,
 *                   bool track_object_lifetimes=False,             # <<<<<<<<<<<<<<
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):
 *         if (file_name, destination).count(None) != 1:
*/
      __pyx_v_track_object_lifetimes = ((bool)0);
    }
    if (values[7]) {
      __pyx_v_file_format = ((enum __pyx_t_6memray_7_memray_FileFormat)__Pyx_PyLong_As_enum____pyx_t_6memray_7_memray_FileFormat(values[7])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
    } else {
      __pyx_v_file_format = __pyx_mstate_global->__pyx_k__4;
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 781, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Tracker.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker___cinit__(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self), __pyx_v_file_name, __pyx_v_destination, __pyx_v_native_traces, __pyx_v_memory_interval_ms, __pyx_v_follow_fork, __pyx_v_trace_python_allocators, __pyx_v_track_object_lifetimes, __pyx_v_file_format);

  /* "memray/_memray.pyx":781
 *             raise TypeError("destination must be a SocketDestination or FileDestination")
 * 
 *     def __cinit__(self, object file_name=None, *, object destination=None,             # <<<<<<<<<<<<<<
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,
 *                   bool follow_fork=False, bool trace_python_allocators=False,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_7Tracker___cinit__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, PyObject *__pyx_v_file_name, PyObject *__pyx_v_destination, bool __pyx_v_native_traces, unsigned int __pyx_v_memory_interval_ms, bool __pyx_v_follow_fork, bool __pyx_v_trace_python_allocators, bool __pyx_v_track_object_lifetimes, enum __pyx_t_6memray_7_memray_FileFormat __pyx_v_file_format) {
  std::string __pyx_v_command_line;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  std::string __pyx_t_10;
  std::unique_ptr<memray::io::Sink>  __pyx_t_11;
  std::unique_ptr<memray::tracking_api::RecordWriter>  __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_destination);

  /* "memray/_memray.pyx":786
 *                   bool track_object_lifetimes=False,
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):
 *         if (file_name, destination).count(None) != 1:             # <<<<<<<<<<<<<<
 *             raise TypeError("Exactly one of 'file_name' or 'destination' argument must be specified")
 * 
*/
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_file_name);
  __Pyx_GIVEREF(__pyx_v_file_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file_name) != (0)) __PYX_ERR(0, 786, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_destination);
  __Pyx_GIVEREF(__pyx_v_destination);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_destination) != (0)) __PYX_ERR(0, 786, __pyx_L1_error);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, Py_None};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_count, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_5)) {

    /* "memray/_memray.pyx":787
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):
 *         if (file_name, destination).count(None) != 1:
 *             raise TypeError("Exactly one of 'file_name' or 'destination' argument must be specified")             # <<<<<<<<<<<<<<
 * 
 *         # Check Python version if reference tracking is enabled
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Exactly_one_of_file_name_or_dest};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 787, __pyx_L1_error)

    /* "memray/_memray.pyx":786
 *                   bool track_object_lifetimes=False,
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):
 *         if (file_name, destination).count(None) != 1:             # <<<<<<<<<<<<<<
 *             raise TypeError("Exactly one of 'file_name' or 'destination' argument must be specified")
 * 
*/
  }

  /* "memray/_memray.pyx":790
 * 
 *         # Check Python version if reference tracking is enabled
 *         if track_object_lifetimes and sys.version_info < (3, 13, 3):             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
*/
  __pyx_t_6 = (__pyx_v_track_object_lifetimes != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_version_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[2], Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_5)) {

    /* "memray/_memray.pyx":791
 *         # Check Python version if reference tracking is enabled
 *         if track_object_lifetimes and sys.version_info < (3, 13, 3):
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
 *                 f"Current version: {'.'.join(map(str, sys.version_info[:3]))}"
*/
    __pyx_t_3 = NULL;

    /* "memray/_memray.pyx":793
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
 *                 f"Current version: {'.'.join(map(str, sys.version_info[:3]))}"             # <<<<<<<<<<<<<<
 *             )
 * 
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_version_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 3, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 0, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)(&PyUnicode_Type)), __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_map, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_8 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__5, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "memray/_memray.pyx":792
 *         if track_object_lifetimes and sys.version_info < (3, 13, 3):
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "             # <<<<<<<<<<<<<<
 *                 f"Current version: {'.'.join(map(str, sys.version_info[:3]))}"
 *             )
*/
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Python_object_reference_tracking, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 791, __pyx_L1_error)

    /* "memray/_memray.pyx":790
 * 
 *         # Check Python version if reference tracking is enabled
 *         if track_object_lifetimes and sys.version_info < (3, 13, 3):             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
*/
  }

  /* "memray/_memray.pyx":796
 *             )
 * 
 *         cdef cppstring command_line = " ".join(sys.argv)             # <<<<<<<<<<<<<<
 *         self._native_traces = native_traces
 *         self._track_object_lifetimes = track_object_lifetimes
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_argv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_command_line = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_10);

  /* "memray/_memray.pyx":797
 * 
 *         cdef cppstring command_line = " ".join(sys.argv)
 *         self._native_traces = native_traces             # <<<<<<<<<<<<<<
 *         self._track_object_lifetimes = track_object_lifetimes
 *         self._memory_interval_ms = memory_interval_ms
*/
  __pyx_v_self->_native_traces = __pyx_v_native_traces;

  /* "memray/_memray.pyx":798
 *         cdef cppstring command_line = " ".join(sys.argv)
 *         self._native_traces = native_traces
 *         self._track_object_lifetimes = track_object_lifetimes             # <<<<<<<<<<<<<<
 *         self._memory_interval_ms = memory_interval_ms
 *         self._follow_fork = follow_fork
*/
  __pyx_v_self->_track_object_lifetimes = __pyx_v_track_object_lifetimes;

  /* "memray/_memray.pyx":799
 *         self._native_traces = native_traces
 *         self._track_object_lifetimes = track_object_lifetimes
 *         self._memory_interval_ms = memory_interval_ms             # <<<<<<<<<<<<<<
 *         self._follow_fork = follow_fork
 *         self._trace_python_allocators = trace_python_allocators
*/
  __pyx_v_self->_memory_interval_ms = __pyx_v_memory_interval_ms;

  /* "memray/_memray.pyx":800
 *         self._track_object_lifetimes = track_object_lifetimes
 *         self._memory_interval_ms = memory_interval_ms
 *         self._follow_fork = follow_fork             # <<<<<<<<<<<<<<
 *         self._trace_python_allocators = trace_python_allocators
 * 
*/
  __pyx_v_self->_follow_fork = __pyx_v_follow_fork;

  /* "memray/_memray.pyx":801
 *         self._memory_interval_ms = memory_interval_ms
 *         self._follow_fork = follow_fork
 *         self._trace_python_allocators = trace_python_allocators             # <<<<<<<<<<<<<<
 * 
 *         if file_name is not None:
*/
  __pyx_v_self->_trace_python_allocators = __pyx_v_trace_python_allocators;

  /* "memray/_memray.pyx":803
 *         self._trace_python_allocators = trace_python_allocators
 * 
 *         if file_name is not None:             # <<<<<<<<<<<<<<
 *             destination = FileDestination(path=file_name)
 * 
*/
  __pyx_t_5 = (__pyx_v_file_name != Py_None);
  if (__pyx_t_5) {

    /* "memray/_memray.pyx":804
 * 
 *         if file_name is not None:
 *             destination = FileDestination(path=file_name)             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(destination, FileDestination):
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_FileDestination); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
      __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_path, __pyx_v_file_name, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
      __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_destination, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":803
 *         self._trace_python_allocators = trace_python_allocators
 * 
 *         if file_name is not None:             # <<<<<<<<<<<<<<
 *             destination = FileDestination(path=file_name)
 * 
*/
  }

  /* "memray/_memray.pyx":806
 *             destination = FileDestination(path=file_name)
 * 
 *         if not isinstance(destination, FileDestination):             # <<<<<<<<<<<<<<
 *             if follow_fork:
 *                 raise RuntimeError("follow_fork requires an output file")
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FileDestination); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_destination, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (__pyx_t_6) {

    /* "memray/_memray.pyx":807
 * 
 *         if not isinstance(destination, FileDestination):
 *             if follow_fork:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("follow_fork requires an output file")
 * 
*/
    __pyx_t_6 = (__pyx_v_follow_fork != 0);
    if (unlikely(__pyx_t_6)) {

      /* "memray/_memray.pyx":808
 *         if not isinstance(destination, FileDestination):
 *             if follow_fork:
 *                 raise RuntimeError("follow_fork requires an output file")             # <<<<<<<<<<<<<<
 * 
 *             if file_format != FileFormat.ALL_ALLOCATIONS:
*/
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_follow_fork_requires_an_output_f};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 808, __pyx_L1_error)

      /* "memray/_memray.pyx":807
 * 
 *         if not isinstance(destination, FileDestination):
 *             if follow_fork:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("follow_fork requires an output file")
 * 
*/
    }

    /* "memray/_memray.pyx":810
 *                 raise RuntimeError("follow_fork requires an output file")
 * 
 *             if file_format != FileFormat.ALL_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("AGGREGATED_ALLOCATIONS requires an output file")
 * 
*/
    __pyx_t_6 = (__pyx_v_file_format != __pyx_e_6memray_7_memray_ALL_ALLOCATIONS);
    if (unlikely(__pyx_t_6)) {

      /* "memray/_memray.pyx":811
 * 
 *             if file_format != FileFormat.ALL_ALLOCATIONS:
 *                 raise RuntimeError("AGGREGATED_ALLOCATIONS requires an output file")             # <<<<<<<<<<<<<<
 * 
 *         self._writer = move(
*/
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_AGGREGATED_ALLOCATIONS_requires};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 811, __pyx_L1_error)

      /* "memray/_memray.pyx":810
 *                 raise RuntimeError("follow_fork requires an output file")
 * 
 *             if file_format != FileFormat.ALL_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("AGGREGATED_ALLOCATIONS requires an output file")
 * 
*/
    }

    /* "memray/_memray.pyx":806
 *             destination = FileDestination(path=file_name)
 * 
 *         if not isinstance(destination, FileDestination):             # <<<<<<<<<<<<<<
 *             if follow_fork:
 *                 raise RuntimeError("follow_fork requires an output file")
*/
  }

  /* "memray/_memray.pyx":815
 *         self._writer = move(
 *             createRecordWriter(
 *                 move(self._make_writer(destination)),             # <<<<<<<<<<<<<<
 *                 command_line,
 *                 native_traces,
*/
  __pyx_t_11 = ((struct __pyx_vtabstruct_6memray_7_memray_Tracker *)__pyx_v_self->__pyx_vtab)->_make_writer(__pyx_v_self, __pyx_v_destination); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error)

  /* "memray/_memray.pyx":814
 * 
 *         self._writer = move(
 *             createRecordWriter(             # <<<<<<<<<<<<<<
 *                 move(self._make_writer(destination)),
 *                 command_line,
*/
  try {
    __pyx_t_12 = memray::tracking_api::createRecordWriter(cython_std::move<std::unique_ptr<memray::io::Sink> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_11)), __pyx_v_command_line, __pyx_v_native_traces, ((enum memray::tracking_api::FileFormat)__pyx_v_file_format), __pyx_v_trace_python_allocators, __pyx_v_track_object_lifetimes);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 814, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":813
 *                 raise RuntimeError("AGGREGATED_ALLOCATIONS requires an output file")
 * 
 *         self._writer = move(             # <<<<<<<<<<<<<<
 *             createRecordWriter(
 *                 move(self._make_writer(destination)),
*/
  __pyx_v_self->_writer = cython_std::move<std::unique_ptr<memray::tracking_api::RecordWriter> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12));

  /* "memray/_memray.pyx":781
 *             raise TypeError("destination must be a SocketDestination or FileDestination")
 * 
 *     def __cinit__(self, object file_name=None, *, object destination=None,             # <<<<<<<<<<<<<<
 *                   bool native_traces=False, unsigned int memory_interval_ms = 10,
 *                   bool follow_fork=False, bool trace_python_allocators=False,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("memray._memray.Tracker.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_destination);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":824
 *         )
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_7Tracker_2__enter__, "Tracker.__enter__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_3__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_2__enter__};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_2__enter__(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":845
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)
 *             if orig_set_os_name is not None:
 *                 def set_os_name_wrapper(self):             # <<<<<<<<<<<<<<
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
 *                     orig_set_os_name(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_9__enter___1set_os_name_wrapper(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_9__enter___1set_os_name_wrapper = {"set_os_name_wrapper", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_9__enter___1set_os_name_wrapper, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_9__enter___1set_os_name_wrapper(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_os_name_wrapper (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 845, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 845, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_os_name_wrapper", 0) < (0)) __PYX_ERR(0, 845, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_os_name_wrapper", 1, 1, 1, i); __PYX_ERR(0, 845, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 845, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_os_name_wrapper", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 845, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Tracker.__enter__.set_os_name_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_9__enter___set_os_name_wrapper(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_9__enter___set_os_name_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *__pyx_cur_scope;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *__pyx_outer_scope;
  CYTHON_UNUSED std::unique_ptr<memray::tracking_api::RecursionGuard>  __pyx_v_guard;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::unique_ptr<memray::tracking_api::RecursionGuard>  __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_os_name_wrapper", 0);
  __pyx_outer_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "memray/_memray.pyx":846
 *             if orig_set_os_name is not None:
 *                 def set_os_name_wrapper(self):
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()             # <<<<<<<<<<<<<<
 *                     orig_set_os_name(self)
 * 
*/
  try {
    __pyx_t_1 = std::make_unique<memray::tracking_api::RecursionGuard>();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 846, __pyx_L1_error)
  }
  __pyx_v_guard = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1);

  /* "memray/_memray.pyx":847
 *                 def set_os_name_wrapper(self):
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
 *                     orig_set_os_name(self)             # <<<<<<<<<<<<<<
 * 
 *                 setattr(threading.Thread, "_set_os_name", set_os_name_wrapper)
*/
  __pyx_t_3 = NULL;
  if (unlikely(!__pyx_cur_scope->__pyx_v_orig_set_os_name)) { __Pyx_RaiseClosureNameError("orig_set_os_name"); __PYX_ERR(0, 847, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_orig_set_os_name);
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_orig_set_os_name; 
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_self};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":845
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)
 *             if orig_set_os_name is not None:
 *                 def set_os_name_wrapper(self):             # <<<<<<<<<<<<<<
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
 *                     orig_set_os_name(self)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.Tracker.__enter__.set_os_name_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":824
 *         )
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
*/

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_2__enter__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *__pyx_cur_scope;
  std::unique_ptr<memray::tracking_api::RecordWriter>  __pyx_v_writer;
  PyObject *__pyx_v_attr = NULL;
  PyObject *__pyx_v_set_os_name_wrapper = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct____enter__(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 824, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }

  /* "memray/_memray.pyx":827
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
 *         with tracker_creation_lock:             # <<<<<<<<<<<<<<
 *             if NativeTracker.getTracker() != NULL:
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
*/
  /*with:*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_tracker_creation_lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "memray/_memray.pyx":828
 *         cdef unique_ptr[RecordWriter] writer
 *         with tracker_creation_lock:
 *             if NativeTracker.getTracker() != NULL:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
 * 
*/
          __pyx_t_10 = (memray::tracking_api::Tracker::getTracker() != NULL);
          if (unlikely(__pyx_t_10)) {

            /* "memray/_memray.pyx":829
 *         with tracker_creation_lock:
 *             if NativeTracker.getTracker() != NULL:
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")             # <<<<<<<<<<<<<<
 * 
 *             if self._writer == NULL:
*/
            __pyx_t_3 = NULL;
            __pyx_t_6 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_No_more_than_one_Tracker_instanc};
              __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_Raise(__pyx_t_1, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __PYX_ERR(0, 829, __pyx_L7_error)

            /* "memray/_memray.pyx":828
 *         cdef unique_ptr[RecordWriter] writer
 *         with tracker_creation_lock:
 *             if NativeTracker.getTracker() != NULL:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
 * 
*/
          }

          /* "memray/_memray.pyx":831
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
 * 
 *             if self._writer == NULL:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("Attempting to use stale output handle")
 *             writer = move(self._writer)
*/
          __pyx_t_10 = ((__pyx_v_self->_writer == NULL) != 0);
          if (unlikely(__pyx_t_10)) {

            /* "memray/_memray.pyx":832
 * 
 *             if self._writer == NULL:
 *                 raise RuntimeError("Attempting to use stale output handle")             # <<<<<<<<<<<<<<
 *             writer = move(self._writer)
 * 
*/
            __pyx_t_3 = NULL;
            __pyx_t_6 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Attempting_to_use_stale_output_h};
              __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_Raise(__pyx_t_1, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __PYX_ERR(0, 832, __pyx_L7_error)

            /* "memray/_memray.pyx":831
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
 * 
 *             if self._writer == NULL:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("Attempting to use stale output handle")
 *             writer = move(self._writer)
*/
          }

          /* "memray/_memray.pyx":833
 *             if self._writer == NULL:
 *                 raise RuntimeError("Attempting to use stale output handle")
 *             writer = move(self._writer)             # <<<<<<<<<<<<<<
 * 
 *             for attr in ("_name", "_ident"):
*/
          __pyx_v_writer = cython_std::move<std::unique_ptr<memray::tracking_api::RecordWriter> >(__pyx_v_self->_writer);

          /* "memray/_memray.pyx":835
 *             writer = move(self._writer)
 * 
 *             for attr in ("_name", "_ident"):             # <<<<<<<<<<<<<<
 *                 assert not hasattr(threading.Thread, attr)
 *                 setattr(
*/
          __pyx_t_1 = __pyx_mstate_global->__pyx_tuple[3]; __Pyx_INCREF(__pyx_t_1);
          __pyx_t_11 = 0;
          for (;;) {
            if (__pyx_t_11 >= 2) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11));
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_11);
            #endif
            ++__pyx_t_11;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_XDECREF_SET(__pyx_v_attr, ((PyObject*)__pyx_t_3));
            __pyx_t_3 = 0;

            /* "memray/_memray.pyx":836
 * 
 *             for attr in ("_name", "_ident"):
 *                 assert not hasattr(threading.Thread, attr)             # <<<<<<<<<<<<<<
 *                 setattr(
 *                     threading.Thread,
*/
            #ifndef CYTHON_WITHOUT_ASSERTIONS
            if (unlikely(__pyx_assertions_enabled())) {
              __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_10 = __Pyx_HasAttr(__pyx_t_5, __pyx_v_attr); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 836, __pyx_L7_error)
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_t_12 = (!__pyx_t_10);
              if (unlikely(!__pyx_t_12)) {
                __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                __PYX_ERR(0, 836, __pyx_L7_error)
              }
            }
            #else
            if ((1)); else __PYX_ERR(0, 836, __pyx_L7_error)
            #endif

            /* "memray/_memray.pyx":838
 *                 assert not hasattr(threading.Thread, attr)
 *                 setattr(
 *                     threading.Thread,             # <<<<<<<<<<<<<<
 *                     attr,
 *                     ThreadNameInterceptor(attr, NativeTracker.registerThreadNameById),
*/
            __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Thread); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "memray/_memray.pyx":840
 *                     threading.Thread,
 *                     attr,
 *                     ThreadNameInterceptor(attr, NativeTracker.registerThreadNameById),             # <<<<<<<<<<<<<<
 *                 )
 * 
*/
            __pyx_t_4 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_ThreadNameInterceptor); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 840, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = __Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(memray::tracking_api::Tracker::registerThreadNameById); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 840, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13);
              assert(__pyx_t_4);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_attr, __pyx_t_14};
              __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 840, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_5);
            }

            /* "memray/_memray.pyx":837
 *             for attr in ("_name", "_ident"):
 *                 assert not hasattr(threading.Thread, attr)
 *                 setattr(             # <<<<<<<<<<<<<<
 *                     threading.Thread,
 *                     attr,
*/
            __pyx_t_15 = PyObject_SetAttr(__pyx_t_3, __pyx_v_attr, __pyx_t_5); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 837, __pyx_L7_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "memray/_memray.pyx":835
 *             writer = move(self._writer)
 * 
 *             for attr in ("_name", "_ident"):             # <<<<<<<<<<<<<<
 *                 assert not hasattr(threading.Thread, attr)
 *                 setattr(
*/
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "memray/_memray.pyx":843
 *                 )
 * 
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)             # <<<<<<<<<<<<<<
 *             if orig_set_os_name is not None:
 *                 def set_os_name_wrapper(self):
*/
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_GetAttr3(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_set_os_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_cur_scope->__pyx_v_orig_set_os_name = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "memray/_memray.pyx":844
 * 
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)
 *             if orig_set_os_name is not None:             # <<<<<<<<<<<<<<
 *                 def set_os_name_wrapper(self):
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
*/
          __pyx_t_12 = (__pyx_cur_scope->__pyx_v_orig_set_os_name != Py_None);
          if (__pyx_t_12) {

            /* "memray/_memray.pyx":845
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)
 *             if orig_set_os_name is not None:
 *                 def set_os_name_wrapper(self):             # <<<<<<<<<<<<<<
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
 *                     orig_set_os_name(self)
*/
            __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_9__enter___1set_os_name_wrapper, 0, __pyx_mstate_global->__pyx_n_u_enter___locals_set_os_name_wra, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_v_set_os_name_wrapper = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "memray/_memray.pyx":849
 *                     orig_set_os_name(self)
 * 
 *                 setattr(threading.Thread, "_set_os_name", set_os_name_wrapper)             # <<<<<<<<<<<<<<
 * 
 *             self._previous_profile_func = sys.getprofile()
*/
            __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 849, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_15 = PyObject_SetAttr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_set_os_name, __pyx_v_set_os_name_wrapper); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 849, __pyx_L7_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "memray/_memray.pyx":844
 * 
 *             orig_set_os_name = getattr(threading.Thread, "_set_os_name", None)
 *             if orig_set_os_name is not None:             # <<<<<<<<<<<<<<
 *                 def set_os_name_wrapper(self):
 *                     cdef unique_ptr[RecursionGuard] guard = make_unique[RecursionGuard]()
*/
          }

          /* "memray/_memray.pyx":851
 *                 setattr(threading.Thread, "_set_os_name", set_os_name_wrapper)
 * 
 *             self._previous_profile_func = sys.getprofile()             # <<<<<<<<<<<<<<
 *             self._previous_thread_profile_func = threading._profile_hook
 *             threading.setprofile(start_thread_trace)
*/
          __pyx_t_1 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getprofile); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 851, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_6 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
            assert(__pyx_t_1);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
            __pyx_t_6 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_GIVEREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_v_self->_previous_profile_func);
          __Pyx_DECREF(__pyx_v_self->_previous_profile_func);
          __pyx_v_self->_previous_profile_func = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "memray/_memray.pyx":852
 * 
 *             self._previous_profile_func = sys.getprofile()
 *             self._previous_thread_profile_func = threading._profile_hook             # <<<<<<<<<<<<<<
 *             threading.setprofile(start_thread_trace)
 * 
*/
          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 852, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_profile_hook); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 852, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GIVEREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_v_self->_previous_thread_profile_func);
          __Pyx_DECREF(__pyx_v_self->_previous_thread_profile_func);
          __pyx_v_self->_previous_thread_profile_func = __pyx_t_13;
          __pyx_t_13 = 0;

          /* "memray/_memray.pyx":853
 *             self._previous_profile_func = sys.getprofile()
 *             self._previous_thread_profile_func = threading._profile_hook
 *             threading.setprofile(start_thread_trace)             # <<<<<<<<<<<<<<
 * 
 *             if "greenlet" in sys.modules:
*/
          __pyx_t_5 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_setprofile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_start_thread_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
            assert(__pyx_t_5);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
            __pyx_t_6 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1};
            __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 853, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_13);
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "memray/_memray.pyx":855
 *             threading.setprofile(start_thread_trace)
 * 
 *             if "greenlet" in sys.modules:             # <<<<<<<<<<<<<<
 *                 NativeTracker.beginTrackingGreenlets()
 * 
*/
          __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 855, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_modules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_greenlet, __pyx_t_3, Py_EQ)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 855, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_12) {

            /* "memray/_memray.pyx":856
 * 
 *             if "greenlet" in sys.modules:
 *                 NativeTracker.beginTrackingGreenlets()             # <<<<<<<<<<<<<<
 * 
 *             NativeTracker.createTracker(
*/
            try {
              memray::tracking_api::Tracker::beginTrackingGreenlets();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 856, __pyx_L7_error)
            }

            /* "memray/_memray.pyx":855
 *             threading.setprofile(start_thread_trace)
 * 
 *             if "greenlet" in sys.modules:             # <<<<<<<<<<<<<<
 *                 NativeTracker.beginTrackingGreenlets()
 * 
*/
          }

          /* "memray/_memray.pyx":858
 *                 NativeTracker.beginTrackingGreenlets()
 * 
 *             NativeTracker.createTracker(             # <<<<<<<<<<<<<<
 *                 move(writer),
 *                 self._native_traces,
*/
          try {
            __pyx_t_3 = memray::tracking_api::Tracker::createTracker(cython_std::move<std::unique_ptr<memray::tracking_api::RecordWriter> >(__pyx_v_writer), __pyx_v_self->_native_traces, __pyx_v_self->_memory_interval_ms, __pyx_v_self->_follow_fork, __pyx_v_self->_trace_python_allocators, __pyx_v_self->_track_object_lifetimes);
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 858, __pyx_L7_error)
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 858, __pyx_L7_error)
          }
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "memray/_memray.pyx":866
 *                 self._track_object_lifetimes,
 *             )
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     @cython.profile(False)
*/
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF((PyObject *)__pyx_v_self);
          __pyx_r = ((PyObject *)__pyx_v_self);
          goto __pyx_L11_try_return;

          /* "memray/_memray.pyx":827
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
 *         with tracker_creation_lock:             # <<<<<<<<<<<<<<
 *             if NativeTracker.getTracker() != NULL:
 *                 raise RuntimeError("No more than one Tracker instance can be active at the same time")
*/
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.Tracker.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_13, &__pyx_t_1) < 0) __PYX_ERR(0, 827, __pyx_L9_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_1);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 827, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (__pyx_t_12 < (0)) __PYX_ERR(0, 827, __pyx_L9_except_error)
          __pyx_t_10 = (!__pyx_t_12);
          if (unlikely(__pyx_t_10)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_1);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_13, __pyx_t_1);
            __pyx_t_3 = 0;  __pyx_t_13 = 0;  __pyx_t_1 = 0; 
            __PYX_ERR(0, 827, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 827, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_9 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 827, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L23;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L23:;
  }

  /* "memray/_memray.pyx":824
 *         )
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("memray._memray.Tracker.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attr);
  __Pyx_XDECREF(__pyx_v_set_os_name_wrapper);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":868
 *             return self
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_7Tracker_4__exit__, "Tracker.__exit__(self, exc_type, exc_value, exc_traceback)");
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_4__exit__};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_traceback = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_value,&__pyx_mstate_global->__pyx_n_u_exc_traceback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 868, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 868, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 868, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 868, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 868, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 868, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 868, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 868, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 868, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_value = values[1];
    __pyx_v_exc_traceback = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 868, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Tracker.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_4__exit__(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_exc_traceback);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_4__exit__(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback) {
  PyObject *__pyx_v_attr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "memray/_memray.pyx":870
 *     @cython.profile(False)
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:             # <<<<<<<<<<<<<<
 *             self._populate_surviving_objects()
 *         with tracker_creation_lock:
*/
  __pyx_t_1 = (__pyx_v_self->_track_object_lifetimes != 0);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":871
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:
 *             self._populate_surviving_objects()             # <<<<<<<<<<<<<<
 *         with tracker_creation_lock:
 *             NativeTracker.destroyTracker()
*/
    ((struct __pyx_vtabstruct_6memray_7_memray_Tracker *)__pyx_v_self->__pyx_vtab)->_populate_surviving_objects(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L1_error)

    /* "memray/_memray.pyx":870
 *     @cython.profile(False)
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:             # <<<<<<<<<<<<<<
 *             self._populate_surviving_objects()
 *         with tracker_creation_lock:
*/
  }

  /* "memray/_memray.pyx":872
 *         if self._track_object_lifetimes:
 *             self._populate_surviving_objects()
 *         with tracker_creation_lock:             # <<<<<<<<<<<<<<
 *             NativeTracker.destroyTracker()
 *             sys.setprofile(self._previous_profile_func)
*/
  /*with:*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_tracker_creation_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 872, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "memray/_memray.pyx":873
 *             self._populate_surviving_objects()
 *         with tracker_creation_lock:
 *             NativeTracker.destroyTracker()             # <<<<<<<<<<<<<<
 *             sys.setprofile(self._previous_profile_func)
 *             threading.setprofile(self._previous_thread_profile_func)
*/
          try {
            __pyx_t_2 = memray::tracking_api::Tracker::destroyTracker();
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L8_error)
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 873, __pyx_L8_error)
          }
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "memray/_memray.pyx":874
 *         with tracker_creation_lock:
 *             NativeTracker.destroyTracker()
 *             sys.setprofile(self._previous_profile_func)             # <<<<<<<<<<<<<<
 *             threading.setprofile(self._previous_thread_profile_func)
 * 
*/
          __pyx_t_4 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 874, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_setprofile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 874, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_7 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
            assert(__pyx_t_4);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
            __pyx_t_7 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->_previous_profile_func};
            __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "memray/_memray.pyx":875
 *             NativeTracker.destroyTracker()
 *             sys.setprofile(self._previous_profile_func)
 *             threading.setprofile(self._previous_thread_profile_func)             # <<<<<<<<<<<<<<
 * 
 *             for attr in ("_name", "_ident"):
*/
          __pyx_t_5 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 875, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_setprofile); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_7 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
            assert(__pyx_t_5);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
            __pyx_t_7 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_self->_previous_thread_profile_func};
            __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "memray/_memray.pyx":877
 *             threading.setprofile(self._previous_thread_profile_func)
 * 
 *             for attr in ("_name", "_ident"):             # <<<<<<<<<<<<<<
 *                 delattr(threading.Thread, attr)
 * 
*/
          __pyx_t_2 = __pyx_mstate_global->__pyx_tuple[3]; __Pyx_INCREF(__pyx_t_2);
          __pyx_t_11 = 0;
          for (;;) {
            if (__pyx_t_11 >= 2) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11));
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11);
            #endif
            ++__pyx_t_11;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 877, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_XDECREF_SET(__pyx_v_attr, ((PyObject*)__pyx_t_6));
            __pyx_t_6 = 0;

            /* "memray/_memray.pyx":878
 * 
 *             for attr in ("_name", "_ident"):
 *                 delattr(threading.Thread, attr)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _populate_surviving_objects(self):
*/
            __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 878, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Thread); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_12 = __Pyx_PyObject_DelAttr(__pyx_t_5, __pyx_v_attr); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 878, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "memray/_memray.pyx":877
 *             threading.setprofile(self._previous_thread_profile_func)
 * 
 *             for attr in ("_name", "_ident"):             # <<<<<<<<<<<<<<
 *                 delattr(threading.Thread, attr)
 * 
*/
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "memray/_memray.pyx":872
 *         if self._track_object_lifetimes:
 *             self._populate_surviving_objects()
 *         with tracker_creation_lock:             # <<<<<<<<<<<<<<
 *             NativeTracker.destroyTracker()
 *             sys.setprofile(self._previous_profile_func)
*/
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.Tracker.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 872, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 872, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (__pyx_t_1 < (0)) __PYX_ERR(0, 872, __pyx_L10_except_error)
          __pyx_t_14 = (!__pyx_t_1);
          if (unlikely(__pyx_t_14)) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_5, __pyx_t_6);
            __pyx_t_2 = 0;  __pyx_t_5 = 0;  __pyx_t_6 = 0; 
            __PYX_ERR(0, 872, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_3) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 872, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L20;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }

  /* "memray/_memray.pyx":868
 *             return self
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.Tracker.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":880
 *                 delattr(threading.Thread, attr)
 * 
 *     cdef void _populate_surviving_objects(self):             # <<<<<<<<<<<<<<
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()
 *         if tracker == NULL:
*/

static void __pyx_f_6memray_7_memray_7Tracker__populate_surviving_objects(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self) {
  memray::tracking_api::Tracker *__pyx_v_tracker;
  std::unordered_set<PyObject *>  __pyx_v_objects;
  std::unordered_set<PyObject *> ::value_type __pyx_v_obj;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  std::unordered_set<PyObject *>  __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  std::unordered_set<PyObject *> ::iterator __pyx_t_4;
  std::unordered_set<PyObject *> ::value_type __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_populate_surviving_objects", 0);

  /* "memray/_memray.pyx":881
 * 
 *     cdef void _populate_surviving_objects(self):
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()             # <<<<<<<<<<<<<<
 *         if tracker == NULL:
 *             return
*/
  __pyx_v_tracker = memray::tracking_api::Tracker::getTracker();

  /* "memray/_memray.pyx":882
 *     cdef void _populate_surviving_objects(self):
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()
 *         if tracker == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_1 = (__pyx_v_tracker == NULL);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":883
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()
 *         if tracker == NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef unordered_set[PyObject*] objects = tracker.getSurvivingObjects()
*/
    goto __pyx_L0;

    /* "memray/_memray.pyx":882
 *     cdef void _populate_surviving_objects(self):
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()
 *         if tracker == NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "memray/_memray.pyx":885
 *             return
 * 
 *         cdef unordered_set[PyObject*] objects = tracker.getSurvivingObjects()             # <<<<<<<<<<<<<<
 *         self._surviving_objects = []
 *         for obj in objects:
*/
  try {
    __pyx_t_2 = __pyx_v_tracker->getSurvivingObjects();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 885, __pyx_L1_error)
  }
  __pyx_v_objects = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2);

  /* "memray/_memray.pyx":886
 * 
 *         cdef unordered_set[PyObject*] objects = tracker.getSurvivingObjects()
 *         self._surviving_objects = []             # <<<<<<<<<<<<<<
 *         for obj in objects:
 *             self._surviving_objects.append(<object>obj)
*/
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_surviving_objects);
  __Pyx_DECREF(__pyx_v_self->_surviving_objects);
  __pyx_v_self->_surviving_objects = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "memray/_memray.pyx":887
 *         cdef unordered_set[PyObject*] objects = tracker.getSurvivingObjects()
 *         self._surviving_objects = []
 *         for obj in objects:             # <<<<<<<<<<<<<<
 *             self._surviving_objects.append(<object>obj)
 *             Py_DECREF(<object>obj)
*/
  __pyx_t_4 = __pyx_v_objects.begin();
  for (; __pyx_t_4 != __pyx_v_objects.end(); ++__pyx_t_4) {
    __pyx_t_5 = *__pyx_t_4;
    __pyx_v_obj = __pyx_t_5;

    /* "memray/_memray.pyx":888
 *         self._surviving_objects = []
 *         for obj in objects:
 *             self._surviving_objects.append(<object>obj)             # <<<<<<<<<<<<<<
 *             Py_DECREF(<object>obj)
 * 
*/
    __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->_surviving_objects, ((PyObject *)__pyx_v_obj)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 888, __pyx_L1_error)

    /* "memray/_memray.pyx":889
 *         for obj in objects:
 *             self._surviving_objects.append(<object>obj)
 *             Py_DECREF(<object>obj)             # <<<<<<<<<<<<<<
 * 
 *     def get_surviving_objects(self):
*/
    Py_DECREF(((PyObject *)__pyx_v_obj));

    /* "memray/_memray.pyx":887
 *         cdef unordered_set[PyObject*] objects = tracker.getSurvivingObjects()
 *         self._surviving_objects = []
 *         for obj in objects:             # <<<<<<<<<<<<<<
 *             self._surviving_objects.append(<object>obj)
 *             Py_DECREF(<object>obj)
*/
  }

  /* "memray/_memray.pyx":880
 *                 delattr(threading.Thread, attr)
 * 
 *     cdef void _populate_surviving_objects(self):             # <<<<<<<<<<<<<<
 *         cdef NativeTracker *tracker = NativeTracker.getTracker()
 *         if tracker == NULL:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.Tracker._populate_surviving_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "memray/_memray.pyx":891
 *             Py_DECREF(<object>obj)
 * 
 *     def get_surviving_objects(self):             # <<<<<<<<<<<<<<
 *         """Get a list of objects that were alive at the end of the tracking period.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_7get_surviving_objects(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_7Tracker_6get_surviving_objects, "Tracker.get_surviving_objects(self)\n\nGet a list of objects that were alive at the end of the tracking period.\n\nReturns:\n    list: A list of objects that were alive at the end of the tracking period.\n\nRaises:\n    RuntimeError: If *track_object_lifetimes* was not enabled at\n        Tracker construction, or if tracking has not completed yet.");
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_7get_surviving_objects = {"get_surviving_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_7get_surviving_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_6get_surviving_objects};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_7get_surviving_objects(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_surviving_objects (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_surviving_objects", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_surviving_objects", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_6get_surviving_objects(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_6get_surviving_objects(struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_surviving_objects", 0);

  /* "memray/_memray.pyx":901
 *                 Tracker construction, or if tracking has not completed yet.
 *         """
 *         if not self._track_object_lifetimes:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "track_object_lifetimes=True was not provided at Tracker construction"
*/
  __pyx_t_1 = (!(__pyx_v_self->_track_object_lifetimes != 0));
  if (unlikely(__pyx_t_1)) {

    /* "memray/_memray.pyx":902
 *         """
 *         if not self._track_object_lifetimes:
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 "track_object_lifetimes=True was not provided at Tracker construction"
 *             )
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_track_object_lifetimes_True_was};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 902, __pyx_L1_error)

    /* "memray/_memray.pyx":901
 *                 Tracker construction, or if tracking has not completed yet.
 *         """
 *         if not self._track_object_lifetimes:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "track_object_lifetimes=True was not provided at Tracker construction"
*/
  }

  /* "memray/_memray.pyx":905
 *                 "track_object_lifetimes=True was not provided at Tracker construction"
 *             )
 *         if self._surviving_objects is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Tracking was never started or has not finished yet or failed."
*/
  __pyx_t_1 = (__pyx_v_self->_surviving_objects == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "memray/_memray.pyx":906
 *             )
 *         if self._surviving_objects is None:
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 "Tracking was never started or has not finished yet or failed."
 *             )
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Tracking_was_never_started_or_ha};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 906, __pyx_L1_error)

    /* "memray/_memray.pyx":905
 *                 "track_object_lifetimes=True was not provided at Tracker construction"
 *             )
 *         if self._surviving_objects is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Tracking was never started or has not finished yet or failed."
*/
  }

  /* "memray/_memray.pyx":909
 *                 "Tracking was never started or has not finished yet or failed."
 *             )
 *         return tuple(self._surviving_objects)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_v_self->_surviving_objects); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":891
 *             Py_DECREF(<object>obj)
 * 
 *     def get_surviving_objects(self):             # <<<<<<<<<<<<<<
 *         """Get a list of objects that were alive at the end of the tracking period.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.Tracker.get_surviving_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_7Tracker_8__reduce_cython__, "Tracker.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_8__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_8__reduce_cython__(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Tracker.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_7Tracker_10__setstate_cython__, "Tracker.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_7Tracker_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_10__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_7Tracker_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.Tracker.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_7Tracker_10__setstate_cython__(((struct __pyx_obj_6memray_7_memray_Tracker *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_7Tracker_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_Tracker *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.Tracker.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":912
 * 
 * 
 * def start_thread_trace(frame, event, arg):             # <<<<<<<<<<<<<<
 *     if event in {"call", "c_call"}:
 *         install_trace_function()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_5start_thread_trace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_4start_thread_trace, "start_thread_trace(frame, event, arg)");
static PyMethodDef __pyx_mdef_6memray_7_memray_5start_thread_trace = {"start_thread_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_5start_thread_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_4start_thread_trace};
static PyObject *__pyx_pw_6memray_7_memray_5start_thread_trace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_frame = 0;
  PyObject *__pyx_v_event = 0;
  CYTHON_UNUSED PyObject *__pyx_v_arg = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_thread_trace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_frame,&__pyx_mstate_global->__pyx_n_u_event,&__pyx_mstate_global->__pyx_n_u_arg,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 912, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 912, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 912, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 912, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "start_thread_trace", 0) < (0)) __PYX_ERR(0, 912, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("start_thread_trace", 1, 3, 3, i); __PYX_ERR(0, 912, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 912, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 912, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 912, __pyx_L3_error)
    }
    __pyx_v_frame = values[0];
    __pyx_v_event = values[1];
    __pyx_v_arg = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start_thread_trace", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 912, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.start_thread_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_4start_thread_trace(__pyx_self, __pyx_v_frame, __pyx_v_event, __pyx_v_arg);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_4start_thread_trace(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_frame, PyObject *__pyx_v_event, CYTHON_UNUSED PyObject *__pyx_v_arg) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start_thread_trace", 0);

  /* "memray/_memray.pyx":913
 * 
 * def start_thread_trace(frame, event, arg):
 *     if event in {"call", "c_call"}:             # <<<<<<<<<<<<<<
 *         install_trace_function()
 *     return start_thread_trace
*/
  __Pyx_INCREF(__pyx_v_event);
  __pyx_t_1 = __pyx_v_event;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_call, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 913, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_c_call, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 913, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  if (__pyx_t_3) {

    /* "memray/_memray.pyx":914
 * def start_thread_trace(frame, event, arg):
 *     if event in {"call", "c_call"}:
 *         install_trace_function()             # <<<<<<<<<<<<<<
 *     return start_thread_trace
 * 
*/
    memray::tracking_api::install_trace_function(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error)

    /* "memray/_memray.pyx":913
 * 
 * def start_thread_trace(frame, event, arg):
 *     if event in {"call", "c_call"}:             # <<<<<<<<<<<<<<
 *         install_trace_function()
 *     return start_thread_trace
*/
  }

  /* "memray/_memray.pyx":915
 *     if event in {"call", "c_call"}:
 *         install_trace_function()
 *     return start_thread_trace             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_start_thread_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":912
 * 
 * 
 * def start_thread_trace(frame, event, arg):             # <<<<<<<<<<<<<<
 *     if event in {"call", "c_call"}:
 *         install_trace_function()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.start_thread_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":918
 * 
 * 
 * def greenlet_trace_function(event, args):             # <<<<<<<<<<<<<<
 *     if event in {"switch", "throw"}:
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_7greenlet_trace_function(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_6greenlet_trace_function, "greenlet_trace_function(event, args)");
static PyMethodDef __pyx_mdef_6memray_7_memray_7greenlet_trace_function = {"greenlet_trace_function", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7greenlet_trace_function, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_6greenlet_trace_function};
static PyObject *__pyx_pw_6memray_7_memray_7greenlet_trace_function(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_event = 0;
  PyObject *__pyx_v_args = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("greenlet_trace_function (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_event,&__pyx_mstate_global->__pyx_n_u_args,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 918, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 918, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 918, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "greenlet_trace_function", 0) < (0)) __PYX_ERR(0, 918, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("greenlet_trace_function", 1, 2, 2, i); __PYX_ERR(0, 918, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 918, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 918, __pyx_L3_error)
    }
    __pyx_v_event = values[0];
    __pyx_v_args = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("greenlet_trace_function", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 918, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.greenlet_trace_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_6greenlet_trace_function(__pyx_self, __pyx_v_event, __pyx_v_args);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_6greenlet_trace_function(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_event, PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("greenlet_trace_function", 0);

  /* "memray/_memray.pyx":919
 * 
 * def greenlet_trace_function(event, args):
 *     if event in {"switch", "throw"}:             # <<<<<<<<<<<<<<
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])
 * 
*/
  __Pyx_INCREF(__pyx_v_event);
  __pyx_t_1 = __pyx_v_event;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_switch, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 919, __pyx_L1_error)
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_throw, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 919, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  if (__pyx_t_3) {

    /* "memray/_memray.pyx":920
 * def greenlet_trace_function(event, args):
 *     if event in {"switch", "throw"}:
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_args, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_args, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    try {
      memray::tracking_api::Tracker::handleGreenletSwitch(__pyx_t_1, __pyx_t_4);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 920, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "memray/_memray.pyx":919
 * 
 * def greenlet_trace_function(event, args):
 *     if event in {"switch", "throw"}:             # <<<<<<<<<<<<<<
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])
 * 
*/
  }

  /* "memray/_memray.pyx":918
 * 
 * 
 * def greenlet_trace_function(event, args):             # <<<<<<<<<<<<<<
 *     if event in {"switch", "throw"}:
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.greenlet_trace_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":923
 * 
 * 
 * def print_greenlet_warning():             # <<<<<<<<<<<<<<
 *     pprint(
 *         ":warning: [bold red]Memray support for Greenlet is experimental[/] :warning:\n"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_9print_greenlet_warning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_8print_greenlet_warning, "print_greenlet_warning()");
static PyMethodDef __pyx_mdef_6memray_7_memray_9print_greenlet_warning = {"print_greenlet_warning", (PyCFunction)__pyx_pw_6memray_7_memray_9print_greenlet_warning, METH_NOARGS, __pyx_doc_6memray_7_memray_8print_greenlet_warning};
static PyObject *__pyx_pw_6memray_7_memray_9print_greenlet_warning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_greenlet_warning (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_8print_greenlet_warning(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_8print_greenlet_warning(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_greenlet_warning", 0);

  /* "memray/_memray.pyx":924
 * 
 * def print_greenlet_warning():
 *     pprint(             # <<<<<<<<<<<<<<
 *         ":warning: [bold red]Memray support for Greenlet is experimental[/] :warning:\n"
 *         "[yellow]Please report any issues at https://github.com/bloomberg/memray/issues[/]\n"
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pprint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":928
 *         "[yellow]Please report any issues at https://github.com/bloomberg/memray/issues[/]\n"
 *         "\n",
 *         file=sys.stderr,             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_warning_bold_red_Memray_support};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file, __pyx_t_5, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 924, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":923
 * 
 * 
 * def print_greenlet_warning():             # <<<<<<<<<<<<<<
 *     pprint(
 *         ":warning: [bold red]Memray support for Greenlet is experimental[/] :warning:\n"
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.print_greenlet_warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":932
 * 
 * 
 * cdef millis_to_dt(millis):             # <<<<<<<<<<<<<<
 *     return datetime.fromtimestamp(millis // 1000).replace(
 *         microsecond=millis % 1000 * 1000).astimezone()
*/

static PyObject *__pyx_f_6memray_7_memray_millis_to_dt(PyObject *__pyx_v_millis) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("millis_to_dt", 0);

  /* "memray/_memray.pyx":933
 * 
 * cdef millis_to_dt(millis):
 *     return datetime.fromtimestamp(millis // 1000).replace(             # <<<<<<<<<<<<<<
 *         microsecond=millis % 1000 * 1000).astimezone()
 * 
*/
  __Pyx_XDECREF(__pyx_r);

  /* "memray/_memray.pyx":934
 * cdef millis_to_dt(millis):
 *     return datetime.fromtimestamp(millis // 1000).replace(
 *         microsecond=millis % 1000 * 1000).astimezone()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_6 = NULL;

  /* "memray/_memray.pyx":933
 * 
 * cdef millis_to_dt(millis):
 *     return datetime.fromtimestamp(millis // 1000).replace(             # <<<<<<<<<<<<<<
 *         microsecond=millis % 1000 * 1000).astimezone()
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_fromtimestamp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyLong_FloorDivideObjC(__pyx_v_millis, __pyx_mstate_global->__pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_9 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);

  /* "memray/_memray.pyx":934
 * cdef millis_to_dt(millis):
 *     return datetime.fromtimestamp(millis // 1000).replace(
 *         microsecond=millis % 1000 * 1000).astimezone()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_8 = __Pyx_PyLong_RemainderObjC(__pyx_v_millis, __pyx_mstate_global->__pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyLong_MultiplyObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_1000, 0x3E8, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, NULL};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_microsecond, __pyx_t_7, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 933, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_replace, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_9 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astimezone, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":932
 * 
 * 
 * cdef millis_to_dt(millis):             # <<<<<<<<<<<<<<
 *     return datetime.fromtimestamp(millis // 1000).replace(
 *         microsecond=millis % 1000 * 1000).astimezone()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("memray._memray.millis_to_dt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":937
 * 
 * 
 * cdef _create_metadata(header, peak_memory):             # <<<<<<<<<<<<<<
 *     stats = header["stats"]
 *     allocator_id_to_name = {
*/

static PyObject *__pyx_f_6memray_7_memray__create_metadata(PyObject *__pyx_v_header, PyObject *__pyx_v_peak_memory) {
  PyObject *__pyx_v_stats = NULL;
  PyObject *__pyx_v_allocator_id_to_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  size_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_metadata", 0);

  /* "memray/_memray.pyx":938
 * 
 * cdef _create_metadata(header, peak_memory):
 *     stats = header["stats"]             # <<<<<<<<<<<<<<
 *     allocator_id_to_name = {
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC: "pymalloc",
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_stats = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":940
 *     stats = header["stats"]
 *     allocator_id_to_name = {
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC: "pymalloc",             # <<<<<<<<<<<<<<
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG: "pymalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC: "mimalloc",
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_pymalloc) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":941
 *     allocator_id_to_name = {
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC: "pymalloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG: "pymalloc debug",             # <<<<<<<<<<<<<<
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC: "mimalloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG: "mimalloc debug",
*/
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC_DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_kp_u_pymalloc_debug) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":942
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC: "pymalloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG: "pymalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC: "mimalloc",             # <<<<<<<<<<<<<<
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG: "mimalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC: "malloc",
*/
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_mimalloc) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":943
 *         PythonAllocatorType.PYTHON_ALLOCATOR_PYMALLOC_DEBUG: "pymalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC: "mimalloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG: "mimalloc debug",             # <<<<<<<<<<<<<<
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC: "malloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_OTHER: "unknown",
*/
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC_DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_kp_u_mimalloc_debug) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":944
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC: "mimalloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG: "mimalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC: "malloc",             # <<<<<<<<<<<<<<
 *         PythonAllocatorType.PYTHON_ALLOCATOR_OTHER: "unknown",
 *     }
*/
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_malloc) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":945
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MIMALLOC_DEBUG: "mimalloc debug",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_MALLOC: "malloc",
 *         PythonAllocatorType.PYTHON_ALLOCATOR_OTHER: "unknown",             # <<<<<<<<<<<<<<
 *     }
 *     return Metadata(
*/
  __pyx_t_2 = __Pyx_Enum_6408e3__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_OTHER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_unknown) < (0)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_allocator_id_to_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":947
 *         PythonAllocatorType.PYTHON_ALLOCATOR_OTHER: "unknown",
 *     }
 *     return Metadata(             # <<<<<<<<<<<<<<
 *         start_time=millis_to_dt(stats["start_time"]),
 *         end_time=millis_to_dt(stats["end_time"]),
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "memray/_memray.pyx":948
 *     }
 *     return Metadata(
 *         start_time=millis_to_dt(stats["start_time"]),             # <<<<<<<<<<<<<<
 *         end_time=millis_to_dt(stats["end_time"]),
 *         total_allocations=stats["n_allocations"],
*/
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_start_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_6memray_7_memray_millis_to_dt(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "memray/_memray.pyx":949
 *     return Metadata(
 *         start_time=millis_to_dt(stats["start_time"]),
 *         end_time=millis_to_dt(stats["end_time"]),             # <<<<<<<<<<<<<<
 *         total_allocations=stats["n_allocations"],
 *         total_frames=stats["n_frames"],
*/
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_end_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __pyx_f_6memray_7_memray_millis_to_dt(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "memray/_memray.pyx":950
 *         start_time=millis_to_dt(stats["start_time"]),
 *         end_time=millis_to_dt(stats["end_time"]),
 *         total_allocations=stats["n_allocations"],             # <<<<<<<<<<<<<<
 *         total_frames=stats["n_frames"],
 *         peak_memory=peak_memory,
*/
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "memray/_memray.pyx":951
 *         end_time=millis_to_dt(stats["end_time"]),
 *         total_allocations=stats["n_allocations"],
 *         total_frames=stats["n_frames"],             # <<<<<<<<<<<<<<
 *         peak_memory=peak_memory,
 *         command_line=header["command_line"],
*/
  __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_n_frames); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "memray/_memray.pyx":953
 *         total_frames=stats["n_frames"],
 *         peak_memory=peak_memory,
 *         command_line=header["command_line"],             # <<<<<<<<<<<<<<
 *         pid=header["pid"],
 *         main_thread_id=header["main_tid"],
*/
  __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_command_line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "memray/_memray.pyx":954
 *         peak_memory=peak_memory,
 *         command_line=header["command_line"],
 *         pid=header["pid"],             # <<<<<<<<<<<<<<
 *         main_thread_id=header["main_tid"],
 *         python_allocator=allocator_id_to_name[header["python_allocator"]],
*/
  __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_pid); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "memray/_memray.pyx":955
 *         command_line=header["command_line"],
 *         pid=header["pid"],
 *         main_thread_id=header["main_tid"],             # <<<<<<<<<<<<<<
 *         python_allocator=allocator_id_to_name[header["python_allocator"]],
 *         has_native_traces=header["native_traces"],
*/
  __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_main_tid); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);

  /* "memray/_memray.pyx":956
 *         pid=header["pid"],
 *         main_thread_id=header["main_tid"],
 *         python_allocator=allocator_id_to_name[header["python_allocator"]],             # <<<<<<<<<<<<<<
 *         has_native_traces=header["native_traces"],
 *         trace_python_allocators=header["trace_python_allocators"],
*/
  __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_python_allocator); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_allocator_id_to_name, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "memray/_memray.pyx":957
 *         main_thread_id=header["main_tid"],
 *         python_allocator=allocator_id_to_name[header["python_allocator"]],
 *         has_native_traces=header["native_traces"],             # <<<<<<<<<<<<<<
 *         trace_python_allocators=header["trace_python_allocators"],
 *         file_format=FileFormat(header["file_format"]),
*/
  __pyx_t_11 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_native_traces); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);

  /* "memray/_memray.pyx":958
 *         python_allocator=allocator_id_to_name[header["python_allocator"]],
 *         has_native_traces=header["native_traces"],
 *         trace_python_allocators=header["trace_python_allocators"],             # <<<<<<<<<<<<<<
 *         file_format=FileFormat(header["file_format"]),
 *     )
*/
  __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_trace_python_allocators); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);

  /* "memray/_memray.pyx":959
 *         has_native_traces=header["native_traces"],
 *         trace_python_allocators=header["trace_python_allocators"],
 *         file_format=FileFormat(header["file_format"]),             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_15 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_FileFormat); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_18 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
    assert(__pyx_t_15);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
    __Pyx_INCREF(__pyx_t_15);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
    __pyx_t_18 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_17};
    __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_18, (2-__pyx_t_18) | (__pyx_t_18*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
  }
  __pyx_t_18 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_18 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 12 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_16 = __Pyx_MakeVectorcallBuilderKwds(12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_start_time, __pyx_t_5, __pyx_t_16, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end_time, __pyx_t_6, __pyx_t_16, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total_allocations, __pyx_t_4, __pyx_t_16, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total_frames, __pyx_t_7, __pyx_t_16, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_peak_memory, __pyx_v_peak_memory, __pyx_t_16, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_command_line, __pyx_t_8, __pyx_t_16, __pyx_callargs+1, 5) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pid, __pyx_t_9, __pyx_t_16, __pyx_callargs+1, 6) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_main_thread_id, __pyx_t_10, __pyx_t_16, __pyx_callargs+1, 7) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_python_allocator, __pyx_t_12, __pyx_t_16, __pyx_callargs+1, 8) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_has_native_traces, __pyx_t_11, __pyx_t_16, __pyx_callargs+1, 9) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_trace_python_allocators, __pyx_t_13, __pyx_t_16, __pyx_callargs+1, 10) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file_format, __pyx_t_14, __pyx_t_16, __pyx_callargs+1, 11) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_18, (1-__pyx_t_18) | (__pyx_t_18*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_16);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":937
 * 
 * 
 * cdef _create_metadata(header, peak_memory):             # <<<<<<<<<<<<<<
 *     stats = header["stats"]
 *     allocator_id_to_name = {
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("memray._memray._create_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stats);
  __Pyx_XDECREF(__pyx_v_allocator_id_to_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":975
 *     cdef timespec _next_refresh
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *         str task_description,
 *         object total,
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_17ProgressIndicator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_17ProgressIndicator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_task_description = 0;
  PyObject *__pyx_v_total = 0;
  bool __pyx_v_report_progress;
  size_t __pyx_v_refresh_per_second;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_task_description,&__pyx_mstate_global->__pyx_n_u_total,&__pyx_mstate_global->__pyx_n_u_report_progress,&__pyx_mstate_global->__pyx_n_u_refresh_per_second,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 975, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 975, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, i); __PYX_ERR(0, 975, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 975, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 975, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 975, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_task_description = ((PyObject*)values[0]);
    __pyx_v_total = values[1];
    if (values[2]) {
      __pyx_v_report_progress = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_report_progress == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":978
 *         str task_description,
 *         object total,
 *         bool report_progress=True,             # <<<<<<<<<<<<<<
 *         size_t refresh_per_second=10,
 *     ):
*/
      __pyx_v_report_progress = ((bool)1);
    }
    if (values[3]) {
      __pyx_v_refresh_per_second = __Pyx_PyLong_As_size_t(values[3]); if (unlikely((__pyx_v_refresh_per_second == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 979, __pyx_L3_error)
    } else {
      __pyx_v_refresh_per_second = ((size_t)10);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 975, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_task_description), (&PyUnicode_Type), 1, "task_description", 1))) __PYX_ERR(0, 976, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator___init__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self), __pyx_v_task_description, __pyx_v_total, __pyx_v_report_progress, __pyx_v_refresh_per_second);

  /* "memray/_memray.pyx":975
 *     cdef timespec _next_refresh
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *         str task_description,
 *         object total,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_17ProgressIndicator___init__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, PyObject *__pyx_v_task_description, PyObject *__pyx_v_total, bool __pyx_v_report_progress, size_t __pyx_v_refresh_per_second) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "memray/_memray.pyx":981
 *         size_t refresh_per_second=10,
 *     ):
 *         self._report_progress = report_progress             # <<<<<<<<<<<<<<
 *         self._total = total
 *         self._cumulative_num_processed = 0
*/
  __pyx_v_self->_report_progress = __pyx_v_report_progress;

  /* "memray/_memray.pyx":982
 *     ):
 *         self._report_progress = report_progress
 *         self._total = total             # <<<<<<<<<<<<<<
 *         self._cumulative_num_processed = 0
 *         # Only check the elapsed time every N records
*/
  __Pyx_INCREF(__pyx_v_total);
  __Pyx_GIVEREF(__pyx_v_total);
  __Pyx_GOTREF(__pyx_v_self->_total);
  __Pyx_DECREF(__pyx_v_self->_total);
  __pyx_v_self->_total = __pyx_v_total;

  /* "memray/_memray.pyx":983
 *         self._report_progress = report_progress
 *         self._total = total
 *         self._cumulative_num_processed = 0             # <<<<<<<<<<<<<<
 *         # Only check the elapsed time every N records
 *         self._update_interval = 100_000
*/
  __pyx_v_self->_cumulative_num_processed = 0;

  /* "memray/_memray.pyx":985
 *         self._cumulative_num_processed = 0
 *         # Only check the elapsed time every N records
 *         self._update_interval = 100_000             # <<<<<<<<<<<<<<
 *         self._ns_between_refreshes = 1_000_000_000 // refresh_per_second
 *         self._next_refresh.tv_sec = 0
*/
  __pyx_v_self->_update_interval = 0x186A0;

  /* "memray/_memray.pyx":986
 *         # Only check the elapsed time every N records
 *         self._update_interval = 100_000
 *         self._ns_between_refreshes = 1_000_000_000 // refresh_per_second             # <<<<<<<<<<<<<<
 *         self._next_refresh.tv_sec = 0
 *         self._next_refresh.tv_nsec = 0
*/
  __pyx_v_self->_ns_between_refreshes = (0x3B9ACA00 / __pyx_v_refresh_per_second);

  /* "memray/_memray.pyx":987
 *         self._update_interval = 100_000
 *         self._ns_between_refreshes = 1_000_000_000 // refresh_per_second
 *         self._next_refresh.tv_sec = 0             # <<<<<<<<<<<<<<
 *         self._next_refresh.tv_nsec = 0
 *         self._task_description = task_description
*/
  __pyx_v_self->_next_refresh.tv_sec = 0;

  /* "memray/_memray.pyx":988
 *         self._ns_between_refreshes = 1_000_000_000 // refresh_per_second
 *         self._next_refresh.tv_sec = 0
 *         self._next_refresh.tv_nsec = 0             # <<<<<<<<<<<<<<
 *         self._task_description = task_description
 *         self._task = None
*/
  __pyx_v_self->_next_refresh.tv_nsec = 0;

  /* "memray/_memray.pyx":989
 *         self._next_refresh.tv_sec = 0
 *         self._next_refresh.tv_nsec = 0
 *         self._task_description = task_description             # <<<<<<<<<<<<<<
 *         self._task = None
 *         self._context_manager = None
*/
  __Pyx_INCREF(__pyx_v_task_description);
  __Pyx_GIVEREF(__pyx_v_task_description);
  __Pyx_GOTREF(__pyx_v_self->_task_description);
  __Pyx_DECREF(__pyx_v_self->_task_description);
  __pyx_v_self->_task_description = __pyx_v_task_description;

  /* "memray/_memray.pyx":990
 *         self._next_refresh.tv_nsec = 0
 *         self._task_description = task_description
 *         self._task = None             # <<<<<<<<<<<<<<
 *         self._context_manager = None
 *         if report_progress:
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_task);
  __Pyx_DECREF(__pyx_v_self->_task);
  __pyx_v_self->_task = Py_None;

  /* "memray/_memray.pyx":991
 *         self._task_description = task_description
 *         self._task = None
 *         self._context_manager = None             # <<<<<<<<<<<<<<
 *         if report_progress:
 *             self._indicator = Progress(
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_context_manager);
  __Pyx_DECREF(__pyx_v_self->_context_manager);
  __pyx_v_self->_context_manager = Py_None;

  /* "memray/_memray.pyx":992
 *         self._task = None
 *         self._context_manager = None
 *         if report_progress:             # <<<<<<<<<<<<<<
 *             self._indicator = Progress(
 *                 SpinnerColumn(),
*/
  __pyx_t_1 = (__pyx_v_report_progress != 0);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":993
 *         self._context_manager = None
 *         if report_progress:
 *             self._indicator = Progress(             # <<<<<<<<<<<<<<
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),
*/
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Progress); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "memray/_memray.pyx":994
 *         if report_progress:
 *             self._indicator = Progress(
 *                 SpinnerColumn(),             # <<<<<<<<<<<<<<
 *                 *Progress.get_default_columns(),
 *                 auto_refresh=False,
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SpinnerColumn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 994, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }

    /* "memray/_memray.pyx":993
 *         self._context_manager = None
 *         if report_progress:
 *             self._indicator = Progress(             # <<<<<<<<<<<<<<
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),
*/
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 993, __pyx_L1_error);
    __pyx_t_3 = 0;

    /* "memray/_memray.pyx":995
 *             self._indicator = Progress(
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),             # <<<<<<<<<<<<<<
 *                 auto_refresh=False,
 *                 transient=True,
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Progress); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_get_default_columns); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }

    /* "memray/_memray.pyx":993
 *         self._context_manager = None
 *         if report_progress:
 *             self._indicator = Progress(             # <<<<<<<<<<<<<<
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),
*/
    __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "memray/_memray.pyx":996
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),
 *                 auto_refresh=False,             # <<<<<<<<<<<<<<
 *                 transient=True,
 *             )
*/
    __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 996, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_auto_refresh, Py_False) < (0)) __PYX_ERR(0, 996, __pyx_L1_error)

    /* "memray/_memray.pyx":997
 *                 *Progress.get_default_columns(),
 *                 auto_refresh=False,
 *                 transient=True,             # <<<<<<<<<<<<<<
 *             )
 * 
*/
    if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_transient, Py_True) < (0)) __PYX_ERR(0, 996, __pyx_L1_error)

    /* "memray/_memray.pyx":993
 *         self._context_manager = None
 *         if report_progress:
 *             self._indicator = Progress(             # <<<<<<<<<<<<<<
 *                 SpinnerColumn(),
 *                 *Progress.get_default_columns(),
*/
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_indicator);
    __Pyx_DECREF(__pyx_v_self->_indicator);
    __pyx_v_self->_indicator = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "memray/_memray.pyx":992
 *         self._task = None
 *         self._context_manager = None
 *         if report_progress:             # <<<<<<<<<<<<<<
 *             self._indicator = Progress(
 *                 SpinnerColumn(),
*/
  }

  /* "memray/_memray.pyx":975
 *     cdef timespec _next_refresh
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *         str task_description,
 *         object total,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1000
 *             )
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return self
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_17ProgressIndicator_2__enter__, "ProgressIndicator.__enter__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_17ProgressIndicator_3__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_2__enter__};
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_3__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator_2__enter__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_2__enter__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "memray/_memray.pyx":1001
 * 
 *     def __enter__(self):
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return self
 *         self._context_manager = self._indicator.__enter__()
*/
  __pyx_t_1 = (!(__pyx_v_self->_report_progress != 0));
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1002
 *     def __enter__(self):
 *         if not self._report_progress:
 *             return self             # <<<<<<<<<<<<<<
 *         self._context_manager = self._indicator.__enter__()
 *         self._task = self._context_manager.add_task(
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1001
 * 
 *     def __enter__(self):
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return self
 *         self._context_manager = self._indicator.__enter__()
*/
  }

  /* "memray/_memray.pyx":1003
 *         if not self._report_progress:
 *             return self
 *         self._context_manager = self._indicator.__enter__()             # <<<<<<<<<<<<<<
 *         self._task = self._context_manager.add_task(
 *             f"[cyan]{self._task_description}...",
*/
  __pyx_t_3 = __pyx_v_self->_indicator;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_context_manager);
  __Pyx_DECREF(__pyx_v_self->_context_manager);
  __pyx_v_self->_context_manager = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1004
 *             return self
 *         self._context_manager = self._indicator.__enter__()
 *         self._task = self._context_manager.add_task(             # <<<<<<<<<<<<<<
 *             f"[cyan]{self._task_description}...",
 *             total=self._total
*/
  __pyx_t_3 = __pyx_v_self->_context_manager;
  __Pyx_INCREF(__pyx_t_3);

  /* "memray/_memray.pyx":1005
 *         self._context_manager = self._indicator.__enter__()
 *         self._task = self._context_manager.add_task(
 *             f"[cyan]{self._task_description}...",             # <<<<<<<<<<<<<<
 *             total=self._total
 *         )
*/
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_self->_task_description, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_cyan;
  __pyx_t_6[1] = __pyx_t_5;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__7;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 3, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "memray/_memray.pyx":1006
 *         self._task = self._context_manager.add_task(
 *             f"[cyan]{self._task_description}...",
 *             total=self._total             # <<<<<<<<<<<<<<
 *         )
 *         return self
*/
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_7};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_v_self->_total, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add_task, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }

  /* "memray/_memray.pyx":1004
 *             return self
 *         self._context_manager = self._indicator.__enter__()
 *         self._task = self._context_manager.add_task(             # <<<<<<<<<<<<<<
 *             f"[cyan]{self._task_description}...",
 *             total=self._total
*/
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_task);
  __Pyx_DECREF(__pyx_v_self->_task);
  __pyx_v_self->_task = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1008
 *             total=self._total
 *         )
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, type, value, traceback):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "memray/_memray.pyx":1000
 *             )
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return self
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1010
 *         return self
 * 
 *     def __exit__(self, type, value, traceback):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_17ProgressIndicator_4__exit__, "ProgressIndicator.__exit__(self, type, value, traceback)");
static PyMethodDef __pyx_mdef_6memray_7_memray_17ProgressIndicator_5__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_4__exit__};
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_5__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_type = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_traceback = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_type,&__pyx_mstate_global->__pyx_n_u_value,&__pyx_mstate_global->__pyx_n_u_traceback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1010, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1010, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 1010, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 1010, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1010, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1010, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1010, __pyx_L3_error)
    }
    __pyx_v_type = values[0];
    __pyx_v_value = values[1];
    __pyx_v_traceback = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1010, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator_4__exit__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_4__exit__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "memray/_memray.pyx":1011
 * 
 *     def __exit__(self, type, value, traceback):
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return
 *         self._context_manager.update(self._task, completed=self._cumulative_num_processed)
*/
  __pyx_t_1 = (!(__pyx_v_self->_report_progress != 0));
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1012
 *     def __exit__(self, type, value, traceback):
 *         if not self._report_progress:
 *             return             # <<<<<<<<<<<<<<
 *         self._context_manager.update(self._task, completed=self._cumulative_num_processed)
 *         return self._context_manager.__exit__(type, value, traceback)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1011
 * 
 *     def __exit__(self, type, value, traceback):
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return
 *         self._context_manager.update(self._task, completed=self._cumulative_num_processed)
*/
  }

  /* "memray/_memray.pyx":1013
 *         if not self._report_progress:
 *             return
 *         self._context_manager.update(self._task, completed=self._cumulative_num_processed)             # <<<<<<<<<<<<<<
 *         return self._context_manager.__exit__(type, value, traceback)
 * 
*/
  __pyx_t_3 = __pyx_v_self->_context_manager;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_cumulative_num_processed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_self->_task};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_completed, __pyx_t_4, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1014
 *             return
 *         self._context_manager.update(self._task, completed=self._cumulative_num_processed)
 *         return self._context_manager.__exit__(type, value, traceback)             # <<<<<<<<<<<<<<
 * 
 *     cdef bool _time_for_refresh(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_v_self->_context_manager;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_type, __pyx_v_value, __pyx_v_traceback};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exit, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1010
 *         return self
 * 
 *     def __exit__(self, type, value, traceback):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1016
 *         return self._context_manager.__exit__(type, value, traceback)
 * 
 *     cdef bool _time_for_refresh(self):             # <<<<<<<<<<<<<<
 *         cdef timespec now
 *         cdef int rc = clock_gettime(CLOCK_MONOTONIC, &now)
*/

static bool __pyx_f_6memray_7_memray_17ProgressIndicator__time_for_refresh(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self) {
  struct timespec __pyx_v_now;
  int __pyx_v_rc;
  bool __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "memray/_memray.pyx":1018
 *     cdef bool _time_for_refresh(self):
 *         cdef timespec now
 *         cdef int rc = clock_gettime(CLOCK_MONOTONIC, &now)             # <<<<<<<<<<<<<<
 * 
 *         if 0 != rc:
*/
  __pyx_v_rc = clock_gettime(CLOCK_MONOTONIC, (&__pyx_v_now));

  /* "memray/_memray.pyx":1020
 *         cdef int rc = clock_gettime(CLOCK_MONOTONIC, &now)
 * 
 *         if 0 != rc:             # <<<<<<<<<<<<<<
 *             return True
 * 
*/
  __pyx_t_1 = (0 != __pyx_v_rc);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1021
 * 
 *         if 0 != rc:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         if now.tv_sec > self._next_refresh.tv_sec or (
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "memray/_memray.pyx":1020
 *         cdef int rc = clock_gettime(CLOCK_MONOTONIC, &now)
 * 
 *         if 0 != rc:             # <<<<<<<<<<<<<<
 *             return True
 * 
*/
  }

  /* "memray/_memray.pyx":1023
 *             return True
 * 
 *         if now.tv_sec > self._next_refresh.tv_sec or (             # <<<<<<<<<<<<<<
 *             now.tv_sec == self._next_refresh.tv_sec
 *             and now.tv_nsec > self._next_refresh.tv_nsec
*/
  __pyx_t_2 = (__pyx_v_now.tv_sec > __pyx_v_self->_next_refresh.tv_sec);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }

  /* "memray/_memray.pyx":1024
 * 
 *         if now.tv_sec > self._next_refresh.tv_sec or (
 *             now.tv_sec == self._next_refresh.tv_sec             # <<<<<<<<<<<<<<
 *             and now.tv_nsec > self._next_refresh.tv_nsec
 *         ):
*/
  __pyx_t_2 = (__pyx_v_now.tv_sec == __pyx_v_self->_next_refresh.tv_sec);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }

  /* "memray/_memray.pyx":1025
 *         if now.tv_sec > self._next_refresh.tv_sec or (
 *             now.tv_sec == self._next_refresh.tv_sec
 *             and now.tv_nsec > self._next_refresh.tv_nsec             # <<<<<<<<<<<<<<
 *         ):
 *             self._next_refresh = now
*/
  __pyx_t_2 = (__pyx_v_now.tv_nsec > __pyx_v_self->_next_refresh.tv_nsec);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;

  /* "memray/_memray.pyx":1023
 *             return True
 * 
 *         if now.tv_sec > self._next_refresh.tv_sec or (             # <<<<<<<<<<<<<<
 *             now.tv_sec == self._next_refresh.tv_sec
 *             and now.tv_nsec > self._next_refresh.tv_nsec
*/
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1027
 *             and now.tv_nsec > self._next_refresh.tv_nsec
 *         ):
 *             self._next_refresh = now             # <<<<<<<<<<<<<<
 *             self._next_refresh.tv_nsec += self._ns_between_refreshes
 *             while self._next_refresh.tv_nsec > 1_000_000_000:
*/
    __pyx_v_self->_next_refresh = __pyx_v_now;

    /* "memray/_memray.pyx":1028
 *         ):
 *             self._next_refresh = now
 *             self._next_refresh.tv_nsec += self._ns_between_refreshes             # <<<<<<<<<<<<<<
 *             while self._next_refresh.tv_nsec > 1_000_000_000:
 *                 self._next_refresh.tv_nsec -= 1_000_000_000
*/
    __pyx_v_self->_next_refresh.tv_nsec = (__pyx_v_self->_next_refresh.tv_nsec + __pyx_v_self->_ns_between_refreshes);

    /* "memray/_memray.pyx":1029
 *             self._next_refresh = now
 *             self._next_refresh.tv_nsec += self._ns_between_refreshes
 *             while self._next_refresh.tv_nsec > 1_000_000_000:             # <<<<<<<<<<<<<<
 *                 self._next_refresh.tv_nsec -= 1_000_000_000
 *                 self._next_refresh.tv_sec += 1
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_self->_next_refresh.tv_nsec > 0x3B9ACA00);
      if (!__pyx_t_1) break;

      /* "memray/_memray.pyx":1030
 *             self._next_refresh.tv_nsec += self._ns_between_refreshes
 *             while self._next_refresh.tv_nsec > 1_000_000_000:
 *                 self._next_refresh.tv_nsec -= 1_000_000_000             # <<<<<<<<<<<<<<
 *                 self._next_refresh.tv_sec += 1
 *             return True
*/
      __pyx_v_self->_next_refresh.tv_nsec = (__pyx_v_self->_next_refresh.tv_nsec - 0x3B9ACA00);

      /* "memray/_memray.pyx":1031
 *             while self._next_refresh.tv_nsec > 1_000_000_000:
 *                 self._next_refresh.tv_nsec -= 1_000_000_000
 *                 self._next_refresh.tv_sec += 1             # <<<<<<<<<<<<<<
 *             return True
 * 
*/
      __pyx_v_self->_next_refresh.tv_sec = (__pyx_v_self->_next_refresh.tv_sec + 1);
    }

    /* "memray/_memray.pyx":1032
 *                 self._next_refresh.tv_nsec -= 1_000_000_000
 *                 self._next_refresh.tv_sec += 1
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return False
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "memray/_memray.pyx":1023
 *             return True
 * 
 *         if now.tv_sec > self._next_refresh.tv_sec or (             # <<<<<<<<<<<<<<
 *             now.tv_sec == self._next_refresh.tv_sec
 *             and now.tv_nsec > self._next_refresh.tv_nsec
*/
  }

  /* "memray/_memray.pyx":1034
 *             return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef update(self, size_t n_processed):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1016
 *         return self._context_manager.__exit__(type, value, traceback)
 * 
 *     cdef bool _time_for_refresh(self):             # <<<<<<<<<<<<<<
 *         cdef timespec now
 *         cdef int rc = clock_gettime(CLOCK_MONOTONIC, &now)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "memray/_memray.pyx":1036
 *         return False
 * 
 *     cdef update(self, size_t n_processed):             # <<<<<<<<<<<<<<
 *         self._cumulative_num_processed += n_processed
 *         if not self._report_progress:
*/

static PyObject *__pyx_f_6memray_7_memray_17ProgressIndicator_update(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, size_t __pyx_v_n_processed) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bool __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "memray/_memray.pyx":1037
 * 
 *     cdef update(self, size_t n_processed):
 *         self._cumulative_num_processed += n_processed             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return
*/
  __pyx_v_self->_cumulative_num_processed = (__pyx_v_self->_cumulative_num_processed + __pyx_v_n_processed);

  /* "memray/_memray.pyx":1038
 *     cdef update(self, size_t n_processed):
 *         self._cumulative_num_processed += n_processed
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:
*/
  __pyx_t_1 = (!(__pyx_v_self->_report_progress != 0));
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1039
 *         self._cumulative_num_processed += n_processed
 *         if not self._report_progress:
 *             return             # <<<<<<<<<<<<<<
 *         if self._cumulative_num_processed % self._update_interval == 0:
 *             if self._time_for_refresh():
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1038
 *     cdef update(self, size_t n_processed):
 *         self._cumulative_num_processed += n_processed
 *         if not self._report_progress:             # <<<<<<<<<<<<<<
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:
*/
  }

  /* "memray/_memray.pyx":1040
 *         if not self._report_progress:
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:             # <<<<<<<<<<<<<<
 *             if self._time_for_refresh():
 *                 assert(self._context_manager is not None)
*/
  __pyx_t_1 = ((__pyx_v_self->_cumulative_num_processed % __pyx_v_self->_update_interval) == 0);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1041
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:
 *             if self._time_for_refresh():             # <<<<<<<<<<<<<<
 *                 assert(self._context_manager is not None)
 *                 self._context_manager.update(
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_v_self->__pyx_vtab)->_time_for_refresh(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1041, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "memray/_memray.pyx":1042
 *         if self._cumulative_num_processed % self._update_interval == 0:
 *             if self._time_for_refresh():
 *                 assert(self._context_manager is not None)             # <<<<<<<<<<<<<<
 *                 self._context_manager.update(
 *                     self._task, completed=self._cumulative_num_processed
*/
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(__pyx_assertions_enabled())) {
        __pyx_t_1 = (__pyx_v_self->_context_manager != Py_None);
        if (unlikely(!__pyx_t_1)) {
          __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
          __PYX_ERR(0, 1042, __pyx_L1_error)
        }
      }
      #else
      if ((1)); else __PYX_ERR(0, 1042, __pyx_L1_error)
      #endif

      /* "memray/_memray.pyx":1043
 *             if self._time_for_refresh():
 *                 assert(self._context_manager is not None)
 *                 self._context_manager.update(             # <<<<<<<<<<<<<<
 *                     self._task, completed=self._cumulative_num_processed
 *                 )
*/
      __pyx_t_4 = __pyx_v_self->_context_manager;
      __Pyx_INCREF(__pyx_t_4);

      /* "memray/_memray.pyx":1044
 *                 assert(self._context_manager is not None)
 *                 self._context_manager.update(
 *                     self._task, completed=self._cumulative_num_processed             # <<<<<<<<<<<<<<
 *                 )
 *                 self._context_manager.refresh()
*/
      __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_cumulative_num_processed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_self->_task};
        __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_completed, __pyx_t_5, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1043, __pyx_L1_error)
        __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "memray/_memray.pyx":1046
 *                     self._task, completed=self._cumulative_num_processed
 *                 )
 *                 self._context_manager.refresh()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
      __pyx_t_7 = __pyx_v_self->_context_manager;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_refresh, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "memray/_memray.pyx":1041
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:
 *             if self._time_for_refresh():             # <<<<<<<<<<<<<<
 *                 assert(self._context_manager is not None)
 *                 self._context_manager.update(
*/
    }

    /* "memray/_memray.pyx":1040
 *         if not self._report_progress:
 *             return
 *         if self._cumulative_num_processed % self._update_interval == 0:             # <<<<<<<<<<<<<<
 *             if self._time_for_refresh():
 *                 assert(self._context_manager is not None)
*/
  }

  /* "memray/_memray.pyx":1036
 *         return False
 * 
 *     cdef update(self, size_t n_processed):             # <<<<<<<<<<<<<<
 *         self._cumulative_num_processed += n_processed
 *         if not self._report_progress:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1048
 *                 self._context_manager.refresh()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def num_processed(self):
 *         return self._cumulative_num_processed
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_13num_processed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_13num_processed_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator_13num_processed___get__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_13num_processed___get__(struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1050
 *     @property
 *     def num_processed(self):
 *         return self._cumulative_num_processed             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_cumulative_num_processed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1048
 *                 self._context_manager.refresh()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def num_processed(self):
 *         return self._cumulative_num_processed
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.num_processed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_17ProgressIndicator_6__reduce_cython__, "ProgressIndicator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_17ProgressIndicator_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_6__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator_6__reduce_cython__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Pickling_of_struct_members_such, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_17ProgressIndicator_8__setstate_cython__, "ProgressIndicator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_17ProgressIndicator_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_8__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_17ProgressIndicator_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_17ProgressIndicator_8__setstate_cython__(((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_17ProgressIndicator_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Pickling_of_struct_members_such, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.ProgressIndicator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1063
 *     cdef size_t _memory_snapshot_stride
 * 
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):             # <<<<<<<<<<<<<<
 *         try:
 *             self._file = open(file_name)
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_10FileReader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_10FileReader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file_name = 0;
  bool __pyx_v_report_progress;
  int __pyx_v_max_memory_records;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file_name,&__pyx_mstate_global->__pyx_n_u_report_progress,&__pyx_mstate_global->__pyx_n_u_max_memory_records,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1063, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1063, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 1063, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 1063, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1063, __pyx_L3_error)
    }
    __pyx_v_file_name = values[0];
    if (values[1]) {
      __pyx_v_report_progress = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_report_progress == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1063, __pyx_L3_error)
    } else {
      __pyx_v_report_progress = ((bool)0);
    }
    if (values[2]) {
      __pyx_v_max_memory_records = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_max_memory_records == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1063, __pyx_L3_error)
    } else {
      __pyx_v_max_memory_records = ((int)0x2710);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1063, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader___cinit__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_file_name, __pyx_v_report_progress, __pyx_v_max_memory_records);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_10FileReader___cinit__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_file_name, bool __pyx_v_report_progress, int __pyx_v_max_memory_records) {
  PyObject *__pyx_v_exc = NULL;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  memray::api::RecordReader *__pyx_v_reader;
  PyObject *__pyx_v_stats = NULL;
  PyObject *__pyx_v_n_memory_snapshots_approx = NULL;
  PyObject *__pyx_v_total = 0;
  memray::api::HighWatermarkFinder __pyx_v_finder;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator = 0;
  struct memray::tracking_api::MemoryRecord __pyx_v_memory_record;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14[4];
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_t_23;
  std::string __pyx_t_24;
  memray::io::FileSource *__pyx_t_25;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_26;
  std::vector<struct memray::tracking_api::MemorySnapshot> ::size_type __pyx_t_27;
  enum memray::api::RecordReader::RecordResult __pyx_t_28;
  struct memray::tracking_api::MemorySnapshot __pyx_t_29;
  int __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  std::vector<struct memray::tracking_api::MemorySnapshot>  __pyx_t_32;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "memray/_memray.pyx":1064
 * 
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):
 *         try:             # <<<<<<<<<<<<<<
 *             self._file = open(file_name)
 *         except OSError as exc:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "memray/_memray.pyx":1065
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):
 *         try:
 *             self._file = open(file_name)             # <<<<<<<<<<<<<<
 *         except OSError as exc:
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_file_name};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_open, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_file);
      __Pyx_DECREF(__pyx_v_self->_file);
      __pyx_v_self->_file = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "memray/_memray.pyx":1064
 * 
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):
 *         try:             # <<<<<<<<<<<<<<
 *             self._file = open(file_name)
 *         except OSError as exc:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "memray/_memray.pyx":1066
 *         try:
 *             self._file = open(file_name)
 *         except OSError as exc:             # <<<<<<<<<<<<<<
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None
 * 
*/
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_OSError))));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("memray._memray.FileReader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1066, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_exc = __pyx_t_5;
      /*try:*/ {

        /* "memray/_memray.pyx":1067
 *             self._file = open(file_name)
 *         except OSError as exc:
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None             # <<<<<<<<<<<<<<
 * 
 *         if platform.system() == "Linux":
*/
        __pyx_t_10 = NULL;
        __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_file_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1067, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_exc, __pyx_mstate_global->__pyx_n_u_strerror); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1067, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1067, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_Could_not_open_file;
        __pyx_t_14[1] = __pyx_t_11;
        __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u__8;
        __pyx_t_14[3] = __pyx_t_13;
        __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1067, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_12};
          __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_OSError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1067, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, Py_None);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1067, __pyx_L14_error)
      }

      /* "memray/_memray.pyx":1066
 *         try:
 *             self._file = open(file_name)
 *         except OSError as exc:             # <<<<<<<<<<<<<<
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None
 * 
*/
      /*finally:*/ {
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
          if ( unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_22);
          __pyx_t_7 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_exc); __pyx_v_exc = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
          __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
          __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
          goto __pyx_L5_except_error;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "memray/_memray.pyx":1064
 * 
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):
 *         try:             # <<<<<<<<<<<<<<
 *             self._file = open(file_name)
 *         except OSError as exc:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "memray/_memray.pyx":1069
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None
 * 
 *         if platform.system() == "Linux":             # <<<<<<<<<<<<<<
 *             self._path = "/proc/self/fd/" + str(self._file.fileno())
 *         else:
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_platform); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_system); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
  }
  __pyx_t_23 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Linux, Py_EQ)); if (unlikely((__pyx_t_23 < 0))) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_23) {

    /* "memray/_memray.pyx":1070
 * 
 *         if platform.system() == "Linux":
 *             self._path = "/proc/self/fd/" + str(self._file.fileno())             # <<<<<<<<<<<<<<
 *         else:
 *             self._path = str(file_name)
*/
    __pyx_t_9 = __pyx_v_self->_file;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_fileno, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1070, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_9 = __Pyx_PyObject_Unicode(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_proc_self_fd, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_24 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_self->_path = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_24);

    /* "memray/_memray.pyx":1069
 *             raise OSError(f"Could not open file {file_name}: {exc.strerror}") from None
 * 
 *         if platform.system() == "Linux":             # <<<<<<<<<<<<<<
 *             self._path = "/proc/self/fd/" + str(self._file.fileno())
 *         else:
*/
    goto __pyx_L20;
  }

  /* "memray/_memray.pyx":1072
 *             self._path = "/proc/self/fd/" + str(self._file.fileno())
 *         else:
 *             self._path = str(file_name)             # <<<<<<<<<<<<<<
 *         self._report_progress = report_progress
 * 
*/
  /*else*/ {
    __pyx_t_8 = __Pyx_PyObject_Unicode(__pyx_v_file_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_24 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_self->_path = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_24);
  }
  __pyx_L20:;

  /* "memray/_memray.pyx":1073
 *         else:
 *             self._path = str(file_name)
 *         self._report_progress = report_progress             # <<<<<<<<<<<<<<
 * 
 *         # Initial pass to populate _header, _high_watermark, and _memory_snapshots.
*/
  __pyx_v_self->_report_progress = __pyx_v_report_progress;

  /* "memray/_memray.pyx":1077
 *         # Initial pass to populate _header, _high_watermark, and _memory_snapshots.
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path)),             # <<<<<<<<<<<<<<
 *             False
 *         )
*/
  try {
    __pyx_t_25 = new memray::io::FileSource(__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1077, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1076
 * 
 *         # Initial pass to populate _header, _high_watermark, and _memory_snapshots.
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path)),
 *             False
*/
  try {
    __pyx_t_26 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_25), 0);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1076, __pyx_L1_error)
  }
  __pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_26);

  /* "memray/_memray.pyx":1080
 *             False
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         self._header = reader.getHeader()
*/
  __pyx_v_reader = __pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1082
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         self._header = reader.getHeader()             # <<<<<<<<<<<<<<
 *         stats = self._header["stats"]
 * 
*/
  __pyx_t_8 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(__pyx_v_reader->getHeader()); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(__pyx_v_self->_header);
  __Pyx_DECREF(__pyx_v_self->_header);
  __pyx_v_self->_header = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "memray/_memray.pyx":1083
 * 
 *         self._header = reader.getHeader()
 *         stats = self._header["stats"]             # <<<<<<<<<<<<<<
 * 
 *         n_memory_snapshots_approx = 2048
*/
  __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_stats = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "memray/_memray.pyx":1085
 *         stats = self._header["stats"]
 * 
 *         n_memory_snapshots_approx = 2048             # <<<<<<<<<<<<<<
 *         if 0 < stats["start_time"] < stats["end_time"]:
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_2048);
  __pyx_v_n_memory_snapshots_approx = __pyx_mstate_global->__pyx_int_2048;

  /* "memray/_memray.pyx":1086
 * 
 *         n_memory_snapshots_approx = 2048
 *         if 0 < stats["start_time"] < stats["end_time"]:             # <<<<<<<<<<<<<<
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10
 * 
*/
  __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_start_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1086, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_9)) {
    __Pyx_DECREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_end_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_23 < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_23) {

    /* "memray/_memray.pyx":1087
 *         n_memory_snapshots_approx = 2048
 *         if 0 < stats["start_time"] < stats["end_time"]:
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10             # <<<<<<<<<<<<<<
 * 
 *         if n_memory_snapshots_approx > max_memory_records:
*/
    __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_end_time); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_start_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_10, 10, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_n_memory_snapshots_approx, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "memray/_memray.pyx":1086
 * 
 *         n_memory_snapshots_approx = 2048
 *         if 0 < stats["start_time"] < stats["end_time"]:             # <<<<<<<<<<<<<<
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10
 * 
*/
  }

  /* "memray/_memray.pyx":1089
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10
 * 
 *         if n_memory_snapshots_approx > max_memory_records:             # <<<<<<<<<<<<<<
 *             n_memory_snapshots_approx = max_memory_records
 *         self._memory_snapshots.reserve(n_memory_snapshots_approx)
*/
  __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_max_memory_records); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_n_memory_snapshots_approx, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_23 < 0))) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_23) {

    /* "memray/_memray.pyx":1090
 * 
 *         if n_memory_snapshots_approx > max_memory_records:
 *             n_memory_snapshots_approx = max_memory_records             # <<<<<<<<<<<<<<
 *         self._memory_snapshots.reserve(n_memory_snapshots_approx)
 * 
*/
    __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_max_memory_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_n_memory_snapshots_approx, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "memray/_memray.pyx":1089
 *             n_memory_snapshots_approx = (stats["end_time"] - stats["start_time"]) / 10
 * 
 *         if n_memory_snapshots_approx > max_memory_records:             # <<<<<<<<<<<<<<
 *             n_memory_snapshots_approx = max_memory_records
 *         self._memory_snapshots.reserve(n_memory_snapshots_approx)
*/
  }

  /* "memray/_memray.pyx":1091
 *         if n_memory_snapshots_approx > max_memory_records:
 *             n_memory_snapshots_approx = max_memory_records
 *         self._memory_snapshots.reserve(n_memory_snapshots_approx)             # <<<<<<<<<<<<<<
 * 
 *         cdef object total = stats['n_allocations'] or None
*/
  __pyx_t_27 = __Pyx_PyLong_As_size_t(__pyx_v_n_memory_snapshots_approx); if (unlikely((__pyx_t_27 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1091, __pyx_L1_error)
  try {
    __pyx_v_self->_memory_snapshots.reserve(__pyx_t_27);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1091, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1093
 *         self._memory_snapshots.reserve(n_memory_snapshots_approx)
 * 
 *         cdef object total = stats['n_allocations'] or None             # <<<<<<<<<<<<<<
 *         cdef HighWatermarkFinder finder
 * 
*/
  __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_23 < 0))) __PYX_ERR(0, 1093, __pyx_L1_error)
  if (!__pyx_t_23) {
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_5 = __pyx_t_8;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L23_bool_binop_done;
  }
  __Pyx_INCREF(Py_None);
  __pyx_t_5 = Py_None;
  __pyx_L23_bool_binop_done:;
  __pyx_v_total = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "memray/_memray.pyx":1096
 *         cdef HighWatermarkFinder finder
 * 
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *             "Calculating high watermark",
 *             total=total,
*/
  __pyx_t_8 = NULL;

  /* "memray/_memray.pyx":1099
 *             "Calculating high watermark",
 *             total=total,
 *             report_progress=self._report_progress             # <<<<<<<<<<<<<<
 *         )
 *         self._memory_snapshot_stride = 0
*/
  __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->_report_progress); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Calculating_high_watermark};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_v_total, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_t_9, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "memray/_memray.pyx":1101
 *             report_progress=self._report_progress
 *         )
 *         self._memory_snapshot_stride = 0             # <<<<<<<<<<<<<<
 *         cdef MemoryRecord memory_record
 *         with progress_indicator:
*/
  __pyx_v_self->_memory_snapshot_stride = 0;

  /* "memray/_memray.pyx":1103
 *         self._memory_snapshot_stride = 0
 *         cdef MemoryRecord memory_record
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while True:
 *                 PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1103, __pyx_L25_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1103, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_1, &__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_22);
        /*try:*/ {

          /* "memray/_memray.pyx":1104
 *         cdef MemoryRecord memory_record
 *         with progress_indicator:
 *             while True:             # <<<<<<<<<<<<<<
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
*/
          while (1) {

            /* "memray/_memray.pyx":1105
 *         with progress_indicator:
 *             while True:
 *                 PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
*/
            __pyx_t_15 = PyErr_CheckSignals(); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1105, __pyx_L29_error)

            /* "memray/_memray.pyx":1106
 *             while True:
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     finder.processAllocation(reader.getLatestAllocation())
*/
            try {
              __pyx_t_28 = __pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1106, __pyx_L29_error)
            }
            __pyx_v_ret = __pyx_t_28;

            /* "memray/_memray.pyx":1107
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     finder.processAllocation(reader.getLatestAllocation())
 *                     progress_indicator.update(1)
*/
            switch (__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1108
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     finder.processAllocation(reader.getLatestAllocation())             # <<<<<<<<<<<<<<
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultAggregatedAllocationRecord:
*/
              try {
                __pyx_v_finder.processAllocation(__pyx_v_reader->getLatestAllocation());
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1108, __pyx_L29_error)
              }

              /* "memray/_memray.pyx":1109
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     finder.processAllocation(reader.getLatestAllocation())
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     finder.processAllocation(
*/
              __pyx_t_5 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L29_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "memray/_memray.pyx":1107
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     finder.processAllocation(reader.getLatestAllocation())
 *                     progress_indicator.update(1)
*/
              break;
              case memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1111
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     finder.processAllocation(             # <<<<<<<<<<<<<<
 *                         reader.getLatestAggregatedAllocation().contributionToHighWaterMark()
 *                     )
*/
              try {
                __pyx_v_finder.processAllocation(__pyx_v_reader->getLatestAggregatedAllocation().contributionToHighWaterMark());
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1111, __pyx_L29_error)
              }

              /* "memray/_memray.pyx":1114
 *                         reader.getLatestAggregatedAllocation().contributionToHighWaterMark()
 *                     )
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_record = reader.getLatestMemoryRecord()
*/
              __pyx_t_5 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L29_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "memray/_memray.pyx":1110
 *                     finder.processAllocation(reader.getLatestAllocation())
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultAggregatedAllocationRecord:             # <<<<<<<<<<<<<<
 *                     finder.processAllocation(
 *                         reader.getLatestAggregatedAllocation().contributionToHighWaterMark()
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

              /* "memray/_memray.pyx":1116
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_record = reader.getLatestMemoryRecord()             # <<<<<<<<<<<<<<
 *                     self._memory_snapshots.push_back(
 *                         _MemorySnapshot(
*/
              __pyx_v_memory_record = __pyx_v_reader->getLatestMemoryRecord();

              /* "memray/_memray.pyx":1119
 *                     self._memory_snapshots.push_back(
 *                         _MemorySnapshot(
 *                             memory_record.ms_since_epoch,             # <<<<<<<<<<<<<<
 *                             memory_record.rss,
 *                             finder.getCurrentWatermark(),
*/
              __pyx_t_29.ms_since_epoch = __pyx_v_memory_record.ms_since_epoch;

              /* "memray/_memray.pyx":1120
 *                         _MemorySnapshot(
 *                             memory_record.ms_since_epoch,
 *                             memory_record.rss,             # <<<<<<<<<<<<<<
 *                             finder.getCurrentWatermark(),
 *                         )
*/
              __pyx_t_29.rss = __pyx_v_memory_record.rss;

              /* "memray/_memray.pyx":1121
 *                             memory_record.ms_since_epoch,
 *                             memory_record.rss,
 *                             finder.getCurrentWatermark(),             # <<<<<<<<<<<<<<
 *                         )
 *                     )
*/
              __pyx_t_29.heap = __pyx_v_finder.getCurrentWatermark();

              /* "memray/_memray.pyx":1117
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_record = reader.getLatestMemoryRecord()
 *                     self._memory_snapshots.push_back(             # <<<<<<<<<<<<<<
 *                         _MemorySnapshot(
 *                             memory_record.ms_since_epoch,
*/
              try {
                __pyx_v_self->_memory_snapshots.push_back(__pyx_t_29);
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1117, __pyx_L29_error)
              }

              /* "memray/_memray.pyx":1115
 *                     )
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                     memory_record = reader.getLatestMemoryRecord()
 *                     self._memory_snapshots.push_back(
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT:

              /* "memray/_memray.pyx":1125
 *                     )
 *                 elif ret == RecordResult.RecordResultMemorySnapshot:
 *                     self._memory_snapshots.push_back(reader.getLatestMemorySnapshot())             # <<<<<<<<<<<<<<
 *                 else:
 *                     break
*/
              try {
                __pyx_v_self->_memory_snapshots.push_back(__pyx_v_reader->getLatestMemorySnapshot());
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1125, __pyx_L29_error)
              }

              /* "memray/_memray.pyx":1124
 *                         )
 *                     )
 *                 elif ret == RecordResult.RecordResultMemorySnapshot:             # <<<<<<<<<<<<<<
 *                     self._memory_snapshots.push_back(reader.getLatestMemorySnapshot())
 *                 else:
*/
              break;
              default:

              /* "memray/_memray.pyx":1127
 *                     self._memory_snapshots.push_back(reader.getLatestMemorySnapshot())
 *                 else:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         if len(self._memory_snapshots) > max_memory_records:
*/
              goto __pyx_L36_break;
              break;
            }
          }
          __pyx_L36_break:;

          /* "memray/_memray.pyx":1103
 *         self._memory_snapshot_stride = 0
 *         cdef MemoryRecord memory_record
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while True:
 *                 PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L34_try_end;
        __pyx_L29_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.FileReader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_9, &__pyx_t_4) < 0) __PYX_ERR(0, 1103, __pyx_L31_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_8 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1103, __pyx_L31_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1103, __pyx_L31_except_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (__pyx_t_23 < (0)) __PYX_ERR(0, 1103, __pyx_L31_except_error)
          __pyx_t_30 = (!__pyx_t_23);
          if (unlikely(__pyx_t_30)) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_9, __pyx_t_4);
            __pyx_t_5 = 0;  __pyx_t_9 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1103, __pyx_L31_except_error)
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L30_exception_handled;
        }
        __pyx_L31_except_error:;
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_1, __pyx_t_22);
        goto __pyx_L1_error;
        __pyx_L30_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_1, __pyx_t_22);
        __pyx_L34_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_3) {
          __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1103, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        }
        goto __pyx_L28;
      }
      __pyx_L28:;
    }
    goto __pyx_L40;
    __pyx_L25_error:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L1_error;
    __pyx_L40:;
  }

  /* "memray/_memray.pyx":1129
 *                     break
 * 
 *         if len(self._memory_snapshots) > max_memory_records:             # <<<<<<<<<<<<<<
 *             self._memory_snapshot_stride = int(ceil(<double>len(self._memory_snapshots) / max_memory_records))
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]
*/
  __pyx_t_4 = __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(__pyx_v_self->_memory_snapshots); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_31 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_31 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_30 = (__pyx_t_31 > __pyx_v_max_memory_records);
  if (__pyx_t_30) {

    /* "memray/_memray.pyx":1130
 * 
 *         if len(self._memory_snapshots) > max_memory_records:
 *             self._memory_snapshot_stride = int(ceil(<double>len(self._memory_snapshots) / max_memory_records))             # <<<<<<<<<<<<<<
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]
 *         self._high_watermark = finder.getHighWatermark()
*/
    __pyx_t_4 = __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(__pyx_v_self->_memory_snapshots); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_31 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_31 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1130, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_self->_memory_snapshot_stride = ((size_t)ceil((((double)__pyx_t_31) / ((double)__pyx_v_max_memory_records))));

    /* "memray/_memray.pyx":1131
 *         if len(self._memory_snapshots) > max_memory_records:
 *             self._memory_snapshot_stride = int(ceil(<double>len(self._memory_snapshots) / max_memory_records))
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]             # <<<<<<<<<<<<<<
 *         self._high_watermark = finder.getHighWatermark()
 *         stats["n_allocations"] = progress_indicator.num_processed
*/
    __pyx_t_4 = __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(__pyx_v_self->_memory_snapshots); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_memory_snapshot_stride); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PySlice_New(Py_None, Py_None, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_32 = __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_self->_memory_snapshots = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_32);

    /* "memray/_memray.pyx":1129
 *                     break
 * 
 *         if len(self._memory_snapshots) > max_memory_records:             # <<<<<<<<<<<<<<
 *             self._memory_snapshot_stride = int(ceil(<double>len(self._memory_snapshots) / max_memory_records))
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]
*/
  }

  /* "memray/_memray.pyx":1132
 *             self._memory_snapshot_stride = int(ceil(<double>len(self._memory_snapshots) / max_memory_records))
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]
 *         self._high_watermark = finder.getHighWatermark()             # <<<<<<<<<<<<<<
 *         stats["n_allocations"] = progress_indicator.num_processed
 * 
*/
  __pyx_v_self->_high_watermark = __pyx_v_finder.getHighWatermark();

  /* "memray/_memray.pyx":1133
 *             self._memory_snapshots = self._memory_snapshots[::self._memory_snapshot_stride]
 *         self._high_watermark = finder.getHighWatermark()
 *         stats["n_allocations"] = progress_indicator.num_processed             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_num_processed); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (unlikely((PyObject_SetItem(__pyx_v_stats, __pyx_mstate_global->__pyx_n_u_n_allocations, __pyx_t_9) < 0))) __PYX_ERR(0, 1133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "memray/_memray.pyx":1063
 *     cdef size_t _memory_snapshot_stride
 * 
 *     def __cinit__(self, object file_name, *, bool report_progress=False, int max_memory_records=10000):             # <<<<<<<<<<<<<<
 *         try:
 *             self._file = open(file_name)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("memray._memray.FileReader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_stats);
  __Pyx_XDECREF(__pyx_v_n_memory_snapshots_approx);
  __Pyx_XDECREF(__pyx_v_total);
  __Pyx_XDECREF((PyObject *)__pyx_v_progress_indicator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1135
 *         stats["n_allocations"] = progress_indicator.num_processed
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
*/

/* Python wrapper */
static void __pyx_pw_6memray_7_memray_10FileReader_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6memray_7_memray_10FileReader_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6memray_7_memray_10FileReader_2__dealloc__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6memray_7_memray_10FileReader_2__dealloc__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "memray/_memray.pyx":1136
 * 
 *     def __dealloc__(self):
 *         self.close()             # <<<<<<<<<<<<<<
 * 
 *     cpdef close(self):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1135
 *         stats["n_allocations"] = progress_indicator.num_processed
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("memray._memray.FileReader.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "memray/_memray.pyx":1138
 *         self.close()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         if self._file is not None:
 *             file = self._file
*/

static PyObject *__pyx_pw_6memray_7_memray_10FileReader_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6memray_7_memray_10FileReader_close(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_file = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6memray_7_memray_10FileReader_5close)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "memray/_memray.pyx":1139
 * 
 *     cpdef close(self):
 *         if self._file is not None:             # <<<<<<<<<<<<<<
 *             file = self._file
 *             self._file = None
*/
  __pyx_t_6 = (__pyx_v_self->_file != Py_None);
  if (__pyx_t_6) {

    /* "memray/_memray.pyx":1140
 *     cpdef close(self):
 *         if self._file is not None:
 *             file = self._file             # <<<<<<<<<<<<<<
 *             self._file = None
 *             file.close()
*/
    __pyx_t_1 = __pyx_v_self->_file;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_file = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1141
 *         if self._file is not None:
 *             file = self._file
 *             self._file = None             # <<<<<<<<<<<<<<
 *             file.close()
 * 
*/
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_file);
    __Pyx_DECREF(__pyx_v_self->_file);
    __pyx_v_self->_file = Py_None;

    /* "memray/_memray.pyx":1142
 *             file = self._file
 *             self._file = None
 *             file.close()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _ensure_not_closed(self) except *:
*/
    __pyx_t_2 = __pyx_v_file;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1139
 * 
 *     cpdef close(self):
 *         if self._file is not None:             # <<<<<<<<<<<<<<
 *             file = self._file
 *             self._file = None
*/
  }

  /* "memray/_memray.pyx":1138
 *         self.close()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         if self._file is not None:
 *             file = self._file
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.FileReader.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_file);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_4close, "FileReader.close(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_5close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_4close};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_5close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_4close(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_4close(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6memray_7_memray_10FileReader_close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.FileReader.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1144
 *             file.close()
 * 
 *     cdef void _ensure_not_closed(self) except *:             # <<<<<<<<<<<<<<
 *         if self._file is None:
 *             raise ValueError("Operation on a closed FileReader")
*/

static void __pyx_f_6memray_7_memray_10FileReader__ensure_not_closed(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ensure_not_closed", 0);

  /* "memray/_memray.pyx":1145
 * 
 *     cdef void _ensure_not_closed(self) except *:
 *         if self._file is None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Operation on a closed FileReader")
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_file == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "memray/_memray.pyx":1146
 *     cdef void _ensure_not_closed(self) except *:
 *         if self._file is None:
 *             raise ValueError("Operation on a closed FileReader")             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Operation_on_a_closed_FileReader};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1146, __pyx_L1_error)

    /* "memray/_memray.pyx":1145
 * 
 *     cdef void _ensure_not_closed(self) except *:
 *         if self._file is None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Operation on a closed FileReader")
 * 
*/
  }

  /* "memray/_memray.pyx":1144
 *             file.close()
 * 
 *     cdef void _ensure_not_closed(self) except *:             # <<<<<<<<<<<<<<
 *         if self._file is None:
 *             raise ValueError("Operation on a closed FileReader")
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.FileReader._ensure_not_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "memray/_memray.pyx":1148
 *             raise ValueError("Operation on a closed FileReader")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def closed(self):
 *         return self._file is None
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_6closed_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_6closed___get__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_6closed___get__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1150
 *     @property
 *     def closed(self):
 *         return self._file is None             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__pyx_v_self->_file == Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1148
 *             raise ValueError("Operation on a closed FileReader")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def closed(self):
 *         return self._file is None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.FileReader.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1152
 *         return self._file is None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_7__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_6__enter__, "FileReader.__enter__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_7__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_7__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_6__enter__};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_7__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_6__enter__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_6__enter__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "memray/_memray.pyx":1153
 * 
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "memray/_memray.pyx":1152
 *         return self._file is None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1155
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_9__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_8__exit__, "FileReader.__exit__(self, exc_type, exc_value, exc_traceback)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_9__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_9__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_8__exit__};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_9__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_traceback = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_value,&__pyx_mstate_global->__pyx_n_u_exc_traceback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1155, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1155, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 1155, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 1155, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1155, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1155, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1155, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_value = values[1];
    __pyx_v_exc_traceback = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1155, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_8__exit__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_exc_traceback);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_8__exit__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "memray/_memray.pyx":1156
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         self.close()             # <<<<<<<<<<<<<<
 * 
 *     def _reaggregate_allocations(
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1155
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.FileReader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1158
 *         self.close()
 * 
 *     def _reaggregate_allocations(             # <<<<<<<<<<<<<<
 *         self, size_t records_to_process, bool merge_threads, bool leaks
 *     ):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_11_reaggregate_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_10_reaggregate_allocations, "FileReader._reaggregate_allocations(self, size_t records_to_process, bool merge_threads, bool leaks)\n\nAggregate records from an AGGREGATED_ALLOCATIONS capture file.\n\nAn extra aggregation pass is still needed to account for merge_threads,\nas well as (for now at least) different location key formats.");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_11_reaggregate_allocations = {"_reaggregate_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_11_reaggregate_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_10_reaggregate_allocations};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_11_reaggregate_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  size_t __pyx_v_records_to_process;
  bool __pyx_v_merge_threads;
  bool __pyx_v_leaks;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reaggregate_allocations (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_records_to_process,&__pyx_mstate_global->__pyx_n_u_merge_threads,&__pyx_mstate_global->__pyx_n_u_leaks,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1158, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1158, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1158, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1158, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_reaggregate_allocations", 0) < (0)) __PYX_ERR(0, 1158, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_reaggregate_allocations", 1, 3, 3, i); __PYX_ERR(0, 1158, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1158, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1158, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1158, __pyx_L3_error)
    }
    __pyx_v_records_to_process = __Pyx_PyLong_As_size_t(values[0]); if (unlikely((__pyx_v_records_to_process == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
    __pyx_v_merge_threads = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_merge_threads == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
    __pyx_v_leaks = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_leaks == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_reaggregate_allocations", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1158, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader._reaggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_10_reaggregate_allocations(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_records_to_process, __pyx_v_merge_threads, __pyx_v_leaks);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_10_reaggregate_allocations(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, size_t __pyx_v_records_to_process, bool __pyx_v_merge_threads, bool __pyx_v_leaks) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reaggregate_allocations", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1158, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_records_to_process = __pyx_v_records_to_process;
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __pyx_cur_scope->__pyx_v_leaks = __pyx_v_leaks;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_12generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_reaggregate_allocations, __pyx_mstate_global->__pyx_n_u_FileReader__reaggregate_allocati, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader._reaggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  memray::io::FileSource *__pyx_t_1;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  enum memray::api::RecordReader::RecordResult __pyx_t_14;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  memray::api::reduced_snapshot_map_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  PyObject *(*__pyx_t_20)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reaggregate_allocations", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L23_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1158, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1168
 *         cdef AggregatedCaptureReaggregator aggregator
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path))             # <<<<<<<<<<<<<<
 *         )
 *         cdef RecordReader* reader = reader_sp.get()
*/
  try {
    __pyx_t_1 = new memray::io::FileSource(__pyx_cur_scope->__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1168, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1167
 *         """
 *         cdef AggregatedCaptureReaggregator aggregator
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
*/
  try {
    __pyx_t_2 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1167, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2);

  /* "memray/_memray.pyx":1170
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
*/
  __pyx_cur_scope->__pyx_v_reader = __pyx_cur_scope->__pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1172
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *             "Processing allocation records",
 *             total=records_to_process,
*/
  __pyx_t_4 = NULL;

  /* "memray/_memray.pyx":1174
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
 *             total=records_to_process,             # <<<<<<<<<<<<<<
 *             report_progress=self._report_progress
 *         )
*/
  __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_records_to_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "memray/_memray.pyx":1175
 *             "Processing allocation records",
 *             total=records_to_process,
 *             report_progress=self._report_progress             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->_report_progress); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Processing_allocation_records};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_t_5, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1172, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_t_6, __pyx_t_8, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_3);
  __pyx_cur_scope->__pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "memray/_memray.pyx":1179
 * 
 *         cdef AggregatedAllocation record
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while True:
 *                 PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1179, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1179, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "memray/_memray.pyx":1180
 *         cdef AggregatedAllocation record
 *         with progress_indicator:
 *             while True:             # <<<<<<<<<<<<<<
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
*/
          while (1) {

            /* "memray/_memray.pyx":1181
 *         with progress_indicator:
 *             while True:
 *                 PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:
*/
            __pyx_t_13 = PyErr_CheckSignals(); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1181, __pyx_L8_error)

            /* "memray/_memray.pyx":1182
 *             while True:
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     record = reader.getLatestAggregatedAllocation()
*/
            try {
              __pyx_t_14 = __pyx_cur_scope->__pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1182, __pyx_L8_error)
            }
            __pyx_cur_scope->__pyx_v_ret = __pyx_t_14;

            /* "memray/_memray.pyx":1183
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:             # <<<<<<<<<<<<<<
 *                     record = reader.getLatestAggregatedAllocation()
 *                     if leaks:
*/
            switch (__pyx_cur_scope->__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1184
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     record = reader.getLatestAggregatedAllocation()             # <<<<<<<<<<<<<<
 *                     if leaks:
 *                         aggregator.addAllocation(record.contributionToLeaks())
*/
              __pyx_cur_scope->__pyx_v_record = __pyx_cur_scope->__pyx_v_reader->getLatestAggregatedAllocation();

              /* "memray/_memray.pyx":1185
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     record = reader.getLatestAggregatedAllocation()
 *                     if leaks:             # <<<<<<<<<<<<<<
 *                         aggregator.addAllocation(record.contributionToLeaks())
 *                     else:
*/
              __pyx_t_15 = (__pyx_cur_scope->__pyx_v_leaks != 0);
              if (__pyx_t_15) {

                /* "memray/_memray.pyx":1186
 *                     record = reader.getLatestAggregatedAllocation()
 *                     if leaks:
 *                         aggregator.addAllocation(record.contributionToLeaks())             # <<<<<<<<<<<<<<
 *                     else:
 *                         aggregator.addAllocation(record.contributionToHighWaterMark())
*/
                try {
                  __pyx_cur_scope->__pyx_v_aggregator.addAllocation(__pyx_cur_scope->__pyx_v_record.contributionToLeaks());
                } catch(...) {
                  __Pyx_CppExn2PyErr();
                  __PYX_ERR(0, 1186, __pyx_L8_error)
                }

                /* "memray/_memray.pyx":1185
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:
 *                     record = reader.getLatestAggregatedAllocation()
 *                     if leaks:             # <<<<<<<<<<<<<<
 *                         aggregator.addAllocation(record.contributionToLeaks())
 *                     else:
*/
                goto __pyx_L16;
              }

              /* "memray/_memray.pyx":1188
 *                         aggregator.addAllocation(record.contributionToLeaks())
 *                     else:
 *                         aggregator.addAllocation(record.contributionToHighWaterMark())             # <<<<<<<<<<<<<<
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
*/
              /*else*/ {
                try {
                  __pyx_cur_scope->__pyx_v_aggregator.addAllocation(__pyx_cur_scope->__pyx_v_record.contributionToHighWaterMark());
                } catch(...) {
                  __Pyx_CppExn2PyErr();
                  __PYX_ERR(0, 1188, __pyx_L8_error)
                }
              }
              __pyx_L16:;

              /* "memray/_memray.pyx":1189
 *                     else:
 *                         aggregator.addAllocation(record.contributionToHighWaterMark())
 *                     records_to_process -= 1             # <<<<<<<<<<<<<<
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemorySnapshot:
*/
              __pyx_cur_scope->__pyx_v_records_to_process = (__pyx_cur_scope->__pyx_v_records_to_process - 1);

              /* "memray/_memray.pyx":1190
 *                         aggregator.addAllocation(record.contributionToHighWaterMark())
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultMemorySnapshot:
 *                     pass
*/
              __pyx_t_3 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_cur_scope->__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_cur_scope->__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1190, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "memray/_memray.pyx":1183
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAggregatedAllocationRecord:             # <<<<<<<<<<<<<<
 *                     record = reader.getLatestAggregatedAllocation()
 *                     if leaks:
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT:

              /* "memray/_memray.pyx":1191
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemorySnapshot:             # <<<<<<<<<<<<<<
 *                     pass
 *                 else:
*/
              break;
              default:

              /* "memray/_memray.pyx":1194
 *                     pass
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemoryRecord             # <<<<<<<<<<<<<<
 *                     assert ret != RecordResult.RecordResultAllocationRecord
 *                     break
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_15 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::MEMORY_RECORD);
                if (unlikely(!__pyx_t_15)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1194, __pyx_L8_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1194, __pyx_L8_error)
              #endif

              /* "memray/_memray.pyx":1195
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemoryRecord
 *                     assert ret != RecordResult.RecordResultAllocationRecord             # <<<<<<<<<<<<<<
 *                     break
 * 
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_15 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::ALLOCATION_RECORD);
                if (unlikely(!__pyx_t_15)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1195, __pyx_L8_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1195, __pyx_L8_error)
              #endif

              /* "memray/_memray.pyx":1196
 *                     assert ret != RecordResult.RecordResultMemoryRecord
 *                     assert ret != RecordResult.RecordResultAllocationRecord
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(
*/
              goto __pyx_L15_break;
              break;
            }
          }
          __pyx_L15_break:;

          /* "memray/_memray.pyx":1179
 * 
 *         cdef AggregatedAllocation record
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while True:
 *                 PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.FileReader._reaggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 1179, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1179, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1179, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (__pyx_t_15 < (0)) __PYX_ERR(0, 1179, __pyx_L10_except_error)
          __pyx_t_17 = (!__pyx_t_15);
          if (unlikely(__pyx_t_17)) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_6, __pyx_t_8);
            __pyx_t_3 = 0;  __pyx_t_6 = 0;  __pyx_t_8 = 0; 
            __PYX_ERR(0, 1179, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_9) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L20;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }

  /* "memray/_memray.pyx":1199
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(
 *             aggregator.getSnapshotAllocations(merge_threads)             # <<<<<<<<<<<<<<
 *         ):
 *             alloc = AllocationRecord(elem)
*/
  try {
    __pyx_t_18 = __pyx_cur_scope->__pyx_v_aggregator.getSnapshotAllocations(__pyx_cur_scope->__pyx_v_merge_threads);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1199, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1198
 *                     break
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(             # <<<<<<<<<<<<<<
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
*/
  try {
    __pyx_t_8 = memray::api::Py_ListFromSnapshotAllocationRecords(__pyx_t_18);
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1198, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1198, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_8);
  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
    __pyx_t_6 = __pyx_t_8; __Pyx_INCREF(__pyx_t_6);
    __pyx_t_19 = 0;
    __pyx_t_20 = NULL;
  } else {
    __pyx_t_19 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_20 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1198, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (likely(!__pyx_t_20)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1198, __pyx_L1_error)
          #endif
          if (__pyx_t_19 >= __pyx_temp) break;
        }
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_19, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_19;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1198, __pyx_L1_error)
          #endif
          if (__pyx_t_19 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_19));
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_19);
        #endif
        ++__pyx_t_19;
      }
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1198, __pyx_L1_error)
    } else {
      __pyx_t_8 = __pyx_t_20(__pyx_t_6);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1198, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;

    /* "memray/_memray.pyx":1201
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
 *             alloc = AllocationRecord(elem)             # <<<<<<<<<<<<<<
 *             (<AllocationRecord> alloc)._reader = reader_sp
 *             yield alloc
*/
    __pyx_t_3 = NULL;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_elem};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_8);
    }
    __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alloc, ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_t_8));
    __Pyx_GIVEREF((PyObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "memray/_memray.pyx":1202
 *         ):
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = reader_sp             # <<<<<<<<<<<<<<
 *             yield alloc
 * 
*/
    __pyx_cur_scope->__pyx_v_alloc->_reader = __pyx_cur_scope->__pyx_v_reader_sp;

    /* "memray/_memray.pyx":1203
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = reader_sp
 *             yield alloc             # <<<<<<<<<<<<<<
 * 
 *         reader.close()
*/
    __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XGIVEREF(__pyx_t_6);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_19;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_20;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L23_resume_from_yield:;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_6);
    __pyx_t_19 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_20 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1203, __pyx_L1_error)

    /* "memray/_memray.pyx":1198
 *                     break
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(             # <<<<<<<<<<<<<<
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "memray/_memray.pyx":1205
 *             yield alloc
 * 
 *         reader.close()             # <<<<<<<<<<<<<<
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,
*/
  __pyx_cur_scope->__pyx_v_reader->close();
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1158
 *         self.close()
 * 
 *     def _reaggregate_allocations(             # <<<<<<<<<<<<<<
 *         self, size_t records_to_process, bool merge_threads, bool leaks
 *     ):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_reaggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1207
 *         reader.close()
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,             # <<<<<<<<<<<<<<
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_14_aggregate_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_13_aggregate_allocations, "FileReader._aggregate_allocations(self, size_t records_to_process, bool merge_threads, size_t temporary_buffer_size=0)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_14_aggregate_allocations = {"_aggregate_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_14_aggregate_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_13_aggregate_allocations};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_14_aggregate_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  size_t __pyx_v_records_to_process;
  bool __pyx_v_merge_threads;
  size_t __pyx_v_temporary_buffer_size;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_aggregate_allocations (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_records_to_process,&__pyx_mstate_global->__pyx_n_u_merge_threads,&__pyx_mstate_global->__pyx_n_u_temporary_buffer_size,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1207, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1207, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1207, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1207, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_aggregate_allocations", 0) < (0)) __PYX_ERR(0, 1207, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_aggregate_allocations", 0, 2, 3, i); __PYX_ERR(0, 1207, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1207, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1207, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1207, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_records_to_process = __Pyx_PyLong_As_size_t(values[0]); if (unlikely((__pyx_v_records_to_process == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    __pyx_v_merge_threads = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_merge_threads == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_temporary_buffer_size = __Pyx_PyLong_As_size_t(values[2]); if (unlikely((__pyx_v_temporary_buffer_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1208, __pyx_L3_error)
    } else {
      __pyx_v_temporary_buffer_size = ((size_t)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_aggregate_allocations", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1207, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader._aggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_13_aggregate_allocations(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_records_to_process, __pyx_v_merge_threads, __pyx_v_temporary_buffer_size);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_13_aggregate_allocations(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, size_t __pyx_v_records_to_process, bool __pyx_v_merge_threads, size_t __pyx_v_temporary_buffer_size) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_aggregate_allocations", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1207, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_records_to_process = __pyx_v_records_to_process;
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __pyx_cur_scope->__pyx_v_temporary_buffer_size = __pyx_v_temporary_buffer_size;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_15generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_aggregate_allocations, __pyx_mstate_global->__pyx_n_u_FileReader__aggregate_allocation, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1207, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader._aggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  memray::api::SnapshotAllocationAggregator *__pyx_t_2;
  memray::io::FileSource *__pyx_t_3;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  enum memray::api::RecordReader::RecordResult __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  memray::api::reduced_snapshot_map_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  PyObject *(*__pyx_t_21)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_aggregate_allocations", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L23_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1207, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1210
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
 *         if temporary_buffer_size:             # <<<<<<<<<<<<<<
 *             the_aggregator.reset(
 *                 new TemporaryAllocationsAggregator(temporary_buffer_size)
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_temporary_buffer_size != 0);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1211
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
 *         if temporary_buffer_size:
 *             the_aggregator.reset(             # <<<<<<<<<<<<<<
 *                 new TemporaryAllocationsAggregator(temporary_buffer_size)
 *             )
*/
    __pyx_cur_scope->__pyx_v_the_aggregator.reset(new memray::api::TemporaryAllocationsAggregator(__pyx_cur_scope->__pyx_v_temporary_buffer_size));

    /* "memray/_memray.pyx":1210
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
 *         if temporary_buffer_size:             # <<<<<<<<<<<<<<
 *             the_aggregator.reset(
 *                 new TemporaryAllocationsAggregator(temporary_buffer_size)
*/
    goto __pyx_L4;
  }

  /* "memray/_memray.pyx":1215
 *             )
 *         else:
 *             the_aggregator.reset(new SnapshotAllocationAggregator())             # <<<<<<<<<<<<<<
 *         cdef AbstractAggregator* aggregator = the_aggregator.get()
 * 
*/
  /*else*/ {
    try {
      __pyx_t_2 = new memray::api::SnapshotAllocationAggregator();
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1215, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_the_aggregator.reset(__pyx_t_2);
  }
  __pyx_L4:;

  /* "memray/_memray.pyx":1216
 *         else:
 *             the_aggregator.reset(new SnapshotAllocationAggregator())
 *         cdef AbstractAggregator* aggregator = the_aggregator.get()             # <<<<<<<<<<<<<<
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
*/
  __pyx_cur_scope->__pyx_v_aggregator = __pyx_cur_scope->__pyx_v_the_aggregator.get();

  /* "memray/_memray.pyx":1219
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path))             # <<<<<<<<<<<<<<
 *         )
 *         cdef RecordReader* reader = reader_sp.get()
*/
  try {
    __pyx_t_3 = new memray::io::FileSource(__pyx_cur_scope->__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1219, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1218
 *         cdef AbstractAggregator* aggregator = the_aggregator.get()
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
*/
  try {
    __pyx_t_4 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_3));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1218, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4);

  /* "memray/_memray.pyx":1221
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
*/
  __pyx_cur_scope->__pyx_v_reader = __pyx_cur_scope->__pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1223
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *             "Processing allocation records",
 *             total=records_to_process,
*/
  __pyx_t_6 = NULL;

  /* "memray/_memray.pyx":1225
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
 *             total=records_to_process,             # <<<<<<<<<<<<<<
 *             report_progress=self._report_progress
 *         )
*/
  __pyx_t_7 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_records_to_process); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "memray/_memray.pyx":1226
 *             "Processing allocation records",
 *             total=records_to_process,
 *             report_progress=self._report_progress             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->_report_progress); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Processing_allocation_records};
    __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_t_7, __pyx_t_10, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1223, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_t_8, __pyx_t_10, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_5);
  __pyx_cur_scope->__pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "memray/_memray.pyx":1229
 *         )
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_11 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = NULL;
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1229, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1229, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "memray/_memray.pyx":1230
 * 
 *         with progress_indicator:
 *             while records_to_process > 0:             # <<<<<<<<<<<<<<
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
*/
          while (1) {
            __pyx_t_1 = (__pyx_cur_scope->__pyx_v_records_to_process > 0);
            if (!__pyx_t_1) break;

            /* "memray/_memray.pyx":1231
 *         with progress_indicator:
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
*/
            __pyx_t_15 = PyErr_CheckSignals(); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1231, __pyx_L9_error)

            /* "memray/_memray.pyx":1232
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     aggregator.addAllocation(reader.getLatestAllocation())
*/
            try {
              __pyx_t_16 = __pyx_cur_scope->__pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1232, __pyx_L9_error)
            }
            __pyx_cur_scope->__pyx_v_ret = __pyx_t_16;

            /* "memray/_memray.pyx":1233
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     aggregator.addAllocation(reader.getLatestAllocation())
 *                     records_to_process -= 1
*/
            switch (__pyx_cur_scope->__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1234
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     aggregator.addAllocation(reader.getLatestAllocation())             # <<<<<<<<<<<<<<
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
*/
              try {
                __pyx_cur_scope->__pyx_v_aggregator->addAllocation(__pyx_cur_scope->__pyx_v_reader->getLatestAllocation());
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1234, __pyx_L9_error)
              }

              /* "memray/_memray.pyx":1235
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     aggregator.addAllocation(reader.getLatestAllocation())
 *                     records_to_process -= 1             # <<<<<<<<<<<<<<
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
*/
              __pyx_cur_scope->__pyx_v_records_to_process = (__pyx_cur_scope->__pyx_v_records_to_process - 1);

              /* "memray/_memray.pyx":1236
 *                     aggregator.addAllocation(reader.getLatestAllocation())
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     pass
*/
              __pyx_t_5 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_cur_scope->__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_cur_scope->__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1236, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "memray/_memray.pyx":1233
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     aggregator.addAllocation(reader.getLatestAllocation())
 *                     records_to_process -= 1
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

              /* "memray/_memray.pyx":1237
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                     pass
 *                 else:
*/
              break;
              default:

              /* "memray/_memray.pyx":1240
 *                     pass
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot             # <<<<<<<<<<<<<<
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT);
                if (unlikely(!__pyx_t_1)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1240, __pyx_L9_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1240, __pyx_L9_error)
              #endif

              /* "memray/_memray.pyx":1241
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord             # <<<<<<<<<<<<<<
 *                     break
 * 
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_1 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD);
                if (unlikely(!__pyx_t_1)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1241, __pyx_L9_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1241, __pyx_L9_error)
              #endif

              /* "memray/_memray.pyx":1242
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(
*/
              goto __pyx_L16_break;
              break;
            }
          }
          __pyx_L16_break:;

          /* "memray/_memray.pyx":1229
 *         )
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L14_try_end;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.FileReader._aggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_8, &__pyx_t_10) < 0) __PYX_ERR(0, 1229, __pyx_L11_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_10);
          __pyx_t_7 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1229, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1229, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (__pyx_t_1 < (0)) __PYX_ERR(0, 1229, __pyx_L11_except_error)
          __pyx_t_18 = (!__pyx_t_1);
          if (unlikely(__pyx_t_18)) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_8, __pyx_t_10);
            __pyx_t_5 = 0;  __pyx_t_8 = 0;  __pyx_t_10 = 0; 
            __PYX_ERR(0, 1229, __pyx_L11_except_error)
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          goto __pyx_L10_exception_handled;
        }
        __pyx_L11_except_error:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        goto __pyx_L1_error;
        __pyx_L10_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_11) {
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1229, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    goto __pyx_L20;
    __pyx_L5_error:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L1_error;
    __pyx_L20:;
  }

  /* "memray/_memray.pyx":1245
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(
 *             aggregator.getSnapshotAllocations(merge_threads)             # <<<<<<<<<<<<<<
 *         ):
 *             alloc = AllocationRecord(elem)
*/
  try {
    __pyx_t_19 = __pyx_cur_scope->__pyx_v_aggregator->getSnapshotAllocations(__pyx_cur_scope->__pyx_v_merge_threads);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1245, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1244
 *                     break
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(             # <<<<<<<<<<<<<<
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
*/
  try {
    __pyx_t_10 = memray::api::Py_ListFromSnapshotAllocationRecords(__pyx_t_19);
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1244, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1244, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_10);
  if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
    __pyx_t_8 = __pyx_t_10; __Pyx_INCREF(__pyx_t_8);
    __pyx_t_20 = 0;
    __pyx_t_21 = NULL;
  } else {
    __pyx_t_20 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_21 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1244, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (;;) {
    if (likely(!__pyx_t_21)) {
      if (likely(PyList_CheckExact(__pyx_t_8))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1244, __pyx_L1_error)
          #endif
          if (__pyx_t_20 >= __pyx_temp) break;
        }
        __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_20, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_20;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1244, __pyx_L1_error)
          #endif
          if (__pyx_t_20 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_20));
        #else
        __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_20);
        #endif
        ++__pyx_t_20;
      }
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1244, __pyx_L1_error)
    } else {
      __pyx_t_10 = __pyx_t_21(__pyx_t_8);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1244, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;

    /* "memray/_memray.pyx":1247
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
 *             alloc = AllocationRecord(elem)             # <<<<<<<<<<<<<<
 *             (<AllocationRecord> alloc)._reader = reader_sp
 *             yield alloc
*/
    __pyx_t_5 = NULL;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_elem};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_10);
    }
    __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alloc, ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_t_10));
    __Pyx_GIVEREF((PyObject *)__pyx_t_10);
    __pyx_t_10 = 0;

    /* "memray/_memray.pyx":1248
 *         ):
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = reader_sp             # <<<<<<<<<<<<<<
 *             yield alloc
 * 
*/
    __pyx_cur_scope->__pyx_v_alloc->_reader = __pyx_cur_scope->__pyx_v_reader_sp;

    /* "memray/_memray.pyx":1249
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = reader_sp
 *             yield alloc             # <<<<<<<<<<<<<<
 * 
 *         reader.close()
*/
    __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XGIVEREF(__pyx_t_8);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_8;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_20;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_21;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L23_resume_from_yield:;
    __pyx_t_8 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_8);
    __pyx_t_20 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_21 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1249, __pyx_L1_error)

    /* "memray/_memray.pyx":1244
 *                     break
 * 
 *         for elem in Py_ListFromSnapshotAllocationRecords(             # <<<<<<<<<<<<<<
 *             aggregator.getSnapshotAllocations(merge_threads)
 *         ):
*/
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "memray/_memray.pyx":1251
 *             yield alloc
 * 
 *         reader.close()             # <<<<<<<<<<<<<<
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):
*/
  __pyx_cur_scope->__pyx_v_reader->close();
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1207
 *         reader.close()
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,             # <<<<<<<<<<<<<<
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("_aggregate_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1253
 *         reader.close()
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records, "FileReader.get_high_watermark_allocation_records(self, merge_threads=True)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records = {"get_high_watermark_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_merge_threads = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_high_watermark_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1253, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1253, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_high_watermark_allocation_records", 0) < (0)) __PYX_ERR(0, 1253, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1253, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_merge_threads = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_high_watermark_allocation_records", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1253, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_high_watermark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_merge_threads);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_high_watermark_allocation_records", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1253, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_merge_threads);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_merge_threads);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_18generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_high_watermark_allocation_re, __pyx_mstate_global->__pyx_n_u_FileReader_get_high_watermark_al, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_high_watermark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  __Pyx_PySendResult __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_high_watermark_allocation_records", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_yield_from;
    case 2: goto __pyx_L6_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1253, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1254
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1254, __pyx_L1_error)

  /* "memray/_memray.pyx":1255
 *     def get_high_watermark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "memray/_memray.pyx":1256
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(             # <<<<<<<<<<<<<<
 *                 self._header["stats"]["n_allocations"],
 *                 merge_threads,
*/
    __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);

    /* "memray/_memray.pyx":1257
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],             # <<<<<<<<<<<<<<
 *                 merge_threads,
 *                 leaks=False,
*/
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1259
 *                 self._header["stats"]["n_allocations"],
 *                 merge_threads,
 *                 leaks=False,             # <<<<<<<<<<<<<<
 *             )
 *             return
*/
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_5, __pyx_cur_scope->__pyx_v_merge_threads};
      __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_leaks, Py_False, __pyx_t_1, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1256, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_reaggregate_allocations, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_7 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_3, &__pyx_r);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_7 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_yield_from:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1256, __pyx_L1_error)
    } else if (likely(__pyx_t_7 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(0, 1256, __pyx_L1_error)
    }

    /* "memray/_memray.pyx":1261
 *                 leaks=False,
 *             )
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # If allocation 0 caused the peak, we need to process 1 record, etc
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1255
 *     def get_high_watermark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],
*/
  }

  /* "memray/_memray.pyx":1264
 * 
 *         # If allocation 0 caused the peak, we need to process 1 record, etc
 *         cdef size_t max_records = self._high_watermark.index + 1             # <<<<<<<<<<<<<<
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
*/
  __pyx_cur_scope->__pyx_v_max_records = (__pyx_cur_scope->__pyx_v_self->_high_watermark.index + 1);

  /* "memray/_memray.pyx":1265
 *         # If allocation 0 caused the peak, we need to process 1 record, etc
 *         cdef size_t max_records = self._high_watermark.index + 1
 *         yield from self._aggregate_allocations(max_records, merge_threads)             # <<<<<<<<<<<<<<
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):
*/
  __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_max_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_5, __pyx_cur_scope->__pyx_v_merge_threads};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_aggregate_allocations, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_7 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_3, &__pyx_r);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_7 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 2;
    return __pyx_r;
    __pyx_L6_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1265, __pyx_L1_error)
  } else if (likely(__pyx_t_7 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1265, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1253
 *         reader.close()
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_high_watermark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_21generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1267
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_20get_leaked_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_19get_leaked_allocation_records, "FileReader.get_leaked_allocation_records(self, merge_threads=True)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_20get_leaked_allocation_records = {"get_leaked_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_20get_leaked_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_19get_leaked_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_20get_leaked_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_merge_threads = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_leaked_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1267, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1267, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_leaked_allocation_records", 0) < (0)) __PYX_ERR(0, 1267, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1267, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_merge_threads = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_leaked_allocation_records", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1267, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_leaked_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_19get_leaked_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_merge_threads);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_19get_leaked_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_leaked_allocation_records", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1267, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_merge_threads);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_merge_threads);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_21generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_leaked_allocation_records, __pyx_mstate_global->__pyx_n_u_FileReader_get_leaked_allocation, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_leaked_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_21generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  __Pyx_PySendResult __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_leaked_allocation_records", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_yield_from;
    case 2: goto __pyx_L6_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1267, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1268
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1268, __pyx_L1_error)

  /* "memray/_memray.pyx":1269
 *     def get_leaked_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "memray/_memray.pyx":1270
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(             # <<<<<<<<<<<<<<
 *                 self._header["stats"]["n_allocations"],
 *                 merge_threads,
*/
    __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);

    /* "memray/_memray.pyx":1271
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],             # <<<<<<<<<<<<<<
 *                 merge_threads,
 *                 leaks=True,
*/
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1273
 *                 self._header["stats"]["n_allocations"],
 *                 merge_threads,
 *                 leaks=True,             # <<<<<<<<<<<<<<
 *             )
 *             return
*/
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_5, __pyx_cur_scope->__pyx_v_merge_threads};
      __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_leaks, Py_True, __pyx_t_1, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_reaggregate_allocations, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_7 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_3, &__pyx_r);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_7 == PYGEN_NEXT)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_yield_from:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1270, __pyx_L1_error)
    } else if (likely(__pyx_t_7 == PYGEN_RETURN)) {
      __Pyx_GOTREF(__pyx_r);
      __Pyx_DECREF(__pyx_r); __pyx_r = 0;
    } else {
      __Pyx_XGOTREF(__pyx_r);
      __PYX_ERR(0, 1270, __pyx_L1_error)
    }

    /* "memray/_memray.pyx":1275
 *                 leaks=True,
 *             )
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1269
 *     def get_leaked_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             yield from self._reaggregate_allocations(
 *                 self._header["stats"]["n_allocations"],
*/
  }

  /* "memray/_memray.pyx":1277
 *             return
 * 
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]             # <<<<<<<<<<<<<<
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyLong_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_cur_scope->__pyx_v_max_records = __pyx_t_6;

  /* "memray/_memray.pyx":1278
 * 
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]
 *         yield from self._aggregate_allocations(max_records, merge_threads)             # <<<<<<<<<<<<<<
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):
*/
  __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_max_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_cur_scope->__pyx_v_merge_threads};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_aggregate_allocations, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_1, &__pyx_r);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(__pyx_t_7 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 2;
    return __pyx_r;
    __pyx_L6_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1278, __pyx_L1_error)
  } else if (likely(__pyx_t_7 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1278, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1267
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_leaked_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_24generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1280
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_23get_temporary_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_22get_temporary_allocation_records, "FileReader.get_temporary_allocation_records(self, merge_threads=True, threshold=1)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_23get_temporary_allocation_records = {"get_temporary_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_23get_temporary_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_22get_temporary_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_23get_temporary_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_merge_threads = 0;
  PyObject *__pyx_v_threshold = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporary_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,&__pyx_mstate_global->__pyx_n_u_threshold,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1280, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_temporary_allocation_records", 0) < (0)) __PYX_ERR(0, 1280, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
    }
    __pyx_v_merge_threads = values[0];
    __pyx_v_threshold = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_temporary_allocation_records", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 1280, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporary_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_22get_temporary_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_merge_threads, __pyx_v_threshold);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_22get_temporary_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads, PyObject *__pyx_v_threshold) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_temporary_allocation_records", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1280, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_merge_threads);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_merge_threads);
  __pyx_cur_scope->__pyx_v_threshold = __pyx_v_threshold;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_threshold);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_threshold);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_24generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_temporary_allocation_records, __pyx_mstate_global->__pyx_n_u_FileReader_get_temporary_allocat, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporary_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_24generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_PySendResult __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporary_allocation_records", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1280, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1281
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1281, __pyx_L1_error)

  /* "memray/_memray.pyx":1282
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't find temporary allocations using a pre-aggregated capture file."
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1283
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 "Can't find temporary allocations using a pre-aggregated capture file."
 *             )
*/
    __pyx_t_2 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Can_t_find_temporary_allocations};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1283, __pyx_L1_error)

    /* "memray/_memray.pyx":1282
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't find temporary allocations using a pre-aggregated capture file."
*/
  }

  /* "memray/_memray.pyx":1287
 *             )
 * 
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]             # <<<<<<<<<<<<<<
 *         yield from self._aggregate_allocations(
 *             max_records,
*/
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_cur_scope->__pyx_v_max_records = __pyx_t_5;

  /* "memray/_memray.pyx":1288
 * 
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]
 *         yield from self._aggregate_allocations(             # <<<<<<<<<<<<<<
 *             max_records,
 *             merge_threads,
*/
  __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);

  /* "memray/_memray.pyx":1289
 *         cdef size_t max_records = self._header["stats"]["n_allocations"]
 *         yield from self._aggregate_allocations(
 *             max_records,             # <<<<<<<<<<<<<<
 *             merge_threads,
 *             temporary_buffer_size=threshold + 1,
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_max_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "memray/_memray.pyx":1291
 *             max_records,
 *             merge_threads,
 *             temporary_buffer_size=threshold + 1,             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_threshold, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_1, __pyx_cur_scope->__pyx_v_merge_threads};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_temporary_buffer_size, __pyx_t_6, __pyx_t_7, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_aggregate_allocations, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_8 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_2, &__pyx_r);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_8 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L5_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1288, __pyx_L1_error)
  } else if (likely(__pyx_t_8 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1288, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1280
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_temporary_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_27generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1294
 *         )
 * 
 *     def get_temporal_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_26get_temporal_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_25get_temporal_allocation_records, "FileReader.get_temporal_allocation_records(self, merge_threads=True)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_26get_temporal_allocation_records = {"get_temporal_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_26get_temporal_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_25get_temporal_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_26get_temporal_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_merge_threads = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporal_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1294, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1294, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_temporal_allocation_records", 0) < (0)) __PYX_ERR(0, 1294, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1294, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_merge_threads = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_temporal_allocation_records", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1294, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_25get_temporal_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_merge_threads);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_25get_temporal_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_temporal_allocation_records", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1294, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_merge_threads);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_merge_threads);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_27generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_temporal_allocation_records, __pyx_mstate_global->__pyx_n_u_FileReader_get_temporal_allocati, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1294, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_27generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  memray::io::FileSource *__pyx_t_6;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  enum memray::api::RecordReader::RecordResult __pyx_t_15;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  std::vector<memray::api::AllocationLifetime>  __pyx_t_18;
  __Pyx_PySendResult __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporal_allocation_records", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L25_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1294, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1295
 * 
 *     def get_temporal_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1295, __pyx_L1_error)

  /* "memray/_memray.pyx":1296
 *     def get_temporal_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get allocation history using a pre-aggregated capture file."
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1297
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 "Can't get allocation history using a pre-aggregated capture file."
 *             )
*/
    __pyx_t_2 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Can_t_get_allocation_history_usi};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1297, __pyx_L1_error)

    /* "memray/_memray.pyx":1296
 *     def get_temporal_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get allocation history using a pre-aggregated capture file."
*/
  }

  /* "memray/_memray.pyx":1302
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path))             # <<<<<<<<<<<<<<
 *         )
 *         cdef RecordReader* reader = reader_sp.get()
*/
  try {
    __pyx_t_6 = new memray::io::FileSource(__pyx_cur_scope->__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1302, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1301
 *             )
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
*/
  try {
    __pyx_t_7 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_6));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1301, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7);

  /* "memray/_memray.pyx":1304
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]
*/
  __pyx_cur_scope->__pyx_v_reader = __pyx_cur_scope->__pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1306
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]             # <<<<<<<<<<<<<<
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
*/
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_cur_scope->__pyx_v_records_to_process = __pyx_t_5;

  /* "memray/_memray.pyx":1307
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *             "Processing allocation records",
 *             total=records_to_process,
*/
  __pyx_t_3 = NULL;

  /* "memray/_memray.pyx":1309
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
 *             total=records_to_process,             # <<<<<<<<<<<<<<
 *             report_progress=self._report_progress
 *         )
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_records_to_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "memray/_memray.pyx":1310
 *             "Processing allocation records",
 *             total=records_to_process,
 *             report_progress=self._report_progress             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_self->_report_progress); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Processing_allocation_records};
    __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1307, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_t_8, __pyx_t_9, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1307, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_2);
  __pyx_cur_scope->__pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1315
 *         cdef AllocationLifetimeAggregator aggregator
 *         cdef _Allocation allocation
 *         cdef size_t memory_records_seen = 0             # <<<<<<<<<<<<<<
 * 
 *         with progress_indicator:
*/
  __pyx_cur_scope->__pyx_v_memory_records_seen = 0;

  /* "memray/_memray.pyx":1317
 *         cdef size_t memory_records_seen = 0
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_10 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = NULL;
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_cur_scope->__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1317, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_9);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        /*try:*/ {

          /* "memray/_memray.pyx":1318
 * 
 *         with progress_indicator:
 *             while records_to_process > 0:             # <<<<<<<<<<<<<<
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
*/
          while (1) {
            __pyx_t_4 = (__pyx_cur_scope->__pyx_v_records_to_process > 0);
            if (!__pyx_t_4) break;

            /* "memray/_memray.pyx":1319
 *         with progress_indicator:
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
*/
            __pyx_t_14 = PyErr_CheckSignals(); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1319, __pyx_L9_error)

            /* "memray/_memray.pyx":1320
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
*/
            try {
              __pyx_t_15 = __pyx_cur_scope->__pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1320, __pyx_L9_error)
            }
            __pyx_cur_scope->__pyx_v_ret = __pyx_t_15;

            /* "memray/_memray.pyx":1321
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
*/
            switch (__pyx_cur_scope->__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1322
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()             # <<<<<<<<<<<<<<
 *                     if merge_threads:
 *                         allocation.tid = NO_THREAD_INFO
*/
              __pyx_cur_scope->__pyx_v_allocation = __pyx_cur_scope->__pyx_v_reader->getLatestAllocation();

              /* "memray/_memray.pyx":1323
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:             # <<<<<<<<<<<<<<
 *                         allocation.tid = NO_THREAD_INFO
 *                     aggregator.addAllocation(allocation)
*/
              __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_merge_threads); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1323, __pyx_L9_error)
              if (__pyx_t_4) {

                /* "memray/_memray.pyx":1324
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
 *                         allocation.tid = NO_THREAD_INFO             # <<<<<<<<<<<<<<
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1
*/
                __pyx_cur_scope->__pyx_v_allocation.tid = memray::api::NO_THREAD_INFO;

                /* "memray/_memray.pyx":1323
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:             # <<<<<<<<<<<<<<
 *                         allocation.tid = NO_THREAD_INFO
 *                     aggregator.addAllocation(allocation)
*/
              }

              /* "memray/_memray.pyx":1325
 *                     if merge_threads:
 *                         allocation.tid = NO_THREAD_INFO
 *                     aggregator.addAllocation(allocation)             # <<<<<<<<<<<<<<
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
*/
              try {
                __pyx_cur_scope->__pyx_v_aggregator.addAllocation(__pyx_cur_scope->__pyx_v_allocation);
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1325, __pyx_L9_error)
              }

              /* "memray/_memray.pyx":1326
 *                         allocation.tid = NO_THREAD_INFO
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1             # <<<<<<<<<<<<<<
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
*/
              __pyx_cur_scope->__pyx_v_records_to_process = (__pyx_cur_scope->__pyx_v_records_to_process - 1);

              /* "memray/_memray.pyx":1327
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
*/
              __pyx_t_2 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_cur_scope->__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_cur_scope->__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "memray/_memray.pyx":1321
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

              /* "memray/_memray.pyx":1329
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1             # <<<<<<<<<<<<<<
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue
*/
              __pyx_cur_scope->__pyx_v_memory_records_seen = (__pyx_cur_scope->__pyx_v_memory_records_seen + 1);

              /* "memray/_memray.pyx":1330
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:             # <<<<<<<<<<<<<<
 *                         continue
 *                     aggregator.captureSnapshot()
*/
              __pyx_t_16 = (__pyx_cur_scope->__pyx_v_self->_memory_snapshot_stride != 0);
              if (__pyx_t_16) {
              } else {
                __pyx_t_4 = __pyx_t_16;
                goto __pyx_L19_bool_binop_done;
              }
              __pyx_t_16 = (((__pyx_cur_scope->__pyx_v_memory_records_seen - 1) % __pyx_cur_scope->__pyx_v_self->_memory_snapshot_stride) != 0);
              __pyx_t_4 = __pyx_t_16;
              __pyx_L19_bool_binop_done:;
              if (__pyx_t_4) {

                /* "memray/_memray.pyx":1331
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue             # <<<<<<<<<<<<<<
 *                     aggregator.captureSnapshot()
 *                 else:
*/
                goto __pyx_L15_continue;

                /* "memray/_memray.pyx":1330
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:             # <<<<<<<<<<<<<<
 *                         continue
 *                     aggregator.captureSnapshot()
*/
              }

              /* "memray/_memray.pyx":1332
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue
 *                     aggregator.captureSnapshot()             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
*/
              __pyx_cur_scope->__pyx_v_aggregator.captureSnapshot();

              /* "memray/_memray.pyx":1328
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
*/
              break;
              default:

              /* "memray/_memray.pyx":1334
 *                     aggregator.captureSnapshot()
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot             # <<<<<<<<<<<<<<
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_4 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT);
                if (unlikely(!__pyx_t_4)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1334, __pyx_L9_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1334, __pyx_L9_error)
              #endif

              /* "memray/_memray.pyx":1335
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord             # <<<<<<<<<<<<<<
 *                     break
 * 
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_4 = (__pyx_cur_scope->__pyx_v_ret != memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD);
                if (unlikely(!__pyx_t_4)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1335, __pyx_L9_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1335, __pyx_L9_error)
              #endif

              /* "memray/_memray.pyx":1336
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
              goto __pyx_L16_break;
              break;
            }
            __pyx_L15_continue:;
          }
          __pyx_L16_break:;

          /* "memray/_memray.pyx":1317
 *         cdef size_t memory_records_seen = 0
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L14_try_end;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 1317, __pyx_L11_except_error)
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_1 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1317, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (__pyx_t_4 < (0)) __PYX_ERR(0, 1317, __pyx_L11_except_error)
          __pyx_t_16 = (!__pyx_t_4);
          if (unlikely(__pyx_t_16)) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_8, __pyx_t_9);
            __pyx_t_2 = 0;  __pyx_t_8 = 0;  __pyx_t_9 = 0; 
            __PYX_ERR(0, 1317, __pyx_L11_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L10_exception_handled;
        }
        __pyx_L11_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        goto __pyx_L1_error;
        __pyx_L10_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_10) {
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    goto __pyx_L24;
    __pyx_L5_error:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L1_error;
    __pyx_L24:;
  }

  /* "memray/_memray.pyx":1338
 *                     break
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()             # <<<<<<<<<<<<<<
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)
 *         yield from gen
*/
  __pyx_t_8 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_9);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_9);
  __pyx_cur_scope->__pyx_v_gen = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "memray/_memray.pyx":1339
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)             # <<<<<<<<<<<<<<
 *         yield from gen
 * 
*/
  try {
    __pyx_t_18 = __pyx_cur_scope->__pyx_v_aggregator.generateIndex();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1339, __pyx_L1_error)
  }
  __pyx_t_9 = ((struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *)__pyx_cur_scope->__pyx_v_gen->__pyx_vtab)->setup(__pyx_cur_scope->__pyx_v_gen, cython_std::move<std::vector<memray::api::AllocationLifetime> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_18)), __pyx_cur_scope->__pyx_v_reader_sp); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "memray/_memray.pyx":1340
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)
 *         yield from gen             # <<<<<<<<<<<<<<
 * 
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):
*/
  __pyx_t_19 = __Pyx_Generator_Yield_From(__pyx_generator, ((PyObject *)__pyx_cur_scope->__pyx_v_gen), &__pyx_r);
  if (likely(__pyx_t_19 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L25_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1340, __pyx_L1_error)
  } else if (likely(__pyx_t_19 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1340, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1294
 *         )
 * 
 *     def get_temporal_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_temporal_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1342
 *         yield from gen
 * 
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records, "FileReader.get_temporal_high_water_mark_allocation_records(self, merge_threads=True)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records = {"get_temporal_high_water_mark_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_merge_threads = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporal_high_water_mark_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1342, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1342, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_temporal_high_water_mark_allocation_records", 0) < (0)) __PYX_ERR(0, 1342, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1342, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_merge_threads = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_temporal_high_water_mark_allocation_records", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1342, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_high_water_mark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_merge_threads);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_merge_threads) {
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  memray::api::RecordReader *__pyx_v_reader;
  size_t __pyx_v_records_to_process;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator = 0;
  memray::api::HighWaterMarkAggregator __pyx_v_aggregator;
  memray::tracking_api::Allocation __pyx_v_allocation;
  size_t __pyx_v_memory_records_seen;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *__pyx_v_gen = 0;
  std::vector<size_t>  __pyx_v_hwm_by_snapshot;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  memray::io::FileSource *__pyx_t_6;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  enum memray::api::RecordReader::RecordResult __pyx_t_15;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  std::vector<memray::api::AllocationLifetime>  __pyx_t_18;
  std::vector<size_t>  __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_temporal_high_water_mark_allocation_records", 0);

  /* "memray/_memray.pyx":1343
 * 
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L1_error)

  /* "memray/_memray.pyx":1344
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get allocation history using a pre-aggregated capture file."
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1345
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 "Can't get allocation history using a pre-aggregated capture file."
 *             )
*/
    __pyx_t_2 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Can_t_get_allocation_history_usi};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1345, __pyx_L1_error)

    /* "memray/_memray.pyx":1344
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get allocation history using a pre-aggregated capture file."
*/
  }

  /* "memray/_memray.pyx":1350
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path))             # <<<<<<<<<<<<<<
 *         )
 *         cdef RecordReader* reader = reader_sp.get()
*/
  try {
    __pyx_t_6 = new memray::io::FileSource(__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1350, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1349
 *             )
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
*/
  try {
    __pyx_t_7 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_6));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1349, __pyx_L1_error)
  }
  __pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7);

  /* "memray/_memray.pyx":1352
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]
*/
  __pyx_v_reader = __pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1354
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]             # <<<<<<<<<<<<<<
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
*/
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_records_to_process = __pyx_t_5;

  /* "memray/_memray.pyx":1355
 * 
 *         cdef size_t records_to_process = self._header["stats"]["n_allocations"]
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *             "Processing allocation records",
 *             total=records_to_process,
*/
  __pyx_t_3 = NULL;

  /* "memray/_memray.pyx":1357
 *         cdef ProgressIndicator progress_indicator = ProgressIndicator(
 *             "Processing allocation records",
 *             total=records_to_process,             # <<<<<<<<<<<<<<
 *             report_progress=self._report_progress
 *         )
*/
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_records_to_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "memray/_memray.pyx":1358
 *             "Processing allocation records",
 *             total=records_to_process,
 *             report_progress=self._report_progress             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_self->_report_progress); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Processing_allocation_records};
    __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1355, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_t_8, __pyx_t_9, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1363
 *         cdef HighWaterMarkAggregator aggregator
 *         cdef _Allocation allocation
 *         cdef size_t memory_records_seen = 0             # <<<<<<<<<<<<<<
 * 
 *         with progress_indicator:
*/
  __pyx_v_memory_records_seen = 0;

  /* "memray/_memray.pyx":1365
 *         cdef size_t memory_records_seen = 0
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_10 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = NULL;
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1365, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_9);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        /*try:*/ {

          /* "memray/_memray.pyx":1366
 * 
 *         with progress_indicator:
 *             while records_to_process > 0:             # <<<<<<<<<<<<<<
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
*/
          while (1) {
            __pyx_t_4 = (__pyx_v_records_to_process > 0);
            if (!__pyx_t_4) break;

            /* "memray/_memray.pyx":1367
 *         with progress_indicator:
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
*/
            __pyx_t_14 = PyErr_CheckSignals(); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1367, __pyx_L8_error)

            /* "memray/_memray.pyx":1368
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
*/
            try {
              __pyx_t_15 = __pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1368, __pyx_L8_error)
            }
            __pyx_v_ret = __pyx_t_15;

            /* "memray/_memray.pyx":1369
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
*/
            switch (__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1370
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()             # <<<<<<<<<<<<<<
 *                     if merge_threads:
 *                         allocation.tid = 0
*/
              __pyx_v_allocation = __pyx_v_reader->getLatestAllocation();

              /* "memray/_memray.pyx":1371
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:             # <<<<<<<<<<<<<<
 *                         allocation.tid = 0
 *                     aggregator.addAllocation(allocation)
*/
              __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_merge_threads); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1371, __pyx_L8_error)
              if (__pyx_t_4) {

                /* "memray/_memray.pyx":1372
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
 *                         allocation.tid = 0             # <<<<<<<<<<<<<<
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1
*/
                __pyx_v_allocation.tid = 0;

                /* "memray/_memray.pyx":1371
 *                 if ret == RecordResult.RecordResultAllocationRecord:
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:             # <<<<<<<<<<<<<<
 *                         allocation.tid = 0
 *                     aggregator.addAllocation(allocation)
*/
              }

              /* "memray/_memray.pyx":1373
 *                     if merge_threads:
 *                         allocation.tid = 0
 *                     aggregator.addAllocation(allocation)             # <<<<<<<<<<<<<<
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
*/
              try {
                __pyx_v_aggregator.addAllocation(__pyx_v_allocation);
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1373, __pyx_L8_error)
              }

              /* "memray/_memray.pyx":1374
 *                         allocation.tid = 0
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1             # <<<<<<<<<<<<<<
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
*/
              __pyx_v_records_to_process = (__pyx_v_records_to_process - 1);

              /* "memray/_memray.pyx":1375
 *                     aggregator.addAllocation(allocation)
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
*/
              __pyx_t_2 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

              /* "memray/_memray.pyx":1369
 *                 PyErr_CheckSignals()
 *                 ret = reader.nextRecord()
 *                 if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                     allocation = reader.getLatestAllocation()
 *                     if merge_threads:
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

              /* "memray/_memray.pyx":1377
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1             # <<<<<<<<<<<<<<
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue
*/
              __pyx_v_memory_records_seen = (__pyx_v_memory_records_seen + 1);

              /* "memray/_memray.pyx":1378
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:             # <<<<<<<<<<<<<<
 *                         continue
 *                     aggregator.captureSnapshot()
*/
              __pyx_t_16 = (__pyx_v_self->_memory_snapshot_stride != 0);
              if (__pyx_t_16) {
              } else {
                __pyx_t_4 = __pyx_t_16;
                goto __pyx_L18_bool_binop_done;
              }
              __pyx_t_16 = (((__pyx_v_memory_records_seen - 1) % __pyx_v_self->_memory_snapshot_stride) != 0);
              __pyx_t_4 = __pyx_t_16;
              __pyx_L18_bool_binop_done:;
              if (__pyx_t_4) {

                /* "memray/_memray.pyx":1379
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue             # <<<<<<<<<<<<<<
 *                     aggregator.captureSnapshot()
 *                 else:
*/
                goto __pyx_L14_continue;

                /* "memray/_memray.pyx":1378
 *                 elif ret == RecordResult.RecordResultMemoryRecord:
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:             # <<<<<<<<<<<<<<
 *                         continue
 *                     aggregator.captureSnapshot()
*/
              }

              /* "memray/_memray.pyx":1380
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
 *                         continue
 *                     aggregator.captureSnapshot()             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
*/
              try {
                __pyx_v_aggregator.captureSnapshot();
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1380, __pyx_L8_error)
              }

              /* "memray/_memray.pyx":1376
 *                     records_to_process -= 1
 *                     progress_indicator.update(1)
 *                 elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                     memory_records_seen += 1
 *                     if self._memory_snapshot_stride and (memory_records_seen - 1) % self._memory_snapshot_stride != 0:
*/
              break;
              default:

              /* "memray/_memray.pyx":1382
 *                     aggregator.captureSnapshot()
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot             # <<<<<<<<<<<<<<
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_4 = (__pyx_v_ret != memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT);
                if (unlikely(!__pyx_t_4)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1382, __pyx_L8_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1382, __pyx_L8_error)
              #endif

              /* "memray/_memray.pyx":1383
 *                 else:
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord             # <<<<<<<<<<<<<<
 *                     break
 * 
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_4 = (__pyx_v_ret != memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD);
                if (unlikely(!__pyx_t_4)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1383, __pyx_L8_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1383, __pyx_L8_error)
              #endif

              /* "memray/_memray.pyx":1384
 *                     assert ret != RecordResult.RecordResultMemorySnapshot
 *                     assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
              goto __pyx_L15_break;
              break;
            }
            __pyx_L14_continue:;
          }
          __pyx_L15_break:;

          /* "memray/_memray.pyx":1365
 *         cdef size_t memory_records_seen = 0
 * 
 *         with progress_indicator:             # <<<<<<<<<<<<<<
 *             while records_to_process > 0:
 *                 PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_high_water_mark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 1365, __pyx_L10_except_error)
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_1 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1365, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1365, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (__pyx_t_4 < (0)) __PYX_ERR(0, 1365, __pyx_L10_except_error)
          __pyx_t_16 = (!__pyx_t_4);
          if (unlikely(__pyx_t_16)) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_8, __pyx_t_9);
            __pyx_t_2 = 0;  __pyx_t_8 = 0;  __pyx_t_9 = 0; 
            __PYX_ERR(0, 1365, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_10) {
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1365, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L23;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L1_error;
    __pyx_L23:;
  }

  /* "memray/_memray.pyx":1386
 *                     break
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()             # <<<<<<<<<<<<<<
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)
 *         hwm_by_snapshot = aggregator.highWaterMarkBytesBySnapshot()
*/
  __pyx_t_8 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1386, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_9);
  }
  __pyx_v_gen = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "memray/_memray.pyx":1387
 * 
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)             # <<<<<<<<<<<<<<
 *         hwm_by_snapshot = aggregator.highWaterMarkBytesBySnapshot()
 *         return gen, hwm_by_snapshot
*/
  try {
    __pyx_t_18 = __pyx_v_aggregator.generateIndex();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1387, __pyx_L1_error)
  }
  __pyx_t_9 = ((struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *)__pyx_v_gen->__pyx_vtab)->setup(__pyx_v_gen, cython_std::move<std::vector<memray::api::AllocationLifetime> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_18)), __pyx_v_reader_sp); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "memray/_memray.pyx":1388
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)
 *         hwm_by_snapshot = aggregator.highWaterMarkBytesBySnapshot()             # <<<<<<<<<<<<<<
 *         return gen, hwm_by_snapshot
 * 
*/
  try {
    __pyx_t_19 = __pyx_v_aggregator.highWaterMarkBytesBySnapshot();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1388, __pyx_L1_error)
  }
  __pyx_v_hwm_by_snapshot = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_19);

  /* "memray/_memray.pyx":1389
 *         gen.setup(move(aggregator.generateIndex()), reader_sp)
 *         hwm_by_snapshot = aggregator.highWaterMarkBytesBySnapshot()
 *         return gen, hwm_by_snapshot             # <<<<<<<<<<<<<<
 * 
 *     def get_allocation_records(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __pyx_convert_vector_to_py_size_t(__pyx_v_hwm_by_snapshot); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF((PyObject *)__pyx_v_gen);
  __Pyx_GIVEREF((PyObject *)__pyx_v_gen);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_gen)) != (0)) __PYX_ERR(0, 1389, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 1389, __pyx_L1_error);
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1342
 *         yield from gen
 * 
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("memray._memray.FileReader.get_temporal_high_water_mark_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_progress_indicator);
  __Pyx_XDECREF((PyObject *)__pyx_v_gen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_32generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1391
 *         return gen, hwm_by_snapshot
 * 
 *     def get_allocation_records(self):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_31get_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_30get_allocation_records, "FileReader.get_allocation_records(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_31get_allocation_records = {"get_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_31get_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_30get_allocation_records};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_31get_allocation_records(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_allocation_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_allocation_records", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_allocation_records", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_30get_allocation_records(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_30get_allocation_records(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_allocation_records", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_7_get_allocation_records(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1391, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_32generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_allocation_records, __pyx_mstate_global->__pyx_n_u_FileReader_get_allocation_record, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1391, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_32generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  memray::io::FileSource *__pyx_t_6;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_7;
  int __pyx_t_8;
  enum memray::api::RecordReader::RecordResult __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_allocation_records", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1391, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1392
 * 
 *     def get_allocation_records(self):
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error)

  /* "memray/_memray.pyx":1393
 *     def get_allocation_records(self):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get all allocations from a pre-aggregated capture file."
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1393, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1394
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 "Can't get all allocations from a pre-aggregated capture file."
 *             )
*/
    __pyx_t_2 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Can_t_get_all_allocations_from_a};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1394, __pyx_L1_error)

    /* "memray/_memray.pyx":1393
 *     def get_allocation_records(self):
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 "Can't get all allocations from a pre-aggregated capture file."
*/
  }

  /* "memray/_memray.pyx":1399
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path))             # <<<<<<<<<<<<<<
 *         )
 *         cdef RecordReader* reader = reader_sp.get()
*/
  try {
    __pyx_t_6 = new memray::io::FileSource(__pyx_cur_scope->__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1399, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1398
 *             )
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
*/
  try {
    __pyx_t_7 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_6));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1398, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7);

  /* "memray/_memray.pyx":1401
 *             unique_ptr[FileSource](new FileSource(self._path))
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         while True:
*/
  __pyx_cur_scope->__pyx_v_reader = __pyx_cur_scope->__pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1403
 *         cdef RecordReader* reader = reader_sp.get()
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
*/
  while (1) {

    /* "memray/_memray.pyx":1404
 * 
 *         while True:
 *             PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:
*/
    __pyx_t_8 = PyErr_CheckSignals(); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1404, __pyx_L1_error)

    /* "memray/_memray.pyx":1405
 *         while True:
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *             if ret == RecordResult.RecordResultAllocationRecord:
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())
*/
    try {
      __pyx_t_9 = __pyx_cur_scope->__pyx_v_reader->nextRecord();
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1405, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_ret = __pyx_t_9;

    /* "memray/_memray.pyx":1406
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())
 *                 (<AllocationRecord> alloc)._reader = reader_sp
*/
    switch (__pyx_cur_scope->__pyx_v_ret) {
      case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

      /* "memray/_memray.pyx":1407
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())             # <<<<<<<<<<<<<<
 *                 (<AllocationRecord> alloc)._reader = reader_sp
 *                 yield alloc
*/
      __pyx_t_2 = NULL;
      __pyx_t_1 = __pyx_cur_scope->__pyx_v_reader->getLatestAllocation().toPythonObject(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1407, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_3);
      }
      __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alloc, ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_t_3));
      __Pyx_GIVEREF((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "memray/_memray.pyx":1408
 *             if ret == RecordResult.RecordResultAllocationRecord:
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())
 *                 (<AllocationRecord> alloc)._reader = reader_sp             # <<<<<<<<<<<<<<
 *                 yield alloc
 *             elif ret == RecordResult.RecordResultMemoryRecord:
*/
      __pyx_cur_scope->__pyx_v_alloc->_reader = __pyx_cur_scope->__pyx_v_reader_sp;

      /* "memray/_memray.pyx":1409
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())
 *                 (<AllocationRecord> alloc)._reader = reader_sp
 *                 yield alloc             # <<<<<<<<<<<<<<
 *             elif ret == RecordResult.RecordResultMemoryRecord:
 *                 pass
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1409, __pyx_L1_error)

      /* "memray/_memray.pyx":1406
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                 alloc = AllocationRecord(reader.getLatestAllocation().toPythonObject())
 *                 (<AllocationRecord> alloc)._reader = reader_sp
*/
      break;
      case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

      /* "memray/_memray.pyx":1410
 *                 (<AllocationRecord> alloc)._reader = reader_sp
 *                 yield alloc
 *             elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:
*/
      break;
      case memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT:

      /* "memray/_memray.pyx":1412
 *             elif ret == RecordResult.RecordResultMemoryRecord:
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:             # <<<<<<<<<<<<<<
 *                 pass
 *             else:
*/
      break;
      default:

      /* "memray/_memray.pyx":1415
 *                 pass
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         reader.close()
*/
      goto __pyx_L6_break;
      break;
    }
  }
  __pyx_L6_break:;

  /* "memray/_memray.pyx":1417
 *                 break
 * 
 *         reader.close()             # <<<<<<<<<<<<<<
 * 
 *     def get_memory_snapshots(self):
*/
  __pyx_cur_scope->__pyx_v_reader->close();
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1391
 *         return gen, hwm_by_snapshot
 * 
 *     def get_allocation_records(self):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_allocation_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_35generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1419
 *         reader.close()
 * 
 *     def get_memory_snapshots(self):             # <<<<<<<<<<<<<<
 *         for record in self._memory_snapshots:
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_34get_memory_snapshots(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_33get_memory_snapshots, "FileReader.get_memory_snapshots(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_34get_memory_snapshots = {"get_memory_snapshots", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_34get_memory_snapshots, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_33get_memory_snapshots};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_34get_memory_snapshots(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_memory_snapshots (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_memory_snapshots", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_memory_snapshots", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_33get_memory_snapshots(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_33get_memory_snapshots(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memory_snapshots", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1419, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_35generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_memory_snapshots, __pyx_mstate_global->__pyx_n_u_FileReader_get_memory_snapshots, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1419, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_memory_snapshots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_35generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  std::vector<struct memray::tracking_api::MemorySnapshot> ::iterator __pyx_t_1;
  struct memray::tracking_api::MemorySnapshot __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_memory_snapshots", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1419, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1420
 * 
 *     def get_memory_snapshots(self):
 *         for record in self._memory_snapshots:             # <<<<<<<<<<<<<<
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_memory_snapshots.begin();
  for (; __pyx_t_1 != __pyx_cur_scope->__pyx_v_self->_memory_snapshots.end(); ++__pyx_t_1) {
    __pyx_t_2 = *__pyx_t_1;
    __pyx_cur_scope->__pyx_v_record = __pyx_t_2;

    /* "memray/_memray.pyx":1421
 *     def get_memory_snapshots(self):
 *         for record in self._memory_snapshots:
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)             # <<<<<<<<<<<<<<
 * 
 *     def get_object_lifetime_events(self, included_objects=None):
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MemorySnapshot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyLong_From_uint64_t(__pyx_cur_scope->__pyx_v_record.ms_since_epoch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_record.rss); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_record.heap); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_t_6, __pyx_t_7, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (4-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_cur_scope->__pyx_t_0);
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1421, __pyx_L1_error)

    /* "memray/_memray.pyx":1420
 * 
 *     def get_memory_snapshots(self):
 *         for record in self._memory_snapshots:             # <<<<<<<<<<<<<<
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
*/
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1419
 *         reader.close()
 * 
 *     def get_memory_snapshots(self):             # <<<<<<<<<<<<<<
 *         for record in self._memory_snapshots:
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_memory_snapshots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_10FileReader_38generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1423
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
 *     def get_object_lifetime_events(self, included_objects=None):             # <<<<<<<<<<<<<<
 *         """Return all object lifetime events recorded in the file.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_37get_object_lifetime_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_36get_object_lifetime_events, "FileReader.get_object_lifetime_events(self, included_objects=None)\n\nReturn all object lifetime events recorded in the file.\n\nThis method yields TrackedObjectRecord instances representing Python objects\nthat were tracked during the recording session.\n\nArgs:\n    included_objects (list, optional): If provided, only yield\n        lifetime events for objects in the list.\n\nReturns:\n    An iterator of TrackedObjectRecord instances.");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_37get_object_lifetime_events = {"get_object_lifetime_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_37get_object_lifetime_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_36get_object_lifetime_events};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_37get_object_lifetime_events(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_included_objects = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_object_lifetime_events (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_included_objects,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1423, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1423, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_object_lifetime_events", 0) < (0)) __PYX_ERR(0, 1423, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1423, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_included_objects = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_object_lifetime_events", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1423, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.get_object_lifetime_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_36get_object_lifetime_events(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v_included_objects);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_36get_object_lifetime_events(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, PyObject *__pyx_v_included_objects) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_object_lifetime_events", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1423, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_included_objects = __pyx_v_included_objects;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_included_objects);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_included_objects);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_10FileReader_38generator8, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_object_lifetime_events, __pyx_mstate_global->__pyx_n_u_FileReader_get_object_lifetime_e, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1423, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.get_object_lifetime_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_10FileReader_38generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  memray::io::FileSource *__pyx_t_9;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  enum memray::api::RecordReader::RecordResult __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_object_lifetime_events", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L14_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1423, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1436
 *             An iterator of TrackedObjectRecord instances.
 *         """
 *         self._ensure_not_closed()             # <<<<<<<<<<<<<<
 * 
 *         object_ids = set()
*/
  ((struct __pyx_vtabstruct_6memray_7_memray_FileReader *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_ensure_not_closed(__pyx_cur_scope->__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1436, __pyx_L1_error)

  /* "memray/_memray.pyx":1438
 *         self._ensure_not_closed()
 * 
 *         object_ids = set()             # <<<<<<<<<<<<<<
 *         if included_objects is not None:
 *             object_ids = {id(obj) for obj in included_objects}
*/
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_object_ids = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1439
 * 
 *         object_ids = set()
 *         if included_objects is not None:             # <<<<<<<<<<<<<<
 *             object_ids = {id(obj) for obj in included_objects}
 * 
*/
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_included_objects != Py_None);
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":1440
 *         object_ids = set()
 *         if included_objects is not None:
 *             object_ids = {id(obj) for obj in included_objects}             # <<<<<<<<<<<<<<
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
*/
    { /* enter inner scope */
      __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_included_objects)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_included_objects)) {
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_included_objects; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_included_objects); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1440, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1440, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_5)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1440, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_4;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1440, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
            #endif
            ++__pyx_t_4;
          }
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1440, __pyx_L1_error)
        } else {
          __pyx_t_6 = __pyx_t_5(__pyx_t_3);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1440, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_7genexpr__pyx_v_obj);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_7genexpr__pyx_v_obj, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_cur_scope->__pyx_7genexpr__pyx_v_obj};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_id, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1440, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1440, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } /* exit inner scope */
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_object_ids);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_object_ids, ((PyObject*)__pyx_t_1));
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1439
 * 
 *         object_ids = set()
 *         if included_objects is not None:             # <<<<<<<<<<<<<<
 *             object_ids = {id(obj) for obj in included_objects}
 * 
*/
  }

  /* "memray/_memray.pyx":1443
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(self._path)),             # <<<<<<<<<<<<<<
 *             True,  # track_stacks
 *             True   # track_object_lifetimes
*/
  try {
    __pyx_t_9 = new memray::io::FileSource(__pyx_cur_scope->__pyx_v_self->_path);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1443, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1442
 *             object_ids = {id(obj) for obj in included_objects}
 * 
 *         cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(self._path)),
 *             True,  # track_stacks
*/
  try {
    __pyx_t_10 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_9), 1, 1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1442, __pyx_L1_error)
  }
  __pyx_cur_scope->__pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_10);

  /* "memray/_memray.pyx":1447
 *             True   # track_object_lifetimes
 *         )
 *         cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *         # Check if the file was generated with object lifetime tracking enabled
*/
  __pyx_cur_scope->__pyx_v_reader = __pyx_cur_scope->__pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1450
 * 
 *         # Check if the file was generated with object lifetime tracking enabled
 *         cdef object header = reader.getHeader()             # <<<<<<<<<<<<<<
 *         if not header["track_object_lifetimes"]:
 *             raise RuntimeError(
*/
  __pyx_t_1 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(__pyx_cur_scope->__pyx_v_reader->getHeader()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_header = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1451
 *         # Check if the file was generated with object lifetime tracking enabled
 *         cdef object header = reader.getHeader()
 *         if not header["track_object_lifetimes"]:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Object lifetime events are not available in this capture file. "
*/
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_header, __pyx_mstate_global->__pyx_n_u_track_object_lifetimes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = (!__pyx_t_2);
  if (unlikely(__pyx_t_11)) {

    /* "memray/_memray.pyx":1452
 *         cdef object header = reader.getHeader()
 *         if not header["track_object_lifetimes"]:
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 "Object lifetime events are not available in this capture file. "
 *                 "The file was not generated with track_object_lifetimes=True."
*/
    __pyx_t_3 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Object_lifetime_events_are_not_a};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1452, __pyx_L1_error)

    /* "memray/_memray.pyx":1451
 *         # Check if the file was generated with object lifetime tracking enabled
 *         cdef object header = reader.getHeader()
 *         if not header["track_object_lifetimes"]:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Object lifetime events are not available in this capture file. "
*/
  }

  /* "memray/_memray.pyx":1458
 * 
 *         cdef TrackedObject tracked_object
 *         while True:             # <<<<<<<<<<<<<<
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
*/
  while (1) {

    /* "memray/_memray.pyx":1459
 *         cdef TrackedObject tracked_object
 *         while True:
 *             PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultObjectRecord:
*/
    __pyx_t_12 = PyErr_CheckSignals(); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1459, __pyx_L1_error)

    /* "memray/_memray.pyx":1460
 *         while True:
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *             if ret == RecordResult.RecordResultObjectRecord:
 *                 tracked_object = reader.getLatestObject()
*/
    try {
      __pyx_t_13 = __pyx_cur_scope->__pyx_v_reader->nextRecord();
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1460, __pyx_L1_error)
    }
    __pyx_cur_scope->__pyx_v_ret = __pyx_t_13;

    /* "memray/_memray.pyx":1461
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultObjectRecord:             # <<<<<<<<<<<<<<
 *                 tracked_object = reader.getLatestObject()
 *                 if included_objects is not None and tracked_object.address not in object_ids:
*/
    switch (__pyx_cur_scope->__pyx_v_ret) {
      case memray::api::RecordReader::RecordResult::OBJECT_RECORD:

      /* "memray/_memray.pyx":1462
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultObjectRecord:
 *                 tracked_object = reader.getLatestObject()             # <<<<<<<<<<<<<<
 *                 if included_objects is not None and tracked_object.address not in object_ids:
 *                     continue
*/
      __pyx_cur_scope->__pyx_v_tracked_object = __pyx_cur_scope->__pyx_v_reader->getLatestObject();

      /* "memray/_memray.pyx":1463
 *             if ret == RecordResult.RecordResultObjectRecord:
 *                 tracked_object = reader.getLatestObject()
 *                 if included_objects is not None and tracked_object.address not in object_ids:             # <<<<<<<<<<<<<<
 *                     continue
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())
*/
      __pyx_t_2 = (__pyx_cur_scope->__pyx_v_included_objects != Py_None);
      if (__pyx_t_2) {
      } else {
        __pyx_t_11 = __pyx_t_2;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_cur_scope->__pyx_v_tracked_object.address); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_cur_scope->__pyx_v_object_ids, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1463, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __pyx_t_2;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_11) {

        /* "memray/_memray.pyx":1464
 *                 tracked_object = reader.getLatestObject()
 *                 if included_objects is not None and tracked_object.address not in object_ids:
 *                     continue             # <<<<<<<<<<<<<<
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())
 *                 object_record._reader = reader_sp
*/
        goto __pyx_L9_continue;

        /* "memray/_memray.pyx":1463
 *             if ret == RecordResult.RecordResultObjectRecord:
 *                 tracked_object = reader.getLatestObject()
 *                 if included_objects is not None and tracked_object.address not in object_ids:             # <<<<<<<<<<<<<<
 *                     continue
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())
*/
      }

      /* "memray/_memray.pyx":1465
 *                 if included_objects is not None and tracked_object.address not in object_ids:
 *                     continue
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())             # <<<<<<<<<<<<<<
 *                 object_record._reader = reader_sp
 *                 yield object_record
*/
      __pyx_t_3 = NULL;
      __pyx_t_6 = __pyx_cur_scope->__pyx_v_tracked_object.toPythonObject(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_1);
      }
      __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_object_record);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_object_record, ((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)__pyx_t_1));
      __Pyx_GIVEREF((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "memray/_memray.pyx":1466
 *                     continue
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())
 *                 object_record._reader = reader_sp             # <<<<<<<<<<<<<<
 *                 yield object_record
 *             elif ret == RecordResult.RecordResultAllocationRecord:
*/
      __pyx_cur_scope->__pyx_v_object_record->_reader = __pyx_cur_scope->__pyx_v_reader_sp;

      /* "memray/_memray.pyx":1467
 *                 object_record = TrackedObjectRecord(tracked_object.toPythonObject())
 *                 object_record._reader = reader_sp
 *                 yield object_record             # <<<<<<<<<<<<<<
 *             elif ret == RecordResult.RecordResultAllocationRecord:
 *                 pass
*/
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_object_record);
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_object_record);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L14_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1467, __pyx_L1_error)

      /* "memray/_memray.pyx":1461
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultObjectRecord:             # <<<<<<<<<<<<<<
 *                 tracked_object = reader.getLatestObject()
 *                 if included_objects is not None and tracked_object.address not in object_ids:
*/
      break;
      case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

      /* "memray/_memray.pyx":1468
 *                 object_record._reader = reader_sp
 *                 yield object_record
 *             elif ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == RecordResult.RecordResultMemoryRecord:
*/
      break;
      case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

      /* "memray/_memray.pyx":1470
 *             elif ret == RecordResult.RecordResultAllocationRecord:
 *                 pass
 *             elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:
*/
      break;
      case memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT:

      /* "memray/_memray.pyx":1472
 *             elif ret == RecordResult.RecordResultMemoryRecord:
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:             # <<<<<<<<<<<<<<
 *                 pass
 *             else:
*/
      break;
      default:

      /* "memray/_memray.pyx":1475
 *                 pass
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         reader.close()
*/
      goto __pyx_L10_break;
      break;
    }
    __pyx_L9_continue:;
  }
  __pyx_L10_break:;

  /* "memray/_memray.pyx":1477
 *                 break
 * 
 *         reader.close()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_cur_scope->__pyx_v_reader->close();
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1423
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
 *     def get_object_lifetime_events(self, included_objects=None):             # <<<<<<<<<<<<<<
 *         """Return all object lifetime events recorded in the file.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_object_lifetime_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1479
 *         reader.close()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def metadata(self):
 *         return _create_metadata(self._header, self._high_watermark.peak_memory)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_8metadata_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_8metadata_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_8metadata___get__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_8metadata___get__(struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1481
 *     @property
 *     def metadata(self):
 *         return _create_metadata(self._header, self._high_watermark.peak_memory)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_header;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_high_watermark.peak_memory); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6memray_7_memray__create_metadata(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1479
 *         reader.close()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def metadata(self):
 *         return _create_metadata(self._header, self._high_watermark.peak_memory)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.FileReader.metadata.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_40__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_39__reduce_cython__, "FileReader.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_40__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_40__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_39__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_40__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_39__reduce_cython__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_39__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_42__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10FileReader_41__setstate_cython__, "FileReader.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_10FileReader_42__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_42__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_41__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_10FileReader_42__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.FileReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10FileReader_41__setstate_cython__(((struct __pyx_obj_6memray_7_memray_FileReader *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10FileReader_41__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_FileReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.FileReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1484
 * 
 * 
 * def compute_statistics(             # <<<<<<<<<<<<<<
 *     file_name,
 *     *,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_11compute_statistics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_10compute_statistics, "compute_statistics(file_name, *, report_progress=False, num_largest=5)");
static PyMethodDef __pyx_mdef_6memray_7_memray_11compute_statistics = {"compute_statistics", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_11compute_statistics, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10compute_statistics};
static PyObject *__pyx_pw_6memray_7_memray_11compute_statistics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file_name = 0;
  PyObject *__pyx_v_report_progress = 0;
  PyObject *__pyx_v_num_largest = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute_statistics (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file_name,&__pyx_mstate_global->__pyx_n_u_report_progress,&__pyx_mstate_global->__pyx_n_u_num_largest,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1484, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "compute_statistics", 0) < (0)) __PYX_ERR(0, 1484, __pyx_L3_error)

      /* "memray/_memray.pyx":1487
 *     file_name,
 *     *,
 *     report_progress=False,             # <<<<<<<<<<<<<<
 *     num_largest=5,
 * ):
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_5)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("compute_statistics", 1, 1, 1, i); __PYX_ERR(0, 1484, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1484, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_5)));
    }
    __pyx_v_file_name = values[0];
    __pyx_v_report_progress = values[1];
    __pyx_v_num_largest = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compute_statistics", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1484, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.compute_statistics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_10compute_statistics(__pyx_self, __pyx_v_file_name, __pyx_v_report_progress, __pyx_v_num_largest);

  /* "memray/_memray.pyx":1484
 * 
 * 
 * def compute_statistics(             # <<<<<<<<<<<<<<
 *     file_name,
 *     *,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_10compute_statistics(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_name, PyObject *__pyx_v_report_progress, PyObject *__pyx_v_num_largest) {
  std::shared_ptr<memray::api::RecordReader>  __pyx_v_reader_sp;
  memray::api::RecordReader *__pyx_v_reader;
  PyObject *__pyx_v_header = 0;
  PyObject *__pyx_v_total = NULL;
  memray::api::AllocationStatsAggregator __pyx_v_aggregator;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *__pyx_v_progress_indicator = 0;
  enum memray::api::RecordReader::RecordResult __pyx_v_ret;
  PyObject *__pyx_v_tmp = 0;
  PyObject *__pyx_v_allocation_count_by_allocator = NULL;
  PyObject *__pyx_v_allocation_count_by_size = 0;
  PyObject *__pyx_v_unknown = NULL;
  PyObject *__pyx_v_top_locations_by_size = NULL;
  PyObject *__pyx_v_top_locations_by_count = NULL;
  uint64_t __pyx_v_peak_memory;
  PyObject *__pyx_8genexpr1__pyx_v_k = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_v = NULL;
  std::pair<uint64_t,std::optional<memray::api::location_id_t>>  __pyx_8genexpr2__pyx_v_size_and_loc;
  std::pair<uint64_t,std::optional<memray::api::location_id_t>>  __pyx_8genexpr3__pyx_v_count_and_loc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  memray::io::FileSource *__pyx_t_2;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  enum memray::api::RecordReader::RecordResult __pyx_t_14;
  std::optional<memray::api::location_id_t> __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  std::vector<std::pair<uint64_t,std::optional<memray::api::location_id_t>> >  __pyx_t_23;
  std::vector<std::pair<uint64_t,std::optional<memray::api::location_id_t>> > ::iterator __pyx_t_24;
  std::vector<std::pair<uint64_t,std::optional<memray::api::location_id_t>> >  __pyx_t_25;
  std::pair<uint64_t,std::optional<memray::api::location_id_t>>  __pyx_t_26;
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  PyObject *__pyx_t_29 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("compute_statistics", 0);

  /* "memray/_memray.pyx":1491
 * ):
 *     cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](
 *         unique_ptr[FileSource](new FileSource(file_name))             # <<<<<<<<<<<<<<
 *     )
 *     cdef RecordReader* reader = reader_sp.get()
*/
  __pyx_t_1 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_file_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1491, __pyx_L1_error)
  try {
    __pyx_t_2 = new memray::io::FileSource(__pyx_t_1);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1491, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1490
 *     num_largest=5,
 * ):
 *     cdef shared_ptr[RecordReader] reader_sp = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *         unique_ptr[FileSource](new FileSource(file_name))
 *     )
*/
  try {
    __pyx_t_3 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_2));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1490, __pyx_L1_error)
  }
  __pyx_v_reader_sp = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);

  /* "memray/_memray.pyx":1493
 *         unique_ptr[FileSource](new FileSource(file_name))
 *     )
 *     cdef RecordReader* reader = reader_sp.get()             # <<<<<<<<<<<<<<
 * 
 *     cdef header = reader.getHeader()
*/
  __pyx_v_reader = __pyx_v_reader_sp.get();

  /* "memray/_memray.pyx":1495
 *     cdef RecordReader* reader = reader_sp.get()
 * 
 *     cdef header = reader.getHeader()             # <<<<<<<<<<<<<<
 *     total = header["stats"]["n_allocations"] or None
 * 
*/
  __pyx_t_4 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(__pyx_v_reader->getHeader()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_header = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1496
 * 
 *     cdef header = reader.getHeader()
 *     total = header["stats"]["n_allocations"] or None             # <<<<<<<<<<<<<<
 * 
 *     if header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_n_allocations); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1496, __pyx_L1_error)
  if (!__pyx_t_7) {
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_4 = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(Py_None);
  __pyx_t_4 = Py_None;
  __pyx_L3_bool_binop_done:;
  __pyx_v_total = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1498
 *     total = header["stats"]["n_allocations"] or None
 * 
 *     if header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError(
 *             "Can't compute statistics using a pre-aggregated capture file."
*/
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_file_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_Enum_6memray_7_memray_enum__dunderpyx_t_6memray_7_memray_FileFormat_to_py(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "memray/_memray.pyx":1499
 * 
 *     if header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
 *         raise NotImplementedError(             # <<<<<<<<<<<<<<
 *             "Can't compute statistics using a pre-aggregated capture file."
 *         )
*/
    __pyx_t_6 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Can_t_compute_statistics_using_a};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1499, __pyx_L1_error)

    /* "memray/_memray.pyx":1498
 *     total = header["stats"]["n_allocations"] or None
 * 
 *     if header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError(
 *             "Can't compute statistics using a pre-aggregated capture file."
*/
  }

  /* "memray/_memray.pyx":1504
 * 
 *     cdef AllocationStatsAggregator aggregator
 *     cdef ProgressIndicator progress_indicator = ProgressIndicator(             # <<<<<<<<<<<<<<
 *         "Computing statistics",
 *         total=total,
*/
  __pyx_t_6 = NULL;

  /* "memray/_memray.pyx":1507
 *         "Computing statistics",
 *         total=total,
 *         report_progress=report_progress,             # <<<<<<<<<<<<<<
 *     )
 *     with progress_indicator:
*/
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Computing_statistics};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total, __pyx_v_total, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1504, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_report_progress, __pyx_v_report_progress, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_5);
  }
  __pyx_v_progress_indicator = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "memray/_memray.pyx":1509
 *         report_progress=report_progress,
 *     )
 *     with progress_indicator:             # <<<<<<<<<<<<<<
 *         while True:
 *             PyErr_CheckSignals()
*/
  /*with:*/ {
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = NULL;
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1509, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1509, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "memray/_memray.pyx":1510
 *     )
 *     with progress_indicator:
 *         while True:             # <<<<<<<<<<<<<<
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
*/
          while (1) {

            /* "memray/_memray.pyx":1511
 *     with progress_indicator:
 *         while True:
 *             PyErr_CheckSignals()             # <<<<<<<<<<<<<<
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:
*/
            __pyx_t_13 = PyErr_CheckSignals(); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1511, __pyx_L10_error)

            /* "memray/_memray.pyx":1512
 *         while True:
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()             # <<<<<<<<<<<<<<
 *             if ret == RecordResult.RecordResultAllocationRecord:
 *                 aggregator.addAllocation(
*/
            try {
              __pyx_t_14 = __pyx_v_reader->nextRecord();
            } catch(...) {
              __Pyx_CppExn2PyErr();
              __PYX_ERR(0, 1512, __pyx_L10_error)
            }
            __pyx_v_ret = __pyx_t_14;

            /* "memray/_memray.pyx":1513
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                 aggregator.addAllocation(
 *                     reader.getLatestAllocation(),
*/
            switch (__pyx_v_ret) {
              case memray::api::RecordReader::RecordResult::ALLOCATION_RECORD:

              /* "memray/_memray.pyx":1516
 *                 aggregator.addAllocation(
 *                     reader.getLatestAllocation(),
 *                     reader.getLatestPythonLocationId(reader.getLatestAllocation()),             # <<<<<<<<<<<<<<
 *                 )
 *                 progress_indicator.update(1)
*/
              try {
                __pyx_t_15 = __pyx_v_reader->getLatestPythonLocationId(__pyx_v_reader->getLatestAllocation());
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1516, __pyx_L10_error)
              }

              /* "memray/_memray.pyx":1514
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:
 *                 aggregator.addAllocation(             # <<<<<<<<<<<<<<
 *                     reader.getLatestAllocation(),
 *                     reader.getLatestPythonLocationId(reader.getLatestAllocation()),
*/
              try {
                __pyx_v_aggregator.addAllocation(__pyx_v_reader->getLatestAllocation(), __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_15));
              } catch(...) {
                __Pyx_CppExn2PyErr();
                __PYX_ERR(0, 1514, __pyx_L10_error)
              }

              /* "memray/_memray.pyx":1518
 *                     reader.getLatestPythonLocationId(reader.getLatestAllocation()),
 *                 )
 *                 progress_indicator.update(1)             # <<<<<<<<<<<<<<
 *             elif ret == RecordResult.RecordResultMemoryRecord:
 *                 pass
*/
              __pyx_t_5 = ((struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator *)__pyx_v_progress_indicator->__pyx_vtab)->update(__pyx_v_progress_indicator, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1518, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "memray/_memray.pyx":1513
 *             PyErr_CheckSignals()
 *             ret = reader.nextRecord()
 *             if ret == RecordResult.RecordResultAllocationRecord:             # <<<<<<<<<<<<<<
 *                 aggregator.addAllocation(
 *                     reader.getLatestAllocation(),
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_RECORD:

              /* "memray/_memray.pyx":1519
 *                 )
 *                 progress_indicator.update(1)
 *             elif ret == RecordResult.RecordResultMemoryRecord:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:
*/
              break;
              case memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT:

              /* "memray/_memray.pyx":1521
 *             elif ret == RecordResult.RecordResultMemoryRecord:
 *                 pass
 *             elif ret == RecordResult.RecordResultMemorySnapshot:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == RecordResult.RecordResultObjectRecord:
*/
              break;
              case memray::api::RecordReader::RecordResult::OBJECT_RECORD:

              /* "memray/_memray.pyx":1523
 *             elif ret == RecordResult.RecordResultMemorySnapshot:
 *                 pass
 *             elif ret == RecordResult.RecordResultObjectRecord:             # <<<<<<<<<<<<<<
 *                 pass
 *             else:
*/
              break;
              default:

              /* "memray/_memray.pyx":1526
 *                 pass
 *             else:
 *                 assert ret != RecordResult.RecordResultMemorySnapshot             # <<<<<<<<<<<<<<
 *                 assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                 break
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_7 = (__pyx_v_ret != memray::api::RecordReader::RecordResult::MEMORY_SNAPSHOT);
                if (unlikely(!__pyx_t_7)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1526, __pyx_L10_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1526, __pyx_L10_error)
              #endif

              /* "memray/_memray.pyx":1527
 *             else:
 *                 assert ret != RecordResult.RecordResultMemorySnapshot
 *                 assert ret != RecordResult.RecordResultAggregatedAllocationRecord             # <<<<<<<<<<<<<<
 *                 break
 * 
*/
              #ifndef CYTHON_WITHOUT_ASSERTIONS
              if (unlikely(__pyx_assertions_enabled())) {
                __pyx_t_7 = (__pyx_v_ret != memray::api::RecordReader::RecordResult::AGGREGATED_ALLOCATION_RECORD);
                if (unlikely(!__pyx_t_7)) {
                  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
                  __PYX_ERR(0, 1527, __pyx_L10_error)
                }
              }
              #else
              if ((1)); else __PYX_ERR(0, 1527, __pyx_L10_error)
              #endif

              /* "memray/_memray.pyx":1528
 *                 assert ret != RecordResult.RecordResultMemorySnapshot
 *                 assert ret != RecordResult.RecordResultAggregatedAllocationRecord
 *                 break             # <<<<<<<<<<<<<<
 * 
 *     # Ignore the n_allocations in the header, use our observed value.
*/
              goto __pyx_L17_break;
              break;
            }
          }
          __pyx_L17_break:;

          /* "memray/_memray.pyx":1509
 *         report_progress=report_progress,
 *     )
 *     with progress_indicator:             # <<<<<<<<<<<<<<
 *         while True:
 *             PyErr_CheckSignals()
*/
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L15_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("memray._memray.compute_statistics", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 1509, __pyx_L12_except_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_16 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1509, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_16, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1509, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (__pyx_t_7 < (0)) __PYX_ERR(0, 1509, __pyx_L12_except_error)
          __pyx_t_18 = (!__pyx_t_7);
          if (unlikely(__pyx_t_18)) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_6, __pyx_t_4);
            __pyx_t_5 = 0;  __pyx_t_6 = 0;  __pyx_t_4 = 0; 
            __PYX_ERR(0, 1509, __pyx_L12_except_error)
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L11_exception_handled;
        }
        __pyx_L12_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_9) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_mstate_global->__pyx_tuple[1], NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1509, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    goto __pyx_L21;
    __pyx_L6_error:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L1_error;
    __pyx_L21:;
  }

  /* "memray/_memray.pyx":1531
 * 
 *     # Ignore the n_allocations in the header, use our observed value.
 *     header["stats"]["n_allocations"] = progress_indicator.num_processed             # <<<<<<<<<<<<<<
 * 
 *     # Convert allocation counts by allocator/by size to Python dicts.
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_progress_indicator), __pyx_mstate_global->__pyx_n_u_num_processed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_header, __pyx_mstate_global->__pyx_n_u_stats); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (unlikely((PyObject_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_n_allocations, __pyx_t_4) < 0))) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1534
 * 
 *     # Convert allocation counts by allocator/by size to Python dicts.
 *     cdef dict tmp = aggregator.allocationCountByAllocator()             # <<<<<<<<<<<<<<
 *     allocation_count_by_allocator = {AllocatorType(k).name: v for k, v in tmp.items()}
 *     cdef dict allocation_count_by_size = aggregator.allocationCountBySize();
*/
  __pyx_t_4 = __pyx_convert_unordered_map_to_py_int____uint64_t(__pyx_v_aggregator.allocationCountByAllocator()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyDict_CheckExact(__pyx_t_4)) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_4))) __PYX_ERR(0, 1534, __pyx_L1_error)
  __pyx_v_tmp = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1535
 *     # Convert allocation counts by allocator/by size to Python dicts.
 *     cdef dict tmp = aggregator.allocationCountByAllocator()
 *     allocation_count_by_allocator = {AllocatorType(k).name: v for k, v in tmp.items()}             # <<<<<<<<<<<<<<
 *     cdef dict allocation_count_by_size = aggregator.allocationCountBySize();
 * 
*/
  { /* enter inner scope */
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1535, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_19 = 0;
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_tmp, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_20), (&__pyx_t_13)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1535, __pyx_L24_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6);
    __pyx_t_6 = __pyx_t_5;
    __pyx_t_5 = 0;
    while (1) {
      __pyx_t_21 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_20, &__pyx_t_19, &__pyx_t_5, &__pyx_t_16, NULL, __pyx_t_13);
      if (unlikely(__pyx_t_21 == 0)) break;
      if (unlikely(__pyx_t_21 == -1)) __PYX_ERR(0, 1535, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_k, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_v, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_AllocatorType); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1535, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_22);
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_22))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_22);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_8genexpr1__pyx_v_k};
        __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1535, __pyx_L24_error)
        __Pyx_GOTREF(__pyx_t_16);
      }
      __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1535, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_22);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_4, (PyObject*)__pyx_t_22, (PyObject*)__pyx_8genexpr1__pyx_v_v))) __PYX_ERR(0, 1535, __pyx_L24_error)
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L27_exit_scope;
    __pyx_L24_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L27_exit_scope:;
  } /* exit inner scope */
  __pyx_v_allocation_count_by_allocator = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1536
 *     cdef dict tmp = aggregator.allocationCountByAllocator()
 *     allocation_count_by_allocator = {AllocatorType(k).name: v for k, v in tmp.items()}
 *     cdef dict allocation_count_by_size = aggregator.allocationCountBySize();             # <<<<<<<<<<<<<<
 * 
 *     # Convert top locations by bytes allocated/by allocation count to dicts
*/
  __pyx_t_4 = __pyx_convert_unordered_map_to_py_size_t____uint64_t(__pyx_v_aggregator.allocationCountBySize()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyDict_CheckExact(__pyx_t_4)) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_4))) __PYX_ERR(0, 1536, __pyx_L1_error)
  __pyx_v_allocation_count_by_size = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1539
 * 
 *     # Convert top locations by bytes allocated/by allocation count to dicts
 *     unknown = ("<unknown>", "<unknown>", 0)             # <<<<<<<<<<<<<<
 * 
 *     top_locations_by_size = [
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[4]);
  __pyx_v_unknown = __pyx_mstate_global->__pyx_tuple[4];

  /* "memray/_memray.pyx":1541
 *     unknown = ("<unknown>", "<unknown>", 0)
 * 
 *     top_locations_by_size = [             # <<<<<<<<<<<<<<
 *         ((reader.Py_GetLocation(size_and_loc.second) or unknown), size_and_loc.first)
 *         for size_and_loc in aggregator.topLocationsBySize(num_largest)
*/
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":1543
 *     top_locations_by_size = [
 *         ((reader.Py_GetLocation(size_and_loc.second) or unknown), size_and_loc.first)
 *         for size_and_loc in aggregator.topLocationsBySize(num_largest)             # <<<<<<<<<<<<<<
 *     ]
 * 
*/
    __pyx_t_8 = __Pyx_PyLong_As_size_t(__pyx_v_num_largest); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1543, __pyx_L1_error)
    try {
      __pyx_t_23 = __pyx_v_aggregator.topLocationsBySize(__pyx_t_8);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1543, __pyx_L1_error)
    }
    __pyx_t_25 = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_23);
    __pyx_t_24 = __pyx_t_25.begin();
    for (; __pyx_t_24 != __pyx_t_25.end(); ++__pyx_t_24) {
      __pyx_t_26 = *__pyx_t_24;
      __pyx_8genexpr2__pyx_v_size_and_loc = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_26);

      /* "memray/_memray.pyx":1542
 * 
 *     top_locations_by_size = [
 *         ((reader.Py_GetLocation(size_and_loc.second) or unknown), size_and_loc.first)             # <<<<<<<<<<<<<<
 *         for size_and_loc in aggregator.topLocationsBySize(num_largest)
 *     ]
*/
      try {
        __pyx_t_22 = __pyx_v_reader->Py_GetLocation(__pyx_8genexpr2__pyx_v_size_and_loc.second);
        if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1542, __pyx_L1_error)
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 1542, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_22);
      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 1542, __pyx_L1_error)
      if (!__pyx_t_18) {
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_22);
        __pyx_t_6 = __pyx_t_22;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L30_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_v_unknown);
      __pyx_t_6 = __pyx_v_unknown;
      __pyx_L30_bool_binop_done:;
      __pyx_t_22 = __Pyx_PyLong_From_uint64_t(__pyx_8genexpr2__pyx_v_size_and_loc.first); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1542, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1542, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1542, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_22);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_22) != (0)) __PYX_ERR(0, 1542, __pyx_L1_error);
      __pyx_t_6 = 0;
      __pyx_t_22 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 1541, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

      /* "memray/_memray.pyx":1543
 *     top_locations_by_size = [
 *         ((reader.Py_GetLocation(size_and_loc.second) or unknown), size_and_loc.first)
 *         for size_and_loc in aggregator.topLocationsBySize(num_largest)             # <<<<<<<<<<<<<<
 *     ]
 * 
*/
    }
  } /* exit inner scope */
  __pyx_v_top_locations_by_size = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1546
 *     ]
 * 
 *     top_locations_by_count = [             # <<<<<<<<<<<<<<
 *         ((reader.Py_GetLocation(count_and_loc.second) or unknown), count_and_loc.first)
 *         for count_and_loc in aggregator.topLocationsByCount(num_largest)
*/
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "memray/_memray.pyx":1548
 *     top_locations_by_count = [
 *         ((reader.Py_GetLocation(count_and_loc.second) or unknown), count_and_loc.first)
 *         for count_and_loc in aggregator.topLocationsByCount(num_largest)             # <<<<<<<<<<<<<<
 *     ]
 * 
*/
    __pyx_t_8 = __Pyx_PyLong_As_size_t(__pyx_v_num_largest); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1548, __pyx_L1_error)
    try {
      __pyx_t_25 = __pyx_v_aggregator.topLocationsByCount(__pyx_t_8);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1548, __pyx_L1_error)
    }
    __pyx_t_23 = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_25);
    __pyx_t_24 = __pyx_t_23.begin();
    for (; __pyx_t_24 != __pyx_t_23.end(); ++__pyx_t_24) {
      __pyx_t_26 = *__pyx_t_24;
      __pyx_8genexpr3__pyx_v_count_and_loc = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_26);

      /* "memray/_memray.pyx":1547
 * 
 *     top_locations_by_count = [
 *         ((reader.Py_GetLocation(count_and_loc.second) or unknown), count_and_loc.first)             # <<<<<<<<<<<<<<
 *         for count_and_loc in aggregator.topLocationsByCount(num_largest)
 *     ]
*/
      try {
        __pyx_t_22 = __pyx_v_reader->Py_GetLocation(__pyx_8genexpr3__pyx_v_count_and_loc.second);
        if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1547, __pyx_L1_error)
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 1547, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_22);
      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 1547, __pyx_L1_error)
      if (!__pyx_t_18) {
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_22);
        __pyx_t_16 = __pyx_t_22;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L35_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_v_unknown);
      __pyx_t_16 = __pyx_v_unknown;
      __pyx_L35_bool_binop_done:;
      __pyx_t_22 = __Pyx_PyLong_From_uint64_t(__pyx_8genexpr3__pyx_v_count_and_loc.first); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_16);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_16) != (0)) __PYX_ERR(0, 1547, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_22);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_22) != (0)) __PYX_ERR(0, 1547, __pyx_L1_error);
      __pyx_t_16 = 0;
      __pyx_t_22 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1546, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "memray/_memray.pyx":1548
 *     top_locations_by_count = [
 *         ((reader.Py_GetLocation(count_and_loc.second) or unknown), count_and_loc.first)
 *         for count_and_loc in aggregator.topLocationsByCount(num_largest)             # <<<<<<<<<<<<<<
 *     ]
 * 
*/
    }
  } /* exit inner scope */
  __pyx_v_top_locations_by_count = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "memray/_memray.pyx":1552
 * 
 *     # And we're done!
 *     cdef uint64_t peak_memory = aggregator.peakBytesAllocated()             # <<<<<<<<<<<<<<
 *     return Stats(
 *         metadata=_create_metadata(header, peak_memory),
*/
  __pyx_v_peak_memory = __pyx_v_aggregator.peakBytesAllocated();

  /* "memray/_memray.pyx":1553
 *     # And we're done!
 *     cdef uint64_t peak_memory = aggregator.peakBytesAllocated()
 *     return Stats(             # <<<<<<<<<<<<<<
 *         metadata=_create_metadata(header, peak_memory),
 *         total_num_allocations=aggregator.totalAllocations(),
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_mstate_global->__pyx_n_u_Stats); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);

  /* "memray/_memray.pyx":1554
 *     cdef uint64_t peak_memory = aggregator.peakBytesAllocated()
 *     return Stats(
 *         metadata=_create_metadata(header, peak_memory),             # <<<<<<<<<<<<<<
 *         total_num_allocations=aggregator.totalAllocations(),
 *         total_memory_allocated=aggregator.totalBytesAllocated(),
*/
  __pyx_t_16 = __Pyx_PyLong_From_uint64_t(__pyx_v_peak_memory); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_5 = __pyx_f_6memray_7_memray__create_metadata(__pyx_v_header, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "memray/_memray.pyx":1555
 *     return Stats(
 *         metadata=_create_metadata(header, peak_memory),
 *         total_num_allocations=aggregator.totalAllocations(),             # <<<<<<<<<<<<<<
 *         total_memory_allocated=aggregator.totalBytesAllocated(),
 *         peak_memory_allocated=peak_memory,
*/
  __pyx_t_16 = __Pyx_PyLong_From_uint64_t(__pyx_v_aggregator.totalAllocations()); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);

  /* "memray/_memray.pyx":1556
 *         metadata=_create_metadata(header, peak_memory),
 *         total_num_allocations=aggregator.totalAllocations(),
 *         total_memory_allocated=aggregator.totalBytesAllocated(),             # <<<<<<<<<<<<<<
 *         peak_memory_allocated=peak_memory,
 *         allocation_count_by_size=allocation_count_by_size,
*/
  __pyx_t_27 = __Pyx_PyLong_From_uint64_t(__pyx_v_aggregator.totalBytesAllocated()); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_27);

  /* "memray/_memray.pyx":1557
 *         total_num_allocations=aggregator.totalAllocations(),
 *         total_memory_allocated=aggregator.totalBytesAllocated(),
 *         peak_memory_allocated=peak_memory,             # <<<<<<<<<<<<<<
 *         allocation_count_by_size=allocation_count_by_size,
 *         allocation_count_by_allocator=allocation_count_by_allocator,
*/
  __pyx_t_28 = __Pyx_PyLong_From_uint64_t(__pyx_v_peak_memory); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_28);

  /* "memray/_memray.pyx":1561
 *         allocation_count_by_allocator=allocation_count_by_allocator,
 *         top_locations_by_size=top_locations_by_size,
 *         top_locations_by_count=top_locations_by_count,             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_22))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_22);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_22);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_22, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 8 : 0)] = {__pyx_t_6, NULL};
    __pyx_t_29 = __Pyx_MakeVectorcallBuilderKwds(8); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_29);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_metadata, __pyx_t_5, __pyx_t_29, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total_num_allocations, __pyx_t_16, __pyx_t_29, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_total_memory_allocated, __pyx_t_27, __pyx_t_29, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_peak_memory_allocated, __pyx_t_28, __pyx_t_29, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allocation_count_by_size, __pyx_v_allocation_count_by_size, __pyx_t_29, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allocation_count_by_allocator, __pyx_v_allocation_count_by_allocator, __pyx_t_29, __pyx_callargs+1, 5) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_top_locations_by_size, __pyx_v_top_locations_by_size, __pyx_t_29, __pyx_callargs+1, 6) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_top_locations_by_count, __pyx_v_top_locations_by_count, __pyx_t_29, __pyx_callargs+1, 7) < (0)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_22, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_29);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
    __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1484
 * 
 * 
 * def compute_statistics(             # <<<<<<<<<<<<<<
 *     file_name,
 *     *,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_27);
  __Pyx_XDECREF(__pyx_t_28);
  __Pyx_XDECREF(__pyx_t_29);
  __Pyx_AddTraceback("memray._memray.compute_statistics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_header);
  __Pyx_XDECREF(__pyx_v_total);
  __Pyx_XDECREF((PyObject *)__pyx_v_progress_indicator);
  __Pyx_XDECREF(__pyx_v_tmp);
  __Pyx_XDECREF(__pyx_v_allocation_count_by_allocator);
  __Pyx_XDECREF(__pyx_v_allocation_count_by_size);
  __Pyx_XDECREF(__pyx_v_unknown);
  __Pyx_XDECREF(__pyx_v_top_locations_by_size);
  __Pyx_XDECREF(__pyx_v_top_locations_by_count);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1565
 * 
 * 
 * def dump_all_records(object file_name):             # <<<<<<<<<<<<<<
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_13dump_all_records(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12dump_all_records, "dump_all_records(file_name)");
static PyMethodDef __pyx_mdef_6memray_7_memray_13dump_all_records = {"dump_all_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_13dump_all_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12dump_all_records};
static PyObject *__pyx_pw_6memray_7_memray_13dump_all_records(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_file_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dump_all_records (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1565, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1565, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "dump_all_records", 0) < (0)) __PYX_ERR(0, 1565, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("dump_all_records", 1, 1, 1, i); __PYX_ERR(0, 1565, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1565, __pyx_L3_error)
    }
    __pyx_v_file_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump_all_records", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1565, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.dump_all_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_12dump_all_records(__pyx_self, __pyx_v_file_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12dump_all_records(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file_name) {
  PyObject *__pyx_v_path = 0;
  std::shared_ptr<memray::api::RecordReader>  __pyx_v__reader;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  std::string __pyx_t_10;
  memray::io::FileSource *__pyx_t_11;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump_all_records", 0);

  /* "memray/_memray.pyx":1566
 * 
 * def dump_all_records(object file_name):
 *     cdef str path = str(file_name)             # <<<<<<<<<<<<<<
 *     if not pathlib.Path(path).exists():
 *         raise IOError(f"No such file: {path}")
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_file_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1567
 * def dump_all_records(object file_name):
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():             # <<<<<<<<<<<<<<
 *         raise IOError(f"No such file: {path}")
 * 
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pathlib); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_path};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = (!__pyx_t_8);
  if (unlikely(__pyx_t_9)) {

    /* "memray/_memray.pyx":1568
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():
 *         raise IOError(f"No such file: {path}")             # <<<<<<<<<<<<<<
 * 
 *     cdef shared_ptr[RecordReader] _reader = make_shared[RecordReader](
*/
    __pyx_t_3 = NULL;
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_No_such_file, __pyx_v_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IOError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1568, __pyx_L1_error)

    /* "memray/_memray.pyx":1567
 * def dump_all_records(object file_name):
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():             # <<<<<<<<<<<<<<
 *         raise IOError(f"No such file: {path}")
 * 
*/
  }

  /* "memray/_memray.pyx":1571
 * 
 *     cdef shared_ptr[RecordReader] _reader = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(path)))             # <<<<<<<<<<<<<<
 *     _reader.get().dumpAllRecords()
 * 
*/
  __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_path); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1571, __pyx_L1_error)
  try {
    __pyx_t_11 = new memray::io::FileSource(__pyx_t_10);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1571, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1570
 *         raise IOError(f"No such file: {path}")
 * 
 *     cdef shared_ptr[RecordReader] _reader = make_shared[RecordReader](             # <<<<<<<<<<<<<<
 *             unique_ptr[FileSource](new FileSource(path)))
 *     _reader.get().dumpAllRecords()
*/
  try {
    __pyx_t_12 = std::make_shared<memray::api::RecordReader>(std::unique_ptr<memray::io::FileSource> (__pyx_t_11));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1570, __pyx_L1_error)
  }
  __pyx_v__reader = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_12);

  /* "memray/_memray.pyx":1572
 *     cdef shared_ptr[RecordReader] _reader = make_shared[RecordReader](
 *             unique_ptr[FileSource](new FileSource(path)))
 *     _reader.get().dumpAllRecords()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  try {
    __pyx_t_1 = __pyx_v__reader.get()->dumpAllRecords();
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1572, __pyx_L1_error)
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1572, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1565
 * 
 * 
 * def dump_all_records(object file_name):             # <<<<<<<<<<<<<<
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.dump_all_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1581
 *     cdef object _port
 * 
 *     def __cinit__(self, int port):             # <<<<<<<<<<<<<<
 *         self._impl = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_12SocketReader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_12SocketReader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED int __pyx_v_port;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_port,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1581, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1581, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 1581, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 1581, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1581, __pyx_L3_error)
    }
    __pyx_v_port = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_port == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1581, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.SocketReader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader___cinit__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self), __pyx_v_port);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_12SocketReader___cinit__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED int __pyx_v_port) {
  int __pyx_r;

  /* "memray/_memray.pyx":1582
 * 
 *     def __cinit__(self, int port):
 *         self._impl = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, port: int):
*/
  __pyx_v_self->_impl = NULL;

  /* "memray/_memray.pyx":1581
 *     cdef object _port
 * 
 *     def __cinit__(self, int port):             # <<<<<<<<<<<<<<
 *         self._impl = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "memray/_memray.pyx":1584
 *         self._impl = NULL
 * 
 *     def __init__(self, port: int):             # <<<<<<<<<<<<<<
 *         self._header = {}
 *         self._port = port
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_12SocketReader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_12SocketReader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_port = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_port,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1584, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1584, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 1584, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1584, __pyx_L3_error)
    }
    if (__Pyx_PyInt_FromNumber(&values[0], "port", 0) < (0)) __PYX_ERR(0, 1584, __pyx_L3_error)
    __pyx_v_port = ((PyObject*)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1584, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.SocketReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_port), (&PyLong_Type), 0, "port", 2))) __PYX_ERR(0, 1584, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_2__init__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self), __pyx_v_port);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_12SocketReader_2__init__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, PyObject *__pyx_v_port) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "memray/_memray.pyx":1585
 * 
 *     def __init__(self, port: int):
 *         self._header = {}             # <<<<<<<<<<<<<<
 *         self._port = port
 * 
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_header);
  __Pyx_DECREF(__pyx_v_self->_header);
  __pyx_v_self->_header = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1586
 *     def __init__(self, port: int):
 *         self._header = {}
 *         self._port = port             # <<<<<<<<<<<<<<
 * 
 *     cdef _teardown(self):
*/
  __Pyx_INCREF(__pyx_v_port);
  __Pyx_GIVEREF(__pyx_v_port);
  __Pyx_GOTREF(__pyx_v_self->_port);
  __Pyx_DECREF(__pyx_v_self->_port);
  __pyx_v_self->_port = __pyx_v_port;

  /* "memray/_memray.pyx":1584
 *         self._impl = NULL
 * 
 *     def __init__(self, port: int):             # <<<<<<<<<<<<<<
 *         self._header = {}
 *         self._port = port
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.SocketReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1588
 *         self._port = port
 * 
 *     cdef _teardown(self):             # <<<<<<<<<<<<<<
 *         with nogil:
 *             del self._impl
*/

static PyObject *__pyx_f_6memray_7_memray_12SocketReader__teardown(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_teardown", 0);

  /* "memray/_memray.pyx":1589
 * 
 *     cdef _teardown(self):
 *         with nogil:             # <<<<<<<<<<<<<<
 *             del self._impl
 *         self._impl = NULL
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "memray/_memray.pyx":1590
 *     cdef _teardown(self):
 *         with nogil:
 *             del self._impl             # <<<<<<<<<<<<<<
 *         self._impl = NULL
 * 
*/
        delete __pyx_v_self->_impl;
      }

      /* "memray/_memray.pyx":1589
 * 
 *     cdef _teardown(self):
 *         with nogil:             # <<<<<<<<<<<<<<
 *             del self._impl
 *         self._impl = NULL
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "memray/_memray.pyx":1591
 *         with nogil:
 *             del self._impl
 *         self._impl = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef unique_ptr[SocketSource] _make_source(self) except*:
*/
  __pyx_v_self->_impl = NULL;

  /* "memray/_memray.pyx":1588
 *         self._port = port
 * 
 *     cdef _teardown(self):             # <<<<<<<<<<<<<<
 *         with nogil:
 *             del self._impl
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1593
 *         self._impl = NULL
 * 
 *     cdef unique_ptr[SocketSource] _make_source(self) except*:             # <<<<<<<<<<<<<<
 *         # Creating a SocketSource can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
*/

static std::unique_ptr<memray::io::SocketSource>  __pyx_f_6memray_7_memray_12SocketReader__make_source(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  memray::io::SocketSource *__pyx_v_source;
  std::unique_ptr<memray::io::SocketSource>  __pyx_r;
  int __pyx_t_1;
  memray::io::SocketSource *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "memray/_memray.pyx":1597
 *         # handlers). If this happens, this method will propagate the appropriate exception.
 *         # We cannot use make_unique or C++ exceptions from SocketSource() won't be caught.
 *         cdef SocketSource* source = new SocketSource(self._port)             # <<<<<<<<<<<<<<
 *         return unique_ptr[SocketSource](source)
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_self->_port); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1597, __pyx_L1_error)
  try {
    __pyx_t_2 = new memray::io::SocketSource(__pyx_t_1);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1597, __pyx_L1_error)
  }
  __pyx_v_source = __pyx_t_2;

  /* "memray/_memray.pyx":1598
 *         # We cannot use make_unique or C++ exceptions from SocketSource() won't be caught.
 *         cdef SocketSource* source = new SocketSource(self._port)
 *         return unique_ptr[SocketSource](source)             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __pyx_r = std::unique_ptr<memray::io::SocketSource> (__pyx_v_source);
  goto __pyx_L0;

  /* "memray/_memray.pyx":1593
 *         self._impl = NULL
 * 
 *     cdef unique_ptr[SocketSource] _make_source(self) except*:             # <<<<<<<<<<<<<<
 *         # Creating a SocketSource can raise Python exceptions (if is interrupted by signal
 *         # handlers). If this happens, this method will propagate the appropriate exception.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.SocketReader._make_source", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  return __pyx_r;
}

/* "memray/_memray.pyx":1600
 *         return unique_ptr[SocketSource](source)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._impl is not NULL:
 *             raise ValueError(
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_5__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12SocketReader_4__enter__, "SocketReader.__enter__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_12SocketReader_5__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_5__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_4__enter__};
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_5__enter__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__enter__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_4__enter__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_4__enter__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  std::unique_ptr<memray::io::SocketSource>  __pyx_t_5;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_6;
  memray::socket_thread::BackgroundSocketReader *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "memray/_memray.pyx":1601
 * 
 *     def __enter__(self):
 *         if self._impl is not NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Can not enter the context of a SocketReader object more than "
*/
  __pyx_t_1 = (__pyx_v_self->_impl != NULL);
  if (unlikely(__pyx_t_1)) {

    /* "memray/_memray.pyx":1602
 *     def __enter__(self):
 *         if self._impl is not NULL:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 "Can not enter the context of a SocketReader object more than "
 *                 "once, at the same time."
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Can_not_enter_the_context_of_a_S};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1602, __pyx_L1_error)

    /* "memray/_memray.pyx":1601
 * 
 *     def __enter__(self):
 *         if self._impl is not NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 "Can not enter the context of a SocketReader object more than "
*/
  }

  /* "memray/_memray.pyx":1607
 *             )
 * 
 *         self._reader = make_shared[RecordReader](move(self._make_source()))             # <<<<<<<<<<<<<<
 *         self._header = self._reader.get().getHeader()
 * 
*/
  __pyx_t_5 = ((struct __pyx_vtabstruct_6memray_7_memray_SocketReader *)__pyx_v_self->__pyx_vtab)->_make_source(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error)
  try {
    __pyx_t_6 = std::make_shared<memray::api::RecordReader>(cython_std::move<std::unique_ptr<memray::io::SocketSource> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5)));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1607, __pyx_L1_error)
  }
  __pyx_v_self->_reader = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6);

  /* "memray/_memray.pyx":1608
 * 
 *         self._reader = make_shared[RecordReader](move(self._make_source()))
 *         self._header = self._reader.get().getHeader()             # <<<<<<<<<<<<<<
 * 
 *         self._impl = new BackgroundSocketReader(self._reader)
*/
  __pyx_t_2 = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(__pyx_v_self->_reader.get()->getHeader()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_header);
  __Pyx_DECREF(__pyx_v_self->_header);
  __pyx_v_self->_header = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1610
 *         self._header = self._reader.get().getHeader()
 * 
 *         self._impl = new BackgroundSocketReader(self._reader)             # <<<<<<<<<<<<<<
 *         self._impl.start()
 * 
*/
  try {
    __pyx_t_7 = new memray::socket_thread::BackgroundSocketReader(__pyx_v_self->_reader);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1610, __pyx_L1_error)
  }
  __pyx_v_self->_impl = __pyx_t_7;

  /* "memray/_memray.pyx":1611
 * 
 *         self._impl = new BackgroundSocketReader(self._reader)
 *         self._impl.start()             # <<<<<<<<<<<<<<
 * 
 *         return self
*/
  try {
    __pyx_v_self->_impl->start();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1611, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1613
 *         self._impl.start()
 * 
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "memray/_memray.pyx":1600
 *         return unique_ptr[SocketSource](source)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._impl is not NULL:
 *             raise ValueError(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.SocketReader.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1615
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         assert self._impl is not NULL
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_7__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12SocketReader_6__exit__, "SocketReader.__exit__(self, exc_type, exc_value, exc_traceback)");
static PyMethodDef __pyx_mdef_6memray_7_memray_12SocketReader_7__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_7__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_6__exit__};
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_7__exit__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_traceback = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_value,&__pyx_mstate_global->__pyx_n_u_exc_traceback,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1615, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1615, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1615, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1615, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 1615, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 1615, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1615, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1615, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1615, __pyx_L3_error)
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_value = values[1];
    __pyx_v_exc_traceback = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1615, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.SocketReader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_6__exit__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_exc_traceback);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_6__exit__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_exc_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "memray/_memray.pyx":1616
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         assert self._impl is not NULL             # <<<<<<<<<<<<<<
 * 
 *         self._teardown()
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->_impl != NULL);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1616, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1616, __pyx_L1_error)
  #endif

  /* "memray/_memray.pyx":1618
 *         assert self._impl is not NULL
 * 
 *         self._teardown()             # <<<<<<<<<<<<<<
 *         self._reader.get().close()
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_6memray_7_memray_SocketReader *)__pyx_v_self->__pyx_vtab)->_teardown(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1619
 * 
 *         self._teardown()
 *         self._reader.get().close()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_v_self->_reader.get()->close();

  /* "memray/_memray.pyx":1615
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         assert self._impl is not NULL
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.SocketReader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1621
 *         self._reader.get().close()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._impl is not NULL:
 *             self._teardown()
*/

/* Python wrapper */
static void __pyx_pw_6memray_7_memray_12SocketReader_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6memray_7_memray_12SocketReader_9__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6memray_7_memray_12SocketReader_8__dealloc__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6memray_7_memray_12SocketReader_8__dealloc__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "memray/_memray.pyx":1622
 * 
 *     def __dealloc__(self):
 *         if self._impl is not NULL:             # <<<<<<<<<<<<<<
 *             self._teardown()
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_impl != NULL);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1623
 *     def __dealloc__(self):
 *         if self._impl is not NULL:
 *             self._teardown()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_6memray_7_memray_SocketReader *)__pyx_v_self->__pyx_vtab)->_teardown(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "memray/_memray.pyx":1622
 * 
 *     def __dealloc__(self):
 *         if self._impl is not NULL:             # <<<<<<<<<<<<<<
 *             self._teardown()
 * 
*/
  }

  /* "memray/_memray.pyx":1621
 *         self._reader.get().close()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._impl is not NULL:
 *             self._teardown()
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("memray._memray.SocketReader.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "memray/_memray.pyx":1625
 *             self._teardown()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def command_line(self):
 *         if not self._header:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_12command_line_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_12command_line_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_12command_line___get__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_12command_line___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1627
 *     @property
 *     def command_line(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._header["command_line"]
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_header); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1627, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":1628
 *     def command_line(self):
 *         if not self._header:
 *             return None             # <<<<<<<<<<<<<<
 *         return self._header["command_line"]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1627
 *     @property
 *     def command_line(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._header["command_line"]
*/
  }

  /* "memray/_memray.pyx":1629
 *         if not self._header:
 *             return None
 *         return self._header["command_line"]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_command_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1625
 *             self._teardown()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def command_line(self):
 *         if not self._header:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.SocketReader.command_line.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1631
 *         return self._header["command_line"]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_active(self):
 *         if self._impl == NULL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_9is_active_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_9is_active_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_9is_active___get__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_9is_active___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1633
 *     @property
 *     def is_active(self):
 *         if self._impl == NULL:             # <<<<<<<<<<<<<<
 *             return False
 *         return self._impl.is_active()
*/
  __pyx_t_1 = (__pyx_v_self->_impl == NULL);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1634
 *     def is_active(self):
 *         if self._impl == NULL:
 *             return False             # <<<<<<<<<<<<<<
 *         return self._impl.is_active()
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "memray/_memray.pyx":1633
 *     @property
 *     def is_active(self):
 *         if self._impl == NULL:             # <<<<<<<<<<<<<<
 *             return False
 *         return self._impl.is_active()
*/
  }

  /* "memray/_memray.pyx":1635
 *         if self._impl == NULL:
 *             return False
 *         return self._impl.is_active()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->_impl->is_active()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1631
 *         return self._header["command_line"]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_active(self):
 *         if self._impl == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.SocketReader.is_active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1637
 *         return self._impl.is_active()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def pid(self):
 *         if not self._header:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_3pid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_3pid_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_3pid___get__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_3pid___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1639
 *     @property
 *     def pid(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._header["pid"]
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_header); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1639, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":1640
 *     def pid(self):
 *         if not self._header:
 *             return None             # <<<<<<<<<<<<<<
 *         return self._header["pid"]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1639
 *     @property
 *     def pid(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._header["pid"]
*/
  }

  /* "memray/_memray.pyx":1641
 *         if not self._header:
 *             return None
 *         return self._header["pid"]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1637
 *         return self._impl.is_active()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def pid(self):
 *         if not self._header:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.SocketReader.pid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1643
 *         return self._header["pid"]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def has_native_traces(self):
 *         if not self._header:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_17has_native_traces_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_17has_native_traces_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_17has_native_traces___get__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_17has_native_traces___get__(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "memray/_memray.pyx":1645
 *     @property
 *     def has_native_traces(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return False
 *         return self._header["native_traces"]
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_header); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1645, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "memray/_memray.pyx":1646
 *     def has_native_traces(self):
 *         if not self._header:
 *             return False             # <<<<<<<<<<<<<<
 *         return self._header["native_traces"]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "memray/_memray.pyx":1645
 *     @property
 *     def has_native_traces(self):
 *         if not self._header:             # <<<<<<<<<<<<<<
 *             return False
 *         return self._header["native_traces"]
*/
  }

  /* "memray/_memray.pyx":1647
 *         if not self._header:
 *             return False
 *         return self._header["native_traces"]             # <<<<<<<<<<<<<<
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->_header, __pyx_mstate_global->__pyx_n_u_native_traces); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1643
 *         return self._header["pid"]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def has_native_traces(self):
 *         if not self._header:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("memray._memray.SocketReader.has_native_traces.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_12SocketReader_12generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1649
 *         return self._header["native_traces"]
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):             # <<<<<<<<<<<<<<
 *         if self._impl is NULL:
 *             return
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_11get_current_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12SocketReader_10get_current_snapshot, "SocketReader.get_current_snapshot(self, *, bool merge_threads)");
static PyMethodDef __pyx_mdef_6memray_7_memray_12SocketReader_11get_current_snapshot = {"get_current_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_11get_current_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_10get_current_snapshot};
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_11get_current_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  bool __pyx_v_merge_threads;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_current_snapshot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_merge_threads,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1649, __pyx_L3_error)
    if (likely(__pyx_kwds_len > 0)) {
      switch (__pyx_nargs) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "get_current_snapshot", 0) < (0)) __PYX_ERR(0, 1649, __pyx_L3_error)
      for (Py_ssize_t i = 0; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseKeywordRequired("get_current_snapshot", *(__pyx_pyargnames[i - 0])); __PYX_ERR(0, 1649, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 0)) {
      goto __pyx_L5_argtuple_error;
    } else {
      __Pyx_RaiseKeywordRequired("get_current_snapshot", __pyx_mstate_global->__pyx_n_u_merge_threads); __PYX_ERR(0, 1649, __pyx_L3_error)
    }
    __pyx_v_merge_threads = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_merge_threads == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1649, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_current_snapshot", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 1649, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.SocketReader.get_current_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_10get_current_snapshot(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self), __pyx_v_merge_threads);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_10get_current_snapshot(struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, bool __pyx_v_merge_threads) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_current_snapshot", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1649, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_merge_threads = __pyx_v_merge_threads;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_12SocketReader_12generator9, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_current_snapshot, __pyx_mstate_global->__pyx_n_u_SocketReader_get_current_snapsho, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.SocketReader.get_current_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_12SocketReader_12generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  std::shared_ptr<memray::api::RecordReader>  __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_current_snapshot", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1649, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1650
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):
 *         if self._impl is NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->_impl == NULL);
  if (__pyx_t_1) {

    /* "memray/_memray.pyx":1651
 *     def get_current_snapshot(self, *, bool merge_threads):
 *         if self._impl is NULL:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         snapshot_allocations = self._impl.Py_GetSnapshotAllocationRecords(merge_threads=merge_threads)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "memray/_memray.pyx":1650
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):
 *         if self._impl is NULL:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "memray/_memray.pyx":1653
 *             return
 * 
 *         snapshot_allocations = self._impl.Py_GetSnapshotAllocationRecords(merge_threads=merge_threads)             # <<<<<<<<<<<<<<
 *         for elem in snapshot_allocations:
 *             alloc = AllocationRecord(elem)
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_impl->Py_GetSnapshotAllocationRecords(__pyx_cur_scope->__pyx_v_merge_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_snapshot_allocations = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "memray/_memray.pyx":1654
 * 
 *         snapshot_allocations = self._impl.Py_GetSnapshotAllocationRecords(merge_threads=merge_threads)
 *         for elem in snapshot_allocations:             # <<<<<<<<<<<<<<
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = self._reader
*/
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_snapshot_allocations)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_snapshot_allocations)) {
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_snapshot_allocations; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_snapshot_allocations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1654, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1654, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1654, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1654, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1654, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "memray/_memray.pyx":1655
 *         snapshot_allocations = self._impl.Py_GetSnapshotAllocationRecords(merge_threads=merge_threads)
 *         for elem in snapshot_allocations:
 *             alloc = AllocationRecord(elem)             # <<<<<<<<<<<<<<
 *             (<AllocationRecord> alloc)._reader = self._reader
 *             yield alloc
*/
    __pyx_t_6 = NULL;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_elem};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1655, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_5);
    }
    __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alloc, ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)__pyx_t_5));
    __Pyx_GIVEREF((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "memray/_memray.pyx":1656
 *         for elem in snapshot_allocations:
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = self._reader             # <<<<<<<<<<<<<<
 *             yield alloc
 * 
*/
    __pyx_t_8 = __pyx_cur_scope->__pyx_v_self->_reader;
    __pyx_cur_scope->__pyx_v_alloc->_reader = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_8);

    /* "memray/_memray.pyx":1657
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = self._reader
 *             yield alloc             # <<<<<<<<<<<<<<
 * 
 * cpdef enum SymbolicSupport:
*/
    __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_alloc);
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L7_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1657, __pyx_L1_error)

    /* "memray/_memray.pyx":1654
 * 
 *         snapshot_allocations = self._impl.Py_GetSnapshotAllocationRecords(merge_threads=merge_threads)
 *         for elem in snapshot_allocations:             # <<<<<<<<<<<<<<
 *             alloc = AllocationRecord(elem)
 *             (<AllocationRecord> alloc)._reader = self._reader
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1649
 *         return self._header["native_traces"]
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):             # <<<<<<<<<<<<<<
 *         if self._impl is NULL:
 *             return
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_current_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12SocketReader_13__reduce_cython__, "SocketReader.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_12SocketReader_14__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_13__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_13__reduce_cython__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.SocketReader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_12SocketReader_15__setstate_cython__, "SocketReader.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_12SocketReader_16__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_15__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_12SocketReader_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.SocketReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_12SocketReader_15__setstate_cython__(((struct __pyx_obj_6memray_7_memray_SocketReader *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_12SocketReader_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_SocketReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.SocketReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1664
 *     TOTAL = 3
 * 
 * def get_symbolic_support():             # <<<<<<<<<<<<<<
 *     locations = unwindHere()
 *     for location in locations:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_15get_symbolic_support(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_14get_symbolic_support, "get_symbolic_support()");
static PyMethodDef __pyx_mdef_6memray_7_memray_15get_symbolic_support = {"get_symbolic_support", (PyCFunction)__pyx_pw_6memray_7_memray_15get_symbolic_support, METH_NOARGS, __pyx_doc_6memray_7_memray_14get_symbolic_support};
static PyObject *__pyx_pw_6memray_7_memray_15get_symbolic_support(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_symbolic_support (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6memray_7_memray_14get_symbolic_support(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_14get_symbolic_support(CYTHON_UNUSED PyObject *__pyx_self) {
  std::vector<std::string>  __pyx_v_locations;
  std::string __pyx_v_location;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_file = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_line = NULL;
  PyObject *__pyx_v_is_python_frame_boundary = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::vector<std::string>  __pyx_t_1;
  std::vector<std::string> ::iterator __pyx_t_2;
  std::string __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  size_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_symbolic_support", 0);

  /* "memray/_memray.pyx":1665
 * 
 * def get_symbolic_support():
 *     locations = unwindHere()             # <<<<<<<<<<<<<<
 *     for location in locations:
 *         function, file, line = location.split(":")
*/
  try {
    __pyx_t_1 = memray::native_resolver::unwindHere();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1665, __pyx_L1_error)
  }
  __pyx_v_locations = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1);

  /* "memray/_memray.pyx":1666
 * def get_symbolic_support():
 *     locations = unwindHere()
 *     for location in locations:             # <<<<<<<<<<<<<<
 *         function, file, line = location.split(":")
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
*/
  __pyx_t_2 = __pyx_v_locations.begin();
  for (; __pyx_t_2 != __pyx_v_locations.end(); ++__pyx_t_2) {
    __pyx_t_3 = *__pyx_t_2;
    __pyx_v_location = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3);

    /* "memray/_memray.pyx":1667
 *     locations = unwindHere()
 *     for location in locations:
 *         function, file, line = location.split(":")             # <<<<<<<<<<<<<<
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
*/
    __pyx_t_4 = __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(__pyx_v_location); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyUnicode_Split(((PyObject*)__pyx_t_4), __pyx_mstate_global->__pyx_kp_u__9, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (1) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PyList_GET_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1667, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_7);
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_file, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "memray/_memray.pyx":1670
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
 *         is_python_frame_boundary = function == "_PyEval_EvalFrameDefault" or (             # <<<<<<<<<<<<<<
 *             function.startswith("_TAIL_CALL_") and ".llvm." in function
 *         )
*/
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_function, __pyx_mstate_global->__pyx_n_u_PyEval_EvalFrameDefault, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1670, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1670, __pyx_L1_error)
    if (!__pyx_t_8) {
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L5_bool_binop_done;
    }

    /* "memray/_memray.pyx":1671
 *         # or Python 3.14 tail call interpreter LLVM-generated functions
 *         is_python_frame_boundary = function == "_PyEval_EvalFrameDefault" or (
 *             function.startswith("_TAIL_CALL_") and ".llvm." in function             # <<<<<<<<<<<<<<
 *         )
 *         if not is_python_frame_boundary:
*/
    __pyx_t_6 = __pyx_v_function;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_TAIL_CALL};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1671, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1671, __pyx_L1_error)
    if (__pyx_t_8) {
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u_llvm, __pyx_v_function, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1671, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1671, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_L5_bool_binop_done:;
    __Pyx_XDECREF_SET(__pyx_v_is_python_frame_boundary, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "memray/_memray.pyx":1673
 *             function.startswith("_TAIL_CALL_") and ".llvm." in function
 *         )
 *         if not is_python_frame_boundary:             # <<<<<<<<<<<<<<
 *             continue
 *         if not file:
*/
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_is_python_frame_boundary); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1673, __pyx_L1_error)
    __pyx_t_10 = (!__pyx_t_8);
    if (__pyx_t_10) {

      /* "memray/_memray.pyx":1674
 *         )
 *         if not is_python_frame_boundary:
 *             continue             # <<<<<<<<<<<<<<
 *         if not file:
 *             return SymbolicSupport.FUNCTION_NAME_ONLY
*/
      goto __pyx_L3_continue;

      /* "memray/_memray.pyx":1673
 *             function.startswith("_TAIL_CALL_") and ".llvm." in function
 *         )
 *         if not is_python_frame_boundary:             # <<<<<<<<<<<<<<
 *             continue
 *         if not file:
*/
    }

    /* "memray/_memray.pyx":1675
 *         if not is_python_frame_boundary:
 *             continue
 *         if not file:             # <<<<<<<<<<<<<<
 *             return SymbolicSupport.FUNCTION_NAME_ONLY
 *         return SymbolicSupport.TOTAL
*/
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_file); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 1675, __pyx_L1_error)
    __pyx_t_8 = (!__pyx_t_10);
    if (__pyx_t_8) {

      /* "memray/_memray.pyx":1676
 *             continue
 *         if not file:
 *             return SymbolicSupport.FUNCTION_NAME_ONLY             # <<<<<<<<<<<<<<
 *         return SymbolicSupport.TOTAL
 *     return SymbolicSupport.NONE
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_FUNCTION_NAME_ONLY); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1676, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "memray/_memray.pyx":1675
 *         if not is_python_frame_boundary:
 *             continue
 *         if not file:             # <<<<<<<<<<<<<<
 *             return SymbolicSupport.FUNCTION_NAME_ONLY
 *         return SymbolicSupport.TOTAL
*/
    }

    /* "memray/_memray.pyx":1677
 *         if not file:
 *             return SymbolicSupport.FUNCTION_NAME_ONLY
 *         return SymbolicSupport.TOTAL             # <<<<<<<<<<<<<<
 *     return SymbolicSupport.NONE
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_TOTAL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "memray/_memray.pyx":1666
 * def get_symbolic_support():
 *     locations = unwindHere()
 *     for location in locations:             # <<<<<<<<<<<<<<
 *         function, file, line = location.split(":")
 *         # Check for Python frame boundaries: traditional _PyEval_EvalFrameDefault
*/
    __pyx_L3_continue:;
  }

  /* "memray/_memray.pyx":1678
 *             return SymbolicSupport.FUNCTION_NAME_ONLY
 *         return SymbolicSupport.TOTAL
 *     return SymbolicSupport.NONE             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_Enum_4a03dd__6memray_7_memray_enum__dunderpyx_t_6memray_7_m__etc_to_py(__pyx_e_6memray_7_memray_NONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1664
 *     TOTAL = 3
 * 
 * def get_symbolic_support():             # <<<<<<<<<<<<<<
 *     locations = unwindHere()
 *     for location in locations:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("memray._memray.get_symbolic_support", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_file);
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XDECREF(__pyx_v_is_python_frame_boundary);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1690
 * 
 * 
 * def _rss_from_proc_status_for_testing(str proc_status):             # <<<<<<<<<<<<<<
 *     cdef cppstring encoded_proc_status = proc_status.encode("utf-8")
 *     cdef size_t rss_in_bytes
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_17_rss_from_proc_status_for_testing(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_16_rss_from_proc_status_for_testing, "_rss_from_proc_status_for_testing(str proc_status)");
static PyMethodDef __pyx_mdef_6memray_7_memray_17_rss_from_proc_status_for_testing = {"_rss_from_proc_status_for_testing", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17_rss_from_proc_status_for_testing, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16_rss_from_proc_status_for_testing};
static PyObject *__pyx_pw_6memray_7_memray_17_rss_from_proc_status_for_testing(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_proc_status = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rss_from_proc_status_for_testing (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_proc_status,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1690, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1690, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_rss_from_proc_status_for_testing", 0) < (0)) __PYX_ERR(0, 1690, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_rss_from_proc_status_for_testing", 1, 1, 1, i); __PYX_ERR(0, 1690, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1690, __pyx_L3_error)
    }
    __pyx_v_proc_status = ((PyObject*)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_rss_from_proc_status_for_testing", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1690, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray._rss_from_proc_status_for_testing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_proc_status), (&PyUnicode_Type), 1, "proc_status", 1))) __PYX_ERR(0, 1690, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_16_rss_from_proc_status_for_testing(__pyx_self, __pyx_v_proc_status);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_16_rss_from_proc_status_for_testing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_proc_status) {
  std::string __pyx_v_encoded_proc_status;
  size_t __pyx_v_rss_in_bytes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::string __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rss_from_proc_status_for_testing", 0);

  /* "memray/_memray.pyx":1691
 * 
 * def _rss_from_proc_status_for_testing(str proc_status):
 *     cdef cppstring encoded_proc_status = proc_status.encode("utf-8")             # <<<<<<<<<<<<<<
 *     cdef size_t rss_in_bytes
 * 
*/
  if (unlikely(__pyx_v_proc_status == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1691, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_proc_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_encoded_proc_status = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2);

  /* "memray/_memray.pyx":1694
 *     cdef size_t rss_in_bytes
 * 
 *     if not getRSSFromProcStatus(encoded_proc_status, &rss_in_bytes):             # <<<<<<<<<<<<<<
 *         raise ValueError("Failed to parse VmRSS from proc status")
 *     return rss_in_bytes
*/
  __pyx_t_3 = (!(memray::tracking_api::getRSSFromProcStatus(__pyx_v_encoded_proc_status, (&__pyx_v_rss_in_bytes)) != 0));
  if (unlikely(__pyx_t_3)) {

    /* "memray/_memray.pyx":1695
 * 
 *     if not getRSSFromProcStatus(encoded_proc_status, &rss_in_bytes):
 *         raise ValueError("Failed to parse VmRSS from proc status")             # <<<<<<<<<<<<<<
 *     return rss_in_bytes
 * 
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Failed_to_parse_VmRSS_from_proc};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1695, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1695, __pyx_L1_error)

    /* "memray/_memray.pyx":1694
 *     cdef size_t rss_in_bytes
 * 
 *     if not getRSSFromProcStatus(encoded_proc_status, &rss_in_bytes):             # <<<<<<<<<<<<<<
 *         raise ValueError("Failed to parse VmRSS from proc status")
 *     return rss_in_bytes
*/
  }

  /* "memray/_memray.pyx":1696
 *     if not getRSSFromProcStatus(encoded_proc_status, &rss_in_bytes):
 *         raise ValueError("Failed to parse VmRSS from proc status")
 *     return rss_in_bytes             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_rss_in_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1690
 * 
 * 
 * def _rss_from_proc_status_for_testing(str proc_status):             # <<<<<<<<<<<<<<
 *     cdef cppstring encoded_proc_status = proc_status.encode("utf-8")
 *     cdef size_t rss_in_bytes
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray._rss_from_proc_status_for_testing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1720
 *     cdef HighWaterMarkAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation, "HighWaterMarkAggregatorTestHarness.add_allocation(self, tid, address, size, allocator, native_frame_id, frame_index, native_segment_generation)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation = {"add_allocation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tid = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_allocator = 0;
  PyObject *__pyx_v_native_frame_id = 0;
  PyObject *__pyx_v_frame_index = 0;
  PyObject *__pyx_v_native_segment_generation = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_allocation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_address_2,&__pyx_mstate_global->__pyx_n_u_size_2,&__pyx_mstate_global->__pyx_n_u_allocator,&__pyx_mstate_global->__pyx_n_u_native_frame_id,&__pyx_mstate_global->__pyx_n_u_frame_index,&__pyx_mstate_global->__pyx_n_u_native_segment_generation,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1720, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add_allocation", 0) < (0)) __PYX_ERR(0, 1720, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 7; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_allocation", 1, 7, 7, i); __PYX_ERR(0, 1720, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 7)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1720, __pyx_L3_error)
      values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1720, __pyx_L3_error)
    }
    __pyx_v_tid = values[0];
    __pyx_v_address = values[1];
    __pyx_v_size = values[2];
    __pyx_v_allocator = values[3];
    __pyx_v_native_frame_id = values[4];
    __pyx_v_frame_index = values[5];
    __pyx_v_native_segment_generation = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_allocation", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1720, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.add_allocation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_address, __pyx_v_size, __pyx_v_allocator, __pyx_v_native_frame_id, __pyx_v_frame_index, __pyx_v_native_segment_generation);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_address, PyObject *__pyx_v_size, PyObject *__pyx_v_allocator, PyObject *__pyx_v_native_frame_id, PyObject *__pyx_v_frame_index, PyObject *__pyx_v_native_segment_generation) {
  memray::tracking_api::Allocation __pyx_v_allocation;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  memray::tracking_api::thread_id_t __pyx_t_1;
  uintptr_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  memray::tracking_api::frame_id_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_allocation", 0);

  /* "memray/_memray.pyx":1731
 *     ):
 *         cdef _Allocation allocation
 *         allocation.tid = tid             # <<<<<<<<<<<<<<
 *         allocation.address = address
 *         allocation.size = size
*/
  __pyx_t_1 = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L1_error)
  __pyx_v_allocation.tid = __pyx_t_1;

  /* "memray/_memray.pyx":1732
 *         cdef _Allocation allocation
 *         allocation.tid = tid
 *         allocation.address = address             # <<<<<<<<<<<<<<
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator
*/
  __pyx_t_2 = __Pyx_PyLong_As_size_t(__pyx_v_address); if (unlikely((__pyx_t_2 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1732, __pyx_L1_error)
  __pyx_v_allocation.address = __pyx_t_2;

  /* "memray/_memray.pyx":1733
 *         allocation.tid = tid
 *         allocation.address = address
 *         allocation.size = size             # <<<<<<<<<<<<<<
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_size); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1733, __pyx_L1_error)
  __pyx_v_allocation.size = __pyx_t_3;

  /* "memray/_memray.pyx":1734
 *         allocation.address = address
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator             # <<<<<<<<<<<<<<
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index
*/
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_allocator); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L1_error)
  __pyx_v_allocation.allocator = ((memray::hooks::Allocator)((int)__pyx_t_4));

  /* "memray/_memray.pyx":1735
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id             # <<<<<<<<<<<<<<
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation
*/
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_v_native_frame_id); if (unlikely((__pyx_t_5 == ((memray::tracking_api::frame_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1735, __pyx_L1_error)
  __pyx_v_allocation.native_frame_id = __pyx_t_5;

  /* "memray/_memray.pyx":1736
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index             # <<<<<<<<<<<<<<
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_frame_index); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1736, __pyx_L1_error)
  __pyx_v_allocation.frame_index = __pyx_t_3;

  /* "memray/_memray.pyx":1737
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation             # <<<<<<<<<<<<<<
 *         allocation.n_allocations = 1
 *         self.aggregator.addAllocation(allocation)
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_native_segment_generation); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L1_error)
  __pyx_v_allocation.native_segment_generation = __pyx_t_3;

  /* "memray/_memray.pyx":1738
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1             # <<<<<<<<<<<<<<
 *         self.aggregator.addAllocation(allocation)
 * 
*/
  __pyx_v_allocation.n_allocations = 1;

  /* "memray/_memray.pyx":1739
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1
 *         self.aggregator.addAllocation(allocation)             # <<<<<<<<<<<<<<
 * 
 *     def capture_snapshot(self):
*/
  try {
    __pyx_v_self->aggregator.addAllocation(__pyx_v_allocation);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1739, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1720
 *     cdef HighWaterMarkAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.add_allocation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1741
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot, "HighWaterMarkAggregatorTestHarness.capture_snapshot(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot = {"capture_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("capture_snapshot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("capture_snapshot", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("capture_snapshot", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("capture_snapshot", 0);

  /* "memray/_memray.pyx":1742
 * 
 *     def capture_snapshot(self):
 *         return self.aggregator.captureSnapshot()             # <<<<<<<<<<<<<<
 * 
 *     def high_water_mark_bytes_by_snapshot(self):
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_v_self->aggregator.captureSnapshot();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1742, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1741
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.capture_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1744
 *         return self.aggregator.captureSnapshot()
 * 
 *     def high_water_mark_bytes_by_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot, "HighWaterMarkAggregatorTestHarness.high_water_mark_bytes_by_snapshot(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot = {"high_water_mark_bytes_by_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("high_water_mark_bytes_by_snapshot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("high_water_mark_bytes_by_snapshot", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("high_water_mark_bytes_by_snapshot", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::vector<size_t>  __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("high_water_mark_bytes_by_snapshot", 0);

  /* "memray/_memray.pyx":1745
 * 
 *     def high_water_mark_bytes_by_snapshot(self):
 *         return self.aggregator.highWaterMarkBytesBySnapshot()             # <<<<<<<<<<<<<<
 * 
 *     def get_current_heap_size(self):
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->aggregator.highWaterMarkBytesBySnapshot();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1745, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_convert_vector_to_py_size_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1744
 *         return self.aggregator.captureSnapshot()
 * 
 *     def high_water_mark_bytes_by_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.high_water_mark_bytes_by_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1747
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
 *     def get_current_heap_size(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.getCurrentHeapSize()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size, "HighWaterMarkAggregatorTestHarness.get_current_heap_size(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size = {"get_current_heap_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_current_heap_size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_current_heap_size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_current_heap_size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_current_heap_size", 0);

  /* "memray/_memray.pyx":1748
 * 
 *     def get_current_heap_size(self):
 *         return self.aggregator.getCurrentHeapSize()             # <<<<<<<<<<<<<<
 * 
 *     def get_temporal_allocations(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_FromSize_t(__pyx_v_self->aggregator.getCurrentHeapSize()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1747
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
 *     def get_current_heap_size(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.getCurrentHeapSize()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.get_current_heap_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_10generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1750
 *         return self.aggregator.getCurrentHeapSize()
 * 
 *     def get_temporal_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations, "HighWaterMarkAggregatorTestHarness.get_temporal_allocations(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations = {"get_temporal_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporal_allocations (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_temporal_allocations", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_temporal_allocations", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_temporal_allocations", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1750, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_10generator10, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_temporal_allocations, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1750, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.get_temporal_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_10generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  std::vector<memray::api::AllocationLifetime>  __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_temporal_allocations", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L4_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1750, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1752
 *     def get_temporal_allocations(self):
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()             # <<<<<<<<<<<<<<
 *         gen.setup(move(self.aggregator.generateIndex()), reader)
 *         yield from gen
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __pyx_cur_scope->__pyx_v_gen = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1753
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(self.aggregator.generateIndex()), reader)             # <<<<<<<<<<<<<<
 *         yield from gen
 * 
*/
  try {
    __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->aggregator.generateIndex();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1753, __pyx_L1_error)
  }
  __pyx_t_1 = ((struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *)__pyx_cur_scope->__pyx_v_gen->__pyx_vtab)->setup(__pyx_cur_scope->__pyx_v_gen, cython_std::move<std::vector<memray::api::AllocationLifetime> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4)), __pyx_cur_scope->__pyx_v_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1754
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(self.aggregator.generateIndex()), reader)
 *         yield from gen             # <<<<<<<<<<<<<<
 * 
 *     def get_allocations(self):
*/
  __pyx_t_5 = __Pyx_Generator_Yield_From(__pyx_generator, ((PyObject *)__pyx_cur_scope->__pyx_v_gen), &__pyx_r);
  if (likely(__pyx_t_5 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L4_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1754, __pyx_L1_error)
  } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1754, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1750
 *         return self.aggregator.getCurrentHeapSize()
 * 
 *     def get_temporal_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_temporal_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1756
 *         yield from gen
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations, "HighWaterMarkAggregatorTestHarness.get_allocations(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations = {"get_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_allocations (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_allocations", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_allocations", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_v_ret = NULL;
  memray::tracking_api::AggregatedAllocation __pyx_v_allocation;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<memray::tracking_api::AggregatedAllocation>  __pyx_t_2;
  std::vector<memray::tracking_api::AggregatedAllocation> ::iterator __pyx_t_3;
  std::vector<memray::tracking_api::AggregatedAllocation>  __pyx_t_4;
  memray::tracking_api::AggregatedAllocation __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_allocations", 0);

  /* "memray/_memray.pyx":1757
 * 
 *     def get_allocations(self):
 *         ret = []             # <<<<<<<<<<<<<<
 *         for allocation in collectAllocations(self.aggregator):
 *             ret.append(
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1758
 *     def get_allocations(self):
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):             # <<<<<<<<<<<<<<
 *             ret.append(
 *                 dict(
*/
  try {
    __pyx_t_2 = collectAllocations(__pyx_v_self->aggregator);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1758, __pyx_L1_error)
  }
  __pyx_t_4 = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2);
  __pyx_t_3 = __pyx_t_4.begin();
  for (; __pyx_t_3 != __pyx_t_4.end(); ++__pyx_t_3) {
    __pyx_t_5 = *__pyx_t_3;
    __pyx_v_allocation = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5);

    /* "memray/_memray.pyx":1761
 *             ret.append(
 *                 dict(
 *                     tid=allocation.tid,             # <<<<<<<<<<<<<<
 *                     allocator=AllocatorType(<int>allocation.allocator),
 *                     native_frame_id=allocation.native_frame_id,
*/
    __pyx_t_1 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyLong_From_memray_3a__3a_tracking_api_3a__3a_thread_id_t(__pyx_v_allocation.tid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_tid, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1762
 *                 dict(
 *                     tid=allocation.tid,
 *                     allocator=AllocatorType(<int>allocation.allocator),             # <<<<<<<<<<<<<<
 *                     native_frame_id=allocation.native_frame_id,
 *                     frame_index=allocation.frame_index,
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_AllocatorType); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyLong_From_int(((int)__pyx_v_allocation.allocator)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_10 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_allocator, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1763
 *                     tid=allocation.tid,
 *                     allocator=AllocatorType(<int>allocation.allocator),
 *                     native_frame_id=allocation.native_frame_id,             # <<<<<<<<<<<<<<
 *                     frame_index=allocation.frame_index,
 *                     native_segment_generation=allocation.native_segment_generation,
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.native_frame_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_native_frame_id, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1764
 *                     allocator=AllocatorType(<int>allocation.allocator),
 *                     native_frame_id=allocation.native_frame_id,
 *                     frame_index=allocation.frame_index,             # <<<<<<<<<<<<<<
 *                     native_segment_generation=allocation.native_segment_generation,
 *                     n_allocations_in_high_water_mark=allocation.n_allocations_in_high_water_mark,
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.frame_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_frame_index, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1765
 *                     native_frame_id=allocation.native_frame_id,
 *                     frame_index=allocation.frame_index,
 *                     native_segment_generation=allocation.native_segment_generation,             # <<<<<<<<<<<<<<
 *                     n_allocations_in_high_water_mark=allocation.n_allocations_in_high_water_mark,
 *                     n_allocations_leaked=allocation.n_allocations_leaked,
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.native_segment_generation); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_native_segment_generation, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1766
 *                     frame_index=allocation.frame_index,
 *                     native_segment_generation=allocation.native_segment_generation,
 *                     n_allocations_in_high_water_mark=allocation.n_allocations_in_high_water_mark,             # <<<<<<<<<<<<<<
 *                     n_allocations_leaked=allocation.n_allocations_leaked,
 *                     bytes_in_high_water_mark=allocation.bytes_in_high_water_mark,
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.n_allocations_in_high_water_mark); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_n_allocations_in_high_water_mark, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1767
 *                     native_segment_generation=allocation.native_segment_generation,
 *                     n_allocations_in_high_water_mark=allocation.n_allocations_in_high_water_mark,
 *                     n_allocations_leaked=allocation.n_allocations_leaked,             # <<<<<<<<<<<<<<
 *                     bytes_in_high_water_mark=allocation.bytes_in_high_water_mark,
 *                     bytes_leaked=allocation.bytes_leaked,
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.n_allocations_leaked); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_n_allocations_leaked, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1768
 *                     n_allocations_in_high_water_mark=allocation.n_allocations_in_high_water_mark,
 *                     n_allocations_leaked=allocation.n_allocations_leaked,
 *                     bytes_in_high_water_mark=allocation.bytes_in_high_water_mark,             # <<<<<<<<<<<<<<
 *                     bytes_leaked=allocation.bytes_leaked,
 *                 )
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.bytes_in_high_water_mark); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_bytes_in_high_water_mark, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1769
 *                     n_allocations_leaked=allocation.n_allocations_leaked,
 *                     bytes_in_high_water_mark=allocation.bytes_in_high_water_mark,
 *                     bytes_leaked=allocation.bytes_leaked,             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/
    __pyx_t_6 = __Pyx_PyLong_FromSize_t(__pyx_v_allocation.bytes_leaked); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_bytes_leaked, __pyx_t_6) < (0)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "memray/_memray.pyx":1759
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):
 *             ret.append(             # <<<<<<<<<<<<<<
 *                 dict(
 *                     tid=allocation.tid,
*/
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1759, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "memray/_memray.pyx":1758
 *     def get_allocations(self):
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):             # <<<<<<<<<<<<<<
 *             ret.append(
 *                 dict(
*/
  }

  /* "memray/_memray.pyx":1772
 *                 )
 *             )
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1756
 *         yield from gen
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.get_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__, "HighWaterMarkAggregatorTestHarness.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_aggregator_cannot_be_conver, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__, "HighWaterMarkAggregatorTestHarness.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__(((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_aggregator_cannot_be_conver, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.HighWaterMarkAggregatorTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1778
 *     cdef AllocationLifetimeAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation, "AllocationLifetimeAggregatorTestHarness.add_allocation(self, tid, address, size, allocator, native_frame_id, frame_index, native_segment_generation)");
static PyMethodDef __pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation = {"add_allocation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation};
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_tid = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_allocator = 0;
  PyObject *__pyx_v_native_frame_id = 0;
  PyObject *__pyx_v_frame_index = 0;
  PyObject *__pyx_v_native_segment_generation = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_allocation (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_address_2,&__pyx_mstate_global->__pyx_n_u_size_2,&__pyx_mstate_global->__pyx_n_u_allocator,&__pyx_mstate_global->__pyx_n_u_native_frame_id,&__pyx_mstate_global->__pyx_n_u_frame_index,&__pyx_mstate_global->__pyx_n_u_native_segment_generation,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1778, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1778, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add_allocation", 0) < (0)) __PYX_ERR(0, 1778, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 7; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_allocation", 1, 7, 7, i); __PYX_ERR(0, 1778, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 7)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1778, __pyx_L3_error)
      values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1778, __pyx_L3_error)
    }
    __pyx_v_tid = values[0];
    __pyx_v_address = values[1];
    __pyx_v_size = values[2];
    __pyx_v_allocator = values[3];
    __pyx_v_native_frame_id = values[4];
    __pyx_v_frame_index = values[5];
    __pyx_v_native_segment_generation = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_allocation", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1778, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.add_allocation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation(((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_address, __pyx_v_size, __pyx_v_allocator, __pyx_v_native_frame_id, __pyx_v_frame_index, __pyx_v_native_segment_generation);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_address, PyObject *__pyx_v_size, PyObject *__pyx_v_allocator, PyObject *__pyx_v_native_frame_id, PyObject *__pyx_v_frame_index, PyObject *__pyx_v_native_segment_generation) {
  memray::tracking_api::Allocation __pyx_v_allocation;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  memray::tracking_api::thread_id_t __pyx_t_1;
  uintptr_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  memray::tracking_api::frame_id_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_allocation", 0);

  /* "memray/_memray.pyx":1789
 *     ):
 *         cdef _Allocation allocation
 *         allocation.tid = tid             # <<<<<<<<<<<<<<
 *         allocation.address = address
 *         allocation.size = size
*/
  __pyx_t_1 = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1789, __pyx_L1_error)
  __pyx_v_allocation.tid = __pyx_t_1;

  /* "memray/_memray.pyx":1790
 *         cdef _Allocation allocation
 *         allocation.tid = tid
 *         allocation.address = address             # <<<<<<<<<<<<<<
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator
*/
  __pyx_t_2 = __Pyx_PyLong_As_size_t(__pyx_v_address); if (unlikely((__pyx_t_2 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1790, __pyx_L1_error)
  __pyx_v_allocation.address = __pyx_t_2;

  /* "memray/_memray.pyx":1791
 *         allocation.tid = tid
 *         allocation.address = address
 *         allocation.size = size             # <<<<<<<<<<<<<<
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_size); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1791, __pyx_L1_error)
  __pyx_v_allocation.size = __pyx_t_3;

  /* "memray/_memray.pyx":1792
 *         allocation.address = address
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator             # <<<<<<<<<<<<<<
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index
*/
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_allocator); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1792, __pyx_L1_error)
  __pyx_v_allocation.allocator = ((memray::hooks::Allocator)((int)__pyx_t_4));

  /* "memray/_memray.pyx":1793
 *         allocation.size = size
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id             # <<<<<<<<<<<<<<
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation
*/
  __pyx_t_5 = __Pyx_PyLong_As_size_t(__pyx_v_native_frame_id); if (unlikely((__pyx_t_5 == ((memray::tracking_api::frame_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1793, __pyx_L1_error)
  __pyx_v_allocation.native_frame_id = __pyx_t_5;

  /* "memray/_memray.pyx":1794
 *         allocation.allocator = <Allocator><int>allocator
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index             # <<<<<<<<<<<<<<
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_frame_index); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1794, __pyx_L1_error)
  __pyx_v_allocation.frame_index = __pyx_t_3;

  /* "memray/_memray.pyx":1795
 *         allocation.native_frame_id = native_frame_id
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation             # <<<<<<<<<<<<<<
 *         allocation.n_allocations = 1
 *         self.aggregator.addAllocation(allocation)
*/
  __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_v_native_segment_generation); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1795, __pyx_L1_error)
  __pyx_v_allocation.native_segment_generation = __pyx_t_3;

  /* "memray/_memray.pyx":1796
 *         allocation.frame_index = frame_index
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1             # <<<<<<<<<<<<<<
 *         self.aggregator.addAllocation(allocation)
 * 
*/
  __pyx_v_allocation.n_allocations = 1;

  /* "memray/_memray.pyx":1797
 *         allocation.native_segment_generation = native_segment_generation
 *         allocation.n_allocations = 1
 *         self.aggregator.addAllocation(allocation)             # <<<<<<<<<<<<<<
 * 
 *     def capture_snapshot(self):
*/
  try {
    __pyx_v_self->aggregator.addAllocation(__pyx_v_allocation);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1797, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1778
 *     cdef AllocationLifetimeAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.add_allocation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1799
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot, "AllocationLifetimeAggregatorTestHarness.capture_snapshot(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot = {"capture_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot};
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("capture_snapshot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("capture_snapshot", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("capture_snapshot", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot(((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("capture_snapshot", 0);

  /* "memray/_memray.pyx":1800
 * 
 *     def capture_snapshot(self):
 *         return self.aggregator.captureSnapshot()             # <<<<<<<<<<<<<<
 * 
 *     def get_allocations(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_void_to_None(__pyx_v_self->aggregator.captureSnapshot()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1799
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.capture_snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_6generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "memray/_memray.pyx":1802
 *         return self.aggregator.captureSnapshot()
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations, "AllocationLifetimeAggregatorTestHarness.get_allocations(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations = {"get_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations};
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_allocations (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_allocations", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_allocations", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations(((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_allocations", 0);
  __pyx_cur_scope = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_12_get_allocations(__pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1802, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_6generator11, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_allocations, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest, __pyx_mstate_global->__pyx_n_u_memray__memray); if (unlikely(!gen)) __PYX_ERR(0, 1802, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.get_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_6generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *__pyx_cur_scope = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  std::vector<memray::api::AllocationLifetime>  __pyx_t_4;
  __Pyx_PySendResult __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_allocations", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L4_resume_from_yield_from;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1802, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1804
 *     def get_allocations(self):
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()             # <<<<<<<<<<<<<<
 *         gen.setup(move(self.aggregator.generateIndex()), reader)
 *         yield from gen
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __Pyx_GIVEREF((PyObject *)__pyx_t_1);
  __pyx_cur_scope->__pyx_v_gen = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1805
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(self.aggregator.generateIndex()), reader)             # <<<<<<<<<<<<<<
 *         yield from gen
 * 
*/
  try {
    __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->aggregator.generateIndex();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1805, __pyx_L1_error)
  }
  __pyx_t_1 = ((struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator *)__pyx_cur_scope->__pyx_v_gen->__pyx_vtab)->setup(__pyx_cur_scope->__pyx_v_gen, cython_std::move<std::vector<memray::api::AllocationLifetime> >(__PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4)), __pyx_cur_scope->__pyx_v_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1806
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
 *         gen.setup(move(self.aggregator.generateIndex()), reader)
 *         yield from gen             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = __Pyx_Generator_Yield_From(__pyx_generator, ((PyObject *)__pyx_cur_scope->__pyx_v_gen), &__pyx_r);
  if (likely(__pyx_t_5 == PYGEN_NEXT)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L4_resume_from_yield_from:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1806, __pyx_L1_error)
  } else if (likely(__pyx_t_5 == PYGEN_RETURN)) {
    __Pyx_GOTREF(__pyx_r);
    __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  } else {
    __Pyx_XGOTREF(__pyx_r);
    __PYX_ERR(0, 1806, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "memray/_memray.pyx":1802
 *         return self.aggregator.captureSnapshot()
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("get_allocations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__, "AllocationLifetimeAggregatorTestHarness.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__(((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_aggregator_cannot_be_conver, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__, "AllocationLifetimeAggregatorTestHarness.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__(((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_aggregator_cannot_be_conver, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.AllocationLifetimeAggregatorTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1814
 *     cdef unique_ptr[RecordWriter] _writer
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         str file_path,
*/

/* Python wrapper */
static int __pyx_pw_6memray_7_memray_23RecordWriterTestHarness_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6memray_7_memray_23RecordWriterTestHarness_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file_path = 0;
  bool __pyx_v_native_traces;
  bool __pyx_v_trace_python_allocators;
  PyObject *__pyx_v_track_object_lifetimes = 0;
  enum memray::tracking_api::FileFormat __pyx_v_file_format;
  memray::tracking_api::thread_id_t __pyx_v_main_tid;
  size_t __pyx_v_skipped_frames;
  PyObject *__pyx_v_command_line = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_file_path,&__pyx_mstate_global->__pyx_n_u_native_traces,&__pyx_mstate_global->__pyx_n_u_trace_python_allocators,&__pyx_mstate_global->__pyx_n_u_track_object_lifetimes,&__pyx_mstate_global->__pyx_n_u_file_format,&__pyx_mstate_global->__pyx_n_u_main_tid,&__pyx_mstate_global->__pyx_n_u_skipped_frames,&__pyx_mstate_global->__pyx_n_u_command_line,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1814, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 1814, __pyx_L3_error)

      /* "memray/_memray.pyx":1819
 *         bool native_traces=False,
 *         bool trace_python_allocators=False,
 *         track_object_lifetimes=False,             # <<<<<<<<<<<<<<
 *         records.FileFormat file_format=records.FileFormat.ALL_ALLOCATIONS,
 *         records.thread_id_t main_tid=1,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u_memray_test_harness));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 8, i); __PYX_ERR(0, 1814, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1814, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1814, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u_memray_test_harness));
    }
    __pyx_v_file_path = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_native_traces = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_native_traces == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1817, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":1817
 *         self,
 *         str file_path,
 *         bool native_traces=False,             # <<<<<<<<<<<<<<
 *         bool trace_python_allocators=False,
 *         track_object_lifetimes=False,
*/
      __pyx_v_native_traces = ((bool)0);
    }
    if (values[2]) {
      __pyx_v_trace_python_allocators = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_trace_python_allocators == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L3_error)
    } else {

      /* "memray/_memray.pyx":1818
 *         str file_path,
 *         bool native_traces=False,
 *         bool trace_python_allocators=False,             # <<<<<<<<<<<<<<
 *         track_object_lifetimes=False,
 *         records.FileFormat file_format=records.FileFormat.ALL_ALLOCATIONS,
*/
      __pyx_v_trace_python_allocators = ((bool)0);
    }
    __pyx_v_track_object_lifetimes = values[3];
    if (values[4]) {
      __pyx_v_file_format = ((enum memray::tracking_api::FileFormat)__Pyx_PyLong_As_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(values[4])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1820, __pyx_L3_error)
    } else {
      __pyx_v_file_format = __pyx_mstate_global->__pyx_k__10;
    }
    if (values[5]) {
      __pyx_v_main_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[5]); if (unlikely((__pyx_v_main_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1821, __pyx_L3_error)
    } else {
      __pyx_v_main_tid = ((memray::tracking_api::thread_id_t)1);
    }
    if (values[6]) {
      __pyx_v_skipped_frames = __Pyx_PyLong_As_size_t(values[6]); if (unlikely((__pyx_v_skipped_frames == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1822, __pyx_L3_error)
    } else {
      __pyx_v_skipped_frames = ((size_t)0);
    }
    __pyx_v_command_line = ((PyObject*)values[7]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 8, __pyx_nargs); __PYX_ERR(0, 1814, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_path), (&PyUnicode_Type), 1, "file_path", 1))) __PYX_ERR(0, 1816, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_command_line), (&PyUnicode_Type), 1, "command_line", 1))) __PYX_ERR(0, 1823, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness___cinit__(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_file_path, __pyx_v_native_traces, __pyx_v_trace_python_allocators, __pyx_v_track_object_lifetimes, __pyx_v_file_format, __pyx_v_main_tid, __pyx_v_skipped_frames, __pyx_v_command_line);

  /* "memray/_memray.pyx":1814
 *     cdef unique_ptr[RecordWriter] _writer
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         str file_path,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6memray_7_memray_23RecordWriterTestHarness___cinit__(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, PyObject *__pyx_v_file_path, bool __pyx_v_native_traces, bool __pyx_v_trace_python_allocators, PyObject *__pyx_v_track_object_lifetimes, enum memray::tracking_api::FileFormat __pyx_v_file_format, memray::tracking_api::thread_id_t __pyx_v_main_tid, size_t __pyx_v_skipped_frames, PyObject *__pyx_v_command_line) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::string __pyx_t_2;
  memray::io::FileSink *__pyx_t_3;
  bool __pyx_t_4;
  std::unique_ptr<memray::tracking_api::RecordWriter>  __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "memray/_memray.pyx":1835
 *         """
 *         self._writer = createRecordWriter(
 *             unique_ptr[Sink](new FileSink(file_path.encode('utf-8'), True, False)),             # <<<<<<<<<<<<<<
 *             command_line.encode(),
 *             native_traces,
*/
  if (unlikely(__pyx_v_file_path == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1835, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_file_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1835, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  try {
    __pyx_t_3 = new memray::io::FileSink(__pyx_t_2, 1, 0);
  } catch(...) {
    try { throw; } catch(const std::exception& exn) {PyErr_SetString((PyObject*)(((PyTypeObject*)PyExc_IOError)), exn.what());} catch(...) { PyErr_SetNone((PyObject*)(((PyTypeObject*)PyExc_IOError))); }
    __PYX_ERR(0, 1835, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1836
 *         self._writer = createRecordWriter(
 *             unique_ptr[Sink](new FileSink(file_path.encode('utf-8'), True, False)),
 *             command_line.encode(),             # <<<<<<<<<<<<<<
 *             native_traces,
 *             file_format,
*/
  if (unlikely(__pyx_v_command_line == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1836, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsEncodedString(__pyx_v_command_line, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1840
 *             file_format,
 *             trace_python_allocators,
 *             track_object_lifetimes,             # <<<<<<<<<<<<<<
 *         )
 *         self._writer.get().setMainTidAndSkippedFrames(main_tid, skipped_frames)
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_track_object_lifetimes); if (unlikely((__pyx_t_4 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1840, __pyx_L1_error)

  /* "memray/_memray.pyx":1834
 *             file_format: The format of the output file
 *         """
 *         self._writer = createRecordWriter(             # <<<<<<<<<<<<<<
 *             unique_ptr[Sink](new FileSink(file_path.encode('utf-8'), True, False)),
 *             command_line.encode(),
*/
  try {
    __pyx_t_5 = memray::tracking_api::createRecordWriter(std::unique_ptr<memray::io::Sink> (__pyx_t_3), __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2), __pyx_v_native_traces, __pyx_v_file_format, __pyx_v_trace_python_allocators, __pyx_t_4);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1834, __pyx_L1_error)
  }
  __pyx_v_self->_writer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5);

  /* "memray/_memray.pyx":1842
 *             track_object_lifetimes,
 *         )
 *         self._writer.get().setMainTidAndSkippedFrames(main_tid, skipped_frames)             # <<<<<<<<<<<<<<
 *         self.write_header(False)
 * 
*/
  try {
    __pyx_v_self->_writer.get()->setMainTidAndSkippedFrames(__pyx_v_main_tid, __pyx_v_skipped_frames);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1842, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1843
 *         )
 *         self._writer.get().setMainTidAndSkippedFrames(main_tid, skipped_frames)
 *         self.write_header(False)             # <<<<<<<<<<<<<<
 * 
 *     def write_header(self, bool seek_to_start) -> None:
*/
  __pyx_t_6 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, Py_False};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write_header, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1814
 *     cdef unique_ptr[RecordWriter] _writer
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         str file_path,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1845
 *         self.write_header(False)
 * 
 *     def write_header(self, bool seek_to_start) -> None:             # <<<<<<<<<<<<<<
 *         if not self._writer.get().writeHeader(seek_to_start):
 *             raise RuntimeError("Failed to write header")
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_3write_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_2write_header, "RecordWriterTestHarness.write_header(self, bool seek_to_start) -> None");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_3write_header = {"write_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_3write_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_2write_header};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_3write_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  bool __pyx_v_seek_to_start;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_header (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seek_to_start,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1845, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1845, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_header", 0) < (0)) __PYX_ERR(0, 1845, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_header", 1, 1, 1, i); __PYX_ERR(0, 1845, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1845, __pyx_L3_error)
    }
    __pyx_v_seek_to_start = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_seek_to_start == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1845, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_header", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1845, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_2write_header(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_seek_to_start);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_2write_header(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, bool __pyx_v_seek_to_start) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_header", 0);

  /* "memray/_memray.pyx":1846
 * 
 *     def write_header(self, bool seek_to_start) -> None:
 *         if not self._writer.get().writeHeader(seek_to_start):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("Failed to write header")
 * 
*/
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeHeader(__pyx_v_seek_to_start);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1846, __pyx_L1_error)
  }
  __pyx_t_2 = (!(__pyx_t_1 != 0));
  if (unlikely(__pyx_t_2)) {

    /* "memray/_memray.pyx":1847
 *     def write_header(self, bool seek_to_start) -> None:
 *         if not self._writer.get().writeHeader(seek_to_start):
 *             raise RuntimeError("Failed to write header")             # <<<<<<<<<<<<<<
 * 
 *     def write_memory_record(self, uint64_t ms_since_epoch, size_t rss) -> bool:
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Failed_to_write_header};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1847, __pyx_L1_error)

    /* "memray/_memray.pyx":1846
 * 
 *     def write_header(self, bool seek_to_start) -> None:
 *         if not self._writer.get().writeHeader(seek_to_start):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("Failed to write header")
 * 
*/
  }

  /* "memray/_memray.pyx":1845
 *         self.write_header(False)
 * 
 *     def write_header(self, bool seek_to_start) -> None:             # <<<<<<<<<<<<<<
 *         if not self._writer.get().writeHeader(seek_to_start):
 *             raise RuntimeError("Failed to write header")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1849
 *             raise RuntimeError("Failed to write header")
 * 
 *     def write_memory_record(self, uint64_t ms_since_epoch, size_t rss) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a memory record to the file."""
 *         cdef records.MemoryRecord record
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record, "RecordWriterTestHarness.write_memory_record(self, uint64_t ms_since_epoch, size_t rss) -> bool\n\nWrite a memory record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record = {"write_memory_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  uint64_t __pyx_v_ms_since_epoch;
  size_t __pyx_v_rss;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_memory_record (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ms_since_epoch,&__pyx_mstate_global->__pyx_n_u_rss,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1849, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1849, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1849, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_memory_record", 0) < (0)) __PYX_ERR(0, 1849, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_memory_record", 1, 2, 2, i); __PYX_ERR(0, 1849, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1849, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1849, __pyx_L3_error)
    }
    __pyx_v_ms_since_epoch = __Pyx_PyLong_As_uint64_t(values[0]); if (unlikely((__pyx_v_ms_since_epoch == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1849, __pyx_L3_error)
    __pyx_v_rss = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_rss == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1849, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_memory_record", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1849, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_memory_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_ms_since_epoch, __pyx_v_rss);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, uint64_t __pyx_v_ms_since_epoch, size_t __pyx_v_rss) {
  struct memray::tracking_api::MemoryRecord __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_memory_record", 0);

  /* "memray/_memray.pyx":1852
 *         """Write a memory record to the file."""
 *         cdef records.MemoryRecord record
 *         record.ms_since_epoch = ms_since_epoch             # <<<<<<<<<<<<<<
 *         record.rss = rss
 *         return self._writer.get().writeRecord(record)
*/
  __pyx_v_record.ms_since_epoch = __pyx_v_ms_since_epoch;

  /* "memray/_memray.pyx":1853
 *         cdef records.MemoryRecord record
 *         record.ms_since_epoch = ms_since_epoch
 *         record.rss = rss             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeRecord(record)
 * 
*/
  __pyx_v_record.rss = __pyx_v_rss;

  /* "memray/_memray.pyx":1854
 *         record.ms_since_epoch = ms_since_epoch
 *         record.rss = rss
 *         return self._writer.get().writeRecord(record)             # <<<<<<<<<<<<<<
 * 
 *     def write_code_object(
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeRecord(__pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1854, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1849
 *             raise RuntimeError("Failed to write header")
 * 
 *     def write_memory_record(self, uint64_t ms_since_epoch, size_t rss) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a memory record to the file."""
 *         cdef records.MemoryRecord record
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_memory_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1856
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_code_object(             # <<<<<<<<<<<<<<
 *         self,
 *         records.code_object_id_t id,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_7write_code_object(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_6write_code_object, "RecordWriterTestHarness.write_code_object(self, code_object_id_t id, str function_name, str filename, bytes linetable, int firstlineno) -> bool\n\nWrite a code object record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_7write_code_object = {"write_code_object", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_7write_code_object, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_6write_code_object};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_7write_code_object(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::code_object_id_t __pyx_v_id;
  PyObject *__pyx_v_function_name = 0;
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_linetable = 0;
  int __pyx_v_firstlineno;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_code_object (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_function_name,&__pyx_mstate_global->__pyx_n_u_filename,&__pyx_mstate_global->__pyx_n_u_linetable,&__pyx_mstate_global->__pyx_n_u_firstlineno,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1856, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_code_object", 0) < (0)) __PYX_ERR(0, 1856, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_code_object", 1, 5, 5, i); __PYX_ERR(0, 1856, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1856, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1856, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1856, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1856, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1856, __pyx_L3_error)
    }
    __pyx_v_id = __Pyx_PyLong_As_size_t(values[0]); if (unlikely((__pyx_v_id == ((memray::tracking_api::code_object_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1858, __pyx_L3_error)
    __pyx_v_function_name = ((PyObject*)values[1]);
    __pyx_v_filename = ((PyObject*)values[2]);
    __pyx_v_linetable = ((PyObject*)values[3]);
    __pyx_v_firstlineno = __Pyx_PyLong_As_int(values[4]); if (unlikely((__pyx_v_firstlineno == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1862, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_code_object", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1856, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_code_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_function_name), (&PyUnicode_Type), 1, "function_name", 1))) __PYX_ERR(0, 1859, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyUnicode_Type), 1, "filename", 1))) __PYX_ERR(0, 1860, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_linetable), (&PyBytes_Type), 1, "linetable", 1))) __PYX_ERR(0, 1861, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_6write_code_object(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_id, __pyx_v_function_name, __pyx_v_filename, __pyx_v_linetable, __pyx_v_firstlineno);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_6write_code_object(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::code_object_id_t __pyx_v_id, PyObject *__pyx_v_function_name, PyObject *__pyx_v_filename, PyObject *__pyx_v_linetable, int __pyx_v_firstlineno) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct memray::tracking_api::CodeObjectInfo __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  std::string __pyx_t_3;
  std::pair<memray::tracking_api::code_object_id_t,struct memray::tracking_api::CodeObjectInfo>  __pyx_t_4;
  bool __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_code_object", 0);

  /* "memray/_memray.pyx":1865
 *     ) -> bool:
 *         """Write a code object record to the file."""
 *         return self._writer.get().writeRecord(             # <<<<<<<<<<<<<<
 *             pair[records.code_object_id_t, records.CodeObjectInfo](
 *                 id,
*/
  __Pyx_XDECREF(__pyx_r);

  /* "memray/_memray.pyx":1869
 *                 id,
 *                 records.CodeObjectInfo(
 *                     function_name.encode(),             # <<<<<<<<<<<<<<
 *                     filename.encode(),
 *                     linetable,
*/
  if (unlikely(__pyx_v_function_name == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1869, __pyx_L1_error)
  }
  __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_function_name, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1.function_name = __pyx_t_3;

  /* "memray/_memray.pyx":1870
 *                 records.CodeObjectInfo(
 *                     function_name.encode(),
 *                     filename.encode(),             # <<<<<<<<<<<<<<
 *                     linetable,
 *                     firstlineno,
*/
  if (unlikely(__pyx_v_filename == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1870, __pyx_L1_error)
  }
  __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_filename, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1.filename = __pyx_t_3;

  /* "memray/_memray.pyx":1871
 *                     function_name.encode(),
 *                     filename.encode(),
 *                     linetable,             # <<<<<<<<<<<<<<
 *                     firstlineno,
 *                 )
*/
  __pyx_t_3 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_linetable); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1871, __pyx_L1_error)
  __pyx_t_1.linetable = __pyx_t_3;

  /* "memray/_memray.pyx":1872
 *                     filename.encode(),
 *                     linetable,
 *                     firstlineno,             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/
  __pyx_t_1.firstlineno = __pyx_v_firstlineno;

  /* "memray/_memray.pyx":1866
 *         """Write a code object record to the file."""
 *         return self._writer.get().writeRecord(
 *             pair[records.code_object_id_t, records.CodeObjectInfo](             # <<<<<<<<<<<<<<
 *                 id,
 *                 records.CodeObjectInfo(
*/
  try {
    __pyx_t_4 = std::pair<memray::tracking_api::code_object_id_t,struct memray::tracking_api::CodeObjectInfo> (__pyx_v_id, __pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1866, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":1865
 *     ) -> bool:
 *         """Write a code object record to the file."""
 *         return self._writer.get().writeRecord(             # <<<<<<<<<<<<<<
 *             pair[records.code_object_id_t, records.CodeObjectInfo](
 *                 id,
*/
  try {
    __pyx_t_5 = __pyx_v_self->_writer.get()->writeRecord(__pyx_t_4);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1865, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1856
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_code_object(             # <<<<<<<<<<<<<<
 *         self,
 *         records.code_object_id_t id,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_code_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1877
 *         )
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_linetable(code_object):
 *         """Get the linetable from a code object."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_9get_linetable(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_8get_linetable, "RecordWriterTestHarness.get_linetable(code_object)\n\nGet the linetable from a code object.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_9get_linetable = {"get_linetable", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_9get_linetable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_8get_linetable};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_9get_linetable(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_code_object = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_linetable (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_code_object,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1877, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1877, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_linetable", 0) < (0)) __PYX_ERR(0, 1877, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_linetable", 1, 1, 1, i); __PYX_ERR(0, 1877, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1877, __pyx_L3_error)
    }
    __pyx_v_code_object = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_linetable", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1877, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.get_linetable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_8get_linetable(__pyx_v_code_object);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_8get_linetable(PyObject *__pyx_v_code_object) {
  char const *__pyx_v_addr;
  size_t __pyx_v_size;
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_linetable", 0);

  /* "memray/_memray.pyx":1882
 *         cdef const char* addr
 *         cdef size_t size
 *         import types             # <<<<<<<<<<<<<<
 *         if not isinstance(code_object, types.CodeType):
 *             raise TypeError("Expected a code object")
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_types, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_types = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1883
 *         cdef size_t size
 *         import types
 *         if not isinstance(code_object, types.CodeType):             # <<<<<<<<<<<<<<
 *             raise TypeError("Expected a code object")
 *         addr = codeGetLinetable(<PyCodeObject*>code_object, &size)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_types, __pyx_mstate_global->__pyx_n_u_CodeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_code_object, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1883, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1884
 *         import types
 *         if not isinstance(code_object, types.CodeType):
 *             raise TypeError("Expected a code object")             # <<<<<<<<<<<<<<
 *         addr = codeGetLinetable(<PyCodeObject*>code_object, &size)
 *         return <bytes>addr[:size]
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Expected_a_code_object};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1884, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1884, __pyx_L1_error)

    /* "memray/_memray.pyx":1883
 *         cdef size_t size
 *         import types
 *         if not isinstance(code_object, types.CodeType):             # <<<<<<<<<<<<<<
 *             raise TypeError("Expected a code object")
 *         addr = codeGetLinetable(<PyCodeObject*>code_object, &size)
*/
  }

  /* "memray/_memray.pyx":1885
 *         if not isinstance(code_object, types.CodeType):
 *             raise TypeError("Expected a code object")
 *         addr = codeGetLinetable(<PyCodeObject*>code_object, &size)             # <<<<<<<<<<<<<<
 *         return <bytes>addr[:size]
 * 
*/
  __pyx_v_addr = memray::compat::codeGetLinetable(((PyCodeObject *)__pyx_v_code_object), (&__pyx_v_size));

  /* "memray/_memray.pyx":1886
 *             raise TypeError("Expected a code object")
 *         addr = codeGetLinetable(<PyCodeObject*>code_object, &size)
 *         return <bytes>addr[:size]             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_addr + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1877
 *         )
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_linetable(code_object):
 *         """Get the linetable from a code object."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.get_linetable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1888
 *         return <bytes>addr[:size]
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_lasti(frame_object):
 *         """Get the linetable from a code object."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_11get_lasti(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_10get_lasti, "RecordWriterTestHarness.get_lasti(frame_object)\n\nGet the linetable from a code object.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_11get_lasti = {"get_lasti", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_11get_lasti, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_10get_lasti};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_11get_lasti(CYTHON_UNUSED PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_frame_object = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_lasti (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_frame_object,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1888, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1888, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_lasti", 0) < (0)) __PYX_ERR(0, 1888, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_lasti", 1, 1, 1, i); __PYX_ERR(0, 1888, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1888, __pyx_L3_error)
    }
    __pyx_v_frame_object = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_lasti", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1888, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.get_lasti", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_10get_lasti(__pyx_v_frame_object);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_10get_lasti(PyObject *__pyx_v_frame_object) {
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_lasti", 0);

  /* "memray/_memray.pyx":1891
 *     def get_lasti(frame_object):
 *         """Get the linetable from a code object."""
 *         import types             # <<<<<<<<<<<<<<
 *         if not isinstance(frame_object, types.FrameType):
 *             raise TypeError("Expected a frame object")
*/
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_types, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1891, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_types = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1892
 *         """Get the linetable from a code object."""
 *         import types
 *         if not isinstance(frame_object, types.FrameType):             # <<<<<<<<<<<<<<
 *             raise TypeError("Expected a frame object")
 *         return frameGetLasti(<PyFrameObject*>frame_object)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_types, __pyx_mstate_global->__pyx_n_u_FrameType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_frame_object, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (unlikely(__pyx_t_4)) {

    /* "memray/_memray.pyx":1893
 *         import types
 *         if not isinstance(frame_object, types.FrameType):
 *             raise TypeError("Expected a frame object")             # <<<<<<<<<<<<<<
 *         return frameGetLasti(<PyFrameObject*>frame_object)
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Expected_a_frame_object};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1893, __pyx_L1_error)

    /* "memray/_memray.pyx":1892
 *         """Get the linetable from a code object."""
 *         import types
 *         if not isinstance(frame_object, types.FrameType):             # <<<<<<<<<<<<<<
 *             raise TypeError("Expected a frame object")
 *         return frameGetLasti(<PyFrameObject*>frame_object)
*/
  }

  /* "memray/_memray.pyx":1894
 *         if not isinstance(frame_object, types.FrameType):
 *             raise TypeError("Expected a frame object")
 *         return frameGetLasti(<PyFrameObject*>frame_object)             # <<<<<<<<<<<<<<
 * 
 *     def write_unresolved_native_frame(self, uintptr_t ip, size_t index) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(memray::compat::frameGetLasti(((PyFrameObject *)__pyx_v_frame_object))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1888
 *         return <bytes>addr[:size]
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_lasti(frame_object):
 *         """Get the linetable from a code object."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.get_lasti", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1896
 *         return frameGetLasti(<PyFrameObject*>frame_object)
 * 
 *     def write_unresolved_native_frame(self, uintptr_t ip, size_t index) -> bool:             # <<<<<<<<<<<<<<
 *         """Write an unresolved native frame record to the file."""
 *         cdef records.UnresolvedNativeFrame record
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame, "RecordWriterTestHarness.write_unresolved_native_frame(self, uintptr_t ip, size_t index) -> bool\n\nWrite an unresolved native frame record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame = {"write_unresolved_native_frame", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  uintptr_t __pyx_v_ip;
  size_t __pyx_v_index;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_unresolved_native_frame (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ip,&__pyx_mstate_global->__pyx_n_u_index,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1896, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_unresolved_native_frame", 0) < (0)) __PYX_ERR(0, 1896, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_unresolved_native_frame", 1, 2, 2, i); __PYX_ERR(0, 1896, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1896, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1896, __pyx_L3_error)
    }
    __pyx_v_ip = __Pyx_PyLong_As_size_t(values[0]); if (unlikely((__pyx_v_ip == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1896, __pyx_L3_error)
    __pyx_v_index = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_index == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1896, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_unresolved_native_frame", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1896, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_unresolved_native_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_ip, __pyx_v_index);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, uintptr_t __pyx_v_ip, size_t __pyx_v_index) {
  struct memray::tracking_api::UnresolvedNativeFrame __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_unresolved_native_frame", 0);

  /* "memray/_memray.pyx":1899
 *         """Write an unresolved native frame record to the file."""
 *         cdef records.UnresolvedNativeFrame record
 *         record.ip = ip             # <<<<<<<<<<<<<<
 *         record.index = index
 *         return self._writer.get().writeRecord(record)
*/
  __pyx_v_record.ip = __pyx_v_ip;

  /* "memray/_memray.pyx":1900
 *         cdef records.UnresolvedNativeFrame record
 *         record.ip = ip
 *         record.index = index             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeRecord(record)
 * 
*/
  __pyx_v_record.index = __pyx_v_index;

  /* "memray/_memray.pyx":1901
 *         record.ip = ip
 *         record.index = index
 *         return self._writer.get().writeRecord(record)             # <<<<<<<<<<<<<<
 * 
 *     def write_allocation_record(self, records.thread_id_t tid, uintptr_t address,
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeRecord(__pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1901, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1896
 *         return frameGetLasti(<PyFrameObject*>frame_object)
 * 
 *     def write_unresolved_native_frame(self, uintptr_t ip, size_t index) -> bool:             # <<<<<<<<<<<<<<
 *         """Write an unresolved native frame record to the file."""
 *         cdef records.UnresolvedNativeFrame record
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_unresolved_native_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1903
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_allocation_record(self, records.thread_id_t tid, uintptr_t address,             # <<<<<<<<<<<<<<
 *                                      size_t size, unsigned char allocator,
 *                                      size_t native_frame_id=0) -> bool:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record, "RecordWriterTestHarness.write_allocation_record(self, thread_id_t tid, uintptr_t address, size_t size, unsigned char allocator, size_t native_frame_id=0) -> bool\n\nWrite a native allocation record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record = {"write_allocation_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::thread_id_t __pyx_v_tid;
  uintptr_t __pyx_v_address;
  size_t __pyx_v_size;
  unsigned char __pyx_v_allocator;
  size_t __pyx_v_native_frame_id;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_allocation_record (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_address_2,&__pyx_mstate_global->__pyx_n_u_size_2,&__pyx_mstate_global->__pyx_n_u_allocator,&__pyx_mstate_global->__pyx_n_u_native_frame_id,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1903, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_allocation_record", 0) < (0)) __PYX_ERR(0, 1903, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_allocation_record", 0, 4, 5, i); __PYX_ERR(0, 1903, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1903, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1903, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1903, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1903, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1903, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[0]); if (unlikely((__pyx_v_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1903, __pyx_L3_error)
    __pyx_v_address = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_address == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1903, __pyx_L3_error)
    __pyx_v_size = __Pyx_PyLong_As_size_t(values[2]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1904, __pyx_L3_error)
    __pyx_v_allocator = __Pyx_PyLong_As_unsigned_char(values[3]); if (unlikely((__pyx_v_allocator == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 1904, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_native_frame_id = __Pyx_PyLong_As_size_t(values[4]); if (unlikely((__pyx_v_native_frame_id == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1905, __pyx_L3_error)
    } else {
      __pyx_v_native_frame_id = ((size_t)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_allocation_record", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 1903, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_allocation_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_address, __pyx_v_size, __pyx_v_allocator, __pyx_v_native_frame_id);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, uintptr_t __pyx_v_address, size_t __pyx_v_size, unsigned char __pyx_v_allocator, size_t __pyx_v_native_frame_id) {
  struct memray::tracking_api::AllocationRecord __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_allocation_record", 0);

  /* "memray/_memray.pyx":1908
 *         """Write a native allocation record to the file."""
 *         cdef records.AllocationRecord record
 *         record.address = address             # <<<<<<<<<<<<<<
 *         record.size = size
 *         record.allocator = <records.Allocator>allocator
*/
  __pyx_v_record.address = __pyx_v_address;

  /* "memray/_memray.pyx":1909
 *         cdef records.AllocationRecord record
 *         record.address = address
 *         record.size = size             # <<<<<<<<<<<<<<
 *         record.allocator = <records.Allocator>allocator
 *         record.native_frame_id = native_frame_id
*/
  __pyx_v_record.size = __pyx_v_size;

  /* "memray/_memray.pyx":1910
 *         record.address = address
 *         record.size = size
 *         record.allocator = <records.Allocator>allocator             # <<<<<<<<<<<<<<
 *         record.native_frame_id = native_frame_id
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
*/
  __pyx_v_record.allocator = ((memray::hooks::Allocator)__pyx_v_allocator);

  /* "memray/_memray.pyx":1911
 *         record.size = size
 *         record.allocator = <records.Allocator>allocator
 *         record.native_frame_id = native_frame_id             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
*/
  __pyx_v_record.native_frame_id = __pyx_v_native_frame_id;

  /* "memray/_memray.pyx":1912
 *         record.allocator = <records.Allocator>allocator
 *         record.native_frame_id = native_frame_id
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)             # <<<<<<<<<<<<<<
 * 
 *     def write_frame_push(
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeThreadSpecificRecord(__pyx_v_tid, __pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1912, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1903
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_allocation_record(self, records.thread_id_t tid, uintptr_t address,             # <<<<<<<<<<<<<<
 *                                      size_t size, unsigned char allocator,
 *                                      size_t native_frame_id=0) -> bool:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_allocation_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1914
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_push(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push, "RecordWriterTestHarness.write_frame_push(self, thread_id_t tid, code_object_id_t code_object_id, int instruction_offset, bool is_entry_frame) -> bool\n\nWrite a frame push record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push = {"write_frame_push", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::thread_id_t __pyx_v_tid;
  memray::tracking_api::code_object_id_t __pyx_v_code_object_id;
  int __pyx_v_instruction_offset;
  bool __pyx_v_is_entry_frame;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_frame_push (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_code_object_id,&__pyx_mstate_global->__pyx_n_u_instruction_offset,&__pyx_mstate_global->__pyx_n_u_is_entry_frame,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1914, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1914, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1914, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1914, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1914, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_frame_push", 0) < (0)) __PYX_ERR(0, 1914, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_frame_push", 1, 4, 4, i); __PYX_ERR(0, 1914, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1914, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1914, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1914, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1914, __pyx_L3_error)
    }
    __pyx_v_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[0]); if (unlikely((__pyx_v_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1916, __pyx_L3_error)
    __pyx_v_code_object_id = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_code_object_id == ((memray::tracking_api::code_object_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1917, __pyx_L3_error)
    __pyx_v_instruction_offset = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_instruction_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1918, __pyx_L3_error)
    __pyx_v_is_entry_frame = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_is_entry_frame == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1919, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_frame_push", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1914, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_frame_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_code_object_id, __pyx_v_instruction_offset, __pyx_v_is_entry_frame);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, memray::tracking_api::code_object_id_t __pyx_v_code_object_id, int __pyx_v_instruction_offset, bool __pyx_v_is_entry_frame) {
  struct memray::tracking_api::FramePush __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_frame_push", 0);

  /* "memray/_memray.pyx":1923
 *         """Write a frame push record to the file."""
 *         cdef records.FramePush record
 *         record.frame.code_object_id = code_object_id             # <<<<<<<<<<<<<<
 *         record.frame.instruction_offset = instruction_offset
 *         record.frame.is_entry_frame = is_entry_frame
*/
  __pyx_v_record.frame.code_object_id = __pyx_v_code_object_id;

  /* "memray/_memray.pyx":1924
 *         cdef records.FramePush record
 *         record.frame.code_object_id = code_object_id
 *         record.frame.instruction_offset = instruction_offset             # <<<<<<<<<<<<<<
 *         record.frame.is_entry_frame = is_entry_frame
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
*/
  __pyx_v_record.frame.instruction_offset = __pyx_v_instruction_offset;

  /* "memray/_memray.pyx":1925
 *         record.frame.code_object_id = code_object_id
 *         record.frame.instruction_offset = instruction_offset
 *         record.frame.is_entry_frame = is_entry_frame             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
*/
  __pyx_v_record.frame.is_entry_frame = __pyx_v_is_entry_frame;

  /* "memray/_memray.pyx":1926
 *         record.frame.instruction_offset = instruction_offset
 *         record.frame.is_entry_frame = is_entry_frame
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)             # <<<<<<<<<<<<<<
 * 
 *     def write_frame_pop(self, records.thread_id_t tid, size_t count) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeThreadSpecificRecord(__pyx_v_tid, __pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1926, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1914
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_push(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_frame_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1928
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_pop(self, records.thread_id_t tid, size_t count) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a frame pop record to the file."""
 *         cdef records.FramePop record
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop, "RecordWriterTestHarness.write_frame_pop(self, thread_id_t tid, size_t count) -> bool\n\nWrite a frame pop record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop = {"write_frame_pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::thread_id_t __pyx_v_tid;
  size_t __pyx_v_count;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_frame_pop (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_count,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1928, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1928, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1928, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_frame_pop", 0) < (0)) __PYX_ERR(0, 1928, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_frame_pop", 1, 2, 2, i); __PYX_ERR(0, 1928, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1928, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1928, __pyx_L3_error)
    }
    __pyx_v_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[0]); if (unlikely((__pyx_v_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1928, __pyx_L3_error)
    __pyx_v_count = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_count == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1928, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_frame_pop", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1928, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_frame_pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_count);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, size_t __pyx_v_count) {
  struct memray::tracking_api::FramePop __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_frame_pop", 0);

  /* "memray/_memray.pyx":1931
 *         """Write a frame pop record to the file."""
 *         cdef records.FramePop record
 *         record.count = count             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
*/
  __pyx_v_record.count = __pyx_v_count;

  /* "memray/_memray.pyx":1932
 *         cdef records.FramePop record
 *         record.count = count
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)             # <<<<<<<<<<<<<<
 * 
 *     def write_thread_record(self, records.thread_id_t tid, str name) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeThreadSpecificRecord(__pyx_v_tid, __pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1932, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1928
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_pop(self, records.thread_id_t tid, size_t count) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a frame pop record to the file."""
 *         cdef records.FramePop record
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_frame_pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1934
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_thread_record(self, records.thread_id_t tid, str name) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a thread record to the file."""
 *         cdef records.ThreadRecord record
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record, "RecordWriterTestHarness.write_thread_record(self, thread_id_t tid, str name) -> bool\n\nWrite a thread record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record = {"write_thread_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::thread_id_t __pyx_v_tid;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_thread_record (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_name_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1934, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1934, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1934, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_thread_record", 0) < (0)) __PYX_ERR(0, 1934, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_thread_record", 1, 2, 2, i); __PYX_ERR(0, 1934, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1934, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1934, __pyx_L3_error)
    }
    __pyx_v_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[0]); if (unlikely((__pyx_v_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1934, __pyx_L3_error)
    __pyx_v_name = ((PyObject*)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_thread_record", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1934, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_thread_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 1934, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_name);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, PyObject *__pyx_v_name) {
  struct memray::tracking_api::ThreadRecord __pyx_v_record;
  PyObject *__pyx_v_name_bytes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  bool __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_thread_record", 0);

  /* "memray/_memray.pyx":1937
 *         """Write a thread record to the file."""
 *         cdef records.ThreadRecord record
 *         cdef bytes name_bytes = name.encode('utf-8')             # <<<<<<<<<<<<<<
 *         record.name = name_bytes
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
*/
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1937, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_bytes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1938
 *         cdef records.ThreadRecord record
 *         cdef bytes name_bytes = name.encode('utf-8')
 *         record.name = name_bytes             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
*/
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_name_bytes); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1938, __pyx_L1_error)
  __pyx_v_record.name = __pyx_t_2;

  /* "memray/_memray.pyx":1939
 *         cdef bytes name_bytes = name.encode('utf-8')
 *         record.name = name_bytes
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)             # <<<<<<<<<<<<<<
 * 
 *     def write_mappings(self, list mappings) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_3 = __pyx_v_self->_writer.get()->writeThreadSpecificRecord(__pyx_v_tid, __pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1939, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1934
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_thread_record(self, records.thread_id_t tid, str name) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a thread record to the file."""
 *         cdef records.ThreadRecord record
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_thread_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name_bytes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1941
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_mappings(self, list mappings) -> bool:             # <<<<<<<<<<<<<<
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_23write_mappings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_22write_mappings, "RecordWriterTestHarness.write_mappings(self, list mappings) -> bool\n\nWrite memory mappings to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_23write_mappings = {"write_mappings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_23write_mappings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_22write_mappings};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_23write_mappings(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_mappings = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_mappings (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mappings,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1941, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1941, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_mappings", 0) < (0)) __PYX_ERR(0, 1941, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_mappings", 1, 1, 1, i); __PYX_ERR(0, 1941, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1941, __pyx_L3_error)
    }
    __pyx_v_mappings = ((PyObject*)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_mappings", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1941, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_mappings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mappings), (&PyList_Type), 1, "mappings", 1))) __PYX_ERR(0, 1941, __pyx_L1_error)
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_22write_mappings(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_mappings);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_22write_mappings(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, PyObject *__pyx_v_mappings) {
  PyObject *__pyx_8genexpr4__pyx_v_mapping = NULL;
  PyObject *__pyx_8genexpr5__pyx_v_seg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  std::string __pyx_t_9;
  uintptr_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  std::vector<struct memray::tracking_api::Segment>  __pyx_t_14;
  std::vector<struct memray::tracking_api::ImageSegments>  __pyx_t_15;
  bool __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_mappings", 0);

  /* "memray/_memray.pyx":1943
 *     def write_mappings(self, list mappings) -> bool:
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(             # <<<<<<<<<<<<<<
 *             [
 *                 records.ImageSegments(
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */

    /* "memray/_memray.pyx":1944
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(
 *             [             # <<<<<<<<<<<<<<
 *                 records.ImageSegments(
 *                     mapping['filename'].encode('utf-8'),
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1944, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "memray/_memray.pyx":1953
 *                     ],
 *                 )
 *                 for mapping in mappings             # <<<<<<<<<<<<<<
 *             ]
 *         )
*/
    if (unlikely(__pyx_v_mappings == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1953, __pyx_L5_error)
    }
    __pyx_t_2 = __pyx_v_mappings; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1953, __pyx_L5_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1953, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_mapping, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "memray/_memray.pyx":1945
 *         return self._writer.get().writeMappings(
 *             [
 *                 records.ImageSegments(             # <<<<<<<<<<<<<<
 *                     mapping['filename'].encode('utf-8'),
 *                     mapping['addr'],
*/
      __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1945, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "memray/_memray.pyx":1946
 *             [
 *                 records.ImageSegments(
 *                     mapping['filename'].encode('utf-8'),             # <<<<<<<<<<<<<<
 *                     mapping['addr'],
 *                     [
*/
      __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr4__pyx_v_mapping, __pyx_mstate_global->__pyx_n_u_filename); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1946, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1946, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1946, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1946, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_filename, __pyx_t_5) < (0)) __PYX_ERR(0, 1945, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "memray/_memray.pyx":1947
 *                 records.ImageSegments(
 *                     mapping['filename'].encode('utf-8'),
 *                     mapping['addr'],             # <<<<<<<<<<<<<<
 *                     [
 *                         records.Segment(seg["vaddr"], seg["memsz"])
*/
      __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr4__pyx_v_mapping, __pyx_mstate_global->__pyx_n_u_addr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1947, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyLong_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_10 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1947, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyLong_FromSize_t(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1947, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_addr, __pyx_t_5) < (0)) __PYX_ERR(0, 1945, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      { /* enter inner scope */

        /* "memray/_memray.pyx":1948
 *                     mapping['filename'].encode('utf-8'),
 *                     mapping['addr'],
 *                     [             # <<<<<<<<<<<<<<
 *                         records.Segment(seg["vaddr"], seg["memsz"])
 *                         for seg in mapping["segments"]
*/
        __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1948, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "memray/_memray.pyx":1950
 *                     [
 *                         records.Segment(seg["vaddr"], seg["memsz"])
 *                         for seg in mapping["segments"]             # <<<<<<<<<<<<<<
 *                     ],
 *                 )
*/
        __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr4__pyx_v_mapping, __pyx_mstate_global->__pyx_n_u_segments); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1950, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
          __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6);
          __pyx_t_11 = 0;
          __pyx_t_12 = NULL;
        } else {
          __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1950, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1950, __pyx_L10_error)
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        for (;;) {
          if (likely(!__pyx_t_12)) {
            if (likely(PyList_CheckExact(__pyx_t_6))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1950, __pyx_L10_error)
                #endif
                if (__pyx_t_11 >= __pyx_temp) break;
              }
              __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_11;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1950, __pyx_L10_error)
                #endif
                if (__pyx_t_11 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11));
              #else
              __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_11);
              #endif
              ++__pyx_t_11;
            }
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1950, __pyx_L10_error)
          } else {
            __pyx_t_7 = __pyx_t_12(__pyx_t_6);
            if (unlikely(!__pyx_t_7)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1950, __pyx_L10_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_seg, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "memray/_memray.pyx":1949
 *                     mapping['addr'],
 *                     [
 *                         records.Segment(seg["vaddr"], seg["memsz"])             # <<<<<<<<<<<<<<
 *                         for seg in mapping["segments"]
 *                     ],
*/
          __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr5__pyx_v_seg, __pyx_mstate_global->__pyx_n_u_vaddr); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_10 = __Pyx_PyLong_As_size_t(__pyx_t_13); if (unlikely((__pyx_t_10 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyLong_FromSize_t(__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_vaddr, __pyx_t_13) < (0)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr5__pyx_v_seg, __pyx_mstate_global->__pyx_n_u_memsz); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_8 = __Pyx_PyLong_As_size_t(__pyx_t_13); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyLong_FromSize_t(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_memsz, __pyx_t_13) < (0)) __PYX_ERR(0, 1949, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1948, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "memray/_memray.pyx":1950
 *                     [
 *                         records.Segment(seg["vaddr"], seg["memsz"])
 *                         for seg in mapping["segments"]             # <<<<<<<<<<<<<<
 *                     ],
 *                 )
*/
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_seg); __pyx_8genexpr5__pyx_v_seg = 0;
        goto __pyx_L14_exit_scope;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_seg); __pyx_8genexpr5__pyx_v_seg = 0;
        goto __pyx_L5_error;
        __pyx_L14_exit_scope:;
      } /* exit inner scope */

      /* "memray/_memray.pyx":1948
 *                     mapping['filename'].encode('utf-8'),
 *                     mapping['addr'],
 *                     [             # <<<<<<<<<<<<<<
 *                         records.Segment(seg["vaddr"], seg["memsz"])
 *                         for seg in mapping["segments"]
*/
      __pyx_t_14 = __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1948, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_convert_vector_to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1948, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_segments, __pyx_t_5) < (0)) __PYX_ERR(0, 1945, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1944, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "memray/_memray.pyx":1953
 *                     ],
 *                 )
 *                 for mapping in mappings             # <<<<<<<<<<<<<<
 *             ]
 *         )
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_mapping); __pyx_8genexpr4__pyx_v_mapping = 0;
    goto __pyx_L16_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_mapping); __pyx_8genexpr4__pyx_v_mapping = 0;
    goto __pyx_L1_error;
    __pyx_L16_exit_scope:;
  } /* exit inner scope */

  /* "memray/_memray.pyx":1944
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(
 *             [             # <<<<<<<<<<<<<<
 *                 records.ImageSegments(
 *                     mapping['filename'].encode('utf-8'),
*/
  __pyx_t_15 = __pyx_convert_vector_from_py_struct__memray_3a__3a_tracking_api_3a__3a_ImageSegments(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "memray/_memray.pyx":1943
 *     def write_mappings(self, list mappings) -> bool:
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(             # <<<<<<<<<<<<<<
 *             [
 *                 records.ImageSegments(
*/
  try {
    __pyx_t_16 = __pyx_v_self->_writer.get()->writeMappings(__pyx_t_15);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1943, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1941
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_mappings(self, list mappings) -> bool:             # <<<<<<<<<<<<<<
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_mappings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_mapping);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_seg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1957
 *         )
 * 
 *     def write_object_record(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_25write_object_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_24write_object_record, "RecordWriterTestHarness.write_object_record(self, thread_id_t tid, uintptr_t address, bool is_created, frame_id_t native_frame_id=0) -> bool\n\nWrite an object tracking record to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_25write_object_record = {"write_object_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_25write_object_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_24write_object_record};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_25write_object_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  memray::tracking_api::thread_id_t __pyx_v_tid;
  uintptr_t __pyx_v_address;
  bool __pyx_v_is_created;
  memray::tracking_api::frame_id_t __pyx_v_native_frame_id;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_object_record (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_tid,&__pyx_mstate_global->__pyx_n_u_address_2,&__pyx_mstate_global->__pyx_n_u_is_created,&__pyx_mstate_global->__pyx_n_u_native_frame_id,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1957, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1957, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1957, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1957, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1957, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_object_record", 0) < (0)) __PYX_ERR(0, 1957, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_object_record", 0, 3, 4, i); __PYX_ERR(0, 1957, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1957, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1957, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1957, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1957, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tid = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(values[0]); if (unlikely((__pyx_v_tid == ((memray::tracking_api::thread_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1959, __pyx_L3_error)
    __pyx_v_address = __Pyx_PyLong_As_size_t(values[1]); if (unlikely((__pyx_v_address == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1960, __pyx_L3_error)
    __pyx_v_is_created = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_is_created == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1961, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_native_frame_id = __Pyx_PyLong_As_size_t(values[3]); if (unlikely((__pyx_v_native_frame_id == ((memray::tracking_api::frame_id_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1962, __pyx_L3_error)
    } else {
      __pyx_v_native_frame_id = ((memray::tracking_api::frame_id_t)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_object_record", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1957, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_object_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_24write_object_record(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v_tid, __pyx_v_address, __pyx_v_is_created, __pyx_v_native_frame_id);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_24write_object_record(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, memray::tracking_api::thread_id_t __pyx_v_tid, uintptr_t __pyx_v_address, bool __pyx_v_is_created, memray::tracking_api::frame_id_t __pyx_v_native_frame_id) {
  memray::tracking_api::ObjectRecord __pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_object_record", 0);

  /* "memray/_memray.pyx":1966
 *         """Write an object tracking record to the file."""
 *         cdef records.ObjectRecord record
 *         record.address = address             # <<<<<<<<<<<<<<
 *         record.is_created = is_created
 *         record.native_frame_id = native_frame_id
*/
  __pyx_v_record.address = __pyx_v_address;

  /* "memray/_memray.pyx":1967
 *         cdef records.ObjectRecord record
 *         record.address = address
 *         record.is_created = is_created             # <<<<<<<<<<<<<<
 *         record.native_frame_id = native_frame_id
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
*/
  __pyx_v_record.is_created = __pyx_v_is_created;

  /* "memray/_memray.pyx":1968
 *         record.address = address
 *         record.is_created = is_created
 *         record.native_frame_id = native_frame_id             # <<<<<<<<<<<<<<
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
*/
  __pyx_v_record.native_frame_id = __pyx_v_native_frame_id;

  /* "memray/_memray.pyx":1969
 *         record.is_created = is_created
 *         record.native_frame_id = native_frame_id
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)             # <<<<<<<<<<<<<<
 * 
 *     def write_trailer(self) -> bool:
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeThreadSpecificRecord(__pyx_v_tid, __pyx_v_record);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1969, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1957
 *         )
 * 
 *     def write_object_record(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_object_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "memray/_memray.pyx":1971
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_trailer(self) -> bool:             # <<<<<<<<<<<<<<
 *         """Write the trailer to the file."""
 *         return self._writer.get().writeTrailer()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_27write_trailer(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_26write_trailer, "RecordWriterTestHarness.write_trailer(self) -> bool\n\nWrite the trailer to the file.");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_27write_trailer = {"write_trailer", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_27write_trailer, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_26write_trailer};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_27write_trailer(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_trailer (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("write_trailer", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("write_trailer", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_26write_trailer(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_26write_trailer(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_trailer", 0);

  /* "memray/_memray.pyx":1973
 *     def write_trailer(self) -> bool:
 *         """Write the trailer to the file."""
 *         return self._writer.get().writeTrailer()             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_writer.get()->writeTrailer();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1973, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "memray/_memray.pyx":1971
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_trailer(self) -> bool:             # <<<<<<<<<<<<<<
 *         """Write the trailer to the file."""
 *         return self._writer.get().writeTrailer()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.write_trailer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__, "RecordWriterTestHarness.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__, "RecordWriterTestHarness.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__};
static PyObject *__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__(((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("memray._memray.RecordWriterTestHarness.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */

static PyObject *__pyx_tp_new_6memray_7_memray_AllocationRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_AllocationRecord *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_AllocationRecord > 0) & __PYX_CHECK_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, sizeof(struct __pyx_obj_6memray_7_memray_AllocationRecord))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray_AllocationRecord[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray_AllocationRecord];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray_AllocationRecord));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)o);
  __Pyx_default_placement_construct(&(p->_reader));
  p->_tuple = Py_None; Py_INCREF(Py_None);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_AllocationRecord(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_AllocationRecord *p = (struct __pyx_obj_6memray_7_memray_AllocationRecord *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_AllocationRecord) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_reader);
  Py_CLEAR(p->_tuple);
  Py_CLEAR(p->_stack_trace_cache);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_AllocationRecord < 1024) & __PYX_CHECK_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, sizeof(struct __pyx_obj_6memray_7_memray_AllocationRecord))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray_AllocationRecord[__pyx_mstate_global->__pyx_freecount_6memray_7_memray_AllocationRecord++] = ((struct __pyx_obj_6memray_7_memray_AllocationRecord *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray_AllocationRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_AllocationRecord *p = (struct __pyx_obj_6memray_7_memray_AllocationRecord *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_tuple) {
    e = (*v)(p->_tuple, a); if (e) return e;
  }
  if (p->_stack_trace_cache) {
    e = (*v)(p->_stack_trace_cache, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_AllocationRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_AllocationRecord *p = (struct __pyx_obj_6memray_7_memray_AllocationRecord *)o;
  tmp = ((PyObject*)p->_tuple);
  p->_tuple = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_stack_trace_cache);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_6memray_7_memray_AllocationRecord(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_6memray_7_memray_16AllocationRecord_3__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_6memray_7_memray_16AllocationRecord_3__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_tid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_3tid_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_address(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_7address_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_4size_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_allocator(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_9allocator_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_8stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_n_allocations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_13n_allocations_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_native_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_15native_stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_native_segment_generation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_25native_segment_generation_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_16AllocationRecord_thread_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_16AllocationRecord_11thread_name_1__get__(o);
}

static PyMethodDef __pyx_methods_6memray_7_memray_AllocationRecord[] = {
  {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_6stack_trace},
  {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_8native_stack_trace},
  {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_10hybrid_stack_trace},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_14__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_16AllocationRecord_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_16AllocationRecord_16__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_AllocationRecord[] = {
  {"tid", __pyx_getprop_6memray_7_memray_16AllocationRecord_tid, 0, 0, 0},
  {"address", __pyx_getprop_6memray_7_memray_16AllocationRecord_address, 0, 0, 0},
  {"size", __pyx_getprop_6memray_7_memray_16AllocationRecord_size, 0, 0, 0},
  {"allocator", __pyx_getprop_6memray_7_memray_16AllocationRecord_allocator, 0, 0, 0},
  {"stack_id", __pyx_getprop_6memray_7_memray_16AllocationRecord_stack_id, 0, 0, 0},
  {"n_allocations", __pyx_getprop_6memray_7_memray_16AllocationRecord_n_allocations, 0, 0, 0},
  {"native_stack_id", __pyx_getprop_6memray_7_memray_16AllocationRecord_native_stack_id, 0, 0, 0},
  {"native_segment_generation", __pyx_getprop_6memray_7_memray_16AllocationRecord_native_segment_generation, 0, 0, 0},
  {"thread_name", __pyx_getprop_6memray_7_memray_16AllocationRecord_thread_name, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_AllocationRecord_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_AllocationRecord},
  {Py_tp_repr, (void *)__pyx_pw_6memray_7_memray_16AllocationRecord_13__repr__},
  {Py_tp_hash, (void *)__pyx_pw_6memray_7_memray_16AllocationRecord_5__hash__},
  {Py_tp_doc, (void *)PyDoc_STR("AllocationRecord(record)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_AllocationRecord},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_AllocationRecord},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_6memray_7_memray_AllocationRecord},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_AllocationRecord},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_AllocationRecord},
  {Py_tp_init, (void *)__pyx_pw_6memray_7_memray_16AllocationRecord_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_AllocationRecord},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_AllocationRecord_spec = {
  "memray._memray.AllocationRecord",
  sizeof(struct __pyx_obj_6memray_7_memray_AllocationRecord),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_AllocationRecord_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_AllocationRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""AllocationRecord", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_AllocationRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_AllocationRecord, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6memray_7_memray_16AllocationRecord_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_6memray_7_memray_16AllocationRecord_5__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("AllocationRecord(record)"), /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_AllocationRecord, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_AllocationRecord, /*tp_clear*/
  __pyx_tp_richcompare_6memray_7_memray_AllocationRecord, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_AllocationRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_AllocationRecord, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6memray_7_memray_16AllocationRecord_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_AllocationRecord, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_TrackedObjectRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TrackedObjectRecord > 0) & __PYX_CHECK_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, sizeof(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray_TrackedObjectRecord[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TrackedObjectRecord];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)o);
  __Pyx_default_placement_construct(&(p->_reader));
  p->_tuple = Py_None; Py_INCREF(Py_None);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_TrackedObjectRecord(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *p = (struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_TrackedObjectRecord) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_reader);
  Py_CLEAR(p->_tuple);
  Py_CLEAR(p->_stack_trace_cache);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TrackedObjectRecord < 1024) & __PYX_CHECK_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, sizeof(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray_TrackedObjectRecord[__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TrackedObjectRecord++] = ((struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray_TrackedObjectRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *p = (struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_tuple) {
    e = (*v)(p->_tuple, a); if (e) return e;
  }
  if (p->_stack_trace_cache) {
    e = (*v)(p->_stack_trace_cache, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_TrackedObjectRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *p = (struct __pyx_obj_6memray_7_memray_TrackedObjectRecord *)o;
  tmp = ((PyObject*)p->_tuple);
  p->_tuple = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_stack_trace_cache);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_6memray_7_memray_TrackedObjectRecord(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_3__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_6memray_7_memray_19TrackedObjectRecord_3__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_tid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_3tid_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_address(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_7address_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_is_created(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_10is_created_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_8stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_native_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_15native_stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_native_segment_generation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_25native_segment_generation_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_19TrackedObjectRecord_thread_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_19TrackedObjectRecord_11thread_name_1__get__(o);
}

static PyMethodDef __pyx_methods_6memray_7_memray_TrackedObjectRecord[] = {
  {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_6stack_trace},
  {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_8native_stack_trace},
  {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_10hybrid_stack_trace},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_14__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_19TrackedObjectRecord_16__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_TrackedObjectRecord[] = {
  {"tid", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_tid, 0, 0, 0},
  {"address", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_address, 0, 0, 0},
  {"is_created", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_is_created, 0, 0, 0},
  {"stack_id", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_stack_id, 0, 0, 0},
  {"native_stack_id", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_native_stack_id, 0, 0, 0},
  {"native_segment_generation", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_native_segment_generation, 0, 0, 0},
  {"thread_name", __pyx_getprop_6memray_7_memray_19TrackedObjectRecord_thread_name, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_TrackedObjectRecord_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_repr, (void *)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_13__repr__},
  {Py_tp_hash, (void *)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_5__hash__},
  {Py_tp_doc, (void *)PyDoc_STR("TrackedObjectRecord(record)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_TrackedObjectRecord},
  {Py_tp_init, (void *)__pyx_pw_6memray_7_memray_19TrackedObjectRecord_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_TrackedObjectRecord},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_TrackedObjectRecord_spec = {
  "memray._memray.TrackedObjectRecord",
  sizeof(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_TrackedObjectRecord_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_TrackedObjectRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""TrackedObjectRecord", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_TrackedObjectRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_TrackedObjectRecord, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6memray_7_memray_19TrackedObjectRecord_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_6memray_7_memray_19TrackedObjectRecord_5__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("TrackedObjectRecord(record)"), /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_TrackedObjectRecord, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_TrackedObjectRecord, /*tp_clear*/
  __pyx_tp_richcompare_6memray_7_memray_TrackedObjectRecord, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_TrackedObjectRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_TrackedObjectRecord, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6memray_7_memray_19TrackedObjectRecord_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_TrackedObjectRecord, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_Interval(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_Interval *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_Interval > 0) & __PYX_CHECK_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_Interval, sizeof(struct __pyx_obj_6memray_7_memray_Interval))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray_Interval[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray_Interval];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray_Interval));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray_Interval *)o);
  p->deallocated_before_snapshot = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6memray_7_memray_8Interval_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_Interval(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_Interval *p = (struct __pyx_obj_6memray_7_memray_Interval *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_Interval) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->deallocated_before_snapshot);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_Interval < 1024) & __PYX_CHECK_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray_Interval, sizeof(struct __pyx_obj_6memray_7_memray_Interval))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray_Interval[__pyx_mstate_global->__pyx_freecount_6memray_7_memray_Interval++] = ((struct __pyx_obj_6memray_7_memray_Interval *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray_Interval(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_Interval *p = (struct __pyx_obj_6memray_7_memray_Interval *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->deallocated_before_snapshot) {
    e = (*v)(p->deallocated_before_snapshot, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_Interval(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_Interval *p = (struct __pyx_obj_6memray_7_memray_Interval *)o;
  tmp = ((PyObject*)p->deallocated_before_snapshot);
  p->deallocated_before_snapshot = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_6memray_7_memray_Interval(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_6memray_7_memray_8Interval_3__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_6memray_7_memray_8Interval_3__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_8Interval_allocated_before_snapshot(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_1__get__(o);
}

static int __pyx_setprop_6memray_7_memray_8Interval_allocated_before_snapshot(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6memray_7_memray_8Interval_25allocated_before_snapshot_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_8Interval_deallocated_before_snapshot(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_1__get__(o);
}

static int __pyx_setprop_6memray_7_memray_8Interval_deallocated_before_snapshot(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_3__set__(o, v);
  }
  else {
    return __pyx_pw_6memray_7_memray_8Interval_27deallocated_before_snapshot_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_8Interval_n_allocations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_8Interval_13n_allocations_1__get__(o);
}

static int __pyx_setprop_6memray_7_memray_8Interval_n_allocations(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6memray_7_memray_8Interval_13n_allocations_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_8Interval_n_bytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_8Interval_7n_bytes_1__get__(o);
}

static int __pyx_setprop_6memray_7_memray_8Interval_n_bytes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6memray_7_memray_8Interval_7n_bytes_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_6memray_7_memray_Interval[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_8Interval_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_8Interval_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_8Interval_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_8Interval_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_Interval[] = {
  {"allocated_before_snapshot", __pyx_getprop_6memray_7_memray_8Interval_allocated_before_snapshot, __pyx_setprop_6memray_7_memray_8Interval_allocated_before_snapshot, PyDoc_STR("allocated_before_snapshot: 'size_t'"), 0},
  {"deallocated_before_snapshot", __pyx_getprop_6memray_7_memray_8Interval_deallocated_before_snapshot, __pyx_setprop_6memray_7_memray_8Interval_deallocated_before_snapshot, PyDoc_STR("deallocated_before_snapshot: object"), 0},
  {"n_allocations", __pyx_getprop_6memray_7_memray_8Interval_n_allocations, __pyx_setprop_6memray_7_memray_8Interval_n_allocations, PyDoc_STR("n_allocations: 'size_t'"), 0},
  {"n_bytes", __pyx_getprop_6memray_7_memray_8Interval_n_bytes, __pyx_setprop_6memray_7_memray_8Interval_n_bytes, PyDoc_STR("n_bytes: 'size_t'"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_Interval_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_Interval},
  {Py_tp_repr, (void *)__pyx_pw_6memray_7_memray_8Interval_5__repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_Interval},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_Interval},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_6memray_7_memray_Interval},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_Interval},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_Interval},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_Interval},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_Interval_spec = {
  "memray._memray.Interval",
  sizeof(struct __pyx_obj_6memray_7_memray_Interval),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_Interval_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_Interval = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""Interval", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_Interval), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_Interval, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6memray_7_memray_8Interval_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_Interval, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_Interval, /*tp_clear*/
  __pyx_tp_richcompare_6memray_7_memray_Interval, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_Interval, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_Interval, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_Interval, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_TemporalAllocationRecord(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TemporalAllocationRecord > 0) & __PYX_CHECK_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray_TemporalAllocationRecord[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TemporalAllocationRecord];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)o);
  __Pyx_default_placement_construct(&(p->_reader));
  p->_tuple = Py_None; Py_INCREF(Py_None);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->intervals = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationRecord(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationRecord) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_reader);
  Py_CLEAR(p->_tuple);
  Py_CLEAR(p->_stack_trace_cache);
  Py_CLEAR(p->intervals);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TemporalAllocationRecord < 1024) & __PYX_CHECK_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray_TemporalAllocationRecord[__pyx_mstate_global->__pyx_freecount_6memray_7_memray_TemporalAllocationRecord++] = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray_TemporalAllocationRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_tuple) {
    e = (*v)(p->_tuple, a); if (e) return e;
  }
  if (p->_stack_trace_cache) {
    e = (*v)(p->_stack_trace_cache, a); if (e) return e;
  }
  if (p->intervals) {
    e = (*v)(p->intervals, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_TemporalAllocationRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)o;
  tmp = ((PyObject*)p->_tuple);
  p->_tuple = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_stack_trace_cache);
  p->_stack_trace_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->intervals);
  p->intervals = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_6memray_7_memray_TemporalAllocationRecord(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_tid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_3tid_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_allocator(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9allocator_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_8stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_native_stack_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15native_stack_id_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_native_segment_generation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_25native_segment_generation_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_thread_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11thread_name_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_intervals(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_1__get__(o);
}

static int __pyx_setprop_6memray_7_memray_24TemporalAllocationRecord_intervals(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_3__set__(o, v);
  }
  else {
    return __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9intervals_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_6memray_7_memray_TemporalAllocationRecord[] = {
  {"stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_7stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_6stack_trace},
  {"native_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_8native_stack_trace},
  {"hybrid_stack_trace", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_10hybrid_stack_trace},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_24TemporalAllocationRecord_14__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_TemporalAllocationRecord[] = {
  {"tid", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_tid, 0, 0, 0},
  {"allocator", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_allocator, 0, 0, 0},
  {"stack_id", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_stack_id, 0, 0, 0},
  {"native_stack_id", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_native_stack_id, 0, 0, 0},
  {"native_segment_generation", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_native_segment_generation, 0, 0, 0},
  {"thread_name", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_thread_name, 0, 0, 0},
  {"intervals", __pyx_getprop_6memray_7_memray_24TemporalAllocationRecord_intervals, __pyx_setprop_6memray_7_memray_24TemporalAllocationRecord_intervals, PyDoc_STR("intervals: object"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_TemporalAllocationRecord_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_hash, (void *)__pyx_pw_6memray_7_memray_24TemporalAllocationRecord_5__hash__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_TemporalAllocationRecord},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_TemporalAllocationRecord},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_TemporalAllocationRecord_spec = {
  "memray._memray.TemporalAllocationRecord",
  sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_TemporalAllocationRecord_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_TemporalAllocationRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""TemporalAllocationRecord", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationRecord, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_6memray_7_memray_24TemporalAllocationRecord_5__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_TemporalAllocationRecord, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_TemporalAllocationRecord, /*tp_clear*/
  __pyx_tp_richcompare_6memray_7_memray_TemporalAllocationRecord, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_TemporalAllocationRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_TemporalAllocationRecord, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_TemporalAllocationRecord, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6memray_7_memray_TemporalAllocationGenerator __pyx_vtable_6memray_7_memray_TemporalAllocationGenerator;

static PyObject *__pyx_tp_new_6memray_7_memray_TemporalAllocationGenerator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6memray_7_memray_TemporalAllocationGenerator;
  __Pyx_default_placement_construct(&(p->lifetimes));
  __Pyx_default_placement_construct(&(p->reader));
  __Pyx_default_placement_construct(&(p->last_key));
  p->curr_record = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationGenerator(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationGenerator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->lifetimes);
  __Pyx_call_destructor(p->reader);
  __Pyx_call_destructor(p->last_key);
  Py_CLEAR(p->curr_record);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6memray_7_memray_TemporalAllocationGenerator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->curr_record) {
    e = (*v)(((PyObject *)p->curr_record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_TemporalAllocationGenerator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *p = (struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *)o;
  tmp = ((PyObject*)p->curr_record);
  p->curr_record = ((struct __pyx_obj_6memray_7_memray_TemporalAllocationRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6memray_7_memray_TemporalAllocationGenerator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_27TemporalAllocationGenerator_6__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_TemporalAllocationGenerator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_TemporalAllocationGenerator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_TemporalAllocationGenerator},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_TemporalAllocationGenerator},
  {Py_tp_iter, (void *)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_TemporalAllocationGenerator},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_TemporalAllocationGenerator},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_TemporalAllocationGenerator_spec = {
  "memray._memray.TemporalAllocationGenerator",
  sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_TemporalAllocationGenerator_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_TemporalAllocationGenerator = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""TemporalAllocationGenerator", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_TemporalAllocationGenerator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_TemporalAllocationGenerator, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_TemporalAllocationGenerator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_1__iter__, /*tp_iter*/
  __pyx_pw_6memray_7_memray_27TemporalAllocationGenerator_3__next__, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_TemporalAllocationGenerator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_TemporalAllocationGenerator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6memray_7_memray_Tracker __pyx_vtable_6memray_7_memray_Tracker;

static PyObject *__pyx_tp_new_6memray_7_memray_Tracker(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_Tracker *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_Tracker *)o);
  p->__pyx_vtab = __pyx_vtabptr_6memray_7_memray_Tracker;
  __Pyx_default_placement_construct(&(p->_writer));
  p->_previous_profile_func = Py_None; Py_INCREF(Py_None);
  p->_previous_thread_profile_func = Py_None; Py_INCREF(Py_None);
  p->_surviving_objects = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6memray_7_memray_7Tracker_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_Tracker(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_Tracker *p = (struct __pyx_obj_6memray_7_memray_Tracker *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_Tracker) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_writer);
  Py_CLEAR(p->_previous_profile_func);
  Py_CLEAR(p->_previous_thread_profile_func);
  Py_CLEAR(p->_surviving_objects);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6memray_7_memray_Tracker(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_Tracker *p = (struct __pyx_obj_6memray_7_memray_Tracker *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_previous_profile_func) {
    e = (*v)(p->_previous_profile_func, a); if (e) return e;
  }
  if (p->_previous_thread_profile_func) {
    e = (*v)(p->_previous_thread_profile_func, a); if (e) return e;
  }
  if (p->_surviving_objects) {
    e = (*v)(p->_surviving_objects, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_Tracker(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_Tracker *p = (struct __pyx_obj_6memray_7_memray_Tracker *)o;
  tmp = ((PyObject*)p->_previous_profile_func);
  p->_previous_profile_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_previous_thread_profile_func);
  p->_previous_thread_profile_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_surviving_objects);
  p->_surviving_objects = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6memray_7_memray_Tracker[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_2__enter__},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_4__exit__},
  {"get_surviving_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_7get_surviving_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_6get_surviving_objects},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_7Tracker_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_7Tracker_10__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_Tracker_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_Tracker},
  {Py_tp_doc, (void *)PyDoc_STR("Context manager for tracking memory allocations in a Python script.\n\n    You can track memory allocations in a Python process by using a Tracker as\n    a context manager::\n\n        with memray.Tracker(\"some_output_file.bin\"):\n\n    Any code inside of the ``with`` block will have its allocations tracked.\n    Any allocations made by other threads will also be tracked for the duration\n    of the ``with`` block. Because of the way tracking works, there can only be\n    one tracker active in the entire program at a time. Attempting to activate\n    a tracker while one is already active will raise an exception, as will\n    attempting to activate the same tracker more than once. If you want to\n    re-enable tracking after the ``with`` block ends, you will need to create\n    a fresh `Tracker` instance.\n\n    Args:\n        file_name (str or pathlib.Path): The name of the file to write the\n            captured allocations into. This is the only argument that can be\n            passed positionally. If not provided, the *destination* keyword\n            argument must be provided.\n        destination (FileDestination or SocketDestination): The destination to\n            write captured allocations to. If provided, the *file_name*\n            argument must not be provided.\n        native_traces (bool): Whether or not to capture native stack frames, in\n            addition to Python stack frames (see :ref:`Native Tracking`).\n            Defaults to False.\n        trace_python_allocators (bool): Whether or not to trace Python allocators\n            as independent allocations. (see :ref:`Python allocators`).\n            Defaults to False.\n        track_object_lifetimes (bool): Whether or not to track which objects are\n            created during the tracking session and still alive at the end (or\n            in other words, what objects are leaked by the code being tracked).\n            Defaults to False.\n        follow_fork (bool): Whether or not to co""ntinue tracking in a subprocess\n            that is forked from the tracked process (see :ref:`Tracking across\n            Forks`). Defaults to False.\n        memory_interval_ms (int): How many milliseconds to wait between sending\n            periodic resident set size updates. By default, every 10\n            milliseconds a record is written that contains the current\n            timestamp and the total number of bytes of virtual memory allocated\n            by the process. These records are used to create the graph of\n            memory usage over time that appears at the top of the flame graph,\n            for instance. This parameter lets you adjust the frequency between\n            updates, though you shouldn't need to change it.\n        file_format (FileFormat): The format that should be used when writing\n            to the capture file. See the `FileFormat` documentation for a list\n            of supported file formats and their limitations.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_Tracker},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_Tracker},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_Tracker},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_Tracker},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_Tracker_spec = {
  "memray._memray.Tracker",
  sizeof(struct __pyx_obj_6memray_7_memray_Tracker),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_Tracker_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_Tracker = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""Tracker", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_Tracker), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_Tracker, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Context manager for tracking memory allocations in a Python script.\n\n    You can track memory allocations in a Python process by using a Tracker as\n    a context manager::\n\n        with memray.Tracker(\"some_output_file.bin\"):\n\n    Any code inside of the ``with`` block will have its allocations tracked.\n    Any allocations made by other threads will also be tracked for the duration\n    of the ``with`` block. Because of the way tracking works, there can only be\n    one tracker active in the entire program at a time. Attempting to activate\n    a tracker while one is already active will raise an exception, as will\n    attempting to activate the same tracker more than once. If you want to\n    re-enable tracking after the ``with`` block ends, you will need to create\n    a fresh `Tracker` instance.\n\n    Args:\n        file_name (str or pathlib.Path): The name of the file to write the\n            captured allocations into. This is the only argument that can be\n            passed positionally. If not provided, the *destination* keyword\n            argument must be provided.\n        destination (FileDestination or SocketDestination): The destination to\n            write captured allocations to. If provided, the *file_name*\n            argument must not be provided.\n        native_traces (bool): Whether or not to capture native stack frames, in\n            addition to Python stack frames (see :ref:`Native Tracking`).\n            Defaults to False.\n        trace_python_allocators (bool): Whether or not to trace Python allocators\n            as independent allocations. (see :ref:`Python allocators`).\n            Defaults to False.\n        track_object_lifetimes (bool): Whether or not to track which objects are\n            created during the tracking session and still alive at the end (or\n            in other words, what objects are leaked by the code being tracked).\n            Defaults to False.\n        follow_fork (bool): Whether or not to co""ntinue tracking in a subprocess\n            that is forked from the tracked process (see :ref:`Tracking across\n            Forks`). Defaults to False.\n        memory_interval_ms (int): How many milliseconds to wait between sending\n            periodic resident set size updates. By default, every 10\n            milliseconds a record is written that contains the current\n            timestamp and the total number of bytes of virtual memory allocated\n            by the process. These records are used to create the graph of\n            memory usage over time that appears at the top of the flame graph,\n            for instance. This parameter lets you adjust the frequency between\n            updates, though you shouldn't need to change it.\n        file_format (FileFormat): The format that should be used when writing\n            to the capture file. See the `FileFormat` documentation for a list\n            of supported file formats and their limitations.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_Tracker, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_Tracker, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_Tracker, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_Tracker, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6memray_7_memray_ProgressIndicator __pyx_vtable_6memray_7_memray_ProgressIndicator;

static PyObject *__pyx_tp_new_6memray_7_memray_ProgressIndicator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_ProgressIndicator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6memray_7_memray_ProgressIndicator;
  __Pyx_default_placement_construct(&(p->_next_refresh));
  p->_indicator = Py_None; Py_INCREF(Py_None);
  p->_context_manager = Py_None; Py_INCREF(Py_None);
  p->_task = Py_None; Py_INCREF(Py_None);
  p->_task_description = Py_None; Py_INCREF(Py_None);
  p->_total = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_ProgressIndicator(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *p = (struct __pyx_obj_6memray_7_memray_ProgressIndicator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_ProgressIndicator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_next_refresh);
  Py_CLEAR(p->_indicator);
  Py_CLEAR(p->_context_manager);
  Py_CLEAR(p->_task);
  Py_CLEAR(p->_task_description);
  Py_CLEAR(p->_total);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6memray_7_memray_ProgressIndicator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *p = (struct __pyx_obj_6memray_7_memray_ProgressIndicator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_indicator) {
    e = (*v)(p->_indicator, a); if (e) return e;
  }
  if (p->_context_manager) {
    e = (*v)(p->_context_manager, a); if (e) return e;
  }
  if (p->_task) {
    e = (*v)(p->_task, a); if (e) return e;
  }
  if (p->_task_description) {
    e = (*v)(p->_task_description, a); if (e) return e;
  }
  if (p->_total) {
    e = (*v)(p->_total, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_ProgressIndicator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_ProgressIndicator *p = (struct __pyx_obj_6memray_7_memray_ProgressIndicator *)o;
  tmp = ((PyObject*)p->_indicator);
  p->_indicator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_context_manager);
  p->_context_manager = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_task);
  p->_task = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_task_description);
  p->_task_description = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_total);
  p->_total = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6memray_7_memray_17ProgressIndicator_num_processed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_17ProgressIndicator_13num_processed_1__get__(o);
}

static PyMethodDef __pyx_methods_6memray_7_memray_ProgressIndicator[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_2__enter__},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_4__exit__},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_17ProgressIndicator_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_17ProgressIndicator_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_ProgressIndicator[] = {
  {"num_processed", __pyx_getprop_6memray_7_memray_17ProgressIndicator_num_processed, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_ProgressIndicator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_ProgressIndicator},
  {Py_tp_doc, (void *)PyDoc_STR("ProgressIndicator(str task_description, total, bool report_progress=True, size_t refresh_per_second=10)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_ProgressIndicator},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_ProgressIndicator},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_ProgressIndicator},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_ProgressIndicator},
  {Py_tp_init, (void *)__pyx_pw_6memray_7_memray_17ProgressIndicator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_ProgressIndicator},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_ProgressIndicator_spec = {
  "memray._memray.ProgressIndicator",
  sizeof(struct __pyx_obj_6memray_7_memray_ProgressIndicator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_ProgressIndicator_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_ProgressIndicator = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""ProgressIndicator", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_ProgressIndicator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_ProgressIndicator, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ProgressIndicator(str task_description, total, bool report_progress=True, size_t refresh_per_second=10)"), /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_ProgressIndicator, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_ProgressIndicator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_ProgressIndicator, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_ProgressIndicator, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6memray_7_memray_17ProgressIndicator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_ProgressIndicator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6memray_7_memray_FileReader __pyx_vtable_6memray_7_memray_FileReader;

static PyObject *__pyx_tp_new_6memray_7_memray_FileReader(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_FileReader *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_FileReader *)o);
  p->__pyx_vtab = __pyx_vtabptr_6memray_7_memray_FileReader;
  __Pyx_default_placement_construct(&(p->_path));
  __Pyx_default_placement_construct(&(p->_memory_snapshots));
  __Pyx_default_placement_construct(&(p->_high_watermark));
  p->_file = Py_None; Py_INCREF(Py_None);
  p->_header = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6memray_7_memray_10FileReader_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_FileReader(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_FileReader *p = (struct __pyx_obj_6memray_7_memray_FileReader *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_FileReader) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6memray_7_memray_10FileReader_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->_path);
  __Pyx_call_destructor(p->_memory_snapshots);
  __Pyx_call_destructor(p->_high_watermark);
  Py_CLEAR(p->_file);
  Py_CLEAR(p->_header);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6memray_7_memray_FileReader(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_FileReader *p = (struct __pyx_obj_6memray_7_memray_FileReader *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_file) {
    e = (*v)(p->_file, a); if (e) return e;
  }
  if (p->_header) {
    e = (*v)(p->_header, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_FileReader(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_FileReader *p = (struct __pyx_obj_6memray_7_memray_FileReader *)o;
  tmp = ((PyObject*)p->_file);
  p->_file = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_header);
  p->_header = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6memray_7_memray_10FileReader_closed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_10FileReader_6closed_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_10FileReader_metadata(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_10FileReader_8metadata_1__get__(o);
}

static PyMethodDef __pyx_methods_6memray_7_memray_FileReader[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_7__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_6__enter__},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_9__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_8__exit__},
  {"_reaggregate_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_11_reaggregate_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_10_reaggregate_allocations},
  {"_aggregate_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_14_aggregate_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_13_aggregate_allocations},
  {"get_high_watermark_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_16get_high_watermark_allocation_records},
  {"get_leaked_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_20get_leaked_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_19get_leaked_allocation_records},
  {"get_temporary_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_23get_temporary_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_22get_temporary_allocation_records},
  {"get_temporal_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_26get_temporal_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_25get_temporal_allocation_records},
  {"get_temporal_high_water_mark_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_28get_temporal_high_water_mark_allocation_records},
  {"get_allocation_records", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_31get_allocation_records, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_30get_allocation_records},
  {"get_memory_snapshots", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_34get_memory_snapshots, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_33get_memory_snapshots},
  {"get_object_lifetime_events", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_37get_object_lifetime_events, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_36get_object_lifetime_events},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_40__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_39__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_10FileReader_42__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_10FileReader_41__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_FileReader[] = {
  {"closed", __pyx_getprop_6memray_7_memray_10FileReader_closed, 0, 0, 0},
  {"metadata", __pyx_getprop_6memray_7_memray_10FileReader_metadata, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_FileReader_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_FileReader},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_FileReader},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_FileReader},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_FileReader},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_FileReader},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_FileReader},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_FileReader_spec = {
  "memray._memray.FileReader",
  sizeof(struct __pyx_obj_6memray_7_memray_FileReader),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_FileReader_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_FileReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""FileReader", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_FileReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_FileReader, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_FileReader, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_FileReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_FileReader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_FileReader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_FileReader, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6memray_7_memray_SocketReader __pyx_vtable_6memray_7_memray_SocketReader;

static PyObject *__pyx_tp_new_6memray_7_memray_SocketReader(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_SocketReader *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_SocketReader *)o);
  p->__pyx_vtab = __pyx_vtabptr_6memray_7_memray_SocketReader;
  __Pyx_default_placement_construct(&(p->_reader));
  p->_header = Py_None; Py_INCREF(Py_None);
  p->_port = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6memray_7_memray_12SocketReader_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_SocketReader(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_SocketReader *p = (struct __pyx_obj_6memray_7_memray_SocketReader *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_SocketReader) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6memray_7_memray_12SocketReader_9__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->_reader);
  Py_CLEAR(p->_header);
  Py_CLEAR(p->_port);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6memray_7_memray_SocketReader(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray_SocketReader *p = (struct __pyx_obj_6memray_7_memray_SocketReader *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_header) {
    e = (*v)(p->_header, a); if (e) return e;
  }
  if (p->_port) {
    e = (*v)(p->_port, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray_SocketReader(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray_SocketReader *p = (struct __pyx_obj_6memray_7_memray_SocketReader *)o;
  tmp = ((PyObject*)p->_header);
  p->_header = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_port);
  p->_port = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6memray_7_memray_12SocketReader_command_line(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_12SocketReader_12command_line_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_12SocketReader_is_active(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_12SocketReader_9is_active_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_12SocketReader_pid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_12SocketReader_3pid_1__get__(o);
}

static PyObject *__pyx_getprop_6memray_7_memray_12SocketReader_has_native_traces(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6memray_7_memray_12SocketReader_17has_native_traces_1__get__(o);
}

static PyMethodDef __pyx_methods_6memray_7_memray_SocketReader[] = {
  {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_5__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_4__enter__},
  {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_7__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_6__exit__},
  {"get_current_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_11get_current_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_10get_current_snapshot},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_13__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_12SocketReader_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_12SocketReader_15__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6memray_7_memray_SocketReader[] = {
  {"command_line", __pyx_getprop_6memray_7_memray_12SocketReader_command_line, 0, 0, 0},
  {"is_active", __pyx_getprop_6memray_7_memray_12SocketReader_is_active, 0, 0, 0},
  {"pid", __pyx_getprop_6memray_7_memray_12SocketReader_pid, 0, 0, 0},
  {"has_native_traces", __pyx_getprop_6memray_7_memray_12SocketReader_has_native_traces, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_SocketReader_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_SocketReader},
  {Py_tp_doc, (void *)PyDoc_STR("SocketReader(int port: int)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray_SocketReader},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray_SocketReader},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_SocketReader},
  {Py_tp_getset, (void *)__pyx_getsets_6memray_7_memray_SocketReader},
  {Py_tp_init, (void *)__pyx_pw_6memray_7_memray_12SocketReader_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_SocketReader},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_SocketReader_spec = {
  "memray._memray.SocketReader",
  sizeof(struct __pyx_obj_6memray_7_memray_SocketReader),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray_SocketReader_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_SocketReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""SocketReader", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_SocketReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_SocketReader, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("SocketReader(int port: int)"), /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray_SocketReader, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray_SocketReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_SocketReader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6memray_7_memray_SocketReader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6memray_7_memray_12SocketReader_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_SocketReader, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_HighWaterMarkAggregatorTestHarness(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)o);
  __Pyx_default_placement_construct(&(p->aggregator));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_HighWaterMarkAggregatorTestHarness(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *p = (struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_HighWaterMarkAggregatorTestHarness) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  __Pyx_call_destructor(p->aggregator);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6memray_7_memray_HighWaterMarkAggregatorTestHarness[] = {
  {"add_allocation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_add_allocation},
  {"capture_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_2capture_snapshot},
  {"high_water_mark_bytes_by_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_4high_water_mark_bytes_by_snapshot},
  {"get_current_heap_size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_6get_current_heap_size},
  {"get_temporal_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_8get_temporal_allocations},
  {"get_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_11get_allocations},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_13__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_15__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_HighWaterMarkAggregatorTestHarness},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_HighWaterMarkAggregatorTestHarness},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_HighWaterMarkAggregatorTestHarness},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness_spec = {
  "memray._memray.HighWaterMarkAggregatorTestHarness",
  sizeof(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""HighWaterMarkAggregatorTestHarness", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_HighWaterMarkAggregatorTestHarness), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_HighWaterMarkAggregatorTestHarness, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_HighWaterMarkAggregatorTestHarness, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_HighWaterMarkAggregatorTestHarness, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_AllocationLifetimeAggregatorTestHarness(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)o);
  __Pyx_default_placement_construct(&(p->aggregator));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray_AllocationLifetimeAggregatorTestHarness(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *p = (struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_AllocationLifetimeAggregatorTestHarness) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  __Pyx_call_destructor(p->aggregator);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6memray_7_memray_AllocationLifetimeAggregatorTestHarness[] = {
  {"add_allocation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_add_allocation},
  {"capture_snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_2capture_snapshot},
  {"get_allocations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_4get_allocations},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_7__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_9__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_AllocationLifetimeAggregatorTestHarness},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_AllocationLifetimeAggregatorTestHarness},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_AllocationLifetimeAggregatorTestHarness},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness_spec = {
  "memray._memray.AllocationLifetimeAggregatorTestHarness",
  sizeof(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""AllocationLifetimeAggregatorTestHarness", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_AllocationLifetimeAggregatorTestHarness), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray_RecordWriterTestHarness(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)o);
  __Pyx_default_placement_construct(&(p->_writer));
  if (unlikely(__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6memray_7_memray_RecordWriterTestHarness(PyObject *o) {
  struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *p = (struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray_RecordWriterTestHarness) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  __Pyx_call_destructor(p->_writer);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6memray_7_memray_RecordWriterTestHarness[] = {
  {"write_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_3write_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_2write_header},
  {"write_memory_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_4write_memory_record},
  {"write_code_object", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_7write_code_object, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_6write_code_object},
  {"get_linetable", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_9get_linetable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_8get_linetable},
  {"get_lasti", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_11get_lasti, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_10get_lasti},
  {"write_unresolved_native_frame", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_12write_unresolved_native_frame},
  {"write_allocation_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_14write_allocation_record},
  {"write_frame_push", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_16write_frame_push},
  {"write_frame_pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_18write_frame_pop},
  {"write_thread_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_20write_thread_record},
  {"write_mappings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_23write_mappings, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_22write_mappings},
  {"write_object_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_25write_object_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_24write_object_record},
  {"write_trailer", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_27write_trailer, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_26write_trailer},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_28__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6memray_7_memray_23RecordWriterTestHarness_30__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray_RecordWriterTestHarness_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray_RecordWriterTestHarness},
  {Py_tp_doc, (void *)PyDoc_STR("A Python wrapper around the C++ RecordWriter class for testing purposes.")},
  {Py_tp_methods, (void *)__pyx_methods_6memray_7_memray_RecordWriterTestHarness},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray_RecordWriterTestHarness},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray_RecordWriterTestHarness_spec = {
  "memray._memray.RecordWriterTestHarness",
  sizeof(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6memray_7_memray_RecordWriterTestHarness_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray_RecordWriterTestHarness = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""RecordWriterTestHarness", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray_RecordWriterTestHarness), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray_RecordWriterTestHarness, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("A Python wrapper around the C++ RecordWriter class for testing purposes."), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6memray_7_memray_RecordWriterTestHarness, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray_RecordWriterTestHarness, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct____enter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct____enter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct____enter__[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct____enter__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct____enter__(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct____enter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_orig_set_os_name);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct____enter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct____enter__[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct____enter__++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct____enter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_orig_set_os_name) {
    e = (*v)(p->__pyx_v_orig_set_os_name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6memray_7_memray___pyx_scope_struct____enter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_orig_set_os_name);
  p->__pyx_v_orig_set_os_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct____enter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct____enter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct____enter__},
  {Py_tp_clear, (void *)__pyx_tp_clear_6memray_7_memray___pyx_scope_struct____enter__},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct____enter__},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct____enter___spec = {
  "memray._memray.__pyx_scope_struct____enter__",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct____enter___slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct____enter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct____enter__", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct____enter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct____enter__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct____enter__, /*tp_traverse*/
  __pyx_tp_clear_6memray_7_memray___pyx_scope_struct____enter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct____enter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_aggregator));
  __Pyx_default_placement_construct(&(p->__pyx_v_reader_sp));
  __Pyx_default_placement_construct(&(p->__pyx_v_record));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_aggregator);
  __Pyx_call_destructor(p->__pyx_v_reader_sp);
  __Pyx_call_destructor(p->__pyx_v_record);
  Py_CLEAR(p->__pyx_v_alloc);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_v_progress_indicator);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_alloc) {
    e = (*v)(((PyObject *)p->__pyx_v_alloc), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, a); if (e) return e;
  }
  if (p->__pyx_v_progress_indicator) {
    e = (*v)(((PyObject *)p->__pyx_v_progress_indicator), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations_spec = {
  "memray._memray.__pyx_scope_struct_1__reaggregate_allocations",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_1__reaggregate_allocations", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_reader_sp));
  __Pyx_default_placement_construct(&(p->__pyx_v_the_aggregator));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_reader_sp);
  __Pyx_call_destructor(p->__pyx_v_the_aggregator);
  Py_CLEAR(p->__pyx_v_alloc);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_v_progress_indicator);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_alloc) {
    e = (*v)(((PyObject *)p->__pyx_v_alloc), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, a); if (e) return e;
  }
  if (p->__pyx_v_progress_indicator) {
    e = (*v)(((PyObject *)p->__pyx_v_progress_indicator), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations_spec = {
  "memray._memray.__pyx_scope_struct_2__aggregate_allocations",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_2__aggregate_allocations", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_merge_threads);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_merge_threads) {
    e = (*v)(p->__pyx_v_merge_threads, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records_spec = {
  "memray._memray.__pyx_scope_struct_3_get_high_watermark_allocation_records",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_3_get_high_watermark_allocation_records", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_merge_threads);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_merge_threads) {
    e = (*v)(p->__pyx_v_merge_threads, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records_spec = {
  "memray._memray.__pyx_scope_struct_4_get_leaked_allocation_records",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_4_get_leaked_allocation_records", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_merge_threads);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_threshold);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_merge_threads) {
    e = (*v)(p->__pyx_v_merge_threads, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_threshold) {
    e = (*v)(p->__pyx_v_threshold, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records_spec = {
  "memray._memray.__pyx_scope_struct_5_get_temporary_allocation_records",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_5_get_temporary_allocation_records", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_aggregator));
  __Pyx_default_placement_construct(&(p->__pyx_v_allocation));
  __Pyx_default_placement_construct(&(p->__pyx_v_reader_sp));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_aggregator);
  __Pyx_call_destructor(p->__pyx_v_allocation);
  __Pyx_call_destructor(p->__pyx_v_reader_sp);
  Py_CLEAR(p->__pyx_v_gen);
  Py_CLEAR(p->__pyx_v_merge_threads);
  Py_CLEAR(p->__pyx_v_progress_indicator);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_gen) {
    e = (*v)(((PyObject *)p->__pyx_v_gen), a); if (e) return e;
  }
  if (p->__pyx_v_merge_threads) {
    e = (*v)(p->__pyx_v_merge_threads, a); if (e) return e;
  }
  if (p->__pyx_v_progress_indicator) {
    e = (*v)(((PyObject *)p->__pyx_v_progress_indicator), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records_spec = {
  "memray._memray.__pyx_scope_struct_6_get_temporal_allocation_records",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_6_get_temporal_allocation_records", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_7_get_allocation_records(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_7_get_allocation_records > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_7_get_allocation_records[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_7_get_allocation_records];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_reader_sp));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_7_get_allocation_records(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_7_get_allocation_records) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_reader_sp);
  Py_CLEAR(p->__pyx_v_alloc);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_7_get_allocation_records < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_7_get_allocation_records[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_7_get_allocation_records++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_7_get_allocation_records(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_alloc) {
    e = (*v)(((PyObject *)p->__pyx_v_alloc), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_7_get_allocation_records},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_7_get_allocation_records},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_7_get_allocation_records},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records_spec = {
  "memray._memray.__pyx_scope_struct_7_get_allocation_records",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_7_get_allocation_records", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_7_get_allocation_records), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_7_get_allocation_records, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_record));
  __Pyx_default_placement_construct(&(p->__pyx_t_0));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_record);
  __Pyx_call_destructor(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots_spec = {
  "memray._memray.__pyx_scope_struct_8_get_memory_snapshots",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_8_get_memory_snapshots", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_reader_sp));
  __Pyx_default_placement_construct(&(p->__pyx_v_tracked_object));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_reader_sp);
  __Pyx_call_destructor(p->__pyx_v_tracked_object);
  Py_CLEAR(p->__pyx_v_header);
  Py_CLEAR(p->__pyx_v_included_objects);
  Py_CLEAR(p->__pyx_7genexpr__pyx_v_obj);
  Py_CLEAR(p->__pyx_v_object_ids);
  Py_CLEAR(p->__pyx_v_object_record);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_header) {
    e = (*v)(p->__pyx_v_header, a); if (e) return e;
  }
  if (p->__pyx_v_included_objects) {
    e = (*v)(p->__pyx_v_included_objects, a); if (e) return e;
  }
  if (p->__pyx_7genexpr__pyx_v_obj) {
    e = (*v)(p->__pyx_7genexpr__pyx_v_obj, a); if (e) return e;
  }
  if (p->__pyx_v_object_ids) {
    e = (*v)(p->__pyx_v_object_ids, a); if (e) return e;
  }
  if (p->__pyx_v_object_record) {
    e = (*v)(((PyObject *)p->__pyx_v_object_record), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events_spec = {
  "memray._memray.__pyx_scope_struct_9_get_object_lifetime_events",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_9_get_object_lifetime_events", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alloc);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_snapshot_allocations);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_alloc) {
    e = (*v)(((PyObject *)p->__pyx_v_alloc), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_snapshot_allocations) {
    e = (*v)(p->__pyx_v_snapshot_allocations, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot_spec = {
  "memray._memray.__pyx_scope_struct_10_get_current_snapshot",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_10_get_current_snapshot", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_reader));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_reader);
  Py_CLEAR(p->__pyx_v_gen);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_gen) {
    e = (*v)(((PyObject *)p->__pyx_v_gen), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations_spec = {
  "memray._memray.__pyx_scope_struct_11_get_temporal_allocations",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_11_get_temporal_allocations", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6memray_7_memray___pyx_scope_struct_12_get_allocations(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *p;
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_12_get_allocations > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_12_get_allocations[--__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_12_get_allocations];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)o);
  __Pyx_default_placement_construct(&(p->__pyx_v_reader));
  return o;
}

static void __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_12_get_allocations(PyObject *o) {
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_12_get_allocations) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_reader);
  Py_CLEAR(p->__pyx_v_gen);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_12_get_allocations < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations, sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations))))
  {
    __pyx_mstate_global->__pyx_freelist_6memray_7_memray___pyx_scope_struct_12_get_allocations[__pyx_mstate_global->__pyx_freecount_6memray_7_memray___pyx_scope_struct_12_get_allocations++] = ((struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_12_get_allocations(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *p = (struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_gen) {
    e = (*v)(((PyObject *)p->__pyx_v_gen), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_12_get_allocations},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_12_get_allocations},
  {Py_tp_new, (void *)__pyx_tp_new_6memray_7_memray___pyx_scope_struct_12_get_allocations},
  {0, 0},
};
static PyType_Spec __pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations_spec = {
  "memray._memray.__pyx_scope_struct_12_get_allocations",
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations_slots,
};
#else

static PyTypeObject __pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct_12_get_allocations", /*tp_name*/
  sizeof(struct __pyx_obj_6memray_7_memray___pyx_scope_struct_12_get_allocations), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6memray_7_memray___pyx_scope_struct_12_get_allocations, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6memray_7_memray___pyx_scope_struct_12_get_allocations, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6memray_7_memray___pyx_scope_struct_12_get_allocations, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_[--__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_))))
  {
    __pyx_mstate_global->__pyx_freelist___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_[__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_},
  {Py_tp_new, (void *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_},
  {0, 0},
};
static PyType_Spec __pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__spec = {
  "memray._memray.__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_",
  sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__slots,
};
#else

static PyTypeObject __pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_", /*tp_name*/
  sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0[--__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0))))
  {
    __pyx_mstate_global->__pyx_freelist___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0[__pyx_mstate_global->__pyx_freecount___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0},
  {Py_tp_new, (void *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0},
  {0, 0},
};
static PyType_Spec __pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_spec = {
  "memray._memray.__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0",
  sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_slots,
};
#else

static PyTypeObject __pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 = {
  PyVarObject_HEAD_INIT(0, 0)
  "memray._memray.""__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0", /*tp_name*/
  sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_EnumBase = Py_None; Py_INCREF(Py_None);
  __Pyx_FlagBase = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_AllocationRecord_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord)) __PYX_ERR(0, 289, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_AllocationRecord_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord = &__pyx_type_6memray_7_memray_AllocationRecord;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AllocationRecord, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationRecord) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_TrackedObjectRecord_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord)) __PYX_ERR(0, 392, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_TrackedObjectRecord_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord) < (0)) __PYX_ERR(0, 392, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord = &__pyx_type_6memray_7_memray_TrackedObjectRecord;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord) < (0)) __PYX_ERR(0, 392, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord) < (0)) __PYX_ERR(0, 392, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TrackedObjectRecord) < (0)) __PYX_ERR(0, 392, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_Interval_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_Interval)) __PYX_ERR(0, 494, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_Interval_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval) < (0)) __PYX_ERR(0, 494, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval = &__pyx_type_6memray_7_memray_Interval;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_Interval) < (0)) __PYX_ERR(0, 494, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_Interval);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_Interval->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Interval, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval) < (0)) __PYX_ERR(0, 494, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_Interval) < (0)) __PYX_ERR(0, 494, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_TemporalAllocationRecord_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord)) __PYX_ERR(0, 537, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_TemporalAllocationRecord_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord) < (0)) __PYX_ERR(0, 537, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord = &__pyx_type_6memray_7_memray_TemporalAllocationRecord;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord) < (0)) __PYX_ERR(0, 537, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord) < (0)) __PYX_ERR(0, 537, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord) < (0)) __PYX_ERR(0, 537, __pyx_L1_error)
  __pyx_vtabptr_6memray_7_memray_TemporalAllocationGenerator = &__pyx_vtable_6memray_7_memray_TemporalAllocationGenerator;
  __pyx_vtable_6memray_7_memray_TemporalAllocationGenerator.setup = (PyObject *(*)(struct __pyx_obj_6memray_7_memray_TemporalAllocationGenerator *, std::vector<memray::api::AllocationLifetime>  &&, std::shared_ptr<memray::api::RecordReader> ))__pyx_f_6memray_7_memray_27TemporalAllocationGenerator_setup;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_TemporalAllocationGenerator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator)) __PYX_ERR(0, 638, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_TemporalAllocationGenerator_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator = &__pyx_type_6memray_7_memray_TemporalAllocationGenerator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator, __pyx_vtabptr_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TemporalAllocationGenerator, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_TemporalAllocationGenerator) < (0)) __PYX_ERR(0, 638, __pyx_L1_error)
  __pyx_vtabptr_6memray_7_memray_Tracker = &__pyx_vtable_6memray_7_memray_Tracker;
  __pyx_vtable_6memray_7_memray_Tracker._make_writer = (std::unique_ptr<memray::io::Sink>  (*)(struct __pyx_obj_6memray_7_memray_Tracker *, PyObject *))__pyx_f_6memray_7_memray_7Tracker__make_writer;
  __pyx_vtable_6memray_7_memray_Tracker._populate_surviving_objects = (void (*)(struct __pyx_obj_6memray_7_memray_Tracker *))__pyx_f_6memray_7_memray_7Tracker__populate_surviving_objects;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_Tracker_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker)) __PYX_ERR(0, 701, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_Tracker_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker = &__pyx_type_6memray_7_memray_Tracker;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker, __pyx_vtabptr_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Tracker, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_Tracker) < (0)) __PYX_ERR(0, 701, __pyx_L1_error)
  __pyx_vtabptr_6memray_7_memray_ProgressIndicator = &__pyx_vtable_6memray_7_memray_ProgressIndicator;
  __pyx_vtable_6memray_7_memray_ProgressIndicator._time_for_refresh = (bool (*)(struct __pyx_obj_6memray_7_memray_ProgressIndicator *))__pyx_f_6memray_7_memray_17ProgressIndicator__time_for_refresh;
  __pyx_vtable_6memray_7_memray_ProgressIndicator.update = (PyObject *(*)(struct __pyx_obj_6memray_7_memray_ProgressIndicator *, size_t))__pyx_f_6memray_7_memray_17ProgressIndicator_update;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_ProgressIndicator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator)) __PYX_ERR(0, 963, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_ProgressIndicator_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator = &__pyx_type_6memray_7_memray_ProgressIndicator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_vtabptr_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ProgressIndicator, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_ProgressIndicator) < (0)) __PYX_ERR(0, 963, __pyx_L1_error)
  __pyx_vtabptr_6memray_7_memray_FileReader = &__pyx_vtable_6memray_7_memray_FileReader;
  __pyx_vtable_6memray_7_memray_FileReader.close = (PyObject *(*)(struct __pyx_obj_6memray_7_memray_FileReader *, int __pyx_skip_dispatch))__pyx_f_6memray_7_memray_10FileReader_close;
  __pyx_vtable_6memray_7_memray_FileReader._ensure_not_closed = (void (*)(struct __pyx_obj_6memray_7_memray_FileReader *))__pyx_f_6memray_7_memray_10FileReader__ensure_not_closed;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_FileReader_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader)) __PYX_ERR(0, 1053, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_FileReader_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader = &__pyx_type_6memray_7_memray_FileReader;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader, __pyx_vtabptr_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_FileReader, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_FileReader) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __pyx_vtabptr_6memray_7_memray_SocketReader = &__pyx_vtable_6memray_7_memray_SocketReader;
  __pyx_vtable_6memray_7_memray_SocketReader._teardown = (PyObject *(*)(struct __pyx_obj_6memray_7_memray_SocketReader *))__pyx_f_6memray_7_memray_12SocketReader__teardown;
  __pyx_vtable_6memray_7_memray_SocketReader._make_source = (std::unique_ptr<memray::io::SocketSource>  (*)(struct __pyx_obj_6memray_7_memray_SocketReader *))__pyx_f_6memray_7_memray_12SocketReader__make_source;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_SocketReader_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader)) __PYX_ERR(0, 1575, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_SocketReader_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader = &__pyx_type_6memray_7_memray_SocketReader;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader, __pyx_vtabptr_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_SocketReader, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_SocketReader) < (0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness)) __PYX_ERR(0, 1717, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness) < (0)) __PYX_ERR(0, 1717, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness = &__pyx_type_6memray_7_memray_HighWaterMarkAggregatorTestHarness;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness) < (0)) __PYX_ERR(0, 1717, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_2, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness) < (0)) __PYX_ERR(0, 1717, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness) < (0)) __PYX_ERR(0, 1717, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness)) __PYX_ERR(0, 1775, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness) < (0)) __PYX_ERR(0, 1775, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness = &__pyx_type_6memray_7_memray_AllocationLifetimeAggregatorTestHarness;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness) < (0)) __PYX_ERR(0, 1775, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest_2, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness) < (0)) __PYX_ERR(0, 1775, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness) < (0)) __PYX_ERR(0, 1775, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray_RecordWriterTestHarness_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness)) __PYX_ERR(0, 1809, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray_RecordWriterTestHarness_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness) < (0)) __PYX_ERR(0, 1809, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness = &__pyx_type_6memray_7_memray_RecordWriterTestHarness;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness) < (0)) __PYX_ERR(0, 1809, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness, (PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness) < (0)) __PYX_ERR(0, 1809, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness) < (0)) __PYX_ERR(0, 1809, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct____enter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__)) __PYX_ERR(0, 824, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct____enter___spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__) < (0)) __PYX_ERR(0, 824, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__ = &__pyx_type_6memray_7_memray___pyx_scope_struct____enter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__) < (0)) __PYX_ERR(0, 824, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct____enter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations)) __PYX_ERR(0, 1158, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations) < (0)) __PYX_ERR(0, 1158, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations = &__pyx_type_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations) < (0)) __PYX_ERR(0, 1158, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_1__reaggregate_allocations->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations)) __PYX_ERR(0, 1207, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations) < (0)) __PYX_ERR(0, 1207, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations = &__pyx_type_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations) < (0)) __PYX_ERR(0, 1207, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_2__aggregate_allocations->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records)) __PYX_ERR(0, 1253, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records) < (0)) __PYX_ERR(0, 1253, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records = &__pyx_type_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records) < (0)) __PYX_ERR(0, 1253, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_3_get_high_watermark_allocation_records->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records)) __PYX_ERR(0, 1267, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records) < (0)) __PYX_ERR(0, 1267, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records = &__pyx_type_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records) < (0)) __PYX_ERR(0, 1267, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_4_get_leaked_allocation_records->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records)) __PYX_ERR(0, 1280, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records) < (0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records = &__pyx_type_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records) < (0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_5_get_temporary_allocation_records->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records)) __PYX_ERR(0, 1294, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records) < (0)) __PYX_ERR(0, 1294, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records = &__pyx_type_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records) < (0)) __PYX_ERR(0, 1294, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_6_get_temporal_allocation_records->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records)) __PYX_ERR(0, 1391, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records) < (0)) __PYX_ERR(0, 1391, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records = &__pyx_type_6memray_7_memray___pyx_scope_struct_7_get_allocation_records;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records) < (0)) __PYX_ERR(0, 1391, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_7_get_allocation_records->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots)) __PYX_ERR(0, 1419, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots) < (0)) __PYX_ERR(0, 1419, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots = &__pyx_type_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots) < (0)) __PYX_ERR(0, 1419, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_8_get_memory_snapshots->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events)) __PYX_ERR(0, 1423, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events) < (0)) __PYX_ERR(0, 1423, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events = &__pyx_type_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events) < (0)) __PYX_ERR(0, 1423, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_9_get_object_lifetime_events->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot)) __PYX_ERR(0, 1649, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot) < (0)) __PYX_ERR(0, 1649, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot = &__pyx_type_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot) < (0)) __PYX_ERR(0, 1649, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_10_get_current_snapshot->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations)) __PYX_ERR(0, 1750, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations) < (0)) __PYX_ERR(0, 1750, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations = &__pyx_type_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations) < (0)) __PYX_ERR(0, 1750, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_11_get_temporal_allocations->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations)) __PYX_ERR(0, 1802, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations_spec, __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations) < (0)) __PYX_ERR(0, 1802, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations = &__pyx_type_6memray_7_memray___pyx_scope_struct_12_get_allocations;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations) < (0)) __PYX_ERR(0, 1802, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations->tp_dictoffset && __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6memray_7_memray___pyx_scope_struct_12_get_allocations->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_)) __PYX_ERR(1, 65, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py__spec, __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_) < (0)) __PYX_ERR(1, 65, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_ = &__pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_) < (0)) __PYX_ERR(1, 65, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_->tp_dictoffset && __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0)) __PYX_ERR(1, 65, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0_spec, __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0) < (0)) __PYX_ERR(1, 65, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0 = &__pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0) < (0)) __PYX_ERR(1, 65, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0->tp_dictoffset && __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype___pyx_scope_struct____Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_4(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_2_4(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyLongObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyLongObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_2_4(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyComplexObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_4(PyComplexObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_4); if (!__pyx_mstate->__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec__memray(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__memray},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "_memray",
      0, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit__memray(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__memray(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
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)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec__memray(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  size_t __pyx_t_22;
  int __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module '_memray' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_memray" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_NOT_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
    PyErr_Clear();
    __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    if (!__Pyx_RefNanny)
        Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  
__Pyx_RefNannySetupContext("PyInit__memray", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_memray___memray) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_3, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "memray._memray")) {
      if (unlikely((PyDict_SetItemString(modules, "memray._memray", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  /*--- Execution code ---*/

  /* "EnumBase":10
 * 
 * cdef object __Pyx_EnumBase
 * from enum import IntEnum as __Pyx_EnumBase             # <<<<<<<<<<<<<<
 * 
 * cdef object __Pyx_FlagBase
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntEnum};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_enum, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntEnum};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 10, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_XGOTREF(__Pyx_EnumBase);
        __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumBase":13
 * 
 * cdef object __Pyx_FlagBase
 * from enum import IntFlag as __Pyx_FlagBase             # <<<<<<<<<<<<<<
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntFlag};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_enum, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntFlag};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_XGOTREF(__Pyx_FlagBase);
        __Pyx_DECREF_SET(__Pyx_FlagBase, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":23
 * 
 * 
 * AllocatorType = __Pyx_FlagBase('AllocatorType', [             # <<<<<<<<<<<<<<
 *     ('PYMALLOC_FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_FREE)),
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__Pyx_FlagBase);
  __pyx_t_5 = __Pyx_FlagBase; 

  /* "EnumType":24
 * 
 * AllocatorType = __Pyx_FlagBase('AllocatorType', [
 *     ('PYMALLOC_FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_FREE)),             # <<<<<<<<<<<<<<
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),
 *     ('PYMALLOC_CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_CALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_PYMALLOC_FREE); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYMALLOC_FREE, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":25
 * AllocatorType = __Pyx_FlagBase('AllocatorType', [
 *     ('PYMALLOC_FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_FREE)),
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),             # <<<<<<<<<<<<<<
 *     ('PYMALLOC_CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_CALLOC)),
 *     ('PYMALLOC_REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_REALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_PYMALLOC_MALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYMALLOC_MALLOC, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":26
 *     ('PYMALLOC_FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_FREE)),
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),
 *     ('PYMALLOC_CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_CALLOC)),             # <<<<<<<<<<<<<<
 *     ('PYMALLOC_REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_REALLOC)),
 *     ('FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(FREE)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_PYMALLOC_CALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYMALLOC_CALLOC, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":27
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),
 *     ('PYMALLOC_CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_CALLOC)),
 *     ('PYMALLOC_REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_REALLOC)),             # <<<<<<<<<<<<<<
 *     ('FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(FREE)),
 *     ('MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_PYMALLOC_REALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_10 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYMALLOC_REALLOC, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":28
 *     ('PYMALLOC_CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_CALLOC)),
 *     ('PYMALLOC_REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_REALLOC)),
 *     ('FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(FREE)),             # <<<<<<<<<<<<<<
 *     ('MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MALLOC)),
 *     ('REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(REALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_FREE); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_11 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_FREE, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":29
 *     ('PYMALLOC_REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_REALLOC)),
 *     ('FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(FREE)),
 *     ('MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MALLOC)),             # <<<<<<<<<<<<<<
 *     ('REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(REALLOC)),
 *     ('CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(CALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_MALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_12 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_MALLOC, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":30
 *     ('FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(FREE)),
 *     ('MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MALLOC)),
 *     ('REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(REALLOC)),             # <<<<<<<<<<<<<<
 *     ('CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(CALLOC)),
 *     ('POSIX_MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(POSIX_MEMALIGN)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_REALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_13 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_REALLOC, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":31
 *     ('MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MALLOC)),
 *     ('REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(REALLOC)),
 *     ('CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(CALLOC)),             # <<<<<<<<<<<<<<
 *     ('POSIX_MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(POSIX_MEMALIGN)),
 *     ('ALIGNED_ALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(ALIGNED_ALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_CALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_14 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_CALLOC, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":32
 *     ('REALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(REALLOC)),
 *     ('CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(CALLOC)),
 *     ('POSIX_MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(POSIX_MEMALIGN)),             # <<<<<<<<<<<<<<
 *     ('ALIGNED_ALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(ALIGNED_ALLOC)),
 *     ('MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MEMALIGN)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_POSIX_MEMALIGN); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_15 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_POSIX_MEMALIGN, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":33
 *     ('CALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(CALLOC)),
 *     ('POSIX_MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(POSIX_MEMALIGN)),
 *     ('ALIGNED_ALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(ALIGNED_ALLOC)),             # <<<<<<<<<<<<<<
 *     ('MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MEMALIGN)),
 *     ('VALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(VALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_ALIGNED_ALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ALIGNED_ALLOC, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":34
 *     ('POSIX_MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(POSIX_MEMALIGN)),
 *     ('ALIGNED_ALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(ALIGNED_ALLOC)),
 *     ('MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MEMALIGN)),             # <<<<<<<<<<<<<<
 *     ('VALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(VALLOC)),
 *     ('PVALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PVALLOC)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_MEMALIGN); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_17 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_MEMALIGN, __pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":35
 *     ('ALIGNED_ALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(ALIGNED_ALLOC)),
 *     ('MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MEMALIGN)),
 *     ('VALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(VALLOC)),             # <<<<<<<<<<<<<<
 *     ('PVALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PVALLOC)),
 *     ('MMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MMAP)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_VALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_18 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_VALLOC, __pyx_t_6); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":36
 *     ('MEMALIGN', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MEMALIGN)),
 *     ('VALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(VALLOC)),
 *     ('PVALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PVALLOC)),             # <<<<<<<<<<<<<<
 *     ('MMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MMAP)),
 *     ('MUNMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MUNMAP)),
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_PVALLOC); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_19 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PVALLOC, __pyx_t_6); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":37
 *     ('VALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(VALLOC)),
 *     ('PVALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PVALLOC)),
 *     ('MMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MMAP)),             # <<<<<<<<<<<<<<
 *     ('MUNMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MUNMAP)),
 * 
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_MMAP); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_20 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_MMAP, __pyx_t_6); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":38
 *     ('PVALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PVALLOC)),
 *     ('MMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MMAP)),
 *     ('MUNMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MUNMAP)),             # <<<<<<<<<<<<<<
 * 
 * ], module=globals().get("__module__", 'memray._memray'))
*/
  __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(__pyx_e_6memray_7_memray_MUNMAP); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_21 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_MUNMAP, __pyx_t_6); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":23
 * 
 * 
 * AllocatorType = __Pyx_FlagBase('AllocatorType', [             # <<<<<<<<<<<<<<
 *     ('PYMALLOC_FREE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_FREE)),
 *     ('PYMALLOC_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(PYMALLOC_MALLOC)),
*/
  __pyx_t_6 = __Pyx_PyList_Pack(15, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

  /* "EnumType":40
 *     ('MUNMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MUNMAP)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_t_21 = __Pyx_Globals(); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_AllocatorType, __pyx_t_6};
    __pyx_t_20 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_21, __pyx_t_20, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_22, (3-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_20);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_AllocatorType, __pyx_t_2) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":42
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_23 = (PY_VERSION_HEX >= 0x030B0000);
  if (__pyx_t_23) {

    /* "EnumType":47
 * 
 * 
 *     AllocatorType._member_names_ = list(AllocatorType.__members__)             # <<<<<<<<<<<<<<
*/
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AllocatorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_AllocatorType); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_2) < (0)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "EnumType":42
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "EnumType":23
 * 
 * 
 * FileFormat = __Pyx_FlagBase('FileFormat', [             # <<<<<<<<<<<<<<
 *     ('ALL_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(ALL_ALLOCATIONS)),
 *     ('AGGREGATED_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(AGGREGATED_ALLOCATIONS)),
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__Pyx_FlagBase);
  __pyx_t_20 = __Pyx_FlagBase; 

  /* "EnumType":24
 * 
 * FileFormat = __Pyx_FlagBase('FileFormat', [
 *     ('ALL_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(ALL_ALLOCATIONS)),             # <<<<<<<<<<<<<<
 *     ('AGGREGATED_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(AGGREGATED_ALLOCATIONS)),
 * 
*/
  __pyx_t_21 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(__pyx_e_6memray_7_memray_ALL_ALLOCATIONS); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_6 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ALL_ALLOCATIONS, __pyx_t_21); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

  /* "EnumType":25
 * FileFormat = __Pyx_FlagBase('FileFormat', [
 *     ('ALL_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(ALL_ALLOCATIONS)),
 *     ('AGGREGATED_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(AGGREGATED_ALLOCATIONS)),             # <<<<<<<<<<<<<<
 * 
 * ], module=globals().get("__module__", 'memray._memray'))
*/
  __pyx_t_21 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(__pyx_e_6memray_7_memray_AGGREGATED_ALLOCATIONS); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_4 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_AGGREGATED_ALLOCATIONS, __pyx_t_21); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

  /* "EnumType":23
 * 
 * 
 * FileFormat = __Pyx_FlagBase('FileFormat', [             # <<<<<<<<<<<<<<
 *     ('ALL_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(ALL_ALLOCATIONS)),
 *     ('AGGREGATED_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(AGGREGATED_ALLOCATIONS)),
*/
  __pyx_t_21 = __Pyx_PyList_Pack(2, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "EnumType":27
 *     ('AGGREGATED_ALLOCATIONS', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(AGGREGATED_ALLOCATIONS)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_t_4 = __Pyx_Globals(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FileFormat, __pyx_t_21};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_4, __pyx_t_6, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_20, __pyx_callargs+__pyx_t_22, (3-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_FileFormat, __pyx_t_5) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "EnumType":29
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_23 = (PY_VERSION_HEX >= 0x030B0000);
  if (__pyx_t_23) {

    /* "EnumType":34
 * 
 * 
 *     FileFormat._member_names_ = list(FileFormat.__members__)             # <<<<<<<<<<<<<<
*/
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_FileFormat); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PySequence_ListKeepNew(__pyx_t_20); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_FileFormat); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_5) < (0)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

    /* "EnumType":29
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "EnumType":23
 * 
 * 
 * ObjectTrackingEvent = __Pyx_FlagBase('ObjectTrackingEvent', [             # <<<<<<<<<<<<<<
 *     ('OBJECT_CREATED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_CREATED)),
 *     ('OBJECT_DESTROYED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_DESTROYED)),
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__Pyx_FlagBase);
  __pyx_t_6 = __Pyx_FlagBase; 

  /* "EnumType":24
 * 
 * ObjectTrackingEvent = __Pyx_FlagBase('ObjectTrackingEvent', [
 *     ('OBJECT_CREATED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_CREATED)),             # <<<<<<<<<<<<<<
 *     ('OBJECT_DESTROYED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_DESTROYED)),
 * 
*/
  __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(__pyx_e_6memray_7_memray_OBJECT_CREATED); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_21 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_OBJECT_CREATED, __pyx_t_4); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "EnumType":25
 * ObjectTrackingEvent = __Pyx_FlagBase('ObjectTrackingEvent', [
 *     ('OBJECT_CREATED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_CREATED)),
 *     ('OBJECT_DESTROYED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_DESTROYED)),             # <<<<<<<<<<<<<<
 * 
 * ], module=globals().get("__module__", 'memray._memray'))
*/
  __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(__pyx_e_6memray_7_memray_OBJECT_DESTROYED); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_OBJECT_DESTROYED, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "EnumType":23
 * 
 * 
 * ObjectTrackingEvent = __Pyx_FlagBase('ObjectTrackingEvent', [             # <<<<<<<<<<<<<<
 *     ('OBJECT_CREATED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_CREATED)),
 *     ('OBJECT_DESTROYED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_DESTROYED)),
*/
  __pyx_t_4 = __Pyx_PyList_Pack(2, __pyx_t_21, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":27
 *     ('OBJECT_DESTROYED', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(OBJECT_DESTROYED)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ObjectTrackingEvent, __pyx_t_4};
    __pyx_t_21 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_2, __pyx_t_21, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
    __pyx_t_20 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_22, (3-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_21);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ObjectTrackingEvent, __pyx_t_20) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "EnumType":29
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_23 = (PY_VERSION_HEX >= 0x030B0000);
  if (__pyx_t_23) {

    /* "EnumType":34
 * 
 * 
 *     ObjectTrackingEvent._member_names_ = list(ObjectTrackingEvent.__members__)             # <<<<<<<<<<<<<<
*/
    __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_ObjectTrackingEvent); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = __Pyx_PySequence_ListKeepNew(__pyx_t_6); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ObjectTrackingEvent); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_20) < (0)) __PYX_ERR(1, 34, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "EnumType":29
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "EnumType":23
 * 
 * 
 * PythonAllocatorType = __Pyx_FlagBase('PythonAllocatorType', [             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_PYMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC)),
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),
*/
  __pyx_t_20 = NULL;
  __Pyx_INCREF(__Pyx_FlagBase);
  __pyx_t_21 = __Pyx_FlagBase; 

  /* "EnumType":24
 * 
 * PythonAllocatorType = __Pyx_FlagBase('PythonAllocatorType', [
 *     ('PYTHON_ALLOCATOR_PYMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC)),             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),
 *     ('PYTHON_ALLOCATOR_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MALLOC)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":25
 * PythonAllocatorType = __Pyx_FlagBase('PythonAllocatorType', [
 *     ('PYTHON_ALLOCATOR_PYMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC)),
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MALLOC)),
 *     ('PYTHON_ALLOCATOR_OTHER', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_OTHER)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_PYMALLOC_DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_PYMALLOC_DEBUG, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":26
 *     ('PYTHON_ALLOCATOR_PYMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC)),
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),
 *     ('PYTHON_ALLOCATOR_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MALLOC)),             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_OTHER', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_OTHER)),
 *     ('PYTHON_ALLOCATOR_MIMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MALLOC, __pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":27
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),
 *     ('PYTHON_ALLOCATOR_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MALLOC)),
 *     ('PYTHON_ALLOCATOR_OTHER', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_OTHER)),             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_MIMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC)),
 *     ('PYTHON_ALLOCATOR_MIMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC_DEBUG)),
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_OTHER); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_18 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_OTHER, __pyx_t_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":28
 *     ('PYTHON_ALLOCATOR_MALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MALLOC)),
 *     ('PYTHON_ALLOCATOR_OTHER', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_OTHER)),
 *     ('PYTHON_ALLOCATOR_MIMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC)),             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_MIMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC_DEBUG)),
 * 
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_17 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC, __pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":29
 *     ('PYTHON_ALLOCATOR_OTHER', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_OTHER)),
 *     ('PYTHON_ALLOCATOR_MIMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC)),
 *     ('PYTHON_ALLOCATOR_MIMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC_DEBUG)),             # <<<<<<<<<<<<<<
 * 
 * ], module=globals().get("__module__", 'memray._memray'))
*/
  __pyx_t_2 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(__pyx_e_6memray_7_memray_PYTHON_ALLOCATOR_MIMALLOC_DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PYTHON_ALLOCATOR_MIMALLOC_DEBUG, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "EnumType":23
 * 
 * 
 * PythonAllocatorType = __Pyx_FlagBase('PythonAllocatorType', [             # <<<<<<<<<<<<<<
 *     ('PYTHON_ALLOCATOR_PYMALLOC', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC)),
 *     ('PYTHON_ALLOCATOR_PYMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_PYMALLOC_DEBUG)),
*/
  __pyx_t_2 = __Pyx_PyList_Pack(6, __pyx_t_4, __pyx_t_5, __pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "EnumType":31
 *     ('PYTHON_ALLOCATOR_MIMALLOC_DEBUG', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(PYTHON_ALLOCATOR_MIMALLOC_DEBUG)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_t_16 = __Pyx_Globals(); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_20, __pyx_mstate_global->__pyx_n_u_PythonAllocatorType, __pyx_t_2};
    __pyx_t_17 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_16, __pyx_t_17, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
    __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_21, __pyx_callargs+__pyx_t_22, (3-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_17);
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PythonAllocatorType, __pyx_t_6) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "EnumType":33
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_23 = (PY_VERSION_HEX >= 0x030B0000);
  if (__pyx_t_23) {

    /* "EnumType":38
 * 
 * 
 *     PythonAllocatorType._member_names_ = list(PythonAllocatorType.__members__)             # <<<<<<<<<<<<<<
*/
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_PythonAllocatorType); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PySequence_ListKeepNew(__pyx_t_21); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_PythonAllocatorType); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_6) < (0)) __PYX_ERR(1, 38, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

    /* "EnumType":33
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "EnumType":23
 * 
 * 
 * SymbolicSupport = __Pyx_FlagBase('SymbolicSupport', [             # <<<<<<<<<<<<<<
 *     ('NONE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(NONE)),
 *     ('FUNCTION_NAME_ONLY', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(FUNCTION_NAME_ONLY)),
*/
  __pyx_t_6 = NULL;
  __Pyx_INCREF(__Pyx_FlagBase);
  __pyx_t_17 = __Pyx_FlagBase; 

  /* "EnumType":24
 * 
 * SymbolicSupport = __Pyx_FlagBase('SymbolicSupport', [
 *     ('NONE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(NONE)),             # <<<<<<<<<<<<<<
 *     ('FUNCTION_NAME_ONLY', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(FUNCTION_NAME_ONLY)),
 *     ('TOTAL', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(TOTAL)),
*/
  __pyx_t_16 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(__pyx_e_6memray_7_memray_NONE); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_NONE, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "EnumType":25
 * SymbolicSupport = __Pyx_FlagBase('SymbolicSupport', [
 *     ('NONE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(NONE)),
 *     ('FUNCTION_NAME_ONLY', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(FUNCTION_NAME_ONLY)),             # <<<<<<<<<<<<<<
 *     ('TOTAL', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(TOTAL)),
 * 
*/
  __pyx_t_16 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(__pyx_e_6memray_7_memray_FUNCTION_NAME_ONLY); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_20 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_FUNCTION_NAME_ONLY, __pyx_t_16); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "EnumType":26
 *     ('NONE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(NONE)),
 *     ('FUNCTION_NAME_ONLY', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(FUNCTION_NAME_ONLY)),
 *     ('TOTAL', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(TOTAL)),             # <<<<<<<<<<<<<<
 * 
 * ], module=globals().get("__module__", 'memray._memray'))
*/
  __pyx_t_16 = __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(__pyx_e_6memray_7_memray_TOTAL); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_18 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_TOTAL, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "EnumType":23
 * 
 * 
 * SymbolicSupport = __Pyx_FlagBase('SymbolicSupport', [             # <<<<<<<<<<<<<<
 *     ('NONE', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(NONE)),
 *     ('FUNCTION_NAME_ONLY', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(FUNCTION_NAME_ONLY)),
*/
  __pyx_t_16 = __Pyx_PyList_Pack(3, __pyx_t_2, __pyx_t_20, __pyx_t_18); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "EnumType":28
 *     ('TOTAL', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(TOTAL)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_t_18 = __Pyx_Globals(); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_SymbolicSupport, __pyx_t_16};
    __pyx_t_20 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_18, __pyx_t_20, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
    __pyx_t_21 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_17, __pyx_callargs+__pyx_t_22, (3-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_20);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SymbolicSupport, __pyx_t_21) < (0)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

  /* "EnumType":30
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_23 = (PY_VERSION_HEX >= 0x030B0000);
  if (__pyx_t_23) {

    /* "EnumType":35
 * 
 * 
 *     SymbolicSupport._member_names_ = list(SymbolicSupport.__members__)             # <<<<<<<<<<<<<<
*/
    __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_SymbolicSupport); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __pyx_t_21 = __Pyx_PySequence_ListKeepNew(__pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_SymbolicSupport); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_21) < (0)) __PYX_ERR(1, 35, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    /* "EnumType":30
 * ], module=globals().get("__module__", 'memray._memray'))
 * 
 * if PY_VERSION_HEX >= 0x030B0000:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "memray/_memray.pyx":1
 * import collections             # <<<<<<<<<<<<<<
 * import contextlib
 * import os
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_collections, __pyx_t_17) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":2
 * import collections
 * import contextlib             # <<<<<<<<<<<<<<
 * import os
 * import pathlib
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_contextlib, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_contextlib, __pyx_t_17) < (0)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":3
 * import collections
 * import contextlib
 * import os             # <<<<<<<<<<<<<<
 * import pathlib
 * import platform
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_os, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_os, __pyx_t_17) < (0)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":4
 * import contextlib
 * import os
 * import pathlib             # <<<<<<<<<<<<<<
 * import platform
 * import sys
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pathlib, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pathlib, __pyx_t_17) < (0)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":5
 * import os
 * import pathlib
 * import platform             # <<<<<<<<<<<<<<
 * import sys
 * 
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_platform, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_platform, __pyx_t_17) < (0)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":6
 * import pathlib
 * import platform
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cimport cython
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_17) < (0)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":10
 * cimport cython
 * 
 * import threading             # <<<<<<<<<<<<<<
 * from datetime import datetime
 * 
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_threading, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_threading, __pyx_t_17) < (0)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":11
 * 
 * import threading
 * from datetime import datetime             # <<<<<<<<<<<<<<
 * 
 * from rich import print as pprint
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_datetime};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_datetime, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_datetime};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":13
 * from datetime import datetime
 * 
 * from rich import print as pprint             # <<<<<<<<<<<<<<
 * from rich.progress import Progress
 * from rich.progress import SpinnerColumn
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_print};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_rich, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_print};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      switch (__pyx_t_3) {
        case 0:
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pprint, __pyx_t_21) < (0)) __PYX_ERR(0, 13, __pyx_L1_error)
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":14
 * 
 * from rich import print as pprint
 * from rich.progress import Progress             # <<<<<<<<<<<<<<
 * from rich.progress import SpinnerColumn
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Progress};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_rich_progress, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Progress};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":15
 * from rich import print as pprint
 * from rich.progress import Progress
 * from rich.progress import SpinnerColumn             # <<<<<<<<<<<<<<
 * 
 * from posix.time cimport CLOCK_MONOTONIC
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_SpinnerColumn};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_rich_progress, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_SpinnerColumn};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":86
 * from libcpp.vector cimport vector
 * 
 * from ._destination import Destination             # <<<<<<<<<<<<<<
 * from ._destination import FileDestination
 * from ._destination import SocketDestination
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Destination};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_destination_2, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__destination, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Destination};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":87
 * 
 * from ._destination import Destination
 * from ._destination import FileDestination             # <<<<<<<<<<<<<<
 * from ._destination import SocketDestination
 * from ._metadata import Metadata
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_FileDestination};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_destination_2, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__destination, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_FileDestination};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":88
 * from ._destination import Destination
 * from ._destination import FileDestination
 * from ._destination import SocketDestination             # <<<<<<<<<<<<<<
 * from ._metadata import Metadata
 * from ._stats import Stats
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_SocketDestination};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_destination_2, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__destination, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_SocketDestination};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":89
 * from ._destination import FileDestination
 * from ._destination import SocketDestination
 * from ._metadata import Metadata             # <<<<<<<<<<<<<<
 * from ._stats import Stats
 * from ._thread_name_interceptor import ThreadNameInterceptor
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Metadata};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_metadata_2, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__metadata, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Metadata};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":90
 * from ._destination import SocketDestination
 * from ._metadata import Metadata
 * from ._stats import Stats             # <<<<<<<<<<<<<<
 * from ._thread_name_interceptor import ThreadNameInterceptor
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Stats};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_stats_2, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__stats, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Stats};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":91
 * from ._metadata import Metadata
 * from ._stats import Stats
 * from ._thread_name_interceptor import ThreadNameInterceptor             # <<<<<<<<<<<<<<
 * 
 * # NOTE: We can't reinitialize tracking in a child process until the interpreter
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ThreadNameInterceptor};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thread_name_interceptor, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_memray__thread_name_interceptor, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  }
  __pyx_t_17 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_17);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ThreadNameInterceptor};
    __pyx_t_3 = 0; {
      __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_17, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_21) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":98
 * #       the child process must never inherit an active tracker, so we must use
 * #       a pthread fork handler to disable tracking before forking.
 * set_up_pthread_fork_handlers()             # <<<<<<<<<<<<<<
 * os.register_at_fork(after_in_child=NativeTracker.childFork)
 * 
*/
  try {
    memray::tracking_api::set_up_pthread_fork_handlers();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 98, __pyx_L1_error)
  }

  /* "memray/_memray.pyx":99
 * #       a pthread fork handler to disable tracking before forking.
 * set_up_pthread_fork_handlers()
 * os.register_at_fork(after_in_child=NativeTracker.childFork)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_21 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_register_at_fork); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = __Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_(memray::tracking_api::Tracker::childFork); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_21, NULL};
    __pyx_t_16 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_after_in_child, __pyx_t_20, __pyx_t_16, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 99, __pyx_L1_error)
    __pyx_t_17 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_18, __pyx_callargs+__pyx_t_22, (1-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_16);
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":102
 * 
 * 
 * def set_log_level(int level):             # <<<<<<<<<<<<<<
 *     """Configure which log messages will be printed to stderr by memray.
 * 
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_1set_log_level, 0, __pyx_mstate_global->__pyx_n_u_set_log_level, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_set_log_level, __pyx_t_17) < (0)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":151
 * 
 * 
 * def size_fmt(num, suffix='B'):             # <<<<<<<<<<<<<<
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_3size_fmt, 0, __pyx_mstate_global->__pyx_n_u_size_fmt, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[6]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_size_fmt, __pyx_t_17) < (0)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":348
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_16AllocationRecord_7stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationRecord_stack_trace, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_mstate_global->__pyx_n_u_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":360
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_16AllocationRecord_9native_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationRecord_native_stack_tr, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_mstate_global->__pyx_n_u_native_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":372
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_16AllocationRecord_11hybrid_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationRecord_hybrid_stack_tr, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationRecord, __pyx_mstate_global->__pyx_n_u_hybrid_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 372, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_16AllocationRecord_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationRecord___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_16AllocationRecord_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationRecord___setstate_cyth, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":443
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         event = (
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_19TrackedObjectRecord_7stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord_stack_trace, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, __pyx_mstate_global->__pyx_n_u_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":459
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         event = (
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_19TrackedObjectRecord_9native_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord_native_stack, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, __pyx_mstate_global->__pyx_n_u_native_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":475
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_19TrackedObjectRecord_11hybrid_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord_hybrid_stack, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TrackedObjectRecord, __pyx_mstate_global->__pyx_n_u_hybrid_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_19TrackedObjectRecord_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._reader cannot be converted to a Python object for pickling"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_19TrackedObjectRecord_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TrackedObjectRecord___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_8Interval_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Interval___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_8Interval_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Interval___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":583
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_7stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord_stack_t, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, __pyx_mstate_global->__pyx_n_u_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":595
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def native_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("native", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_9native_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord_native, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, __pyx_mstate_global->__pyx_n_u_native_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":607
 *         return self._stack_trace_cache[cache_key]
 * 
 *     def hybrid_stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("hybrid", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_11hybrid_stack_trace, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord_hybrid, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_TemporalAllocationRecord, __pyx_mstate_global->__pyx_n_u_hybrid_stack_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord___reduc, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_24TemporalAllocationRecord_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationRecord___setst, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_27TemporalAllocationGenerator_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationGenerator___re, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_27TemporalAllocationGenerator_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TemporalAllocationGenerator___se, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":696
 * 
 * 
 * MemorySnapshot = collections.namedtuple("MemorySnapshot", "time rss heap")             # <<<<<<<<<<<<<<
 * 
 * tracker_creation_lock = threading.Lock()
*/
  __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_namedtuple); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_mstate_global->__pyx_tuple[8], NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MemorySnapshot, __pyx_t_17) < (0)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":698
 * MemorySnapshot = collections.namedtuple("MemorySnapshot", "time rss heap")
 * 
 * tracker_creation_lock = threading.Lock()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_18 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_threading); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_Lock); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_18, NULL};
    __pyx_t_17 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_20, __pyx_callargs+__pyx_t_22, (1-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_tracker_creation_lock, __pyx_t_17) < (0)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":785
 *                   bool follow_fork=False, bool trace_python_allocators=False,
 *                   bool track_object_lifetimes=False,
 *                   FileFormat file_format=FileFormat.ALL_ALLOCATIONS):             # <<<<<<<<<<<<<<
 *         if (file_name, destination).count(None) != 1:
 *             raise TypeError("Exactly one of 'file_name' or 'destination' argument must be specified")
*/
  __pyx_mstate_global->__pyx_k__4 = __pyx_e_6memray_7_memray_ALL_ALLOCATIONS;

  /* "memray/_memray.pyx":824
 *         )
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         cdef unique_ptr[RecordWriter] writer
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tracker___enter, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_Tracker, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_17) < (0)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":868
 *             return self
 * 
 *     @cython.profile(False)             # <<<<<<<<<<<<<<
 *     def __exit__(self, exc_type, exc_value, exc_traceback):
 *         if self._track_object_lifetimes:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tracker___exit, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_Tracker, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_17) < (0)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":891
 *             Py_DECREF(<object>obj)
 * 
 *     def get_surviving_objects(self):             # <<<<<<<<<<<<<<
 *         """Get a list of objects that were alive at the end of the tracking period.
 * 
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_7get_surviving_objects, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tracker_get_surviving_objects, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_Tracker, __pyx_mstate_global->__pyx_n_u_get_surviving_objects, __pyx_t_17) < (0)) __PYX_ERR(0, 891, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tracker___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7Tracker_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tracker___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":912
 * 
 * 
 * def start_thread_trace(frame, event, arg):             # <<<<<<<<<<<<<<
 *     if event in {"call", "c_call"}:
 *         install_trace_function()
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_5start_thread_trace, 0, __pyx_mstate_global->__pyx_n_u_start_thread_trace, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_start_thread_trace, __pyx_t_17) < (0)) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":918
 * 
 * 
 * def greenlet_trace_function(event, args):             # <<<<<<<<<<<<<<
 *     if event in {"switch", "throw"}:
 *         NativeTracker.handleGreenletSwitch(args[0], args[1])
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_7greenlet_trace_function, 0, __pyx_mstate_global->__pyx_n_u_greenlet_trace_function, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_greenlet_trace_function, __pyx_t_17) < (0)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":923
 * 
 * 
 * def print_greenlet_warning():             # <<<<<<<<<<<<<<
 *     pprint(
 *         ":warning: [bold red]Memray support for Greenlet is experimental[/] :warning:\n"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_9print_greenlet_warning, 0, __pyx_mstate_global->__pyx_n_u_print_greenlet_warning, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_print_greenlet_warning, __pyx_t_17) < (0)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1000
 *             )
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return self
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_17ProgressIndicator_3__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ProgressIndicator___enter, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_17) < (0)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1010
 *         return self
 * 
 *     def __exit__(self, type, value, traceback):             # <<<<<<<<<<<<<<
 *         if not self._report_progress:
 *             return
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_17ProgressIndicator_5__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ProgressIndicator___exit, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_ProgressIndicator, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_17) < (0)) __PYX_ERR(0, 1010, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_17ProgressIndicator_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ProgressIndicator___reduce_cytho, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "Pickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_17ProgressIndicator_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ProgressIndicator___setstate_cyt, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1138
 *         self.close()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         if self._file is not None:
 *             file = self._file
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_5close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_close, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_17) < (0)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1152
 *         return self._file is None
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_7__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader___enter, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_17) < (0)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1155
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_9__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader___exit, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_17) < (0)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1158
 *         self.close()
 * 
 *     def _reaggregate_allocations(             # <<<<<<<<<<<<<<
 *         self, size_t records_to_process, bool merge_threads, bool leaks
 *     ):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_11_reaggregate_allocations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader__reaggregate_allocati, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_reaggregate_allocations, __pyx_t_17) < (0)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1207
 *         reader.close()
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,             # <<<<<<<<<<<<<<
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_14_aggregate_allocations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader__aggregate_allocation, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[9]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_aggregate_allocations, __pyx_t_17) < (0)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1253
 *         reader.close()
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_17get_high_watermark_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_high_watermark_al, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[10]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_high_watermark_allocation_re, __pyx_t_17) < (0)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1267
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_leaked_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_20get_leaked_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_leaked_allocation, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[10]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_leaked_allocation_records, __pyx_t_17) < (0)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1280
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_23get_temporary_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_temporary_allocat, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[11]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_temporary_allocation_records, __pyx_t_17) < (0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1294
 *         )
 * 
 *     def get_temporal_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_26get_temporal_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_temporal_allocati, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[10]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_temporal_allocation_records, __pyx_t_17) < (0)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1342
 *         yield from gen
 * 
 *     def get_temporal_high_water_mark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_29get_temporal_high_water_mark_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_temporal_high_wat, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[10]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_temporal_high_water_mark_all, __pyx_t_17) < (0)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1391
 *         return gen, hwm_by_snapshot
 * 
 *     def get_allocation_records(self):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_31get_allocation_records, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_allocation_record, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_allocation_records, __pyx_t_17) < (0)) __PYX_ERR(0, 1391, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1419
 *         reader.close()
 * 
 *     def get_memory_snapshots(self):             # <<<<<<<<<<<<<<
 *         for record in self._memory_snapshots:
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_34get_memory_snapshots, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_memory_snapshots, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_memory_snapshots, __pyx_t_17) < (0)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1423
 *             yield MemorySnapshot(record.ms_since_epoch, record.rss, record.heap)
 * 
 *     def get_object_lifetime_events(self, included_objects=None):             # <<<<<<<<<<<<<<
 *         """Return all object lifetime events recorded in the file.
 * 
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_37get_object_lifetime_events, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader_get_object_lifetime_e, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[7]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_FileReader, __pyx_mstate_global->__pyx_n_u_get_object_lifetime_events, __pyx_t_17) < (0)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_40__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_10FileReader_42__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_FileReader___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1484
 * 
 * 
 * def compute_statistics(             # <<<<<<<<<<<<<<
 *     file_name,
 *     *,
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_report_progress, ((PyObject*)Py_False)) < (0)) __PYX_ERR(0, 1484, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_num_largest, ((PyObject*)__pyx_mstate_global->__pyx_int_5)) < (0)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_11compute_statistics, 0, __pyx_mstate_global->__pyx_n_u_compute_statistics, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_compute_statistics, __pyx_t_20) < (0)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1565
 * 
 * 
 * def dump_all_records(object file_name):             # <<<<<<<<<<<<<<
 *     cdef str path = str(file_name)
 *     if not pathlib.Path(path).exists():
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_13dump_all_records, 0, __pyx_mstate_global->__pyx_n_u_dump_all_records, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dump_all_records, __pyx_t_20) < (0)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1600
 *         return unique_ptr[SocketSource](source)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._impl is not NULL:
 *             raise ValueError(
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_12SocketReader_5__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SocketReader___enter, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_SocketReader, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_20) < (0)) __PYX_ERR(0, 1600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1615
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, exc_traceback):             # <<<<<<<<<<<<<<
 *         assert self._impl is not NULL
 * 
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_12SocketReader_7__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SocketReader___exit, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_SocketReader, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_20) < (0)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1649
 *         return self._header["native_traces"]
 * 
 *     def get_current_snapshot(self, *, bool merge_threads):             # <<<<<<<<<<<<<<
 *         if self._impl is NULL:
 *             return
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_12SocketReader_11get_current_snapshot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SocketReader_get_current_snapsho, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_SocketReader, __pyx_mstate_global->__pyx_n_u_get_current_snapshot, __pyx_t_20) < (0)) __PYX_ERR(0, 1649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_12SocketReader_14__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SocketReader___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_12SocketReader_16__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SocketReader___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1664
 *     TOTAL = 3
 * 
 * def get_symbolic_support():             # <<<<<<<<<<<<<<
 *     locations = unwindHere()
 *     for location in locations:
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_15get_symbolic_support, 0, __pyx_mstate_global->__pyx_n_u_get_symbolic_support, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_symbolic_support, __pyx_t_20) < (0)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1686
 * 
 * 
 * RTLD_NOW = _RTLD_NOW             # <<<<<<<<<<<<<<
 * RTLD_DEFAULT = <long long>_RTLD_DEFAULT
 * 
*/
  __pyx_t_20 = __Pyx_PyLong_From_int(RTLD_NOW); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_RTLD_NOW, __pyx_t_20) < (0)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1687
 * 
 * RTLD_NOW = _RTLD_NOW
 * RTLD_DEFAULT = <long long>_RTLD_DEFAULT             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_20 = __Pyx_PyLong_From_PY_LONG_LONG(((PY_LONG_LONG)RTLD_DEFAULT)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_RTLD_DEFAULT, __pyx_t_20) < (0)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1690
 * 
 * 
 * def _rss_from_proc_status_for_testing(str proc_status):             # <<<<<<<<<<<<<<
 *     cdef cppstring encoded_proc_status = proc_status.encode("utf-8")
 *     cdef size_t rss_in_bytes
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_17_rss_from_proc_status_for_testing, 0, __pyx_mstate_global->__pyx_n_u_rss_from_proc_status_for_testin, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_rss_from_proc_status_for_testin, __pyx_t_20) < (0)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1720
 *     cdef HighWaterMarkAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_1add_allocation, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_3, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_add_allocation, __pyx_t_20) < (0)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1741
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_3capture_snapshot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_4, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_capture_snapshot, __pyx_t_20) < (0)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1744
 *         return self.aggregator.captureSnapshot()
 * 
 *     def high_water_mark_bytes_by_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_5high_water_mark_bytes_by_snapshot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_5, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_high_water_mark_bytes_by_snapsho, __pyx_t_20) < (0)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1747
 *         return self.aggregator.highWaterMarkBytesBySnapshot()
 * 
 *     def get_current_heap_size(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.getCurrentHeapSize()
 * 
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_7get_current_heap_size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_6, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_get_current_heap_size, __pyx_t_20) < (0)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1750
 *         return self.aggregator.getCurrentHeapSize()
 * 
 *     def get_temporal_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_9get_temporal_allocations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_get_temporal_allocations, __pyx_t_20) < (0)) __PYX_ERR(0, 1750, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1756
 *         yield from gen
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         ret = []
 *         for allocation in collectAllocations(self.aggregator):
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_12get_allocations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_7, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_HighWaterMarkAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_get_allocations, __pyx_t_20) < (0)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_14__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_8, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_34HighWaterMarkAggregatorTestHarness_16__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_HighWaterMarkAggregatorTestHarne_9, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1778
 *     cdef AllocationLifetimeAggregator aggregator
 * 
 *     def add_allocation(             # <<<<<<<<<<<<<<
 *         self,
 *         tid,
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_1add_allocation, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest_3, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_add_allocation, __pyx_t_20) < (0)) __PYX_ERR(0, 1778, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1799
 *         self.aggregator.addAllocation(allocation)
 * 
 *     def capture_snapshot(self):             # <<<<<<<<<<<<<<
 *         return self.aggregator.captureSnapshot()
 * 
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_3capture_snapshot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest_4, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_capture_snapshot, __pyx_t_20) < (0)) __PYX_ERR(0, 1799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1802
 *         return self.aggregator.captureSnapshot()
 * 
 *     def get_allocations(self):             # <<<<<<<<<<<<<<
 *         cdef shared_ptr[RecordReader] reader
 *         cdef TemporalAllocationGenerator gen = TemporalAllocationGenerator()
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_5get_allocations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_AllocationLifetimeAggregatorTestHarness, __pyx_mstate_global->__pyx_n_u_get_allocations, __pyx_t_20) < (0)) __PYX_ERR(0, 1802, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_8__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest_5, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.aggregator cannot be converted to a Python object for pickling"
*/
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_39AllocationLifetimeAggregatorTestHarness_10__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AllocationLifetimeAggregatorTest_6, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_20) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1820
 *         bool trace_python_allocators=False,
 *         track_object_lifetimes=False,
 *         records.FileFormat file_format=records.FileFormat.ALL_ALLOCATIONS,             # <<<<<<<<<<<<<<
 *         records.thread_id_t main_tid=1,
 *         size_t skipped_frames=0,
*/
  __pyx_mstate_global->__pyx_k__10 = memray::tracking_api::FileFormat::ALL_ALLOCATIONS;

  /* "memray/_memray.pyx":1845
 *         self.write_header(False)
 * 
 *     def write_header(self, bool seek_to_start) -> None:             # <<<<<<<<<<<<<<
 *         if not self._writer.get().writeHeader(seek_to_start):
 *             raise RuntimeError("Failed to write header")
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1845, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_3write_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_he, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_header, __pyx_t_17) < (0)) __PYX_ERR(0, 1845, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1849
 *             raise RuntimeError("Failed to write header")
 * 
 *     def write_memory_record(self, uint64_t ms_since_epoch, size_t rss) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a memory record to the file."""
 *         cdef records.MemoryRecord record
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_5write_memory_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_me, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_memory_record, __pyx_t_20) < (0)) __PYX_ERR(0, 1849, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1856
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_code_object(             # <<<<<<<<<<<<<<
 *         self,
 *         records.code_object_id_t id,
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1856, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_7write_code_object, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_co, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_code_object, __pyx_t_17) < (0)) __PYX_ERR(0, 1856, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1877
 *         )
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_linetable(code_object):
 *         """Get the linetable from a code object."""
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_9get_linetable, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_get_line, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_linetable, __pyx_t_17) < (0)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_20 = NULL;
  __Pyx_GetNameInClass(__pyx_t_18, (PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_linetable); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_18};
    __pyx_t_17 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_22, (2-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_linetable, __pyx_t_17) < (0)) __PYX_ERR(0, 1877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1888
 *         return <bytes>addr[:size]
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def get_lasti(frame_object):
 *         """Get the linetable from a code object."""
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_11get_lasti, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_get_last, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_lasti, __pyx_t_17) < (0)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_18 = NULL;
  __Pyx_GetNameInClass(__pyx_t_20, (PyObject*)__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_lasti); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_22 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_20};
    __pyx_t_17 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_22, (2-__pyx_t_22) | (__pyx_t_22*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_get_lasti, __pyx_t_17) < (0)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1896
 *         return frameGetLasti(<PyFrameObject*>frame_object)
 * 
 *     def write_unresolved_native_frame(self, uintptr_t ip, size_t index) -> bool:             # <<<<<<<<<<<<<<
 *         """Write an unresolved native frame record to the file."""
 *         cdef records.UnresolvedNativeFrame record
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_13write_unresolved_native_frame, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_un, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_unresolved_native_frame, __pyx_t_20) < (0)) __PYX_ERR(0, 1896, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1903
 *         return self._writer.get().writeRecord(record)
 * 
 *     def write_allocation_record(self, records.thread_id_t tid, uintptr_t address,             # <<<<<<<<<<<<<<
 *                                      size_t size, unsigned char allocator,
 *                                      size_t native_frame_id=0) -> bool:
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_15write_allocation_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_al, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_17, __pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_allocation_record, __pyx_t_17) < (0)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1914
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_push(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_17write_frame_push, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_fr, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_frame_push, __pyx_t_20) < (0)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1928
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_frame_pop(self, records.thread_id_t tid, size_t count) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a frame pop record to the file."""
 *         cdef records.FramePop record
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_19write_frame_pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_fr_2, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_frame_pop, __pyx_t_17) < (0)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1934
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_thread_record(self, records.thread_id_t tid, str name) -> bool:             # <<<<<<<<<<<<<<
 *         """Write a thread record to the file."""
 *         cdef records.ThreadRecord record
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_21write_thread_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_th, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_thread_record, __pyx_t_20) < (0)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1941
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_mappings(self, list mappings) -> bool:             # <<<<<<<<<<<<<<
 *         """Write memory mappings to the file."""
 *         return self._writer.get().writeMappings(
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_23write_mappings, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_ma, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_mappings, __pyx_t_17) < (0)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1957
 *         )
 * 
 *     def write_object_record(             # <<<<<<<<<<<<<<
 *         self,
 *         records.thread_id_t tid,
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __pyx_t_20 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_25write_object_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_ob, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_20);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_20, __pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_20, __pyx_t_17);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_object_record, __pyx_t_20) < (0)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

  /* "memray/_memray.pyx":1971
 *         return self._writer.get().writeThreadSpecificRecord(tid, record)
 * 
 *     def write_trailer(self) -> bool:             # <<<<<<<<<<<<<<
 *         """Write the trailer to the file."""
 *         return self._writer.get().writeTrailer()
*/
  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  if (PyDict_SetItem(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_27write_trailer, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness_write_tr, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_17, __pyx_t_20);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6memray_7_memray_RecordWriterTestHarness, __pyx_mstate_global->__pyx_n_u_write_trailer, __pyx_t_17) < (0)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_29__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness___reduce, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_6memray_7_memray_23RecordWriterTestHarness_31__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RecordWriterTestHarness___setsta, NULL, __pyx_mstate_global->__pyx_n_u_memray__memray, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87])); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_17);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_17) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "memray/_memray.pyx":1
 * import collections             # <<<<<<<<<<<<<<
 * import contextlib
 * import os
*/
  __pyx_t_17 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_17) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init memray._memray", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init memray._memray");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 1877, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 304, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_map); if (!__pyx_builtin_map) __PYX_ERR(0, 793, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_open); if (!__pyx_builtin_open) __PYX_ERR(0, 1065, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(0, 1440, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "memray/_memray.pyx":152
 * 
 * def size_fmt(num, suffix='B'):
 *     for unit in ['','k','M','G','T','P','E','Z']:             # <<<<<<<<<<<<<<
 *         if abs(num) < 1000.0:
 *             return f"{num:5.3f}{unit}{suffix}"
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(8, __pyx_mstate_global->__pyx_kp_u_, __pyx_mstate_global->__pyx_n_u_k, __pyx_mstate_global->__pyx_n_u_M, __pyx_mstate_global->__pyx_n_u_G, __pyx_mstate_global->__pyx_n_u_T, __pyx_mstate_global->__pyx_n_u_P, __pyx_mstate_global->__pyx_n_u_E, __pyx_mstate_global->__pyx_n_u_Z); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "memray/_memray.pyx":766
 *         if isinstance(destination, FileDestination):
 *             is_dev_null = False
 *             with contextlib.suppress(OSError):             # <<<<<<<<<<<<<<
 *                 if pathlib.Path("/dev/null").samefile(destination.path):
 *                     is_dev_null = True
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "memray/_memray.pyx":790
 * 
 *         # Check Python version if reference tracking is enabled
 *         if track_object_lifetimes and sys.version_info < (3, 13, 3):             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_3, __pyx_mstate_global->__pyx_int_13, __pyx_mstate_global->__pyx_int_3); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "memray/_memray.pyx":793
 *             raise RuntimeError(
 *                 "Python object reference tracking requires Python 3.13.3 or later. "
 *                 f"Current version: {'.'.join(map(str, sys.version_info[:3]))}"             # <<<<<<<<<<<<<<
 *             )
 * 
*/
  __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_3, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

  /* "memray/_memray.pyx":835
 *             writer = move(self._writer)
 * 
 *             for attr in ("_name", "_ident"):             # <<<<<<<<<<<<<<
 *                 assert not hasattr(threading.Thread, attr)
 *                 setattr(
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_ident); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "memray/_memray.pyx":1539
 * 
 *     # Convert top locations by bytes allocated/by allocation count to dicts
 *     unknown = ("<unknown>", "<unknown>", 0)             # <<<<<<<<<<<<<<
 * 
 *     top_locations_by_size = [
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_kp_u_unknown_2, __pyx_mstate_global->__pyx_kp_u_unknown_2, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "EnumType":40
 *     ('MUNMAP', __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(MUNMAP)),
 * 
 * ], module=globals().get("__module__", 'memray._memray'))             # <<<<<<<<<<<<<<
 * 
 * if PY_VERSION_HEX >= 0x030B0000:
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_module_2, __pyx_mstate_global->__pyx_kp_u_memray__memray); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "memray/_memray.pyx":151
 * 
 * 
 * def size_fmt(num, suffix='B'):             # <<<<<<<<<<<<<<
 *     for unit in ['','k','M','G','T','P','E','Z']:
 *         if abs(num) < 1000.0:
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_n_u_B)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);

  /* "memray/_memray.pyx":348
 *         return self._reader.get().getThreadName(self.tid)
 * 
 *     def stack_trace(self, max_stacks=None):             # <<<<<<<<<<<<<<
 *         cache_key = ("python", max_stacks)
 *         if cache_key not in self._stack_trace_cache:
*/
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "memray/_memray.pyx":696
 * 
 * 
 * MemorySnapshot = collections.namedtuple("MemorySnapshot", "time rss heap")             # <<<<<<<<<<<<<<
 * 
 * tracker_creation_lock = threading.Lock()
*/
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_MemorySnapshot, __pyx_mstate_global->__pyx_kp_u_time_rss_heap); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "memray/_memray.pyx":1207
 *         reader.close()
 * 
 *     def _aggregate_allocations(self, size_t records_to_process, bool merge_threads,             # <<<<<<<<<<<<<<
 *                                size_t temporary_buffer_size=0):
 *         cdef unique_ptr[AbstractAggregator] the_aggregator
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "memray/_memray.pyx":1253
 *         reader.close()
 * 
 *     def get_high_watermark_allocation_records(self, merge_threads=True):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "memray/_memray.pyx":1280
 *         yield from self._aggregate_allocations(max_records, merge_threads)
 * 
 *     def get_temporary_allocation_records(self, merge_threads=True, threshold=1):             # <<<<<<<<<<<<<<
 *         self._ensure_not_closed()
 *         if self._header["file_format"] == FileFormat.AGGREGATED_ALLOCATIONS:
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(2, Py_True, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<12; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_slice;
    for (Py_ssize_t i=0; i<1; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 9; } index[] = {{0},{3},{4},{46},{21},{37},{26},{84},{61},{69},{61},{65},{38},{38},{20},{20},{70},{22},{23},{38},{22},{35},{3},{64},{14},{56},{45},{46},{47},{47},{50},{46},{50},{4},{179},{123},{32},{106},{29},{83},{47},{24},{61},{1},{1},{1},{1},{1},{3},{2},{1},{8},{10},{14},{12},{11},{6},{30},{58},{9},{7},{6},{35},{2},{13},{9},{6},{19},{14},{16},{13},{31},{19},{13},{14},{16},{10},{50},{14},{14},{64},{67},{92},{7},{22},{11},{13},{68},{15},{9},{5},{160},{22},{13},{15},{55},{39},{54},{56},{57},{59},{16},{34},{36},{35},{35},{28},{13},{1},{6},{8},{11},{1},{4},{18},{15},{10},{10},{20},{19},{28},{30},{33},{35},{16},{33},{48},{40},{31},{37},{42},{58},{43},{9},{1},{59},{34},{49},{51},{68},{56},{50},{52},{54},{7},{7},{8},{26},{28},{5},{4},{1},{6},{8},{4},{6},{14},{8},{4},{4},{14},{14},{16},{19},{1},{14},{7},{15},{13},{15},{16},{23},{25},{31},{22},{25},{31},{4},{8},{17},{27},{26},{35},{37},{24},{19},{83},{95},{20},{7},{12},{8},{23},{41},{43},{33},{37},{47},{41},{40},{39},{36},{38},{43},{43},{43},{37},{53},{17},{12},{22},{21},{30},{32},{33},{13},{5},{15},{1},{11},{5},{27},{45},{47},{24},{42},{44},{43},{43},{36},{6},{21},{19},{37},{39},{38},{38},{31},{7},{17},{16},{25},{27},{29},{6},{1},{1},{14},{8},{4},{7},{14},{22},{10},{5},{25},{10},{29},{24},{9},{6},{3},{4},{4},{4},{4},{10},{18},{4},{12},{4},{24},{12},{6},{9},{4},{16},{11},{17},{18},{5},{11},{14},{11},{12},{9},{16},{18},{10},{5},{13},{8},{27},{11},{12},{8},{16},{4},{6},{19},{8},{9},{38},{4},{5},{13},{8},{9},{6},{8},{4},{11},{9},{9},{8},{6},{11},{11},{5},{11},{12},{13},{8},{8},{8},{13},{3},{3},{22},{15},{21},{20},{19},{37},{9},{29},{13},{20},{26},{21},{20},{31},{24},{47},{32},{10},{12},{8},{23},{5},{17},{6},{4},{33},{15},{6},{18},{2},{6},{16},{5},{18},{10},{2},{13},{10},{14},{24},{5},{1},{5},{5},{4},{9},{8},{9},{8},{14},{8},{6},{3},{7},{8},{18},{11},{10},{14},{11},{18},{19},{14},{5},{13},{8},{9},{11},{8},{6},{10},{7},{14},{13},{32},{20},{7},{8},{5},{4},{8},{10},{10},{6},{15},{25},{15},{18},{13},{4},{3},{11},{13},{3},{10},{13},{4},{16},{2},{9},{4},{7},{11},{21},{3},{8},{3},{4},{6},{5},{22},{11},{13},{18},{8},{6},{16},{11},{14},{12},{6},{7},{9},{24},{6},{18},{10},{17},{13},{7},{18},{16},{7},{15},{3},{6},{7},{4},{13},{3},{33},{12},{8},{13},{3},{8},{4},{4},{11},{13},{12},{12},{19},{10},{10},{12},{19},{4},{12},{8},{14},{26},{20},{8},{11},{18},{10},{10},{12},{5},{6},{6},{8},{6},{8},{6},{3},{6},{16},{21},{8},{14},{24},{9},{9},{5},{3},{3},{22},{21},{5},{17},{12},{22},{21},{23},{9},{22},{14},{21},{9},{4},{5},{4},{7},{6},{1},{5},{5},{6},{7},{12},{4},{23},{17},{15},{16},{12},{14},{19},{19},{19},{13},{29},{6},{11},{33},{7},{11},{2},{5},{69},{65},{52},{56},{34},{91},{43},{58},{5},{61},{9},{243},{78},{91},{87},{85},{77},{104},{59},{54},{7},{33},{53},{14},{14},{14},{94},{5},{71},{80},{46},{45},{34},{39},{38},{20},{318},{8},{9},{90},{76},{19},{5},{466},{20},{84},{30},{23}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (5385 bytes) */
const char* const cstring = "(\265/\375`15\375\247\000\352\264P%I\340\3208\0070\314\363D\236\2060\306f\010\214\2170\020\006\302@\030\010\203q\2447}\371\023)\322\266\310\306$\326:I\2248\333\226dC?\001\234`\377\267\224`{,\363\366\217\242;\3265\273\314\240T\003@\246\322)\353\003\010\002'\002I\002\330\345\267g9\256)\036l\307\362\344\347\370\003\3011\237f\377\235\266~IY\221o\315SQ3yy|y.[\247\270\330\226\332b2\231\252\351\344\003\010\323\253\177-\306ql\177\3533}\377qVm\231\355=\246\252\t\\1\255\240L+\277\037\207o\376\236\3368'&/Z\335\307\033\202?\3660(\322>\306\177\277~\333N\373lM/\360/\007w<\214\003\3035\270_\034w\313\205[\273\363\345\312c\255\312q\314uA|g\367g_\377\205\301\033\323s\360\302\374\306_-Y^3\377\\G]\253/\231j\342/\326z\315\270\203xt\361\347\374\202\236\213\377\256_\276\225e\003\213\n\216\ng\177\367p\r\374~\367\2730\370_\3458\326k\251\332{\206=\357\341\341\207\373\373\356L\344|\227b\236\026\337bnyXr\341\335\2737\356:\326\226\2307\362\237\341\234\361n\325\3276\335\311\306\245\353\030\027o\346\366\267~\275\313~o\002\336\231L\254~\307\233\207\217\236\336\"\213\225\023\232\250\317\367\025\277\013\023\336\375\372\357\322T\337\343\027\366^\344\365]\265\3631\1778\302\366\255%\376_\251n]K\266\364Y\327\032\330\275KS\325\374\242\376\300Q\247\302\233k\254o\035\353\230\247\276ww\257;\236\316\265\255;\017\365~\365\207\335Z\333w\353\372\345\337c\027\257W?\330o\030\354\252\374\026\353\345\036\356\034\367\260\227L\037\342\360\362~k\312{\371\267\016k\367\276\205K\327\375\337\375\234\376;\236f\325[_\272v\232\366\352\307z\315_\273\316\251\235}\303\375\375\362\324\030\014\307.8z\340M=\370\345\033{\360v^\237\217U\367\n\313\270\213\341\367\336\271|\270{\370\266\366>'k\334\257\247A\260{\020\277j\037\305>\352\232o\345\277\361(\373]Y672\255.uCC\323\331\027U\253\213Q\345\304\304t\257\025\023\206\027\312\024\264\377:\337\370\245s\254_\361e\271\367\263\017y8\177>\332\357\305p\354\036\376\254\355\367sa\320fm\277\357\017\212_\366\036\004\265\367a\353\n\277ck\355\307\274\353Y/cPk\327\356\375\362\327&\215\275\\\343\367""\263\356\341w\306Q\026`\373~\371E\261\347\361\003q\314\263\031\277\356\336\341\267\247@\301gx\266G\276el\266\216i\321t\255\233\226\245\221\351Z\266\305\362pXc\261r8\202:\265?\263\354\3673P\363\337y\004\361\335\242xCQ\307\370(Z\313\323?c\334\371\375\216\267\216\316\215M\213\246D\007\363B\323\312y}N\247\275\215\355\036~\261`-x\335\263\235g{C\313\222\241g<\332\277\240\301e\341\305\273yL\0378\350\301d-\210a:_\221\366:\343\200\326~X\317\254\006\353\345\021&ei/VU\303_\226\201\351\215\023\3537G5\242u\023SB\204L\316\215\315\315\210V\312\242\3001\201cO\310\260nppT(nrZ,\325\213*'e[)\025\t\021\017\212\241\214\312\346\306\246\206eS\242\006\247FUSS\263\343i\032\332\2301\r\354\2020\341\230U\326z\274FgD\214\005\355}\320\332\337\035\323\254\355\027\006\005\215\315\215U\325t66eS\002F\245\312\201Q\375\247S)\021?\263\037\336\256Z\314\324\237[\353\365\207\231Ft\376\255\216\306&F\206\246\343\340\200i\r\272N\241\366L\2561\3261\354tj\341b\357#\257=\277\017\342\254\370\232\n\216\272\342\244\002\274x?\307\265?\230c\266\026\305\221\327\254\370@\355RQ[\362\276<-\033T^}\374\220yt\336\311\243\207\223\377\335M\372\207g\225\363mi5\321\236N\336\346.\337\203yJ\355wl\327b\275\335\345\325\232x\372^\247\323\311\332\356\201\027\317\360\356*Y\347\361\253\326\2767~\277\255\255\035\034\357K\347^s\331\\S`\243+\304a\375\036\266\371\347\315\277W\361=l-\277\375~\267[S\355nS8\003A\036 \223U\222\344D\244\233\010\212\002\335T\240\344H\267\026\2244D$3\013\230\365G\206C\272\201\326\314k\362\224\365\300\352\346\202\222\212\316\223\021\016d\364`\204[\2412'\007\re\277\345\204\226\254L\225\034:r(\223d\202\344\202\017\222\223\2333\245\203\016\234\007\002\222\217\352\206\272u \245\"\223\204 =M\r\322\360\2221\033\202r\307\346\261A\362\021\341\241\273y(%\224\337\352\326\335^\234\036\246\254\214\340\221v\347h\252p\254N\225\007iW\276@\225'\347\200\323T\212\312\036\321\007\000\0023@e\t\t\323\241!Tv\236@\322\034\n\0359\267\311bn(\273\314G\345\366\241+t\204\202P\223\351\202\234\261\035\330\000\2401\243+Q.I@Tn\220$\313\252\204""\221<\3435WL\022\217T\364\201\353\330\350d\240n1\350K\306\234\240 \3558\331\215\3456\202\206\234-\2633u\312\007\007d6\017\215\334%'\210\312\026\331\221#\364\344D\021I[\244\214Mt\3539g\314\220Y;\322\016\r\005\0358\024\351\02417J\031\311\340\003G2EJP\251A~t\344V\346\310\004\231*H\020R\351\302\346\321\201\003\235&\"8\004\007p\335\231\362\221~t\340d.\036p\235\214N\006\210,\261\211l\033\032\271N\206\254\274e\n\231\240\003w\317\325\351\300\334%K\271\201\3546\026\233\001\r\034\t\275\020J;\022E\216\006\000\030\315\000\311\330\372\305g3q\3548\217\274\347\307<o\336\255\030v\036\375\201\366c.\021o\217\327x\314\243\341\327k\344[\357\316;\267\374\373\320\373\360\016\357\341\213s\013\323\334\362\235\177\3161\254[S\314\303\373\177\347=\366\337\026\024\177\367\313\261h-\355u\0279xG\331\354\273\305V\334\321:fm\317x\213\242\026\373\005\305\017\213V\334?\323\\[\030\336:\277\250\371\367b\347\017Z\373\2408\366\317\362\361\323a\336\036\346=\374\237[\036Z\313i7\344\037\316\330\202?{\220\357\360\332\250]\242\345\330\212\230\343\327K[\374\3757\202^\306=\377\207C\236\030\3477\366\355;\302,\347\371a\326\362\227\030\006(\233\001Q\031\"\272\201n/,( 8T9B\266H\247\206\020\234\207\222\020p\232\224\272{\362\240J(\234\247\007\241\223\264\247\214\240a\222\2668MLQ*\"1p\230\244\024+\234\324\305g\344\346\241(\316\003\253\022\002\351V\222\222\270?)>\0347V\207\007Yb\353J\007\241\234\350\254\371\370\221YIGZ\254\324\304\017\311O\t\037\022\237\357&\342\246\203^@I\350\212\020\016BJ\202\004\271q(\245\245Q\212\"7\330H6\003\242\023D\331s\235iI\020\321GN\366s\323!5\201\216\244#\246r\004\204\201\216\016\216\215\220\r\013)j\000\351\\Q\352Y\016\204\262N\025\007)*\024\312\2556\314\032\312\301(\023@\270\355\234\246Pn@\010G\340\326\022JA$\313\206\200\324\335\032\240d\005\033\307\352\247\306%u\031}\272\t)J92\236\020\314\036RDf8i\344@b4\020\t\301\215=\355\262Tv\"=\321J[9)\377\311\371\251\341\220\252P\226\006i?+D(E@`\335\231Eg\311\224\020\322\241\224.\270f\214\231\362\225\223#\235\0256:T,)\313\275\305N\234\243\363D#\207N@""\375\260\270U@W\320\027\246\007\255\373\241\t\245+\263;\241\223\352\304\24437\017$\211\372\231\001\231\025A*#1\352\214!\201~F\204R\224\250\005\206\232\032H\273\014\215\001\267\006\347\311\002\322\263\255l\027\006,(=rE^\270\244\210k[9C\347\313K\031R@\202H\r2\001\200\024dF 7*B?\230\013p+\037\030\350LnA\272\"a\003(\220\032l]F\201\0249\n\245\244r$\004\301\224 \273\245n\034\320>C\372!qJS\023f&\255,\220\200\354\260i\2048\310\217\020\016$\343\236&\021\212\202\220v\000A\2311\245\203\223A\251\004\001\310,)\003\224/\344\010\222D\251\324\320\225\231c\003w2\241\230%\243\364e\200\003@\307\007\352\0341Ih\212SEvK\201b\030\2658M'\207YG$\314\t#\034Ju\242\316\260\2040\342(CF\271\213\266\316\221\324\346\212d%#P>)TZc\232/\245\016\331rb\362\241\031HR\222\017\334F\231\202\004\321\010\245\327\\\2310P&\311Id\236L\n\tR\331I\341tQ\252\220J\223UY\201LP\"\025l\000X\220[\225Dr\035\312\362\000\027\205M\250\003H\222\246f!D%2\"I\222d8S@0\200\250\\.\230\315\313\264o\223\303\343\251,\013b(\246\020!\216\030DD(\020\tdDF\222&\215\001\371\345E\200\372]\363\013\030\373o\025\311\275k\256L\214\177\026\211\361\334\2623\006,~\303:\363H\014V\370\351\354\374\355\030\316\013\006\244/\024\005\363\224\225R+\377\215\\\330\265\333X\205 s,\247\316\233\034\366\253W|\201 \345\213x\206,\036\303\367[\333\322\031|wo\311\275\313V\177r\206\246#d\223:8\313\200\272.~\010\224_d\340\225\316\026.&\310Qn\203\274\003\374\262\344\252JZj\nB\356%F\037\354H\354\354\302\245k\324\014(0\371\005\274\231\235\003\201\2545\217{j\255\233\010\322\251\r\245\237V\362\206\317\250N\201R\025\307\177:\320\333G{=\335L5#\217[u\341k;\230\244.\3031L\373k\004\272[@\216\036\335\311Z\275\253\025\210I\312\223'\016g\271\357\326\256\356\276\317$\216\020<\220EN\332\207\222\020\234\003\214-R:!\223d\373\306\3555b\267\233\271\213\334\2429>?\264\316\265\252\254\027\360;\241\215Q\231D\010s\377\3545\005\220\240:\276\300x5Y\254W\3154\272\347\251P\374nI\340\224Z7r\346\021\0377\304\252\306\267-\361\310GA\303\252\224\006\333\204\004C\000\326L\3754Q\275\311\245\274\212K""\327\247\233\365Q\030\t\"\205\323\224\"\010\035\330\201\337a\264\246\r\363\2368\202\371^\300\246,\200\360|\377\246\225\322\017\"1cM\213\037\310\303\353\306\335y\323\227\316\365\234\353w\303q\271\364\304\\\344[H\001\032c2p\"\224;\314k',\235\361s\007\340\2512]d\262\246\212e\254j\031n+\226[HS\202V$\031\323\r\316\331U'\261l'\006\t\357B\365b\005\023Dj9\203\263\256\324\272{\306\260d6\236\371e\347\240\362\031.\270\234\313\013\315\203\373\323a\230YA\003\005\326\217\336\363Bx\002~\026\321\241\003\301O\301W\235\337\235Q8\260\277p\316%@\006\334&6(\215\033\332\365\237\364\350\020\004\372v\222\2010\030\360p\354\322\316d\017\351\316\240\207\376\261\351\242\332{\272\3378\377\307\233Ia*\234\313\0369\301|\036\033\355\010\245\213\265\310\300UA\264\030%V\\M\247\205\271\2257\202\376\016z\037\274\325e\305\215\333\216\000\246\253(V\373\037n\243\310,,\340\256n\376UY\341o\326\333tF*\260b\376\214\222\350\237}\371E9\017\264\220q \311\271@\213)\362\200\317\315@\277\274\315Bt\3279\301\023G\007~\330\356Y\354,\326\311Ap\333\214\240\246\311\2771%\037\233\207v\267\2367R\353?#\303H\313l\312$tkN\302\2141\026\353\331\203\250\024rHA\000\3502u\336*{J\350\243\345\\\251\235\035t\362P\004~u\013\207\250S\205\346%\021\205\3177'\037t@\031&\377_|\263\342\321\216'\254\265\351\0327G\322\201\034\001\031\331F\215\237\r\034\227\210\035e\016\037d\216 )\004\221?\361K\3169\212\324\212&\004\032PrS\342\177\254Ti\025c\350\303O\225\250\272\363\266\211\251\361\307^\314\005\350\021\317Q6\030\026Xo\300\210\020\262&\273>e?\326\177\244/2^\355\021\264\216\005\210|\n\277\347^[f\024\355\345\013[\247\247\344\360\245\007\302\225\363\017l\017f\350\366\217\324\370\356\024Ul\260\252\274Do\210\216\353LR\025\034\213\016F\351\002\325\322\33541t\310\225\220\331\010\326w\023\t\275\217U\003\265\0350N\262O\354q\272\014K\237@?\205=q\000\025q\217\004\337\312\246L\317\024\212\253:\263\220\313\303)\r\212\n\245\345\254\222\377,z\310c\244s}\342+I\332Zl\250\335\225\332\360\026\200\344\013\025\270\r\255\032u\005V\226\331\220\026}\273\003\377wfw""\016\037\220G\346\312\325)\315f\364v[\251\031\004\022\000|5\362\273\026w|\217\243\034Hg9b\310\274\230\013n\337\265\200\246\\\314\367W\257^|\256jUMX\216\006\273,\204\247,\261c\264\276\373\314'EP\317Bfj\017c\037\224P:\244\366\306\362\346U\334_&qRhc#\002~\320\036\216\201V\001\226\205\276\300\362w\001\271\2653\273s\030\0212fu\322\034\003\330P\310r\217\2574V\273R\366\300\207\232\356{W\230<\213\260\014Rg\244\340(\276\253W\214\0305\3500[\241\3254\330\013&\216i\226\241\365\305\211g\221\206\tTki[\317P\347\351\004\260\3679\3328+P\246\203f\2251>\264\267PX\243\340\3309\202\030\275\001\004-\235\201m\234f\361}\362$X\273B\300\221b\026\326\014\367\345\344A\341\\^\225^\267t)\202\233\034\024A\331\376\374\007\325(\270v\261\224\347\320+qaW\013\365\373\247V\027\002q.\023\271\202\273\331\3054~\216R\003\001\200\336\260r\270(\261\204g98\n\361\267\305\326T\033rqS\264[\\\315\324\240O\242\316\032;\232 >t?\361\374\206\002\320\2315.%#HiAu_v\263|\364e\237\300\307\313\245\312\236\310\260\356\221\303\312\360v\240\021\3066]\3757\316\372\260\341 ,+\3741\257Y \320!\003\274\026?C_\201Z\273\351\322\322V\021%5@n\016\320\031\021$+1\232E\010\266!L_\001\021\020\303:|\275\0003^\017\253\232\034l\333JV\304\004 \272`\270\357|\271\n\342x\3757|\371\351]B\241\343\313\026\324\003\257l\231\360\326\272v\216\0319\310.\\\264Y\000)\215\002;\202\010\270\033\007^\231\230\314\321\217\274\004&}M\262)@\t\354l@I\323\310\254\367\0050\025\367\242%\311\204I\302m\213\313\006\344\201\222\313\337h^\332\307`-\013\035Z\306\\OL\361~w\3747\230\305\202\366R\307\261\030\215\220\010*\2752[\254!\303\261A\037\000\233L\246\354:4\336\253\300\200k\271\351\325\230\232\221\270\216\345q\236ev\000r%\000\357Mr\207\216|z-\355\235\0012\242\"1\025\207\326O\033\202A\313\272\004\333\t\016\366\025\336u*I[\217\356\2662\207\305\270F3F\214P\222h\261\266\000\366\221D.\311\365\212Vf\311e\013;?\34304\0012@\032IIPJ\023~\002\235\"\220\225\326\242D\023\360$t\325\306R\274\034D\3713+\021\023\000ZH\226\n\342P\273\023\005\010\210\266\335\022)r\013Q$\334mB\214\361""\355a\253U/\225\230)\010\226t\210&j\265C4\343\217\212@\270\005\230hOb\212\032k\350\375\333\020MpH\006M\367\200\205\362\2319\370^\303\245\331\2205hj\320\307}vHY8\177V.\214>\303\342'\255\177\217\254`\340\276\351\266p\212)g\310\213\203n\022X\010\031\034\002]7S\364\031X\236\246F\342\375<\253\334\007\341\231\2319\303kd\002'J>2Rq\004\005\2713`~f\300\252\320g%6\237dd\364\0148=\206\222\230cb\374\312\030\275id\245 \304\205+\3558\270\346rcP\261KH\241\240\261os\257\306Y\367\311\r\312\010\354:B|\322o\252\t\006\247\261L\302\343\325\330S\334l\325\255b?\236K);\271\241\363\374Z^0\246\270\326\024\347\034<*sUj\321\3656\323/b/XJ\304\022\212\002\2715\260\001\004\324\240\345\000\311g\210\333\021ER!|\363\257\006\tG\002a\004\tj5\243GA\351,\357<\213\272Z\361\236\333\262\323\265}\376\2522\300\221QfQ$\006q;\002crJA}\330\226\031\352\256\241\031\237\201X\220\265\322\332\266\226\324\252lsX1\345c\3749z\201i\327\237\031\022a\037\245\235}i\216S8\223\247\266(\030G3\234q\\\241\025\224\377\233\207f7\014\246\223\026\211Y\252D\370\336\307)\246\375\233\306G\316\330\027\341\002D4\2120\230+\272\351\357\217\006\221\256\0230\227,B\rKq\364UZ]Yz\303\025N\201H\211\331\032Q<<\244\367 \213\342\321\344r\344Lx\341\366\377\366p\347+V\227\375\232a\216\202\026O\267B2\013\035\024Fo\304Q\260\302\320\302H\236\240\234\342&7\033\r\220N\010{\007-s\203\271\rN\n[\003\331\2375\260\353\257Y\n\245e\361\331y\010\306\353l\236\222\206\025\014\210\320\2153|\223\326x\364\tc\360f\332\233\276\034\314\352_\250\201\367\371\304\033'A\017\312\006gZ\216)\210=p^\275\267l\202w\n\201ft\331J\001H\303/\242\263\2406U\351\005\314\205Gg\222\\\275\376\217\320\271&e\027\235\341#\026\231\303\001\007\315\244\3460(\330Y\237\350\036T\221\313\372`\374<\367(\274\226\360\306\367\220f\213\270\314x\005\205P\266\300\275\351@\253\2359R\311t\030\372>\037\020\255vw\246)7\351GT\2748\373\230\324\333\322\340\\\252\316\320`^\2511Z\004%\\!\350\307\300\245\022\214\334P\215\002\354\003\314\301?\246\033\256n\270\023\266\006#\020\031\240\347(\274;(EK\253Vb\356\232\276""\204\227%\301\316\335\255\306\342)R=\251V\355\333f\021\227\210\322~V\271\205\242-\220\014a8_\035\263l\301\n\002\373\024\206\351B\000\2349\313$\316\264E\376:\tz\373\251\370\007'0@\225\335:\014%\263M\350\215q\220?\350'\3567\271\235\374\240Y\322\016\306\r\314\333P<!f\013(C\347_9\357X\303\214z\310\\\270[\217O\236S\353J\355z\317?'1E\025 I\013\027G\016\333\3652\036\274\332z\323L\003\332\330\316d\213\231\371\344\345>\373,\270\344\335Q\211?\211\333\360X\353\260\034\257\335\350\213Z\277Dt\235\0377jg\243\370\n\004\245Q\267\341Q^\214;\277\341\301\202\233?\323u\353\317}J\001\240\340\323\031\014\262\0230k\034Q\243\237\314{\3409\243\013\374\260\243\334\260\372\210\3402~'8\025\367\271\2748\254%A\202u\342>P%~K1\036\235\324\342\037~\274\301 II\324\366\205\204\306{x\263\224\2077\"\221\246\3643\310'\033}g\207\335z\366|\276~\3729\210\360Jku]L1$w\016:Yr\372\365~q\216Xf|\\[\316\325\361\265\300\244\204\352\352v}\302E\264\034|\265\n\211\270A\036\2569\215\210\224@\006\277\032\345\377\032\211\347\336\t\350#\0305z.\025\271\017\034\264\321\314\"gT\266\301$\035\214\006l&\313\345A\350\254\357:\220\276\257\236T8\237\252\232TG\233\243NNE\372\251\300\0305\275\257\346g\315\375^b\276\313I\030\021\346\343\325(m\210\002$\226\365\000\"\n\001\014\003\177\016\360\234\372\031\230Hp\252\207\302\220S\256\357\224\213i-\260\200\317\350Yq\236\264C\030\t'\002\276%\221W\253\272\212[\372\304/h\343\265\301(i\231\321\242I\314\025\356\331\353\256";
    PyObject *data = __Pyx_DecompressString(cstring, 5385, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (5458 bytes) */
const char* const cstring = "BZh91AY&SY\341\375\227\n\000\003\003\377\377\377\377\377\377\377\377\377\377\377\377\377\373\277\377\377\373\300@@@@@@@@@@@@\000@\000`\027<5\366\223\320u\343Aw\234Q\320oz\311Uym\272iC\263\032\266\333d\325(\2416iD\262bj\221h\000\036\207\271\337\004\355\251\236\367\310hB\023!=4\321\030hh)\340h&\251\262OL\223\323C$\332\214F\232m&hh\232\003&\217I\240\362\232d\311\221\240J\023@\020&\204\251\247\223'\252~\222z\231\030\232m4\2154\323G\250\032\003@\000\006C#@44\000\001\240jf\205\005M6\246\214\232h\000\321\265\000\014\375I\03244\006\215\0002\000\000\000\003 h\320\000\022jA\020\215\"\237\246\232h\325?(\207\224m5\001\243@h\332\215\000\0004\000\000\003@\365\000\365\007\250i\246\201\242j\022\236P4\323#@\032=OS\304\324\375\002i\344\022y\031'\250\0322<\247\250\320dz\236L\220z\232m@<\232\215\345O$\320H\210 D\3012!\204\311\250\365\024\337\251\246\232\221\350\323P\362\206F@\000\000\000\000\r\003@\000\014\207Y6\024\320\035t\340z\234TY0\372V\373P\361x\277\313R\217\367\350\325\357\376\244\265\275\032&\022T\253[93\351\027\253i\377OM\204Q\340j\204B\206B\371\230\324\343\201{\337\227\377\022\034\034\326\014\347\001\264\334D`*\254\210\311\005Pc\001\221\204\212\216rzz\2270\355\222q\227\332[\016\205\323\361L\337\317\313\260-\356_\212\304\341\264\323 U@UD\235\214\264CUE\021\221a\026\006\252(\354\323T\016\256\352\206\231\342\323\034\260\333}\241\\\022]\244\251D\244\254\323h\033c\330k\304\255+\323\211\232\004\264\310F\025\026z\3144T\t\306c\023\333\037\370\345\301\227WMy\310\2313g\223\277P\322\\\244C\230/\323B\312\355\272\264\253\021[B\327\2425s\032l\210i\264\301\216\211n\220\27779\212[\232\033H\270\333\033\026\373]\200\262b\214\3655\231N\376\275\252h\"\214\216\031L\235\323=\362\2015\025\244\224,\363\313I[\267r\332/\205\024\333\031\342X(q\314\205F\006r\025\3327b\201\034\342\343\272\034;y\200\351\002\005\262\3375\364[\033\027\036\221\363\365\254\245\211\361\270\325^\344\276e\031u\345#\323^fL\201j\252\020\376P\262>u\271\373\317\346\261\371\024!_\364\346g\317\223\036\177\013\302V\220\206\025\014\241""\301%0\217\001^!F\376&\324\307r\224u\236\030L\242\204U0\003\341\377LQ)\027\341X\274a\014\366x&q\304$c\373\336v\244\010\253%U\322\217wK\276\220j}(\024\261d\3209Q%FY\332\372\377WL\351\254\020*\315\205\246\366p8\3254|\2264K2\222\273J(\250\252Ypn\362\265\0130\025\254\211\324b-~\357w\247\253\332v\274\004<\237k\342v\374\267\271\355{\336V\363\272\360N\3646\236\313f\326\257\272\274\274\230\305[\207M\367\304UK\202\3022\362\315\374\203\310\334\214\004\367\\\356Z\321'\221N[s\367\374\241\277r\232LS7\277$\220a\340N\207\217\343\267\035\207\236$\366\334\273l\375J\335\004\035 o\277\320\255`N\352\276\037\177R[\316\347w\277\212T\246\304\275\023\252*|\241\262ka\241\034\330k5\033Q\315\357\203\330\317\032\317\333\236\273\305\273@\t\307\177\315\236h\025\234\207\251\324\2077\317}\367os\2676{g\334_<o\363%\020x\030D\000<\210\222\"\030P3\252l\325\225\235\240\353\225E\313%\274^mZ\"\250(\346`|\346r\\^E\225\260\201\262!Lu\372\366\222\245\235>\227\233(\364\207\340\271\007ypa\366EEw\263\354\301\253e\311\306\364~\363\030\002\323\000xU\003H\026\251T\312\321\023\255\267\270\342\201\230\344\246\230\006\333\246\266\366\221\210\301\364\273*{sr\344\201M\275\312\360\370\032\360\264@\245\207\301\023\232\027\265pB\345[i\006\016b\270\006\234aO\276\377Z\0260\002d!\032\034\350\371\273Q[\212\344\212\323\242+\276\n\317\202t\331\234\004\016\002\350v\037,\203e\352\317\222\345\326E\re)T\023\354\234\351\273'\332\341iU\032\020D)Z\355q\357~\302\340!\344O:'\013\033Q,g\315\367\2673\3403\003\301\332\373\n\252\240\277\022tp\362\362\365+\2438V\224DEU\216Wn\376\362Z)`\215\223q\274\221\245D\212d(\336-M\020\322\010\024\201\005U\310\022\322X\221P\233\026\232\262b\005\247\332:\013\327\325\367\236?g\206\r\210c\001\276\314HK/7\200\272\275\370\363\373\206\316\033~p\343\314\032\321\366\215}\255?\257\221\220\227E/\340\277Q\304/\372i `e\255\005\013\341\255\345\3616\307\347\316\330\322\276\315\032D9\260\314\016\233U%\010g\304\330\014\024\314\211\266\315X\027\\l\023\303\2105\306_\310\3145\264\ndb9\342\301\024\342\"'\3407&-\343[\366Aa""\026\312\n\302X\031\247:\351\t\275i\264\251.\273\360\212\303\213\264\271\001\261\232\202\207\0375\224\020\255j\367s\234\200\016\204\205\325\0363\330\372\205\277\3652\364\235t/\3366\023*\323\0361\215x*\220\007\335\216\215\021\253\022\000\216\320\271\230\"x\326\213\0040\251\373|\360/\031i\032\204m\343\254D\n\213\265\013 #\260\013H\326\314\271\335\"u8\364\037\234\036\247\225\351u\314\3340(\315LU\315i_i\034,\233\350\037\001STZ\330j\014V\202\210\263\222\224rQD\272\262D\332n\213\342\3327p\343;{\374\236\370\344<nom\213s\372\322u\273\212\252\240\260\037f&\014\301\2303\006f`\364f\017[.Tk\303\023\214$\364\262\204^\375\262\320\267B\016]\231\3072x\020\315Zv\340\265b\274r\237\272G\311\004\205\024\360\200\231C\034-\t\3204\312h!\006\262\"(V\263XA\205\214\006\260\027\331\031\345\037P\332`:\002\371V\242\022|\034\261\r\336V\034QCV\324Uy\004\005@\000|\025p\336\r6\341\301y\350\337\000\254\265j`$\2272\014\263\356\3568\034\327\027\350{^\261\232\371\023\307\270\230\225\250Tr\002P\024U\314\025\024\032J\nh\000w}F%7\2172\311\262t\300\301\213,\341%\345\345\214q\t\230\024DR\237\021%k\000DAT9\251\017\336\366\033\261\307\311\255h\335\300\2376\n\273\272\235q\3456p\302\272\335\352\t\267E$\341*3E\rf\305\270 \276\031\251]\225\231Y\332\230! \202I$\330hF{y\203E\362UI\316\242\311c\243d\216;\023r\214Z!!\004ZK*\025Tar\032h\253\211\3520\222\255\031F\206\252_\002/3\016H(X\202s\213\2232\357\243(;A\215\265\271\310\327!s\347\204f\313\221\213\233\223\201\220\224{\341\243\252\320\217gd\336e'8\030,>\030\302\270\265\214(\305\013\243\006dF\255\t\004=\277\242\305\366\243\264\347!\301a\222d\264m\257\302\267X\t\r\030H\335\021J\342%\032Fy\275'\231\211I\245q\212E\223x4\340+Jb\333j\253{+en!d\357Q\200\255\227:B\244U\311B\272[\200\203\312\020&,\340\232A\030\032_p\025=K\220*pz3-N\014\2227\261U\243J!\221A>\213\"\002\2523W, 8j\177\217G\037{\275\306\330{\010\201\256\234\240\253\365\003T\326\367\370\317\232Np\305/\232\312\210\031\271\300@\307\017\275\353\317\211\211\177\273\312\356\014\211\307\232\222k\214K\000)N\263\301\254""\337\301\253!\263\210\335+\310J\005D`\302\325N*P\262\216}x\250\336Px\330\267\016\363:M\016\\o\262\006\260\204\3030\t\272\nl\261\355]\337C\323\346\374\033o\371PkA\365\222Kw\204\235\256hj\030x\251f\341\"y\t\337<d\027\350\260U6\005A\0241N \245n\367\0207\300\324\333~\267\024\335m\235}\255\"\214\220DwQ&\0254\204\221*Ai*\203N\022P\230\302\201\277\230\010\016\260\377[\3237%\220\226\005\234EY\211\312Fj\240\206|7\3344\020\256\261&V \200P\027\244I\333\333\301A\356\353K\320\034\322\327\302\276\243\006\223lA\361\001\355\375\272\235\330a\357\"43\240\022#\257\327\013E\327\330y\246\363W\334\350\251\327\361,\257\252\301\242\017YX\261\010\032\202\260Sa\306\2609$\2244\006\336\031A\210\236w\016Ja]S5\332\202\231R\305\230\2204\014!\014\212}\021\353\335\257\013`\346m\226Q&\330\305\367\326\227\274\225\222\255H\000M\253\006o\026\257\220N\2400\005\204\260\302-nR\270U'WP\353\244'O?A\220\r4\247\002\001p@\330\273\331\241.\"\314\010D4\004Im\344\215\212kt\311(\324\024\t\244\261\207\253\302\326tH\330\227<\265M\264'g\010\255\304\004\272r\362\212>\275F\314 T\303\0356V\305b\222;\270\330\246\220\240D0+E\252\361q\006\024X\3347\357^\032\372\332Y\352\350\351=\376W\225\332\343Dl\313)\337;\275\341C\240\013=j,\214K\025ft\204\"\362\007\212\204\345\254=X\2112\0175Y\247F\261s\204\271\002\262M\365^-1n\014\031\275\222\3055\257\025\311W(\310\212\252\212\242*\212\2246\306\363\000\336\213cj\257@\241\\\t\035] )}i4YwA\001R\211\037#\032\021\213n\010m\243C\024d\264\252'K-\025\213\240\327Vb \2601\003\001\177\310%Q\3410*\350`\303\244\007\314\325\37085F.l\373\222\242\214\0276,\352\257\262\266\030\204\320\r\036\323p\205x\353\037|\244\247T^`\322$\2468D\344\0344\2657l\262\014\255>\030\3541P{ G\312\202\211\023 \214\242\360\345\221\214\2535\276m)JME\346w\221b\204\247\244\350\353e`S\263\370\372\360\307\035V\021\354\350WV\260'P\020\320\354\216\271\224\026E\024X\r\255\031(\031\251\300\005\032M\245\312\324\327\341\0260\265`.\2559WB\233\306i\014,\213\305D\210\222\216\035\346\235kL\265T\224Y\201LZ\320\252UNk\350^\346\201\"\211\032""\251j3{\313\366$\221\276\007f\316\312\2031\306\246\226\223?4k{\2200P\304\330\330\301\244P\326\274\330\256\026\255\2358\240aA\370,\270+*\010\331\351\245\213t`\316\231E\333Oe\323q\242%IyVe\241Z\207\302\216\021<\257C\027P\355\362n\375\004\340]\220$\200\303\257\266\2746\213\364\271%\261\265&\210S \302\373hJ\247\224\006\346)\n\021n;r\367\272\313f\317\266\367\376\030TH\336\374\351\2546\301\302\233\022\0236g3!\360mgSn\263\022\333\321\246\355(\335\245]u\247l\017\207$MH\033\266v5\305\245m\324\351\020\256\202\206\253k\221I\314m=\271o6FrD\312\006\300\205\271v\305\031\333fq\305\207\2358/|\225s\223\232\203\\a\247, ^\200(6\014\010tc\254\023u\224\353>\010\367|\353P\014\260\240\215_p\325\273\332\361\275\344\331\320tP'7\016\254\306 }h6j\371\304\305\275\006\026\356\371\0200::\243$\036\360 \311h\301\036\216\261\251&\306Ng<@\306\210q\016\266\263\274\243\033Q!3\337\003\333=\204\357)5\212\214\343\216\371\323\325\263\233X3\236\371\201\314\322I\261\002g1]0Zo\320\315\361\263~\335\264\356\345\255c\266\315\037#\326\222+\345\002\n\"\373\257a*\3616oA\330|\010Ks\024x\375,3\030\206\311\245N\320\315P\226\275\001qF\020\353\226\251qP\256\023\246\255\224\310\312}\014K\021\2314\211\361:\273-\212\365A\346\257V\274L\246r\244F\352\307[K\255\202(;\214Y\005{\361\242\260\333g6r6\030oR\361\341`:\037W1}\2276\265\271\353\306\014v\006\340\327\235$\027\274\233H\032H\030\322\2112\234W\344& Ub6dB\001\2153v\245*\350\315n\210\244$n\014o6\367K\234\356\276~+\245\273\333\336s;\374{U_\213\227>;\322+\004\355N\036\004\330m\343X2\"\305\2022\013&\235\226\0320\327\261\312k\246s\324)\341\3067\341\231\224\030\177sh\244\020QU\252mH\305w6\035##b\350\205/\353\276\352\244\020\372aB\026\315Q\223T\360\315xxSF\355\n\032\030\330\343a\021!\001\322\301.\231\201\n\265\2143\364\367P\247\013\222\213A\t\003\007\240\230\337ezXe\263\n\207\307HhB\327u\355s\312\265\316Xo\256\rO;\225UYjI\223\241\016\226*\302[\326\326tDt\000\rS-Sv\200\263A\026Pd\250\024\033\230\304^9I\216P\3454\3069\334k\260\333D\0167j\033\230\355\217\tZF\314)\273%\356 \225a\201""\212\214\352\372\271\343\347\253\345\206!\237GM\203g\305\t\266\003\273\003rZ\037\033\027;\003\227\230\347C\022\020\327\244\372\036\204\024Go\314\322\354\344\266\353\r3R`\341\007\201\304\367qf]\306\221\264\300\207x\025&\372p\206\301\2436\241\210N\004X\316\032\242\231\002\372\t\310z\313\303)!\204TY\\<\\}sg%\212:\267j2\024\022-\244\214CP\000\343.\033\331\344\266u \331tC\035\3226\006e_\243$\215h\332\326\000\334\3011\010\357\337l\220r\306\251\311\260\2255\207[\257\320\247\016p*\342\330\337\033\370\034\020\332h\036!\314{\262\327\314\204V)\236R\311;\350\310:\371\2753[Z%\235U\020\032\202\251\rH\242\272\324\372u\0068H\347\273\037\026\252?\007\356\332\231\200j\313S\205\".UQN\252\006|\272d\363\351\007\327\372Z\007\207\333\3657\014\362\024#\330:\003\373\372\302_b\307\335\\qV\254:Js\214{}+\025\234w\370\346\341X\253\024\004\350\020\246,U\212\260\212\023\211\2461E\221\021\220EQ\"\311\0219`Os\"\200\242\230\356X\304\002\273\252\311-\354J4\302\351O\235\013\334\225@\021\350`.\344D\035\300\311\033~(<\374\336\221\366:&u\246\214\330\252\366\264/NT\221.\263g\334\372\225k\233$B\305\3656\\\320V\355;([$\344\227^\242\327D\342\3146\324\215\260\212(,\000\306#\336G<\340\270r\001}\350\003\275\261@6\356\230B@q\301/\246\322\210\251\250q\274\307\311\253D\024*\250o\335\347\276\374\253\222\241T\25222\256\250\207\241P\\^\241\252\330\032\264%\016|;E\334\321*\3351\242q\253\020\227Y\325N\026\245h@%\301\320\225\344\246m\256\016e\200\324U\261C\333C\001\327*\300\346\002\216\220vf\353lAL\343\tN\027\354\227g{s\033*\276m\2361\246i\311m8\034\357\246\231\301?i\341\327og\232\353X\225{c\2476(\354\202t\327\210\243\242\262\222\272\246\027\240\001a\032\023\202ed\3379\024\344\301\310\235y\364r\324\203\306\025\315J\211,\010\206r\223D\037\035\256sjx$\201\303\201\265\224\220*\316\342\337\006\351\230\001\2356\233\264NDQM\355\364\321*\325\270\246\023\242\345\262\224\254-\236\231\264\311H\324\3478s\017\001\022R\002\345+8y2k\246\352e\252\273\216\257r\247,\215\\\200\343\213L\352#\211\021Z\250\221\224\256\027\262\337\266\364w+%""\207eU\004P\244]$\252\021\225\222\260\030W)7\243dGNX\"\371)\312\210\316\201\006\003\253\010C\005\224,\352Q\"\203,?k/\353`\020\026\310%\226!-\332\341\001F\256\322\274\353\321\343J\327\230\n\2702R0cB`\245\212\344\206\201h0a\203\013d.,\257\032]\343K\210\220\010\025:\250)M1S\240\014q*Ui\0069\352\325\031\025\304\014\\7L\220\202\244\322\242\264GGM\214Mx5\364\313\236\023\247Vp'X\027\010\212\362b7n3}\024\221oh\001\215\000\306\2206\224\265y \027Egf\331\246\244\030\351\324\307\021\237,\320(i6<5\263-\\\374\304\030d\264\314F\014l\206\031G]-5)?V\270H\021\365\232FF\347\311\354\232F\263e\255c\205\245\344\222\277\313OM\354\202x\360\336\203\032\207\266\373\370Wt\376g\210#\330\037\014\312S\377\\\037n\356F\320\006s\244rA0\242KA\353\226\270\321n\313\005N\000\3037\210\351\336{\033j\371\367\360\340Q\030M|\031\002>=a$\256\203\246\020\242$)Bx\001\007\211A'\204)zE\206\243\325p`\225P\266\014\314>\000\240\332\252zP\275\005\010\274\"\256\374\334\355m\273e\2142Xv\255\267_`\256i\211\2638\007\333S\304\251\025\236/\265\363\271wz\336.\315\266\344\325\217 \366k\362\367\332\267%\007\031Bc9\3320\303.<V$\332\020{I\334\014:\233bhgg\004_\3609V\347w,\307_\242\026\351E\r\000\325\336\321\254B\315\020\231\312\334\020;\027\"\316\247>AU\02436\n\250\312\327\017\315\327g-.\225\313@(\211\213\347\332\263L\320\325\275l\324\377\037\221\211\350\036\037?VT\017\346\220\351\340\242X\017\n}\017+\302\237>\216\257\364*ED\252\237\201\372\3221I\016\302T\031oC\324y?\277LC\007\203\261\344w\216\236\370\375\0053\357\251\013\214\301\003\3748R\"28\214\000\027\254vSn\262\300\004\243\337q\001^\007\323v\220\204\027?M HD0\\\271<[O\034\023\274`\312}\375\354\025\264\004U\213\372k\234D\013K\263\034)\236\025\240\210`\320\325\020Y\021|\342\253\314\366$0?x\260P\365VY\247\033x\206{\203\000mf\324D\0206\006\035\377,\320\356\352\257{\201N\004\275\363*\006\303\331\277\311\301\307\r\323\366\374\230\004bZ\2124v\274\0011\026\3503\002T\304Q\020\257Y.>\\gX\013\274l\002\250b\002K2R\2002\371\230o4(4\017\304\nn\310\221\0204a\260\342 \224\327X\213\321""\304\272i\234\217\326#\216g\343,\301Dy\001{\244\371: u\215\005\240]-\3243\033\377\362_\005\207\035\257A\342T\2354o6\337\343\323\314\254\253{l\375\030\325\272y\014b\223\236=r\362\t\027\223g\306\254\247'\233\334\327\305\224t\266\262d@;\207\272S\256\247W\305\226-\377{\255<(\300\265R\301\357\264Y\235\254e)iS\250A@\203\2014\302\306\231\2324\247\235\272b\357?\352%\016\342}<\323\004\2515\316\224\306C>Nc,\324D:\265\255\301\277\014fr\027\177\336\200\357\334\0267\256t{\034\034\213=\336X\3360\235\357\257v\327\000R'\263l\031\025\261\305f\270\304;3P\203<\225\314S\265k\2573\241\354\222A\350`\271:\213\201\216\305=\032=\233\003\260!\226\036\010N\315\017\264\334\327\207F1\363L\216\222\314k\336\262lo_\252Co\312F,\371H\0078H6E\360\007\216\233\333\177\335\221\330q\3103Fv\017G\270B\250\354\263\275\213\305\261\257\255\216\227W$\027@\243[\203/\263RC\356\252\276\267\303R\277\014\205 1%\006\227\3107\016\365\225\273\240E\357E\002\240.\n\200E,n\310\212\341\222\346\2305\324\240\205EdT\252\227\014\013I\013\021\010\246\025\301VD\224!r\312\245\021\335\357\rS\025\227\203&\004\336S\205\260qw>S4\214\233\305\371i8\031\272\341\002q\204\342`\243k#ESW\240\330\252g7\245\225\251k[\366\342\371\331cZ\317\250\320\205-\330\211\325\036U\236\037\026\214X\244\035}\010\313Y\355\225\244i\033F\365\3732\031_\347\0314\251\352\314tG[\306P\264oe\243\020\024\232\311#\275-'\346\257\nN\325\"\246\373\231\260)\377\305\334\221N\024$8\177e\302\200";
    PyObject *data = __Pyx_DecompressString(cstring, 5458, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (5432 bytes) */
const char* const cstring = "x\332\265ZKw\324\306\266\216\357mNl\307\200M\014\007\010!r \030\010\264\323\301\t\201\340\3444\306\030\203\337\356\204$,\256\226,\251\273\025\253\245\266\036~\220\225\034\206\036j\330C\r5\354a\017\031z\250a\017\373'\344'\334oWI\335\352\207\355\346\254{\327rK\252\252]\257]\337\376\366\256*\2473\371o\322\367\362\331\371\371\365\271\371ln\356\211\230]\\\\\231\315\346\026V\2267\004K\335v5K\265\005\311\020L\327)\273\216\220\327t5\253\353\246,9\232i\254\253\262i)\217\034M\231\311:\216Z*;\232Q\020\034SpmU\260\035IW\343zE\311PtuV\322eW\227\230TQ+\024\205]\311Q\255\222dm\315\242\013\303t\004\325@\206\340\024UA6\361\271\347\010f^\220\204\rS\336R\235uURPjn\376\256\312\216P2-\025\22246CV\357\010\222\303\352\331R\t\331ZIM\243\315I\007\355\2240\0006\034G\263\035M\2661:\032\200$\224-\365\256T(Xj\001\303P\004Y*;.\332\2449F\225\363\232\241\01041\323\222\254}Aj\316\374}\032)\250\016\325l\253\235\267\314\322\373T\216*Bk\266cb$}\366N*\245\0260yyKp,IV\205]\315)bU\260\272\244\315\244\224S\244<\301 \rvJ1-R\237-=\316\232\256\256\260U3\313\252\301\372\024\346\366$\331\321\367\261$*\255\334$e\212\324\340\244`Z\302\244\242\242\246\301\2462)HV\301-a\301\205\222k;\302&\226\250\254\312Z^S\225\271=|\321|$,\237\242F+\236\310\315[4F\236\375TB\037\n\241\256,Y\300\335\317\245\365\215\r\256\340\262e\312l\300\256\335\222\332\2654\300\241\310\346\265@p\333\221\364\233\221\212UE\334T\363\000\226h\033R\331.\232\316\314\362Tv\331l\003\233*\344\240\310- Q3\3208\300\007\275\0334\001\314]\333Q\273\220\210\372\266+\027\231\206\036\nH\241G71]\001=b\230\226\013TK\216ci\233\004\330\311\222-b\225eUT\313\246\\\234\354\273\236e\333\375\013C\017\345\376\245w$E\261\372\027/\251%\373M\377\342\244\037\206\225\276k\274\337pl\265@x#\355\030X\024\207\255\250#\314\356\003\352\206\240\331\202\242\352\332\246j\001\007\2000\352k2g#\254\356\352\334\352\335\351\357\246A\205\nl\202pgcQ7e]\262m0$\260\276\351j:\300-8\373e\325N\013\013ya\337t\005C\215\261i\267U\000@\014\301V9R&\231\r2\263\020Q\035f6)(`^\016'\324~*\351\266\232^\341""\304\247ky\225`%\250;4\033\330\221\312\254P\332\001\306\245MX!\215\002L\321N\007B\256\310\277\300\272\266\300m\336`\223U\230\2653z\330\022\271Q\211q'\366L\316r\321u\231$\211\201\360\007\253\324M\033\325\236\2425N\312\253\232\274\245\023=@\021\221\342\261\370\320\245\315\241\217\036mU\317\247E\003\234.Zj\036n\245\3304|u\257\254k\262F\304A>\007$\021\217\351_\222\353\230b\231ZWo\322Hn\255\302\246U\233\323_\213\027-\346\211\354U\276\224\221\207@7\252\245\222}\262\251Q\225\246K\213$\357\2453\367\322\367\210\233trEia\326\265,\342\244\035\014\035\r?\0246Z\324i3\\)j\222\310\241|\346e\270\246\2254\247\006\205/U\302?\346\342\0210\345c\345\010\240\222E\023E\233\305hE\340o4\273\210\274} \003\371y\306Z\351\037\177\270\225\026\322\351\364C\341!\020/B\222\374\035\260\017E\314\334I:\226V\312\264f\344\274k\310i\322\337\376+y_2^\337i\r\276\007\323%\310\271\2712\261\353}\222(\303\270h\341\023YS\212\2723e\270\272\256h6\001\020V\214g\336DW\273\":\331:*\224(\310w`w\242\014/\203\021\315h6\257\251\244u}\247\224\006\202,i?-&\006\026g\361w+\345H\212\344Hq\232(\337\216\023\334\2531'$j\304\367\262Z\206vx1\234\273M\321\211e@\225%\325*\220\265\262\n%\255\304T\005\225m\272\205;\202!\266\253\331\0207\367Qy\3060!\221\227\\\335\021D\000[qA\330\242\240\270\314n\r\323\270\013\032\331\321$\035\2452V\327\021\305)rKSd\016Sye\252\274\237\354\207\033\tw\272\344U\010\024\233,\030\002b\034N%\222\320\016s\002e9\262?V?\016\010\314\377\274\t\260\224#n\251\373wx*&\003\236\374\317\207wG\260\2657\352\214m\311S\\\377S\321J\246\313\373{wx\230\"\302Z\030\275\301\217\221\233.\037\303KM*\203Jw4\205b\003\247\351\2351*NEX\261\233\216\245\252\02460\017p\353\221kl\031\346\256\361\203\353\344\357~\367p\027\353\217\321=\024^m\232:\361\273\362z\211\303\303v\313\210\375\370$\346\321\204\241\3030\301\254`,\325\322\250-I\1775\365Zh61\374j_%\330\277^\325U\t\321\210\245\262\372\222\261\217j\266K\026\000\2749N\331~85U\000\305\271\233i\204\250S\233\272i\022_\026b\305pi\264=<\334;<\317..\314/7\263\026\027\333\312\232P]\214\364\225mb""\"\007\304?\343\200O#\352K\302\272\317j\375\266N\\\325j\275\337Z\021\2256y\251\337zM\353\223\031\374D\261\377\212\360\303D\031\275\252r\n\357L\037\327YS\342\304V\323\305\375MKSD\016{\346b\272D\210\366v\324cE\272\3130?\004!\217g\031\"f\021AS2\301\327sO\327\347\346\236\376\264<K`\021\227\263Ks\342\312\362\342\257\035\254N\311\247 J\311i\371\371\326\027&\3106k\242\330\236\267G\024\327\226\325\241\251\266\262.\035%K\233\033\233$F\223\002 \242\023DX\240\222H\267\003^\214\302\206\016\001\332\232\212\315\255\351\311\362\260t\270\374\223\345`\331\330\2735\201\335Y\334\301p\"\017\357:\204\242\315\250~roM\311\326t\304\376\346\323\334\360\366\022\245\235\027\301i\376\031\232}I\255.\241\321\243\351\245\307\200\355\223\253\366\321x;\273\364Q\241\223X\372\250\322\251:\346\362\361|\2376H\t2\217*Erg\"\271\300>\353\275\227\316\272M\255\257:]&\210M\361\234\341\226\360z\252K\205x\213\034\277\273{I\224t\265\265\250\031\356\336\"B\310\245%FFKsK\314o!\271\272\364\3232=\231QlD\372\\\212\"\271\345\225\345\271h\227\266P*\353*yZD\325\217\237\317\315\346\304\331\3659r\206Q\352\311\334Fn}\345W\244\231\375\304\201\366\034Y\317\352\352\312\306\302/b\334\353\352\317l\020\253\277\362\301\210\263\355Ib\305fb\251\275\014]\362t\356\031(3r\265+\353M\261\316\354\205\023\n0\354\307?\315w\025\257\344\236\315\255w\345\306\2438\262 jMr\212\330\036\025h[\020\277\027\014Ec\036\241+\243E\340=\213\030\217\367*\351X\375^\"]0\020W\367\347\200\020\221\036\214A\236\360\220\231G\212m^\213d\367\304\331\247\330\272\210\367\243PN\3341\341&E}\225v[\030\001{\033\246\272G\241<\272+\303\365aWT\320t\221\355v\304\364#jQ\267\177H\357Z\260\270D\223\352W\233\367\277F'=\233v\261?\370vZD\223\010\311J\222Ho\304\220\242\014}8r\324\366W\342W\275\232_\335\177\242\201\275\227\261\277]W\363\021\\\326s\213O\2606O\263?-\346\330\367\362\312K\356\265_\322)T\322\022\217\310\356V\370\321\202]j?J\2249-D\370\332\261\002\232\001c\334$\317\320[\210\035\244u\273\210\343\305\351</\362t\307\013\262#>\261\354\332\305\276\344\314\362\361b\374\274""\357x\231\222T\246\263\027\373\004)\356\305\373\231l\344\321\373\021\215v\251}\211Zt*p\302\\\\\003Fi\352;*\355|Y\010\311\024\325\265\233O\236\254'\277[\354\320\231\313\210\241#\263\003\242\035\245]\270l+O\372\307\330\255n`\035\014\325\2325u\267dl\320n~c\277\204\275\231&o\360\rYN\314e\027\026\031\201\213\271\225\\v1\027\205\031\255\350x\236\237n\221\273;\262\250{\350\307\013w\315\244[\234/\313Q\371\375tx\364\006\342H\331\356\215\304\221\242\335\033\212#E\2232\014\236\374\271\014\034-\264\016Rz\234x\365\310\3521\361\236B\335s\356!\326c\272=\244z\314\264\207TWq4\241\204\005$2\030\370[\351\236S\262\216\236\006G\273\355Z;\332\016\230&\"\010\233\207%\277\376\326\036\322R\312\221\354-:\350\213\016\373\244<\rH3D\271\250\351J\357\rR\353\364\207g\036u\336\227\350\250E\341\262\351\302\0147\233\221\177\334H{!E\260-\201rY5\024\311*\340\357+\3742\370\331\370\355\220\203)\251o\020\305I\366\276!kf\032\n7\351\026I\265\351T\236\035\355FG\301\233\246\251\363\340\032\223\353\210\272y>\337d\311\"MH\226\344\242J\307S<\321\036\326'N=\341\277\351\270]\204\322\301\211%J\242s\352\202\255\367&\226\204m\020\023N)\361)j\212l\352\272\312\016\220l\026\021\030\ns\213t\247\250\253\320)}\320\272\210\320\016a#\272l\024[\227d\3215\246\256m2\355q\025\262vL\031\201.\333\351\035s(\2338\372L\036\203\212\242B\301\206\250\270\2452-U\274;SY\244Ls\340OE\244\263F\221_\201a\225D\266\261\214q\335\374h\30536\355Cm~X\272\313\226\226\302\242\022\333\212\"\334j\351\215%\020\256\321\233\335\276`\372\266c\307&B\207\273\354\356/\317\016\020\232\327\200\354\243\21485\276\353ao3\257Y\266C\232\305g\353\324\230y,\356\3375CQ\367\370'_\034\272\337c\347\200\216T*\347m>]\364K1\036{\222\232\3427\353\272\240\032\300A\357\003\200\216\275V\317-[/?Ey\321\351/\254\203\234\225\335\327\001B3\000;\366\370\240-\n\353u\200p\364\251AO\232a\231\221\037\025\243\223\315\023\316\024\216\332\301\277\347\001\303I\247\n(\007P\0318\310X9u\212\205\350\3005~s\3645W\267\340J\226R\224\3548\300\341w4<\320\243U;q\363^\334-\265%\231W\351\366-Hi\n\224""\252\031\262\356\222ME\352d\230\324Zg\314\242\231\317\223\375h\321~\330\326\312\"]n\304\244\327\272\350\300\027\332\203&\030\242\221*s/\301\001\276\t\216\000\237\356\023e\331[\204\016[\307\252\352\004\205&\034b\r6WD\304$Al\374\031E\223\232\302S\364&\235#\300\215b\3348\324-I{\355\001-\313I|2=\330\"\277\314cv\204\236\242\244-\306u\343)\213%\273\27558B\265\373\322\306~\303\256Z\242a\332\361\365M\353\036G\223-F\313F\363\032\246d*.\241\243\375m\267\337\221\267\335\321\264%z\270\225\366rn\204\321\245N\264\022\234\007\031\027\212\211'\027\301\227\342\270eb1B_2\310\206\336\343\330\203\3378\213\321M+zj\013JZr-\264\265\201\231nKA\277\370\003]@c6\245\030\247\303\351\250\n\200\330tUv\333f\203\376#\303\264\264\202\230 t\3236wT\213m\017\210\201\351\007\267T\306\304\243eL|\212M\217T\326\224\262\016\006\007\217c\223E\224Q.[X\357\326\243i\247bt\t\222\3609bl\326E\323\334*GG\005\304\346\374\254 \276\374\342\370\217\254\240\031Y\210\260\013\206@\"\003\372\334a\320'\307\265\355J:_\022~\031\025\275\242\204]>\352h\230k'\006'\005\t\\\227\255\253\273\256\240\256\231\241\356\211q\270\022\275\3042u\306p\212\256\340\377\220\224\034\346\273,\025Z\223U~\375#\3063\267T\007\177\256\205\315\031]0\253\226&\027\351\227n\n`(\364#\367\226\364\335\324\246\350\260\000\240`1\rr\030\332\221\013\205\231m\321t\330\2352P\027\377\253\003\335\327\221\343GW\350P\244\301\020\"t\263 2Na\221j\004\356$Vz\304\001\310\212\\\235\235`\353f\240+\366\010z\311m\322/\016x\330w\276\344\330[\032ZT\"+kOQ(\025\263V\314\314\311\025\214-'a2l\3221\347%sx|\200)\323\377\022\260\230L\006\305\024M\205]\020\363kb\333!\334\200\304\3614-\333\315\347\265=\362\215\264\032TO.\332\3736\376@\306\024\214S\024&[Z\231\306\322\362h\233\250FP\240\371\261e\302\023\021j+\024?\352\026\232gcQ\351\003S\325\025|\230\273\230\273SByYl1\024<\025\213\036\273r\251W\207\342y\366H\352\212gp\275\362\357N\353\346\271D*\311j\314\315vZ\243\335\214\375z_\310:|s\025\345;\321\361\032\363x\344\034\321\nU4l\r\270\244\310\221\375\237\214khNt\027\353\226)\036\336a\377b""\304\"J\366\260\243\177\304\210^\320]\336$@\036q\370\324u\310\324qH\324y\266\224<\034j?\004\352q\330\323\343P\247\307\341M\333!\315\261\2071\254\320z;\360\367\370\007\247\306\275\214\227\rS_W'\352\203\037\035L\0378\336w\225\351\212\345_\t\326\002\251>r\316\273S\221*\333o\263\215\301\241\203\261\350up\303\033x\233}\233\255?\232\241\034\252\266]\037\031\rG\357\004\331\372\3513\365K7\203\201\372\310\331\203?*\023h\013E\347\275W\376\200?\356\2575FF\275\301\312@\345\222?Q\037\375\247\267]\031\362/\005\023h)\352;S\037\371\030\217\301\221pD\360S\376\213\340Mm\014\251\203\005/\027^\272\035\334\252B`\334\313z\271\312\030\215\355\272'5\006\317\036l\2675p\232U\377\264\362\322\317\372\271\340b\365rm\272\266]\207\230\023~|\335_\300\274\362\325\371Z\346m\026\323\037\032\211k\261\211\326G\307\330t\302\263\327\374{\276\224\314={\340\362~\343\276v\275Be\215\206;\355\321\344\275!\032\322\250\367\017O\352\2208\347\335\256d\321\306\337\203\037\014\235>x\341\375\341\247\253\003\325\361\352ZU\251\335}\267M\323{\3419\225\357\374i\337\n.W3\r\232ox~*\330\256\246\252Y*~\352\335\250\014D\023\375\373\037\037\214\216\361\366\337T\306*\351\340T\300\372\270U\311\240\027\310\374Y\311\206\237\336\r\326 :\334&z\327w\261<\t\321\360\354g\225m\377l\360g-[[\243\252\273\236R\371\034\325S\217jX\335\306\243\307\357&\320\335\320\331\203-\314m\360\314A\321\223\350U\n?I\007\364\025\236\231\360\307\230f9h\302\211\357k\231\332\334;\246#\032\366\004\033\357\231\263\365\221+\225\027\276\035\\\303XG/x\272?\341g\032#T\357Ae\026\000\211\363\010)Pq\345zE\352@\212S\271\017\201\007\301Bu\215\001\247>\376)t;~\276>~+\030\013o\317\324\326\320\321i\241\262\353K\376~u(|\260p\210\345\300\024\005\377C\177\233k\177\354\"\007\\x\373am\242Ax\275\215\021\275\252\r0\354f\252\227j\0231T\307\032\014\276\327*\033\376@\375\323\351j\266qi\222\232!\354\255\261W\257G\203\300\213)_\370`\350co\222tv\316\373\022\303\304\353fe\202^w+\177\004_\004X\363s\341\271/|V2E*Dr*\312\276\346g8$\376\362\327|)L\221M\r\236\367~\203\232\006\207\352\243""\327\302k\337\0028\023\365\233\267\010\252\017\275\227\225'>\237\001j\372Kaf\366]\206F\363\214\345\003\000\21112\034\303\014n@K\333\355M\367\321\324\021\263\376?iv\354\377\243\321#\032#t\2369\220H\313\313\341e4\034\344\252\004\026\340_j\214_\254\014\003r\343W+\245 \023\314\201=2\365\361\353\376s\000~\\\360\207\003\024\245\203\337\201\231\361o\252\277\201W\200?\330l}\374n\360[\025\251\t\377r\220!\243\031e\306:\362\301\360G\334\204\362\3418:\247\216\361u\033\315\360/\226\327\313\200`\274\351\251\372\320p\233\001\032d\267\307\233]\304\206Tx\2772\t c\226\317=6\331g\336\223\312\177Un\370\340\356\277\317``\215V\023D\367\365Q\330;\255\304\215I\232\307?\301\341\343W*\363\200#\231\331\371\270\325\357\303\253\337\023{6S\231\352X\"\005fx;PO\215z\303@|j\360`\004\352\007\312oT>\254\354\371;\344ThF\327a\312\263\341\324\363\303\t\342\363\027\214\206\234\352\203\332lm\273\351ON\327\343\257\317\261 \203WA\304\251\313\225\2110\205aR\027\343\336,\354\031\037\037\276u\016\356{_ q\212H\237\024U\360\326\302\013\260\330\006p\363\242\372\327\273\265\372\0054\342\377P\035\203\237KQ\263\226\367\231?\020~p\316c\243\034\364\006\274\217\241\236\024\320\223\362\237\004\251\200q\370\275\003\t\264\377\030\352\203e\177\355\255yr\345\002\306z\212,\223\251\232\332\372\372`\355@\366.\320XhX\267\202O\310\275\324\210\371N\r\276u\302\217\300\262\241\360\r\370\236-\377\357 \2651\252\227\tS\317\016\007H\033\023\350s\036h\3136I\266{m\233\302g\0174o\273\267\004\324\311$\3023\002l\200\253\241\336\276\310\001\030\345\305a&\302\244\307zlo\217KyX\374G\265\027\341\374\313\360\345/d\000Y\177-L-\036f\231s\375\214[\341\364\301\036f}\326\377\263J~\2053\032\230\026m\337\253~Y\373\237\303LK\353\327\253\360\324\344}aj\215\301[\301x\360\013\024R\254I\344\232\247\303\3519,\021V|\204\326\003\316\0026\014\003\030\3722\230h \236\340m\257\023\001\023\024\340-\362p'H\221\363\3757\226\002p\275\020N~O\246J\276\341\342\347\376d0F6l\300\270\341&\310\336`j\005\026\323\234\277T\371\214\260\375e\300\304\235\360\223\351\352\\\370`""\351p\375\320\016\327sa\356\227\360\227\355p\333\t\035\267~\361\022Za\240n\214\177\002\355\374\233h\240\371q\27618\305A\014e|\353\215Q<\342\275\361\257\006.\371\355\313\225\333\341\365\354;f\251.\305X3\341\314\322\341\032ad\370\340K\0004\305<@\377\324^\375\244\226=\2127;\3302\331r\237-\035E\226l\270\230\341\020\255\353\231\203\ro L\301\177\276%0\236\372G=u\252\221J\007[\265\253\210d\316\301F+\177\221\222\033)\301\037\302\"\2575Rd\373\304\250)\026\020\000c\231\360\312\335`\243:\320\200\341\356\300v\314\312kF\207\234\326FN\303S\237\312\204_1\315\rEL}\021\361\317\3200\245G\210\007F\250\321\217(^ \330\376H\230\270\214P\010\213z9\274L\261\t\275\341\265\253?\207\337\257\034n7F\031 \320\313\330yO\364\263\215\266\027\346\201\310\300\251\374\030D\221\006\373 \030\237\372\350`\342\340;/\023\216O\206\223\017j,\353\274\367<\274\212\357z\212l\342uu\242\372u\365e\355qMyw\355\335O\207\327\016\177\0167rD\002\227\303{\010A\250\306(B\262\245`\254\221\272\002\366\036\032F\360|\026\0342\202Pf\2436\374\356\316\241\304L\352J\345yx\003\355\326\310\204O]E\324\320\024=\035\374Z\225k\227\337\315\204\253kQl\373\033C;8\006\272\232\360\207Y\000D\234\362\r\354vp,\034\203&\375\233\001c\315\337\303\2334\334\301\317*o\302[$\306\230t\220\271\020\346}X\2228*\205G\322'|Jd\201\260$\231w5`\314\374\305\r2\203\014\254p7\220\220\305\022Yr\024\2237\203\377\006\225=\307\2101\227\372E\362 \367\203\t\346\024\241oP\375[F\331;\0079\357r%S?\017\333\014\246Y\254\373\2446P\033k\225^$\237\307X\037\\\371\277Q\373)\374";
    PyObject *data = __Pyx_DecompressString(cstring, 5432, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (13873 bytes) */
const char* const bytes = ".1f5.3fAGGREGATED_ALLOCATIONS requires an output fileAllocationRecord<tid=Attempting to use stale output handleCalculating high watermarkCan not enter the context of a SocketReader object more than once, at the same time.Can't compute statistics using a pre-aggregated capture file.Can't find temporary allocations using a pre-aggregated capture file.Can't get all allocations from a pre-aggregated capture file.Can't get allocation history using a pre-aggregated capture file.Cannot get stack trace without reader.Cannot get thread name without reader.Computing statisticsCould not open file Exactly one of 'file_name' or 'destination' argument must be specifiedExpected a code objectExpected a frame objectFailed to parse VmRSS from proc statusFailed to write headerInterval(allocated_before_snapshot=N/ANo more than one Tracker instance can be active at the same timeNo such file: No value specified for struct attribute 'ms_since_epoch'No value specified for struct attribute 'rss'No value specified for struct attribute 'heap'No value specified for struct attribute 'vaddr'No value specified for struct attribute 'memsz'No value specified for struct attribute 'filename'No value specified for struct attribute 'addr'No value specified for struct attribute 'segments'NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Object lifetime events are not available in this capture file. The file was not generated with track_object_lifetimes=True.Operation on a closed FileReaderPickling of struct members such as self._next_refresh must be explicitly requested with @auto_pickle(True)Processing allocation recordsPython object reference tracking requires Python 3.13.3 or later. Current version: Stack traces for deallocations aren't captured.TrackedObjectRecord<tid=Tracking was never started or has not finished yet or failed.?>). ...: :add_note, address=, allocation""s=, allocator=cfunc.to_py[cyan], deallocated_before_snapshot=destination must be a SocketDestination or FileDestination/dev/nulldisableenablefollow_fork requires an output filegc, is_created=isenabled.llvm.memray._destinationmemray._memraymemray._metadatamemray._statsmemray._thread_name_interceptormemray test harnessmerged threadmimalloc debug, n_allocations=, n_bytes=no default __reduce__ due to non-trivial __cinit__/proc/self/fd/pymalloc debugself._reader cannot be converted to a Python object for picklingself.aggregator cannot be converted to a Python object for picklingself.last_key,self.lifetimes,self.reader cannot be converted to a Python object for pickling, size=src/memray/_memray.pyx, stack_id=time rss heaptrack_object_lifetimes=True was not provided at Tracker construction(tree fragment)<unknown>utf-8:warning: [bold red]Memray support for Greenlet is experimental[/] :warning:\n[yellow]Please report any issues at https://github.com/bloomberg/memray/issues[/]\n\nAGGREGATED_ALLOCATIONSALIGNED_ALLOCALL_ALLOCATIONSAllocationLifetimeAggregatorTestHarness.get_allocationsAllocationLifetimeAggregatorTestHarnessAllocationLifetimeAggregatorTestHarness.add_allocationAllocationLifetimeAggregatorTestHarness.capture_snapshotAllocationLifetimeAggregatorTestHarness.__reduce_cython__AllocationLifetimeAggregatorTestHarness.__setstate_cython__AllocationRecordAllocationRecord.__reduce_cython__AllocationRecord.__setstate_cython__AllocationRecord.hybrid_stack_traceAllocationRecord.native_stack_traceAllocationRecord.stack_traceAllocatorTypeBCALLOCCodeTypeDestinationEFREEFUNCTION_NAME_ONLYFileDestinationFileFormatFileReaderFileReader.__enter__FileReader.__exit__FileReader.__reduce_cython__FileReader.__setstate_cython__FileReader._aggregate_allocationsFileReader._reaggregate_allocationsFileReader.closeFileReader.get_allocation_recordsFileReader.get_high_watermark_allocation_recordsFileReader.get_leaked_allocation_recordsFileReader.get_memory_snapshotsFileReader.get_object_lifetime_""eventsFileReader.get_temporal_allocation_recordsFileReader.get_temporal_high_water_mark_allocation_recordsFileReader.get_temporary_allocation_recordsFrameTypeGHighWaterMarkAggregatorTestHarness.get_temporal_allocationsHighWaterMarkAggregatorTestHarnessHighWaterMarkAggregatorTestHarness.add_allocationHighWaterMarkAggregatorTestHarness.capture_snapshotHighWaterMarkAggregatorTestHarness.high_water_mark_bytes_by_snapshotHighWaterMarkAggregatorTestHarness.get_current_heap_sizeHighWaterMarkAggregatorTestHarness.get_allocationsHighWaterMarkAggregatorTestHarness.__reduce_cython__HighWaterMarkAggregatorTestHarness.__setstate_cython__IntEnumIntFlagIntervalInterval.__reduce_cython__Interval.__setstate_cython__LinuxLockMMALLOCMEMALIGNMMAPMUNMAPMemorySnapshotMetadataNONENoneNotImplementedOBJECT_CREATEDOBJECT_DESTROYEDObjectTrackingEventPPOSIX_MEMALIGNPVALLOCPYMALLOC_CALLOCPYMALLOC_FREEPYMALLOC_MALLOCPYMALLOC_REALLOCPYTHON_ALLOCATOR_MALLOCPYTHON_ALLOCATOR_MIMALLOCPYTHON_ALLOCATOR_MIMALLOC_DEBUGPYTHON_ALLOCATOR_OTHERPYTHON_ALLOCATOR_PYMALLOCPYTHON_ALLOCATOR_PYMALLOC_DEBUGPathProgressProgressIndicatorProgressIndicator.__enter__ProgressIndicator.__exit__ProgressIndicator.__reduce_cython__ProgressIndicator.__setstate_cython___PyEval_EvalFrameDefaultPythonAllocatorType__Pyx_CFunc_7Tracker_void__lParen__rParennoexcept__space_nogil_to_py_.<locals>.wrap__Pyx_CFunc_e0b72e__7Tracker_void__lParenuint64_t__comma___const_c__etc_to_py_0_0.<locals>.wrap__Pyx_PyDict_NextRefREALLOCRTLD_DEFAULTRTLD_NOWRecordWriterTestHarnessRecordWriterTestHarness.__reduce_cython__RecordWriterTestHarness.__setstate_cython__RecordWriterTestHarness.get_lastiRecordWriterTestHarness.get_linetableRecordWriterTestHarness.write_allocation_recordRecordWriterTestHarness.write_code_objectRecordWriterTestHarness.write_frame_pushRecordWriterTestHarness.write_frame_popRecordWriterTestHarness.write_headerRecordWriterTestHarness.write_mappingsRecordWriterTestHarness.write_memory_recordRecordWriterTestHarness.write_object_recordR""ecordWriterTestHarness.write_thread_recordRecordWriterTestHarness.write_trailerRecordWriterTestHarness.write_unresolved_native_frameSocketDestinationSocketReaderSocketReader.__enter__SocketReader.__exit__SocketReader.__reduce_cython__SocketReader.__setstate_cython__SocketReader.get_current_snapshotSpinnerColumnStatsSymbolicSupportT_TAIL_CALL_TOTALTemporalAllocationGeneratorTemporalAllocationGenerator.__reduce_cython__TemporalAllocationGenerator.__setstate_cython__TemporalAllocationRecordTemporalAllocationRecord.__reduce_cython__TemporalAllocationRecord.__setstate_cython__TemporalAllocationRecord.hybrid_stack_traceTemporalAllocationRecord.native_stack_traceTemporalAllocationRecord.stack_traceThreadThreadNameInterceptorTrackedObjectRecordTrackedObjectRecord.__reduce_cython__TrackedObjectRecord.__setstate_cython__TrackedObjectRecord.hybrid_stack_traceTrackedObjectRecord.native_stack_traceTrackedObjectRecord.stack_traceTrackerTracker.__enter__Tracker.__exit__Tracker.__reduce_cython__Tracker.__setstate_cython__Tracker.get_surviving_objectsVALLOCYZadd_allocationadd_taskaddraddressafter_in_child_aggregate_allocationsaggregatorallocallocated_before_snapshotallocationallocation_count_by_allocatorallocation_count_by_sizeallocatorappendargarg0arg1argsargvastimezoneasyncio.coroutinesattrauto_refreshboolbytes_in_high_water_markbytes_leakedc_callcache_keycallcapture_snapshotcfunc.to_py__class_getitem__cline_in_tracebackclosecode_objectcode_object_idcollectionscommand_linecompletedcompress_on_exitcompute_statisticscontextlibcountcount_and_locdatetimedeallocated_before_snapshotdestination_destination__dict__dump_all_recordselemencodeencoded_proc_statusend_time__enter____enter__.<locals>.set_os_name_wrapperenumeventexc_tracebackexc_typeexc_valueexists__exit__filefile_formatfile_namefile_pathfilenamefilenofirstlinenofollow_forkframeframe_indexframe_objectfromtimestampfsencode__func__functionfunction_namegengetget_allocation_recordsget_allocationsget_current_heap_sizeget_current_snaps""hotget_default_columnsget_high_watermark_allocation_recordsget_lastiget_leaked_allocation_recordsget_linetableget_memory_snapshotsget_object_lifetime_eventsget_surviving_objectsget_symbolic_supportget_temporal_allocation_recordsget_temporal_allocationsget_temporal_high_water_mark_allocation_recordsget_temporary_allocation_recordsgetprofile__getstate__greenletgreenlet_trace_functionguardhas_native_tracesheaderheaphigh_water_mark_bytes_by_snapshothwm_by_snapshothybridhybrid_stack_traceid_identincluded_objectsindexinstruction_offset_intervalsip_is_coroutineis_createdis_entry_frameis_python_frame_boundaryitemskleakslevellinelinetablelocationlocations__main__main_thread_idmain_tidmallocmapmappingmappingsmax_memory_recordsmax_recordsmax_stacks_member_names___members__memory_interval_msmemory_records_seenmemray._memraymemszmerge_threadsmetadata_metadatamicrosecondmimallocmodule__module__modulesms_since_epochn_allocationsn_allocations_in_high_water_markn_allocations_leakedn_bytesn_frames_namename__name__name_bytesnamedtuplenativenative_frame_idnative_segment_generationnative_stack_idnative_stack_tracenative_tracesnextnumnum_largestnum_processedobjobject_idsobject_recordopenorig_set_os_nameosoverwritepathpathlibpeak_memorypeak_memory_allocatedpidplatformpopportpprintprintprint_greenlet_warningproc_status_profile_hookprogress_indicatorpymallocpythonpython_allocator__pyx_state__pyx_vtable____qualname__reader_readerreader_sp_reaggregate_allocationsrecordrecords_to_process__reduce____reduce_cython____reduce_ex__refreshrefresh_per_secondregister_at_forkreplacereport_progressretreturnreverserichrich.progressrss_rss_from_proc_status_for_testingrss_in_bytessamefileseek_to_startsegsegmentsselfsendserver_portset_log_level__set_name___set_os_nameset_os_name_wrappersetdefaultsetprofile__setstate____setstate_cython__sizesize_and_locsize_fmtskipped_framesskipped_frames_on_main_tidsnapshot_allocationsstack_idstack_tracestart_thread_tracestart_timestartswithstaticmethodstats_statsstderrstre""rrorsuffixsuppressswitchsyssystemtask_descriptiontemporary_buffer_size__test__the_aggregator_thread_name_interceptorthreadingthresholdthrowtidtmptop_locations_by_counttop_locations_by_sizetotaltotal_allocationstotal_framestotal_memory_allocatedtotal_num_allocationstrace_python_allocatorstracebacktrack_object_lifetimestracked_objecttracker_creation_locktransienttypetypesunitunknownupdatevvaddrvaluevaluesversionversion_infowrapwrite_allocation_recordwrite_code_objectwrite_frame_popwrite_frame_pushwrite_headerwrite_mappingswrite_memory_recordwrite_object_recordwrite_thread_recordwrite_trailerwrite_unresolved_native_framewriter\200\001\360\024\000\005\024\2201\220A\320\0042\260!\330\010\013\2104\210t\2208\2304\230r\240\034\250Q\250a\330\014\022\220,\230a\230q\200A\340\010\t\210\021\200A\340\010\t\210\021\210&\220\001\200A\200A\330<=\200A\340\010\013\2104\210q\330\014\020\320\020,\250A\330\r\016\330\031(\250\001\330\014\017\210{\230!\2304\230q\330\014\025\220[\240\001\240\024\240Q\340\014\020\220\010\230\001\230\031\240!\330\020\027\220q\230\t\240\031\250!\200A\330\010\013\2104\210t\2201\330\014\023\2201\330\010\014\320\014 \240\004\240K\250z\270\021\330\010\014\210I\220T\320\031*\250)\2601\330\014\024\220A\220T\230\021\330\014\022\220$\220a\340\010\017\210q\200A\330\010\013\2104\210t\2201\330\014\r\330\010\014\320\014\035\230W\240A\240T\250\030\260\032\2704\270q\330\010\017\210t\320\023$\240I\250Q\250f\260G\2701\200A\360\024\000\t\014\2104\210t\2201\330\014\022\220,\230a\330\020\021\340\010\013\2104\320\017#\2403\240a\330\014\022\220,\230a\330\020\021\340\010\017\210u\220A\220T\230\021\200A\330\010\013\2104\210w\220g\230Q\330\014\023\2204\220q\330\014\020\220\t\230\021\330\014\020\220\006\220a\200A\330\010\013\2104\210w\220g\230Q\330\014\022\220*\230A\330\020\021\360\010\000\t\r\210K\220{\240.\260\001\260\024\260Q\260d\270-\300q\330\010\014\210K\220t\2308\2404\240r\250\032\2601\340\010\014\210I\320\025/\250q\260\004\260A\330\010\014\210F\220&\230\001\340\010\017\210q""\200A\360\006\000\020\021\330\010\013\2104\210z\230\021\230.\250\005\250Q\330\014\022\220)\2301\230A\330\010\017\210}\230A\320\035-\250Q\200A\360\n\000\020\021\330\010\013\2104\210z\230\021\230-\240u\250A\330\014\022\220)\2301\230A\330\010\017\320\017\037\230q\240\017\250}\270A\270Q\330\010\017\210w\220d\230\"\230A\320\004<\270A\200A\340<B\300!\360\006\000\t\017\210k\230\021\330\010\016\210h\220a\330\010\016\210m\320\033.\250a\330\010\016\320\016!\240\021\330\010\017\210t\2208\2304\230r\320!;\2701\270E\300\021\200A\330\010\014\210F\220!\200A\360\006\000\016\017\330\014\034\230K\240s\250#\250Q\330\020\026\220l\240!\2401\340\014\017\210t\2209\230C\230q\330\020\026\220l\240!\2401\330\014\025\220T\230\021\230$\230a\340\014\020\220\010\230\001\230\031\240!\330\020\027\220t\2307\240!\2409\250I\260Q\330\020\027\220q\330\024\035\230Q\330\024\025\330\024)\250\021\320*=\270Q\360\006\000\r \230w\240a\240y\260\t\3209I\310\021\330\014\017\320\017 \240\007\240q\330\020\021\360\010\000\021\030\220q\230\t\240\031\320*:\270!\340\014\020\320\020*\250#\250[\270\001\330\014\020\320\0201\260\031\270!\330\014\025\220[\240\001\240\021\340\014\017\210{\230#\230S\240\001\330\0354\260A\340\031'\240q\330\020\024\220A\220Q\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\340\014\023\2201\200A\360\026\000\t\023\220'\230\021\330\010\022\220+\230Q\330\010\022\220(\230!\330\010\022\220-\230{\250%\250q\330\010\022\320\022%\240Q\330\010\022\220/\240\021\330\010\022\320\022/\250q\330\010\022\320\022#\2401\330\010\014\210K\220~\240Q\240a\320\004,\250A\330\010\025\220Z\230q\330\010\t\330\020#\320#6\260d\270!\330()\340\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\3201C\3001\330\020\024\220H\230D\240\001\330\020\021\330\020\024\220A\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\320\004,\250A\330\010\025\220Z\230q\330\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\3201C\3001\330\020\024\220H\230D\240\001\330\020\024""\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\320\004,\250A\330\010\025\220Z\230q\330\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\3201C\3001\330\020\024\220H\230D\240\001\330\020\024\220A\330\020\021\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\320\004,\250A\330\010\025\220Z\230q\330\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\3201C\3001\330\020\024\220H\230D\240\001\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\200A\330\010\016\210a\330\010\014\210N\320\032,\250A\250T\260\021\330\014\017\210w\220a\340\024\030\230\n\240!\330\024\036\230m\2501\250E\260\032\2701\330\024$\240J\250a\330\024 \240\n\250!\330\024.\250j\270\001\330\0245\260Z\270q\330\024)\250\032\2601\330\024-\250Z\260q\330\024!\240\032\2501\360\006\000\t\020\210q\200A\360\014\000\n\013\360\006\000\t\017\210f\320\024&\240a\330\010\016\210f\320\024*\250!\330\010\016\210f\320\024&\240a\330\010\017\210t\2208\2304\230r\320!;\2701\270E\300\021\200A\360\n\000./\330\t\n\360\006\000\t\017\210k\230\021\330\010\016\210n\230A\330\010\016\320\016!\240\021\330\010\017\210t\2208\2304\230r\320!;\2701\270E\300\021\200A\330\010\017\210q\200A\330\010\017\210t\2207\230'\240\021\340\010\014\210J\220a\330\010\014\210H\220D\230\002\230&\240\001\200A\360\016\000\n\013\340\010\017\210t\2208\2304\230r\240\034\250Q\330\020B\300!\330\020\021\330&'\330\024!\240\027\250\001\330\024\034\230G\2401\330\024\025\330\024\025\200A\330\010\017\210t\220;\320\036;\2701\200A\330\010\017\210t\220;\320\0361\260\021\200A\330\010\017\210t\220;\320\036.\250a\200\001\330\004\020\220\n\230!\330\004\010\210\014\220A\330\010\022\220&\230\007\230x\240v\250Q\250a\360\006\000\t$\2409\250C\320/J\310!\330\014\024\220K\230q\240\017\250t\2609\270C\270q\340\010\013\2104\210q\330\014\r\330\010\013\2104\210q\330\014\"\240!\330\010\036\230a\330\004""\032\230!\320\004B\300!\200\001\330\004\024\220C\220q\230\001\330\004\007\200t\2107\220%\220q\230\005\230W\240A\330\010\016\210g\220Q\320\026'\240q\340\004,\250K\260~\300Q\330\026\"\240!\240>\260\021\260!\330\004\013\2104\210r\220\037\240\001\320\000\022\220!\330\004\010\210\010\220\001\220\023\220D\230\004\230D\240\004\240D\250\004\250A\330\010\013\2103\210a\210u\220B\220a\330\014\023\2202\220Q\220c\230\026\230q\240\005\240Q\240a\330\010\017\210q\330\004\013\2102\210Q\210c\220\026\220q\230\001\200\001\330\004)\250\033\260G\2701\270A\360\006\000\005\010\200t\320\013\037\230q\320 5\260Q\260a\330\010\016\210j\230\001\230\021\330\004\013\2101\320\004H\310\001\360\006\000\t!\240\004\240G\2501\250A\330\010\016\210h\220a\330\010\017\210t\2208\2304\230r\320!;\2701\270E\300\021\320\004H\310\001\360\006\000\t\017\210i\220q\330\010\017\210t\2208\2304\230r\320!;\2701\270E\300\021\320\004J\310!\360\006\000\t\017\320\016 \240\001\330\010\016\210g\220Q\330\010\017\210t\2208\2304\230r\240\034\250Q\250a\320\004K\3101\360\006\000\t\017\210f\220A\330\010\016\210i\220q\330\010\017\210t\2208\2304\230r\240\034\250Q\250a\220\001\330\024<\270K\320GW\320WX\330\024$\240A\240Q\320\004L\310A\330\010\014\320\014\037\230q\330\010\013\2104\210x\220q\230\017\240}\260A\330\014\022\320\022%\240Q\330\020\021\360\006\000\t3\260+\270^\3101\330\026\"\240!\240>\260\021\260$\260a\340\010$\240I\250T\260\021\340\010)\250\024\250X\260Q\260h\270a\270q\330\0104\3204E\300Q\330\014\r\330\014\022\220!\330\014\034\230D\240\001\360\n\000\t+\250!\340\r\016\330\014\022\320\022%\240R\240q\330\020\"\240!\330\020\026\220f\230K\240q\330\020\023\2204\220\177\240a\330\024!\240\026\320';\2701\330\024\027\220q\330\030\"\240'\250\021\330\024\036\230n\250A\250Q\330\024*\250!\330\024&\240g\250Q\250a\330\025\031\230\037\250\001\330\024+\2501\330\024\027\220t\320\0334\260E\3209M\310R\310s\320RT\320TX\320Xq\320qt\320tu\330\030\031\330\024\036\320\036.\250a\340\024\033\2304\230\177\250a\330\024\033\2304\230\177\250a\330\024\025""\340\010/\320/J\310!\330\010\013\2106\220\021\220$\220a\220z\240\036\250u\260A\330\010\032\230*\320$A\300\021\330\010\017\210u\220A\320\004=\320=M\310Q\200\001\330\004\n\210+\220Q\320\004%\240Q\330\010\025\220Z\230q\330\010\t\330\020#\320#6\260d\270!\330()\340\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\260\033\270A\330\020\024\220H\230D\240\001\330\020\024\220A\330\020\021\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\320\004%\240Q\330\010\025\220Z\230q\330\010\013\210:\220W\230D\240\001\330\014\020\320\020#\2401\240M\260\033\270A\330\020\024\220H\230D\240\001\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\021\340\010\017\210t\320\023&\240a\240q\200\001\330\004\n\210!\330\010\t\360\006\000\t\016\210S\220\001\320\004:\270!\200\001\360\006\000\005\006\330\004\005\340\004.\250k\270\036\300q\330\022\036\230a\230~\250Q\250a\340\004 \240\t\250\024\250Q\340\004\022\220&\230\n\240!\330\004\014\210F\220!\2208\2301\320\034-\250S\260\001\340\004\007\200v\210Q\210o\230]\250!\330\010\016\320\016!\240\021\330\014\r\360\010\000\0051\3200A\300\021\330\010\t\330\010\016\210a\330\010\030\230\001\340\t\n\330\010\t\330\014\036\230a\330\014\022\220&\230\013\2401\330\014\017\210t\220?\240!\330\020\032\230.\250\001\330\024\032\320\032.\250a\330\024\032\320\0324\260A\260V\320;O\310q\340\020\"\240'\250\021\250!\330\021\025\220_\240A\340\021\025\220_\240A\340\021\025\220_\240A\360\006\000\021\030\220t\230?\250!\330\020\027\220t\230?\250!\330\020\021\360\006\000\005\013\210!\2108\2201\320\024'\320'9\270\021\360\006\000\005\025\220J\320\0369\270\021\330\004$\240A\240]\260!\2602\260W\270B\270d\300#\300U\310#\310V\320ST\330\004)\250\032\3203I\310\021\360\006\000\005\020\210}\230M\250\021\340\004\034\230A\330\t\n\210&\220\017\230q\240\014\250I\260S\270\n\300,\310a\330\010\014\320\014\034\230J\320&9\270\021\270!\360\006\000\005\036\230Q\330\t\n\210&\220\017\230q\240\r\250Y\260c\270\032\300=\320PQ\330\010\014\320\014\035\230Z\320';\2701\270A\360""\010\000\005!\240\n\320*=\270Q\330\004\013\2105\220\001\330\010\021\320\021!\240\021\240(\250!\330\010\036\230j\320(9\270\021\330\010\037\230z\320)=\270Q\330\010\036\230a\330\010!\240\021\330\010&\240a\330\010\036\230a\330\010\037\230q\320\004\037\230q\340\010\017\210t\2208\2304\230r\240\035\250a\320\004/\250q\340\010\017\210t\2208\2304\230r\240\036\250q\330\014\r\330%&\330\024\033\2301\230K\240w\250a\250q\330\024\033\2301\230A\330\024\025\330'(\250\003\2501\250J\260c\270\021\270!\330\030\034\230G\2407\250!\2501\360\006\000\021\025\220K\230q\200\001\330\004\007\200v\210T\220\032\2301\330\025*\250!\2504\250q\260\004\260D\270\001\270\021\200\001\330\004\007\200v\210T\220\030\230\021\330\010\036\230a\330\004\013\2101";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 553; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 92) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 553; i < 607; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 607; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 553;
      for (Py_ssize_t i=0; i<54; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        }
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
    double const c_constants[] = {1000.0};
    for (int i = 0; i < 1; i++) {
      numbertab[i] = PyFloat_FromDouble(c_constants[i]);
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 1;
    int8_t const cint_constants_1[] = {0,-1,1,3,5,10,13};
    int16_t const cint_constants_2[] = {1000,2048};
    for (int i = 0; i < 9; i++) {
      numbertab[i] = PyLong_FromLong((i < 7 ? cint_constants_1[i - 0] : cint_constants_2[i - 7]));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<10; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 4;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 2;
    unsigned int nlocals : 5;
    unsigned int flags : 10;
    unsigned int first_line : 11;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 67};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cfunc_to_py, __pyx_mstate->__pyx_n_u_wrap, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 67};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_arg0, __pyx_mstate->__pyx_n_u_arg1};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cfunc_to_py, __pyx_mstate->__pyx_n_u_wrap, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 845};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_guard};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_set_os_name_wrapper, __pyx_mstate->__pyx_kp_b_iso88591_KGWWX_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1158};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_records_to_process, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_leaks, __pyx_mstate->__pyx_n_u_aggregator, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_progress_indicator, __pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_elem, __pyx_mstate->__pyx_n_u_alloc};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_reaggregate_allocations, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1207};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_records_to_process, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_temporary_buffer_size, __pyx_mstate->__pyx_n_u_the_aggregator, __pyx_mstate->__pyx_n_u_aggregator, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_progress_indicator, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_elem, __pyx_mstate->__pyx_n_u_alloc};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_aggregate_allocations, __pyx_mstate->__pyx_kp_b_iso88591_A_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1253};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_max_records};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_high_watermark_allocation_re, __pyx_mstate->__pyx_kp_b_iso88591_B_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1267};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_max_records};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_leaked_allocation_records, __pyx_mstate->__pyx_kp_b_iso88591__12, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1280};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_threshold, __pyx_mstate->__pyx_n_u_max_records};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_temporary_allocation_records, __pyx_mstate->__pyx_kp_b_iso88591_MQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1294};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_records_to_process, __pyx_mstate->__pyx_n_u_progress_indicator, __pyx_mstate->__pyx_n_u_aggregator, __pyx_mstate->__pyx_n_u_allocation, __pyx_mstate->__pyx_n_u_memory_records_seen, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_gen};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_temporal_allocation_records, __pyx_mstate->__pyx_kp_b_iso88591_A_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1391};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_alloc};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_allocation_records, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1419};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_memory_snapshots, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1423};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_included_objects, __pyx_mstate->__pyx_n_u_object_ids, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_tracked_object, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_object_record, __pyx_mstate->__pyx_n_u_obj};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_object_lifetime_events, __pyx_mstate->__pyx_kp_b_iso88591__12, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1649};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_snapshot_allocations, __pyx_mstate->__pyx_n_u_elem, __pyx_mstate->__pyx_n_u_alloc};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_current_snapshot, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1750};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_gen};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_temporal_allocations, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1802};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_gen};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_allocations, __pyx_mstate->__pyx_kp_b_iso88591_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 102};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_level};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_set_log_level, __pyx_mstate->__pyx_kp_b_iso88591_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 151};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_num, __pyx_mstate->__pyx_n_u_suffix, __pyx_mstate->__pyx_n_u_unit};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_size_fmt, __pyx_mstate->__pyx_kp_b_iso88591_D_D_D_A_3auBa_2Qc_q_Qa_q_2Qc_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 348};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_Q_Zq_WD_1M_A_HD_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 360};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_native_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 372};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_hybrid_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 443};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key, __pyx_mstate->__pyx_n_u_event};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_Q_Zq_6d_WD_1M_A_HD_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 459};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key, __pyx_mstate->__pyx_n_u_event};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_native_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_6d_WD_1M1C1_HD_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 475};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_hybrid_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 583};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_Q_Zq_WD_1M_A_HD_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 595};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_native_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 607};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_stacks, __pyx_mstate->__pyx_n_u_cache_key};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_hybrid_stack_trace, __pyx_mstate->__pyx_kp_b_iso88591_A_Zq_WD_1M1C1_HD_A_A_A_A_A_t_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 824};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_writer, __pyx_mstate->__pyx_n_u_attr, __pyx_mstate->__pyx_n_u_orig_set_os_name, __pyx_mstate->__pyx_n_u_set_os_name_wrapper, __pyx_mstate->__pyx_n_u_set_os_name_wrapper};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_Ks_Q_l_1_t9Cq_l_1_T_a_t7_9IQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 868};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_value, __pyx_mstate->__pyx_n_u_exc_traceback, __pyx_mstate->__pyx_n_u_attr};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_A_4q_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 891};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_surviving_objects, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_a_4_3a_a_uAT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 912};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_frame, __pyx_mstate->__pyx_n_u_event, __pyx_mstate->__pyx_n_u_arg};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_start_thread_trace, __pyx_mstate->__pyx_kp_b_iso88591_vT_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 918};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_event, __pyx_mstate->__pyx_n_u_args};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_greenlet_trace_function, __pyx_mstate->__pyx_kp_b_iso88591_vT_1_4q_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 923};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_print_greenlet_warning, __pyx_mstate->__pyx_kp_b_iso88591_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1000};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_1_Kz_IT_1_AT_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1010};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_traceback};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_WAT_4q_t_IQfG1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1138};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_4wgQ_4q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1152};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1155};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_value, __pyx_mstate->__pyx_n_u_exc_traceback};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1342};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_merge_threads, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_records_to_process, __pyx_mstate->__pyx_n_u_progress_indicator, __pyx_mstate->__pyx_n_u_aggregator, __pyx_mstate->__pyx_n_u_allocation, __pyx_mstate->__pyx_n_u_memory_records_seen, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_gen, __pyx_mstate->__pyx_n_u_hwm_by_snapshot};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_temporal_high_water_mark_all, __pyx_mstate->__pyx_kp_b_iso88591_LA_q_4xq_A_Q_3_1_a_IT_XQhaq_44E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 2, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1484};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_file_name, __pyx_mstate->__pyx_n_u_report_progress, __pyx_mstate->__pyx_n_u_num_largest, __pyx_mstate->__pyx_n_u_reader_sp, __pyx_mstate->__pyx_n_u_reader, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_total, __pyx_mstate->__pyx_n_u_aggregator, __pyx_mstate->__pyx_n_u_progress_indicator, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_tmp, __pyx_mstate->__pyx_n_u_allocation_count_by_allocator, __pyx_mstate->__pyx_n_u_allocation_count_by_size, __pyx_mstate->__pyx_n_u_unknown, __pyx_mstate->__pyx_n_u_top_locations_by_size, __pyx_mstate->__pyx_n_u_top_locations_by_count, __pyx_mstate->__pyx_n_u_peak_memory, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_size_and_loc, __pyx_mstate->__pyx_n_u_count_and_loc};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_compute_statistics, __pyx_mstate->__pyx_kp_b_iso88591_k_q_a_Qa_Q_F_81_S_vQo_10A_a_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1565};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_file_name, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_reader_2};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_dump_all_records, __pyx_mstate->__pyx_kp_b_iso88591_Cq_t7_q_WA_gQ_q_K_Q_4r, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1600};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_4wgQ_A_K_Qd_q_Kt84r_1_I_q_A_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1615};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_value, __pyx_mstate->__pyx_n_u_exc_traceback};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_t7_Ja_HD, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1664};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_locations, __pyx_mstate->__pyx_n_u_location, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_is_python_frame_boundary};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_symbolic_support, __pyx_mstate->__pyx_kp_b_iso88591_A_xvQa_9C_J_Kq_t9Cq_4q_4q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1690};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_proc_status, __pyx_mstate->__pyx_n_u_encoded_proc_status, __pyx_mstate->__pyx_n_u_rss_in_bytes};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_rss_from_proc_status_for_testin, __pyx_mstate->__pyx_kp_b_iso88591_G1A_t_q_5Qa_j_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1720};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_address_2, __pyx_mstate->__pyx_n_u_size_2, __pyx_mstate->__pyx_n_u_allocator, __pyx_mstate->__pyx_n_u_native_frame_id, __pyx_mstate->__pyx_n_u_frame_index, __pyx_mstate->__pyx_n_u_native_segment_generation, __pyx_mstate->__pyx_n_u_allocation};
    __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_add_allocation, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_q_Q_q_1_K_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1741};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_capture_snapshot, __pyx_mstate->__pyx_kp_b_iso88591_A_t_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1744};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_high_water_mark_bytes_by_snapsho, __pyx_mstate->__pyx_kp_b_iso88591_A_t_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1747};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_current_heap_size, __pyx_mstate->__pyx_kp_b_iso88591_A_t_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1756};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_allocation};
    __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_allocations, __pyx_mstate->__pyx_kp_b_iso88591_A_a_N_AT_wa_m1E_1_Ja_j_5Zq_1_Zq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[67])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[68] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1778};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_address_2, __pyx_mstate->__pyx_n_u_size_2, __pyx_mstate->__pyx_n_u_allocator, __pyx_mstate->__pyx_n_u_native_frame_id, __pyx_mstate->__pyx_n_u_frame_index, __pyx_mstate->__pyx_n_u_native_segment_generation, __pyx_mstate->__pyx_n_u_allocation};
    __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_add_allocation, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_q_Q_q_1_K_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1799};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_capture_snapshot, __pyx_mstate->__pyx_kp_b_iso88591_A_t_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1845};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_seek_to_start};
    __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_header, __pyx_mstate->__pyx_kp_b_iso88591_2_4t84r_Qa_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[73])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1849};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ms_since_epoch, __pyx_mstate->__pyx_n_u_rss, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[74] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_memory_record, __pyx_mstate->__pyx_kp_b_iso88591_J_gQ_t84r_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1856};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_function_name, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_linetable, __pyx_mstate->__pyx_n_u_firstlineno};
    __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_code_object, __pyx_mstate->__pyx_kp_b_iso88591_A_t84r_Q_B_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1877};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_code_object, __pyx_mstate->__pyx_n_u_addr, __pyx_mstate->__pyx_n_u_size_2, __pyx_mstate->__pyx_n_u_types};
    __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_linetable, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_uA_1A_q_AQ_wd_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1888};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_frame_object, __pyx_mstate->__pyx_n_u_types};
    __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_get_lasti, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_Q_1A_A_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1896};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ip, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_unresolved_native_frame, __pyx_mstate->__pyx_kp_b_iso88591_K1_fA_iq_t84r_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1903};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_address_2, __pyx_mstate->__pyx_n_u_size_2, __pyx_mstate->__pyx_n_u_allocator, __pyx_mstate->__pyx_n_u_native_frame_id, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_allocation_record, __pyx_mstate->__pyx_kp_b_iso88591_A_B_k_ha_m_a_t84r_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[79])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1914};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_code_object_id, __pyx_mstate->__pyx_n_u_instruction_offset, __pyx_mstate->__pyx_n_u_is_entry_frame, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_frame_push, __pyx_mstate->__pyx_kp_b_iso88591_A_f_a_f_f_a_t84r_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1928};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_frame_pop, __pyx_mstate->__pyx_kp_b_iso88591_H_iq_t84r_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1934};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_name_2, __pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_name_bytes};
    __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_thread_record, __pyx_mstate->__pyx_kp_b_iso88591_H_G1A_ha_t84r_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1941};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mappings, __pyx_mstate->__pyx_n_u_mapping, __pyx_mstate->__pyx_n_u_seg};
    __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_mappings, __pyx_mstate->__pyx_kp_b_iso88591_q_t84r_q_1Kwaq_1A_1Jc_G7_1_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1957};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_address_2, __pyx_mstate->__pyx_n_u_is_created, __pyx_mstate->__pyx_n_u_native_frame_id, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_object_record, __pyx_mstate->__pyx_kp_b_iso88591_A_k_nA_t84r_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1971};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_memray__memray_pyx, __pyx_mstate->__pyx_n_u_write_trailer, __pyx_mstate->__pyx_kp_b_iso88591_q_t84r_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_tree_fragment, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[87])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* dict_setdefault (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType (used by FetchCommonType) */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* AddModuleRef (used by FetchSharedCythonModule) */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CythonFunctionShared) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* CallTypeTraverse (used by CythonFunctionShared) */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* PyMethodNew (used by CythonFunctionShared) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall (used by PyObjectCallOneArg) */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectCallOneArg (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by PyVectorcallFastCallDict) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i;
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos;
    #else
    Py_ssize_t pos;
    #endif
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = 0;
    i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(pos);
    #endif
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared (used by CythonFunction) */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
#endif
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
#else
    {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
    {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
#endif
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#endif
#if CYTHON_METH_FASTCALL
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_dict = NULL;
#endif
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func_dict);
#elif PY_VERSION_HEX < 0x030d0000
    _PyObject_ClearManagedDict((PyObject*)m);
#else
    PyObject_ClearManagedDict((PyObject*)m);
#endif
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func_dict);
#else
    {
        int e =
#if PY_VERSION_HEX < 0x030d0000
            _PyObject_VisitManagedDict
#else
            PyObject_VisitManagedDict
#endif
                ((PyObject*)m, visit, arg);
        if (e != 0) return e;
    }
#endif
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    #if PY_VERSION_HEX < 0x030e00A6
    size_t nargs_value = (size_t) nargs;
    #else
    Py_ssize_t nargs_value = nargs;
    #endif
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_DICT |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* PyDictVersioning (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywordsImpl (used by ParseKeywords) */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos = NULL;
    #else
    Py_ssize_t pos = 0;
    #endif
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (
        #if CYTHON_AVOID_BORROWED_REFS
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
        #else
        PyDict_Next(kwds, &pos, &key, NULL)
        #endif
    ) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        #endif
    }
    __Pyx_END_CRITICAL_SECTION();
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(pos);
    #endif
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
#if PY_VERSION_HEX >= 0x030C00A7
    if (likely(__Pyx_PyLong_IsCompact(n))) {
        return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
    }
#else
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
    }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            #if PY_VERSION_HEX >= 0x030C00A7
            ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
            #else
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
            #endif
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
        Py_INCREF(values[i]);
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    CYTHON_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    if (likely(PyFloat_CheckExact(op1))) {
        a = __Pyx_PyFloat_AS_DOUBLE(op1);
        
    } else
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsZero(op1)) {
            a = 0.0;
            
        } else if (__Pyx_PyLong_IsCompact(op1)) {
            a = (double) __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                case 2:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                        a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -2)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                case 3:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                        a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -3)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                case 4:
                    if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                        a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -4)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                default:
        #endif
                    a = PyLong_AsDouble(op1);
                    if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        #if CYTHON_USE_PYLONG_INTERNALS
            }
        }
        #endif
    } else {
        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
    }
        result = a / b;
        return PyFloat_FromDouble(result);
}
#endif

/* SliceObject */
static CYTHON_INLINE int __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) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s",
        obj_type_name, value ? "assignment" : "deletion");
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return -1;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* SliceTupleAndList */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (length <= 0) {
        return PyList_New(0);
    }
    return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(src);
    result = __Pyx_PyList_GetSlice_locked(src, start, stop);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
#endif // CYTHON_COMPILING_IN_CPYTHON

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (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));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (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));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *pos = NULL;
#else
        Py_ssize_t pos = 0;
#endif
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL);
#if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(pos);
#endif
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (size_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(size_t)*3+2];
    char *dpos, *end = digits + sizeof(size_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    size_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (size_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (size_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (size_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyObjectCall2Args (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod1 (used by append) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 0;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) != 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 1;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 1;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (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));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (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));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal != 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a != (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* SliceObject */
static CYTHON_INLINE PyObject* __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) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return NULL;
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* RaiseClosureNameError */
static void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* HasAttr */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op1);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2);
    }
    calculate_long:
        {
            long q, r;
            q = a / b;
            r = a - q*b;
            q -= ((r != 0) & ((r ^ b) < 0));
            return PyLong_FromLong(q);
        }
    calculate_long_long:
        {
            PY_LONG_LONG q, r;
            q = lla / llb;
            r = lla - q*llb;
            q -= ((r != 0) & ((r ^ llb) < 0));
            return PyLong_FromLongLong(q);
        }
    
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    return __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(op1, op2, inplace);
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_MultiplyObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op1);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_multiply(op1, op2);
    }
    calculate_long:
        CYTHON_UNUSED_VAR(a);
        CYTHON_UNUSED_VAR(b);
        lla = a;
        goto calculate_long_long;
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla * llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_MultiplyObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) * (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_MultiplyObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_MultiplyObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_MultiplyObjC(op1, op2, inplace);
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_RemainderObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op1);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
    }
    calculate_long:
        {
            long x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx = lla % llb;
            llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyLong_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_RemainderObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    return __Pyx_Fallback___Pyx_PyLong_RemainderObjC(op1, op2, inplace);
}
#endif

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* ArgTypeTestFunc (used by ArgTypeTest) */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
    int from_annotation_subclass = 0;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (!exact) {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    } else if (exact == 2) {
        if (__Pyx_TypeCheck(obj, type)) {
            from_annotation_subclass = 1;
            extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
        }
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")"
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        "%s%U"
#endif
        , name, type_name, obj_type_name
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        , (from_annotation_subclass ? ". " : ""), extra_info
#endif
        );
#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    if (exact == 2 && from_annotation_subclass) {
        PyObject *res;
        PyObject *vargs[2];
        vargs[0] = PyErr_GetRaisedException();
        vargs[1] = extra_info;
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
        Py_XDECREF(res);
        PyErr_SetRaisedException(vargs[0]);
    }
#endif
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    calculate_long:
        if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                || __Pyx_PyLong_DigitCount(op1) <= 52 / PyLong_SHIFT) {
            return PyFloat_FromDouble((double)a / (double)b);
        }
        return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_TrueDivideObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) / (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_TrueDivideObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(op1, op2, inplace);
}
#endif

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
}

/* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */
static void
__Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) {
    assert (!gen->yieldfrom);
#if CYTHON_USE_AM_SEND
    assert (!gen->yieldfrom_am_send);
    #if PY_VERSION_HEX < 0x030A00F0
    if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND))
    #endif
    {
        __Pyx_pyiter_sendfunc am_send;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
        am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc);
        #else
        __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async;
        am_send = tp_as_async ? tp_as_async->am_send : NULL;
        #endif
        if (likely(am_send)) {
            gen->yieldfrom_am_send = am_send;
        }
    }
#endif
    gen->yieldfrom = yf;
}

/* IterNextPlain (used by CoroutineBase) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* PyObjectCallNoArg (used by CoroutineBase) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* ReturnWithStopIteration (used by CoroutineBase) */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if (PY_VERSION_HEX >= (0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase (used by Generator) */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult delegate_result, result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
    if (delegate_result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (delegate_result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
    Py_XDECREF(ret);
    return result;
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    if (gen->gi_weakreflist != NULL)
    #endif
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_BEGIN_CRITICAL_SECTION(self);
    #endif
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    #if PY_VERSION_HEX >= 0x030d0000
    Py_END_CRITICAL_SECTION();
    #endif
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_weakreflist = NULL;
#endif
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    gen->is_running = 1;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    assert(gen->is_running);
    gen->is_running = 0;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
    PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                         self_type_name);
    __Pyx_DECREF_TypeName(self_type_name);
    return NULL;
}

/* Generator (used by GeneratorYieldFrom) */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* GeneratorYieldFrom */
#if CYTHON_USE_TYPE_SLOTS
static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
    __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
    PyErr_Format(PyExc_TypeError,
        "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
    __Pyx_DECREF_TypeName(source_type_name);
    Py_DECREF(source);
}
#endif
static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
    PyObject *source_gen;
    __Pyx_PySendResult result;
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(source)) {
        Py_INCREF(source);
        source_gen = source;
        result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
    } else
#endif
    {
#if CYTHON_USE_TYPE_SLOTS
        if (likely(Py_TYPE(source)->tp_iter)) {
            source_gen = Py_TYPE(source)->tp_iter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
            if (unlikely(!PyIter_Check(source_gen))) {
                __Pyx_PyIter_CheckErrorAndDecref(source_gen);
                *retval = NULL;
                return PYGEN_ERROR;
            }
        } else
#endif
        {
            source_gen = PyObject_GetIter(source);
            if (unlikely(!source_gen)) {
                *retval = NULL;
                return PYGEN_ERROR;
            }
        }
        *retval = __Pyx_PyIter_Next_Plain(source_gen);
        result = __Pyx_Coroutine_status_from_result(retval);
    }
    if (likely(result == PYGEN_NEXT)) {
        __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
        return PYGEN_NEXT;
    }
    Py_DECREF(source_gen);
    return result;
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* pyfrozenset_new (used by PySetContains) */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
#if CYTHON_COMPILING_IN_LIMITED_API
            || __Pyx_get_runtime_version() >= 0x030A0000
#endif
            )
            return result;
        {
            Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
            if (likely(size > 0))
                return result;
#if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(size < 0)) {
                Py_DECREF(result);
                return NULL;
            }
#endif
        }
        Py_DECREF(result);
#endif
    }
    return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* IterFinish (used by dict_iter) */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallMethod0 (used by dict_iter) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* RaiseNeedMoreValuesToUnpack (used by UnpackTuple2) */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack (used by UnpackItemEndCheck) */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck (used by UnpackTuple2) */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError (used by UnpackTupleError) */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError (used by UnpackTuple2) */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_AVOID_BORROWED_REFS
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_AVOID_BORROWED_REFS
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* pybuiltin_invalid (used by pyint_simplify) */
static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    if (argname) {
        PyErr_Format(PyExc_TypeError,
            "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
            argname, type_name, obj_type_name
        );
    } else {
        PyErr_Format(PyExc_TypeError,
            "Expected %.200s, got " __Pyx_FMT_TYPENAME,
            type_name, obj_type_name
        );
    }
    __Pyx_DECREF_TypeName(obj_type_name);
}

/* pyint_simplify */
static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
    PyObject *number = *number_var;
    if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
        return 0;
    }
    PyObject *int_object;
    if (likely(PyNumber_Check(number))) {
        int_object = PyNumber_Long(number);
        if (unlikely(!int_object)) goto bad;
    } else {
        __Pyx_PyBuiltin_Invalid(number, "int", argname);
        goto bad;
    }
    *number_var = int_object;
    Py_DECREF(number);
    return 0;
bad:
    *number_var = NULL;
    Py_DECREF(number);
    return -1;
}

/* RaiseKeywordRequired */
static void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name) {
    PyErr_Format(PyExc_TypeError,
        "%s() needs keyword-only argument %U", func_name, kw_name);
}

/* ImportImpl (used by Import) */
static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
    PyObject *imported_module = PyImport_GetModule(qualname);
    if (unlikely(!imported_module)) {
        *module = NULL;
        if (PyErr_Occurred()) {
            return -1;
        }
        return 0;
    }
    *module = imported_module;
    return 1;
}
static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
    PyObject *imported_module;
    PyObject *top_level_package_name;
    Py_ssize_t i;
    int status, module_found;
    Py_ssize_t dot_index;
    module_found = __Pyx__Import_GetModule(qualname, &imported_module);
    if (unlikely(!module_found || module_found == -1)) {
        *module = NULL;
        return module_found;
    }
    if (imported_names) {
        for (i = 0; i < len_imported_names; i++) {
            PyObject *imported_name = imported_names[i];
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
            int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
#else
            int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
            if (unlikely(has_imported_attribute == -1)) goto error;
#endif
            if (!has_imported_attribute) {
                goto not_found;
            }
        }
        *module = imported_module;
        return 1;
    }
    dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
    if (dot_index == -1) {
        *module = imported_module;
        return 1;
    }
    if (unlikely(dot_index == -2)) goto error;
    top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
    if (unlikely(!top_level_package_name)) goto error;
    Py_DECREF(imported_module);
    status = __Pyx__Import_GetModule(top_level_package_name, module);
    Py_DECREF(top_level_package_name);
    return status;
error:
    Py_DECREF(imported_module);
    *module = NULL;
    return -1;
not_found:
    Py_DECREF(imported_module);
    *module = NULL;
    return 0;
}
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *from_list = 0;
    int module_found;
    if (!qualname) {
        qualname = name;
    }
    module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
    if (likely(module_found == 1)) {
        return module;
    } else if (unlikely(module_found == -1)) {
        return NULL;
    }
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (imported_names) {
#if CYTHON_COMPILING_IN_CPYTHON
        from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
        if (unlikely(!from_list))
            goto bad;
#else
        from_list = PyList_New(len_imported_names);
        if (unlikely(!from_list)) goto bad;
        for (Py_ssize_t i=0; i<len_imported_names; ++i) {
            if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
        }
#endif
    }
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, moddict, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, moddict, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(from_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* AllocateExtensionType */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
    if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
        allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
        return alloc_func(t, 0);
    } else {
        newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (!tp_new) {
            PyObject *new_str = PyUnicode_FromString("__new__");
            if (likely(new_str)) {
                PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                Py_DECREF(new_str);
                return o;
            } else
                return NULL;
        } else
    #endif
        return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
    }
}

/* ValidateBasesTuple (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* DelItemOnTypeDict (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_DelItem(tp_dict, k);
    if (likely(!result)) PyType_Modified(tp);
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_3);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
            if (likely(reduce_cython)) {
                ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred()) {
        __Pyx_TypeName type_obj_name =
            __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
        PyErr_Format(PyExc_RuntimeError,
            "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
        __Pyx_DECREF_TypeName(type_obj_name);
    }
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_2_4
#define __PYX_HAVE_RT_ImportType_3_2_4
static PyTypeObject *__Pyx_ImportType_3_2_4(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_4 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_4 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_4 && (size_t)basicsize > size) {
        if (PyErr_WarnFormat(NULL, 0,
                "%.200s.%.200s size changed, may indicate binary incompatibility. "
                "Expected %zd from C header, got %zd from PyObject",
                module_name, class_name, size, basicsize) < 0) {
            goto bad;
        }
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__5);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* ListPack */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
    va_list va;
    PyObject *l = PyList_New(n);
    va_start(va, n);
    if (unlikely(!l)) goto end;
    for (Py_ssize_t i=0; i<n; ++i) {
        PyObject *arg = va_arg(va, PyObject*);
        Py_INCREF(arg);
        if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
            Py_CLEAR(l);
            goto end;
        }
    }
    end:
    va_end(va);
    return l;
}

/* GetAttr (used by Globals) */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n)))
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* Globals */
static PyObject* __Pyx_Globals(void) {
    return __Pyx_NewRef(__pyx_mstate_global->__pyx_d);
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* GetNameInClass */
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    PyObject *dict;
    assert(PyType_Check(nmspace));
#if CYTHON_USE_TYPE_SLOTS
    dict = ((PyTypeObject*)nmspace)->tp_dict;
    Py_XINCREF(dict);
#else
    dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict);
#endif
    if (likely(dict)) {
        result = PyObject_GetItem(dict, name);
        Py_DECREF(dict);
        if (result) {
            return result;
        }
    }
    PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}

/* CLineInTraceback (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
#else
PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
    PyObject **dict_ptr = _PyObject_GetDictPtr(o);
    return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
}
#endif
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    PyObject *cython_runtime_dict;
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
    cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, cython_runtime_dict,
            __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
    }
    if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    Py_XDECREF(cython_runtime_dict);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache (used by AddTraceback) */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            code_cache->count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        if (c_line) {
            py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        } else {
            py_funcname = PyUnicode_FromString(funcname);
        }
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_TrackerStats(struct memray::tracking_api::TrackerStats s) {
  PyObject* res;
  PyObject* member;
  res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL;
  member = __Pyx_PyLong_FromSize_t(s.n_allocations); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_n_allocations, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.n_frames); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_n_frames, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_PY_LONG_LONG(s.start_time); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_start_time, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_PY_LONG_LONG(s.end_time); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_end_time, member) < 0)) goto bad;
  Py_DECREF(member);
  return res;
  bad:
  Py_XDECREF(member);
  Py_DECREF(res);
  return NULL;
}
static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_HeaderRecord(struct memray::tracking_api::HeaderRecord s) {
  PyObject* res;
  PyObject* member;
  res = __Pyx_PyDict_NewPresized(11); if (unlikely(!res)) return NULL;
  member = __Pyx_PyLong_From_int(s.version); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_version, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyBool_FromLong(s.native_traces); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_native_traces, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(s.file_format); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_file_format, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_TrackerStats(s.stats); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_stats, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(s.command_line); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_command_line, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_int(s.pid); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_pid, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.main_tid); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_main_tid, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.skipped_frames_on_main_tid); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_skipped_frames_on_main_tid, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_From_int(s.python_allocator); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_python_allocator, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyBool_FromLong(s.trace_python_allocators); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_trace_python_allocators, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyBool_FromLong(s.track_object_lifetimes); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_track_object_lifetimes, member) < 0)) goto bad;
  Py_DECREF(member);
  return res;
  bad:
  Py_XDECREF(member);
  Py_DECREF(res);
  return NULL;
}
static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_MemorySnapshot(struct memray::tracking_api::MemorySnapshot s) {
  PyObject* res;
  PyObject* member;
  res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL;
  member = __Pyx_PyLong_From_uint64_t(s.ms_since_epoch); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_ms_since_epoch, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.rss); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_rss, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.heap); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_heap, member) < 0)) goto bad;
  Py_DECREF(member);
  return res;
  bad:
  Py_XDECREF(member);
  Py_DECREF(res);
  return NULL;
}
static PyObject* __pyx_convert__to_py_struct__memray_3a__3a_tracking_api_3a__3a_Segment(struct memray::tracking_api::Segment s) {
  PyObject* res;
  PyObject* member;
  res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
  member = __Pyx_PyLong_FromSize_t(s.vaddr); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_vaddr, member) < 0)) goto bad;
  Py_DECREF(member);
  member = __Pyx_PyLong_FromSize_t(s.memsz); if (unlikely(!member)) goto bad;
  if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_memsz, member) < 0)) goto bad;
  Py_DECREF(member);
  return res;
  bad:
  Py_XDECREF(member);
  Py_DECREF(res);
  return NULL;
}
/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyLong_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyLong_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                            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]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (size_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(size_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            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])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            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])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(size_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
        } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        size_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (size_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (size_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (size_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (size_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((size_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((size_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (size_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyLong_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (unsigned int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(unsigned int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
        } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_6memray_7_memray_FileFormat __Pyx_PyLong_As_enum____pyx_t_6memray_7_memray_FileFormat(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_FileFormat neg_one = (enum __pyx_t_6memray_7_memray_FileFormat) -1, const_zero = (enum __pyx_t_6memray_7_memray_FileFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        enum __pyx_t_6memray_7_memray_FileFormat val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (enum __pyx_t_6memray_7_memray_FileFormat) -1;
        val = __Pyx_PyLong_As_enum____pyx_t_6memray_7_memray_FileFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) >= 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((((enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) >= 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) >= 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (enum __pyx_t_6memray_7_memray_FileFormat) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_6memray_7_memray_FileFormat, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((enum __pyx_t_6memray_7_memray_FileFormat)-1)*(((((enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) ((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((enum __pyx_t_6memray_7_memray_FileFormat)-1)*(((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) ((((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) (((enum __pyx_t_6memray_7_memray_FileFormat)-1)*(((((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_6memray_7_memray_FileFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_6memray_7_memray_FileFormat) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_6memray_7_memray_FileFormat) ((((((((((enum __pyx_t_6memray_7_memray_FileFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_6memray_7_memray_FileFormat)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_6memray_7_memray_FileFormat, long, PyLong_AsLong(x))
        } else if ((sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_6memray_7_memray_FileFormat, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        enum __pyx_t_6memray_7_memray_FileFormat val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
        val = (enum __pyx_t_6memray_7_memray_FileFormat) -1;
#endif
        if (unlikely(ret))
            return (enum __pyx_t_6memray_7_memray_FileFormat) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_6memray_7_memray_FileFormat");
    return (enum __pyx_t_6memray_7_memray_FileFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_6memray_7_memray_FileFormat");
    return (enum __pyx_t_6memray_7_memray_FileFormat) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_PY_LONG_LONG(PY_LONG_LONG value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(PY_LONG_LONG));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum memray::tracking_api::FileFormat __Pyx_PyLong_As_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum memray::tracking_api::FileFormat neg_one = (enum memray::tracking_api::FileFormat) -1, const_zero = (enum memray::tracking_api::FileFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        enum memray::tracking_api::FileFormat val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (enum memray::tracking_api::FileFormat) -1;
        val = __Pyx_PyLong_As_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) >= 2 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((((enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) >= 3 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((((((enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) >= 4 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((((((((enum memray::tracking_api::FileFormat)digits[3]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (enum memray::tracking_api::FileFormat) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(enum memray::tracking_api::FileFormat) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum memray::tracking_api::FileFormat, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(enum memray::tracking_api::FileFormat) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum memray::tracking_api::FileFormat, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((enum memray::tracking_api::FileFormat)-1)*(((((enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) ((((((enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((enum memray::tracking_api::FileFormat)-1)*(((((((enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) ((((((((enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) (((enum memray::tracking_api::FileFormat)-1)*(((((((((enum memray::tracking_api::FileFormat)digits[3]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum memray::tracking_api::FileFormat) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum memray::tracking_api::FileFormat, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum memray::tracking_api::FileFormat) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum memray::tracking_api::FileFormat) ((((((((((enum memray::tracking_api::FileFormat)digits[3]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[2]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[1]) << PyLong_SHIFT) | (enum memray::tracking_api::FileFormat)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(enum memray::tracking_api::FileFormat) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum memray::tracking_api::FileFormat, long, PyLong_AsLong(x))
        } else if ((sizeof(enum memray::tracking_api::FileFormat) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum memray::tracking_api::FileFormat, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        enum memray::tracking_api::FileFormat val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
        val = (enum memray::tracking_api::FileFormat) -1;
#endif
        if (unlikely(ret))
            return (enum memray::tracking_api::FileFormat) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum memray::tracking_api::FileFormat");
    return (enum memray::tracking_api::FileFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum memray::tracking_api::FileFormat");
    return (enum memray::tracking_api::FileFormat) -1;
}

/* CIntFromPy */
static CYTHON_INLINE memray::tracking_api::thread_id_t __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const memray::tracking_api::thread_id_t neg_one = (memray::tracking_api::thread_id_t) -1, const_zero = (memray::tracking_api::thread_id_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        memray::tracking_api::thread_id_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (memray::tracking_api::thread_id_t) -1;
        val = __Pyx_PyLong_As_memray_3a__3a_tracking_api_3a__3a_thread_id_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) >= 2 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((((memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) >= 3 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((((((memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_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])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) >= 4 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((((((((memray::tracking_api::thread_id_t)digits[3]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (memray::tracking_api::thread_id_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(memray::tracking_api::thread_id_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(memray::tracking_api::thread_id_t, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(memray::tracking_api::thread_id_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(memray::tracking_api::thread_id_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((memray::tracking_api::thread_id_t)-1)*(((((memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) ((((((memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((memray::tracking_api::thread_id_t)-1)*(((((((memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) ((((((((memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_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])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) (((memray::tracking_api::thread_id_t)-1)*(((((((((memray::tracking_api::thread_id_t)digits[3]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(memray::tracking_api::thread_id_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(memray::tracking_api::thread_id_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])))
                        } else if ((8 * sizeof(memray::tracking_api::thread_id_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (memray::tracking_api::thread_id_t) ((((((((((memray::tracking_api::thread_id_t)digits[3]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[2]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[1]) << PyLong_SHIFT) | (memray::tracking_api::thread_id_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(memray::tracking_api::thread_id_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(memray::tracking_api::thread_id_t, long, PyLong_AsLong(x))
        } else if ((sizeof(memray::tracking_api::thread_id_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(memray::tracking_api::thread_id_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        memray::tracking_api::thread_id_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (memray::tracking_api::thread_id_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (memray::tracking_api::thread_id_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (memray::tracking_api::thread_id_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (memray::tracking_api::thread_id_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(memray::tracking_api::thread_id_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((memray::tracking_api::thread_id_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(memray::tracking_api::thread_id_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((memray::tracking_api::thread_id_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((memray::tracking_api::thread_id_t) 1) << (sizeof(memray::tracking_api::thread_id_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (memray::tracking_api::thread_id_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to memray::tracking_api::thread_id_t");
    return (memray::tracking_api::thread_id_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to memray::tracking_api::thread_id_t");
    return (memray::tracking_api::thread_id_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        uint64_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (uint64_t) -1;
        val = __Pyx_PyLong_As_uint64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) {
                            return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) {
                            return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) {
                            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]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (uint64_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(uint64_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
                            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])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
                            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])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(uint64_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
        } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        uint64_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (uint64_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (uint64_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (uint64_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (uint64_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((uint64_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((uint64_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (uint64_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint64_t");
    return (uint64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint64_t");
    return (uint64_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE unsigned char __Pyx_PyLong_As_unsigned_char(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        unsigned char val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (unsigned char) -1;
        val = __Pyx_PyLong_As_unsigned_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT)) {
                            return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT)) {
                            return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT)) {
                            return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (unsigned char) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(unsigned char) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                            return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                            return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) {
                            return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(unsigned char) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x))
        } else if ((sizeof(unsigned char) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        unsigned char val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (unsigned char) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (unsigned char) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (unsigned char) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (unsigned char) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(unsigned char) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((unsigned char) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(unsigned char) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((unsigned char) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((unsigned char) 1) << (sizeof(unsigned char) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (unsigned char) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned char");
    return (unsigned char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned char");
    return (unsigned char) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_char(unsigned char value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned char) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned char));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyLong_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __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])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_unsigned_long(unsigned long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum__memray_3a__3a_tracking_api_3a__3a_FileFormat(enum memray::tracking_api::FileFormat value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum memray::tracking_api::FileFormat neg_one = (enum memray::tracking_api::FileFormat) -1, const_zero = (enum memray::tracking_api::FileFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum memray::tracking_api::FileFormat) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum memray::tracking_api::FileFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum memray::tracking_api::FileFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum memray::tracking_api::FileFormat) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum memray::tracking_api::FileFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum memray::tracking_api::FileFormat),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum memray::tracking_api::FileFormat));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint64_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint64_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_memray_3a__3a_tracking_api_3a__3a_thread_id_t(memray::tracking_api::thread_id_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const memray::tracking_api::thread_id_t neg_one = (memray::tracking_api::thread_id_t) -1, const_zero = (memray::tracking_api::thread_id_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(memray::tracking_api::thread_id_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(memray::tracking_api::thread_id_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(memray::tracking_api::thread_id_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(memray::tracking_api::thread_id_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(memray::tracking_api::thread_id_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(memray::tracking_api::thread_id_t),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(memray::tracking_api::thread_id_t));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_AllocatorType(enum __pyx_t_6memray_7_memray_AllocatorType value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_AllocatorType neg_one = (enum __pyx_t_6memray_7_memray_AllocatorType) -1, const_zero = (enum __pyx_t_6memray_7_memray_AllocatorType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_6memray_7_memray_AllocatorType) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_AllocatorType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_6memray_7_memray_AllocatorType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_6memray_7_memray_AllocatorType) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_AllocatorType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_6memray_7_memray_AllocatorType),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_6memray_7_memray_AllocatorType));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_FileFormat(enum __pyx_t_6memray_7_memray_FileFormat value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_FileFormat neg_one = (enum __pyx_t_6memray_7_memray_FileFormat) -1, const_zero = (enum __pyx_t_6memray_7_memray_FileFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_6memray_7_memray_FileFormat) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_FileFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_6memray_7_memray_FileFormat),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_6memray_7_memray_FileFormat));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_ObjectTrackingEvent(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_ObjectTrackingEvent neg_one = (enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) -1, const_zero = (enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_6memray_7_memray_ObjectTrackingEvent));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_PythonAllocatorType(enum __pyx_t_6memray_7_memray_PythonAllocatorType value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_PythonAllocatorType neg_one = (enum __pyx_t_6memray_7_memray_PythonAllocatorType) -1, const_zero = (enum __pyx_t_6memray_7_memray_PythonAllocatorType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_6memray_7_memray_PythonAllocatorType));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_6memray_7_memray_SymbolicSupport(enum __pyx_t_6memray_7_memray_SymbolicSupport value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_6memray_7_memray_SymbolicSupport neg_one = (enum __pyx_t_6memray_7_memray_SymbolicSupport) -1, const_zero = (enum __pyx_t_6memray_7_memray_SymbolicSupport) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_6memray_7_memray_SymbolicSupport));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
static __Pyx_TypeName
__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
{
    PyObject *module = NULL, *name = NULL, *result = NULL;
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_qualname);
    #else
    name = PyType_GetQualName(tp);
    #endif
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
    module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_module_2);
    if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
    if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
        result = name;
        name = NULL;
        goto done;
    }
    result = PyUnicode_FromFormat("%U.%U", module, name);
    if (unlikely(result == NULL)) goto bad;
  done:
    Py_XDECREF(name);
    Py_XDECREF(module);
    return result;
  bad:
    PyErr_Clear();
    if (name) {
        result = name;
        name = NULL;
    } else {
        result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__11);
    }
    goto done;
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* GetRuntimeVersion */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
void __Pyx_init_runtime_version(void) {
    if (__Pyx_cached_runtime_version == 0) {
        const char* rt_version = Py_GetVersion();
        unsigned long version = 0;
        unsigned long factor = 0x01000000UL;
        unsigned int digit = 0;
        int i = 0;
        while (factor) {
            while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                ++i;
            }
            version += factor * digit;
            if (rt_version[i] != '.')
                break;
            digit = 0;
            factor >>= 8;
            ++i;
        }
        __Pyx_cached_runtime_version = version;
    }
}
#endif
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    return __Pyx_cached_runtime_version;
#endif
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* NewCodeObj */
#if CYTHON_COMPILING_IN_LIMITED_API
    static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                       PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                       PyObject *fv, PyObject *cell, PyObject* fn,
                                       PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
#elif PY_VERSION_HEX >= 0x030B0000
  static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
    if (likely(result))
        result->_co_firsttraceable = 0;
    #endif
    return result;
  }
#elif !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
    Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
    PyObject *varnames_tuple = PyTuple_New(var_count);
    if (unlikely(!varnames_tuple)) return NULL;
    for (Py_ssize_t i=0; i < var_count; i++) {
        Py_INCREF(varnames[i]);
        if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
    }
    #if CYTHON_COMPILING_IN_LIMITED_API
    varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
    if (!varnames_tuple_dedup) {
        if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
        varnames_tuple_dedup = varnames_tuple;
    }
    #else
    varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
    if (unlikely(!varnames_tuple_dedup)) goto done;
    #endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(varnames_tuple_dedup);
    #endif
    if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
        Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(line_table_length == -1)) goto done;
        #endif
        Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
        code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
        if (unlikely(!code_bytes)) goto done;
        char* c_code_bytes = PyBytes_AsString(code_bytes);
        if (unlikely(!c_code_bytes)) goto done;
        memset(c_code_bytes, 0, (size_t) code_len);
    }
    code_obj = (PyObject*) __Pyx__PyCode_New(
        (int) descr.argcount,
        (int) descr.num_posonly_args,
        (int) descr.num_kwonly_args,
        (int) descr.nlocals,
        0,
        (int) descr.flags,
        code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        varnames_tuple_dedup,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        filename,
        funcname,
        (int) descr.first_line,
        (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* DecompressString */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
    PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
    const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
    PyObject *methodname = PyUnicode_FromString("decompress");
    if (unlikely(!methodname)) return NULL;
    #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
    if (algo == 3) {
        PyObject *fromlist = Py_BuildValue("[O]", methodname);
        if (unlikely(!fromlist)) goto bad;
        module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
    } else
    #endif
        module = PyImport_ImportModule(module_name);
    if (unlikely(!module)) goto import_failed;
    decompress = PyObject_GetAttr(module, methodname);
    if (unlikely(!decompress)) goto import_failed;
    {
        #ifdef __cplusplus
            char *memview_bytes = const_cast<char*>(s);
        #else
            #if defined(__clang__)
              #pragma clang diagnostic push
              #pragma clang diagnostic ignored "-Wcast-qual"
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic push
              #pragma GCC diagnostic ignored "-Wcast-qual"
            #endif
            char *memview_bytes = (char*) s;
            #if defined(__clang__)
              #pragma clang diagnostic pop
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic pop
            #endif
        #endif
        #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
        int memview_flags = 0x100;
        #else
        int memview_flags = PyBUF_READ;
        #endif
        compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
    }
    if (unlikely(!compressed_bytes)) {
        Py_DECREF(decompress);
        goto bad;
    }
    decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
    Py_DECREF(compressed_bytes);
    Py_DECREF(decompress);
    Py_DECREF(module);
    Py_DECREF(methodname);
    return decompressed;
import_failed:
    PyErr_Format(PyExc_ImportError,
        "Failed to import '%.20s.decompress' - cannot initialise module strings. "
        "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
        module_name, algo);
bad:
    Py_XDECREF(module);
    Py_DECREF(methodname);
    return NULL;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


/* MultiPhaseInitModuleState */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
#else
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
#endif
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
#error "Module state with PEP489 requires atomics. Currently that's one of\
 C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
#endif
#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#define __Pyx_ModuleStateLookup_Lock()
#define __Pyx_ModuleStateLookup_Unlock()
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <mutex>
static std::mutex __Pyx_ModuleStateLookup_mutex;
#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
#include <threads.h>
static mtx_t __Pyx_ModuleStateLookup_mutex;
static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
    mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
}
#define __Pyx_ModuleStateLookup_Lock()\
  call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  mtx_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(HAVE_PTHREAD_H)
#include <pthread.h>
static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(_WIN32)
#include <Windows.h>  // synchapi.h on its own doesn't work
static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#else
#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
 Requires C standard >= C11, or C++ standard >= C++11,\
 or pthreads, or the Windows 32 API, or Python >= 3.13."
#endif
typedef struct {
    int64_t id;
    PyObject *module;
} __Pyx_InterpreterIdAndModule;
typedef struct {
    char interpreter_id_as_index;
    Py_ssize_t count;
    Py_ssize_t allocated;
    __Pyx_InterpreterIdAndModule table[1];
} __Pyx_ModuleStateLookupData;
#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
#else
static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
#endif
static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
        __Pyx_InterpreterIdAndModule* table,
        Py_ssize_t count,
        int64_t interpreterId) {
    __Pyx_InterpreterIdAndModule* begin = table;
    __Pyx_InterpreterIdAndModule* end = begin + count;
    if (begin->id == interpreterId) {
        return begin;
    }
    while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
        __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
        if (halfway->id == interpreterId) {
            return halfway;
        }
        if (halfway->id < interpreterId) {
            begin = halfway;
        } else {
            end = halfway;
        }
    }
    for (; begin < end; ++begin) {
        if (begin->id >= interpreterId) return begin;
    }
    return begin;
}
static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return NULL;
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
    {
        __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        if (likely(data)) {
            __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
            if (likely(data == new_data)) {
                goto read_finished;
            }
        }
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        __Pyx_ModuleStateLookup_Lock();
        __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
        data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        __Pyx_ModuleStateLookup_Unlock();
    }
  read_finished:;
#else
    __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_InterpreterIdAndModule* found = NULL;
    if (unlikely(!data)) goto end;
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            found = data->table+interpreter_id;
        }
    } else {
        found = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
    }
  end:
    {
        PyObject *result=NULL;
        if (found && found->id == interpreter_id) {
            result = found->module;
        }
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
#endif
        return result;
    }
}
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
    while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
}
#else
#define __Pyx_ModuleStateLookup_wait_until_no_readers()
#endif
static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
    Py_ssize_t to_allocate = (*old_data)->allocated;
    while (to_allocate <= interpreter_id) {
        if (to_allocate == 0) to_allocate = 1;
        else to_allocate *= 2;
    }
    __Pyx_ModuleStateLookupData *new_data = *old_data;
    if (to_allocate != (*old_data)->allocated) {
         new_data = (__Pyx_ModuleStateLookupData *)realloc(
            *old_data,
            sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
        if (!new_data) {
            PyErr_NoMemory();
            return -1;
        }
        for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
            new_data->table[i].id = i;
            new_data->table[i].module = NULL;
        }
        new_data->allocated = to_allocate;
    }
    new_data->table[interpreter_id].module = module;
    if (new_data->count < interpreter_id+1) {
        new_data->count = interpreter_id+1;
    }
    *old_data = new_data;
    return 0;
}
static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
    __Pyx_InterpreterIdAndModule *read = data->table;
    __Pyx_InterpreterIdAndModule *write = data->table;
    __Pyx_InterpreterIdAndModule *end = read + data->count;
    for (; read<end; ++read) {
        if (read->module) {
            write->id = read->id;
            write->module = read->module;
            ++write;
        }
    }
    data->count = write - data->table;
    for (; write<end; ++write) {
        write->id = 0;
        write->module = NULL;
    }
    data->interpreter_id_as_index = 0;
}
static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    int result = 0;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_ModuleStateLookupData *new_data = old_data;
    if (!new_data) {
        new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
        if (!new_data) {
            result = -1;
            PyErr_NoMemory();
            goto end;
        }
        new_data->allocated = 1;
        new_data->interpreter_id_as_index = 1;
    }
    __Pyx_ModuleStateLookup_wait_until_no_readers();
    if (new_data->interpreter_id_as_index) {
        if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
            goto end;
        }
        __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
    }
    {
        Py_ssize_t insert_at = 0;
        {
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                new_data->table, new_data->count, interpreter_id);
            assert(lower_bound);
            insert_at = lower_bound - new_data->table;
            if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                lower_bound->module = module;
                goto end;  // already in table, nothing more to do
            }
        }
        if (new_data->count+1 >= new_data->allocated) {
            Py_ssize_t to_allocate = (new_data->count+1)*2;
            new_data =
                (__Pyx_ModuleStateLookupData*)realloc(
                    new_data,
                    sizeof(__Pyx_ModuleStateLookupData) +
                    (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                result = -1;
                new_data = old_data;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = to_allocate;
        }
        ++new_data->count;
        int64_t last_id = interpreter_id;
        PyObject *last_module = module;
        for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
            int64_t current_id = new_data->table[i].id;
            new_data->table[i].id = last_id;
            last_id = current_id;
            PyObject *current_module = new_data->table[i].module;
            new_data->table[i].module = last_module;
            last_module = current_module;
        }
    }
  end:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
#else
    __Pyx_ModuleStateLookup_data = new_data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return result;
}
static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
#endif
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            data->table[interpreter_id].module = NULL;
        }
        goto done;
    }
    {
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
        if (!lower_bound) goto done;
        if (lower_bound->id != interpreter_id) goto done;
        __Pyx_InterpreterIdAndModule *end = data->table+data->count;
        for (;lower_bound<end-1; ++lower_bound) {
            lower_bound->id = (lower_bound+1)->id;
            lower_bound->module = (lower_bound+1)->module;
        }
    }
    --data->count;
    if (data->count == 0) {
        free(data);
        data = NULL;
    }
  done:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
#else
    __Pyx_ModuleStateLookup_data = data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return 0;
}
#endif

/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
