Commit Graph

115998 Commits

Author SHA1 Message Date
Shantanu 1ae619c911
gh-87691: add an absolute path pathlib example in / operator docs (GH-100737)
The behaviour is fully explained a couple paragraphs above, but it may be useful to have a brief example to cover the behaviour.

Automerge-Triggered-By: GH:hauntsaninja
2023-01-05 14:55:35 -08:00
Shantanu d84b1a97f9
Add hauntsaninja as tomllib CODEOWNER (#100779) 2023-01-05 14:28:02 -08:00
Barney Gale 7fba99eadb
gh-100562: improve performance of `pathlib.Path.absolute()` (GH-100563)
Increase performance of the `absolute()` method by calling `os.getcwd()` directly, rather than using the `Path.cwd()` class method. This avoids constructing an extra `Path` object (and the parsing/normalization that comes with it).

Decrease performance of the `cwd()` class method by calling the `Path.absolute()` method, rather than using `os.getcwd()` directly. This involves constructing an extra `Path` object. We do this to maintain a longstanding pattern where `os` functions are called from only one place, which allows them to be more readily replaced by users. As `cwd()` is generally called at most once within user programs, it's a good bargain.

```shell
# before
$ ./python -m timeit -s 'from pathlib import Path; p = Path("foo", "bar")' 'p.absolute()'
50000 loops, best of 5: 9.04 usec per loop
# after
$ ./python -m timeit -s 'from pathlib import Path; p = Path("foo", "bar")' 'p.absolute()'
50000 loops, best of 5: 5.02 usec per loop
```

Automerge-Triggered-By: GH:AlexWaygood
2023-01-05 14:11:50 -08:00
Zachary Ware af5149f30b
gh-98831: Regenerate Python/opcode_metadata.h (GH-100778) 2023-01-05 15:47:18 -06:00
Guido van Rossum 14b7f00fdf
GH-98831: Update generate_cases.py: register inst, opcode_metadata.h (#100735)
(These aren't used yet, but may be coming soon,
and it's easier to keep this tool the same between branches.)

Added a sanity check for all this to compile.c.

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2023-01-05 13:01:07 -08:00
Mark Shannon 28187141cc
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
* Remove PRINT_EXPR instruction

* Remove STOPITERATION_ERROR instruction

* Remove IMPORT_STAR instruction
2023-01-05 16:05:51 +00:00
Mark Shannon f20c553a45
GH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753) 2023-01-05 12:20:09 +00:00
Tzu-ping Chung 105e37395d
GH-100766: Note that locale.LC_MESSAGES is not universal (GH-100702) 2023-01-05 03:34:30 +00:00
Brett Cannon 31b639a992
Drop myself from pathlib maintenance (#100757) 2023-01-04 14:59:48 -08:00
Christian Klein 7f1eefc6f4
gh-100739: Respect mock spec when checking for unsafe prefixes (#100740)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-04 22:31:29 +00:00
Irit Katriel 52017dbe16
gh-100747: some compiler macros use c instead of C to access the compiler (#100748) 2023-01-04 20:19:20 +00:00
Mark Shannon 15aecf8dd7
GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721) 2023-01-04 15:41:39 +00:00
Irit Katriel c31e356a10
gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyFrame_NumSlotsForCodeObject (#100722) 2023-01-04 13:37:06 +00:00
David Lechner 5fb1c08e15
docs: fix `ssizeobjargproc` parameters (#100736) 2023-01-04 13:47:42 +05:30
Kumar Aditya ba8dcdbcab
GH-86508: skip binding to local addresses of different family in `asyncio.open_connection` (#100615) 2023-01-04 13:30:26 +05:30
Ethan Furman a286caa937
gh-91219: http - use subclassing to override index_pages attribute (GH-100731)
Remove previously added parameter to `__init__`, and recommend subclassing to modify the `index_pages` attribute instead.
2023-01-03 15:20:08 -08:00
Christophe Nanteuil 64ed609c53
[Enum] docs: replace 'last value' by 'highest value' for Flag auto (GH-100709) 2023-01-03 14:08:50 -08:00
Zachary Ware e196d8c10a
gh-100700: Remove Date and Release fields in past whatsnews (GH-100728) 2023-01-03 16:00:26 -06:00
L. A. F. Pereira e6d4440782
gh-100146: Steal references from stack when building a list (#100147)
When executing the BUILD_LIST opcode, steal the references from the stack,
in a manner similar to the BUILD_TUPLE opcode.  Implement this by offloading
the logic to a new private API, _PyList_FromArraySteal(), that works similarly
to _PyTuple_FromArraySteal().

This way, instead of performing multiple stack pointer adjustments while the
list is being initialized, the stack is adjusted only once and a fast memory
copy operation is performed in one fell swoop.
2023-01-03 10:49:49 -08:00
Thomas Grainger b3722ca058
gh-95882: fix regression in the traceback of exceptions propagated from inside a contextlib context manager (#95883) 2023-01-03 15:47:13 +00:00
Eli Schwartz 8586949833
gh-89419: gdb: fix bug causing `AttributeError` in py-locals when no frame is available (#100611) 2023-01-03 20:26:57 +05:30
4l4k4z4m 8b1f125121
gh-81611: Improve `range` paragraph in 8.3 of language reference (#98353)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-01-03 13:46:51 +05:30
Stanislav Zmiev 73097d91a6
gh-89727: Improve os.walk complexity (#100671) 2023-01-02 13:41:19 -08:00
Ionite d7e7f79ca7
gh-100637: Fix int and bool __sizeof__ calculation to include the 1 element ob_digit array for 0 and False (#100663)
Fixes behaviour where int (and subtypes like bool) __sizeof__ under-reports true size as it did not take into account the size 1 `ob_digit` array for the zero int.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-01-02 21:11:49 +00:00
Rupa Lahiri 9dee973166
gh-100676: Improve description for venv --upgrade-deps (GH-100678) 2023-01-02 12:17:58 +00:00
Kumar Aditya 7feb6d2f85
fix `grammer` -> `grammar` typo in expressions.rst (GH-100683)
Automerge-Triggered-By: GH:AlexWaygood
2023-01-02 03:49:06 -08:00
Alexander Shadchin 254ab42240
Fix deprecation doc for `PyEval_InitThreads` (#100667) 2023-01-02 16:43:55 +05:30
Shantanu edfbf56f4c
gh-100428: Make int documentation more accurate (#100436)
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
2023-01-01 19:14:18 -08:00
Erlend E. Aasland b7a68ab824
gh-99953: Purge mention of numeric param style from sqlite3 docs (#100630)
The PEP-249 numeric style has never been supported by sqlite3.
2023-01-01 23:26:23 +01:00
dependabot[bot] 2366b27565
build(deps): bump actions/stale from 6 to 7 (#100656) 2023-01-01 23:49:10 +02:00
Jason R. Coombs 447d061bc7
gh-97930: Apply changes from importlib_resources 5.10. (GH-100598) 2023-01-01 11:07:32 -05:00
Géry Ogam ba1342ce99
gh-87980: Fix the error message for disallowed __weakref__ slots (#25362)
Fix the error message for disallowed `__weakref__` slots.
2023-01-01 21:11:33 +05:30
ram vikram singh 1aab269d4a
gh-100201: Document behavior with a bare `yield` statement (#100416)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-01 21:06:13 +05:30
Mehrdad Moradizadeh 1d1480fefc
gh-96773 Fix documentation of socket backlog (#96778) 2023-01-01 20:36:17 +05:30
Gabriele N. Tornetta d52d4942cf
gh-100649: Update native_thread_id after fork (gh-100650)
Update native_thread_id after fork
2023-01-01 23:20:38 +09:00
Shantanu e83f88a455
gh-100488: Add is_integer method to fractions.Fraction (#100489) 2023-01-01 01:44:48 -07:00
Shantanu 71159a8e07
gh-100546: Remove incorrect positional-only marker from eval (#100547)
All the arguments are positional-only.

The current status after #99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.
2022-12-31 17:59:31 -07:00
Terry Jan Reedy 1f6c87ca7b
IDLE - fix module browser test (#100647) 2022-12-31 19:01:44 -05:00
Mark Hansen baf234971f
Fix `pydtrace.d` path comment in `Include/pydtrace.h` (#28539) 2022-12-31 22:40:25 +05:30
Sandeep Subramanian ac7a0a9f9e
GH-87002: fix caching documentation in `struct` module (#24164) 2022-12-31 22:27:58 +05:30
Owain Davies 98308dbeb1
gh-100633 Tutorial: Fix dataclasses import (#100638)
import dataclass not dataclasses from dataclasses
2022-12-31 10:23:18 +00:00
tqxia 636e9dd23f
gh-94808: Improve coverage of dictresize (GH-100619) 2022-12-31 18:15:30 +09:00
Paolo Lammens f59c7f8edd
GH-85979: Clarify specification of `object.__await__` (#22320)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-31 11:54:04 +05:30
Raymond Hettinger 4ebaae8aed
Improve comments in itertools uniquification recipes (GH-100631) 2022-12-30 20:36:38 -06:00
Éric 46521826cb
gh-95778: add doc missing in some places (GH-100627) 2022-12-30 13:21:15 -08:00
mathieui f4fcfdf8c5
gh-100616: Document 'attr' parameter for window.vline() in curses module (#24961)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-12-30 08:35:04 -08:00
Nikita Sobolev 79c10b7da8
gh-99433: Fix `doctest` failure on `types.MethodWrapperType` (#99434) 2022-12-30 17:25:01 +05:30
Gregory P. Smith 894f2c3c16
gh-100228: Warn from os.fork() if other threads exist. (#100229)
Not comprehensive, best effort warning. There are cases when threads exist on some platforms that this code cannot detect. macOS when API permissions allow and Linux with a readable /proc procfs present are the currently supported cases where a warning should show up reliably.

Starting with a DeprecationWarning for now, it is less disruptive than something like RuntimeWarning and most likely to only be seen in people's CI tests - a good place to start with this messaging.
2022-12-29 14:41:39 -08:00
Zachary Ware 2df82db485
gh-100540: Remove obsolete Modules/_ctypes/darwin/ dlfcn shim (GH-100541)
As far as I can tell, this hasn't been actually used since Mac OS X 10.2.
2022-12-29 16:13:28 -06:00
ram vikram singh 7223d50b97
gh-100583: Improve the `pydoc` documentation (#100590) 2022-12-29 20:47:20 +05:30