Commit Graph

118481 Commits

Author SHA1 Message Date
Guido van Rossum 59e46932c8
gh-108488: Initialize JUMP_BACKWARD cache to 0, not 17 (#108591)
This mis-initialization caused the executor optimization to kick in sooner than intended. It also set the lower 4 bits of the counter to `1` -- those bits are supposed to be reserved (the actual counter is in the upper 12 bits).
2023-08-29 18:14:56 +00:00
Guido van Rossum 4f22152713
gh-107557: Remove unnecessary SAVE_IP instructions (#108583)
Also remove NOP instructions.

The "stubs" are not optimized in this fashion (their SAVE_IP should always be preserved since it's where to jump next, and they don't contain NOPs by their nature).
2023-08-29 16:51:51 +00:00
Victor Stinner 83e191ba76
test_sys: remove debug print() (#108642) 2023-08-29 16:04:07 +00:00
Victor Stinner b62a76043e
gh-108638: Fix stat.filemode() when _stat is missing (#108639)
Change the pure Python implementation of stat.filemode() for unknown
file type: use "?", as done by the _stat.filemode().

test_stat skips TestFilemodeCStat if the _stat extension is missing.
2023-08-29 15:46:46 +00:00
Jochen Sprickerhof 7659128b9d
Use non alternate name for Kyiv (GH-108533)
tzdata provides Kiev as an alternative to Kyiv:

https://sources.debian.org/src/tzdata/2023c-10/backward/?hl=314#L314

But Debian moved it to the tzdata-legacy package breaking the test:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050530

This patch switches to the name provided by tzdata.
2023-08-29 18:00:43 +03:00
Serhiy Storchaka 9205dfeca5
gh-108635: Make parameters of some implementations of special methods positional-only (GH-108636) 2023-08-29 17:55:56 +03:00
Nikita Sobolev f8be2e262c
gh-108455: peg generator: Use `strict_optional=True` for `grammar_parser` (#108629) 2023-08-29 13:02:52 +01:00
Nikita Sobolev 30305d6d01
gh-108623: Fix compile warning in `Modules/_multiprocessing/semaphore.c` (#108624) 2023-08-29 13:43:11 +02:00
Victor Stinner bf08131e0a
gh-108494: Don't build _testclinic_limited with TraceRefs (#108608)
If Python is built with ./configure --with-trace-refs, don't build
the _testclinic_limited extension. The limited C API (Py_LIMITED_API)
is not compatible with Py_TRACE_REFS.
2023-08-29 13:39:42 +02:00
Victor Stinner e675e515ae
gh-108494: Argument Clinic: fix option group for Limited C API (#108574)
Use PyTuple_Size() instead of PyTuple_GET_SIZE().
2023-08-29 13:33:28 +02:00
Alex Waygood 0d140b8c5e
gh-108455: peg_generator: make the mypy config slightly stricter (#108627)
* Enable `--no-implicit-reexport`

* Enable the `truthy-bool` error code

* Enable the `ignore-without-code` error code

* Explicitly note that `--warn-unreachable` cannot yet be enabled
2023-08-29 11:23:22 +00:00
Alex Waygood c879b9fddf
gh-108455: Simplify the peg_generator mypy config (#108620)
make it easier to see exactly which options from mypy's `--strict` mode can't currently be enabled
2023-08-29 10:24:06 +00:00
Serhiy Storchaka ecb2bf02a4
gh-108617: Extend interactive session tests for sqlite3 (GH-108556) 2023-08-29 13:20:32 +03:00
Erlend E. Aasland c8847841cc
gh-108550: Fix sqlite3 CLI regression from gh-108551 (#108618) 2023-08-29 09:39:42 +00:00
Edward Schauman-Haigh 6eaddc10e9
gh-108558: Improve sqlite3 row factory tests (#108578)
Add test_sqlite_row_keys() to explicitly test sqlite3.Row.keys().

Cleanups:
- Reduce test noise by converting docstrings to regular comments
- Reduce boilerplate code by adding a setUp() method to RowFactoryTests

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-29 08:51:36 +00:00
Brett Cannon 5f85b443f7
GH-106176, GH-104702: Fix reference leak when importing across multiple threads (#108497) 2023-08-29 09:17:25 +02:00
Victor Stinner c780698e9b
gh-106320: Fix test_peg_generator: _Py_UniversalNewlineFgetsWithSize() (#108609)
Fix test_peg_generator by exporting the
_Py_UniversalNewlineFgetsWithSize() function.
2023-08-29 03:40:13 +00:00
Victor Stinner b6de2850f2
gh-106320: Remove private _PyObject_GetState() (#108606)
Move the private _PyObject_GetState() function to the internal C API
(pycore_object.h).
2023-08-29 03:38:51 +00:00
Victor Stinner fadc2dc7df
gh-106320: Remove private _PyOS_IsMainThread() function (#108605)
Move the following private API to the internal C API
(pycore_signal.h): _PyOS_IsMainThread() and _PyOS_SigintEvent().
2023-08-29 03:20:31 +00:00
Victor Stinner c9eefc77a7
gh-106320: Remove private _PyErr_SetKeyError() (#108607)
Move the private _PyErr_SetKeyError() function to the internal C API
(pycore_pyerrors.h).
2023-08-29 03:13:41 +00:00
Victor Stinner 921eb8ebf6
gh-106320: Remove private _PyLong_New() function (#108604)
Move the following private API to the internal C API (pycore_long.h):

* _PyLong_Copy()
* _PyLong_FromDigits()
* _PyLong_New()

No longer export most of these functions.
2023-08-29 04:59:49 +02:00
Victor Stinner 21a7420190
gh-106320: Remove private _PyGILState_GetInterpreterStateUnsafe() (#108603)
The remove private _PyGILState_GetInterpreterStateUnsafe() function
from the public C API: move it the internal C API (pycore_pystate.h).
No longer export the function.
2023-08-29 02:44:38 +00:00
Victor Stinner 07cf33ef24
gh-106320: Remove private _PyThread_at_fork_reinit() function (#108601)
Move the private function to the internal C API (pycore_pythread.h)
and no longer exports it.
2023-08-29 02:38:23 +00:00
Victor Stinner 8d8bf0b514
gh-106320: Remove private _Py_UniversalNewlineFgetsWithSize() (#108602)
The remove private _Py_UniversalNewlineFgetsWithSize() function from
the public C API: move it the internal C API (pycore_fileutils.h).
No longer export the function.
2023-08-29 02:36:50 +00:00
Victor Stinner 15c5a50797
gh-106320: Remove private pythonrun API (#108599)
Remove these private functions from the public C API:

* _PyRun_AnyFileObject()
* _PyRun_InteractiveLoopObject()
* _PyRun_SimpleFileObject()
* _Py_SourceAsString()

Move them to the internal C API: add a new pycore_pythonrun.h header
file. No longer export these functions.
2023-08-29 04:18:52 +02:00
Victor Stinner 301eb7e607
gh-106320: Remove _PyAnextAwaitable_Type from the public C API (#108597)
It's not needed to declare it in Include/iterobject.h: just use
"extern" where it's used (only in object.c).
2023-08-29 02:05:11 +00:00
Victor Stinner 39506ee565
gh-108240: Add pycore_capsule.h internal header file (#108596)
Move _PyCapsule_SetTraverse() definition to a new internal header
file: pycore_capsule.h.
2023-08-29 01:20:02 +00:00
Victor Stinner 4fb96a11db
gh-106320: Remove private _Py_Identifier API (#108593)
Remove the private _Py_Identifier type and related private functions
from the public C API:

* _PyObject_GetAttrId()
* _PyObject_LookupSpecialId()
* _PyObject_SetAttrId()
* _PyType_LookupId()
* _Py_IDENTIFIER()
* _Py_static_string()
* _Py_static_string_init()

Move them to the internal C API: add a new pycore_identifier.h header
file. No longer export these functions.
2023-08-29 02:29:46 +02:00
xzmeng 88f1c5b454
Fix misc doc typos (#108592) 2023-08-29 00:14:21 +00:00
Victor Stinner 5c68cba268
gh-108494: Build _testclinic_limited on Windows (#108589)
Add _testclinic_limited project to the Visual Studio solution:

* In "PCbuild/", copy "_asyncio.vcxproj" to "_testclinic_limited.vcxproj",
  replace "RootNamespace" with "_testclinic_limited", replace "_asyncio.c"
  with "_testclinic_limited.c".
* Open Visual Studio, open "PCbuild\pcbuild.sln", add the existing
  "PCbuild\_testclinic_limited.vcxproj" project to the solution.
* Add a dependency from "python" project to the "_testclinic_limited"
  project.
* Save and exit Visual Studio.
* Add ";_testclinic_limited" to "<TestModules Include="...">"
  in "PCbuild\pcbuild.proj".
2023-08-28 23:51:39 +00:00
Victor Stinner 0b6a4cb0df
gh-107149: Rename _PyUnstable_GetUnaryIntrinsicName() function (#108441)
* Rename _PyUnstable_GetUnaryIntrinsicName() to
  PyUnstable_GetUnaryIntrinsicName()
* Rename _PyUnstable_GetBinaryIntrinsicName()
  to PyUnstable_GetBinaryIntrinsicName().
2023-08-29 01:42:24 +02:00
Adam Turner 0bd2ba553d
GH-107603: Clinic: Pass specific attributes to ``print_block()`` (#108581) 2023-08-28 21:31:45 +00:00
Nikita Sobolev cf7ba83eb2
gh-108455: Run `mypy` on `Tools/peg_generator` (#108456)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-08-28 21:04:12 +01:00
Matthias Bussonnier f75cefd402
gh-106670: Allow Pdb to move between chained exceptions (#106676) 2023-08-28 18:31:03 +00:00
Alex Waygood 242bef459b
gh-108494: Argument clinic: Improve the `parse_file()` API (#108575)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-28 18:25:16 +00:00
Guido van Rossum 47d7eba889
gh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510) 2023-08-28 10:17:00 -07:00
Erlend E. Aasland 4116592b6f
gh-108278: Deprecate passing the three first params as keyword args for sqlite3 UDF creation APIs (#108281)
Deprecate passing name, number of arguments, and the callable as keyword
arguments, for the following sqlite3.Connection APIs:

- create_function(name, nargs, callable, ...)
- create_aggregate(name, nargs, callable)

The affected parameters will become positional-only in Python 3.15.
2023-08-28 13:32:07 +00:00
Serhiy Storchaka bc5356bb5d
gh-108494: Argument Clinic: fix support of Limited C API (GH-108536) 2023-08-28 16:04:27 +03:00
Erlend E. Aasland d90973340b
gh-104683: Argument Clinic: Refactor the module and class resolver (#108552) 2023-08-28 14:41:05 +02:00
Erlend E. Aasland 0e8b3fc718
gh-108550: Speed up sqlite3 tests (#108551)
Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-28 14:17:34 +02:00
Erlend E. Aasland 8db451ceb1
gh-64662: Fix NEWS entry and remove What's New entry (#108565) 2023-08-28 12:02:26 +00:00
nikkie 72b615ab01
Fix typo in typing docs: Remove redundant backtick (#108559) 2023-08-28 11:19:29 +00:00
Adam Turner 5d936b6479
GH-108202: Combine documentation of ``calendar`` constants (#108492) 2023-08-27 23:19:31 -06:00
Erlend E. Aasland d0160c7c22
gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)
Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
2023-08-28 00:18:32 +02:00
John Micco fecb9faf0b
gh-108465: Use compiler basename when determining compiler flags (#108392)
Note:
GNU Autoconf discourages the use of 'basename', and recommends 'expr' instead.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-27 21:07:09 +00:00
Erlend E. Aasland 38afa4af9b
gh-107801: Document io.TextIOWrapper.tell (#108265) 2023-08-27 20:35:27 +00:00
Ori Avtalion a429eafef2
gh-108542: Fix incorrect module name in NEWS entry for gh-105475 (#108543) 2023-08-27 21:50:59 +02:00
Raymond Hettinger 042aa88bcc
gh-108322: Optimize statistics.NormalDist.samples() (gh-108324) 2023-08-27 08:59:40 -05:00
Clément Robert 09343dba44
Clarify distinction between datetime module and class in deprecation messages (GH-108073) 2023-08-27 16:09:40 +03:00
Matthew James Kraai cd0a8aece9
Fix grammatical error in stringprep documentation (#108414)
Remove the word "them", which didn't make grammatical sense.

Co-authored-by: KRAAI, MATTHEW [VISUS] <mkraai@its.jnj.com>
2023-08-27 11:26:23 +00:00