Commit Graph

46882 Commits

Author SHA1 Message Date
Hai Shi dd39123970
bpo-40137: Convert _functools module to use PyType_FromModuleAndSpec. (GH-23405) 2020-12-29 04:45:07 -08:00
Senthil Kumaran 030a713183
Allow / character in username,password fields in _PROXY envvars. (#23973) 2020-12-29 04:18:42 -08:00
Ross c1af128f5a
bpo-41781: Fix typo in internal function name in typing (GH-23957) 2020-12-29 13:55:28 +02:00
Serhiy Storchaka 1df56bc059
bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968)
Objects which belong to different Tcl interpreters are now always
different, even if they have the same name.
2020-12-29 12:56:55 +02:00
Serhiy Storchaka 156b7f7052
bpo-42749: Use dynamic version to test for unsupported bignum in Tk (GH-23966)
Tk can internally support bignum even if Tkinter is built without
support of bignum.
2020-12-29 12:55:55 +02:00
Ken Jin efb1f0918f
bpo-42740: Support PEP 604, 612 for typing.py get_args and get_origin (GH-23942) 2020-12-28 18:26:19 -08:00
Ken Jin 4140f10a16
bpo-42740: Fix get_args for PEP 585 collections.abc.Callable (GH-23963)
PR 1/2. Needs backport to 3.9.
2020-12-28 12:06:19 -08:00
Raymond Hettinger a9621bb301
bpo-42222: Modernize integer test/conversion in randrange() (#23064) 2020-12-28 11:10:34 -08:00
Serhiy Storchaka b02ad2458b
bpo-42749: Fix testing bignum if Tkinter is compiled with Tk 8.4 and dynamic linked with Tk >= 8.5 (GH-23955) 2020-12-27 10:13:30 +02:00
Pablo Galindo 3bcc4ead3f
Add small validator utility for PEG grammars (GH-23519) 2020-12-26 19:11:29 +00:00
Dong-hee Na 0b281f94b9
bpo-42748: test_asdl_parser now uses exec_module instead of load_module (#23954) 2020-12-26 16:25:21 +03:00
Serhiy Storchaka c1ae21c965
Rename Tkinter tests for widget options (GH-23944)
Every test for widget option starts now with "test_configure_"
to distinguish it from tests for widget commands.
2020-12-26 00:10:29 +02:00
Desmond Cheong 36a779e64c
bpo-35728: Add root parameter to tkinter.font.nametofont() (GH-23885) 2020-12-25 23:18:06 +02:00
Serhiy Storchaka 675c97eb6c
bpo-42721: Improve using simple dialogs without root window (GH-23897)
When simple query dialogs (tkinter.simpledialog), message boxes
(tkinter.messagebox) or color choose dialog (tkinter.colorchooser)
are created without arguments master and parent, and the default
root window is not yet created, a new temporary hidden root window
will be created automatically. It will not be set as the default root
window and will be destroyed right after closing the dialog window.
It will help to use these simple dialog windows in programs which do
not need other GUI.

Previously, message boxes and color chooser created the blank root
window and left it after closing the dialog window, and query dialogs
just raised an exception.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-12-25 20:19:20 +02:00
Irit Katriel 586f3dbe15
bpo-28964: add line number of node (if available) to ast.literal_eval error messages (GH-23677) 2020-12-25 20:04:31 +03:00
Serhiy Storchaka bb70b2afe3
bpo-15303: Support widgets with boolean value False in Tkinter (GH-23904)
Use `widget is None` instead of checking the boolean value of a widget.
2020-12-25 17:04:26 +02:00
Serhiy Storchaka 954a7427ba
bpo-42734: Fix crasher bogus_code_obj.py (GH-23939)
It did not work because the signature of code object constructor
was changed. Also, it used old format of bytecode (pre-wordcode).
2020-12-25 17:03:37 +02:00
Gregory P. Smith 64abf37344
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
When the modern text= spelling of the universal_newlines= parameter was added
for Python 3.7, check_output's special case around input=None was overlooked.
So it behaved differently with universal_newlines=True vs text=True.  This
reconciles the behavior to be consistent and adds a test to guarantee it.

Also clarifies the existing check_output documentation.

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2020-12-24 20:57:21 -08:00
Ethan Furman 786d97a66c
bpo-42727: [Enum] use super() and include **kwds (GH-23927)
for multiple inheritance support:

use super().new
pass **kwds to super().new
2020-12-24 19:31:10 -08:00
Serhiy Storchaka c6c43b2874
bpo-42685: Improve placing of simple query windows. (GH-23856)
* If parent is specified and mapped, the query widget is
  centered at the center of parent. Its position and size
  can be corrected so that it fits in the virtual root window.
* Otherwise it is centered at the center of the screen.
2020-12-24 20:26:28 +02:00
Ethan Furman 6ec0adefad
[Enum] EnumMeta.__prepare__ now accepts **kwds (#23917) 2020-12-24 10:05:02 -08:00
kj 73607be686
bpo-41559: Implement PEP 612 - Add ParamSpec and Concatenate to typing (#23702) 2020-12-23 20:33:48 -08:00
Raymond Hettinger cc3467a57b
bpo-38308: Add optional weighting to statistics.harmonic_mean() (GH-23914) 2020-12-23 19:52:09 -08:00
kj 6dd3da3cf4
bpo-42195: Override _CallableGenericAlias's __getitem__ (GH-23915)
Added `__getitem__` for `_CallableGenericAlias` so that it returns a subclass (itself) of `types.GenericAlias` rather than the default behavior of returning a plain `types.GenericAlias`. This fixes `repr` issues occuring after `TypeVar` substitution arising from the previous behavior.
2020-12-23 18:47:40 -08:00
Batuhan Taskaya eee1c7745a
bpo-41960: Add globalns and localns parameters to inspect.signature and Signature.from_callable (GH-22583) 2020-12-24 01:45:13 +03:00
Victor Stinner a12491681f
bpo-32381: pymain_run_command() uses PyCF_IGNORE_COOKIE (GH-23724)
The coding cookie (ex: "# coding: latin1") is now ignored in the
command passed to the -c command line option.

Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE
compiler flag to the parser.

pymain_run_python() no longer propages compiler flags between
function calls.
2020-12-23 19:16:56 +01:00
Raymond Hettinger 41b223d29c
bpo-9694: Fix misleading phrase "optional arguments" (GH-23858) 2020-12-23 09:40:56 -08:00
Victor Stinner bfda4f5776
bpo-28468: Fix typo in _os_release_candidates (GH-23913)
Automerge-Triggered-By: GH:tiran
2020-12-23 08:35:53 -08:00
Mark Shannon 28b75c80dc
bpo-42246: Don't eliminate jumps to jumps, if it will break PEP 626. (GH-23896) 2020-12-23 11:43:10 +00:00
Irit Katriel 069560b117
bpo-34463: Make python tracebacks identical to C tracebacks for SyntaxErrors without a lineno (GH-23427) 2020-12-22 21:53:09 +02:00
AMIR b8fde8b541
bpo-42008: Fix internal _random.Random() seeding for the one argument case (GH-22668) 2020-12-21 15:45:50 -08:00
Fernando Toledo 711381dfb0
Fix typo in docstring (GH-23515) 2020-12-21 16:06:31 +02:00
Mark Shannon f2dbfd7e20
bpo-42634: Mark reraise after except blocks as artificial. (GH-23877)
* Mark reraise after except blocks as artificial.

* Update importlib

* Update dis test.
2020-12-21 13:53:50 +00:00
Daniel Hahler 37a6d5f802
[WIP/RFC] bpo-15872: tests: remove oddity from test_rmtree_errors (GH-22967)
This was added for (some) Windows buildbots back in 2012, and should
either not be necessary anymore, or it should probably get investigated
why "\*.*" gets added to filenames in the first place.

Ref:

Automerge-Triggered-By: GH:hynek
2020-12-20 22:38:02 -08:00
pxinwr ab74c014ae
bpo-31904: Fix site and sysconfig modules for VxWorks RTOS (GH-21821) 2020-12-20 23:27:42 +01:00
Serhiy Storchaka 3d569fd6dc
bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)
* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.
2020-12-19 12:17:08 +02:00
masklinn 1e27b57dbc
bpo-42470: Do not warn on sequences which are also sets in random.sample() (GH-23665) 2020-12-18 20:33:36 -08:00
Raymond Hettinger 51f4688254
bpo-34805: Guarantee that __subclasses__() is in definition order. (GH-23844) 2020-12-18 16:53:50 -08:00
Irit Katriel fb34096140
bpo-24792: Fix zipimporter masking the cause of import errors (GH-22204)
zipimport's _unmarshal_code swallows import errors and then _get_module_code doesn't know the cause of the error, and returns the generic, and sometimes incorrect, 'could not find...'.

Automerge-Triggered-By: GH:brettcannon
2020-12-18 16:09:54 -08:00
Andre Delfino e8d2264210
bpo-36769: Document that fnmatch.filter supports any kind of iterable (#13039) 2020-12-18 20:10:20 +01:00
Richard Kojedzinszky 17ef4319a3
bpo-41891: ensure asyncio.wait_for waits for task completion (#22461) 2020-12-18 09:26:04 -08:00
Max Bernstein 6e799be0a1
bpo-42199: Fix bytecode_helper assertNotInBytecode (#23031)
* bpo-42199: Fix bytecode_helper assertNotInBytecode

Add tests.

* 📜🤖 Added by blurb_it.

Co-authored-by: Dino Viehland <dinoviehland@fb.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-12-17 16:30:29 -08:00
pxinwr 75dabfe7a8
bpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530) 2020-12-17 20:22:29 +01:00
Mark Shannon bf353f3c2d
bpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly after raising or reraising an exception (GH-23803)
* Ensure that f_lasti is set correctly after an exception is raised to conform to PEP 626.

* Update importlib

* Add NEWS.
2020-12-17 13:55:28 +00:00
pxinwr ba760f3710
bpo-31904: Skip some asyncio tests on VxWorks (#23815) 2020-12-17 12:04:47 +02:00
Mike Lei c143cc379c
Correct referenced RFC number in cgi module (GH-22827)
The quoted sentence can be found from the last paragraph of RFC 2046, Section 5.1, while the content of RFC 2026 is unrelated to this module.
2020-12-16 17:34:19 -08:00
Daniel Hahler 051b981867
bpo-37961: Fix regression in tracemalloc.Traceback.__repr__ (GH-23805)
Regression in 8d59eb1b66.
2020-12-16 22:38:32 +01:00
Chris Jerdonek 66d3b589c4
bpo-38323: Add guard clauses in MultiLoopChildWatcher. (#22756)
This is a trivial refactor in preparation for a fix for bpo-38323.
2020-12-16 19:50:25 +02:00
Mark Shannon 5274b682bc
bpo-42645: Make sure that return/break/continue are only traced once when exiting via a finally block. (GH-23780)
* Make sure that return/break/continue are only traced once when exiting via a finally block.

* Add test for return in try-finally.

* Update importlib
2020-12-16 13:07:01 +00:00
Om G c71581c7a4
bpo-42615: Delete redundant jump instructions that only bypass empty blocks (GH-23733)
* Delete jump instructions that bypass empty blocks

* Add news entry

* Explicitly check for unconditional jump opcodes

Using the is_jump function results in the inclusion of instructions like
returns for which this optimization is not really valid. So, instead
explicitly check that the instruction is an unconditional jump.

* Handle conditional jumps, delete jumps gracefully

* Ensure b_nofallthrough and b_reachable are valid

* Add test for redundant jumps

* Regenerate importlib.h and edit Misc/ACKS

* Fix bad whitespace
2020-12-16 12:18:05 +00:00
Victor Stinner 99d28c5670
bpo-40364: asyncio uses os.waitstatus_to_exitcode() (GH-23798)
test_unix_events.py no longer checks if waitstatus_to_exitcode() mock
has been called or not to make the test more functional, rather than
checking the exact implementation.
2020-12-16 12:11:24 +01:00
Serhiy Storchaka 5f0fe8ec70
bpo-19733: Re-enable tests for -image option in Tkinter (GH-23785) 2020-12-16 12:31:49 +02:00
Victor Stinner 79782fe4f8
bpo-41804: Enhance test_epoll.test_control_and_wait() (GH-23795)
Use shorter timeout and replace send() with sendall().
2020-12-16 11:16:25 +01:00
Matthias Bussonnier b32d8b4f9b
bpo-42644: Validate values in logging.disable() (#23786)
* bpo-42644: Validate values in logging.disable()

Technically make the value of manager a property that checks and convert
values assigned to it properly. This has the side effect of making
`logging.disable` also accept strings representing the various level of
warnings.

We want to validate the type of the disable attribute at assignment
time, as it is later compared to other levels when emitting warnings and
would generate a `TypeError: '>=' not supported between ....` in a
different part of the code base, which can make it difficult to track
down.

When assigned an incorrect value; it will raise a TypeError when the
wrong type, or ValueError if an invalid str.

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-12-16 11:43:39 +02:00
Jason R. Coombs 928dbfc16c
bpo-42090: zipfile.Path.joinpath now accepts multiple arguments (GH-22976)
Automerge-Triggered-By: GH:jaraco
2020-12-15 18:12:54 -08:00
pxinwr b230409f21
bpo-31904: Skip os.path.expanduser() tests on VxWorks (GH-23776) 2020-12-15 22:24:00 +01:00
pxinwr 9a0dea6137
bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on VxWorks (GH-23716) 2020-12-15 22:21:53 +01:00
pxinwr e1e3c2dac3
bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687) 2020-12-15 22:20:07 +01:00
E-Paine b9ced83cf4
bpo-40219: Lowered ttk LabeledScale dummy (GH-21467) 2020-12-15 21:42:55 +02:00
Victor Stinner 7f14a3756b
bpo-42641: Enhance test_select.test_select() (GH-23782)
Enhance test_select.test_select(): it now takes 500 ms rather than 10
seconds.

* Use Python rather than a shell as the child process to make the
  test more portable.
* Use a sleep of 50 ms per line rather than 1 second.
* Use subprocess.Popen rather than os.popen().
2020-12-15 18:06:36 +01:00
Victor Stinner 3ca2b8fd75
bpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)
atexit._run_exitfuncs() now logs callback exceptions using
sys.unraisablehook, rather than logging them directly into
sys.stderr and raising the last exception.

Run GeneralTest of test_atexit in a subprocess since it calls
atexit._clear() which clears all atexit callbacks.

_PyAtExit_Fini() sets state->callbacks to NULL.
2020-12-15 17:12:02 +01:00
Victor Stinner f7049b5fb6
bpo-42639: Add script_helper.run_test_script() (GH-23777)
* Add run_test_script() function to test.support.script_helper.
* Rename Lib/test/eintrdata/eintr_tester.py to
  Lib/test/_test_eintr.py.
* test_eintr.py uses run_test_script().
2020-12-15 16:08:16 +01:00
Victor Stinner b8fa135908
bpo-42639: Move atexit state to PyInterpreterState (GH-23763)
* Add _PyAtExit_Call() function and remove pyexitfunc and
  pyexitmodule members of PyInterpreterState. The function
  logs atexit callback errors using _PyErr_WriteUnraisableMsg().
* Add _PyAtExit_Init() and _PyAtExit_Fini() functions.
* Remove traverse, clear and free functions of the atexit module.

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2020-12-15 14:34:19 +01:00
Mark Shannon 8473cf89bd
bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if statements conform to PEP 626. (GH-23743) 2020-12-15 11:07:50 +00:00
Terry Jan Reedy 6f79e60b66
bpo-33610: Edit idlelib.codecontext (GH-23773)
Add sentence to module docstring and import tkinter items.
2020-12-15 00:24:01 -05:00
Victor Stinner 357704c9f2
bpo-42639: atexit now logs callbacks exceptions (GH-23771)
At Python exit, if a callback registered with atexit.register()
fails, its exception is now logged. Previously, only some exceptions
were logged, and the last exception was always silently ignored.

Add _PyAtExit_Call() function and remove
PyInterpreterState.atexit_func member. call_py_exitfuncs() now calls
directly _PyAtExit_Call().

The atexit module must now always be built as a built-in module.
2020-12-14 23:07:54 +01:00
Victor Stinner 83d52044ae
bpo-42639: Cleanup atexitmodule.c (GH-23770)
* Rename "atexitmodule_state" to "struct atexit_state".
* Rename "modstate" to "state".
* Rename "self" parameter to "module".
* test_atexit uses textwrap.dedent().
* Remove _Py_PyAtExit() function: inline it into atexit_exec().
* PyInterpreterState: rename pyexitfunc to atexit_func, rename
  pyexitmodule to atexit_module.
2020-12-14 22:40:40 +01:00
vabr-g fdb9efce6a
bpo-41877: Check for misspelled speccing arguments (GH-23737)
patch, patch.object and create_autospec silently ignore misspelled
arguments such as autospect, auto_spec and set_spec. This can lead
to tests failing to check what they are supposed to check.

This change adds a check causing a RuntimeError if the above
functions get any of the above misspellings as arguments. It also
adds a new argument, "unsafe", which can be set to True to disable
this check.

Also add "!r" to format specifiers in added error messages.
2020-12-14 10:30:09 -08:00
Gregory P. Smith 42c9f0fd0a
bpo-36541: Add lib2to3 grammar PEP-570 pos-only arg parsing (GH-23759)
Add positional only args support to lib2to3 pgen2.

This adds 3.8's PEP-570 support to lib2to3's pgen2.  lib2to3, while
being deprecated is still used by things to parse all versions of Python
code today.  We need it to support parsing modern 3.8 and 3.9 constructs.

Also add tests for complex *expr and **expr's.
2020-12-14 09:10:10 -08:00
Mark Shannon f5e97b72fe
bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761) 2020-12-14 11:28:39 +00:00
Mark Shannon 56aa20f9eb
Don't generate spurious line number in try-except-finally. (#23760) 2020-12-14 10:19:10 +00:00
kj 463c7d3d14
bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing (GH-23060) 2020-12-13 10:38:24 -08:00
Pablo Galindo 43c4fb6c90
bpo-30858: Improve error location for expressions with assignments (GH-23753)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-12-13 16:46:48 +00:00
Ethan Furman b5a6db9111
bpo-39717: [tarfile] update nested exception raising (GH-23739)
- `from None` if the new exception uses, or doesn't need, the previous one
- `from e` if the previous exception is still relevant
2020-12-12 13:26:44 -08:00
Alex Grönholm 67b769f515
bpo-42059: Fix required/optional keys for TypedDict(..., total=False) (GH-22736) 2020-12-10 13:49:05 -08:00
Ethan Furman a658287179
bpo-34750: [Enum] add `_EnumDict.update()` support (GH-23725)
This allows easier Enum construction in unusual cases, such as including dynamic member definitions into a class definition:

# created dynamically
foo_defines = {'FOO_CAT': 'aloof', 'BAR_DOG': 'friendly', 'FOO_HORSE': 'big'}

class Foo(Enum):
    vars().update({
            k: v
            for k, v in foo_defines.items()
            if k.startswith('FOO_')
            })
    def upper(self):
        # example method
        return self.value.upper()
2020-12-10 13:07:00 -08:00
Ethan Furman efb13be72c
bpo-42385: [Enum] add `_generate_next_value_` to StrEnum (GH-23735)
The default for auto() is to return an integer, which doesn't work for `StrEnum`.  The new `_generate_next_value_` for `StrEnum` returns the member name, lower cased.
2020-12-10 12:20:06 -08:00
vabr-g 9fc571359a
bpo-41877: Improve docs for assert misspellings check in mock (GH-23729)
This is a follow-up to
4662fa9bfe.
That original commit expanded guards against misspelling assertions on
mocks. This follow-up updates the documentation and improves the error
message by pointing out the potential cause and solution.

Automerge-Triggered-By: GH:gpshead
2020-12-10 10:35:28 -08:00
Ethan Furman 7cf0aad96d
bpo-42517: [Enum] do not convert private names into members (GH-23722)
private names, such as `_Color__hue` and `_Color__hue_` are now normal attributes, and do not become members nor raise exceptions
2020-12-09 17:12:11 -08:00
Ethan Furman 6bd94de168
bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)
When creating an Enum, type.__new__ calls __init_subclass__, but at that point the members have not been added.

This patch suppresses the initial call, then manually calls the ancestor __init_subclass__ before returning the new Enum class.
2020-12-09 16:41:22 -08:00
pxinwr 98a5417193
bpo-41439: Skip test_ssl and test_uuid tests if fork() is not supported (GH-21684) 2020-12-09 00:20:19 +01:00
pxinwr eb7594f857
bpo-41443: Add more attribute checking in test_posix (GH-21688) 2020-12-09 00:18:37 +01:00
Ethan Furman 6d3dfee271
[Enum] reformat and add doc strings (GH-23705) 2020-12-08 12:26:56 -08:00
Ethan Furman 37440eef7f
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) 2020-12-08 11:14:10 -08:00
Petr Viktorin c168b5078f
bpo-42111: Make the xxlimited module an example of best extension module practices (GH-23226)
- Copy existing xxlimited to xxlimited53 (named for the limited API version it uses)
- Build both modules, both in debug and release
- Test both modules
2020-12-08 08:36:53 -08:00
Pablo Galindo 8bae2a958e
Python 3.10.0a3 2020-12-07 19:34:10 +00:00
Matti Picus c0afb7fa0e
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match distutils (GH-22088) 2020-12-07 17:33:20 +00:00
Ethan Furman c266736ec1
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487) 2020-12-07 00:17:31 -08:00
Terry Jan Reedy 57e5113610
bpo-42508: Keep IDLE running on macOS (GH-23577)
Remove obsolete workaround that prevented running files with
shortcuts when using new universal2 installers built on macOS 11.
Ignore buggy 2nd run_module_event call.
2020-12-06 22:22:33 -05:00
Serhiy Storchaka 8a62887dfb
bpo-42582: Remove asyncio._all_tasks_compat(). (GH-23664)
It was used to implement now removed asyncio.Task.all_tasks().
2020-12-06 18:54:33 +02:00
idanw206 c598a04dd2
bpo-42532: Check if NonCallableMock's spec_arg is not None instead of call its __bool__ function (GH23613)
Check if NonCallableMock's spec_arg is not None instead of call its __bool__ function
2020-12-06 09:59:36 +00:00
kj 804d6893b8
bpo-42576: Raise TypeError when passing in keyword arguments to GenericAlias (GH-23656)
Use `_PyArg_NoKeywords` instead of `_PyArg_NoKwnames` when checking the `kwds` tuple when creating `GenericAlias`. This fixes an interpreter crash when passing in keyword arguments to `GenericAlias`'s constructor.

Needs backport to 3.9.

Automerge-Triggered-By: GH:gvanrossum
2020-12-05 08:02:14 -08:00
Senthil Kumaran da3d2abe6b
GH-5054: CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed (#23638) 2020-12-05 05:26:24 -08:00
Brandt Bucher 226a012d1c
bpo-42536: GC track recycled tuples (GH-23623)
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:

- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip

Previously, they could have become untracked by a prior garbage collection.
2020-12-04 19:45:57 -08:00
Brett Cannon 2de5097ba4
bpo-26131: Deprecate usage of load_module() (GH-23469)
Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
2020-12-04 15:39:21 -08:00
Irit Katriel 2e0760bb2e
bpo-17735: inspect.findsource now raises OSError when co_lineno is out of range (GH-23633)
This can happen when a file was edited after it was imported.
2020-12-04 23:22:03 +02:00
pxinwr 8d4f57dbd1
bpo-31904: fix test_doctest.py failures for VxWorks (GH-23419)
Fix test_doctest.py failures for VxWorks by avoiding exact error message checks. (better for everyone all around)
2020-12-04 12:19:32 -08:00
Irit Katriel 6e1eec71f5
bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630) 2020-12-04 18:45:38 +02:00
Victor Stinner 066394018a
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://bugzilla.redhat.com/show_bug.cgi?id=1866884 is fixed in gdb
10.1 (failed to reproduce on gdb-10.1-1.fc34.aarch64).
2020-12-04 16:23:56 +01:00
Mark Shannon eaccc12aa9
bpo-42246: Don't forget the entry block when ensuring that all exits have a line number (GH-23636)
Don't forget the entry block when ensuring that all exits have a line number.
2020-12-04 15:22:12 +00:00
Yurii Karabas f24b8101a0
bpo-42562: Fix issue when dis failed to parse function that has no line numbers (GH-23632)
Fix issue when dis failed to parse function that has only annotations
2020-12-04 15:20:53 +00:00
Victor Stinner 7e5e13d113
bpo-42553: Fix test_asyncio.test_call_later() (GH-23627)
Fix test_asyncio.test_call_later() race condition: don't measure
asyncio performance in the call_later() unit test. The test failed
randomly on the CI.
2020-12-03 13:56:41 +01:00
Serhiy Storchaka f3c3ea91a7
bpo-42328: Skip some tests with themes vista and xpnative on Windows 7 (GH-23612) 2020-12-03 10:48:26 +02:00
Senthil Kumaran 3ec9d01901
Remove the conditional for setting query. (#23604) 2020-12-02 19:48:14 -08:00
FX Coudert 5291639e61
bpo-42504: fix for MACOSX_DEPLOYMENT_TARGET=11 (GH-23556)
macOS releases numbering has changed as of macOS 11 Big Sur.  Previously, major releases were of the form 10.x, 10.x+1, 10.x+2, etc; as of Big Sur, they are now x, x+1, etc, so, for example, 10.15, 10.15.1, ..., 10.15.7, 11, 11.0.1, 11.1, ..., 12, 12.1, etc. Allow Python to build with single-digit deployment target values. Patch provided by FX Coudert.
2020-12-02 22:20:18 -05:00
Mark Shannon 5977a7989d
bpo-42246: Make sure that line number is correct after a return, as required by PEP 626 (GH-23495)
Make sure that line number is correct after a return, as defined by PEP 626.
2020-12-02 13:31:40 +00:00
Mark Shannon 4e7a69bdb6
bpo-42500: Fix recursion in or after except (GH-23568)
* Use counter, rather boolean state when handling soft overflows.
2020-12-02 13:30:55 +00:00
pxinwr e483d281bd
bpo-31904: Fix test_netrc for VxWorks RTOS (GH-21675)
Fix test_netrc on VxWorks: create temporary directories using temp_cwd().
2020-12-01 21:34:42 +01:00
pxinwr b2d0c66e88
bpo-31904: Fix fifo test cases for VxWorks (GH-20254) 2020-12-01 09:20:50 +01:00
Raymond Hettinger cc061d0e6f
bpo-38200: Add itertools.pairwise() (GH-23549) 2020-11-30 20:42:54 -08:00
Irit Katriel 427613f005
bpo-42482: remove reference to exc_traceback from TracebackException (GH-23531) 2020-11-30 17:35:25 -08:00
pxinwr 1244c816d7
bpo-31904: Support signal module on VxWorks (GH-23391) 2020-11-30 22:48:33 +01:00
Christian Heimes 5c73afc36e
bpo-28468: Add platform.freedesktop_os_release() (GH-23492)
Add platform.freedesktop_os_release() function to parse freedesktop.org
os-release files.

Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-11-30 22:34:45 +01:00
Terry Jan Reedy e41bfd15dd
bpo-42508: Remove bogus idlelib.pyshell.ModifiedInterpreter attribute (GH-23570)
restart_subprocess is a method of self, the pyshell.InteractiveInterpreter instance. The latter does not have an interp attribute redundantly referring to itself. (The PyShell instance does have an interp attribute, referring to the InteractiveInterpreter instance.)
2020-11-30 12:09:43 -05:00
Andreas Poehlmann 0be9ce305f
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ (GH-23534) 2020-11-30 08:34:15 -08:00
Zackery Spytz 9654592478
bpo-42506: Fix unexpected output in test_format (GH-23564) 2020-11-30 17:39:12 +09:00
Serhiy Storchaka 6cc2c419f6
bpo-42142: Try to fix timeouts in ttk tests (GH-23474)
Instead of using wait_visibility() which waits event <VisibilityNotify> in dead loop
use update() which should proceed all queued events.
2020-11-30 10:24:07 +02:00
Raymond Hettinger fc40b3020c
bpo-42450: Minor updates to the itertools recipes (GH-23555) 2020-11-29 10:47:22 -08:00
Renato Cunha 86684319d3
bpo-42406: Fix whichmodule() with multiprocessing (GH-23403)
* bpo-42406: Fix whichmodule() with multiprocessing

Signed-off-by: Renato L. de F. Cunha <renatoc@br.ibm.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-11-29 10:23:15 -08:00
pxinwr 6a273fdc2a
bpo-31904: skip some tests related to fifo on VxWorks (GH-23473)
On VxWork RTOS, FIFO must be created under directory "/fifos/". Some test cases related to fifo is invalid on VxWorks. So skip them.
2020-11-28 14:06:36 -08:00
pxinwr a86a274b72
bpo-31904: add shell requirement for test_pipes (GH-23489)
VxWorks has no user space shell provided so it can't support pipes module. Also add shell requirement for running test_pipes.
2020-11-28 14:04:50 -08:00
pxinwr 996a1ef8ae
skip test_test of test_mailcap on VxWorks (GH-23507) 2020-11-28 13:49:47 -08:00
pxinwr 64c8f81047
skip test_getaddrinfo_ipv6_scopeid_symbolic and test_getnameinfo_ipv6_scopeid_symbolic on VxWorks (GH-23518) 2020-11-28 13:48:38 -08:00
Soumendra Ganguly 74311aeb45
bpo-41818: Fix test_master_read() so that it succeeds on all platforms that either raise OSError or return b"" upon reading from master (GH-23536)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
2020-11-28 23:04:20 +02:00
pxinwr aa1b8a168d
bpo-31904: Fix test_os.test_getcwd_long_path() failure for VxWorks (GH-20256) 2020-11-28 21:21:30 +01:00
Zackery Spytz 8085f742f4
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
2020-11-28 16:27:28 +02:00
Wansoo Kim 5b0194ed31
bpo-41241: Unnecessary Type casting in 'if condition' (GH-21396)
This is my first issue!
So, if there's anything wrong, please tell me!

Also, thank you always for all the contributors!

Automerge-Triggered-By: GH:asvetlov
2020-11-28 03:37:08 -08:00
Yurii Karabas e4fe303b8c
bpo-42392: Remove loop parameter from asyncio.tasks and asyncio.subprocess (GH-23521) 2020-11-28 10:21:17 +02:00
Julien Jerphanion f9195318a8
bpo-42452: Improve colorsys.rgb_to_hls code (GH-23306)
Cache repeated sum and difference to make code slightly faster and easier to read.
2020-11-28 02:11:19 -05:00
Irit Katriel 44ca05afc8
bpo-42474: test TracebackException comparison to non-equal instances (GH-23522)
Closes bpo-42474
2020-11-27 08:38:54 -08:00
Soumendra Ganguly f5a19ead4b
bpo-41818: Make test_openpty() avoid unexpected success due to number of rows and/or number of columns being == 0. (GH-23526) 2020-11-27 12:16:41 +02:00
Alex Grönholm e3ef4d7f65
bpo-41332: Added missing connect_accepted_socket() to AbstractEventLoop (GH-21533)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-11-26 12:09:12 +02:00
Yurii Karabas f533cb80cb
bpo-42392: Remove loop parameter from asyncio.streams (GH-23517) 2020-11-26 09:36:37 +02:00
Andrew Svetlov 87f7ab5359
bpo-41818: test_openpty succeed on Gentoo, don't expect to fail on this platform (GH-23514) 2020-11-25 19:06:12 +02:00
Soumendra Ganguly c13d89955d
bpo-41818: Updated tests for the standard pty library (GH-22962) 2020-11-25 15:41:25 +02:00
Dong-hee Na be319c0c10
bpo-42299: Remove formatter module (GH-23476) 2020-11-25 22:17:30 +09:00
Yurii Karabas b9127dd6ee
bpo-42392: Improve removal of *loop* parameter in asyncio primitives (GH-23499)
* Update code after merge review from 1st1

* Use a sentinel approach for loop parameter
Remove unnecessary _get_running_loop patching

* Use more clear function name (_verify_parameter_is_marker -> _verify_no_loop)

* Add init method to _LoopBoundMixin to check that loop param wasn't used
2020-11-25 06:50:44 -05:00
Yurii Karabas 7301979b23
bpo-42202: Store func annotations as a tuple (GH-23316)
Reduce memory footprint and improve performance of loading modules having many func annotations.

  >>> sys.getsizeof({"a":"int","b":"int","return":"int"})
  232
  >>> sys.getsizeof(("a","int","b","int","return","int"))
  88

The tuple is converted into dict on the fly when `func.__annotations__` is accessed first.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-11-25 19:43:18 +09:00
Julien Palard 4fedd7123e
bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409)
Restore fix from 011525ee92.
2020-11-25 10:23:17 +01:00
Yurii Karabas 0ec34cab9d
bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-24 20:08:54 +02:00
Serhiy Storchaka b0b428510c
bpo-42370: Check element before making mouse click in ttk tests (GH-23491) 2020-11-24 19:35:39 +02:00
Ned Deily c0c23ea72b
bpo-41100: in test_platform, ignore 10.16 (GH-23485) 2020-11-24 01:20:35 -05:00
Yaroslav Pankovych 79d2e62c00
Added support for negative indexes to PurePath.parents (GH-21799)
This commit also fixes up some of the overlapping documentation changed
in bpo-35498, which added support for indexing with slices.

Fixes bpo-21041.
https://bugs.python.org/issue21041

Co-authored-by: Paul Ganssle <p.ganssle@gmail.com>
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2020-11-23 15:06:22 -05:00
Nick Crews 2f2f9d0b5c
bpo-15450: Allow subclassing of dircmp (GH-23424) (#23424)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-11-23 18:29:37 +02:00
Irit Katriel ff420f0e08
bpo-28850: Fix PrettyPrinter.format overrides ignored for contents of small containers (GH-22120) 2020-11-23 15:31:31 +02:00
Serhiy Storchaka dd844a2916
bpo-42328: Fix tkinter.ttk.Style.map(). (GH-23300)
The function accepts now the representation of the default state as
empty sequence (as returned by Style.map()).
The structure of the result is now the same on all platform
and does not depend on the value of wantobjects.
2020-11-22 22:48:52 +02:00
Serhiy Storchaka c4d45ee670
bpo-42427: Use the errno attribute of OSError instead of args[0] (GH-23449) 2020-11-22 10:28:34 +02:00
Ronald Oussoren 404a719b51
bpo-41116: Ensure system supplied libraries are found on macOS 11 (GH-23301)
On macOS system provided libraries are in a shared library cache
and not at their usual location. This PR teaches distutils to search
in the SDK, even if there was no "-sysroot" argument in
the compiler flags.
2020-11-22 00:14:25 -05:00
Serhiy Storchaka 453bc1da20
bpo-42426: IDLE: Fix reporting offset of the RE error in searchengine (GH-23447) 2020-11-22 00:06:51 -05:00
Ronald Oussoren 442746af64
bpo-41100: Stripping '-arch arm64' didn't work after all (GH-23280) 2020-11-21 21:17:18 -05:00
Richard Levasseur 68f68fa423
Clarify that Set._from_iterable is not required to be a classmethod. (GH-23272) 2020-11-21 11:56:24 -08:00
Filipe Laíns 01a202ab6b
bpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal. (GH-20010)
send_signal() now swallows the exception if the process it thought was still alive winds up not to exist anymore (always a plausible race condition despite the checks).

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-11-21 01:22:08 -08:00
Shantanu a993e901eb
bpo-28002: Roundtrip f-strings with ast.unparse better (#19612)
By attempting to avoid backslashes in f-string expressions.
We also now proactively raise errors for some backslashes we can't
avoid while unparsing FormattedValues

Co-authored-by: hauntsaninja <>
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-11-21 00:16:42 +03:00
Joshua Cannon 4520584483
bpo-35498: Added slice support to PathLib parents attribute. (GH-11165)
Added slice support to the `pathlib.Path.parents` sequence. For a `Path` `p`, slices of `p.parents` should return the same thing as slices of `tuple(p.parents)`.
2020-11-20 10:40:39 -05:00
Victor Stinner 3be8e220ed
bpo-42403: Use @staticmethod in importlib (GH-23395)
Use @staticmethod on methods using @classmethod but don't use their
cls parameter on the following classes:

* BuiltinImporter
* FrozenImporter
* WindowsRegistryFinder
* PathFinder

Leave methods using @_requires_builtin or @_requires_frozen unchanged,
since this decorator requires the wrapped method to have an extra parameter
(cls or self).
2020-11-20 14:44:02 +01:00
Erlend Egeberg Aasland a6109ef68d
bpo-1635741: Convert _sre types to heap types and establish module state (PEP 384) (GH-23393) 2020-11-20 21:36:23 +09:00
Christian Heimes 03c8ddd9e9
bpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-20 00:26:07 -08:00
Terry Jan Reedy 7ddbaa7a1b
bpo-42416: Use inspect.getdoc for IDLE calltips (GH-23416)
Inspect.getdoc(ob) sometimes gets docstrings when ob.__doc__ is None.
2020-11-20 01:59:11 -05:00
Yurii Karabas 1b54077ff6
bpo-42345: Fix hash implementation of typing.Literal (GH-23383)
Fix hash implementation of `typing.Literal`.

Update docs regarding `typing.Litaral` caching.

Base implementation was done in PR #23294.
2020-11-19 08:17:38 -08:00
Victor Stinner 3390347aa0
bpo-42403: Simplify importlib external bootstrap (GH-23397)
Simplify the importlib external bootstrap code:
importlib._bootstrap_external now uses regular imports to import
builtin modules. When it is imported, the builtin __import__()
function is already fully working and so can be used to import
builtin modules like sys.
2020-11-19 13:43:43 +01:00
Victor Stinner 7d9d25dbed
bpo-42403: Fix pyflakes warnings in importlib (GH-23396)
Remove unused imports and unused local variables.
2020-11-19 11:20:57 +01:00
Victor Stinner 8fba9523cf
bpo-42398: Fix "make regen-all" race condition (GH-23362)
Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.

The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:

* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
  from source files (ex: Modules/_weakref.c) and clinic files (ex:
  Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
  (ex: Modules/clinic/_weakref.c.h)

Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).

Fix clinic.py to make all file writes atomic:

* Add write_file() function to ensure that all file writes are
  atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
  content does not change to avoid modifying the file modification
  file.
* Update test_clinic to verify these assertions with a functional
  test.
* Remove Clinic.force attribute which was no longer used, whereas
  Clinic.verify remains useful.
2020-11-18 15:36:27 +01:00
Christian Heimes ce04e7105b
bpo-41561: skip test_min_max_version_mismatch (GH-22308)
skip test_min_max_version_mismatch when TLS 1.0 is not available

Signed-off-by: Christian Heimes <christian@python.org>
2020-11-18 13:10:53 +01:00
Tom Gringauz d0d4a45067
bpo-42395: Add aclosing to __all__ (GH-23356)
Automerge-Triggered-By: GH:asvetlov
2020-11-17 15:18:05 -08:00
Victor Stinner 1de61d3923
bpo-41625: Skip os.splice() tests on AIX (GH-23354)
On AIX, splice() only works with a socket, whereas the test uses a
pipe.
2020-11-17 23:08:10 +01:00
Julien Palard 282282a1c9
Fix: Docstrings hidden by slots. (GH-23352)
Some `__slots__` where before the docstring, hiding them.
2020-11-17 13:50:23 -08:00
Mark Shannon 266b462238
bpo-42349: Compiler clean up. More yak-shaving for PEP 626. (GH-23267)
Make sure that CFG from compiler front-end is correct. Be a bit more aggressive in the compiler back-end.
2020-11-17 19:30:14 +00:00
Erlend Egeberg Aasland a1f401a58b
bpo-42264: Deprecate sqlite3.OptimizedUnicode (GH-23163) 2020-11-17 17:55:12 +02:00
Christian Heimes 975022b77b
bpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980)
Skip testing of pure Python PBKDF2 when one or more builtin hash module
is not available. Otherwise the import of hashlib prints noise on
stderr.

Signed-off-by: Christian Heimes <christian@python.org>
2020-11-17 15:40:35 +01:00
Yurii Karabas f03d318ca4
bpo-42345: Fix three issues with typing.Literal parameters (GH-23294)
Literal equality no longer depends on the order of arguments.

Fix issue related to `typing.Literal` caching by adding `typed` parameter to `typing._tp_cache` function.

Add deduplication of `typing.Literal` arguments.
2020-11-16 18:23:19 -08:00
Pablo Galindo b0aba1fcdc
bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)
Currently walruses are not allowerd in set literals and set comprehensions:

>>> {y := 4, 4**2, 3**3}
  File "<stdin>", line 1
    {y := 4, 4**2, 3**3}
       ^
SyntaxError: invalid syntax

but they should be allowed as well per PEP 572
2020-11-17 01:17:12 +00:00
Pablo Galindo a57b3d30f6
bpo-41625: Expose the splice() system call in the os module (GH-21947) 2020-11-17 00:00:38 +00:00
Lysandros Nikolaou cae60187cf
bpo-42316: Allow unparenthesized walrus operator in indexes (GH-23317) 2020-11-17 01:09:35 +02:00
Lysandros Nikolaou cb3e5ed071
bpo-42374: Allow unparenthesized walrus in genexps (GH-23319)
This fixes a regression that was introduced by the new parser.

Automerge-Triggered-By: GH:lysnikolaou
2020-11-16 15:08:35 -08:00
Victor Stinner 5909a494cd
bpo-42350: Fix Thread._reset_internal_locks() (GH-23268)
Fix the threading.Thread class at fork: do nothing if the thread is
already stopped (ex: fork called at Python exit). Previously, an
error was logged in the child process.
2020-11-16 15:20:34 +01:00
kj 384b7a4bd9
bpo-42332: Add weakref slot to types.GenericAlias (GH-23250)
Automerge-Triggered-By: GH:gvanrossum
2020-11-15 19:27:23 -08:00
Serhiy Storchaka a26215db11
bpo-42318: Fix support of non-BMP characters in Tkinter on macOS (GH-23281) 2020-11-15 18:16:59 +02:00
Brett Cannon d2e94bb084
bpo-42131: Add PEP 451-related methods to zipimport (GH-23187)
Specifically, find_spec(), create_module(), and exec_module().

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
2020-11-13 15:14:58 -08:00
Christian Heimes cd9fed6afb
bpo-41001: Add os.eventfd() (#20930)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-11-13 19:48:52 +01:00
Christian Heimes f97406be4c
bpo-40968: Send http/1.1 ALPN extension (#20959)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-13 16:37:52 +01:00
Mark Shannon cc75ab791d
bpo-42246: Eliminate jumps to exit blocks by copying those blocks. (#23251)
* Compiler: eliminate jumps to short exit blocks by copying.
2020-11-12 19:49:33 +00:00
Mario Corchero 750c5abf43
bpo-42308: Add threading.__excepthook__ (GH-23218)
Add threading.__excepthook__ to allow retrieving the original value
of threading.excepthook in case it is set to a broken or a different
value.
2020-11-12 18:27:44 +01:00
Mark Shannon c6409156c4
Bump magic number. (GH-23245) 2020-11-12 10:42:44 +00:00
Mark Shannon 877df851c3
bpo-42246: Partial implementation of PEP 626. (GH-23113)
* Implement new line number table format, as defined in PEP 626.
2020-11-12 09:43:29 +00:00
Batuhan Taskaya fa476fe132
bpo-39411: pyclbr rewrite on AST (#18103)
- Rewrite pyclbr using an AST processor
- Add is_async to the pyclbr.Function
2020-11-11 10:14:12 +03:00
Diogo Dutra 7e5ef0a571
bpo-42140: Improve asyncio.wait function (GH-22938)
# Improve asyncio.wait function

The original code creates the futures set two times.
We can create this set before, avoiding the second creation.

This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty.

Automerge-Triggered-By: GH:1st1
2020-11-10 14:12:52 -08:00
Vladimir Matveev 1e996c3a3b
bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values (#22780) 2020-11-10 12:09:55 -08:00
Michal Čihař e59b2deffd
bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)
The onerror is supposed to be called with failed function, but in this case lstat is wrongly used instead of open.

Not sure if this needs bug or not...

Automerge-Triggered-By: GH:hynek
2020-11-10 08:06:02 -08:00
Andrew Svetlov 42d873c63a
bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() (GH-23020)
The overflow occurs under some circumstances when a task or future
recursively returns itself.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-11-10 15:58:31 +02:00
Ikko Ashimine 9303b9ecc3
Fix typo in test_array.py (GH-23189) 2020-11-10 18:12:36 +05:30
Victor Stinner 9e1b828265
bpo-42260: Compute the path config in the main init (GH-23211)
The path configuration is now computed in the "main" initialization.
The core initialization no longer computes it.

* Add _PyConfig_Read() function to read the configuration without
  computing the path configuration.
* pyinit_core() no longer computes the path configuration: it is now
  computed by init_interp_main().
* The path configuration output members of PyConfig are now optional:

  * executable
  * base_executable
  * prefix
  * base_prefix
  * exec_prefix
  * base_exec_prefix

* _PySys_UpdateConfig() now skips NULL strings in PyConfig.
* _testembed: Rename test_set_config() to test_init_set_config() for
  consistency with other tests.
2020-11-10 13:21:52 +01:00
jack1142 bfc6b63102
bpo-36310: Allow pygettext.py to detect calls to gettext in f-strings. (GH-19875)
Adds support to Tools/i18n/pygettext.py for gettext calls in f-strings. This process is done by parsing the f-strings, processing each value, and flagging the ones which contain a gettext call.

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-11-10 01:50:45 +03:00
Tom Gringauz a117167d8d
bpo-41543: contextlib.nullcontext can fill in for an async context manager (GH-21870)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-09 14:34:07 +02:00
Ammar Askar 97e8b1eaea
bpo-40624: Add support for the XPath != operator in xml.etree (GH-22147) 2020-11-09 08:02:39 +01:00
kj 4eb41d055e
bpo-42233: Add union type expression support for GenericAlias and fix de-duplicating of GenericAlias (GH-23077) 2020-11-08 20:00:13 -08:00
Ronald Oussoren 23831a7a90
bpo-41754: Ignore NotADirectoryError in invocation of xdg-settings (GH-23075)
It is not clear why this can happen, but several users have mentioned
getting this exception on macOS.
2020-11-08 10:46:55 +01:00
Ronald Oussoren 41761933c1
bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)
Co-authored-by:  Lawrence D’Anna <lawrence_danna@apple.com>

* Add support for macOS 11 and Apple Silicon (aka arm64)
   
  As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy

* Support building on recent versions of macOS while deploying to older versions

  This allows building installers on macOS 11 while still supporting macOS 10.9.
2020-11-08 10:05:27 +01:00
Brett Cannon 825ac38332
bpo-42133: update parts of the stdlib to fall back to `__spec__.loader` when `__loader__` is missing (#22929) 2020-11-06 18:45:56 -08:00
Hai Shi 88c2cfd9ff
bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123) 2020-11-06 17:04:47 +01:00
Zackery Spytz 91e93794d5
bpo-26389: Allow passing an exception object in the traceback module (GH-22610)
The format_exception(), format_exception_only(), and
print_exception() functions can now take an exception object as a positional-only argument.

Co-Authored-By: Matthias Bussonnier <bussonniermatthias@gmail.com>
2020-11-05 22:18:44 +00:00
Victor Stinner dc42af8fd1
bpo-42260: PyConfig_Read() only parses argv once (GH-23168)
The PyConfig_Read() function now only parses PyConfig.argv arguments
once: PyConfig.parse_argv is set to 2 after arguments are parsed.
Since Python arguments are strippped from PyConfig.argv, parsing
arguments twice would parse the application options as Python
options.

* Rework the PyConfig documentation.
* Fix _testinternalcapi.set_config() error handling.
* SetConfigTests no longer needs parse_argv=0 when restoring the old
  configuration.
2020-11-05 18:58:07 +01:00
Victor Stinner f3cb814315
bpo-42260: Add _PyConfig_FromDict() (GH-23167)
* Rename config_as_dict() to _PyConfig_AsDict().
* Add 'module_search_paths_set' to _PyConfig_AsDict().
* Add _PyConfig_FromDict().
* Add get_config() and set_config() to _testinternalcapi.
* Add config_check_consistency().
2020-11-05 18:12:33 +01:00
vabr-g 4662fa9bfe
bpo-41877 Check for asert, aseert, assrt in mocks (GH-23165)
Currently, a Mock object which is not unsafe will raise an
AttributeError if an attribute with the prefix assert or assret is
accessed on it. This protects against misspellings of real assert
method calls, which lead to tests passing silently even if the tested
code does not satisfy the intended assertion.

Recently a check was done in a large code base (Google) and three
more frequent ways of misspelling assert were found causing harm:
asert, aseert, assrt. These are now added to the existing check.
2020-11-05 09:04:38 -08:00
Pablo Galindo 80449f243b
bpo-42266: Handle monkey-patching descriptors in LOAD_ATTR cache (GH-23157) 2020-11-05 09:23:15 +00:00
Kazantcev Andrey 178695b7ae
bpo-40816 Add AsyncContextDecorator class (GH-20516)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2020-11-05 10:52:24 +02:00
Victor Stinner 048a35659a
bpo-42260: Add _PyInterpreterState_SetConfig() (GH-23158)
* Inline _PyInterpreterState_SetConfig(): replace it with
  _PyConfig_Copy().
* Add _PyErr_SetFromPyStatus()
* Add _PyInterpreterState_GetConfigCopy()
* Add a new _PyInterpreterState_SetConfig() function.
* Add an unit which gets, modifies, and sets the config.
2020-11-05 00:45:56 +01:00
serge-sans-paille 100964e031
Disable peg generator tests when building with PGO (GH-23141)
Otherwise, when running the testsuite, test_peg_generator tries to compile C
code using the optimized flags and fails because it cannot find the profile
data.
2020-11-04 23:01:08 +00:00
Victor Stinner 3529718925
bpo-42236: os.device_encoding() respects UTF-8 Mode (GH-23119)
On Unix, the os.device_encoding() function now returns 'UTF-8' rather
than the device encoding if the Python UTF-8 Mode is enabled.
2020-11-04 11:20:10 +01:00
Mario Corchero 0001a1b69e
bpo-42251: Add gettrace and getprofile to threading (GH-23125)
This allows to retrieve the functions that were set in these two, which might differ from sys.gettrace and sys.getprofile within a thread.
2020-11-04 09:27:43 +00:00
Pablo Galindo a9abbda618 Python 3.10.0a2
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAl+gngEACgkQ/+h0BBaL
 2EfDABAAnQ/bHY40QjoQ+us2vufDj3uvm2S7w0LMM+kgrehhqEoG/FmVtfb8XIvD
 S8FFtSa/VkrVUXvxI/mMpWL78se+Qk9rVQJ8dUZ4SvFJVe1NJdCMNV2Ij263QgJU
 r6bNu42EODDrFAgG9vq5ImND1qnGkF+hKlMHYV3HZhTP4drBEY+TMaB55Vmsp9TH
 eBnfY50y+k8w0hJmsZA1LaVLAXU9WHaWVB90/D22Z9MJmmQF5ofsIFXYj+1IcEkE
 P5CLSCRSzVlpdeNiZWrcBIEK8ap4ZkHvwD8RI6Fu3E/h2TXeiDbp/nCHZDPZMVVk
 OVx3Z4BFTNXE4nmRDIiO5+GqIbgG10LFQKOrOvHQr6inookUaFGwJKwkaEheNr2T
 vcgZMy61OEOeiLqCe6AJ/PuNlQ267zslYucUpNqpQpCu8j691OGEHzv+NNcSRrEq
 T/S4spifDVpFPGLRDkFjJe1OQ33bVZFdJx7guY6WJXVkZILS8vghqQYng55CNzd/
 cdMqb5T6BBRb2SDqJ/qvUhyr7D8YML0pP5pywUUGKTdo84+mW5F/N2Q4g28ik9zv
 pgaehbAwS8jgoPbqH0Tz7qpXiWga9fTbFU47Az07xw5tQFD2+C5fdx+b1h2NBz2q
 exccvIw3Fn8zWikrKbeLgaSAWa2saw25dw0DMes8gG9uHD4+1JA=
 =XAGl
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAl+hk9UACgkQ/+h0BBaL
 2EdkYxAAs5ujyihMfyoRpU9jV7pNIIbpCHMgV2s74ZBh5jnDPYRfIrGtaE/9HlTp
 PPAScsJvnPwBGNdg8Bs1cLAk/VgJC696ccJXmNugfpxs9CSzhEKQ0oF8PPm+oyqH
 LgU6Dv8dP3+ebOko/vnRPTXbL5gdbvVJvNiV5KUjE6FL+IRl2PHlvUdcEplkPXZ4
 179kgP+8hMCB1Ai1KbMDpO2XIgdkJO+iXgXg9QNDCv2zcyr6OegGYI4cPyB3m/YK
 ZiBTnYK48x/l28Gdi+LISOGa4NNQ7R0j+Qao7YDoqe1yy8Ubj3NrLub+nNnSqnqb
 8PYaFz0sWpJ4I/vjrMaUOJ+hKSwdRZqHF/LqfQBFyBCndmhi6tJNqAzcByqi03HL
 YnXlAYJI9T3rFzBOutfjvbFWkiM2DKAL6dWBIsMeuNEO6MQWTwQHKfidXJyx9zCo
 Vv5QLG5daLFDIgI4qBjJ4POxgl+7eR+5sJBNIVz43KhemiRKLdmFKWmv6moloVB+
 1xoNGmwqz4dzmlAMUj2vJiPuUYl6+P38q1dpAChOXx4hOQZ1ybsmUVUD4S+bLGVQ
 f/VYg6B2I/Fr7Yz9HVYe309abKUSzSeYnW9FkAuTHTmZPjgZHdIJl7euTE0FtNOd
 HQ0paNeC44AoqEnghH35FhFXs+wbedszyc++TltTWn32v0nSVk0=
 =qIu/
 -----END PGP SIGNATURE-----

Merge tag 'v3.10.0a2' into master

Python 3.10.0a2
2020-11-03 17:30:57 +00:00
Serhiy Storchaka 212d32f45c
bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121) 2020-11-03 16:15:56 +02:00
Pablo Galindo 114ee5dec0
Python 3.10.0a2 2020-11-03 00:02:08 +00:00
Victor Stinner 45df61fd2d
bpo-26789: Fix logging.FileHandler._open() at exit (GH-23053)
The logging.FileHandler class now keeps a reference to the builtin
open() function to be able to open or reopen the file during Python
finalization.

Fix errors like:

    Exception ignored in: (...)
    Traceback (most recent call last):
      (...)
      File ".../logging/__init__.py", line 1463, in error
      File ".../logging/__init__.py", line 1577, in _log
      File ".../logging/__init__.py", line 1587, in handle
      File ".../logging/__init__.py", line 1649, in callHandlers
      File ".../logging/__init__.py", line 948, in handle
      File ".../logging/__init__.py", line 1182, in emit
      File ".../logging/__init__.py", line 1171, in _open
    NameError: name 'open' is not defined
2020-11-02 23:17:46 +01:00
Serhiy Storchaka 34637a0ce2
bpo-42103: Improve validation of Plist files. (GH-22882)
* Prevent some possible DoS attacks via providing invalid Plist files
  with extremely large number of objects or collection sizes.
* Raise InvalidFileException for too large bytes and string size instead of returning garbage.
* Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN).
* Raise InvalidFileException instead of TypeError for non-hashable dict keys.
* Add more tests for invalid Plist files.
2020-11-02 23:01:40 +02:00
Irit Katriel 6fdfcec5b1
bpo-41943: Fix bug where assertLogs doesn't correctly filter messages… (GH-22565)
… by level

@vsajip , @pitrou

Automerge-Triggered-By: GH:vsajip
2020-11-02 11:25:29 -08:00
Jason R. Coombs aca67da4fe
Revert "bpo-37193: remove thread objects which finished process its request (GH-13893)" (GH-23107)
This reverts commit c415590212.
2020-11-02 16:48:56 +00:00
Lysandros Nikolaou 301822859b
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067) 2020-11-02 17:27:30 +02:00
Julien Danjou 64366fa9b3
bpo-41435: Add sys._current_exceptions() function (GH-21689)
This adds a new function named sys._current_exceptions() which is equivalent ot
sys._current_frames() except that it returns the exceptions currently handled
by other threads. It is equivalent to calling sys.exc_info() for each running
thread.
2020-11-02 16:16:25 +02:00
Jakub Stasiak 3d86d090dc
bpo-42230: Improve asyncio documentation regarding accepting sets vs iterables (GH-23073)
People call wait() and as_completed() with various non-set iterables,
a list should be the most common but there are others as well[1].

Considering typeshed also documents wait()[2] and as_completed()[3]
as accepting arbitrary iterables I think it's a good idea to document
the status quo better.

[1] https://github.com/aio-libs/aiokafka/pull/672
[2] 620989bac5/stdlib/3/asyncio/tasks.pyi (L161)
[3] 620989bac5/stdlib/3/asyncio/tasks.pyi (L40)
2020-11-02 12:56:35 +02:00
Joongi Kim 6e8dcdaaa4
bpo-41229: Update docs for explicit aclose()-required cases and add contextlib.aclosing() method (GH-21545)
This is a PR to:

 * Add `contextlib.aclosing` which ia analogous to `contextlib.closing` but for async-generators with an explicit test case for [bpo-41229]()
 * Update the docs to describe when we need explicit `aclose()` invocation.

which are motivated by the following issues, articles, and examples:

 * [bpo-41229]()
 * https://github.com/njsmith/async_generator
 * https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#cleanup-in-generators-and-async-generators
 * https://www.python.org/dev/peps/pep-0533/
 * https://github.com/achimnol/aiotools/blob/ef7bf0cea7af/src/aiotools/context.py#L152

Particuarly regarding [PEP-533](https://www.python.org/dev/peps/pep-0533/), its acceptance (`__aiterclose__()`) would make this little addition of `contextlib.aclosing()` unnecessary for most use cases, but until then this could serve as a good counterpart and analogy to `contextlib.closing()`. The same applies for `contextlib.closing` with `__iterclose__()`.
Also, still there are other use cases, e.g., when working with non-generator objects with `aclose()` methods.
2020-11-02 00:02:48 -08:00
Tal Einat da7bb7b4d7
bpo-40511: Stop unwanted flashing of IDLE calltips (GH-20910)
They were occurring with both repeated 'force-calltip' invocations and by typing parentheses
 in expressions, strings, and comments in the argument code.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-11-01 22:59:52 -05:00
MARUYAMA Norihiro c415590212
bpo-37193: remove thread objects which finished process its request (GH-13893)
* bpo-37193: remove the thread which finished process request from threads list

* rename variable t to thread.

* don't remove thread from list if it is daemon.

* use lock to protect self._threads.

* use finally block in case of exception from shutdown_request().

* check "not thread.daemon" before lock to avoid holding the lock if it's unnecessary.

* fix the place of _threads_lock.

* separate code to remove a current thread into a function.

* check ValueError when removing thread.

* fix wrong code which all instance shared same lock.

* Extract thread management into a _Threads class to encapsulate atomic operations and separate concerns.

* Replace multiple references of 'block_on_close' with one, avoiding the possibility that 'block_on_close' could change during the course of processing requests. Now, there's exactly one _threads object with behavior fixed for the duration.

* Add docstrings to private classes.

* Add test to ensure that a ThreadingTCPServer can be closed without serving any requests.

* Use _NoThreads as the default value. Fixes AttributeError when server is closed without serving any requests.

* Add blurb

* Add test capturing failure.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-11-01 18:51:04 -05:00
kj 1f7dfb277e
bpo-42233: Correctly repr GenericAlias when used with typing module (GH-23081)
Noticed by @serhiy-storchaka in the bpo.  `typing`'s types were not showing the parameterized generic. 
Eg. previously:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict, list]'
```
Now:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict[str, float], list[int]]'
```

Automerge-Triggered-By: GH:gvanrossum
2020-11-01 10:13:38 -08:00
Inada Naoki d2810054c7
tempfile: Use random.choises() instead of choise() (GH-23068) 2020-11-01 20:02:03 +09:00
Ronald Oussoren 2165cea548
bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. (GH-23059)
[bpo-29566]() notes that binhex.binhex uses inconsistent line endings (both Unix and MacOS9 line endings are used). This PR changes this to use the MacOS9 line endings everywhere.
2020-11-01 01:08:48 -08:00
Lysandros Nikolaou 02cdfc93f8
bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)
Left-recursive rules need to check for errors explicitly, since
even if the rule returns NULL, the parsing might continue and lead
to long-distance failures.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-31 20:31:41 +02:00
Inada Naoki 43ca084c88
Revert "bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)"
`_RandomNameSequence` is not true singleton so using `os.register_at_fork` doesn't make sense unlike `random._inst`.

This reverts commit 8e409cebad.
2020-10-31 11:15:38 +09:00
Victor Stinner b62bdf71ea
bpo-42208: Add _locale._get_locale_encoding() (GH-23052)
* Add a new _locale._get_locale_encoding() function to get the
  current locale encoding.
* Modify locale.getpreferredencoding() to use it.
* Remove the _bootlocale module.
2020-10-31 01:32:11 +01:00
Pablo Galindo 06f8c3328d
bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the barry_as_flufl rule (GH-23048) 2020-10-30 23:48:42 +00:00
Akashkumar D Khunt d6238ba82d
bpo-42172: Correct typo for test_socket.py (GH-23013) 2020-10-30 15:03:51 +09:00
Eric W 8e409cebad
bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)
The _RandomSequence class in tempfile used to check the current pid every time its rng property was used.
This commit replaces this code with `os.register_at_fork` to reduce the overhead.
2020-10-30 13:56:28 +09:00
Victor Stinner 5776663675
bpo-42029: Remove IRIX code (GH-23023)
IRIX code was slowy removed in Python 2.4 (--with-sgi-dl), Python 3.3
(Irix threads), and Python 3.7.
2020-10-29 15:16:23 +01:00
Zackery Spytz df59273c7a
bpo-34204: Use pickle.DEFAULT_PROTOCOL in shelve (GH-19639)
Use pickle.DEFAULT_PROTOCOL (currently 5) in shelve instead of a
hardcoded 3.
2020-10-29 02:44:35 -07:00
Lysandros Nikolaou 15acc4eaba
bpo-41659: Disallow curly brace directly after primary (GH-22996) 2020-10-27 20:54:20 +02:00
Georges Toth 303aac8c56
bpo-30681: Support invalid date format or value in email Date header (GH-22090)
I am re-submitting an older PR which was abandoned but is still relevant, #10783 by @timb07.

The issue being solved () is still relevant. The original PR #10783 was closed as
the final request changes were not applied and since abandoned.

In this new PR I have re-used the original patch plus applied both comments from the review, by @maxking and @pganssle.


For reference, here is the original PR description:
In email.utils.parsedate_to_datetime(), a failure to parse the date, or invalid date components (such as hour outside 0..23) raises an exception. Document this behaviour, and add tests to test_email/test_utils.py to confirm this behaviour.

In email.headerregistry.DateHeader.parse(), check when parsedate_to_datetime() raises an exception and add a new defect InvalidDateDefect; preserve the invalid value as the string value of the header, but set the datetime attribute to None.

Add tests to test_email/test_headerregistry.py to confirm this behaviour; also added test to test_email/test_inversion.py to confirm emails with such defective date headers round trip successfully.

This pull request incorporates feedback gratefully received from @bitdancer, @brettcannon, @Mariatta and @warsaw, and replaces the earlier PR #2254.

Automerge-Triggered-By: GH:warsaw
2020-10-26 17:31:06 -07:00
Lisa Roach 8374d2ee15
bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654) 2020-10-26 09:28:17 -07:00
Alexey Izbyshev c0590c0033
bpo-42146: Fix memory leak in subprocess.Popen() in case of uid/gid overflow (GH-22966)
Fix memory leak in subprocess.Popen() in case of uid/gid overflow

