Skip to content

Commit bfc9295

Browse files
authored
Merge pull request RustPython#7136 from RustPython/agent-wf
upgrade python workflow fix again
2 parents 809b3e0 + 5afb7c3 commit bfc9295

3 files changed

Lines changed: 29 additions & 17 deletions

File tree

.github/workflows/upgrade-pylib.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,23 @@ else
7272
fi
7373
```
7474

75-
## Step 2: Pick a module to upgrade
75+
## Step 2: Determine module name
7676

77-
If the user provided a module name via `${{ github.event.inputs.name }}`, use **exactly** that module. Skip the selection logic below and go directly to Step 3.
78-
79-
If NO module name was provided, run the todo script to auto-pick one:
77+
Run this script to determine the module name:
8078

8179
```bash
82-
python3 scripts/update_lib todo
80+
MODULE_NAME="${{ github.event.inputs.name }}"
81+
if [ -z "$MODULE_NAME" ]; then
82+
echo "No module specified, running todo to find one..."
83+
python3 scripts/update_lib todo
84+
echo "Pick one module from the list above that is marked [ ], has no unmet deps, and has a small Δ number."
85+
echo "Do NOT pick: opcode, datetime, random, hashlib, tokenize, pdb, _pyrepl, concurrent, asyncio, multiprocessing, ctypes, idlelib, tkinter, shutil, tarfile, email, unittest"
86+
else
87+
echo "Module specified by user: $MODULE_NAME"
88+
fi
8389
```
8490

85-
From the output, pick **one** module that:
86-
- Is marked `[ ]` (not yet up-to-date)
87-
- Has `[no deps]` or `[0/N deps]` (all dependencies are satisfied)
88-
- Has a small diff count (`Δ` number) — prefer modules with smaller diffs for reliability
89-
- Is NOT one of these complex modules: `opcode`, `datetime`, `collections`, `random`, `hashlib`, `tokenize`, `pdb`, `_pyrepl`, `concurrent`, `asyncio`, `multiprocessing`, `ctypes`, `idlelib`, `tkinter`, `shutil`, `tarfile`, `email`, `unittest`
91+
If the script printed "Module specified by user: ...", use that exact name. If it printed the todo list, pick one suitable module from it.
9092

9193
## Step 3: Run the upgrade
9294

Lib/collections/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
try:
5858
from _collections import defaultdict
5959
except ImportError:
60-
# FIXME: try to implement defaultdict in collections.rs rather than in Python
61-
# I (coolreader18) couldn't figure out some class stuff with __new__ and
62-
# __init__ and __missing__ and subclassing built-in types from Rust, so I went
63-
# with this instead.
60+
# TODO: RUSTPYTHON - implement defaultdict in Rust
6461
from ._defaultdict import defaultdict
6562

6663
heapq = None # Lazily imported

Lib/test/test_collections.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def __contains__(self, key):
262262
d = c.new_child(b=20, c=30)
263263
self.assertEqual(d.maps, [{'b': 20, 'c': 30}, {'a': 1, 'b': 2}])
264264

265-
@unittest.expectedFailure # TODO: RUSTPYTHON
265+
@unittest.expectedFailure # TODO: RUSTPYTHON
266266
def test_union_operators(self):
267267
cm1 = ChainMap(dict(a=1, b=2), dict(c=3, d=4))
268268
cm2 = ChainMap(dict(a=10, e=5), dict(b=20, d=4))
@@ -1957,7 +1957,7 @@ class X(ByteString): pass
19571957
# No metaclass conflict
19581958
class Z(ByteString, Awaitable): pass
19591959

1960-
@unittest.expectedFailure # TODO: RUSTPYTHON; Need to implement __buffer__ and __release_buffer__ (https://docs.python.org/3.13/reference/datamodel.html#emulating-buffer-types)
1960+
@unittest.expectedFailure # TODO: RUSTPYTHON; Need to implement __buffer__ and __release_buffer__ (https://docs.python.org/3.13/reference/datamodel.html#emulating-buffer-types)
19611961
def test_Buffer(self):
19621962
for sample in [bytes, bytearray, memoryview]:
19631963
self.assertIsInstance(sample(b"x"), Buffer)
@@ -2029,7 +2029,7 @@ def insert(self, index, value):
20292029
self.assertEqual(len(mss), len(mss2))
20302030
self.assertEqual(list(mss), list(mss2))
20312031

2032-
@unittest.expectedFailure # TODO: RUSTPYTHON
2032+
@unittest.expectedFailure # TODO: RUSTPYTHON
20332033
def test_illegal_patma_flags(self):
20342034
with self.assertRaises(TypeError):
20352035
class Both(Collection):
@@ -2121,6 +2121,19 @@ def test_basics(self):
21212121
self.assertEqual(c.setdefault('e', 5), 5)
21222122
self.assertEqual(c['e'], 5)
21232123

2124+
def test_update_reentrant_add_clears_counter(self):
2125+
c = Counter()
2126+
key = object()
2127+
2128+
class Evil(int):
2129+
def __add__(self, other):
2130+
c.clear()
2131+
return NotImplemented
2132+
2133+
c[key] = Evil()
2134+
c.update([key])
2135+
self.assertEqual(c[key], 1)
2136+
21242137
def test_init(self):
21252138
self.assertEqual(list(Counter(self=42).items()), [('self', 42)])
21262139
self.assertEqual(list(Counter(iterable=42).items()), [('iterable', 42)])

0 commit comments

Comments
 (0)