Commit Graph

113849 Commits

Author SHA1 Message Date
samtygier 9a458befdd
gh-91577: SharedMemory move imports out of methods (#91579)
SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a __del__() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.__init__() can also use this imported resource_tracker.
2022-06-16 15:41:51 +02:00
Victor Stinner a38c2a61d5
gh-91321: Fix test_cppext for C++03 (#93902)
Don't build _testcppext.cpp with -Wzero-as-null-pointer-constant when
testing C++03: only use this compiler flag with C++11.
2022-06-16 14:39:00 +02:00
Victor Stinner 7546914e3f
gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815) 2022-06-16 13:49:43 +02:00
Victor Stinner 484b40bf18
Call busy_retry() and sleeping_retry() with error=True (#93871)
Tests no longer call busy_retry() and sleeping_retry() with
error=False: raise an exception if the loop times out.
2022-06-16 13:44:58 +02:00
Christian Heimes 05b32c1c79
gh-93820: Fix copy() regression in enum.Flag (GH-93876)
GH-26658 introduced a regression in copy / pickle protocol for combined
`enum.Flag`s. `copy.copy(re.A | re.I)` would fail with
`AttributeError: ASCII|IGNORECASE`.

`enum.Flag` now has a `__reduce_ex__()` method that reduces flags by
combined value, not by combined name.
2022-06-15 23:42:36 -07:00
Christian Heimes 8ba1c7f720
gh-84461: Document how to install SDKs manually (GH-93844)
Co-authored-by: Brett Cannon <brett@python.org>
2022-06-15 21:28:34 +02:00
Victor Stinner 50e0866f87
Tests call sleeping_retry() with SHORT_TIMEOUT (#93870)
Tests now call busy_retry() and sleeping_retry() with SHORT_TIMEOUT
or LONG_TIMEOUT (of test.support), rather than hardcoded constants.

Add also WAIT_ACTIVE_CHILDREN_TIMEOUT constant to
_test_multiprocessing.
2022-06-15 18:49:14 +02:00
Victor Stinner 46e455f21c
test_asyncore: Optimize capture_server() (#93867)
Remove time.sleep(0.01) in test_asyncore capture_server(). The sleep
was redundant and inefficient, since the loop starts with
select.select() which also implements a sleep (poll for socket data
with a timeout).
2022-06-15 18:28:31 +02:00
Victor Stinner 41fccd23e9
test_asyncio: run_until() implements exponential sleep (#93866)
run_until() of test.test_asyncio.utils now uses an exponential sleep
delay (max: 1 second), rather than a fixed delay of 1 ms. Similar
design than support.sleeping_retry() wait strategy that applies
exponential backoff.
2022-06-15 18:28:00 +02:00
Steve Dower 99be1cbeb3
gh-93824: Reenable installation of shell extension on Windows ARM64 (GH-93825) 2022-06-15 17:07:55 +01:00
Kumar Aditya b415c5f1aa
GH-93850: Fix test_asyncio exception ignored tracebacks (#93854) 2022-06-15 16:41:47 +02:00
Erlend Egeberg Aasland ce4d11f98b
gh-93857: Fix broken audit-event targets in sqlite3 docs (#93859)
Corrected targets for the following audit-events:

- sqlite3.enable_load_extension => sqlite3.Connection.enable_load_extension
- sqlite3.load_extension => sqlite3.Connection.load_extension
2022-06-15 16:01:27 +02:00
Pamela Fox ff095e13df
Update includes in call.c (GH-93786) 2022-06-15 13:24:12 +01:00
Victor Stinner 0ba80273f2
Use support.sleeping_retry() and support.busy_retry() (#93848)
* Replace time.sleep(0.010) with sleeping_retry() to
  use an exponential sleep.
* support.wait_process(): reuse sleeping_retry().
* _test_eintr: remove unused variables.
2022-06-15 14:09:56 +02:00
Victor Stinner bddbd80cff
test_thread uses support.sleeping_retry() (#93849)
test_thread.test_count() now fails if it takes longer than
LONG_TIMEOUT seconds.
2022-06-15 13:52:13 +02:00
Erlend Egeberg Aasland d31834688b
gh-87260: Update sqlite3 signature docs to reflect actual implementation (#93840)
Align the docs for the following methods with the actual implementation:

- sqlite3.complete_statement()
- sqlite3.Connection.create_function()
- sqlite3.Connection.create_aggregate()
- sqlite3.Connection.set_progress_handler()
2022-06-15 12:28:24 +02:00
Victor Stinner 7e9eaad864
Add test.support.busy_retry() (#93770)
Add busy_retry() and sleeping_retry() functions to test.support.
2022-06-15 11:42:10 +02:00
Erlend Egeberg Aasland 4e9fa71d7e
gh-93829: In sqlite3, replace Py_BuildValue with faster APIs (#93830)
- In Modules/_sqlite/connection.c, use PyLong_FromLong
- In Modules/_sqlite/microprotocols.c, use PyTuple_Pack
2022-06-15 10:42:49 +02:00
Erlend Egeberg Aasland cdd3984307
gh-93183: Adjust wording in socket docs (#93832)
package => packet

Co-authored-by: Victor Norman
2022-06-15 10:36:37 +02:00
Adam Turner 4f26963526
gh-93735: Split Docs CI to speed-up the build (GH-93736) 2022-06-15 09:56:16 +02:00
Jeong YunWon 274769c61c
gh-93814: Add infinite test for itertools.chain.from_iterable (GH-93815)
fix #93814

Automerge-Triggered-By: GH:rhettinger
2022-06-14 13:45:50 -07:00
Ken Jin ad90d49887
[docs] Fix LOAD_ATTR version changed (GH-93816) 2022-06-15 00:22:32 +08:00
Victor Stinner 36934a16e8
gh-93353: Fix regrtest for -jN with N >= 2 (GH-93813) 2022-06-14 18:04:53 +02:00
Mark Shannon 6b330002b1
Rename 'LOAD_METHOD' specialization stat consts to 'ATTR'. (GH-93812) 2022-06-14 16:44:01 +01:00
Mark Shannon ef6e44d392
Remove LOAD_METHOD stats. (GH-93807) 2022-06-14 15:03:15 +01:00
Erlend Egeberg Aasland d773c6e95a
gh-93795: Use test.support TESTFN/unlink in sqlite3 tests (#93796) 2022-06-14 16:02:52 +02:00
Mark Shannon cdf7097612
Include freelists in allocation total. (GH-93799) 2022-06-14 14:44:26 +01:00
Ken Jin 38a7f787d8
GH-93429: Document `LOAD_METHOD` removal (GH-93803) 2022-06-14 21:43:28 +08:00
Sanket Shanbhag a338e106b6
gh-91877: Fix WriteTransport.get_write_buffer_{limits,size} docs (#92338)
- Amend docs for WriteTransport.get_write_buffer_limits
- Add docs for WriteTransport.get_write_buffer_size
2022-06-14 14:46:18 +02:00
Irit Katriel af15cc534c
GH-93678: reduce boilerplate and code repetition in the compiler (GH-93682) 2022-06-14 13:40:09 +01:00
Erlend Egeberg Aasland 46740073ef
gh-79579: Improve DML query detection in sqlite3 (#93623)
The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.

pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.
2022-06-14 13:56:36 +02:00
Victor Stinner e566ce5496
gh-93353: regrtest checks for leaked temporary files (#93776)
When running tests with -jN, create a temporary directory per process
and mark a test as "environment changed" if a test leaks a temporary
file or directory.
2022-06-14 13:43:02 +02:00
Ken Jin b083450f88
GH-93429: Merge `LOAD_METHOD` back into `LOAD_ATTR` (GH-93430) 2022-06-14 11:36:22 +01:00
Christian Heimes cd543d0bc9
gh-90473: Include stdlib dir in wasmtime PYTHONPATH (GH-93797) 2022-06-14 12:15:13 +02:00
Mark Shannon 3cd1a5d3ec
GH-93516: Store offset of first traceable instruction in code object (GH-93769) 2022-06-14 11:09:30 +01:00
Mark Shannon 2bf74753c1
GH-93662: Make sure that column offsets are correct in multi-line method calls. (GH-93673) 2022-06-14 11:08:12 +01:00
Victor Stinner 4caf5c2753
gh-91321: Fix compatibility with C++ older than C++11 (#93784)
Fix the compatibility of the Python C API with C++ older than C++11.

_Py_NULL is only defined as nullptr on C++11 and newer.
2022-06-14 11:43:08 +02:00
Petr Viktorin 3597c12941
gh-89546: Clean up PyType_FromMetaclass (GH-93686)
When changing PyType_FromMetaclass recently (GH-93012, GH-93466, GH-28748)
I found a bunch of opportunities to improve the code. Here they are.

Fixes: #89546

Automerge-Triggered-By: GH:encukou
2022-06-14 02:13:29 -07:00
Vinay Sajip 5bcf33de0b
gh-93761: Fix test to avoid simple delay when synchronizing. (GH-93779) 2022-06-14 06:41:16 +01:00
Serhiy Storchaka d7db9dc3cc
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
2022-06-14 07:25:33 +03:00
Serhiy Storchaka 8352e322e8
gh-79512: Fixed names and __module__ value of weakref classes (GH-93719)
Classes ReferenceType, ProxyType and CallableProxyType have now correct
atrtributes __module__, __name__ and __qualname__.
It makes them (types, not instances) pickleable.
2022-06-14 07:18:03 +03:00
Serhiy Storchaka 6fd4c8ec77
gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)
It combines PyImport_ImportModule() and PyObject_GetAttrString()
and saves 4-6 lines of code on every use.

Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
2022-06-14 07:15:26 +03:00
Victor Stinner 7b2064b4b9
gh-93353: Add test.support.late_deletion() (#93774) 2022-06-14 01:09:23 +02:00
Victor Stinner df22eec421
gh-89653: PEP 670: Macros always cast arguments in cpython/ (#93766)
Header files in the Include/cpython/ are only included if
the Py_LIMITED_API macro is not defined.
2022-06-13 20:09:40 +02:00
Christian Heimes c2007573dd
gh-84461: Fix parallel testing on WebAssembly (GH-93768) 2022-06-13 19:51:04 +02:00
Victor Stinner 443ca731d6
gh-93353: Fix importlib.resources._tempfile() finalizer (#93377)
Fix the importlib.resources.as_file() context manager to remove the
temporary file if destroyed late during Python finalization: keep a
local reference to the os.remove() function. Patch by Victor Stinner.
2022-06-13 19:24:00 +02:00
Victor Stinner 3ceb4b8d3a
gh-84623: Remove unused imports in tests (#93772) 2022-06-13 16:56:03 +02:00
Pablo Galindo Salgado 65ff27c7d3
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700) 2022-06-13 15:49:08 +01:00
Victor Stinner 259dd71c32
gh-84623: Remove unused imports in stdlib (#93773) 2022-06-13 16:28:41 +02:00
Victor Stinner 65ac273280
Remove ANY_VARARGS() macro from the C API (#93764)
The macro was exposed by mistake.
2022-06-13 16:24:19 +02:00