Commit Graph

25343 Commits

Author SHA1 Message Date
Christian Heimes 81520fe677
bpo-45536: Check OpenSSL APIs in configure (GH-29088) 2021-10-20 17:18:34 +02:00
Mark Shannon 8863a0fcc5
bpo-44525: Specialize simple Python calls. (GH-29033) 2021-10-20 16:08:28 +01:00
Petr Viktorin 98fa3b53e2
bpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)
Also, reword the What's New messages: this doesn't change the limited API, it only brings the Py_LIMITED_API macro closer to the ideal of only allowing the limited API.

Automerge-Triggered-By: GH:encukou
2021-10-20 02:32:14 -07:00
Ken Jin 3163e68c34
bpo-44525: Specialize ``CALL_FUNCTION`` for C function calls (GH-26934) 2021-10-20 00:16:36 +01:00
Filipe Laíns 3592980f91
bpo-25625: add contextlib.chdir (GH-28271)
Added non parallel-safe :func:`~contextlib.chdir` context manager to change
the current working directory and then restore it on exit. Simple wrapper
around :func:`~os.chdir`.

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-20 00:19:27 +02:00
Alex Waygood ad6d162e51
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034)
In Python 3.8 and 3.9, stacking `@functools.singledispatchmethod` on top of
`@classmethod` or `@staticmethod` caused an exception to be raised if the
method was registered using type-annotations rather than
`@method.register(int)`. This was not caught by unit tests, however, as the
tests only tested the `@method.register(int)` way of registering additional
implementations. The bug is no longer present in Python 3.10+, but
`test_functools.py` is still lacking regression tests for these cases. This
commit adds these test cases.
2021-10-19 22:30:27 +02:00
Pablo Galindo Salgado a106343f63
bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993)
There are two errors that this commit fixes:

* The parser was not correctly computing the offset and the string
  source for E_LINECONT errors due to the incorrect usage of strtok().
* The parser was not correctly unwinding the call stack when a tokenizer
  exception happened in rules involving optionals ('?', [...]) as we
  always make them return valid results by using the comma operator. We
  need to check first if we don't have an error before continuing.
2021-10-19 21:24:12 +02:00
Filipe Laíns 236e301b8a
bpo-42174: fallback to sane values if the columns or lines are 0 in get_terminal_size (GH-29046)
I considered only falling back when both were 0, but that still seems
wrong, and the highly popular rich[1] library does it this way, so I
thought we should probably inherit that behavior.

[1] https://github.com/willmcgugan/rich

Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-19 20:42:13 +02:00
Filipe Laíns 7bafa0cf58
bpo-45449: add note about PEP 585 in collections.abc's documentation (GH-29047)
Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-19 20:18:50 +02:00
Paul Ganssle 8e40ca127f
Add zoneinfo to the datetime documentation (GH-29038)
We should have done this way back when 3.9 was released, but it fell off
the radar.

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
2021-10-19 20:09:41 +02:00
Erlend Egeberg Aasland 8702b667d8
bpo-43851: Build SQLite with SQLITE_OMIT_AUTOINIT on Windows (GH-25414) 2021-10-19 11:59:57 +01:00
Victor Stinner 52af0756b2
bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)
The Python 3.11 limited C API no longer includes stdlib.h, stdio.h,
string.h and errno.h.

* Exclude Py_MEMCPY() from Python 3.11 limited C API.
* xxlimited C extension is now built with Python 3.11 limited C API.
2021-10-19 12:10:22 +02:00
Inada Naoki 0a4c82ddd3
bpo-45475: Revert `__iter__` optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016)
This reverts commit d2a8e69c2c.
2021-10-19 11:51:48 +09:00
Victor Stinner aad88d33d9
bpo-35134: Split warnings.h and weakrefobject.h (GH-29042)
Split header files to move the non-limited API to Include/cpython/:

* Include/warnings.h => Include/cpython/warnings.h
* Include/weakrefobject.h => Include/cpython/weakrefobject.h

Exclude PyWeakref_GET_OBJECT() from the limited C API. It never
worked since the PyWeakReference structure is opaque in the limited C
API.

Move _PyWarnings_Init() and _PyErr_WarnUnawaitedCoroutine() to the
internal C API.
2021-10-19 01:31:57 +02:00
Filipe Laíns 4d03de3329
bpo-45516: add protocol description to the Traversable documentation (#29039)
* bpo-45516: add protocol description to the Traversable documentation

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Update Doc/library/importlib.rst

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

* Update Lib/importlib/abc.py

* Update Doc/library/importlib.rst

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

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-10-18 18:58:13 -04:00
andrei kulakov 6a533a4238
bpo-45221: Fix handling of LDFLAGS and CPPFLAGS options in setup.py (GH-29031) 2021-10-18 14:26:23 -04:00
Benjamin Szőke a27f53bdd5
Fix contributor person name in rst files (GH-29005) 2021-10-17 20:59:22 +09:00
Terry Jan Reedy 42ac06dcd2
bpo-45495: Add 'case' and 'match' to IDLE completions list. (GH-29000)
Since the keyword list is frozen, only compute it once per
session.  The colorizer already handles context keywords.
2021-10-16 18:44:00 -04:00
Eric Snow b9cdd0fb9c
bpo-45020: Default to using frozen modules unless running from source tree. (gh-28940)
The default was "off".  Switching it to "on" means users get the benefit of frozen stdlib modules without having to do anything.  There's a special-case for running-in-source-tree, so contributors don't get surprised when their stdlib changes don't get used.

https://bugs.python.org/issue45020
2021-10-16 13:16:08 -06:00
Pablo Galindo Salgado fe0d9e22a5
bpo-45249: Fix caret location when end_offset is set to 0 (GH-28855) 2021-10-16 10:27:43 -07:00
Raymond Hettinger 5afa0a4112
bpo-42222: Remove deprecated support for non-integer values (GH-28983) 2021-10-16 10:16:53 -05:00
Dong-hee Na 15ad52fbf6
bpo-45489: Update ForwardRef to support | operator. (GH-28991) 2021-10-17 00:12:58 +09:00
Victor Stinner 00ffc4513d
bpo-45440: Remove pymath.c fallbacks (GH-28977)
Remove fallbacks for missing round(), copysign() and hypot() in
Python/pymath.c. Python now requires these functions to build.

These fallbacks were needed on Visual Studio 2012 and older. They are
no longer needed since Visual Stuido 2013. Python is now built with
Visual Studio 2017 or newer since Python 3.6.
2021-10-15 19:45:34 +02:00
Victor Stinner 547d26aa08
bpo-43760: Add PyThreadState_EnterTracing() (GH-28542)
Add PyThreadState_EnterTracing() and PyThreadState_LeaveTracing()
functions to the limited C API to suspend and resume tracing and
profiling.

Add an unit test on the PyThreadState C API to _testcapi.

Add also internal _PyThreadState_DisableTracing() and
_PyThreadState_ResetTracing().
2021-10-15 16:06:30 +02:00
Victor Stinner 105582e74c
bpo-45434: Remove Include/eval.h header file (GH-28973)
Move Include/eval.h content into Include/ceval.h and
Include/cpython/ceval.h, and remove Include/eval.h.
2021-10-15 13:06:05 +02:00
Victor Stinner 063abd931f
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
Move the interpreteridobject.h header file from Include/ to
Include/internal/. It only provides private functions.
2021-10-15 11:56:34 +02:00
Graham Inggs 59a633d3e2
bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)
Strip trailing '\n'.
2021-10-15 12:38:55 +03:00
Victor Stinner 8e5de40f90
bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)
Move classobject.h, context.h, genobject.h and longintrepr.h header
files from Include/ to Include/cpython/.

