summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* gh-95196: Disable incorrect pickling of the C implemented classmethod ↵Serhiy Storchaka2022-10-051-1/+1
| | | | descriptors (GH-96383)
* GH-97779: Ensure that *all* frame objects are backed by "complete" frames ↵Brandt Bucher2022-10-052-4/+34
| | | | (GH-97845)
* gh-96526: Clarify format and __format__ docstrings (gh-96648)Michael2022-10-034-6/+13
|
* gh-96512: Move int_max_str_digits setting to PyConfig (#96944)Gregory P. Smith2022-10-031-7/+3
| | | | | | | | | | | It had to live as a global outside of PyConfig for stable ABI reasons in the pre-3.12 backports. This removes the `_Py_global_config_int_max_str_digits` and gets rid of the equivalent field in the internal `struct _is PyInterpreterState` as code can just use the existing nested config struct within that. Adds tests to verify unique settings and configs in subinterpreters.
* gh-94808: `_PyLineTable_StartsLine` was not used (GH-96609)Nikita Sobolev2022-10-031-27/+0
|
* gh-97591: In `Exception.__setstate__()` acquire strong references before ↵Ofey Chan2022-10-021-1/+7
| | | | calling `tp_hash` slot (#97700)
* gh-96348: Deprecate the 3-arg signature of coroutine.throw and ↵Ofey Chan2022-09-302-5/+36
| | | | generator.throw (GH-96428)
* gh-97616: list_resize() checks for integer overflow (#97617)Victor Stinner2022-09-281-2/+8
| | | | | | | | Fix multiplying a list by an integer (list *= int): detect the integer overflow when the new allocated length is close to the maximum size. Issue reported by Jordan Limor. list_resize() now checks for integer overflow before multiplying the new allocated length by the list item size (sizeof(PyObject*)).
* bpo-47243: Duplicate entry in 'Objects/unicodetype_db.h' (GH-32376)LiarPrincess2022-09-281-2334/+2322
| | | | | | | | | | | | | | | | | Fix for duplicate 1st entry in 'Objects/unicodetype_db.h': ```c /* a list of unique character type descriptors */ const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, <--- HERE {0, 0, 0, 0, 0, 32}, {0, 0, 0, 0, 0, 48}, … ``` https://bugs.python.org/issue47243 Automerge-Triggered-By: GH:isidentical
* gh-96670: Raise SyntaxError when parsing NULL bytes (#97594)Pablo Galindo Salgado2022-09-271-10/+19
|
* gh-90716: Refactor PyLong_FromString to separate concerns (GH-96808)Oscar Benjamin2022-09-251-258/+297
| | | | | | | | | | | This is a preliminary PR to refactor `PyLong_FromString` which is currently quite messy and has spaghetti like code that mixes up different concerns as well as duplicating logic. In particular: - `PyLong_FromString` now only handles sign, base and prefix detection and calls a new function `long_from_string_base` to parse the main body of the string. - The `long_from_string_base` function handles all string validation and then calls `long_from_binary_base` or a new function `long_from_non_binary_base` to construct the actual `PyLong`. - The existing `long_from_binary_base` function is simplified by factoring duplicated logic to `long_from_string_base`. - The new function `long_from_non_binary_base` factors out much of the code from `PyLong_FromString` including in particular the quadratic algorithm reffered to in gh-95778 so that this can be seen separately from unrelated concerns such as string validation.
* Fix minor comment typo in dictobject.c (GH-96960)Samuel2022-09-201-1/+1
| | | | | Fix a minor comment typo in the Objects/dictobject.c file. Automerge-Triggered-By: GH:methane
* gh-95778: Mention sys.set_int_max_str_digits() in error message (#96874)Victor Stinner2022-09-161-2/+2
| | | | When ValueError is raised if an integer is larger than the limit, mention sys.set_int_max_str_digits() in the error message.
* GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)adphrost2022-09-151-0/+11
| | | | Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* closes gh-96734: Update to Unicode 15.0.0. (GH-96809)Benjamin Peterson2022-09-131-391/+463
|
* gh-94808: improve comments and coverage of fastsearch.h (GH-96760)Dennis Sweeney2022-09-132-5/+6
|
* gh-90751: memoryview now supports half-float (#96738)Dong-hee Na2022-09-101-3/+33
| | | | Co-authored-by: Antoine Pitrou <antoine@python.org>
* gh-96364: Fix text signatures of `__getitem__` for `list` and `dict` (GH-96365)Nikita Sobolev2022-09-092-2/+4
|
* gh-96352: Set AttributeError context in _PyObject_GenericGetAttrWithDict ↵philg3142022-09-081-0/+2
| | | | (#96353)
* gh-96143: Clear instruction cache after mprotect call (#96476)Pablo Galindo Salgado2022-09-081-4/+23
|
* GH-90699: use statically allocated interned strings in typeobject's slotdefs ↵Kumar Aditya2022-09-072-166/+106
| | | | (GH-94706)
* gh-95778: Correctly pre-check for int-to-str conversion (#96537)Mark Dickinson2022-09-041-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =) The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact. The justification for the current check. The C code check is: ```c max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10 ``` In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is: $$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$ From this it follows that $$\frac{M}{3L} < \frac{s-1}{10}$$ hence that $$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$ So $$2^{L(s-1)} > 10^M.$$ But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check. <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* GH-96458: Statically initialize utf8 representation of static strings (#96481)Kumar Aditya2022-09-031-33/+0
|
* gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)Gregory P. Smith2022-09-021-1/+44
| | | | | | | | | | | | | | | | 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. 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#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
* gh-93554: Conditional jump opcodes only jump forward (GH-96318)Irit Katriel2022-09-011-16/+3
|
* gh-96455: update example in exception_handling_notes.txt to the 3.11RC ↵Irit Katriel2022-09-011-25/+28
| | | | bytecode (GH-96456)
* gh-96143: Add some comments and minor fixes missed in the original PR (#96433)Pablo Galindo Salgado2022-08-301-0/+11
| | | | | | | | | * gh-96132: Add some comments and minor fixes missed in the original PR * Update Doc/using/cmdline.rst Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)Pablo Galindo Salgado2022-08-302-0/+529
| | | | | | | :warning: :warning: Note for reviewers, hackers and fellow systems/low-level/compiler engineers :warning: :warning: If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
* GH-96237: Allow non-functions as reference-holder in frames. (GH-96238)Mark Shannon2022-08-251-3/+5
|
* GH-96068: Document object layout (GH-96069)Mark Shannon2022-08-235-0/+157
|
* GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes ↵Pablo Galindo Salgado2022-08-231-1/+1
| | | | (GH-96188)
* GH-96075: move interned dict under runtime state (GH-96077)Kumar Aditya2022-08-221-14/+25
|
* gh-96046: Initialize ht_cached_keys in PyType_Ready() (GH-96047)Christian Heimes2022-08-221-9/+26
|
* GH-90997: Wrap yield from/await in a virtual try/except StopIteration (GH-96010)Brandt Bucher2022-08-191-20/+1
|
* gh-96017: Fix some compiler warnings (GH-96018)Christian Heimes2022-08-191-0/+2
| | | | | - "comparison of integers of different signs" in typeobject.c - only define static_builtin_index_is_set in DEBUG builds - only define recreate_gil with ifdef HAVE_FORK
* Remove dead code in _PyDict_GetItemHint and rename to _PyDict_LookupIndex ↵Matthias Görgens2022-08-181-41/+3
| | | | (GH-95948)
* GH-95589: Dont crash when subclassing extension classes with multiple ↵Mark Shannon2022-08-171-32/+13
| | | | | | | inheritance (GH-96028) * Treat tp_weakref and tp_dictoffset like other opaque slots for multiple inheritance. * Document Py_TPFLAGS_MANAGED_DICT and Py_TPFLAGS_MANAGED_WEAKREF in what's new.
* GH-93911: Specialize `LOAD_ATTR` for custom `__getattribute__` (GH-93988)Ken Jin2022-08-171-13/+13
|
* gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006)Christian Heimes2022-08-161-0/+5
| | | | | | - On WASI `ENOTCAPABLE` is now mapped to `PermissionError`. - The `errno` modules exposes the new error number. - `getpath.py` now ignores `PermissionError` when it cannot open landmark files `pybuilddir.txt` and `pyenv.cfg`.
* GH-95245: Move weakreflist into the pre-header. (GH-95996)Mark Shannon2022-08-161-15/+28
|
* GH-95707: Fix uses of `Py_TPFLAGS_MANAGED_DICT` (GH-95854)Mark Shannon2022-08-152-17/+54
| | | | | | * Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set. * Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
* GH-95977: Speed up calling pure python descriptor __get__ with vectorcall ↵Kumar Aditya2022-08-141-1/+2
| | | | (gh-95978)
* gh-90928: Improve static initialization of keywords tuple in AC (#95907)Erlend E. Aasland2022-08-1315-746/+316
|
* gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code ↵Eric Snow2022-08-1120-63/+1602
| | | | | | | | | | | | | | | | (gh-95860) We only statically initialize for core code and builtin modules. Extension modules still create the tuple at runtime. We'll solve that part of interpreter isolation separately. This change includes generated code. The non-generated changes are in: * Tools/clinic/clinic.py * Python/getargs.c * Include/cpython/modsupport.h * Makefile.pre.in (re-generate global strings after running clinic) * very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c All other changes are generated code (clinic, global strings).
* gh-95605: Fix `float(s)` error message when `s` contains only whitespace ↵Mark Dickinson2022-08-101-1/+8
| | | | | (GH-95665) This PR fixes the error message from float(s) in the case where s contains only whitespace.
* gh-95504: Fix negative numbers in PyUnicode_FromFormat (GH-95848)Petr Viktorin2022-08-101-6/+19
| | | Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
* GH-92678: Document that you shouldn't be doing your own dictionary offset ↵Mark Shannon2022-08-091-1/+5
| | | | | | calculations. (GH-95598) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
* gh-95781: More strict format string checking in PyUnicode_FromFormatV() ↵Serhiy Storchaka2022-08-081-23/+10
| | | | | | | | | (GH-95784) An unrecognized format character in PyUnicode_FromFormat() and PyUnicode_FromFormatV() now sets a SystemError. In previous versions it caused all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded.
* gh-93274: Expose receiving vectorcall in the Limited API (GH-95717)Petr Viktorin2022-08-081-0/+8
|
* docs: Fix a few typos (#94899)Tim Gates2022-08-081-1/+1
| | | | | | - overriden => overridden - calcualation => calculation Signed-off-by: Tim Gates <tim.gates@iress.com>