Skip to content

Sync email, mock, logging, and console behavior with Python 3.15 - #9079

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix-python314-library-behavior-batch
Oct 12, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix-python314-library-behavior-batch

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Sync email content management, encodings aliases, unittest.mock, logging, tabnanny and the license pager with the pinned official CPython 3.15.0 source d220409a13b77de7a6c30abe16ea90db01528edc.

  • Import individual files through the unchanged scripts/update_lib migrate command.
  • Include the canonical email/logging/tabnanny tests and their logging.config / warnings_helper dependencies.
  • Preserve the existing RustPython logging expectedFailure marker.
  • Remove both PR-added extra_tests snippets as requested in review. The PR diff now contains only 12 Lib files.
  • Rebase onto upstream main c0694d9, which includes the required native binascii wrapping and Windows event-log APIs.

Eleven changed Lib files are byte-identical to the pinned source. test_logging differs only by its pre-existing RustPython expectedFailure marker. No manual Lib edits or compatibility backports are included.

Validation

  • Independent source review verified the migration, retained marker, and bounded test scope. Normal configured commit hooks ran.
  • All 116 canonical email contentmanager tests passed on both the verified official c069 Linux executable with candidate Lib and pinned CPython 3.15.
  • Seventeen focused checks passed on each interpreter before the two snippet removals, with candidate module hashes recorded. Twelve canonical methods were extracted unchanged without importing broad test modules. These checks overlap the email coverage above.
  • The follow-up removes only the two added snippets; all production and canonical test bytes remain unchanged. Their prior non-TTY license and mock-property checks remain validation evidence, but are no longer added to repository CI.

The native executable was built by the official main release workflow, not rebuilt at this PR head. Full workspace/C-API/Clippy suites, broad logging/listener/DNS behavior, interactive/external pagers and Windows behavior were not run locally. Hosted CI must be checked for the exact final head.

AI assistance