Remove redundant "#ifndef Py_LIMITED_API" in context.h.

Remove explicit #include "longintrepr.h" in C files. It's not needed,
Python.h already includes it.
2021-10-15 09:46:29 +02:00
Victor Stinner 77b24ba505
bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964) 2021-10-15 02:39:58 +02:00
Victor Stinner 37b1d607bf
po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)
Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.
2021-10-15 01:50:28 +02:00
Victor Stinner 284994762d
bpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)
The <Python.h> header file no longer includes <stdio.h> if the
Py_LIMITED_API macro is defined.
2021-10-15 01:09:06 +02:00
Victor Stinner af1083e975
bpo-45474: Fix the limited C API of marshal.h (GH-28956)
Remove two functions from the limited C API:

* PyMarshal_WriteLongToFile()
* PyMarshal_WriteObjectToFile()

The PEP 384 excludes functions expecting "FILE*" from the stable ABI.

Remove also the Py_MARSHAL_VERSION macro from the limited C API.
2021-10-15 00:20:33 +02:00
Eric Snow 79cf20e48d
bpo-21736: Set __file__ on frozen stdlib modules. (gh-28656)
Currently frozen modules do not have __file__ set.  In their spec, origin is set to "frozen" and they are marked as not having a location.  (Similarly, for frozen packages __path__ is set to an empty list.)  However, for frozen stdlib modules we are able to extrapolate __file__ as long as we can determine the stdlib directory at runtime.  (We now do so since gh-28586.)  Having __file__ set is helpful for a number of reasons.  Likewise, having a non-empty __path__ means we can import submodules of a frozen package from the filesystem (e.g. we could partially freeze the encodings module).

This change sets __file__ (and adds to __path__) for frozen stdlib modules.  It uses sys._stdlibdir (from gh-28586) and the frozen module alias information (from gh-28655).  All that work is done in FrozenImporter (in Lib/importlib/_bootstrap.py). 
 Also, if a frozen module is imported before importlib is bootstrapped (during interpreter initialization) then we fix up that module and its spec during the importlib bootstrapping step (i.e. imporlib._bootstrap._setup()) to match what gets set by FrozenImporter, including setting the file info (if the stdlib dir is known).  To facilitate this, modules imported using PyImport_ImportFrozenModule() have __origname__ set using the frozen module alias info.  __origname__ is popped off during importlib bootstrap.

(To be clear, even with this change the new code to set __file__ during fixups in imporlib._bootstrap._setup() doesn't actually get triggered yet.  This is because sys._stdlibdir hasn't been set yet in interpreter initialization at the point importlib is bootstrapped.  However, we do fix up such modules at that point to otherwise match the result of importing through FrozenImporter, just not the __file__ and __path__ parts.  Doing so will require changes in the order in which things happen during interpreter initialization.  That can be addressed separately.  Once it is, the file-related fixup code from this PR will kick in.)

Here are things this change does not do:

* set __file__ for non-stdlib modules (no way of knowing the parent dir)
* set __file__ if the stdlib dir is not known (nor assume the expense of finding it)
* relatedly, set __file__ if the stdlib is in a zip file
* verify that the filename set to __file__ actually exists (too expensive)
* update __path__ for frozen packages that alias a non-package (since there is no package dir)

Other things this change skips, but we may do later:

* set __file__ on modules imported using PyImport_ImportFrozenModule()
* set co_filename when we unmarshal the frozen code object while importing the module (e.g. in FrozenImporter.exec_module()) -- this would allow tracebacks to show source lines
* implement FrozenImporter.get_filename() and FrozenImporter.get_source()

https://bugs.python.org/issue21736
2021-10-14 15:32:18 -06:00
Carl Friedrich Bolz-Tereick b2af211e22
bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)
Creating an Enum exhibited quadratic behavior based on the number of members in three places:
- `EnumDict._member_names`: a list searched with each new member's name
- member creation: a `for` loop checking each existing member to see if new member was a duplicate
- `auto()` values: a list of all previous values in enum was copied before being sent to `_generate_next_value()`

Two of those issues have been resolved:
- `_EnumDict._member_names` is now a dictionary so lookups are fast
- member creation tries a fast value lookup before falling back to the slower `for` loop lookup

The third issue still remains, as `_generate_next_value_()` can be user-overridden and could corrupt the last values list if it were not copied.
2021-10-14 13:59:51 -07:00
Serhiy Storchaka 39aa98346d
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.raw_unicode_escape_decode().
It is True by default to match the former behavior.
2021-10-14 20:04:19 +03:00
Dennis Sweeney 3b3d30e8f7
bpo-45367: Specialize BINARY_MULTIPLY (GH-28727) 2021-10-14 15:56:33 +01:00
Serhiy Storchaka c96d1546b1
bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
2021-10-14 13:17:00 +03:00
Victor Stinner 194a9526d8
bpo-45440: Require math.h isinf() to build (GH-28894)
Building Python now requires a C99 <math.h> header file providing
isinf(), isnan() and isfinite() functions.

Remove the Py_FORCE_DOUBLE() macro. It was used by the
Py_IS_INFINITY() macro.

Changes:

* Remove Py_IS_NAN(), Py_IS_INFINITY() and Py_IS_FINITE()
  in PC/pyconfig.h.
* Remove the _Py_force_double() function.
* configure no longer checks if math.h defines isinf(), isnan() and
  isfinite().
2021-10-13 23:27:50 +02:00
Victor Stinner aac29af678
bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)
Include <stdlib.h> explicitly in C files.

Python.h includes <wchar.h>.
2021-10-13 19:25:53 +02:00
Pablo Galindo Salgado db2b6a20cd
bpo-45445: Fail if an invalid X-option is provided in the command line (GH-28823) 2021-10-13 18:08:19 +01:00
rtobar 1c83135381
bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765)
At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
2021-10-13 18:38:36 +02:00
andrei kulakov 6fafc25aea
bpo-24444: fix an error in argparse help when help for an option is blank (GH-28050) 2021-10-13 18:31:51 +02:00
Ben Hoyt b9e687618d
bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-13 18:21:27 +02:00
Victor Stinner bbe7497c5a
bpo-45434: Remove pystrhex.h header file (GH-28923)
Move Include/pystrhex.h to Include/internal/pycore_strhex.h.
The header file only contains private functions.

The following C extensions are now built with Py_BUILD_CORE_MODULE
macro defined to get access to the internal C API:

* _blake2
* _hashopenssl
* _md5
* _sha1
* _sha3
* _ssl
* binascii
2021-10-13 15:22:35 +02:00
Mark Shannon a8b9350964
bpo-45340: Don't create object dictionaries unless actually needed (GH-28802)
* Never change types' cached keys. It could invalidate inline attribute objects.