Also add a test that would catch this leak with `--huntrleaks`.

Alas, the test for `extra_groups` also exposes an inconsistency
in our error reporting: we use a custom ValueError for `extra_groups`,
but propagate OverflowError for `user` and `group`.
2020-10-25 17:09:32 -07:00
Jason R. Coombs d1a0a960ee
bpo-42043: Add support for zipfile.Path subclasses (#22716)
* bpo-42043: Add support for zipfile.Path inheritance as introduced in zipp 3.2.0.

* Add blurb.
2020-10-25 14:45:05 -04:00
Hai Shi 14cdc215aa
bpo-41919: Avoid resource leak in test_io (GH-22973)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-25 18:38:33 +00:00
Jason R. Coombs df8d4c83a6
bpo-41490: ``path`` and ``contents`` to aggressively close handles (#22915)
* bpo-41490: ``path`` method to aggressively close handles

* Add blurb

* In ZipReader.contents, eagerly evaluate the contents to release references to the zipfile.

* Instead use _ensure_sequence to ensure any iterable from a reader is eagerly converted to a list if it's not already a sequence.
2020-10-25 14:21:46 -04:00
Mark Roseman 5df6c99cb4
bpo-33987: Add master ttk Frame to IDLE search dialogs (GH-22942) 2020-10-24 23:14:02 -04:00
Mark Roseman c579ad14d3
bpo-33987: Use master ttk Frame for IDLE config dialog (GH-22943) 2020-10-24 19:45:00 -04:00
Mark Roseman e53e54425d
bpo-33987: Use ttk Label on IDLE statusbar (GH-22941) 2020-10-24 19:32:34 -04:00
Serhiy Storchaka 8cd1dbae32
bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870) 2020-10-24 21:14:23 +03:00
Jacob Neil Taylor 16ee68da6e
bpo-38976: Add support for HTTP Only flag in MozillaCookieJar (#17471)
Add support for HTTP Only flag in MozillaCookieJar

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-10-23 15:48:55 -07:00
Christopher Marchfelder da6f098188
bpo-40592: shutil.which will not return None anymore if ; is the last char in PATHEXT (GH-20088)
shutil.which will not return None anymore for empty str in PATHEXT
Empty PATHEXT will now be defaulted to _WIN_DEFAULT_PATHEXT
2020-10-23 11:08:24 +01:00
Eric Snow 345cd37abe
bpo-36876: Fix the C analyzer tool. (GH-22841)
The original tool wasn't working right and it was simpler to create a new one, partially re-using some of the old code. At this point the tool runs properly on the master. (Try: ./python Tools/c-analyzer/c-analyzer.py analyze.)  It take ~40 seconds on my machine to analyze the full CPython code base.

Note that we'll need to iron out some OS-specific stuff (e.g. preprocessor). We're okay though since this tool isn't used yet in our workflow. We will also need to verify the analysis results in detail before activating the check in CI, though I'm pretty sure it's close.

https://bugs.python.org/issue36876
2020-10-22 18:42:51 -06:00
Cheryl Sabella facb522d44
bpo-33987: IDLE: Use ttk Frame on doc window and statusbar (GH-11433) 2020-10-22 15:14:35 -04:00
Mark Shannon b52432cb8c
bpo-42057: Add regression test to master. (GH-22893) 2020-10-23 00:42:26 +09:00
Batuhan Taskaya c7437e2c02
bpo-41747: Ensure all dataclass methods uses their parents' qualname (GH-22155)
* bpo-41747: Ensure all dataclass methods uses their parents' qualname

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-10-21 09:49:22 -04:00
Максим 5f22741340
bpo-23706: Add newline parameter to pathlib.Path.write_text (GH-22420) (GH-22420)
* Add _newline_ parameter to `pathlib.Path.write_text()`
* Update documentation of `pathlib.Path.write_text()`
* Add test case for `pathlib.Path.write_text()` calls with _newline_ parameter passed

Automerge-Triggered-By: GH:methane
2020-10-20 19:08:19 -07:00
Terry Jan Reedy a460d45063
Update idlelib/help.html to current Sphinx output (GH-22833)
idle.rst is unchanged
2020-10-20 20:56:01 -04:00
Gregory P. Smith 786addd9d0
bpo-41586: Attempt to make the pipesize tests more robust. (GH-22839)
Several buildbots are failing on these, likely due to an inability to
set the pipe size to the desired test value.
2020-10-20 17:37:20 -07:00
Serhiy Storchaka 1d3469988e
bpo-38144: Re-add accidentally removed audition for glob. (GH-22805) 2020-10-20 19:45:38 +03:00
Andrey Doroschenko ec42789e6e
bpo-39693: mention KeyError in tarfile extractfile documentation (GH-18639)
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
2020-10-20 10:05:01 -04:00
Miro Hrončok faddc7449d
bpo-38439: Add 256px IDLE icon to the .ico, drop gifs from it (GH-19648) 2020-10-20 13:21:08 +01:00
TIGirardi f2312037e3
bpo-38324: Fix test__locale.py Windows failures (GH-20529)
Use wide-char _W_* fields of lconv structure on Windows
Remove "ps_AF" from test__locale.known_numerics on Windows
2020-10-20 12:39:52 +01:00
Ronald Oussoren 3185267400
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) 2020-10-20 09:26:33 +02:00
Raymond Hettinger 871934d4cf
bpo-4356: Add key function support to the bisect module (GH-20556) 2020-10-19 22:04:01 -07:00
Justin Turner Arthur de73d432bb
bpo-38912: fix close before connect callback in test_asyncio SSL tests (GH-22691)
Reduces the rate at which the ENV CHANGED failure occurs in test_asyncio SSL tests (due to unclosed transport), but does not 100% resolve it.
2020-10-19 21:18:57 -04:00
Ruben Vorderman 23c0fb8edd
bpo-41586: Add pipesize parameter to subprocess & F_GETPIPE_SZ and F_SETPIPE_SZ to fcntl. (GH-21921)
* Add F_SETPIPE_SZ and F_GETPIPE_SZ to fcntl module
* Add pipesize parameter for subprocess.Popen class

This will allow the user to control the size of the pipes.
On linux the default is 64K. When a pipe is full it blocks for writing.
When a pipe is empty it blocks for reading. On processes that are
very fast this can lead to a lot of wasted CPU cycles. On a typical
Linux system the max pipe size is 1024K which is much better.
For high performance-oriented libraries such as xopen it is nice to
be able to set the pipe size.

The workaround without this feature is to use my_popen_process.stdout.fileno() in
conjuction with fcntl and 1031 (value of F_SETPIPE_SZ) to acquire this behavior.
2020-10-19 16:30:02 -07:00
Mark Sapiro bf838227c3
bpo-27321 Fix email.generator.py to not replace a non-existent header. (GH-18074)
This PR replaces #1977. The reason for the replacement is two-fold.

The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit.

Also the tests are different. The test_nonascii_as_string_without_cte test in #1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness.

Automerge-Triggered-By: @warsaw
2020-10-19 15:49:19 -07:00
Jason R. Coombs 5456e78f45
bpo-16396: Allow wintypes to be imported on non-Windows systems. (GH-21394)
Co-authored-by: Christian Heimes <christian@python.org>
2020-10-19 23:06:05 +01:00
Barry Warsaw 96ddc58281
bpo-42089: Sync with current cpython branch of importlib_metadata (GH-22775)
~~The only differences are in the test files.~~

Automerge-Triggered-By: @jaraco
2020-10-19 14:14:21 -07:00
Ronald Oussoren 93a1ccabde
bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762) 2020-10-19 20:16:21 +02:00
Ronald Oussoren 05ee790f4d
bpo-42051: Reject XML entity declarations in plist files (#22760) 2020-10-19 20:13:49 +02:00
Bar Harel 5368c2b6e2
bpo-19270: Fixed sched.scheduler.cancel to cancel correct event (GH-22729) 2020-10-19 10:33:43 +03:00
Anthony Sottile 3c0ac18504
bpo-40492: Fix --outfile with relative path when the program changes it working dir (GH-19910) 2020-10-18 23:48:31 +03:00
Irit Katriel b81c833ab5
bpo-28660: Make TextWrapper break long words on hyphens (GH-22721) 2020-10-18 20:01:15 +03:00
scaramallion c304c9a7ef
bpo-41966: Fix pickling pure datetime.time subclasses (GH-22731) 2020-10-18 17:49:48 +03:00
Max Bernstein 3635388f52
bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message (GH-19940) 2020-10-17 23:38:21 +03:00
Necdet Can Atesman e9959c7118
bpo-42011: Update documentation of logging.Filter.filter() (GH-22692) 2020-10-16 15:14:07 +01:00
Hai Shi c9f696cb96
bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)
* Move the codecs' (un)register operation to testcases.
* Remove _codecs._forget_codec() and _PyCodec_Forget()
2020-10-16 10:34:15 +02:00
Brandt Bucher c13b847a6f
bpo-41984: GC track all user classes (GH-22701) 2020-10-14 18:44:07 -07:00
Hai Shi c5b049b91c
bpo-39337: encodings.normalize_encoding() now ignores non-ASCII characters (GH-22219) 2020-10-14 17:43:31 +02:00
Anatoliy Platonov b4d895336a
bpo-41876: Overload __repr__ for tkinter Font objects (GH-22450) 2020-10-14 13:02:51 +03:00
Ned Deily 6a48518e8d
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688) 2020-10-13 21:38:56 -04:00
linchiwei123 abe244c458
[doc] Fix typo in the graphlib docs (GH-22661)
Automerge-Triggered-By: @pablogsal
2020-10-12 07:33:34 -07:00
Victor Stinner 13ff396c01
bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655)
The test now waits until all threads complete to avoid leaking
running threads.

Also, use regular threads rather than daemon threads.
2020-10-12 00:37:20 +02:00
Batuhan Taskaya 22220ae216
bpo-38605: bump the magic number for 'annotations' future (#22630) 2020-10-10 15:19:46 -07:00
Saiyang Gou b2c0a43699
bpo-39481: Fix duplicate SimpleQueue type in test_genericalias.py (GH-22619)
There are two different `SimpleQueue` types imported (from `multiprocessing.queues` and `queue`) in `Lib/test/test_genericalias.py`, the second one shadowing the first one, making the first one not actually tested. Fix by using different names.

Automerge-Triggered-By: @gvanrossum
2020-10-09 13:00:15 -07:00
Serhiy Storchaka eb38c6b7aa
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355) 2020-10-09 22:57:34 +03:00
Serhiy Storchaka f25323a307
bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) 2020-10-09 21:45:46 +03:00
Serhiy Storchaka e2ec0b27c0
bpo-41974: Remove complex.__float__, complex.__floordiv__, etc (GH-22593)
Remove complex special methods __int__, __float__, __floordiv__,
__mod__, __divmod__, __rfloordiv__, __rmod__ and __rdivmod__
which always raised a TypeError.
2020-10-09 14:14:37 +03:00
Batuhan Taskaya 48f305fd12
bpo-41979: Accept star-unpacking on with-item targets (GH-22611)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-09 10:56:48 +01:00
Hai Shi 3f342376ab
bpo-39337: Add a test case for normalizing of codec names (GH-19069) 2020-10-08 21:20:57 +02:00
Pablo Galindo 27ac19cca2
bpo-41976: Fix the fallback to gcc of ctypes.util.find_library when using gcc>9 (GH-22598) 2020-10-08 19:31:19 +01:00
E-Paine aecf036738
bpo-41306: Allow scale value to not be rounded (GH-21715)
This fixes the test failure with Tk 6.8.10 which is caused by changes to how Tk rounds the `from`, `to` and `tickinterval` arguments. This PR uses `noconv` if the patchlevel is greater than or equal to 8.6.10 (credit to Serhiy for this idea as it is much simpler than what I previously proposed).

Going into more detail for those who want it, the Tk change was made in [commit 591f68c](591f68cb38) and means that the arguments listed above are rounded relative to the value of `from`. However, when rounding the `from` argument ([line 623](591f68cb38/generic/tkScale.c (L623))), it is rounded relative to itself (i.e. rounding `0`) and therefore the assigned value for `from` is always what is given (no matter what values of `from` and `resolution`).

Automerge-Triggered-By: @pablogsal
2020-10-08 06:30:13 -07:00
Pablo Galindo 4a9f82f50d
bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported (GH-22595)
…

Automerge-Triggered-By: @pablogsal
2020-10-08 06:24:28 -07:00
Raymond Hettinger 4e0ce82058
Revert "bpo-26680: Incorporate is_integer in all built-in and standard library numeric types (GH-6121)" (GH-22584)
This reverts commit 58a7da9e12.
2020-10-07 16:43:44 -07:00
Mikhail Golubev 4f3c25043d
bpo-41923: PEP 613: Add TypeAlias to typing module (#22532)
This special marker annotation is intended to help in distinguishing
proper PEP 484-compliant type aliases from regular top-level variable
assignments.
2020-10-07 14:44:31 -07:00
Batuhan Taskaya 044a1048ca
bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)
The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions.

For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
2020-10-06 13:03:02 -07:00
Ben Avrahami bef7d299eb
bpo-41905: Add abc.update_abstractmethods() (GH-22485)
This function recomputes `cls.__abstractmethods__`.
Also update `@dataclass` to use it.
2020-10-06 10:40:50 -07:00
Florian Bruhin a8bf44d049
bpo-41944: No longer call eval() on content received via HTTP in the UnicodeNames tests (GH-22575)
Similarly to GH-22566, those tests called eval() on content received via
HTTP in test_named_sequences_full. This likely isn't exploitable because
unicodedata.lookup(seqname) is called before self.checkletter(seqname,
None) - thus any string which isn't a valid unicode character name
wouldn't ever reach the checkletter method.

Still, it's probably better to be safe than sorry.
2020-10-06 16:21:56 +02:00
Serhiy Storchaka 2ef5caa58f
bpo-41944: No longer call eval() on content received via HTTP in the CJK codec tests (GH-22566) 2020-10-06 15:14:51 +03:00
Pablo Galindo 8e9afaf822
Python 3.10.0a1 2020-10-05 18:30:18 +01:00
Victor Stinner 1fce240d6c
bpo-41939: Fix test_site.test_license_exists_at_url() (#22559)
Call urllib.request.urlcleanup() to reset the global
urllib.request._opener.
2020-10-05 18:24:00 +02:00
Serhiy Storchaka 9ece9cd65c
bpo-41909: Enable previously disabled recursion checks. (GH-22536)
Enable recursion checks which were disabled when get __bases__ of
non-type objects in issubclass() and isinstance() and when intern
strings. It fixes a stack overflow when getting __bases__ leads
to infinite recursion.

Originally recursion checks was disabled for PyDict_GetItem() which
silences all errors including the one raised in case of detected
recursion and can return incorrect result. But now the code uses
PyDict_GetItemWithError() and PyDict_SetDefault() instead.
2020-10-05 00:55:57 +03:00
Pablo Galindo 2cc6dc9896
bpo-41490: Bump vendored pip to version 20.2.3 (#22527) 2020-10-04 18:45:31 +02:00
Hansraj Das a619af43cc
Delete extra 'the' from `Formatter` class docstring (GH-22530) 2020-10-04 17:09:26 +01:00
Batuhan Taskaya e799aa8b92
bpo-41887: omit leading spaces/tabs on ast.literal_eval (#22469)
Also document that eval() does this (the same way).
2020-10-03 17:46:44 -07:00
Pablo Galindo fb0a4651f1
bpo-41840: Report module-level globals as both local and global in the symtable module (GH-22391) 2020-10-03 20:45:55 +01:00
Jason R. Coombs ebbe8033b1
bpo-40564: Avoid copying state from extant ZipFile. (GH-22371)
bpo-40564: Avoid copying state from extant ZipFile.
2020-10-03 10:58:39 -04:00
Pablo Galindo c111355480
bpo-41826: Fix compiler warnings in test_peg_generator (GH-22455)
Co-authored-by: Skip Montanaro
2020-10-03 17:28:51 +03:00
Ram Rachum 52301312bb
bpo-41867: List options for timespec in docstrings of isoformat methods (GH-22418) 2020-10-03 13:43:47 +03:00
Ram Rachum f97e42ef4d
bpo-40833: Clarify Path.rename doc-string regarding relative paths (GH-20554) 2020-10-03 12:52:13 +03:00
scoder 6a412c94b6
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a default namespace was defined. (GH-22474) 2020-10-03 08:07:07 +02:00
Hansraj Das 9cd01ece78
Typo fix - "mesasge" should be "message" (GH-22498)
* Correct at 2 places in email module
2020-10-02 13:21:45 -07:00
Robert Smallshire 58a7da9e12
bpo-26680: Incorporate is_integer in all built-in and standard library numeric types (GH-6121)
* bpo-26680: Adds support for int.is_integer() for compatibility with float.is_integer().

The int.is_integer() method always returns True.

* bpo-26680: Adds a test to ensure that False.is_integer() and True.is_integer() are always True.

* bpo-26680: Adds Real.is_integer() with a trivial implementation using conversion to int.

This default implementation is intended to reduce the workload for subclass
implementers. It is not robust in the presence of infinities or NaNs and
may have suboptimal performance for other types.

* bpo-26680: Adds Rational.is_integer which returns True if the denominator is one.

This implementation assumes the Rational is represented in it's
lowest form, as required by the class docstring.

* bpo-26680: Adds Integral.is_integer which always returns True.

* bpo-26680: Adds tests for Fraction.is_integer called as an instance method.

The tests for the Rational abstract base class use an unbound
method to sidestep the inability to directly instantiate Rational.
These tests check that everything works correct as an instance method.

* bpo-26680: Updates documentation for Real.is_integer and built-ins int and float.

The call x.is_integer() is now listed in the table of operations
which apply to all numeric types except complex, with a reference
to the full documentation for Real.is_integer().  Mention of
is_integer() has been removed from the section 'Additional Methods
on Float'.

The documentation for Real.is_integer() describes its purpose, and
mentions that it should be overridden for performance reasons, or
to handle special values like NaN.

* bpo-26680: Adds Decimal.is_integer to the Python and C implementations.

The C implementation of Decimal already implements and uses
mpd_isinteger internally, we just expose the existing function to
Python.

The Python implementation uses internal conversion to integer
using to_integral_value().

In both cases, the corresponding context methods are also
implemented.

Tests and documentation are included.

* bpo-26680: Updates the ACKS file.

* bpo-26680: NEWS entries for int, the numeric ABCs and Decimal.

Co-authored-by: Robert Smallshire <rob@sixty-north.com>
2020-10-01 17:30:08 +01:00
Mark Shannon 17b5be0c0a
bpo-41670: Remove outdated predict macro invocation. (GH-22026)
Remove PREDICTion of POP_BLOCK from FOR_ITER.
2020-09-29 10:09:13 +01:00
Ram Rachum b0dfc75816
bpo-41773: Raise exception for non-finite weights in random.choices(). (GH-22441) 2020-09-28 18:32:10 -07:00
Dennis Sweeney e8acc355d4
bpo-41873: Add vectorcall for float() (GH-22432) 2020-09-29 09:55:52 +09:00
Hai Shi d332e7b816
bpo-41842: Add codecs.unregister() function (GH-22360)
Add codecs.unregister() and PyCodec_Unregister() functions
to unregister a codec search function.
2020-09-28 23:41:11 +02:00
Jan Mazur ff9147d93b
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337) 2020-09-28 21:53:33 +03:00
Andre Delfino e8a2076e14
Revert "Fix all Python Cookbook links (#22205)" (GH-22424)
This commit reverts commit ac0333e1e1 as the original links are working again and they provide extended features such as comments and alternative versions.
2020-09-27 01:47:25 +01:00
Eric Larson 9fdb76c34c
Fix logging error message (GH-22410)
Same changes as #22276 squashed to a single commit. Just hoping to get Travis to cooperate by opening a new PR...

Automerge-Triggered-By: @vsajip
2020-09-25 11:08:50 -07:00
Mark Shannon 02d126aa09
bpo-39934: Account for control blocks in 'except' in compiler. (GH-22395)
* Account for control blocks in 'except' in compiler. Fixes #39934.
2020-09-25 14:04:19 +01:00
Terry Jan Reedy 05cc881cbc
bpo-41775: Make 'IDLE Shell' the shell title (#22399)
'Python Shell' may have contributed to some beginners confusing 'IDLE' with ' Python'.
2020-09-24 15:30:09 -04:00
Victor Stinner 98c16c991d
bpo-41833: threading.Thread now uses the target name (GH-22357) 2020-09-23 23:21:19 +02:00
Zackery Spytz 2e4dd336e5
bpo-30155: Add macros to get tzinfo from datetime instances (GH-21633)
Add PyDateTime_DATE_GET_TZINFO() and PyDateTime_TIME_GET_TZINFO()
macros.
2020-09-23 14:43:45 -04:00
Terry Jan Reedy 7af072c3b6
bpo-41841: Prepare IDLE News for 3.10 (GH-22379) 2020-09-23 09:44:31 -04:00
Ethan Furman d986d1657e
bpo-41816: `StrEnum.__str__` is `str.__str__` (GH-22362)
use `str.__str__` for `StrEnum` so that `str(StrEnum.member)` is the same as directly accessing the string value of the `StrEnum` member
2020-09-22 13:00:07 -07:00
Terry Jan Reedy 947adcaa13
bpo-35764: Rewrite the IDLE Calltips doc section (GH-22363) 2020-09-22 13:21:58 -04:00
Bas van Beek 0d0e9fe2ff
bpo-41810: Reintroduce `types.EllipsisType`, `.NoneType` & `.NotImplementedType` (GH-22336)
closes issue 41810
2020-09-22 08:55:34 -07:00
Thomas Grainger a68a2ad19c
bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (#21956)
Closes bpo issue 41602
2020-09-22 08:53:03 -07:00
Ethan Furman ea0711a9f9
bpo-41817: use new StrEnum to ensure all members are strings (GH-22348)
* use new StrEnum to ensure all members are strings
2020-09-22 08:01:17 -07:00
Serhiy Storchaka 557b9a52ed
bpo-40670: More reliable validation of statements in timeit.Timer. (GH-22358)
It now accepts "empty" statements (only whitespaces and comments)
and rejects misindentent statements.
2020-09-22 16:16:46 +03:00
Terry Jan Reedy 40a0625792
bpo-40181: Remove '/' reminder in IDLE calltips. (GH-22350)
The marker was added to the language in 3.8 and
3.7 only gets security patches.
2020-09-22 01:43:55 -04:00
Ethan Furman 0063ff4e58
bpo-41816: add `StrEnum` (GH-22337)
`StrEnum` ensures that its members were already strings, or intended to
be strings.
2020-09-21 17:23:13 -07:00
Angelin BOOZ 68526fe258
bpo-40084: Enum - dir() includes member attributes (GH-19219) 2020-09-21 06:11:06 -07:00
Raymond Hettinger bc6b7fa6d7
bpo-41513: Add accuracy tests for math.hypot() (GH-22327) 2020-09-20 21:47:56 -07:00
Berker Peksag 5c0eed7375
bpo-12178: Fix escaping of escapechar in csv.writer() (GH-13710)
Co-authored-by: Itay Elbirt <anotahacou@gmail.com>
2020-09-20 09:38:07 +03:00
Peter McCormick bfee9fad84
bpo-41815: SQLite: segfault if backup called on closed database (GH-22322)
# [bpo-41815](): SQLite: fix segfault if backup called on closed database

Attempting to backup a closed database will trigger segfault:

```python
import sqlite3
target = sqlite3.connect(':memory:')
source = sqlite3.connect(':memory:')
source.close()
source.backup(target)
```
2020-09-19 20:40:46 -07:00
idomic 0c71a66b53
bpo-33689: Blank lines in .pth file cause a duplicate sys.path entry (GH-20679) 2020-09-19 22:13:29 +03:00
Ethan Furman ae0d2a33ec
bpo-41811: create SortKey members using first given value (GH-22316) 2020-09-19 11:12:57 -07:00
Serhiy Storchaka 0b419b7910
bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998)
* When the parameters argument is a list, correctly handle the case
  of changing it during iteration.
* When the parameters argument is a custom sequence, no longer
  override an exception raised in ``__len__()``.
2020-09-17 10:35:44 +03:00
Ethan Furman 7219e27087
Enum: make `Flag` and `IntFlag` members iterable (GH-22221) 2020-09-16 13:01:00 -07:00
Ethan Furman fc23a9483e
_auto_called cleanup (GH-22285) 2020-09-16 12:37:54 -07:00
Ethan Furman c95ad7a91f
bpo-39728: Enum: fix duplicate `ValueError` (GH-22277)
fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
2020-09-16 10:26:50 -07:00
Ethan Furman 3064dbf5df
bpo-41517: do not allow Enums to be extended (#22271)
fix bug that let Enums be extended via multiple inheritance
2020-09-16 07:11:57 -07:00
Patrick Reader 0705ec8a14
bpo-41792: Add is_typeddict function to typing.py (GH-22254)
Closes issue41792.

Also closes https://github.com/python/typing/issues/751.
2020-09-15 21:58:32 -07:00
Ethan Furman 22415ad625
bpo-41789: honor object overrides in Enum classes (GH-22250)
EnumMeta double-checks that `__repr__`, `__str__`, `__format__`, and `__reduce_ex__` are not the same as `object`'s, and replaces them if they are -- even if that replacement was intentionally done in the Enum being constructed.  This patch fixes that.

Automerge-Triggered-By: @ethanfurman
2020-09-15 16:28:25 -07:00
Ethan Furman bff01f3a3a
bpo-39587: Enum - use correct mixed-in data type (GH-22263) 2020-09-15 15:56:26 -07:00
Batuhan Taskaya 2e87774df1
bpo-41780: Fix __dir__ of types.GenericAlias (GH-22262)
Automerge-Triggered-By: @gvanrossum
2020-09-15 14:58:32 -07:00
Andre Delfino ac0333e1e1
Fix all Python Cookbook links (#22205) 2020-09-15 21:13:26 +01:00
Ethan Furman 5a565b3d7c
minor reformat of enum tests (GH-22259)
Automerge-Triggered-By: @ethanfurman
2020-09-15 12:27:06 -07:00
Victor Stinner e5fbe0cbd4
bpo-41631: _ast module uses again a global state (#21961)
Partially revert commit ac46eb4ad6662cf6d771b20d8963658b2186c48c:
"bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)".

Using a module state per module instance is causing subtle practical
problems.

For example, the Mercurial project replaces the __import__() function
to implement lazy import, whereas Python expected that "import _ast"
always return a fully initialized _ast module.

Add _PyAST_Fini() to clear the state at exit.

The _ast module has no state (set _astmodule.m_size to 0). Remove
astmodule_traverse(), astmodule_clear() and astmodule_free()
functions.
2020-09-15 18:03:34 +02:00
Raymond Hettinger 95a8a0e01d
bpo-41513: Remove broken tests that fail on Gentoo (GH-22249) 2020-09-14 17:13:49 -07:00
Raymond Hettinger 457d4e97de
bpo-41513: Add docs and tests for hypot() (GH-22238) 2020-09-13 23:33:41 -07:00
Zackery Spytz 2ec67526a6
bpo-38967: Improve the error msg for reserved _sunder_ names in enum (GH-18370) 2020-09-13 13:27:51 -07:00
Victor Stinner 1b0f0e3d7d
bpo-39651: Fix asyncio proactor _write_to_self() (GH-22197)
Fix a race condition in the call_soon_threadsafe() method of
asyncio.ProactorEventLoop: do nothing if the self-pipe socket has
been closed.
2020-09-12 08:50:18 +02:00
Terry Jan Reedy 7e711ead26
bpo-41731: Make test_cmd_line_script pass with -vv (GH-22206)
Argument script_exec_args is usually an absolute file name,
but twice has form ['-m', 'module_name'].
2020-09-12 02:25:36 -04:00
Terry Jan Reedy 471247150e
Update idlelib/help.html to current IDLE doc (GH-22181) 2020-09-09 18:53:18 -04:00
Maggie Moss 1b4552c5e8
bpo-41428: Implementation for PEP 604 (GH-21515)
See https://www.python.org/dev/peps/pep-0604/ for more information.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2020-09-09 21:23:24 +01:00
Serhiy Storchaka 58de1dd6a8
bpo-41525: Make the Python program help ASCII-only (GH-21836) 2020-09-09 01:28:02 +01:00
Graham Bleaney 84ef33c511
Fix typo in typing.py (GH-22121)
This is a trivial PR to fix a typo in a docstring in typing.py. From reverences -> references
2020-09-08 15:41:10 -07:00
Irit Katriel 3fd69991f4
bpo-38762: Extend logging.test_multiprocessing to cover missing cases. (GH-22142) 2020-09-08 20:40:04 +01:00
Erlend Egeberg Aasland 207c321f13
bpo-40744: Drop support for SQLite pre 3.7.3 (GH-20909)
Remove code required to support SQLite pre 3.7.3.

Co-written-by: Berker Peksag <berker.peksag@gmail.com>
Co-written-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2020-09-07 22:26:54 +01:00
Artem Bulgakov 22748a83d9
bpo-41316: Make tarfile follow specs for FNAME (GH-21511)
tarfile writes full path to FNAME field of GZIP format instead of just basename if user specified absolute path. Some archive viewers may process file incorrectly. Also it creates security issue because anyone can know structure of directories on system and know username or other personal information.

RFC1952 says about FNAME:
This is the original name of the file being compressed, with any directory components removed.

So tarfile must remove directory names from FNAME and write only basename of file.

Automerge-Triggered-By: @jaraco
2020-09-07 09:46:33 -07:00
Serhiy Storchaka fd4cafd470
bpo-41720: Add "return NotImplemented" in turtle.Vec2D.__rmul__(). (GH-22092) 2020-09-07 18:55:22 +03:00
Jakub Kulík 8c0be6fd91
bpo-41687: Fix sendfile implementation to work with Solaris (#22040) 2020-09-05 12:10:01 -07:00
Steve Dower dd18001c30
bpo-41627: Distinguish 32 and 64-bit user site packages on Windows (GH-22098)
Also fixes the error message returned when sysconfig fails to interpolate a variable correctly.
2020-09-05 00:45:54 +01:00
Dong-hee Na 54a66ade20
bpo-41700: Skip test if the locale is not supported (GH-22081) 2020-09-04 17:47:40 +09:00
Pablo Galindo e55a0e971b
Fix 'gather' rules in the python parser generator (GH-22021)
Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
2020-09-03 15:29:55 +01:00
Ben Darnell be435ae2b0
bpo-39010: Improve test shutdown (#22066)
Simply closing the event loop isn't enough to avoid warnings. If we
don't also shut down the event loop's default executor, it sometimes
logs a "dangling thread" warning.

Follow-up to GH-22017
2020-09-02 21:58:50 -07:00
Shantanu 0770ad948c
bpo-41696: Fix handling of debug mode in asyncio.run (#22069)
* bpo-41696: Fix handling of debug mode in asyncio.run

This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run

* 📜🤖 Added by blurb_it.

Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-09-02 21:54:46 -07:00
Benjamin Peterson 3940333637
closes bpo-41689: Preserve text signature from tp_doc in C heap type creation. (GH-22058) 2020-09-02 11:29:06 -05:00
han-solo 749ed85e44
Fixed mistake in test for f-string error description (GH-22036) (GH-22059) 2020-09-02 04:56:37 -04:00
Shantanu 17dc1b789e
bpo-39349: Add cancel_futures to Executor.shutdown base class (GH-22023)
* Add cancel_futures parameter to the Executor base class, since it was missed in the original PR (https://github.com/python/cpython/pull/18057) that added cancel_futures.
2020-09-01 17:18:07 -04:00
Pablo Galindo 9b648a95cc
bpo-41654: Fix deallocator of MemoryError to account for subclasses (GH-22020)
When allocating MemoryError classes, there is some logic to use
pre-allocated instances in a freelist only if the type that is being
allocated is not a subclass of MemoryError. Unfortunately in the
destructor this logic is not present so the freelist is altered even
with subclasses of MemoryError.
2020-09-01 19:39:46 +01:00
Marek Madejski 6844b56176
bpo-41528: Use math module in turtle (GH-21837)
Use angle-related functions from math module instead of reinventing the wheel.
2020-09-01 12:42:41 -04:00
han-solo 0d6aa7f0ee
bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` in format specifier (GH-22036)
* Fixed `f-string/str.format` error description when using two `,` in format specifier.

Co-authored-by: millefalcon <hanish0019@hmail.com>
2020-09-01 10:34:29 -04:00
Ben Darnell ea5a6363c3
bpo-39010: Fix errors logged on proactor loop restart (#22017)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
2020-08-31 12:57:52 -07:00
Vinay Sharma 475a5fbb56
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) 2020-08-30 20:03:11 +01:00
Irit Katriel 582f13786b
bpo-39994: Fix pprint handling of dict subclasses that override __repr__ (GH-21892)
Co-authored-by: Palak Kumar Jha
2020-08-30 20:29:53 +03:00
Irit Katriel 022bc7572f
bpo-41609: Fix output of pdb's whatis command for instance methods (GH-21935) 2020-08-27 02:51:12 +02:00
Dong-hee Na 94ad6c674f bpo-33660: Fix PosixPath to resolve a relative path on root 2020-08-27 02:24:38 +02:00
Elvis Pranskevichus a2118a1462
bpo-37658: Fix asyncio.wait_for() to respect waited task status (#21894)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
2020-08-26 09:42:45 -07:00
Elvis Pranskevichus c517fc7121
bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 (#21895)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative.  This takes care of that.

Props to @aaliddell for noticing the inconsistency.
2020-08-26 09:42:22 -07:00
Cleber Rosa 1afb42cfa8
bpo-41572: Fix grammar in BaseTransport.close docstring (GH-21914)
Fix grammar in BaseTransport.close docstring.

https://bugs.python.org/issue41572

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2020-08-20 18:10:01 +05:30
James Weaver 29f84294d8
bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method not a coroutine (GH-21852)
asyncio.AbstractEventLoop.run_in_executor should be a method that returns an asyncio Future, not an async method.
This matches the concrete implementations, and the documentation better.
2020-08-17 07:19:46 -07:00
Allen 99c0ee3c89
Fix typo in message from assert statement (GH-21283)
The error message was missing space between the action "acquire" and "_wait_semaphore" which is an attribute for instances of Condition.
2020-08-17 19:08:55 +05:30
Victor Stinner fbf43f051e
bpo-41521: Rename blacklist parameter to not_exported (GH-21824)
Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".
2020-08-17 07:20:40 +02:00
Irit Katriel 2353d77fad
bpo-41503: Fix race between setTarget and flush in logging.handlers.MemoryHandler (GH-21765) 2020-08-16 16:10:13 +01:00
Raymond Hettinger fff3c28052
bpo-41513: Improve speed and accuracy of math.hypot() (GH-21803) 2020-08-15 19:38:19 -07:00
Stefan Krah 39dab24621
bpo-41540: AIX: skip test that is flaky with a default ulimit. (#21890)
- AIX has extreme over-allocation that is in no relation to the physical
    RAM and swap.
2020-08-15 20:19:07 +02:00
Paul Ganssle 87d8287865
bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965)
Prior to this change, attempting to subclass the C implementation of
zoneinfo.ZoneInfo gave the following error:

    TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument

https://bugs.python.org/issue41025
2020-08-13 22:38:30 -04:00
Rishav Kundu e55de68be3
bpo-41410: Fix outdated info in mkstemp docs (GH-21701)
Automerge-Triggered-By: @ericvsmith
2020-08-13 18:33:14 -07:00
Victor Stinner 20ae565bd2
bpo-41521: Replace denylist with blocklist is http.cookiejar doc (GH-21826)
The http.cookiejar module has is_blocked() and blocked_domains()
methods, so "blocklist" term sounds better than "denylist" in this
module.

Replace also denylisted with denied in test___all__.
2020-08-13 19:20:28 +02:00
Terry Jan Reedy c818b15fa5
bpo-41520: Fix second codeop regression (GH-21848)
* bpo-41520: Fix second codeop repression

Fix the repression introduced by the initial regression fix.
2020-08-13 13:18:49 -04:00
Pablo Galindo c51db0ea40
bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements (GH-21850) 2020-08-13 09:48:41 +01:00
Victor Stinner 369a1cbdee
bpo-41520: codeop no longer ignores SyntaxWarning (GH-21838) 2020-08-12 14:53:28 +02:00
Victor Stinner 0e95bbf085
bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825) 2020-08-12 10:53:12 +02:00
Victor Stinner 0ee0b2938c
bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21823)
Rename 5 test method names in test_codecs and test_typing.
2020-08-11 15:28:43 +02:00
Victor Stinner fabd7bb8e0
bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)
Automerge-Triggered-By: @tiran
2020-08-11 06:26:59 -07:00
Hai Shi 490c5426b1
bpo-40275: Fix failed test cases by using test helpers (GH-21811) 2020-08-10 23:24:02 +02:00
Filipe Laíns 4ce6faa6c9
bpo-16995: add support for base32 extended hex (base32hex) (GH-20441)
cc @pganssle

Automerge-Triggered-By: @pganssle
2020-08-10 07:48:20 -07:00
Stefan Krah 39042e00ab
bpo-41324 Add a minimal decimal capsule API (#21519) 2020-08-10 16:32:21 +02:00
Terry Jan Reedy 416f0b71ba
bpo-41514: Fix buggy IDLE test (GH-21808)
test_run method test_fatal_error failed when run twice, as with
python -m test -m test_fatal_error test_idle test_idle
because func.called was not reinitialized to 0.
This bug caused a failure on a refleak buildbot.
2020-08-10 06:43:56 -07:00
Terry Jan Reedy f2e161c279
bpo-41468: Improve and test IDLE run error exit (GH-21798)
A message box pops up when an unexpected error stops the run process.  Tell users it is likely a random glitch, but report it if not.
2020-08-09 16:08:30 -04:00
Terry Jan Reedy 8b67bf907c
Improve renamed test_run.RecursionLimitTest (GH-21794)
PEP 8 style and new comments.
2020-08-09 13:08:19 -04:00
Zackery Spytz e28b8c9387
bpo-35018: Sax parser should provide user access to lexical handlers (GH-20958)
Co-Authored-By: Jonathan Gossage <jgossage@gmail.com>
2020-08-09 12:50:53 +02:00
Hai Shi c6f282f3b1
bpo-40275: Use new test.support helper submodules in tests (GH-21785) 2020-08-08 13:05:24 +02:00
Hai Shi d94af3f7ed
bpo-40275: Remove test helpers aliases in test.support (GH-21771) 2020-08-08 11:32:41 +02:00
Konge a4084b9d1e
bpo-41497: Fix potential UnicodeDecodeError in dis CLI (GH-21757) 2020-08-08 12:03:09 +09:00
Hai Shi fcce8c649a
bpo-40275: Use new test.support helper submodules in tests (GH-21772) 2020-08-07 23:55:35 +02:00
Victor Stinner e27a51c11e
bpo-41473: Skip test_gdb with gdb 9.2 to work around gdb bug (GH-21768)
gdb 9.2 on Fedora Rawhide is not reliable, see:

* https://bugs.python.org/issue41473
* https://bugzilla.redhat.com/show_bug.cgi?id=1866884
2020-08-07 17:57:56 +02:00
Victor Stinner f44693eaed
bpo-41477: Make ctypes optional in test_genericalias (GH-21766) 2020-08-07 17:56:42 +02:00
Hai Shi 598a951844
bpo-40275: Use new test.support helper submodules in tests (GH-21764) 2020-08-07 17:18:38 +02:00
Nathan M 5f0769a752
bpo-41371: Handle lzma lib import error in test_zoneinfo.py (GH-21734) 2020-08-06 15:09:40 -07:00
Hai Shi 79bb2c93f2
bpo-40275: Use new test.support helper submodules in tests (GH-21743) 2020-08-06 13:51:29 +02:00
Eric L. Frederich 52f98424a5
bpo-41482: Fix error in ipaddress.IPv4Network docstring (GH-21736) 2020-08-05 14:44:53 -04:00
Batuhan Taskaya 8f4380d2f5
bpo-40726: handle uninitalized end_lineno on ast.increment_lineno (GH-20312) 2020-08-05 14:32:32 +01:00
Hai Shi c7decc27d5
bpo-40275: Use new test.support helper submodules in tests (GH-21727) 2020-08-04 17:53:12 +02:00
Hai Shi 604bba1f8f
bpo-40275: Use new test.support helper submodules in tests (GH-21452) 2020-08-04 17:51:43 +02:00
Hans Petter Jansson da4e09fff6
bpo-36982: Add support for extended color functions in ncurses 6.1 (GH-17536)
Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
2020-08-03 23:51:33 -04:00
Inada Naoki db6d9a50ce
bpo-41431: Optimize dict_merge for copy (GH-21674) 2020-08-04 11:08:06 +09:00
Victor Stinner 602a971a2a
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
2020-08-04 02:40:10 +02:00
Victor Stinner 701b63894f
bpo-38912: regrtest logs unraisable exception into sys.__stderr__ (GH-21718)
regrtest_unraisable_hook() temporarily replaces sys.stderr with
sys.__stderr__ to help to display errors when a test captures stderr.
2020-08-03 22:51:23 +02:00
Hai Shi 4660597b51
bpo-40275: Use new test.support helper submodules in tests (GH-21448) 2020-08-03 18:49:18 +02:00
Hai Shi bb0424b122
bpo-40275: Use new test.support helper submodules in tests (GH-21451) 2020-08-03 18:47:42 +02:00
Hai Shi a7f5d93bb6
bpo-40275: Use new test.support helper submodules in tests (GH-21449) 2020-08-03 18:41:24 +02:00
Raymond Hettinger 6a613f90bf
random module: Convert a "while 1" to "while True (GH-21700) 2020-08-02 12:03:32 -07:00
Raymond Hettinger 5c3270939c
bpo-41421: Algebraic simplification for random.paretovariate() (GH-21695) 2020-08-01 01:18:26 -07:00
Karthikeyan Singaravelan cadda52d97
bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694) 2020-07-31 16:20:48 +05:30
Mark Shannon 6e8128f02e
bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517)
* Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
2020-07-30 10:03:00 +01:00
Zackery Spytz c82dda1e08
bpo-35328: Set VIRTUAL_ENV_PROMPT at venv activation (GH-21587)
Co-Authored-By: Baptiste Darthenay <baptiste.darthenay@gmail.com>
2020-07-28 09:41:57 +01:00
Serhiy Storchaka 67987acd5d
bpo-41401: Fix test_fspath_support in test_io. (GH-21640)
The error is exposed on non-UTF-8 locales.
2020-07-27 20:58:35 +03:00
pxinwr 855e68855e
bpo-31904: Fix test_ftplib failures for VxWorks RTOS (GH-19447) 2020-07-27 15:17:47 +09:00
Akuli f1d40f941a
bpo-41384: Raise TclError in tkinter.OptionMenu (GH-21601)
... when an unknown option is passed.  TypeError was being raised because a 2to3 fix was missing.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-26 21:48:17 -04:00
Guido van Rossum 508ed2d912
Delete remaining references to Grammar/Grammar from docs (#21624)
(Ironically, the file itself remains, see https://github.com/we-like-parsers/cpython/issues/135.)
2020-07-26 08:27:52 -07:00
Serhiy Storchaka b1a87300a0
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608) 2020-07-26 10:21:39 +03:00
YoSTEALTH 0028c14073
bpo-41314: fixed annotations __future__ version (GH-21616)
PEP 563 was updated to change the release where `from __future__ import annotations` becomes the default (and only) behavior from 4.0 to 3.10. Update `__future__.py` and its docs to reflect this.
2020-07-25 14:42:49 -07:00
Gregory Schevchenko daff39070e
bpo-38731: Add --quiet option to py_compile CLI (GH-17134) 2020-07-25 22:58:45 +03:00
Terry Jan Reedy af08db7bac
bpo-37309: NEWS for #41373 (GH-21612) 2020-07-25 00:30:57 -04:00
Serhiy Storchaka 0dd463c8a4
bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597)
Fixes regression in 3.8.4 and 3.9.0b4.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-24 23:21:30 -04:00
Alex Grönholm 0dd98c2d00
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (#21595) 2020-07-23 12:45:08 -07:00
Zackery Spytz 592527f3ee
bpo-4630: Fix errors in Lib/idlelib/NEWS.txt (GH-21594)
Also one in news log.
2020-07-23 02:06:26 -04:00
Abhijeet Kasurde bcd47837a9
bpo-41182 selector: use DefaultSelector based upon implementation (GH-21257)
On some platform such as VMware ESXi, DefaultSelector fails
to detect selector due to default value.
This fix adds a check and uses the correct selector depending upon
select implementation and actual call.

Fixes: [bpo-41182]()

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-07-22 20:13:37 -07:00
wyfo 653f420b53
bpo-41341: Recursive evaluation of ForwardRef in get_type_hints (#21553)
The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
2020-07-22 12:47:28 -07:00
Steve Dower bf2f76ec09
bpo-41364: Reduce import overhead of uuid module (GH-21586) 2020-07-22 00:15:47 +01:00
Serhiy Storchaka 12f433411b
bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic (GH-21535) 2020-07-20 15:53:55 +03:00
Vinay Sharma d42528a3a2
bpo-37703: improve asyncio.gather documentation regarding cancellation (GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()

Automerge-Triggered-By: @asvetlov
2020-07-20 01:42:57 -07:00
Inada Naoki 902356a7b0
bpo-41338: Fix DeprecationWarning in tests (GH-21542) 2020-07-20 12:02:50 +09:00
Vinay Sharma bfd0fbdc13
bpo-38169: Increase code coverage for SharedMemory and ShareableList (GH-16139) 2020-07-19 22:35:52 +09:00
scoder c53b310e59
bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)
Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call.

Automerge-Triggered-By: @gvanrossum
2020-07-18 14:19:50 -07:00
AMIR 8ca8a2e8fb
bpo-39603: Prevent header injection in http methods (GH-18485)
reject control chars in http method in http.client.putrequest to prevent http header injection
2020-07-18 13:16:10 -07:00
Mark Shannon cb9879b948
bpo-40941: Unify implicit and explicit state in the frame and generator objects into a single value. (GH-20803)
* Merge gen and frame state variables into one.

* Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
2020-07-17 11:44:23 +01:00
matthewhughes934 8e836bb21c
bpo-41195: Add getter for Openssl security level (GH-21282)
Add an accessor under SSLContext.security_level as a wrapper around
SSL_CTX_get_security_level, see:
https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html


------
This is my first time contributing, so please pull me up on all the things I missed or did incorrectly.

Automerge-Triggered-By: @tiran
2020-07-17 01:59:15 -07:00
Terry Jan Reedy 38d3864efe
bpo-41300: IDLE - save files with non-ascii chars (GH-21512)
Fix regression released in 3.9.0b4 and 3.8.4.
2020-07-16 18:24:49 -04:00