OpenAI Codex performed the scripted migration, source review and focused validation. The model identifier is unavailable in this environment. This does not claim completed human validation or readiness to merge.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (12)
  • Lib/_sitebuiltins.py is excluded by !Lib/**
  • Lib/email/contentmanager.py is excluded by !Lib/**
  • Lib/encodings/aliases.py is excluded by !Lib/**
  • Lib/logging/__init__.py is excluded by !Lib/**
  • Lib/logging/config.py is excluded by !Lib/**
  • Lib/logging/handlers.py is excluded by !Lib/**
  • Lib/tabnanny.py is excluded by !Lib/**
  • Lib/test/support/warnings_helper.py is excluded by !Lib/**
  • Lib/test/test_email/test_contentmanager.py is excluded by !Lib/**
  • Lib/test/test_logging.py is excluded by !Lib/**
  • Lib/test/test_tabnanny.py is excluded by !Lib/**
  • Lib/unittest/mock.py is excluded by !Lib/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 53b50c2e-2a41-4176-a0cd-703b23e1f6d1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[ ] lib: cpython/Lib/unittest
[ ] test: cpython/Lib/test/test_unittest (TODO: 1)

dependencies:

  • unittest (native: _io, _log, async_case, builtins, case, loader, main, os.path, result, runner, signals, suite, sys, time, unittest.util, util)
    • _colorize (native: builtins, collections.abc, nt, sys)
    • annotationlib (native: builtins, sys)
    • argparse (native: sys)
    • asyncio (native: _asyncio, _overlapped, _pyrepl.console, _pyrepl.main, _pyrepl.simple_interact, _remote_debugging, _winapi, asyncio.tools, base_events, collections.abc, concurrent.futures, coroutines, errno, events, exceptions, futures, graph, itertools, locks, log, math, msvcrt, protocols, queues, readline, runners, streams, sys, taskgroups, tasks, threads, time, timeouts, transports, unix_events, windows_events)
    • collections (native: _collections, _weakref, itertools, sys)
    • contextlib (native: sys)
    • dataclasses (native: itertools, sys)
    • difflib
    • functools (native: _functools, _thread)
    • inspect (native: _weakref, builtins, collections.abc, importlib.machinery, itertools, sys)
    • io (native: _io, _thread, errno, msvcrt, sys)
    • os (native: nt, os.path, posix, sys)
    • pkgutil (native: importlib.machinery, importlib.util, marshal, os.path, sys)
    • pprint (native: sys)
    • re (native: _casefix, _constants, _sre, sys, unicodedata)
    • threading (native: _collections, _contextvars, _thread, itertools, sys, time)
    • traceback (native: _missing_stdlib_info, _suggestions, collections.abc, importlib.machinery, importlib.resources.readers, importlib.util, itertools, sys, unicodedata)
    • types (native: _types, sys)
    • warnings (native: _contextvars, _thread, _warnings, builtins, sys)
    • weakref (native: _weakref, atexit, gc, itertools, sys)
    • contextvars, fnmatch, logging, signal

dependent tests: (408 tests)

  • unittest: regrtestdata test___all__ test__colorize test__locale test__opcode test__osx_support test_abc test_abstract_numbers test_android test_annotationlib test_apple test_argparse test_array test_asdl_parser test_ast test_asyncgen test_asyncio test_atexit test_audit test_augassign test_base64 test_baseexception test_bdb test_bigaddrspace test_bigmem test_binascii test_binop test_bisect test_bool test_buffer test_bufio test_builtin test_bytes test_bz2 test_c_locale_coercion test_calendar test_call test_charmapcodec test_class test_clinic test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_code_module test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_iso2022 test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_collections test_colorsys test_compare test_compile test_compileall test_complex test_concurrent_futures test_configparser test_contains test_context test_contextlib test_contextlib_async test_copy test_copyreg test_coroutines test_cprofile test_csv test_ctypes test_datetime test_dbm test_dbm_dumb test_dbm_sqlite3 test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_devpoll test_dict test_dictcomps test_dictviews test_difflib test_dis test_doctest test_doctest2 test_docxmlrpc test_dtrace test_dummy_thread test_dummy_threading test_dynamic test_dynamicclassattribute test_eintr test_email test_embed test_ensurepip test_enum test_enumerate test_eof test_epoll test_errno test_except_star test_exception_group test_exception_hierarchy test_exception_variations test_exceptions test_extcall test_external_inspection test_faulthandler test_fcntl test_file test_file_eintr test_filecmp test_fileinput test_fileio test_fileutils test_finalization test_float test_flufl test_fnmatch test_fork1 test_format test_fractions test_frame test_frozen test_fstring test_ftplib test_funcattrs test_functools test_future_stmt test_gc test_generated_cases test_generator_stop test_generators test_genericalias test_genericclass test_genericpath test_genexps test_getopt test_getpass test_gettext test_glob test_global test_grammar test_graphlib test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_html test_htmlparser test_http_cookiejar test_http_cookies test_httplib test_httpservers test_idle test_imaplib test_importlib test_index test_inspect test_int test_int_literal test_io test_ioctl test_ipaddress test_isinstance test_iter test_iterlen test_itertools test_json test_keyword test_keywordonlyarg test_kqueue test_largefile test_launcher test_linecache test_list test_listcomps test_locale test_logging test_long test_longexp test_lzma test_mailbox test_marshal test_math test_math_property test_memoryio test_memoryview test_metaclass test_mimetypes test_minidom test_mmap test_modulefinder test_monitoring test_msvcrt test_multibytecodec test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_named_expressions test_netrc test_ntpath test_nturl2path test_numeric_tower test_opcache test_opcodes test_openpty test_operator test_optimizer test_optparse test_ordered_dict test_os test_osx_env test_pathlib test_patma test_pdb test_peepholer test_peg_generator test_pep646_syntax test_perfmaps test_pickle test_picklebuffer test_pickletools test_pkg test_pkgutil test_platform test_plistlib test_poll test_popen test_poplib test_positional_only_arg test_posix test_posixpath test_pow test_pprint test_print test_profile test_property test_pstats test_pty test_pulldom test_pwd test_py_compile test_pyclbr test_pydoc test_pyexpat test_pyrepl test_queue test_quopri test_raise test_random test_range test_re test_regrtest test_repl test_reprlib test_resource test_richcmp test_rlcompleter test_robotparser test_runpy test_sax test_sched test_scope test_script_helper test_secrets test_select test_selectors test_set test_setcomps test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_smtpnet test_socket test_socketserver test_sort test_sqlite3 test_ssl test_stable_abi_ctypes test_stat test_statistics test_str test_strftime test_string test_string_literals test_stringprep test_strptime test_strtod test_struct test_structseq test_subclassinit test_subprocess test_sundry test_super test_support test_symtable test_syntax test_sys test_sys_setprofile test_sys_settrace test_sysconfig test_syslog test_tabnanny test_tarfile test_tempfile test_termios test_textwrap test_thread test_thread_local_bytecode test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeit test_timeout test_tokenize test_tomllib test_tools test_trace test_traceback test_tracemalloc test_tstring test_tty test_tuple test_turtle test_type_aliases test_type_annotations test_type_cache test_type_comments test_type_params test_typechecks test_types test_typing test_ucn test_unary test_unicode_file test_unicode_file_functions test_unicode_identifiers test_unicodedata test_unittest test_univnewlines test_unpack test_unpack_ex test_unparse test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib_response test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_utf8_mode test_utf8source test_uuid test_venv test_wait3 test_wait4 test_wave test_weakref test_weakset test_webbrowser test_winapi test_winconsoleio test_winreg test_winsound test_with test_wmi test_wsgiref test_xml_dom_minicompat test_xml_dom_xmlbuilder test_xml_etree test_xml_etree_c test_xmlrpc test_xpickle test_xxlimited test_xxtestfuzz test_yield_from test_zipapp test_zipfile test_zipfile64 test_zipimport test_zipimport_support test_zlib test_zoneinfo test_zstd

[ ] lib: cpython/Lib/site.py
[x] lib: cpython/Lib/_sitebuiltins.py
[ ] test: cpython/Lib/test/test_site.py (TODO: 4)

dependencies:

  • site (native: _io, _pyrepl.main, _pyrepl.pager, _pyrepl.readline, _pyrepl.unix_console, _pyrepl.windows_console, atexit, builtins, errno, readline, sitecustomize, sys, usercustomize)
    • _sitebuiltins
    • locale (native: _locale, builtins, encodings.aliases, sys)
    • pydoc (native: _pyrepl.pager, builtins, email.message, http.server, importlib._bootstrap, importlib._bootstrap_external, importlib.machinery, importlib.util, pydoc_data.topics, select, sys, time, urllib.parse)
    • rlcompleter (native: main, atexit, builtins, readline)
    • stat (native: _stat)
    • os, pkgutil, traceback, warnings
    • _sitebuiltins, textwrap

dependent tests: (1 tests)

  • site: test_site

[x] lib: cpython/Lib/tabnanny.py
[x] test: cpython/Lib/test/test_tabnanny.py

dependencies:

  • tabnanny

dependent tests: (1 tests)

  • tabnanny: test_tabnanny

[ ] lib: cpython/Lib/email
[ ] test: cpython/Lib/test/test_email (TODO: 2)

dependencies:

  • email (native: binascii, email._encoded_words, email._parseaddr, email._policybase, email.base64mime, email.charset, email.contentmanager, email.encoders, email.errors, email.feedparser, email.generator, email.headerregistry, email.iterators, email.message, email.mime.base, email.mime.nonmultipart, email.parser, email.policy, email.quoprimime, email.utils, sys, time, urllib.parse)
    • abc (native: _abc)
    • base64 (native: binascii, sys)
    • calendar (native: itertools, sys)
    • copy
    • datetime (native: _datetime, _thread, math, sys, time)
    • random (native: _random, _sha2, itertools, math, time)
    • socket (native: _socket, array, errno, sys)
    • string (native: _string, itertools)
    • urllib (native: _scproxy, email.utils, http.client, http.cookiejar, math, sys, time, unicodedata, urllib.error, urllib.parse, urllib.request, urllib.response, winreg)
    • collections, functools, io, os, re
    • codecs, operator, quopri

dependent tests: (54 tests)

  • email: test_email test_http_cookiejar test_httpservers test_mailbox test_smtplib test_urllib test_urllib2 test_urllib2_localnet test_urllibnet test_zipfile
    • http.client: test_docxmlrpc test_hashlib test_ssl test_ucn test_unicodedata test_wsgiref test_xmlrpc
      • logging.handlers: test_concurrent_futures test_logging test_pkgutil
      • urllib.request: test_pathlib test_pydoc test_sax test_site test_urllib2net
    • http.server: test_robotparser
      • pydoc: test_enum
    • importlib.metadata: test_importlib test_zoneinfo
    • mailbox: test_genericalias
    • pydoc:
      • pdb: test_pdb
    • smtplib: test_smtpnet
    • urllib.request:
      • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_importlib test_json test_launcher test_os test_pathlib test_peg_generator test_pyrepl test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_venv test_winapi test_zipapp test_zipfile test_zstd

[x] lib: cpython/Lib/logging
[x] test: cpython/Lib/test/test_logging.py (TODO: 1)

dependencies:

  • logging

dependent tests: (90 tests)

  • logging: test_asyncio test_concurrent_futures test_decimal test_genericalias test_hashlib test_logging test_pkgutil test_support test_unittest test_urllib2net
    • asyncio.futures: test_asyncio
    • concurrent.futures._base: test_concurrent_futures
    • hashlib: test_hmac test_smtplib test_tarfile test_unicodedata test_urllib2_localnet
      • poplib: test_poplib
      • random: test_asyncio test_bisect test_buffer test_builtin test_bz2 test_collections test_complex test_context test_dbm_dumb test_deque test_descr test_devpoll test_dict test_dummy_thread test_email test_float test_functools test_grp test_heapq test_importlib test_int test_io test_itertools test_long test_lzma test_math test_mmap test_numeric_tower test_ordered_dict test_poll test_posixpath test_pow test_pprint test_pwd test_queue test_random test_regrtest test_richcmp test_selectors test_set test_shutil test_signal test_socket test_sort test_statistics test_strtod test_struct test_sys test_thread test_threading test_tokenize test_traceback test_unparse test_uuid test_weakref test_zipfile test_zlib test_zstd
      • urllib.request: test_http_cookiejar test_pathlib test_pydoc test_sax test_site test_ssl test_urllib test_urllib2 test_urllibnet
      • uuid: test_os
    • multiprocessing.util: test_asyncio test_compileall test_concurrent_futures
    • venv: test_venv

[ ] lib: cpython/Lib/encodings

dependencies:

  • encodings (native: _codecs, _codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr, _codecs_tw, _multibytecodec, _win_cp_codecs, binascii, sys, unicodedata, zlib)
    • stringprep (native: unicodedata)
    • base64, io, re, warnings
    • bz2, codecs, quopri

dependent tests: (160 tests)

  • encodings: test_codecs test_pydoc test_sys
    • codecs: test_charmapcodec test_codeccallbacks test_eof test_exceptions test_importlib test_inspect test_io test_json test_locale test_logging test_multibytecodec test_os test_pdb test_plistlib test_sax test_str
      • json: test_embed test_pyrepl test_subprocess test_sysconfig test_tomllib test_tools test_traceback test_zoneinfo
      • pickle: test_annotationlib test_argparse test_array test_ast test_asyncio test_bool test_builtin test_bytes test_bz2 test_collections test_concurrent_futures test_configparser test_coroutines test_csv test_ctypes test_decimal test_defaultdict test_deque test_descr test_dict test_dictviews test_email test_enum test_enumerate test_fractions test_functools test_generators test_genericalias test_http_cookies test_importlib test_ipaddress test_iter test_itertools test_list test_lzma test_memoryio test_memoryview test_minidom test_opcache test_operator test_ordered_dict test_pathlib test_pickle test_picklebuffer test_pickletools test_platform test_positional_only_arg test_posix test_random test_range test_re test_set test_shelve test_slice test_socket test_statistics test_string test_structseq test_super test_time test_trace test_tuple test_turtle test_type_aliases test_type_params test_types test_typing test_unittest test_uuid test_xml_dom_minicompat test_xml_etree test_xpickle test_zipfile test_zlib test_zoneinfo
      • tokenize: test_linecache test_peg_generator test_tabnanny test_tokenize test_unparse
    • locale: test__locale test_c_locale_coercion test_calendar test_float test_format test_regrtest test_strftime test_strptime test_utf8_mode
      • calendar: test_imaplib
      • gettext: test_gettext
      • site: test_site
      • subprocess: test_android test_asyncio test_atexit test_audit test_cmd_line test_cmd_line_script test_concurrent_futures test_ctypes test_dtrace test_external_inspection test_faulthandler test_file_eintr test_gc test_gzip test_json test_launcher test_msvcrt test_ntpath test_osx_env test_peg_generator test_poll test_py_compile test_pyrepl test_quopri test_repl test_runpy test_script_helper test_select test_shutil test_signal test_sqlite3 test_support test_sys_settrace test_tempfile test_threading test_unittest test_urllib2 test_venv test_wait3 test_webbrowser test_zipfile

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@youknowdot
youknowdot force-pushed the fix-python314-library-behavior-batch branch 2 times, most recently from 1dc15a4 to 3d97ea8 Compare October 11, 2026 15:20
@youknowone youknowone changed the title Restore Python 3.14 email, mock, logging, and console behavior Sync email, mock, logging, and console behavior with Python 3.15 Oct 11, 2026
@codspeed

codspeed Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-python314-library-behavior-batch (3d97ea8) with main (2ab8af3)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (a107443) during the generation of this report, so 2ab8af3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Import exact d220409a13b77de7a6c30abe16ea90db01528edc sources through scripts/update_lib migrate, preserving the existing logging test marker. Retain focused Python license and mock property regressions outside Lib. This later Python-stage change requires native binascii wrapcol support; listener DNS runtime validation remains out of scope.

Assisted-by: OpenAI Codex:model identifier unavailable
@youknowdot
youknowdot force-pushed the fix-python314-library-behavior-batch branch from 3d97ea8 to e220bc4 Compare October 12, 2026 12:13
Comment thread extra_tests/snippets/builtin_license.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do NOT add extra_tests for Lib udpate. lib update must be run by update_lib script

Remove the two PR-added extra_tests snippets as requested in review. Preserve the script-migrated CPython library files and their canonical tests unchanged.

Assisted-by: OpenAI Codex:model identifier unavailable
@youknowone
youknowone marked this pull request as ready for review October 12, 2026 13:16
@youknowone
youknowone enabled auto-merge (squash) October 12, 2026 13:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T13:29:12.411089Z 7f62270 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@youknowone
youknowone disabled auto-merge October 12, 2026 13:17
@youknowone
youknowone merged commit cae11f6 into RustPython:main Oct 12, 2026
21 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f62270b00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Lib/test/test_tabnanny.py
"""Should display usage on no arguments."""
path = findfile('tabnanny.py')
stderr = f"Usage: {path} [-v] file_or_directory ..."
stderr = f"Usage: {sys.executable} -m tabnanny [-v] file_or_directory ..."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Revert the test expectation change

This rewrites the expected stderr of an existing test, but the repository’s test-modification policy explicitly prohibits changing test assertions, logic, or data and permits only adding or removing expectedFailure markers. Keep the existing test expectation rather than updating test data as part of this library sync.

AGENTS.md reference: AGENTS.md:L273-L279

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants