summaryrefslogtreecommitdiffstats
path: root/Python/clinic
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501)Gregory P. Smith2022-09-021-1/+54
| | | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. This backports https://github.com/python/cpython/pull/96499 aka 511ca9452033ef95bc7d7fc404b8161068226002 Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
* bpo-31861: Add aiter and anext to builtins (#23847)Joshua Bronson2021-03-231-1/+45
| | | | | | Co-authored-by: jab <jab@users.noreply.github.com> Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk> Co-authored-by: Justin Wang <justin39@gmail.com>
* bpo-37146: Deactivate opcode cache only when using huntrleaks in the test ↵Pablo Galindo2021-02-281-1/+19
| | | | suite (GH-24643)
* bpo-41435: Add sys._current_exceptions() function (GH-21689)Julien Danjou2020-11-021-1/+21
| | | | | | This adds a new function named sys._current_exceptions() which is equivalent ot sys._current_frames() except that it returns the exceptions currently handled by other threads. It is equivalent to calling sys.exc_info() for each running thread.
* bpo-40471: Fix grammar typo in 'issubclass' docstring (GH-19847)Alex Povel2020-06-031-3/+3
| | | | | Just a brief grammar fix. See also <>.
* bpo-40792: Make the result of PyNumber_Index() always having exact type int. ↵Serhiy Storchaka2020-05-281-2/+2
| | | | | | | | | | | | (GH-20443) Previously, the result could have been an instance of a subclass of int. Also revert bpo-26202 and make attributes start, stop and step of the range object having exact type int. Add private function _PyNumber_Index() which preserves the old behavior of PyNumber_Index() for performance to use it in the conversion functions like PyLong_AsLong().
* bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)Serhiy Storchaka2020-05-266-86/+6
| | | | Only __index__ should be used to make integer conversions lossless.
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-26/+1
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* Shorter docstring (GH-16322)Raymond Hettinger2019-09-211-2/+2
|
* bpo-38237: Make pow's arguments have more descriptive names and be keyword ↵Ammar Askar2019-09-211-18/+24
| | | | | | | | | | | | passable (GH-16302) Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-144-8/+8
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* bpo-37034: Display argument name on errors with keyword arguments with ↵Rémi Lapeyre2019-08-295-19/+19
| | | | Argument Clinic. (GH-13593)
* bpo-37942: Improve argument clinic float converter (GH-15470)Raymond Hettinger2019-08-251-4/+10
|
* bpo-37414: Remove sys.callstats() (GH-14398)Victor Stinner2019-06-261-38/+1
| | | | | Remove the undocumented sys.callstats() function. Since Python 3.7, it was deprecated and always returned None. It required a special build option CALL_PROFILE which was already removed in Python 3.7.
* bpo-37392: Remove sys.setcheckinterval() (GH-14355)Victor Stinner2019-06-251-57/+1
| | | | | | | Remove sys.getcheckinterval() and sys.setcheckinterval() functions. They were deprecated since Python 3.2. Use sys.getswitchinterval() and sys.setswitchinterval() instead. Remove also check_interval field of the PyInterpreterState structure.
* bpo-35766: compile(): rename feature_version parameter (GH-13994)Victor Stinner2019-06-121-5/+9
| | | | | | Rename compile() feature_version parameter to _feature_version and convert it to a keyword-only parameter. Update also test_type_comments to pass feature_version as a tuple.
* bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) ↵Matthias Bussonnier2019-05-281-28/+1
| | | | | | | | | | (GH-13577) It has been documented as deprecated and to be removed in 3.8; From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`. https://bugs.python.org/issue36933
* bpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)Victor Stinner2019-05-271-4/+5
| | | | | * sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs. * Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call() and gc delete_garbage().
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-1/+33
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36829: Add sys.unraisablehook() (GH-13187)Victor Stinner2019-05-221-1/+17
| | | | | | | | | | | | | | | | | | | Add new sys.unraisablehook() function which can be overridden to control how "unraisable exceptions" are handled. It is called when an exception has occurred but there is no way for Python to handle it. For example, when a destructor raises an exception or during garbage collection (gc.collect()). Changes: * Add an internal UnraisableHookArgs type used to pass arguments to sys.unraisablehook. * Add _PyErr_WriteUnraisableDefaultHook(). * The default hook now ignores exception on writing the traceback. * test_sys now uses unittest.main() to automatically discover tests: remove test_main(). * Add _PyErr_Init(). * Fix PyErr_WriteUnraisable(): hold a strong reference to sys.stderr while using it
* bpo-36127: Argument Clinic: inline parsing code for keyword parameters. ↵Serhiy Storchaka2019-03-145-26/+206
| | | | (GH-12058)
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-7/+8
| | | | | | | This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.) https://bugs.python.org/issue35975
* bpo-36101: remove non-ascii characters in docstring (GH-12018)animalize2019-02-241-2/+2
| | | | | * remove non-ascii characters in docstring * clinic.py emits a warning when docstring has non-ascii character
* bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)Serhiy Storchaka2019-01-114-49/+89
| | | | | Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
* bpo-35582: Argument Clinic: inline parsing code for positional parameters. ↵Serhiy Storchaka2019-01-114-23/+91
| | | | (GH-11313)
* bpo-20182: AC convert Python/sysmodule.c (GH-11328)Tal Einat2018-12-311-4/+970
|
* bpo-23867: Argument Clinic: inline parsing code for a single positional ↵Serhiy Storchaka2018-12-253-10/+45
| | | | parameter. (GH-9689)
* bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. ↵Serhiy Storchaka2018-11-276-29/+29
| | | | | | | | (GH-6748) Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS in Argument Clinic generated code.
* bpo-34637: Make the *start* argument for *sum()* visible as a keyword ↵Raymond Hettinger2018-09-121-6/+7
| | | | argument. (GH-9208)
* Add docstrings to public methods from context.c (GH-8531)Peter Lamut2018-07-301-9/+36
|
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-0/+146
|
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-211-0/+66
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-30579: Allow TracebackType creation and tb_next mutation from Python ↵Nathaniel J. Smith2018-01-071-0/+35
| | | | | | | | | | | | | | | | | (GH-4793) Third party projects may wish to hide their own internal machinery in order to present more comprehensible tracebacks to end users (e.g. Jinja2 and Trio both do this). Previously such projects have had to rely on ctypes to do so: https://github.com/pallets/jinja/blob/fe3dadacdf4cf411d0a5b6bbd4d5234697a28af2/jinja2/debug.py#L345 https://github.com/python-trio/trio/blob/1e86b1aee8c0c759f6f239ae53a05d0d3963c629/trio/_core/_multierror.py#L296 This provides a Python level API for creating and modifying real Traceback objects, allowing tracebacks to be edited at runtime. Patch by Nathaniel Smith.
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-154-24/+24
| | | | arguments. (#4746)
* closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)Benjamin Peterson2017-12-091-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Python now supports checking bytecode cache up-to-dateness with a hash of the source contents rather than volatile source metadata. See the PEP for details. While a fairly straightforward idea, quite a lot of code had to be modified due to the pervasiveness of pyc implementation details in the codebase. Changes in this commit include: - The core changes to importlib to understand how to read, validate, and regenerate hash-based pycs. - Support for generating hash-based pycs in py_compile and compileall. - Modifications to our siphash implementation to support passing a custom key. We then expose it to importlib through _imp. - Updates to all places in the interpreter, standard library, and tests that manually generate or parse pyc files to grok the new format. - Support in the interpreter command line code for long options like --check-hash-based-pycs. - Tests and documentation for all of the above.
* bpo-30950: Convert round() to Argument Clinic. (#2740)Serhiy Storchaka2017-11-151-1/+35
|
* bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)Serhiy Storchaka2017-07-034-86/+22
| | | | | the bare METH_FASTCALL be used for functions with positional-only parameters.
* bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)Sylvain2017-06-103-63/+63
| | | | | | | | The function '_PyArg_ParseStack()' and '_PyArg_UnpackStack' were failing (with error "XXX() takes Y argument (Z given)") before the function '_PyArg_NoStackKeywords()' was called. Thus, the latter did not raise its more meaningful error : "XXX() takes no keyword arguments".
* Add reference to help('FORMATTING') in format() builtin (GH-166)Amit Kumar2017-05-291-2/+4
|
* bpo-20185: Convert the marshal module to Argument Clinic. (#541)Serhiy Storchaka2017-03-121-0/+145
| | | Based on patch by Vajrasky Kok.
* Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-172-38/+86
| | | | | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code.
* Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-173-9/+17
| | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments.
* Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywordsVictor Stinner2017-01-172-2/+2
| | | | Issue #29286.
* Issue #20185: Convert _warnings.warn() to Argument ClinicVictor Stinner2016-12-091-0/+38
| | | | Fix warn_explicit(): interpret source=None as source=NULL.
* Issue #27810: Rerun Argument Clinic on all modulesVictor Stinner2016-09-101-4/+4
|
* Issue #27574: Decreased an overhead of parsing keyword arguments in functionsSerhiy Storchaka2016-08-141-3/+4
| | | | implemented with using Argument Clinic.
* - Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-072-63/+62
|\ | | | | | | generated by Argument Clinic. Patch by Petr Viktorin.
| * Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-072-63/+62
| | | | | | | | generated by Argument Clinic. Patch by Petr Viktorin.
* | Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7.Serhiy Storchaka2016-06-092-25/+48
|/
* Regenerate Argument Clinic code for issue #26874.Serhiy Storchaka2016-05-011-2/+2
|