* Lazily create object dictionaries.

* Update specialization of LOAD/STORE_ATTR.

* Don't update shared keys version for deletion of value.

* Update gdb support to handle instance values.

* Rename SPLIT_KEYS opcodes to INSTANCE_VALUE.
2021-10-13 14:19:34 +01:00
Terry Jan Reedy 380c440875
bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)
To avoid error, add either space or parentheses.
2021-10-13 01:14:58 -04:00
David Bohman 9c4766772c
bpo-45405: Prevent ``internal configure error`` when running ``configure`` with recent versions of non-Apple clang. (#28845)
Change the configure logic to function properly on macOS when the compiler
outputs a platform triplet for option --print-multiarch.

Co-authored-by: Ned Deily <nad@python.org>
2021-10-12 20:10:26 -04:00
180909 2d21612f0d
Fix spelling in Misc (GH-28858) 2021-10-12 11:22:05 -07:00
Mike Gilbert be21706f37
bpo-45433: Do not link libpython against libcrypt (GH-28881)
Save/restore LIBS when calling AC_SEARCH_LIBS(..., crypt). This avoid
linking libpython with libcrypt.
2021-10-12 01:24:03 +02:00
Victor Stinner 1f316ea3b4
bpo-41123: Remove Py_UNICODE_COPY() and Py_UNICODE_FILL() (GH-28887) 2021-10-11 23:36:37 +02:00
Victor Stinner 03ea862b8a
bpo-45434: Python.h no longer includes <stdlib.h> (GH-28888) 2021-10-11 23:30:00 +02:00
Victor Stinner 2f92e2a590
bpo-45412: Remove Py_SET_ERRNO_ON_MATH_ERROR() macro (GH-28820)
Remove the following math macros using the errno variable:

* Py_ADJUST_ERANGE1()
* Py_ADJUST_ERANGE2()
* Py_OVERFLOWED()
* Py_SET_ERANGE_IF_OVERFLOW()
* Py_SET_ERRNO_ON_MATH_ERROR()

Create pycore_pymath.h internal header file.

Rename Py_ADJUST_ERANGE1() and Py_ADJUST_ERANGE2() to
_Py_ADJUST_ERANGE1() and _Py_ADJUST_ERANGE2(), and convert these
macros to static inline functions.

Move the following macros to pycore_pymath.h:

* _Py_IntegralTypeSigned()
* _Py_IntegralTypeMax()
* _Py_IntegralTypeMin()
* _Py_InIntegralTypeRange()
2021-10-11 21:00:25 +02:00
Dong-hee Na ab62051152
bpo-20028: Empty escapechar/quotechar is not allowed for csv.Dialect (GH-28833) 2021-10-11 20:08:15 +09:00
Josephine-Marie d74da9e140
bpo-45411: Update mimetypes.py (GH-28792)
.vtt and .srt files are common subtitle files, used by browsers.
2021-10-11 13:05:28 +02:00
Joongi Kim 1a7892414e
bpo-45416: Fix use of asyncio.Condition() with explicit Lock objects (GH-28850)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-10 19:01:41 +03:00
180909 532403e7c6
Remove repeated 'the' in docs (GH-28852) 2021-10-10 22:05:21 +08:00
Inada Naoki ad970e8623
bpo-29410: Change the default hash algorithm to SipHash13. (GH-28752)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Christian Heimes <christian@python.org>
2021-10-10 17:29:46 +09:00
Serhiy Storchaka b454e8e4df
bpo-27580: Add support of null characters in the csv module. (GH-28808) 2021-10-09 19:17:43 +03:00
Dong-hee Na 34bbc87b2d
bpo-20028: Improve error message of csv.Dialect when initializing (GH-28705) 2021-10-09 23:50:12 +09:00
Julien Palard c91b6f57f3
bpo-10716: Migrating pydoc to html5. (GH-28651) 2021-10-09 09:36:50 +02:00
Victor Stinner b108db63e0
bpo-45410: libregrtest -jN writes stderr into stdout (GH-28819)
When libregrtest spawns a worker process, stderr is now written into
stdout to keep messages order. Use a single pipe for stdout and
stderr, rather than two pipes. Previously, messages were out of order
which made analysis of buildbot logs harder
2021-10-08 17:14:37 +02:00
Matthias Reichl 392a898353
bpo-45262, asyncio: Fix cache of the running loop holder (GH-28796)
Prevent use-after-free of running loop holder via cache.
2021-10-08 00:46:49 +02:00
Pablo Galindo Salgado 0219017df7
bpo-45408: Don't override previous tokenizer errors in the second parser pass (GH-28812) 2021-10-07 22:33:05 +01:00
Steve Dower 6811fdaec8
bpo-45337: Use the realpath of the new executable when creating a venv on Windows (GH-28663) 2021-10-07 21:26:12 +01:00
Victor Stinner 768aaf6c43
bpo-45403: Fix test_sys.test_stdlib_dir() (GH-28785)
Fix test_sys.test_stdlib_dir() when Python is built outside the
source tree: compare normalized paths.
2021-10-07 21:22:28 +02:00
Victor Stinner ff8859d965
bpo-45402: Fix test_tools.test_sundry() (GH-28786)
Fix test_tools.test_sundry() when Python is built out of tree: fix
how the freeze_modules.py tool locates the _freeze_module program.
2021-10-07 21:19:13 +02:00
Victor Stinner 4e605666b0
bpo-45400: Fix suggestion test of test_exceptions (GH-28783)
Fix test_name_error_suggestions_do_not_trigger_for_too_many_locals()
of test_exceptions if a directory name contains "a1" (like
"Python-3.11.0a1"): use a stricter regular expression.
2021-10-07 13:47:23 +02:00
Ammar Askar 5baec4aea6
bpo-35970: Add help flag to base64 module (GH-28774)
This continues off rkuska's work from https://github.com/python/cpython/pull/11789 seeing as the patch wasn't updated to add tests.
2021-10-06 18:38:43 -07:00
Dong-hee Na e6ff4eba6d
bpo-45385: Fix reference leak from descr_check (#28719) 2021-10-07 09:51:56 +09:00
rtobar 0571b934f5
bpo-45328: Avoid failure in OSs without TCP_NODELAY support (GH-28646)
Operating systems without support for TCP_NODELAY will raise an OSError
when trying to set the socket option, but the show can still go on.
2021-10-06 19:49:44 +02:00
Christian Clauss 470145f572
[Misc] [Mac] Fix typos found using codespell (GH-28756) 2021-10-06 19:40:09 +02:00
Łukasz Langa f528045f69
bpo-40321: Add missing test, slightly expand documentation (GH-28760) 2021-10-06 17:28:16 +02:00
Mark Shannon a7252f88d3
bpo-40116: Add insertion order bit-vector to dict values to allow dicts to share keys more freely. (GH-28520) 2021-10-06 13:19:53 +01:00
Jochem Schulenklopper c379bc5ec9
bpo-40321: Support HTTP response status code 308 in urllib.request (#19588)
* Support HTTP response status code 308 in urllib.

HTTP response status code 308 is defined in https://tools.ietf.org/html/rfc7538 to be the permanent redirect variant of 307 (temporary redirect).

* Update documentation to include http_error_308()

* Add blurb for bpo-40321 fix

Co-authored-by: Roland Crosby <roland@rolandcrosby.com>
2021-10-05 19:02:58 -07:00
Illia Volochii 4c8d543823
bpo-45343: Update bundled pip to 21.2.4 and setuptools to 58.1.0 (GH-28684) 2021-10-05 23:30:38 +02:00
Eric Snow 08285d563e
bpo-45020: Identify which frozen modules are actually aliases. (gh-28655)
In the list of generated frozen modules at the top of Tools/scripts/freeze_modules.py, you will find that some of the modules have a different name than the module (or .py file) that is actually frozen. Let's call each case an "alias". Aliases do not come into play until we get to the (generated) list of modules in Python/frozen.c. (The tool for freezing modules, Programs/_freeze_module, is only concerned with the source file, not the module it will be used for.)

Knowledge of which frozen modules are aliases (and the identity of the original module) normally isn't important. However, this information is valuable when we go to set __file__ on frozen stdlib modules. This change updates Tools/scripts/freeze_modules.py to map aliases to the original module name (or None if not a stdlib module) in Python/frozen.c. We also add a helper function in Python/import.c to look up a frozen module's alias and add the result of that function to the frozen info returned from find_frozen().

https://bugs.python.org/issue45020
2021-10-05 11:26:37 -06:00
Pablo Galindo 350e7a25d6 Python 3.11.0a1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmFcSLIACgkQ/+h0BBaL
 2Edt+A//euGR2lSeASHsLMeFwZkhMGOHHPZKmCcUP7CyQC6zfvajVnEORcsRhMI1
 dD1jLMv/PsednzYV+nBBdSVGCGnnAX3O5u2eB+W7cG4xvt78ok/DX5lYXJrnyAfy
 YzWv74zWR/W8HJYy7LQfrhvqfJHK/c5ar/Jk6+t7c9LqZrlkPM2rEpAWWILASQuX
 2eR/A+9TifqIPtZN5c67OObtm190ScYWUID5HjqROcEjiOh9Y9tASk0VpyDtfIHP
 imJro+JGsV3WOlRpVkfAvyC0L8LrEjVxyFyBok8+fWJQ0yjjepC+EkLGX3DKWutz
 LgS5Wx/onnCT5dDlIcda9GVuDnEbr8WvAHWwwu0nJhmZ2XzXRNMzRf8lxw9hH09X
 mvmKS+nzx12pDZs5IAdWNUyWFJx1pPLNOqRa3heTIC/yB9+rHvY3WfGYkpD+r7FJ
 JAbD/LiWfVTRnl3HIyoNCyIOHxSZaYlAN9qJeapEFoFdYCLWByQsCiMoUH+W8zKE
 kpF7yl2RaSUFIZ7b6VJ0tDk2QDTWYPHYh37zii4OtfHgY1AkqbiWA1FTfNW3ZiX0
 1QHpB89feB4TdnFP7c+piEQxHxxJnhGCfb3bpEHdofDJVpMn+pz9DRXEpWTkPhBK
 JK7z5eVBzxYfACbb/IULc79Bsnp/5P2ZQiXMNpb+/W2wwjqjOdw=
 =RF/t
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmFchnQACgkQ/+h0BBaL
 2Eekgg/+LEvtmrE0O8VgzG/+4EiMWk6AWSc0h9ZIuY+qDLSMTjJBnsG9nl7fl7Gb
 LzeDeQSWglnNsut/K63XVniADFZ4nqU9L1c9KF//4jfS8xqOv9m2GNe4ESbV4JlG
 hVP6dmKjsl1BM0rgAEF4V2lCslxwI5rGkHL7MUuST+G4yyRfo7jARw9nAOHz9OIo
 fr+S1rry2KPexUTxRFvQ+5dzV01o8ylkleIIZZIQ1Z186LvrDi7YgNqBAdi3bECc
 U+PuLvLEx1SzuuzJQNkstfGHS9Mabu5UvvGj2fZmvGhgOqxFdEtT6/QmHdFEJlnk
 65T5xT6QUE6NlRyzbb044Rs0czCs8tpVZL+LrAhJnnKxufqKUZVOxWwzMkGTG3Ia
 4SUeMr+70+Qs4Uwe3xYqfLvym4AnBDGKgHQaMiEe7gpmqQUgfKIBBORjMBezNiOQ
 DI+fAi+w4+T+aGEhSSjdgyj9NqpSkYjrP1ODpb1I7kKJfronVufUwp1afJoKaLBR
 bLAQKNIAop08zuMY7N7l1hATqpiaFyGlFU4rjH0dNEaQzaGSVqyEOpWanhqOsMPV
 l1AoTMUtJxdM1y/T1WxdKbaN/XoZYznFZbQrCDsPzAXhWHx+1thJBN7BGdCi/Krm
 2f7Kk//8uLj+BuHowMzOzArNvAfCiFPJypPhUktCFU++GvEWnjY=
 =hwKX
 -----END PGP SIGNATURE-----

Merge tag 'v3.11.0a1'

Python 3.11.0a1
2021-10-05 18:07:59 +01:00
Eric Snow c3d9ac8b34
bpo-45324: Capture data in FrozenImporter.find_spec() to use in exec_module(). (gh-28633)
Before this change we end up duplicating effort and throwing away data in FrozenImporter.find_spec().  Now we do the work once in find_spec() and the only thing we do in FrozenImporter.exec_module() is turn the raw frozen data into a code object and then exec it.

We've added _imp.find_frozen(), add an arg to _imp.get_frozen_object(), and updated FrozenImporter.  We've also moved some code around to reduce duplication, get a little more consistency in outcomes, and be more efficient.

Note that this change is mostly necessary if we want to set __file__ on frozen stdlib modules. (See https://bugs.python.org/issue21736.)

https://bugs.python.org/issue45324
2021-10-05 10:01:27 -06:00
Hai Shi b9bb74871b
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794)
Automerge-Triggered-By: GH:encukou
2021-10-05 06:19:32 -07:00
Pablo Galindo 7c12e4835e
Python 3.11.0a1 2021-10-05 13:44:05 +01:00
Steve Dower 5146877623
bpo-45375: Fix assertion failure due to searching for stdlib in unnormalised paths (GH-28735) 2021-10-05 13:37:43 +01:00
Mark Shannon bd627eb7ed
bpo-43760: Check for tracing using 'bitwise or' instead of branch in dispatch. (GH-28723) 2021-10-05 11:01:11 +01:00
Christian Heimes ef6196028f
bpo-45371: Fix distutils' rpath support for clang (GH-28732)
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-05 02:43:46 -07:00
John Belmonte e6d1aa1ac6
bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089)
* bpo-44594: fix (Async)ExitStack handling of __context__

Make enter_context(foo()) / enter_async_context(foo()) equivalent to
`[async] with foo()` regarding __context__ when an exception is raised.

Previously exceptions would be caught and re-raised with the wrong
context when explicitly overriding __context__ with None.
2021-10-03 23:49:55 -07:00
Julien Palard 4f6e0680d0
Remove news entry without bpo issue number. (GH-28703)
I'm just removing an erroneous NEWS entry I previously merged.

Automerge-Triggered-By: GH:JulienPalard
2021-10-03 07:21:31 -07:00
TAGAMI Yukihiro 0742abdc48
bpo-45329: Fix freed memory access in pyexpat.c (GH-28649) 2021-10-02 12:57:13 +03:00
native-api 417faa69bd
Makefile: Fix missing slashes (GH-28659) 2021-10-02 11:38:59 +02:00
AngstyDuck a450398933
bpo-44687: Ensure BufferedReader objects with unread buffers can peek even when the underlying file is closed (GH-28457) 2021-10-01 21:11:08 +01:00
Victor Stinner 98d2827002
bpo-41710: Fix PY_TIMEOUT_MAX on Windows (GH-28673)
WaitForSingleObject() accepts timeout in milliseconds in the range
[0; 0xFFFFFFFE] (DWORD type). INFINITE value (0xFFFFFFFF) means no
timeout. 0xFFFFFFFE milliseconds is around 49.7 days.

PY_TIMEOUT_MAX is (0xFFFFFFFE * 1000) milliseconds on Windows, around
49.7 days.

Partially revert commit 37b8294d62.
2021-10-01 13:03:03 +02:00
Nikita Sobolev 746d648d47
bpo-45125: Improves pickling docs and tests for `shared_memory` (GH-28294) 2021-10-01 13:45:59 +03:00
Victor Stinner 1ee0f94d16
bpo-41710: PyThread_acquire_lock_timed() uses sem_clockwait() (GH-28662)
On Unix, if the sem_clockwait() function is available in the C
library (glibc 2.30 and newer), the threading.Lock.acquire() method
now uses the monotonic clock (time.CLOCK_MONOTONIC) for the timeout,
rather than using the system clock (time.CLOCK_REALTIME), to not be
affected by system clock changes.

configure now checks if the sem_clockwait() function is available.
2021-10-01 09:55:28 +02:00
Serhiy Storchaka ec4d917a6a
bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654)
* Work correctly if an additional fresh module imports other
  additional fresh module which imports a blocked module.
* Raises ImportError if the specified module cannot be imported
  while all additional fresh modules are successfully imported.
* Support blocking packages.
* Always restore the import state of fresh and blocked modules
  and their submodules.
* Fix test_decimal and test_xml_etree which depended on an undesired
  side effect of import_fresh_module().
2021-09-30 19:20:39 +03:00
Victor Stinner 37b8294d62
bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)
PyThread_acquire_lock_timed() now clamps the timeout into the
[_PyTime_MIN; _PyTime_MAX] range (_PyTime_t type) if it is too large,
rather than calling Py_FatalError() which aborts the process.

