Commit Graph

48071 Commits

Author SHA1 Message Date
Nikita Sobolev d2d1d49eac
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223) 2022-02-09 23:23:07 +09:00
Barney Gale 06e1701ad3
bpo-46556: emit `DeprecationWarning` from `pathlib.Path.__enter__()` (GH-30971)
In Python 3.9, Path.__exit__() was made a no-op and has never been documented.

Co-authored-by: Brett Cannon <brett@python.org>
2022-02-08 13:01:37 -08:00
Jelle Zijlstra 243436f377
bpo-46475: Add typing.Never and typing.assert_never (GH-30842) 2022-02-08 10:50:26 -08:00
Pablo Galindo Salgado 69e10976b2
bpo-46521: Fix codeop to use a new partial-input mode of the parser (GH-31010) 2022-02-08 11:54:37 +00:00
Mark Shannon 25db2b361b
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191) 2022-02-08 11:50:38 +00:00
Gregory Beauregard c8b62bbe46
bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) 2022-02-08 09:46:58 +02:00
Jason Wilkes da576e0829
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204)
In [Lib/test/support/import_helper.py](https://github.com/python/cpython/blob/master/Lib/test/support/import_helper.py), the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
2022-02-07 17:09:07 -08:00
Victor Stinner 7a0486eaa9
bpo-46659: calendar uses locale.getlocale() (GH-31166)
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar
classes module now use locale.getlocale(), instead of using
locale.getdefaultlocale(), if no locale is specified.
2022-02-08 00:24:09 +01:00
James Hilton-Balfe 7ba1cc8049
bpo-46534: Implement PEP 673 Self in typing.py (GH-30924)
Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-07 12:47:48 -08:00
Victor Stinner 4cce1352bb
bpo-46323: _ctypes.CFuncPtr fails if _argtypes_ is too long (GH-31188)
ctypes.CFUNCTYPE() and ctypes.WINFUNCTYPE() now fail to create the
type if its "_argtypes_" member contains too many arguments.
Previously, the error was only raised when calling a function.

Change also how CFUNCTYPE() and WINFUNCTYPE() handle KeyError to
prevent creating a chain of exceptions if ctypes.CFuncPtr raises an
error.
2022-02-07 14:53:15 +01:00
Nikita Sobolev 8e98175a03
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet
and use the local HTTP server rather than an external HTTP server.
2022-02-07 13:48:43 +01:00
Matthew Rahtz a335d98f19
bpo-46589: Improve documentation for typing._GenericAlias (GH-31026)
(These should arguably be docstrings per convention in the rest of the file, but it doesn't really matter.)
2022-02-06 17:59:22 -08:00
Nikita Sobolev 067c03bf40
bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078) 2022-02-06 17:35:48 -08:00
Gregory Beauregard 77b025be4a
bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156) 2022-02-06 15:16:22 -08:00
Victor Stinner 06b8f1615b
bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)
skip_if_buggy_ucrt_strfptime() of test.support now uses
locale.getpreferredencoding(False) instead of
locale.getdefaultlocale() to get the Windows code page.
2022-02-06 21:51:56 +01:00
Victor Stinner 04dd60e50c
bpo-46659: Update the test on the mbcs codec alias (GH-31168)
encodings registers the _alias_mbcs() codec search function before
the search_function() codec search function. Previously, the
_alias_mbcs() was never used.

Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code
page, not a fake ANSI code page number.

Remove the test_site.test_aliasing_mbcs() test: the alias is now
implemented in the encodings module, no longer in the site module.
2022-02-06 21:50:09 +01:00
Serhiy Storchaka 3da5526136
Add more tests for variable substitution in generics (GH-31170) 2022-02-06 21:52:39 +02:00
Victor Stinner 1578de2fcd
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
POST requests to http://www.example.com/ fail randomly.
2022-02-06 15:08:54 +01:00
Hugo van Kemenade 6c4e44ef8a
bpo-23952: Document cgi module's maxlen variable (GH-30338) 2022-02-06 05:59:32 -08:00
Christian Heimes 96b344c2f1
bpo-40280: Address more test failures on Emscripten (GH-31050)
Co-authored-by: Brett Cannon <brett@python.org>
2022-02-05 20:52:01 +01:00
Gregory Beauregard 2f077b6991
Fix __init_subclass__ using self instead of class (#31135) 2022-02-05 07:50:00 -08:00
andrei kulakov fea7290a0e
bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)
* added RegexFlag to re.__all__; added RegexFlag.NOFLAG

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-04 19:54:28 -08:00
Kumar Aditya bf95ff91f2
bpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space (GH-31074)
This reduces the size of the data segment by **300 KB** of the executable because if the modules are deep-frozen then the marshalled frozen data just wastes space. This was inspired by comment by @gvanrossum in https://github.com/python/cpython/pull/29118#issuecomment-958521863. Note: There is a new option `--deepfreeze-only` in `freeze_modules.py` to change this behavior, it is on be default to save disk space.
```console 
# du -s ./python before
27892   ./python
# du -s ./python after
27524   ./python
```

