summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-93691: Compiler's code-gen passes location around instead of holding it ↵Irit Katriel2022-10-171-848/+975
| | | | on the global compiler state (GH-98001)
* gh-97669: Create Tools/build/ directory (#97963)Victor Stinner2022-10-174-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Create Tools/build/ directory. Move the following scripts from Tools/scripts/ to Tools/build/: * check_extension_modules.py * deepfreeze.py * freeze_modules.py * generate_global_objects.py * generate_levenshtein_examples.py * generate_opcode_h.py * generate_re_casefix.py * generate_sre_constants.py * generate_stdlib_module_names.py * generate_token.py * parse_html5_entities.py * smelly.py * stable_abi.py * umarshal.py * update_file.py * verify_ensurepip_wheels.py Update references to these scripts.
* gh-98254: Include stdlib module names in error messages for NameErrors (#98255)Pablo Galindo Salgado2022-10-152-30/+74
|
* Fix some incorrect indentation around the main switch (#98177)Guido van Rossum2022-10-111-21/+20
| | | | | | The `}` marked with `/* End instructions */` is the end of the switch. There is another pair of `{}` around the switch, which is vestigial from ancient times when it was `for (;;) { switch (opcode) { ... } }`. All `DISPATCH` macro calls should be inside that pair.
* gh-97841: Add methoddef for _filters_mutated (gh-98115)Dong-hee Na2022-10-092-4/+26
|
* gh-97922: Run the GC only on eval breaker (#97920)Pablo Galindo Salgado2022-10-081-10/+20
|
* Add a warning message about PyOS_snprintf (#95993)Eric Wieser2022-10-071-0/+1
|
* gh-86298: Ensure that __loader__ and __spec__.loader agree in ↵Barry Warsaw2022-10-071-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | warnings.warn_explicit() (GH-97803) In `_warnings.c`, in the C equivalent of `warnings.warn_explicit()`, if the module globals are given (and not None), the warning will attempt to get the source line for the issued warning. To do this, it needs the module's loader. Previously, it would only look up `__loader__` in the module globals. In https://github.com/python/cpython/issues/86298 we want to defer to the `__spec__.loader` if available. The first step on this journey is to check that `loader == __spec__.loader` and issue another warning if it is not. This commit does that. Since this is a PoC, only manual testing for now. ```python # /tmp/foo.py import warnings import bar warnings.warn_explicit( 'warning!', RuntimeWarning, 'bar.py', 2, module='bar knee', module_globals=bar.__dict__, ) ``` ```python # /tmp/bar.py import sys import os import pathlib # __loader__ = pathlib.Path() ``` Then running this: `./python.exe -Wdefault /tmp/foo.py` Produces: ``` bar.py:2: RuntimeWarning: warning! import os ``` Uncomment the `__loader__ = ` line in `bar.py` and try it again: ``` sys:1: ImportWarning: Module bar; __loader__ != __spec__.loader (<_frozen_importlib_external.SourceFileLoader object at 0x109f7dfa0> != PosixPath('.')) bar.py:2: RuntimeWarning: warning! import os ``` Automerge-Triggered-By: GH:warsaw
* GH-91052: Add C API for watching dictionaries (GH-31787)Carl Meyer2022-10-072-1/+8
|
* bpo-38693: Use f-strings instead of str.format() within importlib (#17058)Gregory P. Smith2022-10-061-0/+1783
| | | | | | | | | This is a small performance improvement, especially for one or two hot places such as _handle_fromlist() that are called a lot and the .format() method was being used just to join two strings with a dot. Otherwise it is merely a readability improvement. We keep `_ERR_MSG` and `_ERR_MSG_PREFIX` as those may be used elsewhere for canonical looking error messages.
* GH-97002: Prevent `_PyInterpreterFrame`s from backing more than one ↵Brandt Bucher2022-10-061-6/+23
| | | | `PyFrameObject` (GH-97996)
* gh-97973: Return all necessary information from the tokenizer (GH-97984)Lysandros Nikolaou2022-10-061-9/+8
| | | | | Right now, the tokenizer only returns type and two pointers to the start and end of the token. This PR modifies the tokenizer to return the type and set all of the necessary information, so that the parser does not have to this.
* gh-65961: Raise `DeprecationWarning` when `__package__` differs from ↵Brett Cannon2022-10-051-1/+1
| | | | | | | `__spec__.parent` (#97879) Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-87092: bring compiler code closer to a preprocessing-opt-assembler ↵Irit Katriel2022-10-051-39/+49
| | | | organisation (GH-97644)
* GH-91079: Decouple C stack overflow checks from Python recursion checks. ↵Mark Shannon2022-10-057-51/+73
| | | | (GH-96510)
* GH-97779: Ensure that *all* frame objects are backed by "complete" frames ↵Brandt Bucher2022-10-051-0/+7
| | | | (GH-97845)
* gh-97670: Remove sys.getdxp() and analyze_dxp.py script (#97671)Victor Stinner2022-10-042-63/+0
| | | | | | | Remove the sys.getdxp() function and the Tools/scripts/analyze_dxp.py script. DXP stands for "dynamic execution pairs". They were related to DYNAMIC_EXECUTION_PROFILE and DXPAIRS macros which have been removed in Python 3.11. Python can now be built with "./configure --enable-pystats" to gather statistics on Python opcodes.
* GH-97752: Clear the `previous` member of newly-created generator/coroutine ↵Brandt Bucher2022-10-031-0/+3
| | | | frames (GH-97795)
* gh-96526: Clarify format and __format__ docstrings (gh-96648)Michael2022-10-032-10/+16
|
* gh-96512: Move int_max_str_digits setting to PyConfig (#96944)Gregory P. Smith2022-10-032-12/+24
| | | | | | | | | | | 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.
* Fix typos in `bltinmodule.c`. (GH-97766)Nikita Sobolev2022-10-032-12/+12
|
* gh-96670: Raise SyntaxError when parsing NULL bytes (#97594)Pablo Galindo Salgado2022-09-271-1/+1
|
* gh-96848: Fix -X int_max_str_digits option parsing (#96988)Victor Stinner2022-09-261-1/+2
| | | | | Fix command line parsing: reject "-X int_max_str_digits" option with no value (invalid) when the PYTHONINTMAXSTRDIGITS environment variable is set to a valid limit.
* GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97003)Brandt Bucher2022-09-221-3/+6
|
* GH-95921: Fix positions for some chained comparisons (GH-96968)Brandt Bucher2022-09-201-0/+1
|
* gh-87092: in compiler, move the detection of exception handlers before the ↵Irit Katriel2022-09-201-16/+32
| | | | CFG optimization stage (GH-96935)
* gh-96711: Enhance SystemError message upon Invalid opcode (#96712)serge-sans-paille2022-09-201-3/+5
| | | | | | Raise verbose SystemError instead of printing debug information upon Invalid opcode. Fix #96711
* gh-96387: take_gil() resets drop request before exit (#96869)Victor Stinner2022-09-191-0/+11
| | | | | | | | | | | | | At Python exit, sometimes a thread holding the GIL can wait forever for a thread (usually a daemon thread) which requested to drop the GIL, whereas the thread already exited. To fix the race condition, the thread which requested the GIL drop now resets its request before exiting. take_gil() now calls RESET_GIL_DROP_REQUEST() before PyThread_exit_thread() if it called SET_GIL_DROP_REQUEST to fix a race condition with drop_gil(). Issue discovered and analyzed by Mingliang ZHAO.
* GH-96864: Check for error between line and opcode events (GH-96880)Brandt Bucher2022-09-191-1/+1
|
* GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)adphrost2022-09-152-2/+13
| | | | Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* gh-96751: Remove dead code from `CALL_FUNCTION_EX` opcode (GH-96752)Nikita Sobolev2022-09-151-13/+2
|
* ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)Kevin Modzelewski2022-09-141-5/+2
|
* gh-87092: reduce redundancy and repetition in compiler's optimization stage ↵Irit Katriel2022-09-131-90/+63
| | | | (GH-96713)
* GH-96754: Check whether the interpreter frame is complete before creating ↵Mark Shannon2022-09-132-3/+8
| | | | frame object. (GH-96776)
* GH-96678: Fix undefined behavior in ceval.c (#96708)Mark Shannon2022-09-101-1/+7
|
* Replace ad-hoc labels with JUMP_TO_INSTRUCTION (GH-96634)Brandt Bucher2022-09-091-4/+4
|
* GH-90230: Fix warnings and failures with --enable-pystats (GH-96622)Brandt Bucher2022-09-091-0/+2
|
* Fix possible NULL pointer dereference in _PyThread_CurrentFrames (GH-96584)Kumar Aditya2022-09-091-1/+6
|
* GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643)Mark Shannon2022-09-081-62/+59
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* gh-96653: Remove duplicate CALL_STAT_INC(inlined_py_calls) in ↵Itamar Ostricher2022-09-081-1/+0
| | | | BINARY_SUBSCR_GETITEM (GH-96654)
* GH-90699: use statically allocated interned strings in typeobject's slotdefs ↵Kumar Aditya2022-09-071-5/+0
| | | | (GH-94706)
* gh-89545: Updates platform module to use new internal _wmi module on Windows ↵Steve Dower2022-09-071-30/+63
| | | | to directly query OS properties (GH-96289)
* gh-88057: in compile.c, assertion that stackdepth is alway >=0 is missing in ↵Irit Katriel2022-09-071-0/+1
| | | | one place (GH-96513)
* GH-91432: Remove the iterator_exhausted_no_error label (GH-96517)Brandt Bucher2022-09-071-16/+20
|
* GH-96572: fix use after free in trace refs build mode (#96618)Kumar Aditya2022-09-061-1/+1
|
* GH-96569: Add two NULL checks to avoid undefined behavior. (GH-96585)Mark Shannon2022-09-061-8/+5
|
* GH-93911: Fix `LOAD_ATTR_PROPERTY` caches (GH-96519)Brandt Bucher2022-09-061-5/+5
|
* ceval.c's GETITEM should have asserts, not set exceptions (GH-96518)Dennis Sweeney2022-09-041-2/+8
|
* gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)Gregory P. Smith2022-09-023-3/+186
| | | | | | | | | | | | | | | | 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-014-220/+112
|