PyThread_acquire_lock_timed() no longer uses
MICROSECONDS_TO_TIMESPEC() to compute sem_timedwait() argument, but
_PyTime_GetSystemClock() and _PyTime_AsTimespec_truncate().

Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is
0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF
milliseconds (around 49.7 days).

Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF
milliseconds.

Fix PY_TIMEOUT_MAX overflow test: replace (us >= PY_TIMEOUT_MAX) with
(us > PY_TIMEOUT_MAX).
2021-09-30 10:16:51 +02:00
Serhiy Storchaka eed32df5b6
bpo-24391: Better reprs for threading objects. (GH-20534)
Add reprs for Semaphore, BoundedSemaphore, Event, and Barrier.
2021-09-29 13:07:58 +03:00
Jack DeVries b6fe857250
bpo-39039: tarfile raises descriptive exception from zlib.error (GH-27766)
* during tarfile parsing, a zlib error indicates invalid data
* tarfile.open now raises a descriptive exception from the zlib error
* this makes it clear to the user that they may be trying to open a
  corrupted tar file
2021-09-29 11:25:48 +02:00
Serhiy Storchaka 233b9da07d
[docs] Use full names for time units (GH-28611)
Use "second", "millisecond", "microsecond", "nanosecond" instead of
"sec", "ms", "msec", "us", "ns", etc.
2021-09-29 12:09:56 +03:00
Nikita Sobolev e046aabbe3
bpo-45269: test wrong `markers` type to `c_make_encoder` (GH-28540) 2021-09-28 23:18:00 +02:00
Serhiy Storchaka 4f05f15d7b
[docs] Improve the markup of powers (GH-28598) 2021-09-28 22:40:57 +02:00
Terry Jan Reedy e649e0658f
bpo-45296: Fix exit/quit message on Windows (GH-28577)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z.
2021-09-28 14:05:56 +02:00
Victor Stinner 95d3137082
bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549)
Fix the threading._shutdown() function when the threading module was
imported first from a thread different than the main thread: no
longer log an error at Python exit.
2021-09-27 23:09:00 +02:00
Victor Stinner a22be4943c
bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532)
Fix a race condition in the Thread.join() method of the threading
module. If the function is interrupted by a signal and the signal
handler raises an exception, make sure that the thread remains in a
consistent state to prevent a deadlock.
2021-09-27 14:20:31 +02:00
Nikita Sobolev f56268a2cd
bpo-45280: Add test for empty `NamedTuple` in `test_typing` (GH-28559)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2021-09-26 18:32:18 +02:00
Victor Stinner 7834ff26cb
bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545)
Co-authored-by: Livius <egyszeregy@freemail.hu>
2021-09-25 14:36:26 +02:00
Nikita Sobolev 784905dbef
bpo-45166: fixes `get_type_hints` failure on `Final` (GH-28279)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-09-25 10:56:22 +02:00
Antony Lee 6587fc60d4
bpo-44019: Implement operator.call(). (GH-27888)
Having `operator.call(obj, arg)` mean `type(obj).__call__(obj, arg)` is
consistent with the other dunder operators.  The semantics with `*args,
**kwargs` then follow naturally from the single-arg semantics.
2021-09-24 16:22:49 +01:00
Nikita Sobolev 8d8729146f
bpo-20524: adds better error message for `.format()` (GH-28310)
It now lists the bad format_spec and the type of the object.
2021-09-24 11:18:04 -04:00
Daniel Hillier 91099e2544
bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception (GH-18031) 2021-09-23 23:37:53 +02:00
Jason Fried 86b833badd
bpo-38415: Allow using @asynccontextmanager-made ctx managers as decorators (GH-16667) 2021-09-23 23:36:03 +02:00
Alexander Böhn 8c21941dda
bpo-39549: reprlib.Repr uses a “fillvalue” attribute (GH-18343) 2021-09-22 15:45:58 -05:00
Serhiy Storchaka ecb6922ff2
bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449)
It runs now asynchronous methods and callbacks.