Automerge-Triggered-By: GH:ericsnowcurrently
2022-02-04 09:57:03 -08:00
Manish Kumar ⛄ ba650af7d6
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2022-02-04 15:49:43 +09:00
Caio Agiani 222865daab
bpo-46588: fix typo in test_calltip.py (GH-31119) 2022-02-03 23:39:59 -05:00
Pablo Galindo bd8b05395a
Merge remote-tracking branch 'upstream/main' 2022-02-03 22:56:59 +00:00
Terry Jan Reedy d1df81a730
bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)
On Windows, one had to Tab or click on the entry box
to get a cursor and be able to enter anything.
2022-02-03 17:06:17 -05:00
Terry Jan Reedy 916d0d822c
bpo-45975: IDLE - Remove extraneous parens (GH-31107)
mistakenly included in 3 files in previous PR
and backported both to 3.10 and 3.9.
2022-02-03 14:44:35 -05:00
Pablo Galindo c4e4b91557
Python 3.11.0a5 2022-02-03 18:37:08 +00:00
Géry Ogam 2d080347d7
bpo-46436: Fix command-line option -d/--directory in module http.server (GH-30701)
Fix command-line option -d/--directory in http.server main
function that was ignored when combined with --cgi.

Automerge-Triggered-By: GH:merwok
2022-02-03 07:51:05 -08:00
Miro Hrončok 6baa98e538
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098) 2022-02-03 07:48:13 -06:00
Zackery Spytz b4bd1e1422
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
2022-02-03 11:43:25 +02:00
Nikita Sobolev 7ffe7ba30f
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-02-03 11:25:10 +02:00
Nikita Sobolev 0cbdd21311
bpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993) 2022-02-03 11:20:08 +02:00
Matthew Suozzo 6394e981ad
Restrict use of Mock objects as specs (GH-31090)
Follow-on to https://github.com/python/cpython/pull/25326

This covers cases where mock objects are passed directly to spec.
2022-02-03 00:41:19 -08:00
Gregory P. Smith 8726067ace
bpo-45629: Improve test.support.skip_if_buildbot (GH-31094)
It was added as part of #29222 to avoid running freeze tool tests on the
buildbots but the logic was wrong so it did not skip tests on typical posix
setup buildbots where the worker is launched from cron via an @reboot task and
thus have no USER environment variable.  This uses the canonical
`getpass.getuser()` API rather than rolling its own attempt.
2022-02-02 21:36:16 -08:00
Nick Drozd 51a95be1d0
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083) 2022-02-02 20:59:24 -05:00
Steve Dower 89a0a90c2e
bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completion (GH-31086) 2022-02-02 19:54:27 +00:00
Hugo van Kemenade e8659b47de
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
* Revert "bpo-45173 Remove configparser deprecations"

This reverts commit df2284bc41.

* bpo-45173: Note these configparser deprecations will be removed in 3.12
2022-02-02 08:59:39 -08:00
Petr Viktorin 0ef0853012
bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696)
Automerge-Triggered-By: GH:encukou
2022-02-02 07:57:51 -08:00
Christian Heimes f66c857572
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???
2022-02-02 07:03:10 -08:00
Barney Gale 08f8301b21
bpo-43012: remove `pathlib._Accessor` (GH-25701)
Per Pitrou:

> The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there.

https://discuss.python.org/t/make-pathlib-extensible/3428/2

Accessors are:

- Lacking any internal purpose - '_NormalAccessor' is the only implementation
- Lacking any firm conceptual difference to `Path` objects themselves (inc. subclasses)
- Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor' 
- Unofficially used to implement customized `Path` objects, but once once [bpo-24132]() is addressed there will be a supported route for that.

This patch preserves all existing behaviour.
2022-02-02 04:38:25 -08:00
Nikita Sobolev 3483aa65df
bpo-46583: remove unused `sys.version_info` check from `selectors` (GH-31023) 2022-02-02 10:15:02 +02:00
Raymond Hettinger f77beacf01
Fix minor details in the Counter docs (GH-31029) 2022-02-01 22:18:11 -06:00
Jelle Zijlstra abcc3d75f6
bpo-46414: Add typing.reveal_type (#30646)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 18:48:55 -08:00
Victor Stinner 0611eafc70
bpo-44359: Fix test_ftplib unhandled thread exceptions (GH-31069)
test_ftplib now silently ignores socket errors to prevent logging
unhandled threading exceptions.
2022-02-02 02:47:40 +01:00
Wes 53c7808057
bpo-46591: Make About IDLE doc link label clickable (GH-30251)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-02-01 20:20:23 -05:00
Brandt Bucher a0e55a571c
bpo-46528: Simplify BUILD_TUPLE/UNPACK_SEQUENCE folding (GH-31039) 2022-02-01 13:41:32 -08:00
Victor Stinner bebaa95fd0
bpo-46600: Fix test_gdb.test_pycfunction() for clang -Og (GH-31058)
Fix test_gdb.test_pycfunction() for Python built with clang -Og.
Tolerate inlined functions in the gdb traceback.

When _testcapimodule.c is built by clang -Og, _null_to_none() is
inlined in meth_varargs() and so gdb returns _null_to_none() as
the frame #1. If it's not inlined, meth_varargs() is the frame #1.
2022-02-01 18:12:26 +01:00
Emiya 64568acbd8
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-02-01 18:05:02 +02:00