Commit Graph

29491 Commits

Author SHA1 Message Date
Ethan Furman 700ec657c8
gh-103596: [Enum] do not shadow mixed-in methods/attributes (GH-103600)
For example:

    class Book(StrEnum):
        title = auto()
        author = auto()
        desc = auto()

    Book.author.desc is Book.desc

but

    Book.author.title() == 'Author'

is commonly expected.  Using upper-case member names avoids this confusion and possible performance impacts.

Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
2023-04-18 16:19:23 -07:00
Pradyun Gedam ece20dba12
gh-95299: Stop installing setuptools as a part of ensurepip and venv (#101039)
Remove the bundled setuptools wheel from ensurepip, and stop installing setuptools in environments created by venv.

Co-Authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-17 23:43:34 -05:00
Nikita Sobolev b57f55c23e
gh-103449: Fix a bug in dataclass docstring generation (#103454) 2023-04-17 17:33:22 -06:00
AN Long d83faf7f1b
gh-103092: Isolate winreg (#103250) 2023-04-17 12:30:48 -06:00
Giampaolo Rodola ff3303e49c
gh-48330: address review comments to PR-12271 (#103209)
address review comments to PR-12271

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
2023-04-17 00:19:44 +02:00
Nikita Sobolev 4fe1c4b97e
gh-103553: Improve `test_inspect`: add more assertions, remove unused (#103554) 2023-04-15 13:48:31 -07:00
Barney Gale 0097c36e07
GH-103517: Improve tests for `pathlib.Path.walk()` (GH-103518) 2023-04-15 17:35:17 +01:00
chgnrdv 2b6f5c3483
gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (#102115) 2023-04-15 06:53:31 +01:00
Barney Gale 8af8f52d17
GH-78079: Fix UNC device path root normalization in pathlib (GH-102003)
We no longer add a root to device paths such as `//./PhysicalDrive0`,
`//?/BootPartition` and `//./c:` while normalizing. We also avoid adding a
root to incomplete UNC share paths, like `//`, `//a` and `//a/`.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2023-04-14 21:55:41 +01:00
Tian Gao 7c1b0a46c6
gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547) 2023-04-14 21:40:31 +01:00
Nikita Sobolev 7569781176
gh-103406: Modernize pos-only arguments usage in `test_signature` (#103407) 2023-04-14 00:06:31 -07:00
Ethan Furman a6f95941a3
gh-103479: [Enum] require __new__ to be considered a data type (GH-103495)
a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type
2023-04-13 08:31:03 -07:00
Ethan Furman 2194071540
gh-103365: [Enum] STRICT boundary corrections (GH-103494)
STRICT boundary:

- fix bitwise operations
- make default for Flag
2023-04-13 08:24:33 -07:00
Mark Shannon efb8a2553c
GH-103488: Use return-offset, not yield-offset. (GH-103502)
* Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
2023-04-13 16:19:07 +01:00
Stanislav Syekirin 4307feaddc
gh-103088: Fix test_venv error message to avoid bytes/str warning (GH-103500) 2023-04-13 14:17:14 +01:00
Mark Shannon 70e0a28bed
GH-103082: Turn on branch events for FOR_ITER instructions. (#103507)
Turn on branch events for FOR_ITER instructions.
2023-04-13 13:56:09 +01:00
Tomas R 59e0de4903
gh-102978: Fix mock.patch function signatures for class and staticmethod decorators (#103228)
Fixes unittest.mock.patch not enforcing function signatures for methods
decorated with @classmethod or @staticmethod when patch is called with
autospec=True.
2023-04-13 08:37:57 +01:00
Ali-Akber Saifee 19d2639d1e
gh-103462: Ensure SelectorSocketTransport.writelines registers a writer when data is still pending (#103463) 2023-04-13 10:16:52 +05:30
Pradyun Gedam 9e677406ee
gh-95299: Rework test_cppext.py to not invoke setup.py directly (#103316)
* gh-95299: Rework test_cppext.py to not invoke setup.py directly

* Add tests/cppextdata data to `TESTSUBDIRS`

* Revert "Add tests/cppextdata data to `TESTSUBDIRS`"

This reverts commit 635492e539.

* Revert "gh-95299: Rework test_cppext.py to not invoke setup.py directly"

This reverts commit 41c5a667b5.

* Build and install the extension in a temporary directory instead

* Pull in wheels for setuptools and wheel for testing extension builds
2023-04-12 23:17:36 -05:00
Skip Montanaro 330a942b63
gh-67230: add quoting rules to csv module (GH-29469)
Add two quoting styles for csv dialects.
They will help to work with certain databases in particular.

Automerge-Triggered-By: GH:merwok
2023-04-12 15:32:30 -07:00
Stanislav Syekirin 2b6e877767
gh-103088: Fix virtual environment activate script not working in Cygwin (GH-103470) 2023-04-12 21:11:50 +01:00
Mark Shannon 411b169281
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython (GH-103083)
* The majority of the monitoring code is in instrumentation.c

* The new instrumentation bytecodes are in bytecodes.c

* legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
2023-04-12 12:04:55 +01:00
Bar Harel 8f54302ab4
gh-103357: Add logging.Formatter defaults support to logging.config fileConfig and dictConfig (GH-103359) 2023-04-12 08:35:56 +01:00
Barney Gale b57105ae33
GH-103220: Fix `ntpath.join()` of partial UNC drive with trailing slash (GH-103221) 2023-04-11 17:26:45 +01:00
Irit Katriel 55c99d97e1
gh-77757: replace exception wrapping by PEP-678 notes in typeobject's __set_name__ (#103402) 2023-04-11 11:53:06 +01:00
Irit Katriel 78b763f630
gh-103176: sys._current_exceptions() returns mapping to exception instances instead of exc_info tuples (#103177) 2023-04-11 09:38:37 +01:00
Zac Hatfield-Dodds 4cd1cc843a
gh-99553: add tests for ExceptionGroup wrapping (#99615) 2023-04-10 23:44:53 -07:00
Nikita Sobolev a28e2ce3fb
gh-103395: Improve `typing._GenericAlias.__dir__` coverage (#103396) 2023-04-10 12:09:19 +01:00
Barney Gale 2c673d5e93
GH-101362: Omit path anchor from `pathlib.PurePath()._parts` (GH-102476)
Improve performance of path construction by skipping the addition of the path anchor (`drive + root`) to the internal `_parts` list. Rename this attribute to `_tail` for clarity.
2023-04-09 18:40:03 +01:00
Barney Gale 0a675f4bb5
GH-103379: Fix up old tests for `pathlib.PurePath._parse_path` (GH-103380)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-04-09 16:48:45 +01:00
Furkan Onder 8317d51996
Gh-68586: use run_python_until_end in test_capi (GH-102729)
Co-authored-by: Aidin Gharibnavaz

Automerge-Triggered-By: GH:kumaraditya303
2023-04-09 01:44:49 -07:00
JakobDev d9305f8e9d
Fix typos in test_tempfile.py (#102841) 2023-04-09 13:43:40 +05:30
Erlend E. Aasland f329a8bc1e
gh-103092: Isolate `socket` module (#103094) 2023-04-09 06:33:52 +05:30
C.A.M. Gerlach a34c796238
gh-75729: Fix os.spawn tests not handling spaces on Windows (#99150)
* Quote paths in os.spawn tests on Windows so they work with spaces

* Add NEWS entry for os spawn test fix

* Fix code style to avoid double negative in os.spawn tests

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-04-08 10:37:23 +03:00
Russell Keith-Magee 26c65980dc
gh-103329: Add regression test for PropertyMock with side effect (#103358) 2023-04-07 20:09:00 -06:00
sunmy2019 5d7d86f2fd
gh-103272: regression test for getattr exception in property (#103336) 2023-04-07 12:11:11 -07:00
Tian Gao 2667452945
gh-103225: Fixed zero lineno issue for pdb (#103265)
Co-authored-by: Artem Mukhin <ortem00@gmail.com>
2023-04-07 18:57:46 +01:00
Alex Waygood 800382a2b0
gh-74690: Add more tests for runtime-checkable protocols (#103347) 2023-04-07 18:21:19 +01:00
AN Long 4dc339b4d6
GH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-102813) 2023-04-07 12:56:00 +01:00
Nikita Sobolev 995386071f
bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-07 12:43:41 +02:00
Dong-hee Na efb0a2cf3a
gh-103256: Fix hmac algorithm to support fallback implementation (gh-103286)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-07 10:51:29 +09:00
AGZain a653c32d08
gh-93121: fix test_mailbox where some test cases were accidentally dropped (#93242) 2023-04-06 23:19:11 +01:00
Brett Cannon 5d08c3ff7d
GH-102700: allow built-in modules to be submodules (GH-103162) 2023-04-06 14:19:54 -07:00
Ijtaba Hussain 1724553e6e
gh-103186: assert in tests that UnsafeMailcapInput warnings are provided (#103217) 2023-04-06 19:13:33 +01:00
Irit Katriel 52bc2e7b9d
gh-48330: assert warning is emitted on unittest.TestResult with no addDuration (#103309) 2023-04-06 14:05:23 +01:00
Irit Katriel 482b6eeadc
gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293) 2023-04-06 11:08:25 +01:00
Eric Snow 03089fdccc
gh-101659: Add _Py_AtExit() (gh-103298)
The function is like Py_AtExit() but for a single interpreter.  This is a companion to the atexit module's register() function, taking a C callback instead of a Python one.

We also update the _xxinterpchannels module to use _Py_AtExit(), which is the motivating case.  (This is inspired by pain points felt while working on gh-101660.)
2023-04-05 18:42:02 -06:00
Ethan Furman 4ec8dd10bd
gh-93910: [Enum] remove member.member deprecation (GH-103236)
i.e. Color.RED.BLUE is now officially supported.
2023-04-05 17:33:52 -07:00
Brandt Bucher b4978ff872
GH-88691: Shrink the CALL caches (GH-103230) 2023-04-05 14:15:49 -07:00
Irit Katriel 5e7c468fc4
gh-89058: remove skip from test_no_hang_on_context_chain_cycle2 (#102903) 2023-04-05 15:52:38 +01:00