Commit Graph

117809 Commits

Author SHA1 Message Date
dependabot[bot] d3abc9b516
build(deps): bump mheap/github-action-required-labels from 4 to 5 (#106306)
Bumps [mheap/github-action-required-labels](https://github.com/mheap/github-action-required-labels) from 4 to 5.
- [Release notes](https://github.com/mheap/github-action-required-labels/releases)
- [Commits](https://github.com/mheap/github-action-required-labels/compare/v4...v5)

---
updated-dependencies:
- dependency-name: mheap/github-action-required-labels
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-01 13:23:57 +03:00
dependabot[bot] c336b4c14f
build(deps-dev): bump mypy from 1.3.0 to 1.4.1 in /Tools/clinic (#106305)
Bumps [mypy](https://github.com/python/mypy) from 1.3.0 to 1.4.1.
- [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-01 09:54:32 +00:00
Terry Jan Reedy 04dfc6fa90
gh-106232: Make timeit doc command lines compatible with Windows. (#106296)
Command Prompt (CMD Shell) and older versions of PowerShell
require double quotes and single quotes inside the string.
This form also works on linux and macOS.
2023-06-30 22:34:31 -04:00
Nikita Sobolev eb7d6e7ad8
gh-105486: Change the `repr` of `ParamSpec` list of args in `GenericAlias` (#105488) 2023-07-01 00:04:50 +00:00
Barney Gale e212618baf
GH-89812: Simplify creation of symlinks in pathlib tests. (GH-106061)
Remove `PathTest.dirlink()` function. Symlinks in `PathTest.setUp()` are
created using `os.symlink()` directly; symlinks in test functions use
`Path.symlink_to()` in order to make the tests applicable to a
(near-)future `AbstractPath` class.
2023-07-01 00:46:44 +01:00
Nikita Sobolev 46c1097868
gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (#106224) 2023-06-30 23:45:08 +00:00
Nikita Sobolev 904aef9942
GH-106135: Add more edge-"cases" to test_patma (GH-106271) 2023-06-30 19:39:50 +00:00
Kirill Podoprigora 2062e11501
gh-106267: Add type cast to generated code (#106289) 2023-06-30 12:11:10 -07:00
Dong-hee Na 02ce3d56e6
gh-106280: Remove unnecessary unreachable code (gh-106285) 2023-06-30 15:58:07 +00:00
F3eQnxN3RriK a8ae73965b
gh-101100: Docs: Fix references to several numeric dunders (#106278)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-30 15:27:09 +01:00
Victor Stinner 319de0b578
GH-104584: Add Include/cpython/optimizer.h to Makefile.pre.in (#106277) 2023-06-30 03:40:09 -07:00
Victor Stinner 1a2652ceaa
Cleanup clear_static_tp_subclasses() (#106276)
Only iterate on the dictionary if Python is built with assertions:
subclass is only needed when Python is built with assertions.
2023-06-30 10:39:55 +00:00
Victor Stinner 80b3d8f337
gh-106023: Remove _PyObject_FastCallTstate() function (#106273) 2023-06-30 12:28:59 +02:00
Victor Stinner f3cf2ddd8d
gh-77782: Deprecate Py_HasFileSystemDefaultEncoding (#106272)
Deprecate Py_HasFileSystemDefaultEncoding variable.
2023-06-30 11:57:06 +02:00
Victor Stinner 2efdd2a14e
gh-106023: Remove _PyObject_FastCall() function (#106265) 2023-06-30 11:46:43 +02:00
Victor Stinner 0b51463862
Remove private _PyCodec_Lookup() function (#106269)
Remove the following private functions of the C API:

* _PyCodecInfo_GetIncrementalDecoder()
* _PyCodecInfo_GetIncrementalEncoder()
* _PyCodec_DecodeText()
* _PyCodec_EncodeText()
* _PyCodec_Forget()
* _PyCodec_Lookup()
* _PyCodec_LookupTextEncoding()

Move these functions to a new pycore_codecs.h internal header file.

These functions are no longer exported.
2023-06-30 09:34:01 +00:00
Victor Stinner e17420db5d
gh-106023: Rename _PyObject_FastCallDictTstate() (#106264)
Rename _PyObject_FastCallDictTstate() to
_PyObject_VectorcallDictTstate().
2023-06-30 07:53:42 +00:00
Inada Naoki f1034ba7f6
gh-106182: sys: Intern getfilesystemencoding() and getfilesystemencodeerrors() (#106183)
sys: Intern getfilesystemencoding() and getfilesystemencodeerrors()
2023-06-30 13:02:03 +09:00
Inada Naoki 77ddc9a7b1
fix typos (#106247)
Most typos are in comments, but two typos are in docstring.
2023-06-30 13:00:22 +09:00
Victor Stinner cd580910e1
gh-106023: Remove _PY_FASTCALL_SMALL_STACK constant (#106258)
Remove _PY_FASTCALL_SMALL_STACK constant from the C API: move it to
the internal C API (pycore_call.h).
2023-06-30 01:07:59 +00:00
Victor Stinner 8c5f74fc89
gh-106023: Update code using _PyObject_FastCall() (#106257)
Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
2023-06-30 01:05:01 +00:00
Hood Chatham e7bc8d1636
gh-106210 Remove Emscripten import trampoline (#106211)
It's no longer necessary.

Co-authored-by: Brett Cannon <brett@python.org>
2023-06-29 17:20:49 -07:00
Tian Gao cea9d4ea82
GH-106152: Add PY_THROW event to cProfile (GH-106161) 2023-06-29 16:14:09 -07:00
Brandt Bucher 7b2d94d875
GH-106008: Make implicit boolean conversions explicit (GH-106003) 2023-06-29 13:49:54 -07:00
Guido van Rossum 6e9f83d9ae
GH-106250: Support insts using one cache entry and no oparg (GH-106252) 2023-06-29 13:02:25 -07:00
hms 8bff940ad6
gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)
This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.
2023-06-29 09:34:00 -07:00
Serhiy Storchaka 3c70d467c1
Fix possible refleak in CodeType.replace() (GH-106243)
A reference to c_code was leaked if PySys_Audit() failed.
2023-06-29 17:22:15 +03:00
Charlie Zhao fb0d9b9ac1
gh-106078: Convert `_decimal` types to heap types (#106079)
- Establish global state struct
- Convert static types to heap types and add them to global state:
    * PyDecContextManager_Type
    * PyDecContext_Type
    * PyDecSignalDictMixin_Type
    * PyDec_Type
- Add to global state:
    * PyDecSignalDict_Type
    * DecimalTuple

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-06-29 10:27:20 +00:00
Serhiy Storchaka 0e24499129
gh-89392: Make test_decimal discoverable (GH-106209) 2023-06-29 12:53:22 +03:00
Serhiy Storchaka 08c08d21b0
gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor (GH-106044) 2023-06-29 12:31:08 +03:00
Serhiy Storchaka 8bf6904b22
gh-101006: Improve error handling when read marshal data (GH-101007)
* EOFError no longer overrides other errors such as MemoryError or OSError at
  the start of the object.
* Raise more relevant error when the NULL object occurs as a code object
  component.
* Minimize an overhead of calling PyErr_Occurred().
2023-06-29 12:22:19 +03:00
Nikita Sobolev 3fb7c608e5
gh-106194: Rename duplicated tests in `test_curses` (#106196) 2023-06-28 14:41:08 -06:00
Hood Chatham 4bde89462a
GH-106214: Fix `test_opcache` to skip threaded tests on non-threaded platforms (GH-106166)
This skips the test added in GH-105953 on threadless builds.
2023-06-28 13:04:59 -07:00
Guido van Rossum 11731434df
gh-104584: Emit macro expansions to opcode_metadata.h (#106163)
This produces longer traces (superblocks?).

Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project.

Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)
2023-06-28 18:28:07 +00:00
Nikita Sobolev c283a0cff5
gh-106197: Deduplicate tests in `test_buffer` (#106198) 2023-06-28 07:43:41 -07:00
F3eQnxN3RriK 18f51f91e2
gh-101100: Fix reference to `parse_args` in `optparse.rst` (#105265) 2023-06-28 15:30:26 +03:00
Nikita Sobolev d830c4a944
gh-106200: Remove unused imports (#106201) 2023-06-28 11:55:41 +00:00
Erlend E. Aasland 6c60684bf5
gh-106118: Add O_CLOEXEC preprocessor guard (#106120) 2023-06-28 13:11:32 +02:00
F3eQnxN3RriK bbf722dcd3
gh-101100: Fix reference to asynchronous methods (#106172) 2023-06-28 10:43:11 +00:00
Sam Bull 6b52a581c1
gh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs (#105995) 2023-06-28 16:08:15 +05:30
Inada Naoki a3dd8cce58
gh-106162: fix test_array modifies warning filter (#106181) 2023-06-28 16:50:36 +09:00
lightdrk 541a10f9ed
Refer to `TimeoutError` instead of `asyncio.TimeoutError` in `asyncio-task.rst` (#106136)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-06-27 23:21:38 -06:00
Victor Stinner 1f74b9e933
Fix c-analyzer for GCC: ignore LANG env var (#106173)
The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.
2023-06-28 02:50:51 +00:00
Victor Stinner adaacf26d3
GH-104584: Fix test_capi.test_counter_optimizer() when run twice (#106171)
test_counter_optimizer() and test_long_loop() of test_capi now create
a new function at each call. Otherwise, the optimizer counters are
not the expected values when the test is run more than once.
2023-06-28 04:41:21 +02:00
Victor Stinner 2ac3eec103
gh-101634: regrtest reports decoding error as failed test (#106169)
When running the Python test suite with -jN option, if a worker stdout
cannot be decoded from the locale encoding report a failed testn so the
exitcode is non-zero.
2023-06-28 04:26:52 +02:00
Victor Stinner 3f8483cad2
gh-106168: PyTuple_SET_ITEM() now checks the index (#106164)
PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument
with an assertion if Python is built in debug mode or is built with
assertions.

* list_extend() and _PyList_AppendTakeRef() now set the list size
  before calling PyList_SET_ITEM().
* PyStructSequence_GetItem() and PyStructSequence_SetItem() now check
  the index argument: must be lesser than REAL_SIZE(op).
* PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now
  aliases to PyStructSequence_GetItem() and
  PyStructSequence_SetItem().
2023-06-28 03:45:57 +02:00
T. Wouters 161012fc25
GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)
Fix test_gzip's failure under WASI, which does not have zlib, by using
test.support.import_helper.import_module to import zlib. (gzip
unconditionally imports zlib, so this does not cause any new skips.)
2023-06-28 00:55:11 +00:00
Victor Stinner 84caa3324a
gh-106084: Remove _PyObject_CallMethod() function (#106159)
Remove the following private functions from the public C API:

* _Py_CheckFunctionResult()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdNoArgs()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_CallMethodIdOneArg()
* _PyObject_MakeTpCall()
* _PyObject_VectorcallMethodId()
* _PyStack_AsDict()

Move these functions to the internal C API (pycore_call.h).

No longer export the following functions:

* _PyObject_Call()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_Call_Prepend()
* _PyObject_FastCallDictTstate()
* _PyStack_AsDict()

The following functions are still exported for stdlib shared
extensions:

* _Py_CheckFunctionResult()
* _PyObject_MakeTpCall()

Mark the following internal functions as extern:

* _PyStack_UnpackDict()
* _PyStack_UnpackDict_Free()
* _PyStack_UnpackDict_FreeNoDecRef()
2023-06-28 01:34:37 +02:00
Guido van Rossum 6b5166fb12
gh-104584: Change DEOPT_IF in uops executor (#106146)
This effectively reverts bb578a0, restoring the original DEOPT_IF() macro in ceval_macros.h, and redefining it in the Tier 2 interpreter. We can get rid of the PREDICTED() macros there as well!
2023-06-27 14:17:41 -07:00
Irit Katriel 5290881009
gh-106149: move jump target resolution from optimizer to assembler (#106150) 2023-06-27 20:24:58 +01:00