Author: Armin Rigo <ar...@tunes.org> Branch: py3.5-fstring-pep498 Changeset: r89746:b8a7efb2f114 Date: 2017-01-24 17:10 +0100 http://bitbucket.org/pypy/pypy/changeset/b8a7efb2f114/
Log: Can now translate a pypy with --no-objspace-fstrings. Might be useful if you're absolutely convinced f-strings pose a danger or for some other reason don't want them in your PyPy 3.5. diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -196,6 +196,11 @@ default=False, requires=[("objspace.usemodules.cpyext", False)]), + BoolOption("fstrings", + "if you are really convinced that f-strings are a security " + "issue, you can disable them here", + default=True), + OptionDescription("std", "Standard Object Space Options", [ BoolOption("withtproxy", "support transparent proxies", default=True), 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 @@ -292,6 +292,16 @@ # 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 oefmt(space.w_SystemError, + "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") + while True: literal, expr = fstring_find_literal_and_expr(astbuilder, fstr, atom_node, rec) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit