Commit Graph

47507 Commits

Author SHA1 Message Date
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
Mark Shannon b2bf2bc1ec
bpo-43693: Compute deref offsets in compiler (gh-25152)
Merges locals and cells into a single array.
Saves a pointer in the interpreter and means that we don't need the LOAD_CLOSURE opcode any more

https://bugs.python.org/issue43693
2021-06-03 18:03:54 -06:00
Pablo Galindo b250f89bb7
bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523) 2021-06-03 23:52:12 +01:00
Victor Stinner 5c2191df9a
bpo-43921: Cleanup test_ssl.test_wrong_cert_tls13() (GH-26520)
Don't catch OSError, and check the SSLError message.
2021-06-03 22:12:31 +02:00
Batuhan Taskaya f3491242e4
bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)
When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError.
2021-06-03 21:01:02 +01:00
Erlend Egeberg Aasland d88b47b5a3
bpo-42213: Remove redundant cyclic GC hack in sqlite3 (GH-26517)
The sqlite3 module now fully implements the GC protocol, so there's no
need for this workaround anymore.

- Add and use managed resource helper for connections using TESTFN
- Sort test imports
- Split open-tests into their own test case

Automerge-Triggered-By: GH:vstinner
2021-06-03 09:38:19 -07:00
Eric Snow 2c1e2583fd
bpo-43693: Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388)
A number of places in the code base (notably ceval.c and frameobject.c) rely on mapping variable names to indices in the frame "locals plus" array (AKA fast locals), and thus opargs.  Currently the compiler indirectly encodes that information on the code object as the tuples co_varnames, co_cellvars, and co_freevars.  At runtime the dependent code must calculate the proper mapping from those, which isn't ideal and impacts performance-sensitive sections.  This is something we can easily address in the compiler instead.

This change addresses the situation by replacing internal use of co_varnames, etc. with a single combined tuple of names in locals-plus order, along with a minimal array mapping each to its kind (local vs. cell vs. free).  These two new PyCodeObject fields, co_fastlocalnames and co_fastllocalkinds, are not exposed to Python code for now, but co_varnames, etc. are still available with the same values as before (though computed lazily).

Aside from the (mild) performance impact, there are a number of other benefits:

* there's now a clear, direct relationship between locals-plus and variables
* code that relies on the locals-plus-to-name mapping is simpler
* marshaled code objects are smaller and serialize/de-serialize faster

Also note that we can take this approach further by expanding the possible values in co_fastlocalkinds to include specific argument types (e.g. positional-only, kwargs).  Doing so would allow further speed-ups in _PyEval_MakeFrameVector(), which is where args get unpacked into the locals-plus array.  It would also allow us to shrink marshaled code objects even further.

https://bugs.python.org/issue43693
2021-06-03 10:28:27 -06:00
Victor Stinner ea0210fa8c
bpo-43921: Fix test_ssl.test_wrong_cert_tls13() on Windows (GH-26502)
Fix test_ssl.test_wrong_cert_tls13(): use suppress_ragged_eofs=False,
since read() can raise ssl.SSLEOFError on Windows.
2021-06-03 18:04:25 +02:00
Erlend Egeberg Aasland 82ad22a97d
bpo-42213: Check connection in sqlite3.Connection.__enter__ (GH-26512)
Try to harden connection close:

- add tests that exercise stuff against a closed database
- add wrapper for sqlite3_close_v2()
- check connection on __enter__
- explicitly free pending statements before close()
- sqlite3_close_v2() always returns SQLITE_OK
2021-06-03 17:53:47 +02:00
Mark Shannon 937cebc93b
bpo-44298: Fix line numbers for early exits in with statements. (GH-26513) 2021-06-03 16:45:58 +01:00
andrei kulakov 8b93f0e696
bpo-43858: Add logging.getLevelNamesMapping() (GH-26459)
Added a function that returns a copy of a dict of logging levels.
2021-06-03 01:12:59 -07:00
Gregory P. Smith e60ab843cb
bpo-44022: Improve the regression test. (GH-26503)
It wasn't actually detecting the regression due to the
assertion being too lenient.
2021-06-02 20:43:38 -07:00
Tal Einat adef445dc3
bpo-44282: Fix occasional test_incremental_editing failures on buildbots (GH-26491)
Signed-off-by: Tal Einat <532281+taleinat@users.noreply.github.com>
2021-06-03 01:53:41 +02:00
Victor Stinner 320eaa7f42
bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489)
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases
(when the recv() method returns an empty string).
2021-06-02 22:25:26 +02:00
Mariusz Felisiak 1a8c778471
Remove duplicate address in CommonTestMixin_v4.test_leading_zeros() (GH-26326) 2021-06-02 13:30:13 +01:00
Serhiy Storchaka 39dd141a4b
bpo-44273: Improve syntax error message for assigning to "..." (GH-26477)
Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis.
2021-06-01 12:07:05 +01:00
Serhiy Storchaka a6a2065881
bpo-44260: Do not read system entropy without need in Random() (GH-26455) 2021-05-31 23:24:20 +03:00
Jason R. Coombs c34ed08d97
bpo-44246: Restore compatibility in entry_points (GH-26468)
* bpo-44246: Entry points performance improvements.

From importlib_metadata 4.3.1.

* bpo-44246: Sync with importlib_metadata 4.4
2021-05-31 12:19:42 -04:00
Jason R. Coombs 410b70d39d
bpo-44246: Entry points performance improvements. (GH-26467)
From importlib_metadata 4.3.1.
2021-05-31 11:52:29 -04:00
Dong-hee Na 14ba761078
bpo-44235: Remove deprecated functions in the gettext module. (GH-26378) 2021-05-30 10:29:45 +09:00
Sergey B Kirpichev 5ffa58cb97
Trivial change in fractions module docs: real -> rational numbers (GH-25009)
Obviously, the former was a little misleading: not only rationals
may be considered as "infinite-precision, real numbers" - but, for
example, any real finite extension of the rationals.
2021-05-29 19:49:31 -03:00
Terry Jan Reedy af5a324843
bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
On macOS, tk defers to system setting for button background when in normal state.
Give turtledemo button text a color that works on either light or dark background.
2021-05-29 03:19:50 -04:00
Andreas Jansson de14d709e3
Remove duplicate mime type mapping .bmp -> image/x-ms-bmp (GH-26300)
Thanks for the contribution @andreasjansson
2021-05-28 22:20:46 -03:00
Sean Grady 7e6f237569
Fix dataclass comment typo _eq__ -> __eq__ (GH-26433) 2021-05-28 16:57:18 -04:00
Jürgen Gmach 2138b2edaf
bpo-44045: fix spelling of uppercase vs upper-case (GH-25985)
And also of lowercase vs lower-case.

The `-` notation should only be used for adjectives.
2021-05-28 17:54:25 -03:00
Mark Shannon f8a95df84b
bpo-44206: Add a version number to dictionary keys (GH-26333)
* Store log2(size) instead of size in dict-keys.

* Use enum instead of function pointer to record kind of keys.

* Add version number to dict keys.
2021-05-28 09:54:10 +01:00
Tal Einat 4e2e5c1c4f
bpo-41611: IDLE: Catch TclError exceptions in AutoCompleteWindow.winconfig_event() (GH-26404)
Since the <Configure> event may occur after the
completion window is gone, catch potential
TclError exceptions when accessing acw.
2021-05-28 09:07:21 +03:00
Erlend Egeberg Aasland e90e042218
bpo-43916: Use test.support.check_disallow_instantiation() in test_tcl (GH-26412) 2021-05-27 23:00:26 +02:00
Eric Snow 9f494d4929
bpo-43693: Add _PyCode_New(). (gh-26375)
This is an internal-only API that helps us manage the many values used to create a code object.

https://bugs.python.org/issue43693
2021-05-27 09:54:34 -06:00
Tal Einat abc4bd5db9
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400) 2021-05-27 17:29:55 +03:00
Erlend Egeberg Aasland 8cec740820
bpo-43988: Document test.support.check_disallow_instantiation() (GH-26394) 2021-05-27 12:55:38 +02:00
Erlend Egeberg Aasland fbff5387c3
bpo-43988: Use check disallow instantiation helper (GH-26392) 2021-05-27 08:43:52 +02:00
Jason R. Coombs f6fbdb90ee
bpo-38693: Prefer f-strings in importlib.resources (importlib_resources 5.0.6). (GH-26387)
Automerge-Triggered-By: GH:jaraco
2021-05-26 13:16:11 -07:00
Eric Snow 6cc800d363
bpo-43693: Clean up the PyCodeObject fields. (GH-26364)
* Move up the comment about fields using in hashing/comparision.

* Group the fields more clearly.

* Add co_ncellvars and co_nfreevars.

* Raise ValueError if nlocals != len(varnames), rather than aborting.
2021-05-26 20:15:40 +01:00
Jason R. Coombs e6c815d2e3
bpo-38693: importlib.metadata f-strings (GH-26383)
Automerge-Triggered-By: GH:jaraco
2021-05-26 11:49:06 -07:00
Jason R. Coombs 06ac3a4742
bpo-44241: Incorporate changes from importlib_metadata 4.1. (#26382) 2021-05-26 13:40:05 -04:00
Erlend Egeberg Aasland 4f725261c6
bpo-43988: Add test.support.check_disallow_instantiation() (GH-25757) 2021-05-26 16:15:27 +02:00
Yonatan Goldschmidt 156699bca0
bpo-44222: Improve _removeHandlerRef() for a very long _handlerList (GH-26325)
The list lookups become a big burden for very long lists.
This patch changes the "happy flow" path of 2 lookups into 1 lookup.

Automerge-Triggered-By: GH:vsajip
2021-05-25 15:40:23 -07:00
Victor Stinner bd199e72fb
bpo-44232: Fix type_new() error reporting (GH-26359)
Fix a regression in type() when a metaclass raises an exception. The
C function type_new() must properly report the exception when a
metaclass constructor raises an exception and the winner class is not
the metaclass.
2021-05-25 22:28:10 +02:00
Raymond Hettinger 2f2e703244
bpo-44151: Various grammar, word order, and markup fixes (GH-26344) 2021-05-24 23:04:04 -07:00
Zack Kneupper 2f3a87856c
bpo-44151: linear_regression() minor API improvements (GH-26199) 2021-05-24 17:30:58 -07:00
Petr Viktorin 563bd5a4dc
bpo-41282: Fix broken `make install` (GH-26329)
A previous commit broke a check in sysconfig when building cpython itself.
This caused builds of the standard library modules to search a wrong
location (the installed location rather than the source directory) for
header files with the net effect that a ``make install``
incorrectly caused all extension modules to be rebuilt again and
with incorrect include file paths.

When building Python, we need two distinct "include" directories:
- source .h files
- install target for .h files

Note that this doesn't matter except when building Python from source.

Historically:
- source .h files were in the distutils scheme under 'include'
- the install directory was in the distutils.command.install scheme
    under 'headers'

GH-24549 merged these; sysconfig is now the single source of truth and
distutils is derived from it.

This commit introduces a "secret" scheme path, 'headers', which contains
the install target. It is only present when building Python.
The distutils code uses it if present, and falls back to 'include'.

Co-authored-by: Ned Deily <nad@python.org>
2021-05-24 18:48:44 -04:00
Filipe Laíns df7eeacd83
bpo-44210: make importlib.metadata._meta.PackageMetadata public (GH-26299)
Signed-off-by: Filipe Laíns <lains@riseup.net>

Automerge-Triggered-By: GH:jaraco
2021-05-23 12:04:05 -07:00
Serhiy Storchaka 8b01067318
bpo-28307: Tests and fixes for optimization of C-style formatting (GH-26318)
Fix errors:
* "%10.s" should be equal to "%10.0s", not "%10s".
* Tuples with starred expressions caused a SyntaxError.
2021-05-23 19:06:48 +03:00
Irit Katriel 220dd80a26
bpo-33809: add the TracebackException.print() method (GH-24231) 2021-05-22 17:39:33 +01:00
Anthony Sottile 9e746e3298
bpo-20684: Remove unused inspect._signature_get_bound_param (GH-21100) 2021-05-22 15:51:43 +01:00
E-Paine e9f66aedf4
Remove effbot urls (GH-26308) 2021-05-22 14:09:54 +02:00
Zackery Spytz 6cc8ac9499
bpo-40736: Improve the error message for re.search() TypeError (GH-23312)
Include the invalid type in the error message.
2021-05-21 22:02:42 +01:00
Pablo Galindo c878a97968
bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)
The invalid assignment rules are very delicate since the parser can
easily raise an invalid assignment when a keyword argument is provided.
As they are very deep into the grammar tree, is very difficult to
specify in which contexts these rules can be used and in which don't.
For that, we need to use a different version of the rule that doesn't do
error checking in those situations where we don't want the rule to raise
(keyword arguments and generator expressions).

