Commit graph

27420 commits

Author SHA1 Message Date
Nikita Sobolev aa732459c5
gh-111388: Add show_group parameter to traceback.format_exception_only (#111390) 2023-10-27 11:11:26 +01:00
Łukasz Langa 6d42759c5e
gh-111276: Clarify docs and comments about the role of LC_CTYPE (#111319)
Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0:
https://docs.python.org/2/library/string.html#deprecated-string-functions

Also, fix a comment in logging about locale-specific behavior of `str.lower()`.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-27 11:43:01 +02:00
Raymond Hettinger 7f9a99e854
gh-89519: Remove classmethod descriptor chaining, deprecated since 3.11 (gh-110163) 2023-10-27 00:24:56 -05:00
Nikita Sobolev ee2d22f06d
gh-111343: Fix itertools docs: start arg is optional for count (gh-111344) 2023-10-27 04:30:13 +00:00
Tian Gao 3f84a19e62
Docs: Add restart_events() and positional arg semantics for sys.monitoring (#111291)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-25 18:03:32 +00:00
Khalil Mouawad 14f52e1548
gh-110679: Improved markup in enum.rst (GH-110747) 2023-10-25 10:32:09 -07:00
Erlend E. Aasland 1262e41842
gh-108590: Improve sqlite3 docs on encoding issues and how to handle those (#108699)
Add a guide for how to handle non-UTF-8 text encodings.
Link to that guide from the 'text_factory' docs.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Corvin <corvin@corvin.dev>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-25 15:58:00 +02:00
Hugo van Kemenade 81ed80d843
gh-111187: Postpone removal version for locale.getdefaultlocale() to 3.15 (#111188) 2023-10-25 16:47:41 +03:00
Serhiy Storchaka f6a45a03d0
gh-111165: Move test running code from test.support to libregrtest (GH-111166)
Remove no longer used functions run_unittest() and run_doctest() from
the test.support module.
2023-10-25 12:41:21 +03:00
Pavel Karateev 8b44f3c54b
Fix first parameter name in tool functions from sys.monitoring (#111286) 2023-10-24 21:19:54 +00:00
InSync c0ea67dd0d
GH-111182: Update EnumType.__contains__ docs (GH-111184) 2023-10-24 10:30:13 -07:00
Zachary Ware c7d68f907a
Revert "Fix a code snippet typo in asyncio docs (#108427)" (GH-111271)
This reverts commit 7f31676340.

The change resulted in a tautology and should not have been made.  There
may be an opportunity for additional clarity in this section, but this
change wasn't it :)

Ref: https://github.com/python/cpython/pull/108427#issuecomment-1777525740
2023-10-24 11:09:13 -05:00
InSync 1198076447
gh-111151: Convert monospaced directives to :ref: (#111152) 2023-10-24 08:22:08 -07:00
Serhiy Storchaka b8c20f9049
gh-97928: Change the behavior of tkinter.Text.count() (GH-98484)
It now always returns an integer if one or less counting options are specified.
Previously it could return a single count as a 1-tuple, an integer (only if
option "update" was specified) or None if no items found.
The result is now the same if wantobjects is set to 0.
2023-10-24 12:59:19 +03:00
James Tocknell 6b9babf140
Fix typo in sys docs (#111196)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-24 11:03:35 +03:00
Hugo van Kemenade 96cbd1e1db
gh-101100: Fix Sphinx warnings for fileno (#111118) 2023-10-23 13:05:56 -06:00
Anthony Shaw be551a7d0e
Add a version added note for PY_VECTORCALL_ARGUMENTS_OFFSET (#110963) 2023-10-23 19:00:52 +03:00
Don Patterson 94c2ddfcd7
typo: missing line of output in pull parser example (#111068) 2023-10-23 18:54:29 +03:00
Pablo Martí Gamboa 46cea34d54
Fix typo in 3.13's whatsnew (#111215) 2023-10-23 18:43:08 +03:00
Nick c84b0390c0
gh-110383: Italicize variable name (#111206) 2023-10-23 07:56:36 +00:00
Nick 1172d02f9f
gh-110383: Added explanation about simplest regex use case for quantifiers. (#111110)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-23 10:22:17 +03:00
Hugo van Kemenade b845a9e145
gh-109975: What's new in 3.13: Add module headers to removals and sort (#110994) 2023-10-22 12:45:17 -06:00
Nikita Sobolev 8c689c9b88
gh-101100: Fix sphinx warnings in library/asyncio-dev.rst (GH-111179)
* gh-101100: Fix sphinx warnings in `library/asyncio-dev.rst`

* Update Doc/library/asyncio-eventloop.rst

* Update Doc/library/asyncio-eventloop.rst

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-10-22 17:11:57 +00:00
Maciej Olko 663cf513b0
gh-101100: Fix Sphinx warning in tutorial/introduction.rst (#111173) 2023-10-22 14:53:17 +03:00
Hugo van Kemenade c9c4a87f5d
gh-109975: What's new in 3.13: Add PEP 594 to release highlights (#110993) 2023-10-22 10:17:03 +03:00
Irit Katriel b578e51f02
gh-111123: symtable should visit exception handlers before the else block (#111142) 2023-10-21 13:38:29 +01:00
Gouvernathor b07f23259d
gh-106310 - document the __signature__ attribute (#106311)
Document the __signature__ attribute

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-21 08:54:02 +10:00
Victor Stinner f1e751e933
gh-111089: PyUnicode_AsUTF8AndSize() sets size on error (#111106)
On error, PyUnicode_AsUTF8AndSize() now sets the size argument to -1,
to avoid undefined value.
2023-10-20 20:03:11 +02:00
Victor Stinner d8f32be5b6
gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)
Add PyUnicode_AsUTF8() function to the limited C API.

multiprocessing posixshmem now uses PyUnicode_AsUTF8() instead of
PyUnicode_AsUTF8AndSize(): the extension is built with the limited C
API. The function now raises an exception if the filename contains an
embedded null character instead of truncating silently the filename.
2023-10-20 19:29:27 +02:00
Victor Stinner d731579bfb
gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)
* PyUnicode_AsUTF8() now raises an exception if the string contains
  embedded null characters.
* Update related C API tests (test_capi.test_unicode).
* type_new_set_doc() uses PyUnicode_AsUTF8AndSize() to silently
  truncate doc containing null bytes.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-20 17:59:29 +02:00
Hugo van Kemenade c42c68aa7b
gh-101100: Fix Sphinx warnings in library/tty.rst (#111079)
Fix Sphinx warnings in library/tty.rst
2023-10-20 07:33:17 +03:00
Victor Stinner 8d234cd315
gh-85283: Build posixshmem extension with Limited C API (#111087)
Build the _multiprocessing.posixshmem extension with the Limited C
API.

* Add <errno.h> include.
* Replace PyUnicode_AsUTF8() with PyUnicode_AsUTF8AndSize().
2023-10-20 00:23:49 +02:00
Unique-Usman bcc941bd4a
gh-109510: Clearly explain "Which Docstrings Are Examined" (#109696)
Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-10-19 18:10:06 +03:00
Adam Turner 63acf78d71
GH-101100: Fix reference warnings for `__enter__ and __exit__` (#110112) 2023-10-19 18:05:17 +03:00
Adam Turner da99133710
GH-101100: Fix reference warnings for `__getitem__` (#110118) 2023-10-19 18:05:05 +03:00
Nikita Sobolev d144749914
gh-101100: Fix sphinx warnings in library/getpass.rst (#110461) 2023-10-19 18:04:29 +03:00
Nikita Sobolev a89708aeea
gh-101100: Fix sphinx warnings in library/codecs.rst (#110979) 2023-10-19 17:20:52 +03:00
Tian Gao 1991694117
GH-103082: Clean up the sys.monitoring docs (GH-110532) 2023-10-18 16:15:42 -07:00
Tian Gao d9246c7b73
GH-104232: Fix statement about trace return values (GH-110516) 2023-10-18 13:24:00 -07:00
Tian Gao e6eb8cafca
GH-102895 Add an option local_exit in code.interact to block exit() from terminating the whole process (GH-102896) 2023-10-18 11:36:43 -07:00
Hugo van Kemenade 411d6a638e
gh-109975: What's new in 3.13: longer full support (#110997) 2023-10-17 21:42:28 -07:00
Victor Stinner e7ae43ad7d
Regen Doc/requirements-oldest-sphinx.txt (#111012)
Fix https://github.com/python/cpython/security/dependabot/4: use
urllib3 version 2.0.7.
2023-10-18 07:21:35 +03:00
Victor Stinner 73a003f646
gh-85283: Build _uuid extension with limited C API (#111010) 2023-10-17 23:07:12 +00:00
Victor Stinner 7029c1a1c5
gh-85283: Build _scproxy extension with limited C API (#111008)
* Replace Py_SETREF(v, NULL) with Py_CLEAR(v).
* Reformat the code.
2023-10-17 22:32:53 +00:00
Victor Stinner e37620edfd
gh-85283: Build resource extension with limited C API (#110989)
* Replace PyStructSequence_SET_ITEM() with
  PyStructSequence_SetItem().
* Replace PyTuple_GET_SIZE() with PyTuple_Size().
* Replace PyTuple_GET_ITEM() with PyTuple_GetItem().
2023-10-17 23:52:58 +02:00
Victor Stinner 232465204e
gh-85283: Add PySys_Audit() to the limited C API (#108571)
The PySys_Audit() function was added in Python 3.8 by the PEP 578
"Python Runtime Audit Hooks".

Add also PySys_AuditTuple() to the limited C API, function added
to Python 3.13.

Move non-limited "PerfMap" C API from Include/sysmodule.h to
Include/cpython/sysmodule.h.
2023-10-17 16:02:23 +02:00
Victor Stinner 6db6b30ac2
gh-85283: Build winsound extension with limited C API (#110978)
Replace type->tp_name with PyType_GetQualName().
2023-10-17 15:57:10 +02:00
Matthieu Dartiailh 198aa67d4c
gh-107457: update dis documentation with changes in 3.12 (#108900) 2023-10-17 12:59:34 +00:00
Victor Stinner 4dba0a6d87
gh-85283: Build md5 extension with limited C API (#110967)
* Replace _Py_strhex() with few lines of code.
* Replace _PyType_GetModuleState() with PyType_GetModuleState().
* Fix make check-c-globals.
2023-10-17 10:57:41 +00:00
Victor Stinner 37bd8726b8
gh-85283: Build errno and _ctypes_test with limited C API (#110955)
_testimportmultiple is now built with limited C API version 3.2.
2023-10-17 01:05:20 +00:00
Victor Stinner cc71cc9256
gh-85283: Add PyMem_RawMalloc() to the limited C API (#108570)
Add PyMem_RawMalloc(), PyMem_RawCalloc(), PyMem_RawRealloc() and
PyMem_RawFree() to the limited C API.

These functions were added by Python 3.4 and are needed to port
stdlib extensions to the limited C API, like grp and pwd.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-17 02:41:51 +02:00
Victor Stinner cf9c25c719
gh-85283: Build _testimportmultiple with limited C API (#110954) 2023-10-17 02:27:15 +02:00
Mienxiu f07ca27709
C-API docs: Clarify the size of arenas (#110895)
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
2023-10-16 19:52:13 +01:00
Nikita Sobolev bfc1cd8145
gh-110527: Improve PySet_Clear docs (#110528) 2023-10-16 15:05:09 +02:00
Karolina Surma db656aebc6
sysconfig docs: fix broken link to the source code (#110920)
It's now a package. See: 4a53a397c3
2023-10-16 12:27:12 +01:00
partev 42a5d21d46
gh-110886 Doc: add a link to BNF Wikipedia article (#110887)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-15 10:52:13 -06:00
Łukasz Langa 84b7e9e3fa
gh-110722: Add PYTHON_PRESITE to import a module before site.py is run (#110769) 2023-10-14 23:32:57 +02:00
Nikita Sobolev 12deda7633
gh-101100: Fix sphinx warnings in library/time.rst (#110862) 2023-10-14 16:20:19 +02:00
Serhiy Storchaka 38bd2c520a
gh-88434: Emit deprecation warnings for non-integer numbers in gettext if translation not found (GH-110574) 2023-10-14 09:07:02 +03:00
Nikita Sobolev 45cfabb842
gh-101100: Fix sphinx warnings in usage/cmdline.rst (#110841) 2023-10-14 08:05:46 +02:00
Serhiy Storchaka 7284e0ef84
gh-110815: Support non-ASCII keyword names in PyArg_ParseTupleAndKeywords() (GH-110816)
It already mostly worked, except in the case when invalid keyword
argument with non-ASCII name was passed to function with non-ASCII
parameter names. Then it crashed in the debug mode.
2023-10-14 08:50:03 +03:00
paskozdilar f81e36f700
gh-110703: Add asyncio.wait_for() change notes for 3.11 (GH-110818)
* Remove redundant versionchanged

* Add missing versionchanged

* Update Doc/library/asyncio-task.rst

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2023-10-13 15:15:28 +02:00
Petr Viktorin 2ab34f0e42
gh-110803: Reorganize docs for what PyType_Slot doesn't cover (GH-110813)
* gh-110803: Reorganize docs for what PyType_Slot doesn't cover

- Cover the offset fields first
- Mention the old alternative for MANAGED flags, which is needed
  to support older Pythons
- De-emphasize the internal flags: use an inline list.
- Add a note to PyMemberDef saying what to do with it

* Remove an older draft...
2023-10-13 14:51:48 +02:00
T. Wouters b7f9661bc1
Fix the pyspecific SOURCE_URI (#110811) 2023-10-13 08:43:01 +00:00
InSync 2c472a87c7
Remove unnecessary escape in Doc/library/enum.rst (GH-110780) 2023-10-12 15:04:36 -07:00
Thomas Grainger 8c6c14b91b
gh-94597: Add asyncio.EventLoop (#110723)
This is needed to pave the way for deprecating and eventually killing the event loop policy system (which is over-engineered and rarely used).
2023-10-12 07:13:57 -07:00
Victor Stinner 88ecb190f3
gh-85283: _stat extension now uses the limited C API (#110711)
gh-85283: _stat extension uses the limited C API

The _stat C extension is now built with the limited C API.
2023-10-12 00:06:20 +02:00
Ezio Melotti 41d8ec5a1b
gh-110631: Fix reST indentation in Doc/reference (#110708)
Fix wrong indentation in the Doc/reference dir.
2023-10-11 22:50:55 +02:00
Victor Stinner 6f4a49942b
gh-85283: If Py_LIMITED_API is defined, undefine Py_BUILD_CORE (#110725)
If the Py_LIMITED_API macro is defined, Py_BUILD_CORE,
Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros are now
undefined by Python.h.

Only undefine these 3 macros after including "exports.h" which uses
them to define PyAPI_FUNC(), PyAPI_DATA() and PyMODINIT_FUNC macros.

Remove hacks (undefine manually the 3 Py_BUILD_CORE macros) in
Modules/_testcapi/parts.h and Modules/_testclinic_limited.c.
2023-10-11 20:47:54 +00:00
Ezio Melotti 718391f475
gh-110631: Fix reST indentation (#110724)
* Fix wrong indentation in the other dirs.

* Fix more wrong indentation.
2023-10-11 22:43:03 +02:00
Ezio Melotti bb7923f556
gh-110631: Fix reST indentation in Doc/library (#110685)
Fix wrong indentation in the Doc/library dir.
2023-10-11 22:24:12 +02:00
Serhiy Storchaka eb50cd37ea
gh-110289: C API: Add PyUnicode_EqualToUTF8() and PyUnicode_EqualToUTF8AndSize() functions (GH-110297) 2023-10-11 16:41:58 +03:00
Adam Turner d1f7fae424
GH-107518: Remove the Argument Clinic How-To (#109900)
* Remove the content of the Argument Clinic HOWTO
* Update cross-references to the Argument Clinic
* Add a note directing readers to the devguide
2023-10-11 14:57:51 +02:00
Ezio Melotti 3dd593e2f2
gh-110631: fix wrong indentation in the Doc/whatsnew dir (#110632)
Fix wrong indentation in the Doc/whatsnew dir.
2023-10-11 07:34:38 +02:00
Radislav Chugunov 0d805b998d
gh-108826: Document dis module CLI and rename _test function to main (#108827)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-10-10 16:31:28 -06:00
Nikita Sobolev 756062b296
gh-101100: Fix sphinx warnings in library/socketserver.rst (GH-110207) 2023-10-10 13:44:19 +02:00
Donghee Na 0362cbf908
gh-109595: Add -Xcpu_count=<n> cmdline for container users (#109667)
---------

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-10-10 19:00:09 +09:00
Ezio Melotti bdbe43c7d0
Remove unused SPHINXLINT var from Doc/Makefile. (#110570)
Remove unused `SPHINXLINT` var.
2023-10-10 00:30:23 +02:00
Nikita Sobolev 5e7edac771
gh-110497: Add note about OSError being an alias to IOError in docs (#110498) 2023-10-09 11:18:06 +02:00
Albert Villanova del Moral 0df772f555
Remove unused imports in multiprocessing docs example (#109984) 2023-10-08 22:36:01 -07:00
partev 892ee72b36
gh-110534 fix a URL redirect to wikipedia article on Fibonacci numbers (#110535) 2023-10-09 00:44:15 -04:00
Serhiy Storchaka d96a8cdfe2
gh-89902: Deprecate non-standard format specifier "N" for Decimal (GH-110508)
It was not documented and only supported in the C implementation.
2023-10-08 10:01:39 +03:00
zipperer 8e56d551ce
Update floatingpoint.rst (#110509)
This commit removes a ':'. I believe the extra colon causes a display error.

What I believe to be an error:
Above this expression
`round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)`
the page displays `.. doctest::`.

What I observed:
After I remove the extra colon, the page does not display `.. doctest::`
2023-10-07 17:07:36 -07:00
Masaru Tsuchiyama de2a4036cb
gh-108277: Add os.timerfd_create() function (#108382)
Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-07 19:33:22 +02:00
Victor Stinner 64f158e7b0
gh-110397: Add Py_IsFinalizing() to the stable ABI (#110441) 2023-10-07 17:59:16 +02:00
InSync 02cdaefe9a
Fix typo in Doc/library/textwrap.rst (#110328)
"One problem with this is algorithm is that [...]" -> "One problem with this algorithm is that [...]"
2023-10-06 14:25:02 +00:00
Victor Stinner bb057b3370
gh-85283: Add PySys_AuditTuple() function (#108965)
sys.audit() now has assertions to check that the event argument is
not NULL and that the format argument does not use the "N" format.

Add tests on PySys_AuditTuple().
2023-10-05 21:59:35 +00:00
Bradley Reynolds d257479c2f
gh-110383: Swap 'the all' -> 'all the' in socket docs (#110434) 2023-10-05 19:55:44 +00:00
Harmen Stoppels a13620685f
Fix env var typo in perf profiling docs (#110404)
Fix typo in docs
2023-10-05 20:27:19 +03:00
Towster15 a973bf0f97
gh-110383 TimeIt Docs Spelling Fix (#110407)
Make 0.2 second plural
2023-10-05 17:01:35 +00:00
박문식 d33aa18f15
gh-82367: Use FindFirstFile Win32 API in ntpath.realpath() (GH-110298)
* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
2023-10-05 09:49:07 -05:00
Benjamin Peterson 313aa861ce
Remove duplicate word. (#110376) 2023-10-05 15:18:17 +11:00
P. L. Lim f7860295b1
Add back bltin-boolean-values ref tag (#110371)
To avoid breaking downstream intersphinx via numpydoc
2023-10-04 12:56:11 -07:00
Jelle Zijlstra f02f26e293
gh-85984: Document change in return type of tty functions (#110028) 2023-10-03 20:46:38 -07:00
Adam Turner 77e9aae383
Docs: Avoid the deprecated `.. cmdoption::` directive (#110292) 2023-10-03 17:38:12 +00:00
Victor Stinner d73501602f
gh-108867: Add PyThreadState_GetUnchecked() function (#108870)
Add PyThreadState_GetUnchecked() function: similar to
PyThreadState_Get(), but don't issue a fatal error if it is NULL. The
caller is responsible to check if the result is NULL. Previously,
this function was private and known as _PyThreadState_UncheckedGet().
2023-10-03 16:53:51 +00:00
Victor Stinner 6ab6040054
gh-110276: No longer ignore PROFILE_TASK failure silently (#110295) 2023-10-03 18:43:23 +02:00
Victor Stinner eeb4e974d0
gh-107073: Mention pythoncapi-compat for PyObject_VisitManagedDict() (#110291) 2023-10-03 15:50:10 +00:00
Lincoln 4227bfa8b2
Enhanced sqlite3 connection context management documentation with contextlib.closing gh-109234 (#109322)
* Enhanced sqlite3 connection context management documentation with contextlib.closing

* 📜🤖 Added by blurb_it.

* Fixed gitignore spelling error from nitignore to gitignore

* Renamed .gitignore to .nitignore

* Added generated doctests

* Deleted sqlite3 generated files

* Removed white-space changes

* Removed News entry from the doc

* Expanded a note that context manager can be used for connection management using contextlib.closing

* Removed repeated contextlib.closing code snippet

* Expanded the note around usage of context manageer for sqlite3 connection management

* Deleted extra white-spaces

* Deleted extra white-space

* re-arranged context manager wording

* Re-arranged word layout on how to use context manager

* Fix whitespace errors

* Remove unneeded change in .gitignore

* Added suggested changes

* Added suggested change redirecting to the contextlib.closing implementation

* Added closing keyword

* Removed line 2473

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-03 17:32:43 +03:00
Alex Waygood f1663a492e
Bump various dependencies in Doc/requirements-oldest-sphinx.txt (#110278)
This resolves a Dependabot security alert on the repository for urllib3==2.0.4.
2023-10-03 14:10:03 +01:00
Lele Gaifax 8c071373f1
Fix typo in py312 whatsnew: add missing closing paren (#110255) 2023-10-03 07:10:16 +01:00
Victor Stinner fc2cb86d21
gh-107073: Make PyObject_VisitManagedDict() public (#108763)
Make PyObject_VisitManagedDict() and PyObject_ClearManagedDict()
functions public in Python 3.13 C API.

* Rename _PyObject_VisitManagedDict() to PyObject_VisitManagedDict().
* Rename _PyObject_ClearManagedDict() to PyObject_ClearManagedDict().
* Document these functions.
2023-10-02 19:24:08 +02:00
Victor Stinner 4d0d1c3866
gh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)
If the timeout is greater than PY_TIMEOUT_MAX,
PyThread_acquire_lock_timed() uses a timeout of PY_TIMEOUT_MAX
microseconds, which is around 280.6 years. This case is unlikely and
limiting a timeout to 280.6 years sounds like a reasonable trade-off.

The constant PY_TIMEOUT_MAX is not used in PyPI top 5,000 projects.
2023-10-02 18:07:56 +02:00
numbermaniac 8d92b6eff3
3.12 What's New: Remove duplicate "up to" (#110219) 2023-10-02 13:13:44 +00:00
Steve Dower 1b3bc610fd
gh-83180: Made launcher treat shebang 'python' tags as low priority so that active virtual environments are preferred (GH-108101) 2023-10-02 12:22:55 +00:00
Adam Turner 6139bf5e0c
GH-109190: Announce final release in What's New in Python 3.12 (#110117)
Prepare What's New in Python 3.12 for final release
2023-10-02 13:15:58 +02:00
Adam Turner f16e81f368
GH-92584: Move installation schemes overview to sysconfig docs (#108018)
* Add new installation path functions subsection

* Add content from install/index to sysconfig

* Fix table

* Update note about installers

* Clean up the list of schemes, remove references to Distutils
2023-10-02 12:40:03 +02:00
Hugo van Kemenade 9cb8927bfc
Docs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (#110208) 2023-10-02 13:31:23 +03:00
Charles Machalow 29b875bb93
gh-109590: Update shutil.which on Windows to prefer a PATHEXT extension on executable files (GH-109995)
The default arguments for shutil.which() request an executable file, but extensionless files are not executable on Windows and should be ignored.
2023-10-02 09:27:30 +01:00
Ned Batchelder 29c3a445d9
fix misaligned versionchanged blocks in sqlite3 docs (GH-110191) 2023-10-01 20:34:09 -07:00
Quentin Agren adf0f15a06
gh-110138: Improve grammar in idiomatic usage of `__main__.py` (#110142) 2023-10-01 13:32:43 -05:00
Nikita Sobolev 31097df611
gh-101100: Fix sphinx warnings in library/site.rst (#110144)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-01 20:18:19 +03:00
Barney Gale 15de493395
GH-107465: Add pathlib.Path.from_uri() classmethod. (#107640)
This method supports file URIs (including variants) as described in RFC 8089, such as URIs generated by `pathlib.Path.as_uri()` and `urllib.request.pathname2url()`.

The method is added to `Path` rather than `PurePath` because it uses `os.fsdecode()`, and so its results vary from system to system. I intend to deprecate `PurePath.as_uri()` and move it to `Path` for the same reason.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-01 16:14:02 +01:00
Raymond Hettinger 62405c7867
gh-110150: Fix base case handling in quantiles() (gh-110151) 2023-09-30 23:35:54 -05:00
Victor Stinner a46e960768
gh-109649: Use os.process_cpu_count() (#110165)
Replace os.cpu_count() with os.process_cpu_count() in modules:

* compileall
* concurrent.futures
* multiprocessing

Replace os.cpu_count() with os.process_cpu_count() in programs:

* _decimal deccheck.py test
* freeze.py
* multissltests.py
* python -m test (regrtest)
* wasm_build.py

Other changes:

* test.pythoninfo logs os.process_cpu_count().
* regrtest gets os.process_cpu_count() / os.cpu_count() in headers.
2023-10-01 03:14:57 +02:00
Victor Stinner c81521020d
gh-109649: Add os.process_cpu_count() function (#109907)
* Refactor os_sched_getaffinity_impl(): move variable definitions to
  their first assignment.
* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
  when the test completes!
* Doc: Specify that os.cpu_count() counts *logicial* CPUs.
* Doc: Specify that os.sched_getaffinity(0) is related to the calling
  thread.
2023-10-01 00:12:51 +02:00
Victor Stinner 7513994c92
gh-110014: Include explicitly <unistd.h> header (#110155)
* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They  are already
  included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
  is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
  are already defined, like the __NEED_pthread_t macro.
2023-09-30 20:06:45 +00:00
Victor Stinner 74e425ec18
gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)
* pycore_pythread.h is now the central place to make sure that
  _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if
  available.
* Make sure that pycore_pythread.h is included when _POSIX_THREADS
  and _POSIX_SEMAPHORES macros are tested.
* PY_TIMEOUT_MAX is now defined as a constant, since its value
  depends on _POSIX_THREADS, instead of being defined as a macro.
* Prevent integer overflow in the preprocessor when computing
  PY_TIMEOUT_MAX_VALUE on Windows:
  replace "0xFFFFFFFELL * 1000 < LLONG_MAX"
  with "0xFFFFFFFELL < LLONG_MAX / 1000".
* Document the change and give hints how to fix affected code.
* Add an exception for PY_TIMEOUT_MAX  name to smelly.py
* Add PY_TIMEOUT_MAX to the stable ABI
2023-09-30 19:25:54 +02:00
Adam Turner 0449fe999d
GH-101100: Fix reference warnings for `gettext` (#110115) 2023-09-30 05:10:07 -06:00
Adam Turner cbdacc738a
GH-101100: Fix reference warnings for `namedtuple` (#110113) 2023-09-29 23:32:35 -07:00
Raymond Hettinger 613c0d4e86
Add example for linear_regression() with proportional=True. (gh-110133) 2023-09-29 23:18:12 -05:00
Donghee Na 501939c9c1
gh-105323: Update readline module to detect apple editline variant (gh-108665) 2023-09-29 21:18:18 +09:00
Jacob Coffee e27adc68cc
gh-109634: Fix :samp: syntax (GH-110073) 2023-09-29 14:21:34 +03:00
Yuki K bfd94ab9e9
gh-101100: Fix references to `URLError and HTTPError in howto/urllib2.rst` (#107966)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-29 08:35:29 +00:00
Maciej Olko 8898a8683b
gh-101100: Fix Sphinx warnings in tutorial/controlflow.rst (#109424)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-29 11:27:43 +03:00
Nikita Sobolev f1b1680a72
gh-109961: Use proper module for copy method docs (#110027)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-29 11:26:55 +03:00
Nikita Sobolev d102d39bbe
gh-101100: Fix sphinx warnings in library/difflib.rst (#110074) 2023-09-29 11:03:59 +03:00
Jelle Zijlstra 7dc2c5093e
gh-110045: Update symtable module for PEP 695 (#110066) 2023-09-29 02:08:04 +00:00
Davide Rizzo c4eda57345
Whitespace fix in asyncio-stream.rst (#110015) 2023-09-28 09:34:35 -07:00
Nikita Sobolev 0baf72696e
gh-109961: Docs: Fix incorrect rendering of __replace__ in copy.rst (#109968) 2023-09-28 14:51:33 +03:00
Adam Turner 526380e286
GH-109190: Copyedit 3.12 What's New: Bytecode (#109821)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-28 04:40:59 +00:00
Jacob Coffee 99fba5f156
gh-109812: Fix phrasing for collections.Counter (gh-109813) 2023-09-27 21:29:39 -05:00
Jelle Zijlstra f49958c886
Enhance TypedDict docs around required/optional keys (#109547)
As discussed in comments to #109544, the semantics of this attribute
are somewhat confusing. Add a note explaining its limitations and
steering users towards __required_keys__ and __optional_keys__ instead.
2023-09-27 10:35:46 -07:00
Sam Gross 773614e03a
gh-109740: Use 't' in --disable-gil SOABI (#109922)
Shared libraries for CPython 3.13 are now marked with a 't' for
threading. For example, `binascii.cpython-313t-darwin.so`.
2023-09-27 15:24:12 +00:00
Adam Turner b35f0843fc
GH-109190: Copyedit 3.12 What's New: Release highlights (#109770) 2023-09-27 17:31:55 +03:00
Nikita Sobolev d9809e84fb
gh-101100: Fix sphinx warnings in library/devmode.rst (#109963)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-09-27 16:07:28 +03:00
Adam Turner 0e28d0f7a1
GH-109190: Copyedit 3.12 What's New: Deprecations (`os` fix) (#109927)
Merge the two ``os`` entries
2023-09-27 07:59:42 +03:00
Victor Stinner 3538930d87
gh-101100: Fix Sphinx warnings in Doc/using/configure.rst (#109931) 2023-09-27 02:01:48 +02:00
Adam Turner 87ddfa74e2
GH-109190: Copyedit 3.12 What's New: Deprecations (#109766) 2023-09-27 00:24:44 +03:00
Victor Stinner b1e4f6e83e
gh-109276, gh-109508: Fix libregrtest stdout (#109903)
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
2023-09-26 21:34:50 +02:00
Barney Gale ecd813f054
GH-109187: Improve symlink loop handling in pathlib.Path.resolve() (GH-109192)
Treat symlink loops like other errors: in strict mode, raise `OSError`, and
in non-strict mode, do not raise any exception.
2023-09-26 17:57:17 +01:00
Victor Stinner 859618c8cd
gh-109566, regrtest: Add --fast-ci and --slow-ci options (#109570)
* Add --fast-ci and --slow-ci options to libregrtest:

  * --fast-ci uses a default timeout of 10 minutes and "-u all,-cpu"
    (skip slowest tests).
  * --slow-ci uses a default timeout of 20 minues and "-u all" (run
    all tests).

* regrtest header now lists test resources.
* Makefile changes:

  * "make test", "make hostrunnertest" and "make coverage-report" now
    use --fast-ci option and TESTTIMEOUT variable.
  * "make buildbottest" now uses "--slow-ci". Remove options which
    became redundant with "--slow-ci".
  * "make testall" and "make testuniversal" now use --slow-ci option
    and TESTTIMEOUT variable.
  * "make testall" now uses "find -exec rm ..." instead of
    "find ... -print|xargs rm ...", same as "make clean".

* GitHub Actions workflow:

  * Ubuntu and Address Sanitizer jobs now use "make test". Remove
    options which became redundant with "--fast-ci".
  * Windows jobs now use --fast-ci option.
  * Use -j0 to detect the number of CPUs.

* Set Makefile TESTTIMEOUT default to an empty string, since
  --slow-ci and --fast-ci use different default timeout. It's now
  accepted to pass "--timeout=" to regrtest: treated as not timeout.
* Tools/scripts/run_tests.py now uses --fast-ci option.
* Tools/buildbot/test.bat now uses --slow-ci option. Remove
  --timeout=1200 option, redundant with --slow-ci.
2023-09-26 17:22:50 +02:00
lohaswinner 8100612bac
no-issue: Fix a typo in the parameter name of random.expovariate. (gh-109902) 2023-09-26 22:12:32 +09:00
Nikita Sobolev 7c61a361fc
gh-101100: Fix Sphinx warnings in Doc/library/weakref.rst (#109881) 2023-09-26 10:46:09 +03:00
Antoine Pitrou 88a6137cdb
gh-109599: Add types.CapsuleType (#109600)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-09-25 19:50:39 +02:00
Adam Turner 86e7c611ac
GH-109190: Copyedit 3.12 What's New: Sort Other Language Changes (#109836) 2023-09-25 17:42:03 +03:00
Adam Turner 64ab9f7d5c
GH-109190: Copyedit 3.12 What's New: Synchronise C API deprecations with the 3.12 branch (#109844) 2023-09-25 17:04:36 +03:00
Adam Turner bccc1b7800
GH-109190: Copyedit 3.12 What's New: Improve the C-API deprecations section (#109751)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-25 12:38:07 +00:00
Adam Turner 4e478534d7
GH-109190: Copyedit 3.12 What's New: Use the present tense (#109754) 2023-09-25 15:18:22 +03:00
Adam Turner f08772cfd8
GH-109190: Copyedit 3.12 What's New: Trivia (#109760) 2023-09-25 15:11:37 +03:00