Skip to content

Use exec directly#5224

Merged
nicoddemus merged 1 commit into
pytest-dev:masterfrom
asottile:exec
May 7, 2019
Merged

Use exec directly#5224
nicoddemus merged 1 commit into
pytest-dev:masterfrom
asottile:exec

Conversation

@asottile

@asottile asottile commented May 7, 2019

Copy link
Copy Markdown
Member

Apparently this has always worked, and I just assumed that six was providing the shim for a good reason 🤷‍♂

$ ./bin/python1.0.1 
Python 1.0.1 (May  6 2019)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> x = {}
>>> exec('y = 5', x)
>>> x['y']
5

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

the version in six only sorts out:

Python 2.7.16 (default, Mar  5 2019, 09:07:48) 
[GCC 9.0.1 20190227 (Red Hat 9.0.1-0.8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exec("test", globals=locals())
  File "<stdin>", line 1
    exec("test", globals=locals())
                        ^
SyntaxError: invalid syntax

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

(failures unrelated)

@nicoddemus nicoddemus merged commit 1d466d0 into pytest-dev:master May 7, 2019
@asottile asottile deleted the exec branch May 7, 2019 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants