Commit graph

27747 commits

Author SHA1 Message Date
Petr Viktorin 879f4546bf
gh-110850: Add PyTime_t C API (GH-115215)
* gh-110850: Add PyTime_t C API

Add PyTime_t API:

* PyTime_t type.
* PyTime_MIN and PyTime_MAX constants.
* PyTime_AsSecondsDouble(), PyTime_Monotonic(),
  PyTime_PerfCounter() and PyTime_GetSystemClock() functions.

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-02-12 18:13:10 +01:00
Serhiy Storchaka 91822018ee
gh-115233: Fix an example in the Logging Cookbook (GH-115325)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
2024-02-12 18:24:45 +02:00
Hugo van Kemenade 92483b21b3
gh-101100: Fix Sphinx warnings in whatsnew/2.7.rst and related (#115319)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-12 14:40:41 +02:00
Nikita Sobolev 705c76d4a2
gh-114785: Remove content from Porting from Python2 how-to (#114805)
Keep the page though, because people might still rely on it (the traffic shows that they do).
Instead of our own manual we now give links to the 3rd-party ones.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-02-12 14:59:58 +03:00
Brandt Bucher 235cacff81
GH-114695: Add sys._clear_internal_caches (GH-115152) 2024-02-12 09:04:36 +00:00
Skip Montanaro e1552fd19d
gh-101100: Clean up Doc/c-api/exceptions.rst and Doc/c-api/sys.rst (GH-114825) 2024-02-11 18:51:07 +00:00
Serhiy Storchaka b104360788
gh-49766: Make date-datetime comparison more symmetric and flexible (GH-114760)
Now the special comparison methods like `__eq__` and `__lt__` return
NotImplemented if one of comparands is date and other is datetime
instead of ignoring the time part and the time zone or forcefully
return "not equal" or raise TypeError.

It makes comparison of date and datetime subclasses more symmetric
and allows to change the default behavior by overriding
the special comparison methods in subclasses.

It is now the same as if date and datetime was independent classes.
2024-02-11 13:06:43 +02:00
Serhiy Storchaka d2c4baa41f
gh-97928: Partially restore the behavior of tkinter.Text.count() by default (GH-115031)
By default, it preserves an inconsistent behavior of older Python
versions: packs the count into a 1-tuple if only one or none
options are specified (including 'update'), returns None instead of 0.
Except that setting wantobjects to 0 no longer affects the result.

Add a new parameter return_ints: specifying return_ints=True makes
Text.count() always returning the single count as an integer
instead of a 1-tuple or None.
2024-02-11 12:43:14 +02:00
Serhiy Storchaka 573acb30f2
gh-115172: Fix explicit index extries for the C API (GH-115173) 2024-02-11 12:23:30 +02:00
Skip Montanaro 1b89591474
gh-101100: Fix dangling refs in bdb.rst (#114983)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-02-11 11:21:10 +02:00
Nikita Sobolev 4821f08674
gh-101100: Fix sphinx warnings in c-api/gcsupport.rst (#114786) 2024-02-10 15:59:23 -07:00
Mike Zimin 9d1a353230
gh-114894: add array.array.clear() method (#114919)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-10 07:59:46 -08:00
Nikita Sobolev e19103a346
gh-114552: Update __dir__ method docs: it allows returning an iterable (#114662) 2024-02-10 08:34:23 +00:00
Laurie O b2d9d134dc
gh-96471: Add shutdown() method to queue.Queue (#104750)
Co-authored-by: Duprat <yduprat@gmail.com>
2024-02-09 20:58:30 -08:00
Erlend E. Aasland 769d444826
Docs: correctly link to code objects (#115214) 2024-02-09 15:11:36 +01:00
Brett Cannon c968dc7ff3
GH-113632: update configure.ac for WebAssembly support tiers (#115192)
Move WASI to tier 2 and drop Emscripten.
2024-02-09 09:21:49 +01:00
Nikita Sobolev 553c90ccc2
gh-101100: Fix sphinx warnings in library/enum.rst (#114696)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-02-08 23:40:28 -07:00
Shantanu 17689e3c41
gh-107944: Improve error message for getargs with bad keyword arguments (#114792) 2024-02-08 01:04:41 -08:00
Mark Shannon 8a3c499ffe
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)"

This reverts commit 36518e69d7.
2024-02-07 12:38:34 +00:00
Skip Montanaro d0322fdf2c
gh-101100: Fix Py_DEBUG dangling Sphinx references (#115003) 2024-02-07 10:48:42 +00:00
Edgar Ramírez Mondragón 60375a3809
gh-115114: Add missing slash to file URI prefix file:/ (#115115)
Add missing slash to file URI prefix `file:/`
2024-02-07 05:22:47 +00:00
Finite State Machine 3f71c416c0
gh-115106 docs: 'enum.Flag.__iter__()' did not exist prior to Python 3.11 (GH-115107)
change versionchanged to versionadded
2024-02-06 17:28:01 -08:00
Sam Gross de61d4bd4d
gh-112066: Add PyDict_SetDefaultRef function. (#112123)
The `PyDict_SetDefaultRef` function is similar to `PyDict_SetDefault`,
but returns a strong reference through the optional `**result` pointer
instead of a borrowed reference.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-06 11:36:23 -05:00
da-woods 0e2ab73dc3
gh-114756: Update FAQ section on removing the GIL (#114957)
Update FAQ section on removing the GIL to reflect recent progress on PEP 703 and PEP 684.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-02-06 10:55:44 -05:00
Mariusz Felisiak 1a10437a14
gh-91602: Add iterdump() support for filtering database objects (#114501)
Add optional 'filter' parameter to iterdump() that allows a "LIKE"
pattern for filtering database objects to dump.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-06 12:34:56 +01:00
Serhiy Storchaka bb57ffdb38
gh-83648: Support deprecation of options, arguments and subcommands in argparse (GH-114086) 2024-02-06 00:41:34 +02:00
Serhiy Storchaka 652fbf88c4
gh-82626: Emit a warning when bool is used as a file descriptor (GH-111275) 2024-02-05 22:51:11 +02:00
HarryLHW 750489cc77
gh-114967: Fix "Built-in Exceptions" documentation ambiguous wording (#114968)
Change the somewhat vague "listed below" to "listed in this chapter" in Doc/library/exceptions.rst.
The exceptions are listed in multiple sections after two intermediate sections.
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-05 15:22:57 -05:00
Mark Shannon 36518e69d7
GH-108362: Incremental GC implementation (GH-108038) 2024-02-05 18:28:51 +00:00
Serhiy Storchaka b4ba0f73d6
gh-43457: Tkinter: fix design flaws in wm_attributes() (GH-111404)
* When called with a single argument to get a value, it allow to omit
  the minus prefix.
* It can be called with keyword arguments to set attributes.
* w.wm_attributes(return_python_dict=True) returns a dict instead of 
  a tuple (it will be the default in future).
* Setting wantobjects to 0 no longer affects the result.
2024-02-05 18:24:54 +02:00
Terry Jan Reedy 39ec7fbba8
Remove bogus syntax error marker in csv doc (#115017) 2024-02-05 04:11:31 +00:00
Dai Wentao da8f9fb2ea
gh-113803: Fix inaccurate documentation for shutil.move when dst is an existing directory (#113837)
* fix the usage of dst and destination in shutil.move doc
* update shutil.move doc
2024-02-04 13:42:58 -05:00
Serhiy Storchaka ca715e56a1
gh-69893: Add the close() method for xml.etree.ElementTree.iterparse() iterator (GH-114534) 2024-02-04 17:25:21 +02:00
Ethan Furman ff7588b729
gh-114071: [Enum] update docs and code for tuples/subclasses (GH-114871)
Update documentation with `__new__` and `__init__` entries.

Support use of `auto()` in tuple subclasses on member assignment lines.  Previously, auto() was only supported on the member definition line either solo or as part of a tuple:

    RED = auto()
    BLUE = auto(), 'azul'

However, since Python itself supports using tuple subclasses where tuples are expected, e.g.:

    from collections import namedtuple
    T = namedtuple('T', 'first second third')

    def test(one, two, three):
        print(one, two, three)

    test(*T(4, 5, 6))
    # 4 5 6

it made sense to also support tuple subclasses in enum definitions.
2024-02-04 07:22:55 -08:00
Skip Montanaro ec69e1d0dd
gh-101100: Fix dangling references in pickle.rst (#114972)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-04 14:24:24 +00:00
Hugo van Kemenade 848c86786b
gh-101100: Fix Sphinx warnings from PEP 3108 stdlib re-organisation (#114327)
* Fix Sphinx warnings from PEP 3108 stdblib re-organisation

* Apply suggestions from code review

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Update Doc/whatsnew/2.2.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Apply suggestions from code review

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-04 09:45:35 +00:00
Nikita Sobolev 72d2d0f10d
gh-114803: Mention that @dataclass should not be applied on enums (GH-114891)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-02-03 13:55:38 -08:00
Skip Montanaro ab76d37948
gh-101100: Fix Sphinx reference warnings in the glossary (#114729)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-03 18:45:49 +00:00
Kristján Valur Jónsson 6b53d5fe04
gh-112202: Ensure that condition.notify() succeeds even when racing with Task.cancel() (#112201)
Also did a general cleanup of asyncio locks.py comments and docstrings.
2024-02-03 08:19:37 -08:00
AN Long b4240fd68e
gh-114955: Add clear to MutableSequence's mixin methods in document (gh-114956) 2024-02-03 09:33:58 -06:00
Mariusz Felisiak 28bb2961ba
Update LOGGING example taken from Django docs. (#114903)
For example, Django no longer provides a custom NullHandler

6c66a41c3d

* Remove require_debug_true.
2024-02-03 09:37:21 +02:00
Skip Montanaro 00d7109075
Normalize heading underline in multiprocessing.rst (#114923)
This gets rid of the mildly confusing `>>>>>>>' underlines which look vaguely like `diff` punctuation.
2024-02-02 17:56:00 -08:00
Terry Jan Reedy 1183f1e6bf
gh-114913: Add newline to subprocess doc (#114941)
*creationflags* is a separate topic from *startupinfo*.
Start sentence with 'If given', like previous sentence.
2024-02-02 23:14:32 +00:00
John Belmonte 73d20cafb5
Correct timedelta description (GH-101417)
It only represents the difference between two datetime or
date objects, not between two time objects.
2024-02-02 23:42:17 +02:00
Serhiy Storchaka b27812d632
Fix indentation of "versionchanged" in datetime.rst (GH-114933) 2024-02-02 23:09:16 +02:00
Serhiy Storchaka c12240ed28
gh-114728: Fix documentation for comparison of objects in datetime module (GH-114749) 2024-02-02 20:53:24 +02:00
patenaud 9872855a31
GH-69695: Update `PyImport_ImportModule` description (GH-103836)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-02-02 17:31:55 +01:00
Steven Ward ee66c33349
gh-114909: Add --first-weekday option to usage message (#114910) 2024-02-02 17:13:00 +02:00
Justin Williams d29f57f603
gh-103360: Add link in stdtypes.rst to escape sequences in lexical_analysis.rst (GH-103638) 2024-02-02 15:32:46 +02:00
Sam Gross d0f1307580
gh-114329: Add PyList_GetItemRef function (GH-114504)
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns
a strong reference instead of a borrowed reference. Additionally, if the
passed "list" object is not a list, the function sets a `TypeError`
instead of calling `PyErr_BadInternalCall()`.
2024-02-02 14:03:15 +01:00