pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/146639.patch

CHECK_STACK_BOUNDS(-1); stack_pointer[-2] = res; stack_pointer += -1; diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index d6f1c09490aac9..f4072326fb4d2d 100644 --- a/Python/optimizer_symbols.c +++ b/Python/optimizer_symbols.c @@ -264,6 +264,25 @@ _Py_uop_sym_get_const_as_stackref(JitOptContext *ctx, JitOptRef sym) return PyStackRef_FromPyObjectBorrow(const_val); } +/* + Indicates whether the type is a known built-in type + that is safe to narrow. + */ +bool +_Py_uop_sym_is_safe_type(JitOptRef sym) +{ + PyTypeObject *typ = _Py_uop_sym_get_type(sym); + if (typ == NULL) { + return false; + } + return (typ == &PyLong_Type) || + (typ == &PyUnicode_Type) || + (typ == &PyFloat_Type) || + (typ == &_PyNone_Type) || + (typ == &PyBool_Type) || + (typ == &PyFrozenDict_Type); +} + /* Indicates whether the constant is safe to constant evaluate (without side effects). From d09a7ccc9afa331ed9ecdecdad3b32eed761a070 Mon Sep 17 00:00:00 2001 From: Neko Asakura Date: Wed, 1 Apr 2026 12:34:26 -0400 Subject: [PATCH 3/3] gh-131798: Narrow the return type of `_FORMAT_SIMPLE` and `_FORMAT_WITH_SPEC` to str for built-in types --- Python/optimizer_symbols.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index f4072326fb4d2d..d6c014a838cc5d 100644 --- a/Python/optimizer_symbols.c +++ b/Python/optimizer_symbols.c @@ -264,6 +264,16 @@ _Py_uop_sym_get_const_as_stackref(JitOptContext *ctx, JitOptRef sym) return PyStackRef_FromPyObjectBorrow(const_val); } +static bool +is_safe_builtin_type(PyTypeObject *typ) +{ + return (typ == &PyUnicode_Type) || + (typ == &PyFloat_Type) || + (typ == &_PyNone_Type) || + (typ == &PyBool_Type) || + (typ == &PyFrozenDict_Type); +} + /* Indicates whether the type is a known built-in type that is safe to narrow. @@ -275,12 +285,7 @@ _Py_uop_sym_is_safe_type(JitOptRef sym) if (typ == NULL) { return false; } - return (typ == &PyLong_Type) || - (typ == &PyUnicode_Type) || - (typ == &PyFloat_Type) || - (typ == &_PyNone_Type) || - (typ == &PyBool_Type) || - (typ == &PyFrozenDict_Type); + return (typ == &PyLong_Type) || is_safe_builtin_type(typ); } /* @@ -298,11 +303,7 @@ _Py_uop_sym_is_safe_const(JitOptContext *ctx, JitOptRef sym) return true; } PyTypeObject *typ = Py_TYPE(const_val); - return (typ == &PyUnicode_Type) || - (typ == &PyFloat_Type) || - (typ == &_PyNone_Type) || - (typ == &PyBool_Type) || - (typ == &PyFrozenDict_Type); + return is_safe_builtin_type(typ); } void pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy