Commit Graph

50600 Commits

Author SHA1 Message Date
Carl Meyer e5d5522612
gh-106917: fix super classmethod calls to non-classmethods (#106977) 2023-07-24 13:14:56 -07:00
Tian Gao b383703491
gh-106727: Add `__module__` check for `inspect.getsource(cls)` (#106968) 2023-07-24 13:12:45 -07:00
Erlend E. Aasland 83a2837b32
gh-106368: Increase Argument Clinic CLI test coverage (#107156)
Instead of hacking into the Clinic class, use the Argument Clinic tool
to run the ClinicExternalTest test suite.

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-24 20:49:16 +02:00
Victor Stinner 307186704d
gh-106320: Remove private _PyMem API (#107187)
Move private _PyMem functions to the internal C API (pycore_pymem.h):

* _PyMem_GetCurrentAllocatorName()
* _PyMem_RawStrdup()
* _PyMem_RawWcsdup()
* _PyMem_Strdup()

No longer export these functions.

Move pymem_getallocatorsname() function from _testcapi to _testinternalcapi,
since the API moved to the internal C API.
2023-07-24 18:48:06 +00:00
Guido van Rossum 032f480909
Thoroughly refactor the cases generator (#107151)
This mostly extracts a whole bunch of stuff out of generate_cases.py into separate files, but there are a few other things going on here.

- analysis.py: `Analyzer` etc.
- instructions.py: `Instruction` etc.
- flags.py: `InstructionFlags`, `variable_used`, `variable_used_unspecialized`
- formatting.py: `Formatter` etc.
- Rename parser.py to parsing.py, to avoid conflict with stdlib parser.py
- Blackify most things
- Fix most mypy errors
- Remove output filenames from Generator state, add them to `write_instructions()` etc.
- Fix unit tests
2023-07-24 09:38:23 -07:00
Victor Stinner 0d6dfd68d2
gh-106320: Remove private _PyObject C API (#107147)
Move private debug _PyObject functions to the internal C API
(pycore_object.h):

* _PyDebugAllocatorStats()
* _PyObject_CheckConsistency()
* _PyObject_DebugTypeStats()
* _PyObject_IsFreed()

No longer export most of these functions, except of
_PyObject_IsFreed().

Move test functions using _PyObject_IsFreed() from _testcapi to
_testinternalcapi. check_pyobject_is_freed() test no longer catch
_testcapi.error: the tested function cannot raise _testcapi.error.
2023-07-23 20:09:08 +00:00
Dong-hee Na 0ae4870d09
gh-107122: Add clear method to dbm.ndbm module (gh-107126) 2023-07-23 14:26:23 +00:00
Tomas R b3c34e55c0
gh-62519: Make pgettext search plurals when translation is not found (#107118)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-07-23 16:08:28 +02:00
Dong-hee Na b273837fea
gh-107122: Add clear method to dbm.gdbm.module (gh-107127) 2023-07-23 13:51:12 +00:00
htsedebenham c65592c4d6
gh-106186: Don't report MultipartInvariantViolationDefect for valid multipart emails when parsing header only (#107016) 2023-07-23 12:25:18 +02:00
Gilles Bassière 54632528ee
bpo-18319: gettext() can retrieve a message even if a plural form exists (#19869) 2023-07-23 11:59:19 +02:00
J. Nick Koston 9eeb4b485f
gh-82500: Fix asyncio sendfile overflow on 32bit (#107056) 2023-07-22 21:07:14 -07:00
Guido van Rossum 7fc9be350a
gh-107082: Remove debug hack from get_first_executor in test_capi.test_misc (#107085)
(Even though it doesn't look like it fixes gh-107082 -- see discussion there -- it still removes debug code that should never have been committed.)
2023-07-22 18:22:33 -07:00
J. Nick Koston b7dc795dfd
gh-106527: asyncio: optimize to add/remove readers and writers (#106528) 2023-07-22 21:07:40 +00:00
Jochem Boersma 5e5a34ac3a
gh-107028: tiny textual changes in logging docs and docstrings (GH-107029) 2023-07-22 21:43:18 +01:00
Matthieu Caneill 3782def5a2
gh-65495: Use lowercase `mail from` and `rcpt to` in `smtplib.SMTP` (#107019)
Use lowercase `mail from` and `rcpt to` in `smtplib.SMTP`

SMTP commands are case-insensitive. `smtplib` uses lowercase commands,
however it writes `mail FROM` and `rcpt TO`, lacking consistency.
2023-07-22 16:46:59 +02:00
Bart Skowron 2aba047f0a
gh-69714: Make `calendar` module fully tested (#93655)
There are 3 paths to use `locale` argument in
`calendar.Locale{Text|HTML}Calendar.__init__(..., locale=None)`:
(1) `locale=None` -- denotes the "default locale"[1]
(2) `locale=""` -- denotes the native environment
(3) `locale=other_valid_locale` -- denotes a custom locale

So far case (2) is covered and case (1) is in 78935daf5a (same branch).
This commit adds a remaining case (3).

[1] In the current implementation, this translates into the following
approach:

GET current locale
IF current locale == "C" THEN
  SET current locale TO ""
  GET current locale
ENDIF

* Remove unreachable code (and increase test coverage)

This condition cannot be true. `_locale.setlocale()` from the C module
raises `locale.Error` instead of returning `None` for
`different_locale.__enter__` (where `self.oldlocale` is set).

* Expand the try clause to calls to `LocaleTextCalendar.formatmonthname()`.

This method temporarily changes the current locale to the given locale,
so `_locale.setlocale()` may raise `local.Error`.


Co-authored-by: Rohit Mediratta <rohitm@gmail.com>
Co-authored-by: Jessica McKellar <jesstess@mit.edu>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-07-22 15:20:40 +02:00
Eric Snow adda43dc0b
gh-105699: Add some stress tests for subinterpreter creation (#106966) 2023-07-22 14:21:55 +02:00
Victor Stinner 4a1026d764
gh-106714: Fix test_capi to not write a coredump (#107007)
test_capi: Fix test_no_FatalError_infinite_loop() to no longer write
a coredump, by using test.support.SuppressCrashReport.
2023-07-22 12:17:25 +00:00
Erlend E. Aasland ee5c01b473
gh-106368: Increase coverage for Argument Clinic output directive (#106979) 2023-07-22 09:32:10 +00:00
Erlend E. Aasland 3372bcba98
gh-106970: Fix Argument Clinic 'destination <name> clear' command (#106972)
Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
2023-07-22 09:43:13 +02:00
James Hilton-Balfe cdeb1a6caa
gh-96663: Add a better error message for __dict__-less classes setattr (#103232) 2023-07-21 17:24:26 -07:00
Victor Stinner 41ca164551
gh-106004: Add PyDict_GetItemRef() function (#106005)
* Add PyDict_GetItemRef() and PyDict_GetItemStringRef() functions.
  Add these functions to the stable ABI version 3.13.
* Add unit tests on the PyDict C API in test_capi.
2023-07-21 23:10:51 +02:00
Erlend E. Aasland 8d228cf66f
gh-106368: Increase Argument Clinic test coverage for IndentStack (#106933) 2023-07-21 08:02:39 +02:00
Gregory P. Smith a31dea1feb
gh-106669: Revert "gh-102988: Detect email address parsing errors ... (#105127)" (#106733)
This reverts commit 18dfbd0357.
Adds a regression test from the issue.

See https://github.com/python/cpython/issues/106669.
2023-07-20 20:30:52 -07:00
Irit Katriel 9c81fc2dbe
gh-105481: do not auto-generate pycore_intrinsics.h (#106913) 2023-07-20 17:46:04 +01:00
Brandt Bucher 214a25dd81
GH-104584: Miscellaneous fixes for -Xuops (GH-106908) 2023-07-20 16:35:39 +00:00
Irit Katriel eeff8e7234
gh-102799: use sys.exception() instead of sys.exc_info() in contextlib (#103311)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2023-07-20 14:41:32 +05:30
Pieter Eendebak 832c37d42a
gh-106751: Optimize _PolllikeSelector for many iteration case (gh-106884) 2023-07-20 09:53:11 +09:00
Barney Gale c6c5665ee0
GH-100502: Add `pathlib.PurePath.pathmod` attribute (GH-106533)
This instance attribute stores the implementation of `os.path` used for
low-level path operations: either `posixpath` or `ntpath`.
2023-07-19 18:59:55 +01:00
Yonatan Bitton 70b961ed93
gh-104090: Fix unittest collectedDurations resources leak (#106795) 2023-07-19 12:03:47 +01:00
Dong-hee Na e6f96cf9c6
gh-106751: Optimize SelectSelector.select() for many iteration case (gh-106879) 2023-07-19 15:12:38 +09:00
Dong-hee Na 7513e2e7e4
gh-106751: Optimize KqueueSelector.select() for many iteration case (gh-106864) 2023-07-19 10:18:23 +09:00
Tian Gao 663854d73b
gh-106727: Make `inspect.getsource` smarter for class for same name definitions (#106815) 2023-07-18 23:20:31 +00:00
Irit Katriel 40f3f11a77
gh-105481: Generate the opcode lists in dis from data extracted from bytecodes.c (#106758) 2023-07-18 19:42:44 +01:00
J. Nick Koston aecf6aca51
gh-106751: selectors: optimize EpollSelector.select() (#106754)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2023-07-18 10:16:32 +00:00
Serhiy Storchaka 83ac128490
bpo-42327: C API: Add PyModule_Add() function (GH-23443)
It is a fixed implementation of PyModule_AddObject() which consistently
steals reference both on success and on failure.
2023-07-18 09:42:05 +03:00
Erlend E. Aasland 22379c60ab
gh-106368: Increase Argument Clinic test coverage for cpp.Monitor (#106833) 2023-07-17 20:55:10 +00:00
Guido van Rossum 8e9a1a0322
gh-106603: Make uop struct a triple (opcode, oparg, operand) (#106794) 2023-07-17 12:12:33 -07:00
Mario Corchero 7e96370a94
gh-61215: threadingmock: Improve test suite to avoid race conditions (#106822)
threadingmock: Improve test suite to avoid race conditions

Simplify tests and split them into multiple tests to prevent assertions
from triggering race conditions.
Additionally, we rely on calling the mocks without delay to validate the
functionality of matching calls.
2023-07-17 18:57:40 +00:00
Guido van Rossum b2b261ab2a
gh-106529: Generate uops for POP_JUMP_IF_[NOT_]NONE (#106796)
These aren't automatically translated because (ironically)
they are macros deferring to POP_JUMP_IF_{TRUE,FALSE},
which are not viable uops (being manually translated).

The hack is that we emit IS_NONE and then set opcode and
jump to the POP_JUMP_IF_{TRUE,FALSE} translation code.
2023-07-17 10:06:05 -07:00
Victor Stinner ad95c7253a
gh-106687: _ssl: use uint64_t for SSL options (#106700)
SSL_CTX_get_options() uses uint64_t for options:
https://www.openssl.org/docs/man3.1/man3/SSL_CTX_get_options.html

Fix this compiler warning on Windows with MSC:

    conversion from 'uint64_t' to 'long', possible loss of data
2023-07-17 17:55:30 +02:00
Irit Katriel 5ecedbd266
gh-106789: avoid importing pprint from sysconfig (#106790) 2023-07-17 10:28:33 +01:00
Nikita Sobolev c41320701b
gh-105540: Convert `pytest` tests of `cases_generator` to regular tests (#106713) 2023-07-16 16:05:24 -07:00
Grigoriev Semyon 55408f86d7
gh-105726: Add `__slots__` to `AbstractContextManager` and `AbstractAsyncContextManager` (#106771)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2023-07-16 15:30:39 +00:00
Jason R. Coombs 22980dc7c9
gh-106752: Sync with zipp 3.16.2 (#106757)
* gh-106752: Sync with zipp 3.16.2

* Add blurb
2023-07-15 09:21:17 -04:00
Inada Naoki 2566b74b26
gh-81283: compiler: remove indent from docstring (#106411)
Co-authored-by: Éric <merwok@netwok.org>
2023-07-15 19:33:32 +09:00
Erlend E. Aasland 2d7d1aa4bc
gh-106368: Increase Argument Clinic BlockParser test coverage (#106759) 2023-07-15 11:28:57 +02:00
Guido van Rossum 0db85eeba7
gh-106529: Fix subtle Tier 2 edge case with list iterator (#106756)
The Tier 2 opcode _IS_ITER_EXHAUSTED_LIST (and _TUPLE)
didn't set it->it_seq to NULL, causing a subtle bug
that resulted in test_exhausted_iterator in list_tests.py
to fail when running all tests with -Xuops.

The bug was introduced in gh-106696.

Added this as an explicit test.

Also fixed the dependencies for ceval.o -- it depends on executor_cases.c.h.
2023-07-14 17:22:06 -07:00
Jason R. Coombs 03185f0c15
gh-106752: Move zipfile._path into its own package (#106753)
* gh-106752: Move zipfile._path into its own package so it may have supplementary behavior.

* Add blurb
2023-07-14 20:40:46 +00:00