We also need to check if we are in left-recursive rule, as those can try
to eagerly advance the parser even if the parse will fail at the end of
the expression. Failing to do this allows the parser to start parsing a
call as a tuple and incorrectly identify a keyword argument as an
invalid assignment, before it realizes that it was not a tuple after all.
2021-05-21 18:34:54 +01:00
Victor Stinner 615069eb08
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)
Fix a crash at Python exit when a deallocator function removes the
last strong reference to a heap type.

Don't read type memory after calling basedealloc() since
basedealloc() can deallocate the type and free its memory.

_PyMem_IsPtrFreed() argument is now constant.
2021-05-21 19:19:54 +02:00
Jason R. Coombs 875b3d84b3
bpo-43643: Sync with python/importlib_resources@c17a610aad. (GH-26284)
* bpo-43643: Sync with python/importlib_resources@c17a610aad.
* Sync with python/importlib_resources@89fd5e961a.
2021-05-21 13:00:40 -04:00
Pablo Galindo b51081c1a8
bpo-44180: Report generic syntax errors in the furthest position reached in the first parser pass (GH-26253) 2021-05-21 16:09:51 +01:00
Mark Shannon b11a951f16
bpo-44032: Move data stack to thread from FrameObject. (GH-26076)
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames.

* Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells.

* Move locals, cells and freevars out of frame object into separate memory buffer.

* Use per-threadstate allocated memory chunks for local variables.

* Move globals and builtins from frame object to per-thread stack.

* Move (slow) locals frame object to per-thread stack.

