Commit Graph

47507 Commits

Author SHA1 Message Date
Pablo Galindo Salgado b6bde9fc42
bpo-44667: Treat correctly lines ending with comments and no newlines in the Python tokenizer (GH-27499) 2021-07-31 02:17:09 +01:00
Jason R. Coombs e63e6311aa
bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. (#27497)
* bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak.

* Include new 'resources' dir in the Makefile.
2021-07-30 20:37:09 -04:00
andrei kulakov 48a62559df
bpo-44648: Fix error type in inspect.getsource() in interactive session (GH-27171) 2021-07-30 19:17:46 +02:00
andrei kulakov ceea579ccc
bpo-43625: Enhance csv sniffer has_headers() to be more accurate (GH-26939) 2021-07-30 19:10:37 +02:00
andrei kulakov e3f877c32d
bpo-42892: fix email multipart attribute error (GH-26903) 2021-07-30 19:05:49 +02:00
Stefan Hoelzl 80f0707629
bpo-44666: Use default encoding as fallback for compile_file (GH-27236)
When sys.stdout.encoding is None compile_file will fall back to
sys.getdefaultencoding to encode/decode error messages.

Co-authored-by: Stefan Hoelzl <stefan.hoelzl@posteo.de>
Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
2021-07-30 18:38:42 +02:00
Noah Kantrowitz be42c06bb0
Update URLs in comments and metadata to use HTTPS (GH-27458) 2021-07-30 15:54:46 +02:00
Yurii Karabas ea4673ed07
bpo-44747: Refactor usage of sys._getframe at typing module (#27387)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-30 15:49:24 +02:00
Yurii Karabas 7b975f81e4
bpo-44761: Change default value of NewType __module__ attr (GH-27406) 2021-07-30 14:56:12 +02:00
Vinay Sajip 6ff8903809
bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475) 2021-07-30 12:48:50 +01:00
Jason R. Coombs aaa83cdfab
bpo-44771: Apply changes from importlib_resources 5.2.1 (GH-27436)
* bpo-44771: Apply changes from importlib_resources@3b24bd6307

* Add blurb

* Exclude namespacedata01 from eol conversion.
2021-07-29 21:05:05 -04:00
Erlend Egeberg Aasland 7e311e496b
bpo-31746: Prevent segfaults when sqlite3.Connection is uninitialised (GH-27431) 2021-07-29 20:45:32 +01:00
Yurii Karabas 8182c8329c
bpo-44662: Add ability to annotate types.Union (#27214)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-29 21:44:48 +02:00
Hai Shi 9101b39e67
To fix the random failed test cases of test___xxsubinterpreters in multiprocess. (GH-27240) 2021-07-29 19:05:49 +02:00
Irit Katriel ddd1c418c0
bpo-44725 : expose specialization stats in python (GH-27192) 2021-07-29 17:26:53 +01:00
Jack DeVries 6741794dd4
bpo-44752: refactor part of rlcompleter.Completer.attr_matches (GH-27433) 2021-07-29 16:01:21 +02:00
Jack DeVries 50de8f74f8
bpo-44752: Make rlcompleter not call `@property` methods (GH-27401)
* rlcompleter was calling these methods to identify whether to add
  parenthesis to the completion, based on if the attribute is callable.
* for property objects, completion with parenthesis are never desirable.
* property methods with print statements behaved very strangely, which
  was especially unfriendly to language newcomers. <tab> could suddenly
  produce output unexpectedly.
2021-07-29 13:40:29 +02:00
Erlend Egeberg Aasland 5269c09145
bpo-44688: Remove ASCII limitation from `sqlite3` collation names (GH-27395) 2021-07-29 09:47:56 +02:00
Brandt Bucher 8d0647485d
bpo-43897: Reject "_" captures and top-level MatchStar in the AST validator (GH-27432) 2021-07-28 17:24:18 -07:00
Batuhan Taskaya 31bec6f1b1
bpo-43897: AST validation for pattern matching nodes (GH24771) 2021-07-28 10:14:45 -07:00
andrei kulakov 53b9458f2e
bpo-44682: Handle invalid arg to pdb's "commands" directive (#27252) 2021-07-28 18:55:03 +02:00
Barney Gale 56c1f6d7ed
bpo-27827: identify a greater range of reserved filename on Windows. (GH-26698)
`pathlib.PureWindowsPath.is_reserved()` now identifies as reserved
filenames with trailing spaces or colons.

Co-authored-by: Barney Gale <barney.gale@foundry.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
2021-07-28 16:28:14 +02:00
Anton Grübel 9ffbb89946
Change type check to isinstance in pipes (GH-27291) 2021-07-28 15:38:06 +02:00
Jason R. Coombs ee03bad25e
bpo-44461: Check early that a pdb target is valid for execution. (#27227)
* bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a __main__ module

* 📜🤖 Added by blurb_it.

* remove "else"

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-07-27 21:51:42 -04:00
Brandt Bucher 38ddc8beb3
bpo-44600: Refactor new tracing tests (GH-27396) 2021-07-27 17:51:49 -07:00
Pablo Galindo Salgado ecc3c8e421
bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392) 2021-07-27 21:30:32 +01:00
Pablo Galindo Salgado 6948964ecf
bpo-34013: Generalize the invalid legacy statement error message (GH-27389) 2021-07-27 17:19:22 +01:00
Mariusz Felisiak 11749e2dc2
bpo-44740: Lowercase "internet" and "web" where appropriate. (#27378)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-27 00:11:55 +02:00
Nick Coghlan a2c45e5bcf
bpo-44515: handle non-refcounted GC in contextlib tests (GH-26910)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-26 22:57:17 +02:00
T. Wouters 1d582bbc96
bpo-44698: Fix undefined behaviour in complex exponentiation. (GH-27278) 2021-07-26 18:03:35 +02:00
Hasan 2b8ad9e6c5
bpo-44732: Rename types.Union to types.UnionType (#27342)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-07-26 18:00:21 +02:00
Logan Jones 3f135c073a
bpo-44734: Fix precision in turtle tests (GH-27343) 2021-07-26 17:21:09 +02:00
Mark Shannon ae0a2b7562
bpo-44590: Lazily allocate frame objects (GH-27077)
* Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it.

* Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector.

* Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation.

* Move ownership of InterpreterFrame in generator from frame object to generator object.

* Do not create frame objects for Python calls.

* Do not create frame objects for generators.
2021-07-26 11:22:16 +01:00
Charles Burkland 4214f470f0
bpo-44600: Fix line numbers for pattern matching cleanup code (GH-27346) 2021-07-25 16:42:07 -07:00
Batuhan Taskaya 3e235e0447
bpo-43950: support some multi-line expressions for PEP 657 (GH-27339)
This is basically something that I noticed up while fixing test runs for another issue. It is really common to have multiline calls, and when they fail the display is kind of weird since we omit the annotations. E.g;

```
 $ ./python t.py
Traceback (most recent call last):
  File "/home/isidentical/cpython/cpython/t.py", line 11, in <module>
    frame_1()
    ^^^^^^^^^
  File "/home/isidentical/cpython/cpython/t.py", line 5, in frame_1
    frame_2(              
  File "/home/isidentical/cpython/cpython/t.py", line 2, in frame_2
    return a / 0 / b / c
           ~~^~~
ZeroDivisionError: division by zero
```

This patch basically adds support for annotating the rest of the line, if the instruction covers multiple lines (start_line != end_line).

Automerge-Triggered-By: GH:isidentical
2021-07-25 15:01:44 -07:00
andrei kulakov 96cf5a63d2
bpo-42378: fixed log truncation on logging shutdown (GH-27310)
Automerge-Triggered-By: GH:vsajip
2021-07-25 13:17:47 -07:00
Filipe Laíns 0a8ae8a50a
bpo-44717: improve AttributeError on circular imports of submodules (GH-27338) 2021-07-24 23:44:46 +01:00
Serhiy Storchaka 435a0334d3
bpo-44676: Serialize the union type using only public API (GH-27323)
Remove also the _from_args() constructor.
2021-07-24 21:26:02 +03:00
Batuhan Taskaya 4f5980a4f5
bpo-43950: support long lines in traceback.py (GH-27336) 2021-07-24 20:50:39 +03:00
Serhiy Storchaka 0828423127
bpo-44731: Simplify the union type implementation (GH-27318)
Remove direct support of typing types in the C code because they are already supported by defining methods __or__ and __ror__ in the Python code.
2021-07-24 14:34:48 +01:00
Pablo Galindo Salgado 3eae8f20d7
Revert "bpo-44717: improve AttributeError on circular imports of submodules (GH-27299)" (GH-27331)
This reverts commit 8072a1181d.
2021-07-24 14:33:03 +01:00
Batuhan Taskaya c8362314cc
bpo-43950: ensure source_line is present when specialising the traceback (GH-27313) 2021-07-24 13:50:19 +01:00
Yurii Karabas a22b05da87
bpo-44353: Improve tests covering typing.NewType pickling (GH-27302) 2021-07-24 11:53:40 +02:00
Filipe Laíns 8072a1181d
bpo-44717: improve AttributeError on circular imports of submodules (GH-27299)
Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-24 11:50:17 +02:00
Dennis Sweeney 5370f0a82a
bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ (GH-27316) 2021-07-24 11:17:19 +02:00
Serhiy Storchaka e89ef0ad2a
bpo-44353: Expand NewType tests for complex __qualname__. (#27311)
Make NewType pickleable by name.
2021-07-24 09:40:08 +02:00
Sebastian Rittau 4512848ab9
Fix a deprecation warning in typing tests (#27312)
The test was accessing typing.{io,re}.__all__, which triggered the
warning. This check isn't necessary anymore, since the objects from
typing.{io,re}.__all__ are in typing.__all__ as well, since Python 3.10.
2021-07-23 11:53:29 -07:00
Yurii Karabas 8f42106b5c
bpo-44353: Fix memory leak introduced by GH-27262 (GH-27305) 2021-07-23 16:28:05 +02:00
seb-hub 7d28a6eb90
Improve consistency of colorsys.rgb_to_hsv (GH-27277)
Cache repeated difference to make code easier to read and consistent with colorsys.rgb_to_hls.
2021-07-23 09:59:30 -03:00
Anthony Sottile 17575f73ce
bpo-29298: Fix crash with required subparsers without dest (GH-3680)
Automerge-Triggered-By: GH:encukou
2021-07-23 05:49:04 -07:00
Yurii Karabas fe13f0b0f6
bpo-44676: Add ability to serialize types.Union (GH-27244) 2021-07-23 11:47:00 +02:00
Serhiy Storchaka 2e3744d50b
bpo-44653: Support typing types in parameter substitution in the union type. (GH-27247) 2021-07-22 23:57:06 +02:00
Yurii Karabas 96c4cbd96c
bpo-44353: Implement typing.NewType __call__ method in C (#27262)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Denis Laxalde <denis@laxalde.org>
2021-07-22 23:06:54 +02:00
Łukasz Langa f1afef5e0d
bpo-44708: Only re-run test methods that match names of previously failing test methods (GH-27287)
* Move to a static argparse.Namespace subclass
* Roughly annotate runtest.py
* Refactor libregrtest to use lossless test result objects
* Only re-run test methods that match names of previously failing test methods
* Adopt tests to cover test method name matching

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-07-22 20:25:58 +02:00
Jacob Walls c0f2fcf9bb
Speed up test_urlsplit_normalization (GH-26688) 2021-07-22 10:45:53 +03:00
Dennis Sweeney c878f5d817
bpo-44704: Make Set._hash consistent with frozenset.__hash__ (GH-27281) 2021-07-21 18:49:03 -05:00
Thomas Grainger ab7fcc8fbd
bpo-44686 replace unittest.mock._importer with pkgutil.resolve_name (GH-18544)
Automerge-Triggered-By: GH:cjw296
2021-07-21 04:47:44 -07:00
Mohamad Mansour 3b56b3b97d
bpo-44539: Support recognizing JPEG files without JFIF or Exif markers (GH-26964)
Co-authored-by: moemansour03@gmail.com <m.mansour@tecfrac.com>
Co-authored-by: Éric Araujo <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-20 20:56:57 +02:00
Jakub Kulík 6564656495
bpo-43219: skip Solaris in the test as well (GH-27257) 2021-07-20 11:16:23 -07:00
Thomas Grainger 7f1c330da3
bpo-44566: resolve differences between asynccontextmanager and contextmanager (#27024) 2021-07-20 20:15:07 +02:00
Leonardo Freua 85fa3b6b7c
bpo-44631: Make the repr() of the _Environ class more readable. (#27128)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-20 19:15:45 +02:00
Yurii Karabas 4868b94c60
bpo-44353: Add test to cover __or__ of two NewType (#27259) 2021-07-20 16:48:05 +02:00
Yurii Karabas 965dd76e90
bpo-44353: Refactor typing.NewType into callable class (GH-27250) 2021-07-20 15:20:38 +02:00
Idan Moral 366fcbac18
bpo-44678: Separate error message for discontinuous padding in binascii.a2b_base64 strict mode (GH-27249)
* Renamed assertLeadingPadding function to match logic
* Added a separate error message for discontinuous padding
* Updated the tests for discontinuous padding
2021-07-19 15:42:19 -07:00
Yurii Karabas bce1418541
bpo-44524: Add missed __name__ and __qualname__ to typing module objects (#27237)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-19 19:22:12 +02:00
Zackery Spytz 89f4c34797
bpo-27513: email.utils.getaddresses() now handles Header objects (#13797)
getaddresses() should be able to handle a Header object if passed
one.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-19 18:07:54 +02:00
Mark Shannon d09c134178
bpo-44645: Check for interrupts on any potentially backwards edge (GH-27216) 2021-07-19 11:10:21 +01:00
Irit Katriel aab1899c9d
bpo-41546: make pprint (like print) not write to stdout when it is None (GH-26810) 2021-07-19 10:19:02 +01:00
Jason R. Coombs 2c20558844
bpo-44554: refactor pdb targets (and internal tweaks) (GH-26992)
- Refactor module/script handling to share an interface (check method).
- Import functools and adjust tests for the new line number for find_function.
- Use cached_property for details.
- Add blurb.

Automerge-Triggered-By: GH:jaraco
2021-07-18 18:00:35 -07:00
Idan Moral 35b98e38b6
bpo-43086: Add handling for out-of-spec data in a2b_base64 (GH-24402)
binascii.a2b_base64 gains a strict_mode= parameter. When enabled it will raise an
error on input that deviates from the base64 spec in any way.  The default remains
False for backward compatibility.

Code reviews and minor tweaks by: Gregory P. Smith <greg@krypto.org> [Google]
2021-07-18 17:45:19 -07:00
Batuhan Taskaya a045991f60
bpo-42355: symtable.get_namespace() now checks whether there are multiple or any namespaces found (GH-23278) 2021-07-18 15:56:09 +03:00
Serhiy Storchaka 3ea5332a43
bpo-44633: Fix parameter substitution of the union type with wrong types. (GH-27218)
A TypeError is now raised instead of returning NotImplemented.
2021-07-18 12:10:19 +03:00
Serhiy Storchaka 0fd27375ca
bpo-44654: Refactor and clean up the union type implementation (GH-27196) 2021-07-17 22:44:10 +03:00
Hasan 689b05c628
bpo-42095: plistlib: Add tests that compare with plutil(1) (#27173)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-17 12:11:04 +02:00
Germán Méndez Bravo 889036f7ef
bpo-41249: Fix postponed annotations for TypedDict (GH-27017)
This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules.

This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation.

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-16 20:49:30 -07:00
Yurii Karabas bf89ff96e6
bpo-44490: Improve typing module compatibility with types.Union (GH-27048) 2021-07-16 20:33:40 -07:00
Pablo Galindo Salgado f783428a23
bpo-44655: Include the name of the type in unset __slots__ attribute errors (GH-27199) 2021-07-17 00:34:46 +01:00
Pablo Galindo Salgado 6714dec5e1
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) 2021-07-16 21:58:21 +01:00
Pablo Galindo Salgado c90c591e51
Revert "bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167)" (#27194)
This reverts commit 000e70ad52.
2021-07-16 19:05:47 +02:00
Batuhan Taskaya 9af34c9351
bpo-20201: variadic arguments support for AC (GH-18609)
Implement support for `*args` in AC, and port `print()` to use it.
2021-07-16 18:43:02 +03:00
Łukasz Langa 7915c96ffd
bpo-44647: Add a permanent Unicode-valued env var to regrtest (#27187) 2021-07-16 15:24:02 +02:00
Serhiy Storchaka 0cd2d51aad
bpo-44652: Preserve natural order of args in the union type. (GH-27185) 2021-07-16 16:11:30 +03:00
Weipeng Hong 6aab5f9bf3
bpo-40897:Give priority to using the current class constructor in `inspect.signature` (#27177)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-16 15:04:27 +02:00
Ammar Askar 8ce3008585
bpo-44569: Decouple frame formatting in traceback.py (GH-27038) 2021-07-16 13:21:16 +01:00
Pablo Galindo Salgado a283ef116b
Remove unnecessary 'invalid_primary' rule in the parser (GH-27186) 2021-07-16 13:20:09 +01:00
Mark Shannon 000e70ad52
bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167) 2021-07-16 10:59:31 +01:00
Serhiy Storchaka d9f923280f
bpo-44636: Collapse union of equal types (GH-27178)
The result of `int | int` is now `int`.

Fix comparison of the union type with non-hashable objects.
`int | str == {}` no longer raises a TypeError.
2021-07-16 12:49:33 +03:00
Serhiy Storchaka aeaa553d65
bpo-44646: Fix the hash of the union type. (#27179)
It no longer depends on the order of arguments.
hash(int | str) == hash(str | int)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
2021-07-16 10:34:56 +02:00
Batuhan Taskaya 919ad53751
bpo-43950: make BinOp specializations more reliable (GH-27126) 2021-07-16 00:38:11 +01:00
Łukasz Langa 82b218f36c
bpo-44647: Fix test_httpservers failing on Unicode characters in os.environ on Windows (GH-27161)
GH-23638 introduced a new test for Accept: headers in CGI HTTP servers. This test serializes all of os.environ on the server side. For non-UTF8 locales this can fail for some Unicode characters found in environment variables. This change fixes the HTTP_ACCEPT test.
2021-07-15 21:14:24 +02:00
Mark Shannon a86f7dae0a
bpo-44626: Merge basic blocks earlier to enable better handling of exit blocks without line numbers (GH-27138) 2021-07-15 17:46:55 +01:00
Pablo Galindo Salgado 4cb7263f0c
Remove sys._deactivate_opcache() now that is not needed (GH-27154) 2021-07-15 14:43:59 +01:00
Mark Shannon f333ab0f2e
bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160) 2021-07-15 14:37:57 +01:00
Łukasz Langa b83861f026
bpo-42073: allow classmethod to wrap other classmethod-like descriptors (#27115)
Patch by Erik Welch.

bpo-19072 (#8405) allows `classmethod` to wrap other descriptors, but this does
not work when the wrapped descriptor mimics classmethod.  The current PR fixes
this.

In Python 3.8 and before, one could create a callable descriptor such that this
works as expected (see Lib/test/test_decorators.py for examples):
```python
class A:
    @myclassmethod
    def f1(cls):
        return cls

    @classmethod
    @myclassmethod
    def f2(cls):
        return cls
```
In Python 3.8 and before, `A.f2()` return `A`. Currently in Python 3.9, it
returns `type(A)`.  This PR make `A.f2()` return `A` again.

As of #8405, classmethod calls `obj.__get__(type)` if `obj` has `__get__`.
This allows one to chain `@classmethod` and `@property` together.  When
using classmethod-like descriptors, it's the second argument to `__get__`--the
owner or the type--that is important, but this argument is currently missing.
Since it is None, the "owner" argument is assumed to be the type of the first
argument, which, in this case, is wrong (we want `A`, not `type(A)`).

This PR updates classmethod to call `obj.__get__(type, type)` if `obj` has
`__get__`.

Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
2021-07-15 15:16:19 +02:00
Irit Katriel 641345d636
bpo-26280: Port BINARY_SUBSCR to PEP 659 adaptive interpreter (GH-27043) 2021-07-15 13:13:12 +01:00
Leonardo Freua a0551059ba
Remove unnecessary pass statement in msvccompiler.py (GH-27123) 2021-07-15 12:59:01 +02:00
andrei kulakov b39eea06d1
bpo-42799: fnmatch module: bump up size of lru_cache for patterns (GH-27084) 2021-07-15 12:53:26 +02:00
Elisha Hollander 3527569f1c
Remove unnecessary test for `xc == 1` in _pydecimal (GH-27102)
- if `xc == 1` then the function returns on line 2140;
- other assignments to `xc` are inside the `y.sign == 1` condition block which always returns early
2021-07-15 12:48:46 +02:00
Tzu-ping Chung 28544609cb
Fix osx_framework_user include to match distutils (#27093) 2021-07-15 11:44:04 +02:00
Jack DeVries 2693132292
bpo-44589: raise a SyntaxError when mapping patterns have duplicate literal keys (GH-27131) 2021-07-14 17:38:42 -07:00
Vinay Sajip 3b8075f907
bpo-44473: Update docstring and documentation for QueueHandler.prepar… (GH-27140)
…e().
2021-07-14 17:06:48 -07:00
Shane Harvey d59d7374a3
bpo-34932: Add socket.TCP_KEEPALIVE for macOS (GH-25079) 2021-07-14 23:53:15 +01:00
Serhiy Storchaka a158b20019
bpo-44632: Fix support of TypeVar in the union type (GH-27139)
int | TypeVar('T') returns now an instance of types.Union
instead of typing.Union.
2021-07-14 20:09:15 +03:00
Serhiy Storchaka b81cac0560
bpo-44635: Convert None to NoneType in the union type constructor (GH-27136) 2021-07-14 19:54:54 +03:00
Mark Shannon e5862f79c1
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) 2021-07-14 10:08:38 +01:00
Serhiy Storchaka f572cbf1fa
bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)
if it is called with a sequence or set, but not list or tuple.
2021-07-14 08:19:18 +03:00
Serhiy Storchaka 81989058de
bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. (GH-27120)
* Fix issubclass() for None.
  E.g. issubclass(type(None), int | None) returns now True.
* Fix issubclass() for virtual subclasses.
  E.g. issubclass(dict, int | collections.abc.Mapping) returns now True.
* Fix crash in isinstance() if the check for one of items raises exception.
2021-07-14 07:35:39 +03:00
T. Wouters 0093876328
bpo-44630: Fix assertion errors in csv module (GH-27127)
Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).

Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.

Contributed-By: T. Wouters [Google]
2021-07-13 15:56:45 -07:00
Serhiy Storchaka 054e9c84ac
bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-07-13 22:27:50 +01:00
Konstantin-Glukhov 0ee0a740e1
bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) 2021-07-13 20:21:48 +01:00
jsnklln 2924bb1a56
bpo-38741: Definition of multiple ']' in header configparser (GH-17129)
Co-authored-by: Jason Killen <jason.killen@windsorcircle.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-07-13 15:54:06 +02:00
andrei kulakov d4a5f0b659
bpo-35113: clean up duplicate import and comment (#27073) 2021-07-13 15:42:56 +02:00
Elisha Hollander 62d55a4d11
Remove unnecessary pass statements (GH-27103) 2021-07-13 15:02:30 +02:00
Batuhan Taskaya 1890dd235f
bpo-43950: Specialize tracebacks for subscripts/binary ops (GH-27037)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-07-12 20:32:33 +01:00
Furkan Onder 66c5853406
bpo-26329: update os.path.normpath documentation (GH-20138)
* bpo-26329: update os.path.normpath documentation

* Update os.path.rst

* Update posixpath.py

* update Pathname Resolution note
2021-07-12 09:48:01 -03:00
Mark Shannon 9487a17e3c
bpo-44207: Add an internal version number to function objects. (GH-27078) 2021-07-12 10:01:01 +01:00
Filipe Laíns e14d5ae544
bpo-29753: revert 0d7ad9f (GH-19850) (GH-27085)
This reverts commit 0d7ad9fb38 as it has a regression.

See https://github.com/python/cpython/pull/19850#issuecomment-869410686
2021-07-11 17:43:50 +01:00
andrei kulakov 248173cc04
bpo-43219: shutil.copyfile, raise a less confusing exception instead of IsADirectoryError (GH-27049)
Fixes the misleading IsADirectoryError to be FileNotFoundError.
2021-07-09 20:47:41 -07:00
Pablo Galindo Salgado f24777c2b3
bpo-44317: Improve tokenizer errors with more informative locations (GH-26555) 2021-07-10 01:29:29 +01:00
Mark Shannon da6414f0ac
bpo-44570: Fix line tracing for forwards jumps to duplicated tails (GH-27068) 2021-07-08 19:21:09 +01:00
Filipe Laíns 91a8f8c16c
bpo-44446: support lineno being None in traceback.FrameSummary (GH-26781)
As of 088a15c49d, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-07-08 17:28:01 +01:00
Steve Dower bbf2fb6c7a
bpo-44582: Accelerate mimetypes.init on Windows with a native accelerator (GH-27059) 2021-07-08 16:48:42 +01:00
Erlend Egeberg Aasland a3739b207a
bpo-43908: Immutable types inherit vectorcall (GH-27001)
Heap types with the Py_TPFLAGS_IMMUTABLETYPE flag can now inherit the
PEP 590 vectorcall protocol.  Previously, this was only possible for static types.

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-07-08 12:48:01 +02:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 58248d9437
bpo-41137: Use utf-8 encoding while reading .pdbrc files (GH-21263) 2021-07-08 16:16:08 +09:00
Ammar Askar 052930f241
Remove __cleanenv from PEP-657 tests (GH-27060) 2021-07-07 22:47:50 +01:00
Ammar Askar 4823d9a512
bpo-43950: Add option to opt-out of PEP-657 (GH-27023)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2021-07-07 20:07:12 +01:00
Rupert Tombs 6bd3ecfc27
bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007) 2021-07-07 22:28:09 +09:00
Gabriele N. Tornetta 2f180ce2cb
bpo-44530: Add co_qualname field to PyCodeObject (GH-26941) 2021-07-07 12:21:51 +01:00
Yurii Karabas c45fa1a5d9
bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2021-07-06 11:04:33 -07:00
Sebastian Rittau 8b849ea0f3
bpo-38291: Fix a spurious warning when using help(object) (#27039)
help(object) via pydoc.TextDoc.docclass(object) iterates over the
subclasses of object, which includes typing.io and typing.re if typing
is imported. It tries to access cls.__module__ for each of those
sub-classes. This change suppresses warnings when accessing
cls.__module__.
2021-07-06 08:01:15 -07:00
Dong-hee Na 09302405d2
bpo-44558: Make the implementation consistency of operator.indexOf (GH-27012) 2021-07-05 18:04:36 +09:00
Jack DeVries abb08e3af6
bpo-44534: fix wording and docstring sync in unittest.Mock GH27000 2021-07-05 07:52:32 +01:00
Ammar Askar 5644c7b3ff
bpo-43950: Print columns in tracebacks (PEP 657) (GH-26958)
The traceback.c and traceback.py mechanisms now utilize the newly added code.co_positions and PyCode_Addr2Location
to print carets on the specific expressions involved in a traceback.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2021-07-05 00:14:33 +01:00
Batuhan Taskaya 693cec0e2d
bpo-43950: include position in dis.Instruction (GH-27015)
Automerge-Triggered-By: GH:isidentical
2021-07-04 12:05:05 -07:00
Batuhan Taskaya 44f91fc802
bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27011) 2021-07-04 11:02:16 -07:00
Irit Katriel d968a638fc
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) 2021-07-03 16:33:35 +01:00
Daniel Hillier 556d5ad11f
bpo-44129: Add descriptive global variables for general purpose bit flags (GH-26118)
Replace hex flag masks with named global variables to improve
readability.

eg.
    if flags & 0x800
becomes:
    if flags & _MASK_UTF_FILENAME
2021-07-03 17:37:57 +03:00
Ken Jin 1097384ce9
bpo-44553 : Implement GC methods for types.Union (GH-26993) 2021-07-03 15:12:11 +03:00
Pablo Galindo 98eee94421
bpo-43950: Add code.co_positions (PEP 657) (GH-26955)
This PR is part of PEP 657 and augments the compiler to emit ending
line numbers as well as starting and ending columns from the AST
into compiled code objects. This allows bytecodes to be correlated
to the exact source code ranges that generated them.

This information is made available through the following public APIs:

* The `co_positions` method on code objects.
* The C API function `PyCode_Addr2Location`.

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2021-07-02 15:10:11 +01:00
finefoot 85b920498b
bpo-30256: Add manager_owned keyword arg to AutoProxy (GH-16341)
Co-authored-by: Jordan Speicher <jordan@jspeicher.com>
2021-07-01 20:45:02 -07:00
Batuhan Taskaya 0d7f61ddb0
bpo-44313: bump up magic (#26983) 2021-07-01 22:25:10 +03:00
Illia Volochii ddd5f36971
bpo-43234: Prohibit non-ThreadPoolExecutor in loop.set_default_executor (GH-24540) 2021-07-01 17:46:49 +03:00
Illia Volochii a1092f6249
bpo-43216: Remove @asyncio.coroutine (GH-26369)
Remove the @asyncio.coroutine decorator
enabling legacy generator-based coroutines to be compatible with async/await
code; remove asyncio.coroutines.CoroWrapper used for wrapping
legacy coroutine objects in the debug mode.

The decorator has been deprecated
since Python 3.8 and the removal was initially scheduled for Python 3.10.
2021-07-01 15:13:59 +02:00
Dong-hee Na c8979f780e
bpo-43425: Update _osx_support not to use distutils.log (GH-26968) 2021-07-01 09:35:10 +09:00
Batuhan Taskaya 1b28187a0e
bpo-44313: generate LOAD_ATTR/CALL_FUNCTION for top-level imported objects (GH-26677) 2021-06-30 23:53:36 +01:00
Steve Dower 139de04518
bpo-41180: Replace marshal code.__new__ audit event with marshal.load[s] and marshal.dumps (GH-26961) 2021-06-30 17:21:37 +01:00
Illia Volochii 1d08d85cbe
bpo-43232: Remove previously deprecated methods on TransportSocket (GH-24538) 2021-06-30 09:19:09 +03:00
Pablo Galindo e2fea101fd
bpo-44523: Remove the pass-through for hash() in weakref proxy objects (GH-26950) 2021-06-29 23:58:45 +01:00
Serhiy Storchaka 6cb145d23f
bpo-44471: Change error type for bad objects in ExitStack.enter_context() (GH-26820)
A TypeError is now raised instead of an AttributeError in
ExitStack.enter_context() and AsyncExitStack.enter_async_context()
for objects which do not support the context manager or
asynchronous context manager protocols correspondingly.
2021-06-29 11:28:15 +03:00
Serhiy Storchaka 20a88004ba
bpo-12022: Change error type for bad objects in "with" and "async with" (GH-26809)
A TypeError is now raised instead of an AttributeError in
"with" and "async with" statements for objects which do not
support the context manager or asynchronous context manager
protocols correspondingly.
2021-06-29 11:27:04 +03:00
Jason R. Coombs efe7d08d17
bpo-44464: Remove special exclusion for flake8 in the deprecation warnings. (#26807)
Sync with importlib_metadata 4.6.
2021-06-27 17:59:18 -04:00
Ram Rachum 74d60eab55
Clarify the order of a stacked `abstractmethod` (GH-26892)
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
2021-06-27 21:02:23 +03:00
Miguel Brito ed1076428c
bpo-44110: Improve string's __getitem__ error message (GH-26042) 2021-06-27 15:04:57 +03:00
will-ca 7569c0fe91
bpo-44468: Never skip base classes in `typing.get_type_hints()`, even with invalid `.__module__`. (GH-26862) 2021-06-26 16:31:32 -07:00
Stéphane Bidoul 521ba8892e
Update vendored pip to 21.1.3 (GH-26912) 2021-06-26 17:22:48 +01:00
Brandt Bucher ca2009d72a
bpo-43977: Properly update the tp_flags of existing subclasses when their parents are registered (GH-26864) 2021-06-25 08:20:43 -07:00
Irit Katriel 22e7effad5
bpo-44498: suppress DeprecationWarnings for asynchat, asyncore and smtpd in tests (GH-26905) 2021-06-25 00:20:40 +01:00
Barry Warsaw 8488b85c63
bpo-44498: Issue a deprecation warning on asynchat, asyncore and smtpd import (#26882)
* Issue a deprecation warning on smtpd import

* Also issue DeprecationWarnings for asynchat and asyncore

* Fix some tests

* test___all__ requires the word 'module' or 'package' in the deprecation
  warning text, so add those to smtpd, asynchat, and asyncore.
* In test_support, use pprint now instead of asyncore as the landmark.

* Add What's New

* Use ..deprecated::

* Use ..deprecated::

* Update Lib/smtpd.py

Co-authored-by: Miro Hrončok <miro@hroncok.cz>

* Update Doc/library/smtpd.rst

Co-authored-by: Miro Hrončok <miro@hroncok.cz>

* Import async{hat,ore} after the DeprecationWarning for this module

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2021-06-24 12:37:26 -07:00
Pablo Galindo 0acc258fe6
bpo-44456: Improve the syntax error when mixing keyword and positional patterns (GH-26793) 2021-06-24 16:09:57 +01:00
Erlend Egeberg Aasland b19f455339
bpo-44491: Allow clearing the sqlite3 authoriser callback (GH-26863) 2021-06-24 15:35:57 +01:00
Mark Shannon 18ba1ff6a4
Make sure that line number is set correctly for call to __exit__ when handling exception in body of a with statement. (GH-26890) 2021-06-24 15:12:48 +01:00
Erlend Egeberg Aasland b5a52eef67
bpo-44229: Ignore spurious EPROTOTYPE on macOS in test_ssl (GH-26893) 2021-06-24 13:05:42 +01:00
Erlend Egeberg Aasland 2c1ae09764
bpo-43553: Improve `sqlite3` test coverage (GH-26886) 2021-06-24 12:56:56 +01:00
Guido van Rossum 769d7d0c66
bpo-43693 Get rid of CO_NOFREE -- it's unused (GH-26839)
All uses of this flag are either setting it
or in doc or tests for it. So we should be
able to get rid of it completely.
2021-06-23 09:51:44 -07:00
Erlend Egeberg Aasland a50e28377b
bpo-42064: Move `sqlite3` exceptions to global state, part 1 of 2 (GH-26745)
Also adds a test to verify the (borrowed) exceptions in `sqlite3.Connection`.
2021-06-23 05:56:40 -07:00
Victor Stinner 489699ca05
bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874)
Py_RunMain() now resets PyImport_Inittab to its initial value at
exit. It must be possible to call PyImport_AppendInittab() or
PyImport_ExtendInittab() at each Python initialization.
2021-06-23 14:13:27 +02:00
E-Paine e9c8f784fa
bpo-44404: tkinter `after` support callable classes (GH-26812) 2021-06-23 13:30:24 +03:00
Serhiy Storchaka 5c7940257e
bpo-44482: Fix very unlikely resource leak in glob in non-CPython implementations (GH-26843) 2021-06-23 12:53:37 +03:00
Dong-hee Na 5a3108044d
bpo-28395: Remove unnecessary semicolons in tests (GH-26868) 2021-06-23 18:01:06 +09:00
Mark Shannon c3f52b4d70
bpo-44486: Make sure that modules always have a dictionary. (GH-26847)
* Make sure that modules always have a dictionary.
2021-06-23 10:00:43 +01:00
Ikko Ashimine 35b773accb
Fix typo in test_typing.py (GH-26853)
maximium -> maximum
2021-06-22 15:42:28 -07:00
Ken Jin adfa1ba398
bpo-44483: Fix crash in union object with bad ``__module__`` (GH-26848) 2021-06-22 16:54:44 +03:00
Ma Lin bc6c12c72a
bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol correctly (GH-26764)
No longer use len() to get the length of the input data. For some buffer protocol objects,
the length obtained by using len() is wrong.
2021-06-22 10:04:23 +03:00
Victor Stinner be1cb3214d
bpo-44287: asyncio test_popen() uses longer timeout (GH-26832)
Fix asyncio test_popen() of test_windows_utils by using a longer
timeout. Use military grade battle-tested test.support.SHORT_TIMEOUT
timeout rather than a hardcoded timeout of 10 seconds: it's 30
seconds by default, but it is made longer on slow buildbots.

WaitForMultipleObjects() timeout argument is in milliseconds.
2021-06-22 01:58:19 +02:00
Guido van Rossum 355f5dd36a
bpo-43693: Turn localspluskinds into an object (GH-26749)
Managing it as a bare pointer to malloc'ed bytes is just too awkward in a few places.
2021-06-21 13:53:04 -07:00
Ken Jin c5d700f0e2
Reset DeprecationWarning filters in test_typing io and re (#26811) 2021-06-21 11:17:55 -07:00
Dong-hee Na 30f7a77f35
bpo-44395: Fix MIMEPart.as_string to pass unixfrom properly (GH-26685) 2021-06-21 22:59:02 +09:00
Victor Stinner d19163912b
bpo-44466: Faulthandler now detects the GC (GH-26823)
The faulthandler module now detects if a fatal error occurs during a
garbage collector collection (only if all_threads is true).
2021-06-21 13:15:40 +02:00
Mark Shannon 82e5c28af7
bpo-44297: Fix missing line number in generator expressions (GH-26801)
* Make sure that line number is set when entering comprehension scope in compiler.
2021-06-21 10:55:15 +01:00
Serhiy Storchaka 5d2b3a0d68
bpo-44469: Fix tests for "async with" with bad object (GH-26817)
Test for execution of the body was null. It would pass
even if the code which should be skipped was executed.
2021-06-21 10:21:59 +03:00
Erlend Egeberg Aasland 5f0fc30de4
bpo-44430: Refactor `sqlite3` threading tests (GH-26748)
1. Rewrite ThreadTests with a _run_test() helper method that does the heavy lifting
2. Add test.support.threading_helper.reap_threads to _run_test()
3. Use _run_test() in all threading tests
4. Add test case for sqlite3.Connection.set_trace_callback
5. Add test case for sqlite3.Connection.create_collation
2021-06-20 20:26:36 +01:00
Erlend Egeberg Aasland 7d0a47e1af
bpo-44087: Disallow instantiation of sqlite3.Statement (GH-26567) 2021-06-20 20:24:32 +01:00
Erlend Egeberg Aasland 185ecdc146
bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC (GH-24421) 2021-06-20 20:24:00 +01:00
Sebastian Rittau 09eb817115
bpo-38291: DeprecationWarning when importing typing.{io,re} (#26719) 2021-06-19 10:31:18 -07:00
Ethan Furman f60b07ab6c
bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
* [Enum] reduce scope of new format behavior

Instead of treating all Enums the same for format(), only user mixed-in
enums will be affected.  In other words, IntEnum and IntFlag will not be
changing the format() behavior, due to the requirement that they be
drop-in replacements of existing integer constants.

If a user creates their own integer-based enum, then the new behavior
will apply:

    class Grades(int, Enum):
        A = 5
        B = 4
        C = 3
        D = 2
        F = 0

Now:  format(Grades.B)  -> DeprecationWarning and '4'
3.12:                   -> no warning, and 'B'
2021-06-18 13:15:46 -07:00
Miro Hrončok df1502e47f
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    ERROR: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests)
    Prior versions of Distribution.entry_points would return a
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/builddir/build/BUILD/Python-3.10.0b3/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
        expected = next(iter(caught))
    StopIteration
    ----------------------------------------------------------------------
    Ran 1402 tests in 2.125s
    FAILED (errors=1, skipped=18, expected failures=1)
2021-06-18 16:02:45 -04:00
Brandt Bucher c106cf31f8
Reorganize the pattern matching suite (GH-26661) 2021-06-18 10:18:14 -07:00
Mark Shannon 0982ded179
bpo-44032: Move pointer to code object from frame-object to frame specials array. (GH-26771) 2021-06-18 11:00:29 +01:00
Irit Katriel f73377d57c
bpo-43024: improve signature (in help, etc) for functions taking sent… (GH-24331)
…inel defaults
2021-06-17 09:14:30 -07:00
Mark Shannon ba2f32a983
Do not clear globals or builtins when calling clear() on a frame object. Reverts behavior to that of 3.10 and earlier. (GH-26768) 2021-06-17 16:29:15 +01:00
Joe c544393b89
bpo-44389: Fix typo in ssl deprecation warning message (GH-26754)
`ssl.SSL_NO_TLS` should be `ssl.OP_NO_TLS`.
2021-06-17 02:39:57 -07:00
Victor Stinner 0729694246
bpo-44422: threading.Thread reuses the _delete() method (GH-26741)
The _bootstrap_inner() method of threading.Thread now reuses its
_delete() method rather than accessing _active() directly. It became
possible since _active_limbo_lock became reentrant. Moreover, it no
longer ignores any exception when deleting the thread from the
_active dictionary.
2021-06-16 11:41:17 +02:00
Ethan Furman 741b8ae1cf
bpo-44342: [Enum] sync current docs to 3.10 (GH-26750) 2021-06-15 18:51:19 -07:00
Eric Snow ac38a9f2df
bpo-43693: Eliminate unused "fast locals". (gh-26587)
Currently, if an arg value escapes (into the closure for an inner function) we end up allocating two indices in the fast locals even though only one gets used.  Additionally, using the lower index would be better in some cases, such as with no-arg `super()`.  To address this, we update the compiler to fix the offsets so each variable only gets one "fast local".  As a consequence, now some cell offsets are interspersed with the locals (only when an arg escapes to an inner function).

https://bugs.python.org/issue43693
2021-06-15 16:35:25 -06:00
Ethan Furman cb2014f207
[Enum] improve test, add andrei kulakov to ACKS (GH-26726) 2021-06-15 11:38:15 -07:00
Victor Stinner 243fd01047
bpo-44422: Fix threading.enumerate() reentrant call (GH-26727)
The threading.enumerate() function now uses a reentrant lock to
prevent a hang on reentrant call.
2021-06-15 16:14:24 +02:00
andrei kulakov 689a84475e
Fix a typo in _make_class_unpicklable() docstring (GH-26729) 2021-06-14 19:42:46 -07:00
Pablo Galindo 507ed6fa1d
bpo-44409: Fix error location in tokenizer errors that happen during initialization (GH-26712) 2021-06-14 17:46:11 +01:00
Mark Shannon eecbc7c390
bpo-44338: Port LOAD_GLOBAL to PEP 659 adaptive interpreter (GH-26638)
* Add specializations of LOAD_GLOBAL.

* Add more stats.

* Remove old opcache; it is no longer used.

* Add NEWS
2021-06-14 11:04:09 +01:00
Christian Heimes bf527277d4
bpo-44389: Fix deprecation of OP_NO_TLSv1_3 (GH-26700)
Signed-off-by: Christian Heimes <christian@python.org>
2021-06-13 13:46:07 +02:00
Binbin 17b16e13bb
Fix typos in multiple files (GH-26689)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-06-12 22:47:44 -04:00
Dong-hee Na 736ed6f7a9
bpo-43425: Update test_c_parser not to use TempdirManager (GH-26693) 2021-06-13 07:07:24 +09:00
Pablo Galindo a342cc5891
bpo-44396: Update multi-line-start location when reallocating tokenizer buffers (GH-26676)
Automerge-Triggered-By: GH:pablogsal
2021-06-12 10:53:49 -07:00
Serhiy Storchaka 9f1c5f6e8a
bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679) 2021-06-12 15:15:17 +03:00
Mark Dickinson 4a42cebf6d
bpo-44339: Fix math.pow corner case to comply with IEEE 754 (GH-26606)
Change the behaviour of `math.pow(0.0, -math.inf)` and `math.pow(-0.0, -math.inf)` to return positive infinity instead of raising `ValueError`. This makes `math.pow` consistent with the built-in `pow` (and the `**` operator) for this particular special case, and brings the `math.pow` special-case handling into compliance with IEEE 754.
2021-06-12 10:23:02 +01:00
Kaustubh J 3ec3ee7d2e
bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
In particular, when running with tk8.6.8, as in PSF 3.9. 

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-06-11 18:55:32 -04:00
huzhaojie 4cb6ba1432
bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646) 2021-06-11 16:17:56 +01:00
Lumír 'Frenzy' Balhar fc98266ff6
bpo-44351: Restore back parse_makefile in distutils.sysconfig (GH-26637)
The function uses distutils.text_file.TextFile and therefore
behaves differently than _parse_makefile in sysconfig.
2021-06-11 17:08:00 +02:00
Ethan Furman c956734d7a
bpo-44242: [Enum] improve error messages (GH-26669) 2021-06-11 02:44:43 -07:00
Ethan Furman 3a7cccfd6c
bpo-44342: [Enum] fix data type search (GH-26667)
In an inheritance chain of

  int -> my_int -> final_int

the data type is now final_int (not my_int)
2021-06-11 01:25:14 -07:00
Christian Heimes e26014f1c4
bpo-44362: ssl: improve deprecation warnings and docs (GH-26646)
Signed-off-by: Christian Heimes <christian@python.org>
2021-06-11 09:15:48 +02:00
Julien Palard c4955e2c4f
Doc: Prettier exception hierarchy. (GH-26533) 2021-06-11 08:53:52 +02:00
Ethan Furman 62f1d2b3d7
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658)
by-value lookups could fail on complex enums, necessitating a check for
__reduce__ and possibly sabotaging the final enum;

by-name lookups should never fail, and sabotaging is no longer necessary
for class-based enum creation.
2021-06-10 15:52:09 -07:00
Pablo Galindo 05073036dc
bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632) 2021-06-10 23:50:32 +01:00
Daniel Hahler 6544b2532d
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr (GH-18180) 2021-06-10 21:32:04 +01:00
Ethan Furman 8a4f0850d7
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same (GH-26649)
This enables, for example, two base Enums to both inherit from `str`, and then both be mixed into the same final Enum:

    class Str1Enum(str, Enum):
        # some behavior here

    class Str2Enum(str, Enum):
        # some more behavior here

    class FinalStrEnum(Str1Enum, Str2Enum):
        # this now works
2021-06-10 13:30:41 -07:00
Mark Roseman 42d5a4fc3b
bpo-33962: Use ttk spinbox for IDLE indent space config (GH-22954)
If ttk.Spinbox is not available (Tk < 8.5.9) use readonly ttk.Combobox.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-06-10 15:13:55 -04:00
Ajith Ramachandran ac867f10b4
bpo-44357:Add `math.cbrt()` function: Cube Root (GH-26622)
* Add math.cbrt() function: Cube Root

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2021-06-10 17:42:09 +01:00
Ajith Ramachandran 90cd433032
bpo-44364:Add non integral tests for `sqrt()` (#26625)
* Add non integral tests for `sqrt()`

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2021-06-10 17:27:26 +01:00
Mark Shannon 54cb63863f
bpo-44348: Move trace-info to thread-state (GH-26623)
* Move trace-info to thread state.

* Correct output for pdb when turning on tracing in middle of line
2021-06-10 08:46:59 +01:00
Mark Shannon e117c02837
bpo-44337: Port LOAD_ATTR to PEP 659 adaptive interpreter (GH-26595)
* Specialize LOAD_ATTR with  LOAD_ATTR_SLOT and LOAD_ATTR_SPLIT_KEYS

* Move dict-common.h to internal/pycore_dict.h

* Add LOAD_ATTR_WITH_HINT specialized opcode.

* Quicken in function if loopy

* Specialize LOAD_ATTR for module attributes.

* Add specialization stats
2021-06-10 08:46:01 +01:00
Dong-hee Na 309ab61602
bpo-35800: Remove smtpd.MailmanProxy since 3.11 (GH-26617) 2021-06-10 08:12:41 +09:00
Pablo Galindo 457ce60fc7
bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft keywords (GH-26630) 2021-06-09 22:20:01 +01:00
Terry Jan Reedy 275d5f7957
bpo-40468: Split IDLE settings General tab (GH-26621)
Replace it with Windows tab for Shell and Editor options
and Shell/Ed for options exclusive to one of them.

Create room for more options and make dialog shorter,
to better fit small windows.
2021-06-09 16:17:58 -04:00
Ethan Furman eea8148b7d
bpo-44242: [Enum] remove missing bits test from Flag creation (GH-26586)
Move the check for missing named flags in flag aliases from Flag creation
to a new *verify* decorator.
2021-06-09 09:03:55 -07:00
Mark Shannon 6f84656dc1
Delete line that was accidentally copied. (GH-26624) 2021-06-09 15:55:35 +01:00
Terry Jan Reedy 5571cabf1b
bpo-40468: Factor out class ExtPage in idlelib.configdialog (GH-26618) 2021-06-08 21:43:49 -04:00
Pablo Galindo 9fd21f649d
bpo-44349: Fix edge case when displaying text from files with encoding in syntax errors (GH-26611) 2021-06-09 00:54:29 +01:00
Serhiy Storchaka 2ea6d89028
bpo-43833: Emit warnings for numeric literals followed by keyword (GH-25466)
Emit a deprecation warning if the numeric literal is immediately followed by
one of keywords: and, else, for, if, in, is, or. Raise a syntax error with
more informative message if it is immediately followed by other keyword or
identifier.

Automerge-Triggered-By: GH:pablogsal
2021-06-08 16:31:10 -07:00
Eric Snow 3e1c7167d8
bpo-43693: Un-revert commit f3fa63e. (#26609)
This was reverted in GH-26596 (commit 6d518bb) due to some bad memory accesses.

* Add the MAKE_CELL opcode. (gh-26396)

The memory accesses have been fixed.

https://bugs.python.org/issue43693
2021-06-08 16:01:34 -06:00
Terry Jan Reedy ab36b9f834
bpo-40468: Move IDLE helplist settings to extensions page of dialog. (GH-26593)
These are the settings that extend the help menu.  Moving them shortens the dialog and will help with it being too tall for small screens.
2021-06-08 15:35:10 -04:00
Batuhan Taskaya 8004c4570b
bpo-11105: document the new test.support.infinite_recursion context manager (GH-26604) 2021-06-08 20:39:03 +03:00
Batuhan Taskaya e58d762c1f
bpo-11105: reduce the recursion limit for tests (GH-26550) 2021-06-08 19:55:10 +03:00
Pablo Galindo 3fe921cd49
Revert "bpo-43693: Add the MAKE_CELL opcode and interleave fast locals offsets. (gh-26396)" (GH-26597)
This reverts commit 631f9938b1.
2021-06-08 13:17:55 +01:00
Pablo Galindo d334c73b56
bpo-44335: Fix a regression when identifying invalid characters in syntax errors (GH-26589) 2021-06-08 12:25:22 +01:00
Machinexa2 d56e700d6c
Use `from` imports (GH-26594)
from imports
2021-06-08 06:47:15 -03:00
Ned Batchelder ffd87b7093
fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582) 2021-06-08 01:15:46 +01:00
Eric Snow 631f9938b1
bpo-43693: Add the MAKE_CELL opcode and interleave fast locals offsets. (gh-26396)
This moves logic out of the frame initialization code and into the compiler and eval loop.  Doing so simplifies the runtime code and allows us to optimize it better.

https://bugs.python.org/issue43693
2021-06-07 16:52:00 -06:00
Terry Jan Reedy e915db3e9e
Use absolute imports in IDLE tests (GH-26581)
Relative imports do not work when running test_x as main.
2021-06-07 17:56:34 -04:00
Eric Snow 2ab27c4af4
bpo-43693: Un-revert commits 2c1e258 and b2bf2bc. (gh-26577)
These were reverted in gh-26530 (commit 17c4edc) due to refleaks.

* 2c1e258 - Compute deref offsets in compiler (gh-25152)
* b2bf2bc - Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388)

This change fixes the refleaks.

https://bugs.python.org/issue43693
2021-06-07 12:22:26 -06:00
Mark Shannon 001eb520b5
bpo-44187: Quickening infrastructure (GH-26264)
* Add co_firstinstr field to code object.

* Implement barebones quickening.

* Use non-quickened bytecode when tracing.

* Add NEWS item

* Add new file to Windows build.

* Don't specialize instructions with EXTENDED_ARG.
2021-06-07 18:38:06 +01:00
Sergey B Kirpichev 89e50ab36f
bpo-44258: support PEP 515 for Fraction's initialization from string (GH-26422)
* bpo-44258: support PEP 515 for Fraction's initialization from string

* regexps's version

* A different regexps version, which doesn't suffer from catastrophic backtracking

* revert denom -> den

* strip "_" from the decimal str, add few tests

* drop redundant tests

* Add versionchanged & whatsnew entry

* Amend Fraction constructor docs

* Change .. versionchanged:...
2021-06-07 08:06:33 +01:00
wim glenn afb2eed72b
bpo-37449: ensurepip uses importlib.resources.files() traversable APIs (#22659)
* `ensurepip` now uses `importlib.resources.files()` traversable APIs

* Update Lib/ensurepip/__init__.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Update Misc/NEWS.d/next/Library/2020-10-11-20-23-48.bpo-37449.f-t3V6.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-06-06 22:14:47 -04:00
Pablo Galindo fa106a685c
bpo-44304: Fix crash in the sqlite3 module when the GC clears Statement objects (GH-26545) 2021-06-05 03:50:39 +01:00
Pablo Galindo f171877ebe
bpo-38323: Skip SubprocessMultiLoopWatcherTest as they can hang the test suite (GH-26542) 2021-06-05 00:33:20 +01:00
Raymond Hettinger 3668e118f7
Update nonstandard variable names (GH-26540) 2021-06-04 16:28:31 -07:00
Erlend Egeberg Aasland 006fd869e4
bpo-43853: Handle sqlite3_value_text() errors (GH-25422) 2021-06-04 19:34:00 +01:00
Erlend Egeberg Aasland 8363ac8607
bpo-44041: Add test for sqlite3 column count (GH-25907) 2021-06-04 18:36:08 +01:00
Pablo Galindo 17c4edc4e0
bpo-43693: Revert commits 2c1e2583fd and b2bf2bc1ec (GH-26530)
* Revert "bpo-43693: Compute deref offsets in compiler (gh-25152)"

This reverts commit b2bf2bc1ec.

* Revert "bpo-43693: Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388)"

This reverts commit 2c1e2583fd.

These two commits are breaking the refleak buildbots.
2021-06-04 17:51:05 +01:00
stratakis a46c220edc
bpo-44048: Fix two hashlib test cases under FIPS mode (GH-26470)
test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
2021-06-04 17:47:59 +01:00