Skip to content

Commit 4861c66

Browse files
committed
Built-in odict is a lifted type for now (i.e. we do not wrap it in an EPyObject).
1 parent c7ae712 commit 4861c66

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ To run a specific test via `tox` on a specific Python version:
7272
PYTEST_ARGS=-ktry_except_raise tox -e py37
7373
```
7474

75+
### OS X Multiple Python Versions
76+
77+
On OS X multiple Python versions can be installed via `pyenv`; something along
78+
the lines of:
79+
80+
```
81+
$ pyenv install 3.7
82+
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
83+
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
84+
$ echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile
85+
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
86+
$ ln -s $(pyenv which python3.7) /usr/local/bin/python3.7
87+
```
88+
7589
### py.test
7690

7791
py.test is run for any given Python version under test -- it is driven via a

src/echo/interp_routines.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import collections
12
import operator
23
import os
34
import sys
@@ -21,23 +22,29 @@
2122
import termcolor
2223

2324

25+
# Many opcodes end up delegating to special functions in the object protocol --
26+
# this maps bytecode operation names to the corresponding special function
27+
# name.
2428
OPNAME_TO_SPECIAL = {
25-
'BINARY_SUBTRACT': '__sub__',
2629
'BINARY_ADD': '__add__',
27-
'BINARY_SUBSCR': '__getitem__',
2830
'BINARY_AND': '__and__',
2931
'BINARY_MULTIPLY': '__mul__',
3032
'BINARY_OR': '__or__',
3133
'BINARY_POWER': '__pow__',
34+
'BINARY_SUBSCR': '__getitem__',
35+
'BINARY_SUBTRACT': '__sub__',
3236
}
37+
# These are the "right hand side" variants of the above for the symmetrical
38+
# binops.
3339
OPNAME_TO_SPECIAL_RHS = {
3440
'BINARY_ADD': '__radd__',
35-
'BINARY_SUBTRACT': '__rsub__',
36-
'BINARY_MULTIPLY': '__rmul__',
3741
'BINARY_AND': '__rand__',
42+
'BINARY_MULTIPLY': '__rmul__',
3843
'BINARY_OR': '__ror__',
3944
'BINARY_POWER': '__rpow__',
45+
'BINARY_SUBTRACT': '__rsub__',
4046
}
47+
4148
COMPARE_TO_SPECIAL = {
4249
'==': '__eq__',
4350
'!=': '__ne__',
@@ -139,6 +146,7 @@ def run_binop(opname: Text, lhs: Any, rhs: Any, ictx: ICtx) -> Result[Any]:
139146
builtin_value_types = {
140147
ebool, ebytes, estr, eint, elist, edict, ebytearray, eset, etuple,
141148
float, complex, slice, range, ebytearray, type(sys.version_info),
149+
collections.OrderedDict,
142150
}
143151

144152
if (opname in ('BINARY_TRUE_DIVIDE', 'BINARY_MODULO') and rhs_type is eint

0 commit comments

Comments
 (0)