Skip to content

Commit 5fa5b3a

Browse files
committed
Switch to enum class
Signed-off-by: Iason Krommydas <iason.krom@gmail.com>
1 parent 95bdbb4 commit 5fa5b3a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/memray/_memray.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def set_log_level(int level):
112112
setLogThreshold(level)
113113

114114

115-
cpdef enum AllocatorType:
115+
cpdef enum class AllocatorType:
116116
PYMALLOC_FREE = 1
117117
PYMALLOC_MALLOC = 2
118118
PYMALLOC_CALLOC = 3
@@ -129,21 +129,21 @@ cpdef enum AllocatorType:
129129
MMAP = 14
130130
MUNMAP = 15
131131

132-
# Note: enumerator values are greater than 100 because they must be unique
132+
# Note: enumerator values are negative because they must be unique
133133
# from the enumerator values of the AllocatorType enum above
134-
cpdef enum ObjectTrackingEvent:
135-
OBJECT_CREATED = 101
136-
OBJECT_DESTROYED = 102
134+
cpdef enum class ObjectTrackingEvent:
135+
OBJECT_CREATED = -1
136+
OBJECT_DESTROYED = -2
137137

138-
cpdef enum PythonAllocatorType:
138+
cpdef enum class PythonAllocatorType:
139139
PYTHON_ALLOCATOR_PYMALLOC = 1
140140
PYTHON_ALLOCATOR_PYMALLOC_DEBUG = 2
141141
PYTHON_ALLOCATOR_MALLOC = 3
142142
PYTHON_ALLOCATOR_OTHER = 4
143143
PYTHON_ALLOCATOR_MIMALLOC = 5
144144
PYTHON_ALLOCATOR_MIMALLOC_DEBUG = 6
145145

146-
cpdef enum FileFormat:
146+
cpdef enum class FileFormat:
147147
ALL_ALLOCATIONS = _FileFormat.ALL_ALLOCATIONS
148148
AGGREGATED_ALLOCATIONS = _FileFormat.AGGREGATED_ALLOCATIONS
149149

@@ -1662,7 +1662,7 @@ cdef class SocketReader:
16621662
(<AllocationRecord> alloc)._reader = self._reader
16631663
yield alloc
16641664

1665-
cpdef enum SymbolicSupport:
1665+
cpdef enum class SymbolicSupport:
16661666
NONE = 1
16671667
FUNCTION_NAME_ONLY = 2
16681668
TOTAL = 3

0 commit comments

Comments
 (0)