| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
(cherry picked from commit 28db978d7f134edf6c86f21c42e15003511e7e9b)
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit 1acdfec359fdf3db936168480be0f4157273c200)
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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#).
|
|
|
|
|
|
|
|
|
| |
8) (GH-95934) (GH-95938)
(cherry picked from commit a965db37f27ffb232312bc13d9a509f0d93fcd20)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Automerge-Triggered-By: GH:lysnikolaou
|
|
|
|
|
|
|
|
|
| |
8) (GH-95935)
(cherry picked from commit https://github.com/python/cpython/commit/b5e3ea286289fcad12be78480daf3756e350f69f)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Automerge-Triggered-By: GH:lysnikolaou
|
|
|
|
|
|
|
| |
feature_version (GH-94950) (#94990)
(cherry picked from commit 0daba822212cd5d6c63384a27f390f0945330c2b)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-94948) (#94969)
* gh-94947: Disallow parsing walrus with feature_version < (3, 8)
* oops, commit the parser
* 📜🤖 Added by blurb_it.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>.
(cherry picked from commit ae0be5a53bb4caee3de4888341addd9c94133f2d)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
|
|
|
|
|
|
| |
lines with continuation characters (GH-30130). (GH-30898)
(cherry picked from commit a0efc0c1960e2c49e0092694d98395555270914c)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
|
|
|
|
|
|
| |
parser pass (GH-28812). (GH-28813)
(cherry picked from commit 0219017df7ec41839fd0d56a3076b5f09c58d313)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
validator (GH-27432) (GH-27435)
(cherry picked from commit 8d0647485db5af2a0f0929d6509479ca45f1281b)
Co-authored-by: Brandt Bucher <brandt@python.org>
Automerge-Triggered-By: GH:brandtbucher
|
|
|
|
|
| |
(cherry picked from commit 8dcb7d98086888230db94a1eb07bae1b5db82bc9)
Co-authored-by: Batuhan Taskaya <batuhan@python.org>
|
|
|
| |
* [Enum] revert enum module to 3.9
|
|
|
|
|
| |
(cherry picked from commit e58d762c1fb4ad5e021d016c80c2bc4513632d2f)
Co-authored-by: Batuhan Taskaya <batuhan@python.org>
|
|
|
|
|
|
|
|
|
|
| |
When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError.
(cherry picked from commit f3491242e41933aa9529add7102edb68b80a25e9)
Co-authored-by: Batuhan Taskaya <batuhan@python.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
add:
* `_simple_enum` decorator to transform a normal class into an enum
* `_test_simple_enum` function to compare
* `_old_convert_` to enable checking `_convert_` generated enums
`_simple_enum` takes a normal class and converts it into an enum:
@simple_enum(Enum)
class Color:
RED = 1
GREEN = 2
BLUE = 3
`_old_convert_` works much like` _convert_` does, using the original logic:
# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
enum.IntEnum, 'AddressFamily', 'socket',
lambda C: C.isupper() and C.startswith('AF_'),
source=_socket,
)
`_test_simple_enum` takes a traditional enum and a simple enum and
compares the two:
# in the REPL or the same module as Color
class CheckedColor(Enum):
RED = 1
GREEN = 2
BLUE = 3
_test_simple_enum(CheckedColor, Color)
_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)
Any important differences will raise a TypeError
|
|
|
| |
This reverts commit dbac8f40e81eb0a29dc833e6409a1abf47467da6.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
add:
_simple_enum decorator to transform a normal class into an enum
_test_simple_enum function to compare
_old_convert_ to enable checking _convert_ generated enums
_simple_enum takes a normal class and converts it into an enum:
@simple_enum(Enum)
class Color:
RED = 1
GREEN = 2
BLUE = 3
_old_convert_ works much like _convert_ does, using the original logic:
# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
enum.IntEnum, 'AddressFamily', 'socket',
lambda C: C.isupper() and C.startswith('AF_'),
source=_socket,
)
test_simple_enum takes a traditional enum and a simple enum and
compares the two:
# in the REPL or the same module as Color
class CheckedColor(Enum):
RED = 1
GREEN = 2
BLUE = 3
_test_simple_enum(CheckedColor, Color)
_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)
Any important differences will raise a TypeError
|
|
|
|
|
|
|
| |
* Add source location attributes to alias.
* Move alias star construction to pegen helper.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
| |
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Talin <viridia@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
|
|
|
| |
messages (GH-23677)
|
|
|
| |
Also document that eval() does this (the same way).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Partially revert commit ac46eb4ad6662cf6d771b20d8963658b2186c48c:
"bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)".
Using a module state per module instance is causing subtle practical
problems.
For example, the Mercurial project replaces the __import__() function
to implement lazy import, whereas Python expected that "import _ast"
always return a fully initialized _ast module.
Add _PyAST_Fini() to clear the state at exit.
The _ast module has no state (set _astmodule.m_size to 0). Remove
astmodule_traverse(), astmodule_clear() and astmodule_free()
functions.
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
| |
|
|
|
|
|
| |
location information (GH-20157)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
| |
the AST (GH-19952)
|
|
|
|
|
| |
nodes (GH-19868)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
| |
(GH-19348)
|
| |
|
|
|
|
|
|
|
| |
* Re-add removed classes Suite, slice, Param, AugLoad and AugStore.
* Add docstrings for dummy classes.
* Add docstrings for attribute aliases.
* Set __module__ to "ast" instead of "_ast".
|
|
|
|
|
| |
(GH-19055)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Remove the slice type.
* Make Slice a kind of the expr type instead of the slice type.
* Replace ExtSlice(slices) with Tuple(slices, Load()).
* Replace Index(value) with a value itself.
All non-terminal nodes in AST for expressions are now of the expr type.
|
|
|
|
|
|
|
| |
default values. (GH-18843)
The default values for optional fields and attributes of AST nodes are now set
as class attributes (e.g. Constant.kind is set to None).
|
|
|
|
| |
Implement a simple precedence algorithm for ast.unparse in order to avoid redundant
parenthesis for nested structures in the final output.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
if_stmt (GH-17582)
When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node.
https://bugs.python.org/issue39031
Automerge-Triggered-By: @pablogsal
|
|
|
|
| |
decorators. (GH-16861)
|
| |
|
|
|
|
| |
(GH-15510)
|
|
|
|
|
|
|
| |
(GH-15490)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix typos in comments, docs and test names
* Update test_pyparse.py
account for change in string length
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Apply suggestion: Dealloccte -> Deallocate
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>
* Update posixmodule checksum.
* Reverse idlelib changes.
|
|
|
|
|
| |
ast.parameters nodes (GH-14778)
https://bugs.python.org/issue37593
|