Skip to content

Commit fe5bf86

Browse files
authored
Fix representation of dotted variables (and other method calls) (#1074)
* Add test of #1069 * Ensure function arguments are all in repr form * Reverse order of pop'd arguments Successive pops reverses, so reverse back * Install miniconda on macos Grrr. Laggards on Azure/GHA team [dropped miniconda on macos images](actions/runner-images#9262)
1 parent d8d9f88 commit fe5bf86

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.azure/templates/install.yml

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ parameters:
1010
default: scipy
1111

1212
steps:
13+
- bash: |
14+
# laggards on Azure/GHA team dropped miniconda on macos images
15+
# https://github.com/actions/runner-images/issues/9262
16+
mkdir -p ~/miniconda3
17+
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/miniconda.sh
18+
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
19+
rm ~/miniconda3/miniconda.sh
20+
echo "##vso[task.setvariable variable=CONDA;]${HOME}/miniconda3"
21+
displayName: Install miniconda
22+
condition: startsWith(variables.image, 'macos')
23+
1324
- bash: echo "##vso[task.prependpath]$CONDA/bin"
1425
displayName: Add conda to PATH
1526
condition: or(startsWith(variables.image, 'macos'), startsWith(variables.image, 'ubuntu'))

fipy/variables/operatorVariable.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def _py3kInstructions(self, op, style, argDict, id, freshen):
238238
stack.append(stack.pop() + "(" + ", ".join(args + kwargs) + ")")
239239
elif ins.opname == 'LOAD_DEREF':
240240
# Changed in Python 3.11
241-
stack.append(op.__closure__[ins.arg-1].cell_contents)
241+
stack.append(ins.argrepr)
242242
elif ins.opname == 'RESUME':
243243
# New in Python 3.11
244244
pass
@@ -250,8 +250,8 @@ def _py3kInstructions(self, op, style, argDict, id, freshen):
250250
pass
251251
elif ins.opname == 'CALL':
252252
# New in Python 3.11
253-
kwargs = [kw + "=" + str(stack.pop()) for kw in kws]
254-
positionals = [stack.pop() for _ in range(ins.argval - len(kws))]
253+
kwargs = [kw + "=" + str(stack.pop()) for kw in kws][::-1]
254+
positionals = [stack.pop() for _ in range(ins.argval - len(kws))][::-1]
255255
callable = stack.pop()
256256
if len(stack) > 0:
257257
call_self = callable
@@ -1257,6 +1257,12 @@ def _testBinOp(self):
12571257
[[ 0 1 2 3 4 5 6 7 8]
12581258
[ 0 -1 -2 -3 -4 -5 -6 -7 -8]]
12591259
1260+
Test operator variable with unusual index argument
1261+
1262+
>>> vcv.dot(vcv) # doctest: +ELLIPSIS
1263+
(...MeshVariable._dot(CellVariable(value=array([[0, 1, 2],
1264+
[1, 2, 3]]), mesh=UniformGrid2D(dx=1.0, nx=3, dy=1.0, ny=1)), CellVariable(value=array([[0, 1, 2],
1265+
[1, 2, 3]]), mesh=UniformGrid2D(dx=1.0, nx=3, dy=1.0, ny=1)), index))
12601266
"""
12611267
pass
12621268

0 commit comments

Comments
 (0)