Commit graph

112538 commits

Author SHA1 Message Date
Andrew Svetlov 1f9d4c93af
Raise TypeError if SSLSocket is passed to asyncio transport-based methods (GH-31442) 2022-02-20 14:17:15 +02:00
Nikita Sobolev 4ab8167b9c
bpo-46672: fix NameError in asyncio.gather if type check fails (GH-31187)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-02-20 12:24:00 +02:00
Andrew Svetlov e7130c2e8c
bpo-46752: Uniform TaskGroup.__repr__ (GH-31409) 2022-02-20 12:07:00 +02:00
Raymond Hettinger 12a2e41e8a
Improve discussion about how __getattr__ is invoked. (GH-31435) 2022-02-19 23:02:30 -06:00
Jelle Zijlstra 0a8a8e7454
bpo-46066: Check DeprecationWarning in test_typing (GH-31428) 2022-02-19 17:44:51 -08:00
Dennis Sweeney 7a4791e036
Use raw string to avoid deprecation warning (GH-31427) 2022-02-19 00:57:36 -05:00
Inada Naoki 5543d9c559
dict: Use DK_LOG_SIZE in hot loop. (GH-31405)
DK_LOG_SIZE(key) < 8 is faster than DK_SIZE(key) <= 0xff, at least on GCC.
2022-02-19 13:15:20 +09:00
Charles Brunet 99331fcf17
Counter doc mentions three methods, but lists four (GH-30706)
Was probably caused by the addition of the `total()` method
2022-02-18 18:23:53 -08:00
Nikita Sobolev 32e3e0bea6
bpo-46685: improve test coverage of Self and Never in typing (GH-31222) 2022-02-18 17:56:30 -08:00
Nikita Sobolev 25c0b9d243
bpo-46603: improve coverage of typing._strip_annotations (GH-31063) 2022-02-18 17:54:01 -08:00
Nikita Sobolev 395029b0bd
bpo-46571: improve typing.no_type_check to skip foreign objects (GH-31042)
There are several changes:
1. We now don't explicitly check for any base / sub types, because new name check covers it
2. I've also checked that `no_type_check` do not modify foreign functions. It was the same as with `type`s
3. I've also covered `except TypeError` in `no_type_check` with a simple test case, it was not covered at all
4. I also felt like adding `lambda` test is a good idea: because `lambda` is a bit of both in class bodies: a function and an assignment