If it fails, doCleanups() can be called for cleaning up.
2021-09-22 17:43:23 +02:00
Victor Stinner 58f8adfda3
bpo-21302: time.sleep() uses waitable timer on Windows (GH-28483)
On Windows, time.sleep() now uses a waitable timer which has a
resolution of 100 ns (10^-7 sec). Previously, it had a solution of 1
ms (10^-3 sec).

* On Windows, time.sleep() now calls PyErr_CheckSignals() before
  resetting the SIGINT event.
* Add _PyTime_As100Nanoseconds() function.
* Complete and update time.sleep() documentation.

Co-authored-by: Livius <egyszeregy@freemail.hu>
2021-09-22 16:09:30 +02:00
Mohamad Mansour 8f943ca257
[codemod] Fix non-matching bracket pairs (GH-28473)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-22 01:09:00 +02:00
andrei kulakov b7eac52b46
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421)
This was a regression from fixing BPO-43219.
2021-09-21 23:53:07 +02:00
Victor Stinner 86f28372b1
bpo-45061: Detect refcount bug on empty string singleton (GH-28504)
Detect refcount bugs in C extensions when the empty Unicode string
singleton is destroyed by mistake.

* Move forward declarations to the top of unicodeobject.c.
* Simplifiy unicode_is_singleton().
2021-09-21 23:43:09 +02:00
Nikita Sobolev 06e1773c8d
bpo-45216: Remove extraneous method docs from `difflib` (GH-28445) 2021-09-21 23:31:12 +02:00
Victor Stinner 79a3148099
bpo-45061: Detect refcount bug on empty tuple singleton (GH-28503)
Detect refcount bugs in C extensions when the empty tuple singleton
is destroyed by mistake.

