Skip to content

Commit 2c7a294

Browse files
committed
fix(rc): switch from type to typecode for mp reliability
This switches the shared data for the remote configuration PublisherSubscriberConnector to use a typecode instead of a type that relies on sizeof. This should be more reliable across Python versions and fix an issue with Python3.13: ``` get_mp_context().Array(c_char, SHARED_MEMORY_SIZE, lock=False): TypeError: this type has no size ``` This change should be identical, and for more information, see the docs here: - https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array - https://docs.python.org/3/library/array.html#module-array - https://docs.python.org/3/library/ctypes.html Refs: DEBUG-4453
1 parent ea8e783 commit 2c7a294

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ddtrace/internal/remoteconfig/_connectors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from ctypes import c_char
21
from dataclasses import asdict
32
import json
43
import os
@@ -46,7 +45,7 @@ class PublisherSubscriberConnector:
4645

4746
def __init__(self):
4847
try:
49-
self.data = get_mp_context().Array(c_char, SHARED_MEMORY_SIZE, lock=False)
48+
self.data = get_mp_context().Array("c", SHARED_MEMORY_SIZE, lock=False)
5049
except FileNotFoundError:
5150
log.warning(
5251
"Unable to create shared memory. Features relying on remote configuration will not work as expected."
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
RemoteConfig: Fixes an issue introduced in Python 3.13 where creating a shared
5+
array with the c_char type raised a TypeError, this now uses the 'c' typecode
6+
for better compatibility across versions.

0 commit comments

Comments
 (0)