Commit Graph

111528 Commits

Author SHA1 Message Date
Eric Snow 69f6dabb9c
Rearrage the finder tests. (gh-28740)
This makes the tests a bit cleaner and makes adding more tests a little simpler.

https://bugs.python.org/issue45324
2021-10-05 10:37:14 -06: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
Jeremy Kloth de4052fe06
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712) 2021-10-05 13:17:13 +01:00
Ned Deily 0af08f343a
bpo-45163: Restrict added libnetwork check to builds on Haiku. (GH-28729)
For example, without the guard the check could cause macOS
installer builds to fail to install on older supported macOS
releases where libnetwork is not available and is not needed
on any release.
2021-10-05 11:02:57 +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
Pablo Galindo Salgado 07cf10bafc
Fix compiler warning in ceval.c regarding signed comparison (GH-28716) 2021-10-04 12:13:46 +01:00
Serhiy Storchaka 252b7bcb23
bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720) 2021-10-04 14:11:26 +03:00
Bibo-Joshi 9be930f9b1
bpo-28206: Document signals Handlers, Sigmasks and Signals enums (GH-28628)
Co-authored-by: desbma <desbma@users.noreply.github.com>
2021-10-04 13:09:40 +02: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
Pablo Galindo Salgado a25dcaefb7
bpo-45350: Rerun autoreconf with the pkg-config macros (GH-28708) 2021-10-04 00:46:52 +01:00
Serhiy Storchaka 60b9e040c9
bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711) 2021-10-03 21:22:42 +03: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
Serhiy Storchaka a5a56154f1
Remove trailing spaces. (GH-28706) 2021-10-03 16:58:14 +03:00
Raymond Hettinger dc878240dc
Fix spelling error in comment (GH-28696) 2021-10-02 13:52:05 -05:00
Raymond Hettinger db91b058d5
bpo-45346: Keep docs consistent regarding true and false values (GH-28697) 2021-10-02 13:48:08 -05: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
Terry Jan Reedy 0be338199f
bpo-45341: Replace 'Packaging' with 'Package' in "Python P... Index" (#28687)
pypi.org "  The Python Package Index (PyPI) ...
2021-10-02 02:04:55 -04: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
Mark Shannon cd760ceb67
Fix a couple of compiler warnings. (GH-28677) 2021-10-01 15:44:19 +01:00
Dong-hee Na 9eed75fde2
bpo-45332: Fix broken Decimal test and benchmark (GH-28680) 2021-10-01 22:49:46 +09:00
Julien Palard 9ce0f48e91
hashlib: Fix old message about unicode objects. (GH-28653) 2021-10-01 14:38:49 +02:00
Julien Palard 1dac95c814
sqlite3: Modernize documentation around unicode and bytes. (GH-28652) 2021-10-01 14:37:56 +02:00
Victor Stinner 833fdf126c
bpo-41710: Add private _PyDeadline_Get() function (GH-28674)
Add a private C API for deadlines: add _PyDeadline_Init() and
_PyDeadline_Get() functions.

* Add _PyTime_Add() and _PyTime_Mul() functions which compute t1+t2
  and t1*t2 and clamp the result on overflow.
* _PyTime_MulDiv() now uses _PyTime_Add() and _PyTime_Mul().
2021-10-01 13:29:25 +02:00
Victor Stinner 54957f16a6
bpo-41710: gc_collect_main() uses _PyTime_GetPerfCounter() (GH-28676)
If the DEBUG_STATS debug flag is set, gc_collect_main() now uses
_PyTime_GetPerfCounter() instead of _PyTime_GetMonotonicClock() to
measure the elapsed time.

On Windows, _PyTime_GetMonotonicClock() only has a resolution of 15.6
ms, whereas _PyTime_GetPerfCounter() is closer to a resolution of 100
ns.
2021-10-01 13:29:00 +02: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
Serhiy Storchaka 2f20592012
Revert "Revert "bpo-45229: Make datetime tests discoverable (GH-28615)" (GH-28650)" (GH-28667)
This reverts commit b07fddd527.
2021-10-01 10:57:58 +03:00
Serhiy Storchaka eb4495e8e2
bpo-45310: Fix parrallel shared memory tests (GH-28661)
Add a PID to names of POSIX shared memory objects to allow
running multiprocessing tests (test_multiprocessing_fork,
test_multiprocessing_spawn, etc) in parallel.
2021-10-01 10:56:32 +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
Eric Snow 3e1c5d989a
Install the __phello__ package too. (#28665)
I broke some buildbots by not adding __phello__ to the list of installed packages.

https://bugs.python.org/issue45020
2021-09-30 20:23:32 -06:00
Eric Snow 7e5c107541
bpo-45020: Add more test cases for frozen modules. (gh-28664)
I've added a number of test-only modules. Some of those cases are covered by the recently frozen stdlib modules (and some will be once we add encodings back in). However, I figured we'd play it safe by having a set of modules guaranteed to be there during tests.

https://bugs.python.org/issue45020
2021-09-30 18:38:52 -06: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
Pablo Galindo Salgado b07fddd527
Revert "bpo-45229: Make datetime tests discoverable (GH-28615)" (GH-28650)
This reverts commit d441437ee7.
2021-09-30 14:46:26 +01:00
Victor Stinner b34dd58fee
bpo-41710: Document _PyTime_t API in pytime.h (GH-28647) 2021-09-30 11:23:03 +02: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
Inada Naoki a143717003
Fix EncodingWarning in freeze_modules. (GH-28591) 2021-09-30 12:36:16 +09:00
Victor Stinner 0231b6da45
bpo-41710: Fix building pytime.c on Windows (GH-28644) 2021-09-30 03:50:29 +02:00
Victor Stinner d62d925823
bpo-41710: Add pytime_add() and pytime_mul() (GH-28642)
Add pytime_add() and pytime_mul() functions to pytime.c to compute
t+t2 and t*k with clamping to [_PyTime_MIN; _PyTime_MAX].

Fix pytime.h: _PyTime_FromTimeval() is not implemented on Windows.
2021-09-30 03:07:11 +02:00
Victor Stinner 09796f2f14
bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629)
Add the _PyTime_AsTimespec_clamp() function: similar to
_PyTime_AsTimespec(), but clamp to _PyTime_t min/max and don't raise
an exception.

PyThread_acquire_lock_timed() now uses _PyTime_AsTimespec_clamp() to
remove the Py_UNREACHABLE() code path.

* Add _PyTime_AsTime_t() function.
* Add PY_TIME_T_MIN and PY_TIME_T_MAX constants.
* Replace _PyTime_AsTimeval_noraise() with _PyTime_AsTimeval_clamp().
* Add pytime_divide_round_up() function.
* Fix integer overflow in pytime_divide().
* Add pytime_divmod() function.
2021-09-30 02:11:41 +02:00
Victor Stinner 8d3e7eff09
bpo-43753: _operator.is_() uses Py_Is() (GH-28641) 2021-09-30 01:28:10 +02:00
Serhiy Storchaka d441437ee7
bpo-45229: Make datetime tests discoverable (GH-28615) 2021-09-29 23:27:57 +03:00
Eric Snow 45ca1c0413
bpo-45020: Do not freeze <pkg>/__init__.py twice. (gh-28635)
Currently we're freezing the __init__.py twice, duplicating the built data unnecessarily With this change we do it once. There is no change in runtime behavior.

https://bugs.python.org/issue45020
2021-09-29 12:55:35 -06:00
Łukasz Langa bf5d1684a7
[typo] s/libexpact/libexpat/ in setup.py (GH-28624) 2021-09-29 16:29:35 +02:00
Łukasz Langa f1ca5d7f61
[typo] Fix threading.Barrier comment that used confusing punctuation (GH-28623)
Removed extra comma in comment that indicates state of a `Barrier` as it was confusing and breaking the flow while reading.

Co-authored-by: Priyank <5903604+cpriyank@users.noreply.github.com>
2021-09-29 16:11:26 +02:00
Pablo Galindo Salgado 6c1154b9de
bpo-44394: Ensure libexpat is linked against libm (GH-28617) 2021-09-29 14:18:33 +01:00