Commit Graph

116892 Commits

Author SHA1 Message Date
Terry Jan Reedy e407661e7a
gh-65772: Clean-up turtle module (#104218)
* Remove the unused, private, and undocumented name `_ver` and
the commented-out `print` call.

* Don't add math functions to `__all__`.  Beginners should learn
to `import math` to access them.

* Gregor Lindel, who wrote this version of turtle, dropped plans
to implement turtle on another toolkit at least a decade ago.
Drop `_dot` code preparing for this, but add a hint comment.

* `_Screen` is meant to be a singleton class.  To enforce that,
it needs either a `__new__` that returns the singleton or
`else...raise` in `__iter__`.  Merely removing the `if` clauses
as suggested might break something if a user were to call `_Screen`
directly.  Leave the code alone until a problem is evident.

* Turtledemo injects into _Screen both _root and _canvas,
configured as it needs them to be.  Making _canvas an `__init__`
option would require skipping some but not all of the lines under
'if _Screen._canvas is None:`.  Leave working code alone.
2023-05-06 11:04:41 -04:00
Nikita Sobolev 6616710731
gh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234) 2023-05-06 20:28:32 +05:30
Adam Turner f5088006ca
GH-97950: Use new-style index directive ('builtin') (#104164)
* Uncomment builtin removal in pairindextypes

* Use new-style index directive ('builtin') - C API

* Use new-style index directive ('builtin') - Extending

* Use new-style index directive ('builtin') - Library

* Use new-style index directive ('builtin') - Reference

* Use new-style index directive ('builtin') - Tutorial
2023-05-06 06:54:08 +03:00
Sam Morris 4cd95dce0b
gh-102215: importlib documentation cleanups 2023-05-06 03:40:19 +01:00
Victor Stinner c84029179c
gh-101819: Prepare to modernize the _io extension (#104178)
* Add references to static types to _PyIO_State:

  * PyBufferedIOBase_Type
  * PyBytesIOBuffer_Type
  * PyIncrementalNewlineDecoder_Type
  * PyRawIOBase_Type
  * PyTextIOBase_Type

* Add the defining class to methods:

  * _io.BytesIO.getbuffer()
  * _io.FileIO.close()

* Add get_io_state_by_cls() function.
* Add state parameter to _textiowrapper_decode()
* _io_TextIOWrapper___init__() now sets self->state before calling
  _textiowrapper_set_decoder().

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-06 01:53:55 +02:00
Jacob Bower 8b7f37dd4c
gh-97696: Remove redundant #include (#104216)
Remove "#include cpython/context.h"` from `_asynciomodule.c`.

It's already included in `Python.h`.
2023-05-05 16:50:06 -07:00
Itamar Ostricher 52d8f36e8c
gh-104144: Skip scheduling a done callback if a TaskGroup task completes eagerly (#104140)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-05 16:44:03 -07:00
Eric Snow f3e7eb48f8
gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)
We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL.

Note that for now we don't actually respect own_gil; all interpreters still share the one GIL.  However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil.  That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.
2023-05-05 15:59:20 -06:00
Erlend E. Aasland 66558d2a16
gh-104146: Remove unused var 'parser_body_declarations' from clinic.py (#104214) 2023-05-05 21:35:24 +00:00
Eric Snow a9c6e0618f
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules.  We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
2023-05-05 21:11:27 +00:00
Eric Snow 1c420e138f
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)
I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.
2023-05-05 14:04:55 -06:00
Eric Snow 55671fe047
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly.  Note that _PyRuntime.ceval.gil is still the actual GIL.
2023-05-05 13:23:00 -06:00
Barney Gale d00d942149
GH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)
Add `pathlib.PurePath.with_segments()`, which creates a path object from arguments. This method is called whenever a derivative path is created, such as from `pathlib.PurePath.parent`. Subclasses may override this method to share information between path objects.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-05 19:04:53 +00:00
Alexey Namyotkin 1afe0e0320
gh-69152: Add _proxy_response_headers attribute to HTTPConnection (#26152)
Add _proxy_response_headers attribute to HTTPConnection (#26152)

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
2023-05-05 18:52:24 +00:00
Tian Gao b979741731
gh-103533: Use PEP 669 APIs for cprofile (GH-103534) 2023-05-05 18:38:47 +01:00
Mark Shannon a0df9ee8fc
GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (GH-96849) 2023-05-05 17:53:07 +01:00
Erlend E. Aasland 45a9e3834a
gh-64595: Argument Clinic: Touch source file if any output file changed (#104152) 2023-05-05 12:38:38 +00:00
Erlend E. Aasland d0b4abedfb
gh-64631: Test exception messages in cloned Argument Clinic funcs (#104167) 2023-05-05 14:08:24 +02:00
Erlend E. Aasland 5245cb64d9
gh-68395: Avoid naming conflicts by mangling variable names in Argument Clinic (#104065)
Add all internally used variable names to CLINIC_PREFIXED_ARGS.
2023-05-05 13:40:18 +02:00
Erlend E. Aasland 721a78395d
gh-64658: Expand Argument Clinic return converter docs (#104175) 2023-05-05 13:32:00 +02:00
Kumar Aditya 2318bedb36
GH-103092: port `_asyncio` freelist to module state (#104196) 2023-05-05 16:42:58 +05:30
Irit Katriel 81fc135f26
gh-104051: fix crash in test_xxtestfuzz with -We (#104052) 2023-05-05 11:34:13 +01:00
sunmy2019 163034515a
gh-104190: fix ubsan crash (#104191) 2023-05-05 15:24:03 +05:30
Dong-hee Na e5b8b19d99
gh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (gh-104129) 2023-05-05 12:27:25 +09:00
Brandt Bucher ce871fdc3a
GH-104142: Fix _Py_RefcntAdd to respect immortality (GH-104143) 2023-05-04 17:00:07 -07:00
Carl Meyer fa86a77589
gh-104112: link from cached_property docs to method-caching FAQ (#104113)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-04 16:38:53 -06:00
Michael Blahay 46361bb843
gh-68968: Correcting message display issue with assertEqual (#103937) 2023-05-04 16:37:17 -06:00
Brandt Bucher 7d35c3121a
GH-103899: Provide a hint when accidentally calling a module (GH-103900) 2023-05-04 15:07:42 -07:00
Carl Meyer f5c38382f9
gh-103963: fix 'make regen-opcode' in out-of-tree builds (#104177) 2023-05-04 17:45:56 +00:00
Hugo van Kemenade d47cddfa27
gh-102500: Add PEP 688 and 698 to the 3.12 release highlights (#104174) 2023-05-04 19:55:48 +03:00
Barney Gale 8100be5535
GH-81079: Add case_sensitive argument to `pathlib.Path.glob()` (GH-102710)
This argument allows case-sensitive matching to be enabled on Windows, and
case-insensitive matching to be enabled on Posix.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2023-05-04 16:44:36 +00:00
Shantanu 09b7695f12
gh-91896: Deprecate collections.abc.ByteString (#102096)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-04 09:39:33 -07:00
Serhiy Storchaka 2ba931ff72
gh-99593: Add tests for Unicode C API (part 2) (#99868)
Add tests for lower-level functions.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-04 15:25:09 +00:00
Jelle Zijlstra b7a0a52196
gh-102500: Document PEP 688 (#102571)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-04 08:23:40 -07:00
Jelle Zijlstra 04f6733275
gh-102500: Implement PEP 688 (#102521)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-05-04 07:59:46 -07:00
Gleb Smirnoff b17d32c114
gh-96534: socketmodule: support FreeBSD divert(4) socket (#96536) 2023-05-04 14:57:05 +00:00
Itamar Ostricher fdcb49c36b
gh-104066: Improve performance of hasattr for module objects (#104063) 2023-05-04 08:50:26 -06:00
Kevin Krakauer c9ecd3ee75
gh-102795: Fix use of poll in test_epoll's test_control_and_wait (#102796)
This test can fail unnecessarily. In the test we wait for events on two
file descriptors. This is done in a single call to select.epoll's poll()
function. However, it is valid for the OS to return only one event via
poll() and the next via a subsequent call to poll(). This rarely
happens, but it can cause the test to fail despite properly functioning
polling.

Instead, we poll a second time when necessary.
2023-05-04 14:38:20 +00:00
Victor Stinner 45398ad512
gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)
This function no longer makes sense, since its runtime parameter is
no longer used. Use directly _PyThreadState_GET() and
_PyInterpreterState_GET() instead.
2023-05-04 16:21:01 +02:00
Pablo Galindo Salgado eba64d2afb
gh-104169: Ensure the tokenizer doesn't overwrite previous errors (#104170) 2023-05-04 15:15:26 +01:00
Christopher Chavez e2ef5015d1
Fix typo "involvin" → "involving" (#104166) 2023-05-04 13:03:52 +00:00
Erlend E. Aasland 4f524da484
gh-103092: Port _ctypes.COMError to heap type (#104020) 2023-05-04 13:03:24 +00:00
Lysandros Nikolaou ef0df5284f
gh-97556: Raise null bytes syntax error upon null in multiline string (GH-104136) 2023-05-04 14:26:23 +02:00
Adam Turner 55d50d147c
GH-97950: Use new-style index directive ('statement') (#104162) 2023-05-04 13:48:45 +03:00
Adam Turner 3e7995ca11
GH-97950: Use new-style index directive ('exception') (#104160) 2023-05-04 13:30:24 +03:00
sunmy2019 83751bbd14
gh-104089: catch DeprecationWarning in `test_fstring` (#104137)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-04 11:20:20 +01:00
Adam Turner 6ab463684b
GH-97950: Use new-style index directive ('object') (#104158)
* Uncomment object removal in pairindextypes

* Use new-style index directive ('object') - C API

* Use new-style index directive ('object') - Library

* Use new-style index directive ('object') - Reference

* Use new-style index directive ('object') - Tutorial
2023-05-04 13:04:41 +03:00
Adam Turner b0ce2db118
GH-97950: Use new-style index directive ('operator') (#104156) 2023-05-04 12:03:11 +03:00
Adam Turner 33ca322c50
GH-97950: Use new-style index directive ('keyword') (#104153)
* Uncomment keyword removal in pairindextypes

* Use new-style index directive ('keyword') - Reference
2023-05-04 10:44:12 +02:00
Adam Turner d0122372f2
GH-97950: Use new-style index directive ('module') (#103996)
* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference

* Use new-style index directive ('module') - Tutorial

* Uncomment module removal in pairindextypes

* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference
2023-05-04 10:17:12 +02:00