Commit Graph

25124 Commits

Author SHA1 Message Date
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.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 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