Skip to content

Commit

Permalink
remove unnecessary and ugly exec_ compat hack (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph authored and hynek committed Sep 10, 2016
1 parent 1897dfd commit dcfbb7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/attr/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def isclass(klass):
# TYPE is used in exceptions, repr(int) is different on Python 2 and 3.
TYPE = "type"

def exec_(code, locals_, globals_):
exec("exec code in locals_, globals_")

def iteritems(d):
return d.iteritems()

Expand All @@ -31,9 +28,6 @@ def isclass(klass):

TYPE = "class"

def exec_(code, locals_, globals_):
exec(code, locals_, globals_)

def iteritems(d):
return d.items()

Expand Down
4 changes: 2 additions & 2 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import linecache

from . import _config
from ._compat import exec_, iteritems, isclass, iterkeys
from ._compat import iteritems, isclass, iterkeys
from .exceptions import FrozenInstanceError

# This is used at least twice, so cache it here.
Expand Down Expand Up @@ -420,7 +420,7 @@ def _add_init(cls, frozen):
# Save the lookup overhead in __init__ if we need to circumvent
# immutability.
globs["_cached_setattr"] = _obj_setattr
exec_(bytecode, globs, locs)
eval(bytecode, globs, locs)
init = locs["__init__"]

# In order of debuggers like PDB being able to step through the code,
Expand Down

0 comments on commit dcfbb7b

Please sign in to comment.