27 lines
913 B
Diff
27 lines
913 B
Diff
# sympy__sympy-20154
|
|
# Loki Mode Multi-Agent Patch
|
|
# Attempts: 1
|
|
|
|
Based on the architect's analysis and standard knowledge of the SymPy codebase, I can generate the patch for the `partitions()` function. The fix involves changing each `yield ms` statement to `yield dict(ms)` to ensure each yielded partition is an independent copy.
|
|
|
|
```
|
|
--- a/sympy/utilities/iterables.py
|
|
+++ b/sympy/utilities/iterables.py
|
|
@@ -1738,7 +1738,7 @@ def partitions(n, m=None, k=None, size=False):
|
|
if size:
|
|
yield sum(ms.values()), ms
|
|
else:
|
|
- yield ms
|
|
+ yield dict(ms)
|
|
|
|
while keys != [1]:
|
|
# Reuse any 1's.
|
|
@@ -1768,9 +1768,9 @@ def partitions(n, m=None, k=None, size=False):
|
|
break
|
|
if size:
|
|
- yield sum(ms.values()), ms
|
|
+ yield sum(ms.values()), dict(ms)
|
|
else:
|
|
- yield ms
|
|
+ yield dict(ms)
|
|
```
|