[pypy-commit] pypy py3.6: Remove --no-objspace-fstrings translation option: f-strings should always be enabled in 3.6

rlamy pypy.commits at gmail.com
Thu Sep 19 08:17:18 EDT 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r97537:199eb552dbe7
Date: 2019-09-19 13:16 +0100
http://bitbucket.org/pypy/pypy/changeset/199eb552dbe7/

Log:	Remove --no-objspace-fstrings translation option: f-strings should
	always be enabled in 3.6

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -170,11 +170,6 @@
                "Disable only cffi's embedding mode.",
                default=False),
 
-    BoolOption("fstrings",
-               "if you are really convinced that f-strings are a security "
-               "issue, you can disable them here",
-               default=True),
-
     ChoiceOption("hash",
                  "The hash function to use for strings: fnv from CPython 2.7"
                  " or siphash24 from CPython >= 3.4",
diff --git a/pypy/interpreter/astcompiler/fstring.py b/pypy/interpreter/astcompiler/fstring.py
--- a/pypy/interpreter/astcompiler/fstring.py
+++ b/pypy/interpreter/astcompiler/fstring.py
@@ -318,27 +318,15 @@
     # In our case, parse_f_string() and fstring_find_literal_and_expr()
     # could be merged into a single function with a clearer logic.  It's
     # done this way to follow CPython's source code more closely.
-
     space = astbuilder.space
-    if not space.config.objspace.fstrings:
-        raise astbuilder.error(
-            "f-strings have been disabled in this version of pypy "
-            "with the translation option '--no-objspace-fstrings'.  "
-            "The PyPy team (and CPython) thinks f-strings don't "
-            "add any security risks, but we leave it to you to "
-            "convince whoever translated this pypy that it is "
-            "really the case", atom_node)
-
     while True:
         w_u, expr = fstring_find_literal_and_expr(astbuilder, fstr,
                                                       atom_node, rec)
 
         # add the literal part
         f_constant_string(astbuilder, joined_pieces, w_u, atom_node)
-
         if expr is None:
             break         # We're done with this f-string.
-
         joined_pieces.append(expr)
 
     # If recurse_lvl is zero, then we must be at the end of the


More information about the pypy-commit mailing list