Add the _Py_FatalRefcountErrorFunc() function.
2021-09-21 23:04:34 +02:00
Nikita Sobolev f604cf1c37
bpo-45209: fix `UserWarning: resource_tracker` in test_multiprocessing (GH-28377) 2021-09-21 19:49:42 +02:00
scoder debd804037
bpo-24076: Inline single digit unpacking in the integer fastpath of sum() (GH-28469) 2021-09-21 11:01:18 +02:00
nullptr 0bfa1106ac
bpo-45021: Fix a hang in forked children (GH-28007)
_global_shutdown_lock should be reinitialized in forked children
2021-09-20 11:30:19 -07:00
Erlend Egeberg Aasland 5846c9b71e
bpo-44848: Update Windows installer to use SQLite 3.36.0 (GH-27622) 2021-09-20 16:58:13 +01:00
Irit Katriel f71300cb04
bpo-1514420: Do not attempt to open files with names in <>s when formatting an exception (GH-28143)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-20 17:10:30 +02:00
Rémi Lapeyre 4d2957c1b9
bpo-40497: Fix handling of check in subprocess.check_output() (GH-19897)
Co-authored-by: Tal Einat <taleinat@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-20 17:09:05 +02:00
Nikita Sobolev 1d42408495
bpo-45128: fixes `test_multiprocessing_fork` mysterious crash (GH-28387) 2021-09-19 23:50:04 +01:00
Serhiy Storchaka 664448d81f
bpo-30856: Update TestResult early, without buffering in _Outcome (GH-28180)
TestResult methods addFailure(), addError(), addSkip() and
addSubTest() are now called immediately after raising an exception
in test or finishing a subtest.  Previously they were called only
after finishing the test clean up.
2021-09-19 15:24:38 +03:00
Serhiy Storchaka dea59cf88a
bpo-36674: Honour the skipping decorators in TestCase.debug() (GH-28446)
unittest.TestCase.debug() raises now a SkipTest if the class or
the test method are decorated with the skipping decorator.

