Commit Graph

117725 Commits

Author SHA1 Message Date
Victor Stinner bc7eb17084
gh-106320: Use _PyInterpreterState_GET() (#106336)
Replace PyInterpreterState_Get() with inlined
_PyInterpreterState_GET().
2023-07-02 16:37:37 +00:00
Victor Stinner 9a51a41961
gh-106320: Remove private _PyInterpreterState functions (#106335)
Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.

Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.
2023-07-02 18:11:45 +02:00
Inada Naoki 20b7c79b9d
gh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)
Add note about PY_SSIZE_T_CLEAN in extending and embedding document.
2023-07-03 00:54:35 +09:00
Nikita Sobolev 5950e7dbfc
gh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (#106329)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-07-02 17:15:28 +03:00
Inada Naoki d5bd32fb48
gh-104922: remove PY_SSIZE_T_CLEAN (#106315) 2023-07-02 15:07:46 +09:00
Victor Stinner 8571b271e7
gh-106320: Remove private _PyInterpreterState functions (#106325)
Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.

Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.
2023-07-02 01:39:38 +00:00
Victor Stinner feb51f3a64
gh-106320: Remove private _PyTraceMalloc C API functions (#106324)
* Remove private _PyTraceMalloc C API functions: move them to the
  internal C API.
* Don't export most of these functions anymore, but still export
  _PyTraceMalloc_GetTraceback() used by tests.
* Rename Include/tracemalloc.h to Include/cpython/tracemalloc.h
2023-07-02 00:49:18 +00:00
Victor Stinner 18b1fdebe0
gh-106320: Remove _PyInterpreterState_Get() alias (#106321)
Replace calls to the (removed) slow _PyInterpreterState_Get() with
fast inlined _PyInterpreterState_GET() function.
2023-07-01 23:44:07 +00:00
Kirill Podoprigora 0530f4f646
gh-102541: Fix Helper.help("mod") for non-existent mod (#105934)
If the output arg to Helper() is a stream rather than the default None, which means 'page to stdout', the ImportError from pydoc.resolve is currently not caught in pydoc.doc. The same error is caught when output is None.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-07-01 18:46:06 -04:00
Victor Stinner 46d77610fc
gh-106316: Remove pytime.h header file (#106317)
Remove the "cpython/pytime.h" header file: it only contained private
functions. Move functions to the internal pycore_time.h header file.

Move tests from _testcapi to _testinternalcapi. Rename also test
methods to have the same name than tested C functions.

No longer export these functions:

* _PyTime_Add()
* _PyTime_As100Nanoseconds()
* _PyTime_FromMicrosecondsClamp()
* _PyTime_FromTimespec()
* _PyTime_FromTimeval()
* _PyTime_GetPerfCounterWithInfo()
* _PyTime_MulDiv()
2023-07-01 22:27:18 +00:00
Md Sadman Chowdhury 822db860ea
Fix duplicate word typos in comments (#106225) 2023-07-01 12:47:14 -07:00
Barney Gale c2622a0d82
GH-89812: Improve test for `pathlib.Path.stat()` (GH-106064)
Make assertions about the `st_mode`, `st_ino` and `st_dev` attributes of
the stat results from two files and a directory, rather than checking if
`chmod()` affects `st_mode` (which is already tested elsewhere).
2023-07-01 13:33:29 +01:00
Barney Gale cbc33e4aed
GH-89812: Miscellaneous pathlib test improvements (GH-106063)
- Split out dedicated test for unbuffered `open()`
- Split out dedicated test for `is_mount()` at the filesystem root
- Avoid `os.stat()` when checking that empty paths point to '.'
- Remove unnecessary `rmtree()` call
- Remove unused `assertSame()` method
2023-07-01 12:29:02 +00:00
Barney Gale 6e01055e15
GH-89812: Test that `pathlib.Path.is_junction()` returns false (GH-106062)
Slightly expand the test coverage of `is_junction()`. The existing test
only checks that `os.path.isjunction()` is called under-the-hood.
2023-07-01 12:58:30 +01:00
Barney Gale 3fd99b5a97
GH-89812: Make symlink support configurable in pathlib tests. (GH-106060)
Adjust the pathlib tests to add a new `PathTest.can_symlink` class
attribute, which allows us to enable or disable symlink support in tests.
A (near-)future commit will add an `AbstractPath` class; its tests will
hard-code the value to `True` or `False` depending on a stub subclass's
capabilities.
2023-07-01 12:24:34 +01:00
Irit Katriel 200f255411
gh-106149: move unconditional jump direction resolution from optimizer to assembler (#106291) 2023-07-01 11:28:07 +01:00
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