@@ -117,36 +117,36 @@ Here's a simple example that inspects object types in a running Python process:
117117
118118 .. code-block :: python
119119
120- import sys
121- import tempfile
122- import os
123-
124- # Create a temporary script
125- with tempfile.NamedTemporaryFile(mode = ' w' , suffix = ' .py' , delete = False ) as f:
126- script_path = f.name
127- f.write("""
128- import gc
129- import collections
130-
131- # Collect all objects managed by the garbage collector
132- gc.collect()
133-
134- # Count objects by type
135- type_counts = collections.Counter(type(obj).__name__
136- for obj in gc.get_objects())
137-
138- # Print the most common types
139- print("Most common object types in process:")
140- for type_name, count in type_counts.most_common(10):
141- print(f" {type_name} : {count} ")
142- """ )
143-
144- try :
145- # Execute in process with PID 1234
146- print (" Behold! An offering:" )
147- sys.remote_exec(1234 , script_path)
148- finally :
149- os.unlink(script_path)
120+ import sys
121+ import tempfile
122+ import os
123+
124+ # Create a temporary script
125+ with tempfile.NamedTemporaryFile(mode = ' w' , suffix = ' .py' , delete = False ) as f:
126+ script_path = f.name
127+ f.write("""
128+ import gc
129+ import collections
130+
131+ # Collect all objects managed by the garbage collector
132+ gc.collect()
133+
134+ # Count objects by type
135+ type_counts = collections.Counter(type(obj).__name__
136+ for obj in gc.get_objects())
137+
138+ # Print the most common types
139+ print("Most common object types in process:")
140+ for type_name, count in type_counts.most_common(10):
141+ print(f" {type_name} : {count} ")
142+ """ )
143+
144+ try :
145+ # Execute in process with PID 1234
146+ print (" Behold! An offering:" )
147+ sys.remote_exec(1234 , script_path)
148+ finally :
149+ os.unlink(script_path)
150150
151151 The debugging interface has been carefully designed with security in mind and includes several
152152mechanisms to control access:
0 commit comments