Commit graph

114863 commits

Author SHA1 Message Date
Lysandros Nikolaou 3de08ce8c1
gh-97997: Add col_offset field to tokenizer and use that for AST nodes (#98000) 2022-10-07 14:38:35 -07:00
Guido van Rossum c06276402b
GH-88968: Reject socket that is already used as a transport (#98010) 2022-10-07 12:56:50 -07:00
Serhiy Storchaka c11b667a1d
gh-96346: Use double caching for re._compile() (#96347) 2022-10-07 12:21:42 -07:00
Stanley eed80458e8
gh-91708: Revert params note in urllib.parse.urlparse table (#96699)
Revert params note in urllib.parse.urlparse table
2022-10-07 12:19:36 -07:00
Stanley 3a7e955858
gh-96265: Fix some formatting in faq/design.rst (#96924)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-07 12:15:41 -07:00
Stanley fde74be61b
gh-73196: Add namespace/scope clarification for inheritance section (#92840)
Add namespace/scope clarification for inheritance section
2022-10-07 12:04:14 -07:00
Noam Cohen 2a168355f0
gh-97646: Change .js and .mjs files mimetype to conform to RFC 9239 (#97934) 2022-10-07 12:00:53 -07:00
Nikita Sobolev 3108fc1c16
gh-97923: Always run Ubuntu SSL tests with others in CI (#97940) 2022-10-07 11:58:46 -07:00
Nikita Sobolev 586cfb0131
gh-97956: Mention generate_global_objects.py in AC How-To (#97957) 2022-10-07 11:54:45 -07:00
180909 c81c64ca58
gh-96959: Update HTTP links which are redirected to HTTPS (#98039) 2022-10-07 11:52:45 -07:00
Eric Wieser c7b2204996
Add a warning message about PyOS_snprintf (#95993) 2022-10-07 11:49:53 -07:00
Anh71me d5fea01d9d
GH-96073: Fix wild replacement in inspect.formatannotation (#96074)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-07 11:23:06 -07:00
Stanley 676d8ef380
gh-65496: Correct wording on csv's skipinitialspace argument (#96170) 2022-10-07 11:15:34 -07:00
Stanley 4a74e6ab38
gh-64921: Clarify wording for open()'s newline arg (#96171) 2022-10-07 11:12:08 -07:00
Nikita Sobolev 24a6645894
gh-97955: Migrate zoneinfo to Argument Clinic (#97958) 2022-10-07 11:06:23 -07:00
Victor Stinner 002252c4ad
gh-97669: Move difflib examples to Doc/includes/ (#97964)
Remove diff.py and ndiff.py scripts of Tools/scripts/: move them to
Doc/includes/.

* diff.py and ndiff.py files are no longer executable. Remove also
  their shebang ("#!/usr/bin/env python3").
* Remove the -profile command from ndiff.py to simply the code.
* Remove ndiff.py copyright and history command. The Python
  documentation examples are distributed under the "Zero Clause BSD
  License".
2022-10-07 10:57:48 -07:00
zikcheng 24a4b34158
Make _symtable_entry.ste_type's comment consistent wit _Py_block_ty (#92414)
_Py_block_ty defines four types of block, FunctionBlock, ClassBlock, ModuleBlock and AnnotationBlock.
But _symtable_entry.ste_type only comments three of them, I think it's better both sides are consistent.
2022-10-07 10:53:07 -07:00
Marc Monfort 7f685683f8
Fix a mistake in isSet() deprecated message doc (#95720) 2022-10-07 10:42:35 -07:00
Nikita Sobolev 83cbe84dc2
gh-64373: Convert _functools to Argument Clinic (#96640) 2022-10-07 10:36:40 -07:00
Nikita Sobolev 5ba4875aec
gh-96415: Remove types._cell_factory from a module namespace (#96416)
Closes #96415
2022-10-07 10:27:14 -07:00
Serhiy Storchaka cae7d1d7a7
Add more syslog tests (GH-97953) 2022-10-07 20:17:08 +03:00
andrei kulakov 80b3e32d62
Add note on capture_output arg to subprocess.run() docstring (#98012)
add note on capture_output arg to the docstring
2022-10-07 10:08:08 -07:00
Nikita Sobolev 72c166add8
gh-94808: Cover %p in PyUnicode_FromFormat (#96677)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-07 09:53:42 -07:00
Carl Meyer be4099e55d
Fix memory leaks in test_capi (#98017) 2022-10-07 08:17:41 -07:00
Oleg Iarygin f99bb20cde
gh-97983: Revert "Lay the foundation for further work in asyncio.test_streams: port server cases to IsolatedAsyncioTestCase" (#98015)
This PR reverts gh-93369 and gh-97896 because they've made asyncio tests unstable. After these PRs were merged, random GitHub action jobs of random commits started to fail unrelated tests and test framework methods.

The reverting is necessary because such shrapnel failures are a symptom of some underlying bug that must be found and fixed first.

I had a hope that it's a server overload because we already have extremely rare disc access errors. However, one and a half day passed, and the failures continue to emerge both in PRs and commits.

Affected issue: gh-93357.
First reported in https://github.com/python/cpython/pull/97940#issuecomment-1270004134.

* Revert "gh-93357: Port test cases to IsolatedAsyncioTestCase, part 2 (#97896)"

This reverts commit 09aea94d29.

* Revert "gh-93357: Start porting asyncio server test cases to IsolatedAsyncioTestCase (#93369)"

This reverts commit ce8fc186ac.
2022-10-07 07:14:28 -07:00
Christopher Chianelli 6592a62ec2
gh-71316: Update dis documentation to include changes to jump arguments (GH-95798) 2022-10-07 14:54:21 +01:00
Raymond Hettinger e500cc0451
Misc updates to the itertools recipes and tests (GH-98018) 2022-10-07 03:37:21 -05:00
Julien Palard 66cc46b2e4
Doc: sphinx-lint finds two other default roles. (GH-98019) 2022-10-07 09:10:51 +02:00
Barry Warsaw 13d4489142
gh-86298: Ensure that __loader__ and __spec__.loader agree in warnings.warn_explicit() (GH-97803)
In `_warnings.c`, in the C equivalent of `warnings.warn_explicit()`, if the module globals are given (and not None), the warning will attempt to get the source line for the issued warning.  To do this, it needs the module's loader.

Previously, it would only look up `__loader__` in the module globals.  In https://github.com/python/cpython/issues/86298 we want to defer to the `__spec__.loader` if available.

The first step on this journey is to check that `loader == __spec__.loader` and issue another warning if it is not.  This commit does that.

Since this is a PoC, only manual testing for now.

```python
# /tmp/foo.py
import warnings

import bar

warnings.warn_explicit(
    'warning!',
    RuntimeWarning,
    'bar.py', 2,
    module='bar knee',
    module_globals=bar.__dict__,
    )
```

```python
# /tmp/bar.py
import sys
import os
import pathlib

# __loader__ = pathlib.Path()
```

Then running this: `./python.exe -Wdefault /tmp/foo.py`

Produces:

```
bar.py:2: RuntimeWarning: warning!
  import os
```

Uncomment the `__loader__ = ` line in `bar.py` and try it again:

```
sys:1: ImportWarning: Module bar; __loader__ != __spec__.loader (<_frozen_importlib_external.SourceFileLoader object at 0x109f7dfa0> != PosixPath('.'))
bar.py:2: RuntimeWarning: warning!
  import os
```

Automerge-Triggered-By: GH:warsaw
2022-10-06 19:32:53 -07:00
Gregory P. Smith 27369ef56f
gh-82874: Convert remaining importlib format uses to f-str. (#98005)
f-yes
2022-10-06 18:27:51 -07:00
Hugo van Kemenade fa2d43e518
Docs: Fix backtick errors found by sphinx-lint (#97998)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-06 18:01:30 -07:00
Nikita Sobolev 27025e158c
gh-97850: Remove deprecated functions from importlib.utils (#97898)
* gh-97850: Remove deprecated functions from `importlib.utils`

* Rebase and remove `set_package` from diff
2022-10-06 17:57:10 -07:00
Xiao Chen 4875433682
Remove extra spaces in custom openSSL documentation. (#93568) 2022-10-06 17:42:08 -07:00
Guido van Rossum 09de8d7aaf
GH-90985: Revert "Deprecate passing a message into cancel()" (#97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
2022-10-06 17:30:27 -07:00
Tiger c46a423a52
bpo-35540 dataclasses.asdict now supports defaultdict fields (gh-32056) 2022-10-06 17:11:59 -07:00
Carl Meyer a4b7794887
GH-91052: Add C API for watching dictionaries (GH-31787) 2022-10-07 01:08:00 +01:00
Gregory P. Smith 683ab85955
bpo-38693: Use f-strings instead of str.format() within importlib (#17058)
This is a small performance improvement, especially for one or two hot
places such as _handle_fromlist() that are called a lot and the
.format() method was being used just to join two strings with a dot.

Otherwise it is merely a readability improvement.

We keep `_ERR_MSG` and `_ERR_MSG_PREFIX` as those may be used elsewhere for canonical looking error messages.
2022-10-06 16:43:16 -07:00
Brandt Bucher 21a2d9ff55
GH-97002: Prevent _PyInterpreterFrames from backing more than one PyFrameObject (GH-97996) 2022-10-07 00:20:01 +01:00
Lysandros Nikolaou cbf0afd8a1
gh-97973: Return all necessary information from the tokenizer (GH-97984)
Right now, the tokenizer only returns type and two pointers to the start and end of the token.
This PR modifies the tokenizer to return the type and set all of the necessary information,
so that the parser does not have to this.
2022-10-06 16:07:17 -07:00
Dong-hee Na b9d2e81716
fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). (gh-97965) 2022-10-06 15:57:37 -07:00
Brett Cannon e1c4d56fdd
gh-65961: Do not rely solely on __cached__ (GH-97990)
Make sure `__spec__.cached` (at minimum) can be used.
2022-10-06 15:40:22 -07:00
Brett Cannon f8edc6ff53
gh-97850: Remove the open issues section from the import reference (#97935)
Remove the open issues section from the import reference

Tracking in https://github.com/python/cpython/issues/97850 instead.
2022-10-06 14:01:06 -07:00
Hugo van Kemenade 993de50e44
Docs: pin sphinx-lint (GH-97992) 2022-10-06 13:58:41 -07:00
Erik Welch 1c4728cc29
gh-94590: add signatures to operator itemgetter, attrgetter, methodcaller (#94591)
These were intentionally skipped when operator was updated to use the argument clinic:
https://github.com/python/cpython/issues/64385#issuecomment-1093641466

However, by not using the argument clinic, they missed out on getting signatures.
This is a narrow PR to update the docstrings so that `__text_signature__` can be
extracted from them.  Updating to use the argument clinic is beyond scope.

`methodcaller` uses `*args, **kwargs` to match variadic names used elsewhere,
including in `operator.call`.
2022-10-06 13:35:53 -07:00
Barry Warsaw effc25f7f2
Add Pynche's move to the What's new in 3.11 (#97974)
* Add Pynche's move to the What's new in 3.11

* Update Doc/whatsnew/3.11.rst

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-06 13:29:52 -07:00
Jason R. Coombs 8af04cdef2
gh-97781: Apply changes from importlib_metadata 5. (GH-97785)
* gh-97781: Apply changes from importlib_metadata 5.

* Apply changes from upstream

* Apply changes from upstream.
2022-10-06 15:25:24 -04:00
Terry Jan Reedy 2b5f1360ea
gh-86482: Document assignment expression need for ()s (#23291)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-06 12:24:17 -07:00
larryhastings 6bfb0be804
gh-97943: PyFunction_GetAnnotations should return a borrowed reference. (#97949) 2022-10-06 12:23:20 -07:00
Michael Droettboom 23e83a8465
gh-94808: Coverage: Test that maximum indentation level is handled (#95926)
* gh-94808: Coverage: Test that maximum indentation level is handled

* Use "compile" rather than "exec"
2022-10-06 10:39:17 -07:00
Kumar Aditya e2e6b95c03
GH-88050: fix race in closing subprocess pipe in asyncio (#97951)
Check for None when iterating over `self._pipes.values()`.
2022-10-06 10:18:19 -07:00