<!-- issue-number: [bpo-46571](https://bugs.python.org/issue46571) -->
https://bugs.python.org/issue46571
<!-- /issue-number -->
2022-02-18 17:53:29 -08:00
Jörn Heissler f80a97b492
[docs] Correct typos in SSLContext.sni_callback (GH-30623)
Co-authored-by: Jörn Heissler <nosuchaddress@joern-heissler.de>
2022-02-18 17:49:04 -08:00
Yilei "Dolee" Yang 6312c1052c
bpo-46784: Add newly exported expat symbols to the namespace. (GH-31397)
The libexpat 2.4.1 upgrade from  introduced the following new exported symbols:

* `testingAccountingGetCountBytesDirect`
* `testingAccountingGetCountBytesIndirect`
* `unsignedCharToPrintable`
* `XML_SetBillionLaughsAttackProtectionActivationThreshold`
* `XML_SetBillionLaughsAttackProtectionMaximumAmplification`

We need to adjust [Modules/expat/pyexpatns.h](https://github.com/python/cpython/blob/master/Modules/expat/pyexpatns.h)

(The newer libexpat upgrade  has no new symbols).

Automerge-Triggered-By: GH:gpshead
2022-02-18 14:33:06 -08:00
Hugo van Kemenade 892ff93d7f
Process more stale PRs, oldest first (GH-31407) 2022-02-18 11:28:12 -08:00
Brandt Bucher 91cc5fd14c
"Own" pattern matching and peepholing (GH-31412) 2022-02-18 19:57:02 +01:00
Guido van Rossum 80a9ba537f
Reduce flakiness of taskgroups test 13 (GH-31411) 2022-02-18 09:28:56 -08:00
Mark Shannon cf345e945f
bpo-46329: Change calling sequence (again) (GH-31373)
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
2022-02-18 17:19:08 +00:00
Nikita Sobolev e2c28616ce
bpo-46709: check eval breaker in specialized CALL opcodes (GH-31404) 2022-02-18 12:56:23 +00:00
Saul Shanabrook c3ce7781e3
bpo-46724: Fix dis support for overflow args (GH-31285) 2022-02-18 09:56:23 +00:00
Serhiy Storchaka 2923d87ca2
bpo-46777: Fix incorrect use of directives in asyncio documentation (GH-31388) 2022-02-18 10:58:48 +02:00
Guido van Rossum d85121660e
bpo-46752: Slight improvements to TaskGroup API (GH-31398)
* Remove task group names (for now)

We're not sure that they are needed, and once in the code
we would never be able to get rid of them.

Yury wrote:

> Ideally, there should be a way for someone to build a "trace"
> of taskgroups/task leading to the current running task.
> We could do that using contextvars, but I'm not sure we should
> do that in 3.11.

* Pass optional name on to task in create_task()

* Remove a bunch of unused stuff
2022-02-17 21:30:44 -08:00
辰冢 2a38e1ab65
Fix missing spaces in os.walk example (GH-29918) 2022-02-17 23:10:33 -05:00
Patrick Reader 5f1c205dce
Fix mistake in barry_as_FLUFL test (GH-31392)
Use assertEqual(), not assertTrue(lineno, 2)
2022-02-17 20:45:35 -05:00
William Andrea 35f55cc5c6
docs: Link match statement in tutorial (GH-31396)
Add a link to the `match` statement from its section in the tutorial.

This should be backported to 3.10.

[Initially submitted as #31395 but against the wrong branch. Thanks @Mariatta]

Automerge-Triggered-By: GH:Mariatta
2022-02-17 16:02:42 -08:00
Alexander Münch aa1ccbc76c
Fix typo in compileall.py's docstring (GH-29865) 2022-02-17 15:45:27 -05:00
Hakan Çelik 02815d9393
bpo-29418: Add inspect.ismethodwrapper to whatsnew (GH-31377) 2022-02-17 22:45:55 +03:00
Christian Heimes 9e06d03672
bpo-46730: Fix refleak and tighten NULL checks (GH-31389)
``PyType_GetQualName`` returns a new reference.

Signed-off-by: Christian Heimes <christian@python.org>
2022-02-17 14:27:42 -05:00
Jeremy Kloth 98dd0aec2d
bpo-46778: Enable multiprocess compilation for source files when building on Windows (GH-31390) 2022-02-17 18:40:33 +00:00
Géry Ogam 2945f5a7c5
Update html.parser.rst (GH-30678)
This PR for the documentation of the [html.parser](https://docs.python.org/3/library/html.parser.html) module will

- fix a terminology mistake (‘start of a tag’ -> ‘start tag of an element’);
- mention the parameter names of the `HTMLParser.handle_*` methods where missing.
2022-02-17 04:20:40 -08:00
Brian Faherty fc115c9bde
bpo-41086: Add exception for uninstantiated interpolation (configparser) (GH-21062)
* Add exception for uninstantiated interpolation (configparser)

The current feedback when users try to pass an uninstantiated
interpolation into a ConfigParser is an error message that does not help
users solve the problem. This current error of `TypeError: before_set()
missing 1 required positional argument: 'value'` does not display until
the parser is used, which usually results in the assumption that
instantiation of the parser was done correctly. The new exception of
InterpolationTypeError, will be raised on the line where the
ConfigParser is instantiated. This will result in users see the line
that has the error in their backtrace for faster debugging.

There have been a number of bugs created in the issue tracker, which
could have been addressed by:
https://bugs.python.org/issue26831 and https://bugs.python.org/issue26469

* 📜🤖 Added by blurb_it.

* Replace custom Error with TypeError

Per feedback from @iritkatriel, the custom InterpolationTypeError has
been dropped in favour of a TypeError with a custom message, and the
unittests have been expanded.

* More verbose message

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-02-17 13:17:43 +01:00
Erlend Egeberg Aasland 5bc4327e2c
Close stale PRs without signed CLA (GH-30500)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-02-17 09:20:40 +01:00
Robert-André Mauchin 482a4b6c3f
bpo-46745: Fix typo in PositionsIterator (#31322)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-16 21:20:06 -08:00
Dong-hee Na 8cb5f707a8
bpo-46541: Remove usage of _Py_IDENTIFIER from array module (GH-31376) 2022-02-17 13:02:17 +09:00
aha79 6e7b813195
bpo-46333: Honor module parameter in ForwardRef (GH-30536)
The `module` parameter carries semantic information about the forward ref.
Forward refs are different if they refer to different module even if they
have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods.

Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-02-16 19:28:18 -08:00
97littleleaf11 de6043e596
bpo-46066: Deprecate kwargs syntax for TypedDict definitions (GH-31126)
Closes python/typing#981

https://bugs.python.org/issue46066
2022-02-16 19:26:07 -08:00
Jelle Zijlstra 6f1efd19a7
Become a CODEOWNER for typing (#31374) 2022-02-16 11:02:06 -08:00
Brandt Bucher 580cd9ab29
bpo-46072: Add detailed failure stats for BINARY_OP (GH-31289) 2022-02-16 08:49:58 -08:00
Brandt Bucher a9da085015
bpo-46702: Specialize UNPACK_SEQUENCE (GH-31240) 2022-02-16 08:48:16 -08:00
Dong-hee Na e8a19b092f
bpo-46541: Remove usage of _Py_IDENTIFIER from mmap module (GH-31375) 2022-02-17 01:04:38 +09:00
Erlend Egeberg Aasland b2077117d1
bpo-46541: Replace _Py_IDENTIFIER with _Py_ID in sqlite3 (GH-31351) 2022-02-17 00:24:44 +09:00
Dong-hee Na d64f3caebe
bpo-46541: Remove usage of _Py_IDENTIFIER from csv module (GH-31372) 2022-02-17 00:24:03 +09:00
Hakan Çelik 562c13f573
bpo-29418: Implement inspect.ismethodwrapper and fix inspect.isroutine for cases where methodwrapper is given (GH-19261)
Automerge-Triggered-By: GH:isidentical
2022-02-16 04:46:20 -08:00
Mark Shannon 3954fcb83f
Remove offsets from expected output in test.test_dis (GH-31369) 2022-02-16 12:19:09 +00:00
Eric V. Smith ffd9f8ff84
bpo-46762: Fix an assert failure in f-strings where > or < is the last character if the f-string is missing a trailing right brace. (#31365) 2022-02-16 05:54:09 -05:00
Dong-hee Na e59309b9d0
bpo-46541: Remove usage of _Py_IDENTIFIER from dbms modules (GH-31358) 2022-02-16 18:57:28 +09:00
Alex-Blade 0cb765b2ce
bpo-46730: Add more info to @property AttributeError messages (GH-31311)
On `obj.read_only_property = x`, raise `AttributeError: property 'read_only_property' of 'A' object has no setter`.
2022-02-16 02:07:34 -05:00
Eric Snow 4d8a515d19
bpo-46541: Scan Fewer Files in generate_global_objects.py (gh-31364)
https://bugs.python.org/issue46541
2022-02-15 20:07:11 -07:00
Eric Snow 6c89589486
bpo-46541: Drop the check for orphaned global strings. (gh-31363)
https://bugs.python.org/issue46541
2022-02-15 20:06:38 -07:00
Guido van Rossum 602630ac18
bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)
asyncio/taskgroups.py is an adaptation of taskgroup.py from EdgeDb, with the following key changes:

- Allow creating new tasks as long as the last task hasn't finished
- Raise [Base]ExceptionGroup (directly) rather than TaskGroupError deriving from MultiError
- Instead of monkey-patching the parent task's cancel() method,
  add a new public API to Task

The Task class has a new internal flag, `_cancel_requested`, which is set when `.cancel()` is called successfully. The `.cancelling()` method returns the value of this flag. Further `.cancel()` calls while this flag is set return False. To reset this flag, call `.uncancel()`.

Thus, a Task that catches and ignores `CancelledError` should call `.uncancel()` if it wants to be cancellable again; until it does so, it is deemed to be busy with uninterruptible cleanup.

This new Task API helps solve the problem where TaskGroup needs to distinguish between whether the parent task being cancelled "from the outside" vs. "from inside".

Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-15 15:42:04 -08:00
Zackery Spytz 08ec80113b
bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360) 2022-02-15 17:12:15 -06:00