Previously it only raised a SkipTest if the test method was decorated
with other decorator in addition to the skipping decorator, or
if SkipTest was explicitly raised in the test or setup methods.
2021-09-18 15:34:22 +03:00
Adam Schwalm a6e8db5e8e
bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) 2021-09-17 23:20:31 -05:00
Brett Cannon 209b7035f7
bpo-45183: don't raise an exception when calling zipimport.zipimporter.find_spec() when the zip file is missing and the internal cache has been reset (GH-28435)
This can occur when the zip file gets deleted, you call zipimport.zipimporter.invalidate_cache(), and then try to use zipimport.zipimporter.find_spec() (i.e. you left the zip file path on sys.path).
2021-09-17 16:48:17 -07:00
Victor Stinner 6b41355128
bpo-45116: Add the Py_ALWAYS_INLINE macro (GH-28390)
Add the Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function. The compiler can ignore it and decides to not
inline the function.
2021-09-17 14:09:14 +02:00
Serhiy Storchaka b0a6ede3d0
bpo-45162: Remove many old deprecated unittest features (GH-28268)
* "fail*" and "assert*" aliases of TestCase methods.
* Broken from start TestCase method assertDictContainsSubset().
* Ignored TestLoader.loadTestsFromModule() parameter use_load_tests.
* Old alias _TextTestResult of TextTestResult.
2021-09-17 13:33:27 +03:00
Serhiy Storchaka 773319545b
bpo-45228: Fix stack buffer overflow in parsing J1939 address (GH-28404) 2021-09-17 11:46:19 +03:00
speedrun-program a59ede2447
bpo-45225: use map function instead of genexpr in capwords (GH-28342) 2021-09-16 14:49:38 -05:00
Steve Dower f4b94b1f57
bpo-45220: Avoid automatically selecting the Windows 11 SDK preview when building (GH-28393) 2021-09-16 19:29:32 +01:00
Barry Warsaw 07e737d002
bpo-45155 : Default arguments for int.to_bytes(length=1, byteorder=sys.byteorder) (#28265)
Add default arguments for int.to_bytes() and int.from_bytes()

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2021-09-15 19:55:24 -07:00
Erlend Egeberg Aasland ff6d2cc55a
bpo-5846: Deprecate obsolete methods in `unittest` (GH-28299)
Deprecate makeSuite, findTestCases, and getTestCaseNames. Scheduled for removal in Python 3.13.
2021-09-15 20:33:31 +02:00
Terry Jan Reedy 9d76d28867
bpo-45193: News for IDLE PR_28343 (GH-28348) 2021-09-15 14:26:43 -04:00
Serhiy Storchaka 5dce51a887
bpo-45167: Fix deepcopying of GenericAlias (GH-28324) 2021-09-15 20:25:41 +02:00
Steve Dower 09b4ad11f3
bpo-45188: Windows now regenerates frozen modules at the start of build instead of late (GH-28322)
This will enable us to drop the frozen module header files from the repository.

It does currently cause many source files to be built twice, which just takes more time. For whoever comes to fix this in the future, the files shared between freeze_module and pythoncore should be put into a static library that is consumed by both.
2021-09-15 18:11:12 +01:00
Nikita Sobolev d897579a80
bpo-45185: enables `TestEnumerations` in `test_ssl` (GH-28330) 2021-09-15 19:57:03 +03:00
Eric Snow cbeb819710
bpo-45020: Freeze some of the modules imported during startup. (gh-28335)
Doing this provides significant performance gains for runtime startup (~15% with all the imported modules frozen). We don't yet freeze all the imported modules because there are a few hiccups in the build systems we need to sort out first. (See bpo-45186 and bpo-45188.)

Note that in PR GH-28320 we added a command-line flag (-X frozen_modules=[on|off]) that allows users to opt out of (or into) using frozen modules. The default is still "off" but we will change it to "on" as soon as we can do it in a way that does not cause contributors pain.

https://bugs.python.org/issue45020
2021-09-15 10:19:30 -06:00
Serhiy Storchaka 1a9ef57985
bpo-44786: Fix a warning in RE in c-analyzer (GH-28351) 2021-09-15 17:08:48 +03:00
Eric Snow a65c86889e
bpo-45020: Add -X frozen_modules=[on|off] to explicitly control use of frozen modules. (gh-28320)
Currently we freeze several modules into the runtime. For each of these modules it is essential to bootstrapping the runtime that they be frozen. Any other stdlib module that we later freeze into the runtime is not essential. We can just as well import from the .py file.  This PR lets users explicitly choose which should be used, with the new "-X frozen_modules=[on|off]" CLI flag. The default is "off" for now.

https://bugs.python.org/issue45020
2021-09-14 17:31:45 -06:00
Benjamin Peterson 024fda47d4
closes bpo-45190: Update Unicode data to version 14.0.0. (GH-28336) 2021-09-14 11:00:38 -07:00
Victor Stinner 797c8eb9ef
bpo-45195: Fix test_readline.test_nonascii() (GH-28329)
Fix test_readline.test_nonascii(): sometimes, the newline character
is not written at the end, so don't expect it in the output.
2021-09-14 17:38:04 +02:00
Nikita Sobolev 7f60c9e1c6
bpo-45156: Fixes inifite loop on unittest.mock.seal() (GH-28300)
Fixes infinite loop on unittest.mock.seal() of mocks created by
unittest.create_autospec().

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2021-09-14 12:20:40 +02:00
Irit Katriel c99fc4e53a
bpo-45168: change dis output to omit missing values rather than replacing them by their index (GH-28313) 2021-09-14 10:09:05 +01:00
Hugo van Kemenade 9f93018b69
bpo-42135 Correct version slated for importlib.find_loader removal (GH-28312)
importlib.find_loader should also be slated for 3.12 like the others in GH-25169 and as documented in https://docs.python.org/3.11/whatsnew/3.10.html#deprecated.
2021-09-13 15:57:50 -07:00
Hugo van Kemenade 1fc41ae870
bpo-45173 Remove configparser deprecations (GH-28292)
In the configparser module, these have been deprecated since Python 3.2:

* the SafeConfigParser class,
* the filename property of the ParsingError class,
* the readfp method of the ConfigParser class,
2021-09-13 19:12:36 +02:00
Livius 85a4748118
bpo-21302: Add clock_nanosleep() implementation for time.sleep() (GH-28111)
In Unix operating systems, time.sleep() now uses the clock_nanosleep() function,
if available, which allows to sleep for an interval specified with nanosecond precision.

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-13 14:37:38 +02:00
Serhiy Storchaka 92bf8691fb
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes (GH-26456)
* Constructors of subclasses of some buitin classes (e.g. tuple, list,
  frozenset) no longer accept arbitrary keyword arguments.
* Subclass of set can now define a __new__() method with additional
  keyword parameters without overriding also __init__().
2021-09-12 13:27:50 +03:00
Dong-hee Na 9abd07e596
bpo-44987: Speed up unicode normalization of ASCII strings (GH-28283) 2021-09-11 18:04:38 +03:00
Serhiy Storchaka 97ea18eced
bpo-35474: Fix mimetypes.guess_all_extensions() potentially mutating list (GH-28286)
* Calling guess_all_extensions() with strict=False potentially
  mutated types_map_inv.
* Mutating the result of guess_all_extensions() mutated types_map_inv.
2021-09-11 17:44:44 +03:00
David CARLIER 5f5b7d0c65
bpo-45163: Haiku build fix. (GH-28269)
linkage issues mainly for shared libs and missing system library,
also little nit into the signal extension as strsignal returns
a constant in this platform.
2021-09-11 11:46:22 +03:00
Serhiy Storchaka f0f29f328d
bpo-25894: Always report skipped and failed subtests separately (GH-28082)
* In default mode output separate characters for skipped and failed subtests.
* In verbose mode output separate lines (including description) for skipped
   and failed subtests.
* In verbose mode output test description for errors in test cleanup.
2021-09-10 17:55:05 +02:00
Łukasz Langa 296b710070
bpo-44219: Mention GH-28250 is a deadlock bugfix (GH-28261) 2021-09-10 17:51:43 +02:00
Henry-Joseph Audéoud 707137b863
bpo-40563: Support pathlike objects on dbm/shelve (GH-21849)
Co-authored-by: Hakan Çelik <hakancelik96@outlook.com>
2021-09-10 15:26:16 +03:00
Raymond Hettinger 62fa613f6a
bpo-45024 and bpo-23864: Document how interface testing works with the collections ABCs (GH-28218) 2021-09-09 21:51:07 -05:00
Senthil Kumaran 794430700d
bpo-45067 - Verify the version of ncurses for extended color support feature usage. (GH-28260)
* issue45067 - Fix _curses compilation in CentOS 7. Verify the version of ncurses
for extended color support feature usage.

The function extended_color_content was introduced in 2017.  The ncurses-devel
package in CentOS 7 had a older version ncurses resulted in compilation error.
For compiling ncurses with extended color support, we verify the version of the
ncurses library.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-09 11:32:11 -07:00
Vincent Michel 06148b1870
bpo-44219: Release the GIL during isatty syscalls (GH-28250)
Release the GIL while performing isatty() system calls on arbitrary
file descriptors. In particular, this affects os.isatty(),
os.device_encoding() and io.TextIOWrapper. By extension,
io.open() in text mode is also affected.
2021-09-09 15:12:03 +02:00
Victor Stinner 49acac00c0
bpo-44860: Update test_sysconfig for posix_user platlib (GH-28235)
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
2021-09-09 11:02:48 +02:00
Raymond Hettinger 4a5cccb02b
bpo-20499: Rounding error in statistics.pvariance (GH-28230) 2021-09-08 22:00:12 -05:00
Erlend Egeberg Aasland f235dd0784
bpo-38371: Remove deprecated `tkinter` split() method (GH-28237) 2021-09-08 23:02:19 +03:00
Hugo van Kemenade 59ea704df7
bpo-45129 Remove deprecated reuse_address (GH-28207)
Due to significant security concerns, the reuse_address parameter of
asyncio.loop.create_datagram_endpoint, deprecated in Python 3.9, is
now removed. This is because of the behavior of the socket option
SO_REUSEADDR in UDP.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-08 18:58:43 +02:00
Florin Spătar 2396fa6537
bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857) 2021-09-08 14:43:00 +02:00
Yurii Karabas c11956a8bd
bpo-45121: Fix RecursionError when calling Protocol.__init__ from a subclass' __init__ (GH-28206) 2021-09-08 18:25:09 +08:00
Hugo van Kemenade d003a5bd25
bpo-45132 Remove deprecated __getitem__ methods (GH-28225)
Remove deprecated __getitem__ methods of xml.dom.pulldom.DOMEventStream,
wsgiref.util.FileWrapper and fileinput.FileInput, deprecated since Python 3.9.
2021-09-08 13:07:40 +03:00
Victor Stinner cb15afcccf
bpo-39573: Py_TYPE becomes a static inline function (GH-28128)
Convert the Py_TYPE() and Py_SIZE() macros to static inline
functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be
used to set an object type and size.
2021-09-08 11:59:13 +02:00
Stanisław Skonieczny 9dc363ee7c
bpo-45012: Release GIL around stat in os.scandir (GH-28085)
Releasing GIL allows other threads to continue
its work when os.scandir is fetching DirEntry.stat
info from file system.
2021-09-07 19:55:20 +02:00
Victor Stinner fb305092a5
bpo-44348: BaseException deallocator uses trashcan (GH-28190)
The deallocator function of the BaseException type now uses the
trashcan mecanism to prevent stack overflow. For example, when a
RecursionError instance is raised, it can be linked to another
RecursionError through the __context__ attribute or the __traceback__
attribute, and then a chain of exceptions is created. When the chain
is destroyed, nested deallocator function calls can crash with a
stack overflow if the chain is too long compared to the available
stack memory.
2021-09-07 15:42:11 +02:00
Nikita Sobolev 8ca6b61e3f
bpo-45034: Fix how upper limit is formatted for `struct.pack("H", ...)` (GH-28178)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-07 13:18:46 +01:00
Pablo Galindo Salgado 97b754d4b4
Revert "bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011)" (GH-28201)
This reverts commit 4f88161f07.
2021-09-07 12:46:25 +01:00
Yury Selivanov 2c3474a637
bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194)
Fix PyAiter_Check to only check for the `__anext__` presense (not for
`__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`,
`PyObject_GetAiter()` -> `PyObject_GetAIter()`.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-07 11:52:30 +01:00
Hugo van Kemenade eb254b43d2
bpo-45124: Remove the bdist_msi command (GH-28195)
The bdist_msi command, deprecated in Python 3.9, is now removed.
Use bdist_wheel (wheel packages) instead.
2021-09-07 12:34:27 +02:00
Pablo Galindo Salgado 533e725821
bpo-44963: Implement send() and throw() methods for anext_awaitable objects (GH-27955)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2021-09-07 11:30:14 +01:00
Tzu-ping Chung 4f88161f07
bpo-45035: Make sysconfig posix_home depend on platlibdir (GH-28011) 2021-09-07 11:27:48 +01:00
Tzu-ping Chung a5c6bcf244
Make sysconfig posix_user not depend on platlibdir (GH-27655) 2021-09-07 11:26:42 +02:00
Tim Peters 5cb4c672d8
bpo-34561: Switch to Munro & Wild "powersort" merge strategy. (#28108)
For list.sort(), replace our ad hoc merge ordering strategy with the principled, elegant,
and provably near-optimal one from Munro and Wild's "powersort".
2021-09-06 12:54:41 -05:00
Nikita Sobolev 19871fce3b
bpo-45052: Unskips a failing `test_shared_memory_basics` test (GH-28182) 2021-09-06 17:55:34 +01:00
Erlend Egeberg Aasland 5024dc1c6e
bpo-44848: Update macOS installer to use SQLite 3.36.0 (GH-27621) 2021-09-05 15:54:39 -04:00
Irit Katriel 9e31b3952f
bpo-41031: Match C and Python code formatting of unprintable exceptions and exceptions in the __main__ module. (GH-28139) 2021-09-05 18:54:13 +03:00
Nikita Sobolev dd7b816ac8
bpo-45042: Now test classes decorated with `requires_hashdigest` are not skipped (GH-28060)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-04 23:42:36 +03:00
Serhiy Storchaka 936f6a16b9
bpo-45030: Fix integer overflow in __reduce__ of the range iterator (GH-28000)
It happened with fast range iterator  when the calculated stop = start + step * len
was out of the C long range.
2021-09-04 21:02:21 +03:00
Irit Katriel 0b58e863df
bpo-45075: distinguish between frame and FrameSummary in traceback mo… (GH-28112) 2021-09-03 22:39:23 +01:00
Steve Dower 6f8bc464e0
bpo-45022: Update libffi to 3.4.2 in Windows build (GH-28146) 2021-09-03 19:37:31 +01:00
Dong-hee Na bc1c49fa94
bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11 (GH-27837)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-03 18:21:03 +02:00
Victor Stinner 7974c30b9f
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
* Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and
  document it.
* Sort macros in the C API documentation.
2021-09-03 16:44:02 +02:00
Łukasz Langa be9de8721d
bpo-34602: Quadruple stack size on macOS when compiling with UBSAN (GH-27309) 2021-09-03 09:32:19 +02:00
Irit Katriel b4b6342848
bpo-45083: Include the exception class qualname when formatting an exception (GH-28119)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-09-03 09:30:17 +02:00
Yurii Karabas 0635e201be
bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-09-02 18:17:13 +02:00
Ruben Vorderman ea23e7820f
bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-02 17:02:59 +02:00
Inada Naoki 55c4a92fc1
bpo-45056: Remove trailing unused constants from co_consts (GH-28109) 2021-09-02 13:02:06 +02:00
Victor Stinner 19ba2122ac
bpo-37330: open() no longer accept 'U' in file mode (GH-28118)
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
2021-09-02 12:58:00 +02:00
Victor Stinner a806608705
bpo-45085: Remove the binhex module (GH-28117)
The binhex module, deprecated in Python 3.9, is now removed. The
following binascii functions, deprecated in Python 3.9, are now also
removed:

* a2b_hqx(), b2a_hqx();
* rlecode_hqx(), rledecode_hqx().

The binascii.crc_hqx() function remains available.
2021-09-02 12:10:08 +02:00
Victor Stinner d589a7e7eb
bpo-40360: Deprecate the lib2to3 package (GH-28116) 2021-09-02 11:46:47 +02:00
Victor Stinner 679cb4781e
bpo-44895: libregrtest: refleak check clears types later (GH-28113)
libregrtest now clears the type cache later to reduce the risk of
false alarm when checking for reference leaks. Previously, the type
cache was cleared too early and libregrtest raised a false alarm
about reference leaks under very specific conditions.

Move also support.gc_collect() outside clear/cleanup functions to
make the garbage collection more explicit.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-09-01 17:45:27 +02:00
Irit Katriel 863154c929
bpo-31299: make it possible to filter out frames from tracebacks (GH-28067) 2021-08-31 21:42:08 +01:00
Victor Stinner 4300352000
bpo-45061: Detect Py_DECREF(Py_True) bug (GH-28089)
Add a deallocator to the bool type to detect refcount bugs in C
extensions which call Py_DECREF(Py_True) or Py_DECREF(Py_False) by
mistake.
2021-08-31 18:05:15 +02:00
Raymond Hettinger 793f55bde9
bpo-39218: Improve accuracy of variance calculation (GH-27960) 2021-08-30 20:57:30 -05:00
Eric Snow 044e8d866f
bpo-45019: Add a tool to generate list of modules to include for frozen modules (gh-27980)
Frozen modules must be added to several files in order to work properly. Before this change this had to be done manually. Here we add a tool to generate the relevant lines in those files instead. This helps us avoid mistakes and omissions.

https://bugs.python.org/issue45019
2021-08-30 17:25:11 -06:00
Łukasz Langa 5246dbc2a1
bpo-44756: Remove misleading NEWS entries of a change that was reverted before release (GH-28075) 2021-08-30 23:54:47 +02:00
Erlend Egeberg Aasland 86d8b46523
bpo-16379: expose SQLite error codes and error names in `sqlite3` (GH-27786) 2021-08-30 19:32:21 +01:00