diff options
| author | robot-piglet <[email protected]> | 2024-08-05 09:59:58 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2024-08-05 10:07:22 +0300 |
| commit | 8ca35a5a3ec2486b6905e4f1e55ab10872752ab2 (patch) | |
| tree | 89f9626d133380ea95f68b1f038e3756d005cbe6 /contrib/python/pure-eval/pure_eval | |
| parent | 95f0248d5a766eac88212c429966702dec272773 (diff) | |
Intermediate changes
Diffstat (limited to 'contrib/python/pure-eval/pure_eval')
4 files changed, 20 insertions, 4 deletions
diff --git a/contrib/python/pure-eval/pure_eval/__init__.py b/contrib/python/pure-eval/pure_eval/__init__.py index 0040e318a6e..ec4ba735030 100644 --- a/contrib/python/pure-eval/pure_eval/__init__.py +++ b/contrib/python/pure-eval/pure_eval/__init__.py @@ -6,3 +6,12 @@ try: except ImportError: # version.py is auto-generated with the git tag when building __version__ = "???" + +__all__ = [ + "Evaluator", + "CannotEval", + "group_expressions", + "is_expression_interesting", + "getattr_static", + "__version__", +] diff --git a/contrib/python/pure-eval/pure_eval/my_getattr_static.py b/contrib/python/pure-eval/pure_eval/my_getattr_static.py index c750b1acc3f..5490b90adec 100644 --- a/contrib/python/pure-eval/pure_eval/my_getattr_static.py +++ b/contrib/python/pure-eval/pure_eval/my_getattr_static.py @@ -79,8 +79,10 @@ def getattr_static(obj, attr): klass_result = _check_class(klass, attr) if instance_result is not _sentinel and klass_result is not _sentinel: - if (_check_class(type(klass_result), '__get__') is not _sentinel and - _check_class(type(klass_result), '__set__') is not _sentinel): + if _check_class(type(klass_result), "__get__") is not _sentinel and ( + _check_class(type(klass_result), "__set__") is not _sentinel + or _check_class(type(klass_result), "__delete__") is not _sentinel + ): return _resolve_descriptor(klass_result, obj, klass) if instance_result is not _sentinel: diff --git a/contrib/python/pure-eval/pure_eval/utils.py b/contrib/python/pure-eval/pure_eval/utils.py index a8a37302daa..19ead658506 100644 --- a/contrib/python/pure-eval/pure_eval/utils.py +++ b/contrib/python/pure-eval/pure_eval/utils.py @@ -184,7 +184,12 @@ def copy_ast_without_context(x): if field != 'ctx' if hasattr(x, field) } - return type(x)(**kwargs) + a = type(x)(**kwargs) + if hasattr(a, 'ctx'): + # Python 3.13.0b2+ defaults to Load when we don't pass ctx + # https://github.com/python/cpython/pull/118871 + del a.ctx + return a elif isinstance(x, list): return list(map(copy_ast_without_context, x)) else: diff --git a/contrib/python/pure-eval/pure_eval/version.py b/contrib/python/pure-eval/pure_eval/version.py index 9dd16a34511..db9cf742db5 100644 --- a/contrib/python/pure-eval/pure_eval/version.py +++ b/contrib/python/pure-eval/pure_eval/version.py @@ -1 +1 @@ -__version__ = '0.2.2'
\ No newline at end of file +__version__ = '0.2.3'
\ No newline at end of file |
