Commit Graph

116791 Commits

Author SHA1 Message Date
Adam Turner 35d273825a
GH-97950: Allow translation of index directive content (#104000) 2023-05-04 10:11:09 +03:00
Erlend E. Aasland 9885677b04
gh-104146: Remove unused 'second_pass_replacements' from clinic.py (#104147)
The code that manipulated 'second_pass_replacements' was removed in 2015
with commit 0759f84 (gh-67688, bpo-23500).
2023-05-04 00:11:29 +00:00
Yuxin Wu e95dd40aff
pydoc.safeimport: Use importlib.import_module instead of __import__ (GH-103118) 2023-05-03 16:26:39 -07:00
Nikita Sobolev d6e83fbf30
gh-97850: Deprecate `find_loader` and `get_loader` in `pkgutil` (GH-98520)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-03 16:11:54 -07:00
Irit Katriel 9f9e001ab2
gh-103590: mention that the change is included in 3.11.4 and clarify except* documentation (#104095) 2023-05-03 21:55:19 +01:00
Barney Gale da1980afcb
GH-104114: Fix `pathlib.WindowsPath.glob()` use of literal pattern segment case (GH-104116)
We now use `_WildcardSelector` to evaluate literal pattern segments, which
allows us to retrieve the real filesystem case.

This change is necessary in order to implement a *case_sensitive* argument
(see GH-81079) and a *follow_symlinks* argument (see GH-77609).
2023-05-03 17:28:44 +01:00
Paul Ganssle 38dc3f28dd
GH-103944: Remove last use of `utcfromtimestamp` (#103995)
* Remove last use of `utcfromtimestamp`

This was a weirdly valid use of `utcfromtimestamp` in the sense that the "timestamps" in TZif files are not epoch times, but actually something more properly thought of as "number of seconds since 1970 in the local time zone", so even though we didn't want UTC time, `utcfromtimestamp` was still a good way to get the thing we wanted. Since we're deprecating `utcfromtimestamp`, it's just as valid to use `timedelta` arithmetic here.

We may be able to avoid the question entirely by switching these tests over to using `ZoneInfo` in the future.

* Fix a few missing DeprecationWarnings in tests

In one test, we simply turn off DeprecationWarning rather than asserting about it, because whether the error condition happens before or after the warning seems to differ between the Python and C versions.
2023-05-03 11:17:27 -04:00
Tian Gao 0fc58c66ba
gh-103693: Add convenience variable feature to `pdb` (#103694) 2023-05-03 15:04:50 +01:00
Petr Viktorin 524a7f77fd
gh-103968: Deprecate creating heap types whose metaclass has custom tp_new. (GH-103972)
(That's a mouthful of an edge case!)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-03 15:17:14 +02:00
Adam Turner 423d7faeb3
GH-97850: Suppress cross-references to removed ``importlib.util`` functions (#104134)
`importlib.utils` -> `importlib.util` in a few places

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-03 14:13:03 +01:00
Adam Turner 8b03e5ff94
GH-97850: Suppress cross-references to the removed ``module_repr`` method (#104133)
Suppress cross-references to ``module_repr``
2023-05-03 13:57:23 +01:00
Adam Turner 328435ed42
GH-98040: Suppress cross-references to the removed ``imp`` module (#104131)
Suppress cross-references to imp
2023-05-03 13:29:42 +01:00
Barry Warsaw 326997829d
gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)
* Remove deprecated classes from pkgutil
* Remove some other PEP 302 obsolescence
* Use find_spec instead of load_module
* Remove more tests of PEP 302 obsolete APIs
* Remove another bunch of tests using obsolete load_modules()
* Remove deleted names from __all__
* Remove obsolete footnote
* imp is removed
* Remove `imp` from generated stdlib names
* What's new and blurb
* Update zipimport documentation for the removed methods
* Fix some Windows tests
* Remove any test (or part of a test) that references `find_module()`.
* Use assertIsNone() / assertIsNotNone() consistently.
* Update Doc/reference/import.rst
* We don't need pkgutil._get_spec() any more either
*  test.test_importlib.fixtures.NullFinder
* ...BadLoaderFinder.find_module
* ...test_api.InvalidatingNullFinder.find_module
* ...test.test_zipimport test of z.find_module
* Suppress cross-references to find_loader and find_module
* Suppress cross-references to Finder
* Suppress cross-references to pkgutil.ImpImporter and pkgutil.ImpLoader

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-05-03 04:55:22 -07:00
Tian Gao bcea36f8db
gh-103845: Remove line & instruction instrumentations before adding them back (GH-103851) 2023-05-03 10:51:47 +01:00
Paul Ganssle 0a5cd984b2 GH-84976: Re-introduce `datetime.py` and fix reprs
Without the change to the reprs, pure-python classes would have a repr
of `datetime._pydatetime.time`, etc.
2023-05-03 03:09:45 -06:00
Paul Ganssle 65c4a2b326 GH-84976: Move Lib/datetime.py to Lib/_pydatetime
This breaks the tests, but we are keeping it as a separate commit so
that the move operation and editing of the moved files are separate, for
a cleaner history.
2023-05-03 03:09:45 -06:00
Itamar Ostricher 8d34031068
gh-104078: Improve performance of PyObject_HasAttrString (#104079) 2023-05-03 00:20:00 -07:00
Tim Hoffmann fdb3ef8c0f
gh-82012: Deprecate bitwise inversion (~) of bool (#103487)
The bitwise inversion operator on bool returns the bitwise inversion of the
underlying int value; i.e. `~True == -2` such that `bool(~True) == True`.

It's a common pitfall that users mistake `~` as negation operator and actually
want `not`. Supporting `~` is an artifact of bool inheriting from int. Since there
is no real use-case for the current behavior, let's deprecate `~` on bool and
later raise an error. This removes a potential source errors for users.

Full reasoning: https://github.com/python/cpython/issues/82012#issuecomment-1258705971

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-03 00:00:42 -07:00
Hugo van Kemenade 5b05b013ff
gh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` modules (#103457)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-02 23:09:04 -06:00
andrei kulakov af886ffa06
GH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise match (GH-29655)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-03 04:50:10 +01:00
Ethan Furman c7c3a60c88
gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (#104067)
Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-03 03:42:00 +00:00
Eric Snow 292076a9aa
gh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)
We also expose PyInterpreterConfig. This is part of the PEP 684 (per-interpreter GIL) implementation.  We will add docs as soon as we can.

FYI, I'm adding the new config field for per-interpreter GIL in gh-99114.
2023-05-02 21:40:00 -06:00
Eric Snow de64e75616
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)
his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses.  Those three fields are effectively const for builtin static types (unlike tp_subclasses).  In theory we only need to make their values immortal, along with their contents.  However, that isn't such a simple proposition.  (See gh-103823.)  In the meantime the simplest solution is to move the fields into the interpreter.

One alternative is to statically allocate the values, but that's its own can of worms.
2023-05-02 21:30:03 -06:00
Juhi Chandalia 872cbc6132
GH-103963: Make dis display names of args for intrinsics opcodes (#104029) 2023-05-02 19:00:17 -07:00
Barney Gale 65a49c6553
GH-104102: Optimize `pathlib.Path.glob()` handling of `../` pattern segments (GH-104103)
These segments do not require a `stat()` call, as the selector's
`_select_from()` method is called after we've established that the
parent is a directory.
2023-05-02 23:16:04 +00:00
Barney Gale 47770a1e91
GH-104104: Optimize `pathlib.Path.glob()` by avoiding repeated calls to `os.path.normcase()` (GH-104105)
Use `re.IGNORECASE` to implement case-insensitive matching. This
restores behaviour from before GH-31691.
2023-05-02 22:51:18 +01:00
Prince Roshan 1f5384434d
gh-103822: [Calendar] change return value to enum for day and month APIs (GH-103827) 2023-05-02 13:13:31 -07:00
Shantanu 587f2f0180
gh-65022: Fix description of tuple return value in copyreg (#103892) 2023-05-02 11:13:47 -07:00
Barney Gale 8611e7bf5c
GH-103525: Improve exception message from `pathlib.PurePath()` (GH-103526)
Check that arguments are strings before calling `os.path.join()`.

Also improve performance of `PurePath(PurePath(...))` while we're in the
area: we now use the *unnormalized* string path of such arguments.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-05-02 19:08:19 +01:00
Dong-hee Na d81ca7ec02
gh-84436: Add integration C API tests for immortal objects (gh-103962) 2023-05-03 00:05:30 +09:00
Jurica Bradarić 87223f32ab
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-02 13:38:46 +02:00
Mariusz Felisiak f6314b92dc
gh-102997: Update Windows installer to SQLite 3.41.2. (#102999) 2023-05-02 09:37:57 +02:00
Rafael Fontenelle 68ed2a2a3f
GH-103484: Fix redirected permanently URLs (#104001)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2023-05-02 09:34:44 +03:00
Shantanu 82ba6ce303
Improve assert_type phrasing (#104081)
I'd like to make the fact that this does nothing at runtime
really obvious, since I suspect this is unintuitive for users who are
unfamiliar with static type checking.

I thought of this because of
https://discuss.python.org/t/add-arg-check-type-to-types/26384
wherein I'm skeptical that the user really did want `assert_type`.
2023-05-01 23:05:25 -07:00
Mariusz Felisiak f0ad456731
gh-102997: Update macOS installer to SQLite 3.41.2. (GH-102998) 2023-05-02 00:30:43 -04:00
Thomas Grainger 9de0cf20fa
GH-103472: close response in HTTPConnection._tunnel (#103473)
Avoid a potential `ResourceWarning` in `http.client.HTTPConnection`
by closing the proxy / tunnel's CONNECT response explicitly.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-02 03:59:42 +00:00
Terry Jan Reedy 690df4c16c
gh-88496: IDLE - fix another test on macOS (#104075)
Needed for Catalina: test_sidebar add 'idletasks' and skip assert.
2023-05-02 02:53:16 +00:00
Eric Snow f73abf8e03
gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)
This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
2023-05-01 20:34:43 -06:00
Eric Snow fdd878650d
gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072)
Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
2023-05-01 19:36:00 -06:00
Pablo Galindo Salgado b1ca34d4d5
gh-104016: Skip test for deeply neste f-strings on wasi (#104071) 2023-05-01 23:55:41 +00:00
Kirill Podoprigora 605f8785db
gh-104057: Fix direct invocation of test_super (#104064) 2023-05-01 16:14:49 -06:00
Irit Katriel 80b714835d
gh-87092: Expose assembler to unit tests (#103988) 2023-05-01 22:29:30 +01:00
Itamar Ostricher a474e04388
gh-97696: asyncio eager tasks factory (#102853)
Co-authored-by: Jacob Bower <jbower@meta.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-05-01 15:10:13 -06:00
Eric Snow 59bc36aacd
gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (gh-104054)
This also does some cleanup.
2023-05-01 15:08:34 -06:00
Kirill Podoprigora d448fcb032
gh-104057: Fix direct invocation of test_module (GH-104059) 2023-05-01 20:17:47 +00:00
Anže Pečar e665563f83
gh-100458: Clarify Enum.__format__() change of mixed-in types in the whatsnew/3.11.rst (GH-100387)
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-05-01 12:49:54 -07:00
John Belmonte 3ed8c88290
gh-104018: disallow "z" format specifier in %-format of byte strings (GH-104033)
PEP-0682 specified that %-formatting would not support the "z" specifier,
but it was unintentionally allowed for bytes. This PR makes use of the "z"
flag an error for %-formatting in a bytestring.

Issue: #104018

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-05-01 20:47:14 +01:00
jx124 5078eedc5b
gh-104016: Fixed off by 1 error in f string tokenizer (#104047)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-01 19:15:47 +00:00
Franek Magiera 2d526cd32f
GH-103629: Update Unpack's repr in compliance with PEP 692 (#104048) 2023-05-01 17:58:50 +00:00
Irit Katriel a679c3d58d
gh-102799: replace sys.exc_info by sys.exception in inspect and traceback modules (#104032) 2023-05-01 18:19:47 +01:00