cpython/Lib
Pablo Galindo Salgado 42b25ad4d3
gh-91048: Refactor and optimize remote debugging module (#134652)
Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-25 20:19:29 +00:00
..
__phello__
_pyrepl GH-130328: Speedup pasting in legacy console on Windows (gh-133728) 2025-05-25 15:17:43 +02:00
asyncio gh-91048: Refactor and optimize remote debugging module (#134652) 2025-05-25 20:19:29 +00:00
collections
compression gh-132983: Style improvements for compression.zstd (#133547) 2025-05-14 12:08:27 +00:00
concurrent gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440) 2025-05-22 06:50:06 -06:00
ctypes gh-131747: ctypes: Deprecate _pack_ implicitly setting _layout_ = 'ms' (GH-133205) 2025-05-05 15:32:06 +02:00
curses gh-133575: eliminate legacy checks in Lib/curses/__init__.py (#133576) 2025-05-07 20:28:32 +02:00
dbm
email gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
encodings gh-62824: Add alias for iso-8859-8-i which is the same as iso-8859-8 (gh-134306) 2025-05-20 15:14:02 +02:00
ensurepip gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
html gh-86155: Fix data loss after unclosed script or style tag in HTMLParser (GH-22658) 2025-05-10 17:36:06 +00:00
http gh-134168: fix http.server CLI support for IPv6 and --directory when serving over HTTPS (#134169) 2025-05-24 12:19:20 +00:00
idlelib gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
importlib
json gh-133346: Make theming support in _colorize extensible (GH-133347) 2025-05-05 23:45:25 +02:00
logging gh-134360 Add processName attribute to logging.Formatter docstring (GH-134371) 2025-05-21 05:49:06 +01:00
multiprocessing gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462) 2025-05-24 03:50:19 +00:00
pathlib GH-128520: pathlib ABCs: add JoinablePath.__vfspath__() (#133437) 2025-05-12 19:00:36 +01:00
pydoc_data Python 3.14.0b1 2025-05-06 18:33:52 +03:00
re gh-133306: Support \z as a synonym for \Z in regular expressions (GH-133314) 2025-05-03 07:54:33 +00:00
site-packages
sqlite3 gh-133447: Add basic color to sqlite3 CLI (#133461) 2025-05-10 07:59:01 +00:00
string gh-134082: modernize string.Formatter class docstring (#134125) 2025-05-18 10:10:54 +02:00
sysconfig gh-133779: Revert Windows generation of pyconfig.h and go back to a static header. (GH-133966) 2025-05-19 11:35:22 +01:00
test gh-91048: Refactor and optimize remote debugging module (#134652) 2025-05-25 20:19:29 +00:00
tkinter gh-130482: Add ability to specify name for tkinter.OptionMenu and tkinter.ttk.OptionMenu (GH-130502) 2025-05-02 14:38:50 +03:00
tomllib gh-133117: Enable stricter mypy checks for tomllib (#133206) 2025-05-03 16:57:09 +03:00
turtledemo
unittest gh-134565: Use ExceptionGroup to handle multiple errors in unittest.doModuleCleanups() (GH-134566) 2025-05-23 21:07:49 +03:00
urllib GH-123599: url2pathname(): don't call gethostbyname() by default (#132610) 2025-05-05 17:03:42 +00:00
venv gh-119535: 3.15 minus π (#134037) 2025-05-15 02:39:42 -07:00
wsgiref gh-133810: remove http.server.CGIHTTPRequestHandler and --cgi flag (#133811) 2025-05-17 09:58:16 +02:00
xml
xmlrpc
zipfile gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) 2025-05-20 18:32:41 -07:00
zoneinfo gh-114713: Revert gh-114731 (#133330) 2025-05-03 07:47:08 +00:00
__future__.py
__hello__.py
_aix_support.py
_android_support.py
_apple_support.py
_ast_unparse.py gh-133581: Improve AST unparsing of t-strings (#133635) 2025-05-08 06:13:57 -07:00
_collections_abc.py
_colorize.py gh-133346: Make theming support in _colorize extensible (GH-133347) 2025-05-05 23:45:25 +02:00
_compat_pickle.py gh-133810: remove http.server.CGIHTTPRequestHandler and --cgi flag (#133811) 2025-05-17 09:58:16 +02:00
_ios_support.py
_markupbase.py
_opcode_metadata.py GH-134282: Always borrow references LOAD_CONST (GH-134284) 2025-05-20 11:24:11 -04:00
_osx_support.py
_py_abc.py
_py_warnings.py gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
_pydatetime.py gh-126883: Add check that timezone fields are in range for datetime.fromisoformat (#127242) 2025-05-19 14:07:11 -04:00
_pydecimal.py gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
_pyio.py gh-62184: Remove _pyio import of _io.FileIO (gh-134192) 2025-05-21 17:29:18 +02:00
_pylong.py
_sitebuiltins.py
_strptime.py gh-122781: Allow empty offset for %z in strptime (#132922) 2025-05-20 16:39:58 +00:00
_threading_local.py gh-107006: Move threading.local docstring to docs (#131840) 2025-05-05 15:00:15 +03:00
_weakrefset.py
abc.py
annotationlib.py gh-133684: Fix get_annotations() where PEP 563 is involved (#133795) 2025-05-25 08:40:58 -07:00
antigravity.py
argparse.py gh-134109: Fix showing comments in pydoc output for argparse (GH-134110) 2025-05-16 23:29:14 +03:00
ast.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
base64.py
bdb.py
bisect.py
bz2.py
calendar.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
cmd.py gh-133363: Fix Cmd completion for lines beginning with ! (#133364) 2025-05-03 22:50:37 -04:00
code.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
codecs.py
codeop.py
colorsys.py
compileall.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
configparser.py
contextlib.py
contextvars.py
copy.py
copyreg.py
cProfile.py
csv.py
dataclasses.py gh-82129: Improve annotations for make_dataclass() (#133406) 2025-05-05 08:21:32 -07:00
datetime.py
decimal.py
difflib.py
dis.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
doctest.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
enum.py
filecmp.py
fileinput.py
fnmatch.py gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338) 2025-05-03 17:58:21 +03:00
fractions.py gh-72902: improve Fraction constructor speed for typical inputs (GH-134320) 2025-05-20 12:47:27 +03:00
ftplib.py
functools.py gh-125028: Prohibit placeholders in partial keywords (GH-126062) 2025-05-08 10:53:53 +03:00
genericpath.py
getopt.py
getpass.py gh-77065: Use putwch instead of putch in getpass.win_getpass (#134058) 2025-05-15 15:14:31 +00:00
gettext.py
glob.py GH-128520: pathlib ABCs: add JoinablePath.__vfspath__() (#133437) 2025-05-12 19:00:36 +01:00
graphlib.py
gzip.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
hashlib.py
heapq.py gh-110067: Make max heap methods public and add missing ones (GH-130725) 2025-05-05 17:52:49 +02:00
hmac.py
imaplib.py
inspect.py gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (#133415) 2025-05-09 18:42:53 -07:00
io.py
ipaddress.py gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841) 2025-05-24 02:57:13 +00:00
keyword.py
linecache.py gh-133253: making linecache thread-safe (#133305) 2025-05-09 12:15:16 +05:30
locale.py
lzma.py
mailbox.py
mimetypes.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
modulefinder.py
netrc.py
ntpath.py gh-76023: Make os.path.realpath to ignore WinError 1005 in non-strict mode (GH-128328) 2025-05-19 09:33:15 +00:00
nturl2path.py
numbers.py
opcode.py
operator.py
optparse.py
os.py
pdb.py gh-134546: ensure remote pdb script is readable (#134552) 2025-05-23 23:07:39 -04:00
pickle.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pickletools.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pkgutil.py
platform.py gh-133604: remove deprecated java_ver function (#133888) 2025-05-16 16:17:54 +02:00
plistlib.py
poplib.py
posixpath.py
pprint.py gh-90117: handle dict and mapping views in pprint (#30135) 2025-05-20 12:30:00 -07:00
profile.py
pstats.py
pty.py
py_compile.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pyclbr.py
pydoc.py gh-125225: Fix column misalignment in help('topics') output (gh-125226) 2025-05-19 16:10:17 +02:00
queue.py
quopri.py
random.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
reprlib.py gh-132493: Avoid eager evaluation of annotations in @reprlib.recursive_repr() (#133411) 2025-05-05 19:20:11 -07:00
rlcompleter.py
runpy.py
sched.py
secrets.py
selectors.py
shelve.py
shlex.py
shutil.py gh-132983: Add the compression.zstd pacakge and tests (#133365) 2025-05-06 01:38:08 +01:00
signal.py
site.py gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380) 2025-05-20 21:47:57 +02:00
smtplib.py
socket.py gh-127840: Revert "gh-127840: pass flags and address from send_fds (GH-127841)" (#134482) 2025-05-22 03:38:44 +00:00
socketserver.py gh-80184: Set getattr(socket, "SOMAXCONN", 5) as the default queue size for TCPServer (GH-134249) 2025-05-19 19:28:09 +00:00
sre_compile.py
sre_constants.py
sre_parse.py
ssl.py gh-133623: Add ssl.HAS_PSK_TLS13 to detect external TLS 1.3 PSK support (#133624) 2025-05-09 09:09:09 +02:00
stat.py
statistics.py
stringprep.py
struct.py
subprocess.py gh-133089: Use original timeout value for TimeoutExpired when the func subprocess.run is called with a timeout (GH-133103) 2025-05-05 01:15:31 +00:00
symtable.py
tabnanny.py
tarfile.py gh-133890: Handle UnicodeEncodeError in tarfile (GH-134147) 2025-05-18 22:21:06 +03:00
tempfile.py gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085) 2025-05-21 10:10:31 -07:00
textwrap.py gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
this.py
threading.py gh-134323: Fix the new threading.RLock.locked method (#134368) 2025-05-22 13:48:24 +00:00
timeit.py
token.py gh-131507: Add support for syntax highlighting in PyREPL (GH-133247) 2025-05-02 20:22:31 +02:00
tokenize.py gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (#134603) 2025-05-25 17:23:38 +01:00
trace.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
traceback.py gh-133346: Make theming support in _colorize extensible (GH-133347) 2025-05-05 23:45:25 +02:00
tracemalloc.py
tty.py
turtle.py
types.py gh-133372: remove out of date todos from types module about generator wrapper (#134563) 2025-05-23 05:19:41 +00:00
typing.py gh-133960: Improve typing.evaluate_forward_ref (#133961) 2025-05-25 17:26:39 +00:00
uuid.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
warnings.py
wave.py gh-133873: remove deprecated mark interface for wave.Wave_{read,write} objects (#133874) 2025-05-15 14:52:07 +00:00
weakref.py
webbrowser.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipapp.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipimport.py