* Move internal frame functions to internal header.
2021-05-21 10:57:35 +01:00
Raymond Hettinger be4dd7fcd9
bpo-44150: Support optional weights parameter for fmean() (GH-26175) 2021-05-20 20:22:26 -07:00
Barney Gale 18f41c04ff
bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. (GH-26184)
Issue should be fixed in bpo-43757

Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2021-05-20 18:41:33 +02:00
native-api 1270ad6ec8
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) 2021-05-20 11:25:37 +01:00
Victor Stinner 58a993957a
bpo-44131: Py_FrozenMain() uses PyConfig_SetBytesArgv() (GH-26201)
Moreover, Py_FrozenMain() relies on Py_InitializeFromConfig() to
handle the PYTHONUNBUFFERED environment variable and configure C
stdio streams like stdout (make the stream unbuffered).
2021-05-20 12:08:05 +02:00
Pablo Galindo 33c0c90dea
bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210) 2021-05-19 19:03:04 +01:00
Catherine Devlin b3ab4344d1
bpo-4928: Document NamedTemporaryFile non-deletion after SIGKILL (#26198)
* bpo-4928 Document NamedTemporaryFile non-deletion after SIGKILL

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-05-19 10:21:03 -04:00
Ian Norton 5d6e463df4
bpo-43749: Ensure current exe is copied when using venv on windows (GH-25216)
Automerge-Triggered-By: GH:vsajip
2021-05-19 02:37:17 -07:00
Tal Einat 60d343a816
bpo-44010: IDLE: colorize pattern-matching soft keywords (GH-25851) 2021-05-19 12:18:10 +03:00
Jürgen Gmach 02ee819126
bpo-41963: document that ConfigParser strips off comments (GH-26197)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Laura Gutierrez Funderburk <58710704+lgfunderburk@users.noreply.github.com>
2021-05-18 18:11:23 +02:00
uniocto 115dea9e26
bpo-25872: Add unit tests for linecache and threading (GH-25913) 2021-05-18 09:56:52 +01:00
Victor Stinner eaede0ded7
bpo-44131: Test Py_FrozenMain() (GH-26126)
* Add test_frozenmain to test_embed
* Add Programs/test_frozenmain.py
* Add Programs/freeze_test_frozenmain.py
* Add Programs/test_frozenmain.h
* Add make regen-test-frozenmain
* Add test_frozenmain command to Programs/_testembed
* _testembed.c: add error(msg) function
2021-05-17 23:48:35 +02:00
Igor Bolshakov f32c7950e0
bpo-43650: Fix MemoryError on zip.read in shutil._unpack_zipfile for large files (GH-25058)
`shutil.unpack_archive()` tries to read the whole file into memory, making no use of any kind of smaller buffer. Process crashes for really large files: I.e. archive: ~1.7G, unpacked: ~10G. Before the crash it can easily take away all available RAM on smaller systems. Had to pull the code form `zipfile.Zipfile.extractall()` to fix this

Automerge-Triggered-By: GH:gpshead
2021-05-17 01:28:21 -07:00
Pete Wicken 83f0f8d62f
bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check.

Automerge-Triggered-By: GH:gpshead
2021-05-17 00:52:36 -07:00
Sergey B Kirpichev b102dd598d
bpo-44154: optimize Fraction pickling (GH-26186) 2021-05-17 00:20:02 -07:00
Raymond Hettinger b3f65e819f
Apply edits from Allen Downey's review of the linear_regression docs. (GH-26176) 2021-05-16 19:21:14 -07:00
flizzywine be54fb5ae7
fix docstring typo in bdb.py (GH-22323) 2021-05-17 00:20:33 +01:00
Ashwin Ramaswami de367378f6
Fix typo in comment (GH-26162) 2021-05-16 16:35:41 +01:00
Batuhan Taskaya 51cef8be8c
bpo-44142: drop redundant parantheses when unparsing tuples as assignment targets (GH-26156) 2021-05-16 16:33:22 +03:00
Barney Gale 1a08c5ac49
bpo-39950: Fix deprecation warning in test for `pathlib.Path.link_to()` (GH-26155) 2021-05-16 00:15:25 -07:00
Raymond Hettinger fdfea4ab16
Improve speed and accuracy for correlation() (GH-26135) 2021-05-15 11:00:51 -07:00
Pablo Galindo 80b089179f
bpo-44143: Fix crash in the parser when raising tokenizer errors with an exception set (GH-26144) 2021-05-15 17:58:02 +01:00
Ken Jin f24afda591
bpo-26110: Add ``CALL_METHOD_KW`` opcode to speedup method calls with keywords (GH-26014)
* Add CALL_METHOD_KW

* Make CALL_METHOD branchless too since it shares the same code

* Place parentheses in STACK_SHRINK
2021-05-15 16:15:23 +01:00
Batuhan Taskaya e4e931a67e
bpo-44081: improve ast.unparse() for lambdas with no parameters (GH-26000) 2021-05-15 15:55:53 +03:00
Rory Yorke 4aa63d65a9
bpo-44072: fix Complex, Integral docs for `**` (GH-25986)
In numbers module docstrings and docs.
2021-05-14 18:01:48 -04:00
Antoine Pitrou c10c2ec7a0
bpo-37788: Fix reference leak when Thread is never joined (GH-26103)
When a Thread is not joined after it has stopped, its lock may remain in the _shutdown_locks set until interpreter shutdown.  If many threads are created this way, the _shutdown_locks set could therefore grow endlessly.  To avoid such a situation, purge expired locks each time a new one is added or removed.
2021-05-14 12:37:20 -07:00
Miguel Brito dc0b364de4
bpo-44095: Add suffix, stem and suffixes to zipfile.Path (GH-26129) 2021-05-14 10:57:36 -07:00
Erlend Egeberg Aasland be7e467bcf
sqlite3 test suite now works with SQLITE_DQS=0 (GH-26032) 2021-05-14 19:27:21 +09:00
Irit Katriel 4aeee0b47b
bpo-28146: Fix a confusing error message in str.format() (GH-24213)
Automerge-Triggered-By: GH:pitrou
2021-05-13 13:55:55 -07:00
Ken Jin b2f3f8e3d8
bpo-44098: Drop ParamSpec from most ``__parameters__`` in typing generics (GH-26013)
Added two new attributes to ``_GenericAlias``: 
* ``_typevar_types``, a single type or tuple of types indicating what types are treated as a ``TypeVar``. Used for ``isinstance`` checks.
* ``_paramspec_tvars ``, a boolean flag which guards special behavior for dealing with ``ParamSpec``. Setting it to ``True`` means this  class deals with ``ParamSpec``.

Automerge-Triggered-By: GH:gvanrossum
2021-05-12 22:24:35 -07:00
Yurii Karabas c40486a32d
bpo-38908: Fix issue when non runtime_protocol failed to raise TypeError (#26067) 2021-05-12 08:47:49 -07:00
Ken Jin 2b458c1dba
bpo-44089: Allow subclassing of ``csv.Error`` (GH-26008)
* fix subclass error

* Update 2021-05-09-22-52-34.bpo-44089.IoANsN.rst
2021-05-12 06:47:11 -07:00
Karl Dubost 5010c044c7
bpo-25479: add unit test for __subclasshook__ in test_abc.py (GH-24034)
Co-authored-by: Szymon Trapp
2021-05-12 14:05:45 +01:00
Mark Shannon cb6f3d7163
bpo-43933: Force RETURN_VALUE bytecodes to have line numbers (GH-26054) 2021-05-12 11:25:44 +01:00
Gregory P. Smith d597fdc5fd
bpo-44002: Switch to lru_cache in urllib.parse. (GH-25798)
Switch to lru_cache in urllib.parse.

urllib.parse now uses functool.lru_cache for its internal URL splitting and
quoting caches instead of rolling its own like its the 90s.

The undocumented internal Quoted class API is now deprecated
as it had no reason to be public and no existing OSS users were found.

The clear_cache() API remains undocumented but gets an explicit test as it
is used in a few projects' (twisted, gevent) tests as well as our own regrtest.
2021-05-11 17:01:44 -07:00
Miguel Brito e9d7f88d56
bpo-44061: Fix pkgutil.iter_modules regression when passed a pathlib.Path object (GH-25964) 2021-05-12 00:27:22 +01:00
Erlend Egeberg Aasland 8563a7052c
bpo-28528: Fix pdb.checkline() attribute error when 'curframe' is None. (#25438)
Co-authored-by: Thomas Kluyver <takowl@gmail.com>
2021-05-12 00:26:30 +01:00
Sebastian Rittau 5fedf71439
Fix import of HTTPError (GH-22304)
Import HTTPError from urllib.error instead of urllib.request.
2021-05-11 16:01:33 -07:00
Irit Katriel 12e7d10dfd
bpo-25821: Fix inaccuracy in threading.enumerate/is_alive documentation (#23192) 2021-05-11 18:55:24 +01:00
Giampaolo Rodola c0190137ca
bpo-43743 add comment stating _USE_CP_SENDFILE should not be removed (#26024) 2021-05-10 22:45:06 +02:00
Zachary Ware 8e8307d70b
Revert test for Tix deprecation warning (GH-26005)
Added in bpo-41730 (GH-22186), the test apparently causes refleaks.  The
test isn't worth hunting them down, so it's simply reverted.

This partially reverts commit 4a2d98a1e9.
2021-05-09 01:58:35 -05:00
Batuhan Taskaya 3d98ececda
bpo-43417: Better buffer handling for ast.unparse (GH-24772) 2021-05-09 02:32:04 +03:00
Pablo Galindo 6692dc1ca9
bpo-43149: Correct the syntax error message for multiple exception types (GH-25996)
Automerge-Triggered-By: GH:pablogsal
2021-05-08 11:24:41 -07:00
pxinwr b063b02eab
bpo-31904: Correct error string in test_file_not_exists() for VxWorks (GH-25965)
The error string on VxWorks is "no such file or directory" for FileNotFoundError. That is, the 1st letter of the error string has lower case.
2021-05-08 01:03:41 -07:00
Inada Naoki 4d4be47705
Do not use Py_ssize_clean_t (GH-25940) 2021-05-08 10:17:37 +09:00
E-Paine 092f9ddb5e
bpo-44026: Idle - display interpreter's 'did you mean' hints (GH-25912)
A C function accessible by the default exception handler, but not by python code,
finds the existing name closest to the name causing a name or attribute error.  For
such errors, call the default handler after capturing stderr and retrieve its message line.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-05-07 19:52:01 -04:00
Batuhan Taskaya b2ec37a722
bpo-44063: set the missing end locations on the compiler (GH-25956) 2021-05-07 20:49:06 +03:00
wyz23x2 4a2d98a1e9
bpo-41730: Show deprecation warnings for tkinter.tix (GH-22186)
Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
2021-05-07 10:53:23 -05:00
Mark Shannon adcd220556
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling.

* Uses a lookup table to determine how to handle exceptions.
* Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements.
* Reduces the size of the frame object by about 60%.
2021-05-07 15:19:19 +01:00