sweinteract/sweinteract huggingface dataset:
Repository: borgbackup/borg (python)

Issue:
windows: drive letters (borg2)

Check the test suite about windows drive letters - do we have enough tests?

As borg is a POSIX backup tool and we also want to be cross-platform (e.g. extract a windows backup on a linux machine), maybe the best way is to map `C:\some\path` to `C/some/path` and store that path into archived items.

There is already SOME code for this, but more testing, including practical tests is needed.


Patch:
diff --git a/src/borg/helpers/fs.py b/src/borg/helpers/fs.py
index 8a47b1bd10..49e649ed58 100644
--- a/src/borg/helpers/fs.py
+++ b/src/borg/helpers/fs.py
@@ -252,6 +252,12 @@ def make_path_safe(path):
     if "\\.." in path or "..\\" in path:
         raise ValueError(f"unexpected '..' element in path {path!r}")
 
+    path = slashify(path)
+
+    if is_win32 and len(path) >= 2 and path[1] == ":":
+        # Handle drive letters: C:/path -> C/path
+        path = path[0].upper() + path[2:]
+
     path = map_chars(path)
 
     path = path.lstrip("/")


Test patch:
diff --git a/src/borg/testsuite/helpers/fs_test.py b/src/borg/testsuite/helpers/fs_test.py
index 6fa243dc11..587f8c5006 100644
--- a/src/borg/testsuite/helpers/fs_test.py
+++ b/src/borg/testsuite/helpers/fs_test.py
@@ -318,6 +318,23 @@ def test_invalid_make_path_safe(path):
         make_path_safe(path)
 
 
+def test_make_path_safe_win32_drive_letters(monkeypatch):
+    monkeypatch.setattr("borg.helpers.fs.is_win32", True)
+    # Basic drive letter
+    assert make_path_safe("C:\\Users") == "C/Users"
+    assert make_path_safe("C:\\Users\\test") == "C/Users/test"
+    # Lowercase drive letter -> Uppercase
+    assert make_path_safe("c:\\windows") == "C/windows"
+    # Relative path with backslashes
+    assert make_path_safe("foo\\bar") == "foo/bar"
+    # Just drive letter
+    assert make_path_safe("D:") == "D"
+    # Drive letter with forward slash
+    assert make_path_safe("E:/test") == "E/test"
+    # Mixed separators
+    assert make_path_safe("F:\\Mixed/Separators") == "F/Mixed/Separators"
+
+
 def test_dir_is_tagged(tmpdir):
     """Test dir_is_tagged with both path-based and file descriptor-based operations."""
Repository: numpy/numpy (python)

Issue:
BUG: weekmask parameter in busdaycalendar is not accepting array of booleans .

### Describe the issue:

the busdaycalendar is not working properly when an array of boolean is given to weekmask. I'm using the example from the numpy page.

### Reproduce the code example:

```python
import numpy as np

np.busdaycalendar(
    holidays=['2011-07-01', '2011-07-04', '2011-07-17'], weekmask=np.array([ True,  True, True,  True,  True, False, False]))
```

### Error message:

```shell
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: 'numpy.bool' object cannot be interpreted as an intege
```

### Python and NumPy Versions:

python 3.14
numpy 2.4.2

### Runtime Environment:

_No response_

### How does this issue affect you or how did you find it:

I'm developing a library to handle day-count conventions and generate cash flows. This is affecting my joint calendars implementation.


Patch:
diff --git a/numpy/_core/src/multiarray/datetime_busdaycal.c b/numpy/_core/src/multiarray/datetime_busdaycal.c
index 3a7e3a383dca..4c6986544f6c 100644
--- a/numpy/_core/src/multiarray/datetime_busdaycal.c
+++ b/numpy/_core/src/multiarray/datetime_busdaycal.c
@@ -159,15 +159,15 @@ PyArray_WeekMaskConverter(PyObject *weekmask_in, npy_bool *weekmask)
             int i;
 
             for (i = 0; i < 7; ++i) {
-                long val;
+                int val;
                 PyObject *f = PySequence_GetItem(obj, i);
                 if (f == NULL) {
                     Py_DECREF(obj);
                     return 0;
                 }
 
-                val = PyLong_AsLong(f);
-                if (error_converting(val)) {
+                val = PyObject_IsTrue(f);
+                if (val == -1) {
                     Py_DECREF(f);
                     Py_DECREF(obj);
                     return 0;


Test patch:
diff --git a/numpy/_core/tests/test_datetime.py b/numpy/_core/tests/test_datetime.py
index 7515aacc6d1b..da964923d2c6 100644
--- a/numpy/_core/tests/test_datetime.py
+++ b/numpy/_core/tests/test_datetime.py
@@ -2220,6 +2220,11 @@ def test_datetime_busdaycalendar(self):
         bdd = np.busdaycalendar(weekmask="0011001")
         assert_equal(bdd.weekmask, np.array([0, 0, 1, 1, 0, 0, 1], dtype='?'))
 
+        # Check length 7 bool array.
+        mask = np.array([False, True, True, True, True, False, False])
+        bdd = np.busdaycalendar(weekmask=mask)
+        assert_equal(bdd.weekmask, mask, strict=True)
+
         # Check length 7 string weekmask.
         bdd = np.busdaycalendar(weekmask="Mon Tue")
         assert_equal(bdd.weekmask, np.array([1, 1, 0, 0, 0, 0, 0], dtype='?'))
Repository: sympy/sympy (python)

Issue:
`Pow.as_real_imag` is inconsistent with evaluating `Pow(0, -1)` as ComplexInfinity

> Another example of something causing this issue: `1/Sum(1, (Symbol("p"), 8, 6))`
> 
> I think this boils down to the following inconsistency:
> - `Pow(0,-1).as_real_imag() == (nan, nan)`
> - `Sum(1, (Symbol("p"), 8, 6)).is_nonzero is None`
> - `Pow(Sum(1, (Symbol("p"), 8, 6)), -1).as_real_imag() == (Pow(Sum(1, (Symbol("p"), 8, 6)), -1), 0)`
> 
> I guess https://github.com/sympy/sympy/blob/c0adb406785d80e9b4bbe1f0c95e7357f371bb53/sympy/core/power.py#L1130-L1137 should have a case first about what to do if `not self.base.is_nonzero` when `not exp >= 0` 

 _Originally posted by @JasonGross in [#28218](https://github.com/sympy/sympy/issues/28218#issuecomment-3047313998)_


Patch:
diff --git a/sympy/core/power.py b/sympy/core/power.py
index cc9e90066bc0..a29731d083a9 100644
--- a/sympy/core/power.py
+++ b/sympy/core/power.py
@@ -1132,9 +1132,14 @@ def as_real_imag(self, deep=True, **hints):
             from sympy.polys.polytools import poly
 
             exp = self.exp
+            if exp < 0 and self.base.is_zero:
+                return (S.NaN, S.NaN)
+
             re_e, im_e = self.base.as_real_imag(deep=deep)
+
             if not im_e:
                 return self, S.Zero
+
             a, b = symbols('a b', cls=Dummy)
             if exp >= 0:
                 if re_e.is_Number and im_e.is_Number:


Test patch:
diff --git a/sympy/core/tests/test_power.py b/sympy/core/tests/test_power.py
index 80ae48c525c2..d0405e33cba5 100644
--- a/sympy/core/tests/test_power.py
+++ b/sympy/core/tests/test_power.py
@@ -668,3 +668,9 @@ def test_issue_25165():
     e1 = (1/sqrt(( - x + 1)**2 + (x - 0.23)**4)).series(x, 0, 2)
     e2 = 0.998603724830355 + 1.02004923189934*x + O(x**2)
     assert all_close(e1, e2)
+
+
+def test_issue_28219():
+    assert Pow(S.Zero, -1, evaluate=False).as_real_imag() == (S.NaN, S.NaN)
+    x = Symbol('x', real=True)
+    assert Pow(x, -1, evaluate=False).as_real_imag() == (1/x, S.Zero)
Repository: sympy/sympy (python)

Issue:
problem with `limit(2**(1/x), x, 0, dir='-')` and `sp.limit(2**x, x, -sp.oo)`

Could someone help me with this issue in sympy 1.13.3? I'm expecting the left limit to be 0.
```
>>> import sympy as sp
>>> x = sp.symbols('x')
>>> sp.limit(2**(1/x), x, 0, dir='-')
oo
```
I tried a simplified version, and got the same error
```
>>> sp.limit(2**x, x, -sp.oo)
oo
```


Patch:
diff --git a/sympy/series/limits.py b/sympy/series/limits.py
index 46d892c4ca96..b76fc1a7f3b9 100644
--- a/sympy/series/limits.py
+++ b/sympy/series/limits.py
@@ -177,18 +177,18 @@ def free_symbols(self):
         return isyms
 
 
-    def pow_heuristics(self, e, z, z0):
+    def pow_heuristics(self, e, z, z0, dir):
         b1, e1 = e.base, e.exp
         if not b1.has(z):
-            res = limit(e1*log(b1), z, z0)
+            res = limit(e1*log(b1), z, z0, dir=dir)
             return exp(res)
 
-        ex_lim = limit(e1, z, z0)
-        base_lim = limit(b1, z, z0)
+        ex_lim = limit(e1, z, z0, dir=dir)
+        base_lim = limit(b1, z, z0, dir=dir)
 
         if base_lim is S.One:
             if ex_lim in (S.Infinity, S.NegativeInfinity):
-                res = limit(e1*(b1 - 1), z, z0)
+                res = limit(e1*(b1 - 1), z, z0, dir=dir)
                 return exp(res)
         if base_lim is S.NegativeInfinity and ex_lim is S.Infinity:
             return S.ComplexInfinity
@@ -338,7 +338,7 @@ def set_signs(expr):
             from sympy.simplify.powsimp import powsimp
             e = powsimp(e)
             if e.is_Pow:
-                r = self.pow_heuristics(e, z, z0)
+                r = self.pow_heuristics(e, z, z0, dir)
                 if r is not None:
                     return r
             try:


Test patch:
diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index 96c905505d48..6ccdc84853c4 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -1468,3 +1468,14 @@ def test_issue_28558():
     # The original problematic case now raises NotImplementedError instead of TypeError
     # This confirms the fix - the TypeError about missing 'cdir' is resolved
     raises(NotImplementedError, lambda: limit(log(x)*cos(x), x, oo, dir='-'))
+
+
+def test_issue_28975():
+    assert limit(2**(1/x), x, 0, dir='-') == 0
+    assert limit(2**(1/x), x, 0, dir='+') == oo
+    assert limit((1/2)**(1/x), x, 0, dir='-') == oo
+    assert limit((1/2)**(1/x), x, 0, dir='+') == 0
+    assert limit(3**(1/(x-1)), x, 1, dir='-') == 0
+    assert limit(3**(1/(x-1)), x, 1, dir='+') == oo
+    assert limit(3**(tan(x)), x, pi/2, dir='-') == oo
+    assert limit(3**(tan(x)), x, pi/2, dir='+') == 0
Repository: sympy/sympy (python)

Issue:
LaTeX printing of FreeGroupElements

Version: 1.15.0.dev (actually it has been a problem for quite a long time, not just 1.15)

Code: Consider calling `latex` on generators of a free group,
```
from sympy.combinatorics import free_group
from sympy.abc import a, b
from sympy import *
_, aa, bb = free_group((a,b))
print(latex(aa))
```

This will cause a RecursionError. As a side effect, displaying the generators of a free group in Jupyter notebooks will cause a RecursionError.

---

Apart from above, I tested calling `latex` over **words** instead of single generators, e.g.,
```
print(aa*bb**3*aa)
print(latex(aa*bb**3*aa))
```
This is the output:
```
a*b**3*a
\left( \left( a, \  1\right), \  \left( b, \  3\right), \  \left( a, \  1\right)\right)
```
Is it better to make `latex` print in a similar way as `str`?


Patch:
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index 0a818615b0db..f87e8b9d2f80 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -2543,6 +2543,20 @@ def _print_OmegaPower(self, expr):
     def _print_Ordinal(self, expr):
         return " + ".join([self._print(arg) for arg in expr.args])
 
+    def _print_FreeGroupElement(self, elm):
+        if elm.is_identity:
+            return "1"
+
+        str_form = []
+        for g, power in elm.array_form:
+            s = str(g)
+            if power == 1:
+                str_form.append(s)
+            else:
+                str_form.append(s + "^{" + str(power) + "}")
+        mul_symbol = self._settings['mul_symbol_latex'] or ""
+        return mul_symbol.join(str_form)
+
     def _print_PolyElement(self, poly):
         mul_symbol = self._settings['mul_symbol_latex']
         return poly.str(self, PRECEDENCE, "{%s}^{%d}", mul_symbol)


Test patch:
diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
index cacc8ab6ca53..74b614e2a402 100644
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -1,6 +1,7 @@
 from sympy import MatAdd, MatMul, Array
 from sympy.algebras.quaternion import Quaternion
 from sympy.calculus.accumulationbounds import AccumBounds
+from sympy.combinatorics.free_groups import free_group
 from sympy.combinatorics.permutations import Cycle, Permutation, AppliedPermutation
 from sympy.concrete.products import Product
 from sympy.concrete.summations import Sum
@@ -1725,6 +1726,18 @@ def test_latex_Lambda():
     assert latex(Lambda((x, y), x + 1)) == r"\left( \left( x, \  y\right) \mapsto x + 1 \right)"
     assert latex(Lambda(x, x)) == r"\left( x \mapsto x \right)"
 
+
+def test_latex_FreeGroupElement():
+    F, a, b = free_group("a,b")
+
+    assert latex(a**0) == "1"
+    assert latex(a) == "a"
+    assert latex(a**-1) == "a^{-1}"
+    assert latex(a**3*b**2*a*b**(-1)) == "a^{3} b^{2} a b^{-1}"
+    assert latex(b**(-2)*a*b**3, mul_symbol='dot') == \
+        r"b^{-2} \cdot a \cdot b^{3}"
+
+
 def test_latex_PolyElement():
     Ruv, u, v = ring("u,v", ZZ)
     Rxyz, x, y, z = ring("x,y,z", Ruv)
Repository: sympy/sympy (python)

Issue:
`Plane((x,y,z),(u,v,w)).equation()` is 0

The current implementation of this is: 
```python
def equation(self, x=None, y=None, z=None):
        x, y, z = [i if i else Symbol(j, real=True) for i, j in zip((x, y, z), 'xyz')]
        a = Point3D(x, y, z)
        b = self.p1.direction_ratio(a)
        c = self.normal_vector
        return (sum(i*j for i, j in zip(b, c)))
```
so the equation returned is u*(x - x) + v*(y - y) + w*(z -z) == 0. 

The simplest way round this is to raise an error if x, y, z are used in a Plane. However, this might introduce some regressions for current users.

Therefore, I suggest we check if x, y, z, are used in the definition of a plane and if they are then replace them with X, Y, Z instead and raise a warning to the user.


Patch:
diff --git a/.mailmap b/.mailmap
index 042d2a233a33..ada6a497e94c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -231,6 +231,7 @@ Addison Cugini <ajcugini@gmail.com> <addisonc@pcp065368pcs.dhcp.calpoly.edu>
 Aditya Jindal <jaditya8889@gmail.com>
 Aditya Kapoor <aditya.kapoor.apm12@itbhu.ac.in>
 Aditya Kumar Sinha <adityakumar113141@gmail.com> aditya113141 <adityakumar113141@gmail.com>
+Aditya Prakash <prakashaditya2709@gmail.com>
 Aditya Ravuri <infprobscix@gmail.com> InfProbSciX <infprobscix@gmail.com>
 Aditya Rohan <riyuzakiiitk@gmail.com>
 Aditya Shah <adityashah30@gmail.com>
diff --git a/sympy/geometry/plane.py b/sympy/geometry/plane.py
index d5f69f46ec4e..47d231667219 100644
--- a/sympy/geometry/plane.py
+++ b/sympy/geometry/plane.py
@@ -348,6 +348,9 @@ def equation(self, x=None, y=None, z=None):
         6*x + 6*y + 6*z - 42
 
         """
+        coords = {x, y, z} - {None}
+        if coords & self.free_symbols:
+            raise ValueError("Provided symbols clash with symbols used to define the plane")
         x, y, z = [i if i else Symbol(j, real=True) for i, j in zip((x, y, z), 'xyz')]
         a = Point3D(x, y, z)
         b = self.p1.direction_ratio(a)


Test patch:
diff --git a/sympy/geometry/tests/test_plane.py b/sympy/geometry/tests/test_plane.py
index 77165bbd6f16..292c0ee77329 100644
--- a/sympy/geometry/tests/test_plane.py
+++ b/sympy/geometry/tests/test_plane.py
@@ -272,3 +272,10 @@ def test_parameter_value():
     raises(ValueError, lambda: p.parameter_value((1, 0, 0), t))
     raises(ValueError, lambda: p.parameter_value(Line(Point(0, 0), Point(1, 1)), t))
     raises(ValueError, lambda: p.parameter_value((0, -3, 2), t, 1))
+
+
+def test_plane_equation_symbol_clash():
+    x, y, z, u, v, w = symbols('x y z u v w')
+
+    p = Plane(Point3D(x, y, z), normal_vector=(u, v, w))
+    raises(ValueError, lambda: p.equation(x, y, z))
Repository: sympy/sympy (python)

Issue:
Ideal membership testing raises `ValueError`

An exception can be raised by testing membership of an element contained in a ring ideal, perhaps due to a bug in the Groebner basis algorithms.

The following minimal working example exercises the bug in Sympy `1.12`:

```
from sympy import Symbol, QQ
x = Symbol('x')
R = QQ.old_poly_ring(x)
I = R.ideal(0, x)
I.contains(x)
```

The final line should evaluate to `true`, but instead raises an exception, with a stack trace ending in:

```
File /path/to/python3.11/site-packages/sympy/polys/distributedmodules.py:341, in sdm_deg(f)
    327 def sdm_deg(f):
    328     """
    329     Degree of ``f``.
    330 
   (...)
    339     7
    340     """
--> 341     return max(sdm_monomial_deg(M[0]) for M in f)

ValueError: max() arg is an empty sequence
```

Curiously, the error does not occur if the ideal is replaced with any of `R.ideal(0)`, `R.ideal(x)`, `R.ideal(0, 0)` or `R.ideal(x, x)`, and the correct result is obtained in all of these cases.


Patch:
diff --git a/.mailmap b/.mailmap
index 09b3f8a9ef4c..8ee7d969b32b 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1769,6 +1769,7 @@ Zhi-Qiang Zhou <zzq_890709@hotmail.com> zhouzq-thu <zzq_890709@hotmail.com>
 Zhongshi <zj495@nyu.edu>
 Zhuoyuan Li <zy.li@stu.pku.edu.cn> zylipku <123136644+zylipku@users.noreply.github.com>
 Zhuoyuan Li <zy.li@stu.pku.edu.cn> zylipku <zy.li@stu.pku.edu.cn>
+Zihao Qi <zihaoqi@iastate.edu> Zihao Qi <35388022+megapteranovaeangliae@users.noreply.github.com>
 Zlatan Vasović <zlatanvasovic@gmail.com>
 Zoufiné Lauer-Baré <raszoufine@gmail.com> Zoufiné Lauer-Baré <82505312+zolabar@users.noreply.github.com>
 Zoufiné Lauer-Baré <raszoufine@gmail.com> zolabar <raszoufine@gmail.com>
diff --git a/sympy/polys/distributedmodules.py b/sympy/polys/distributedmodules.py
index d1fbee4ed156..9a14d3e0053a 100644
--- a/sympy/polys/distributedmodules.py
+++ b/sympy/polys/distributedmodules.py
@@ -705,8 +705,10 @@ def removethis(pair):
 
     # First add all the elements of G to S
     for i, f in enumerate(G):
+        if not f:
+            continue
         P = update(f, sdm_deg(f), P)
-        if extended and f:
+        if extended:
             coefficients.append(sdm_from_dict({(i,) + (0,)*numgens: K(1)}, O))
 
     # Now carry out the buchberger algorithm.


Test patch:
diff --git a/sympy/polys/agca/tests/test_ideals.py b/sympy/polys/agca/tests/test_ideals.py
index 0d47ea19a59a..310bc5ca7957 100644
--- a/sympy/polys/agca/tests/test_ideals.py
+++ b/sympy/polys/agca/tests/test_ideals.py
@@ -59,6 +59,14 @@ def test_exceptions():
     assert I != J
 
 
+def test_zero_generators_do_not_change_ideal():
+    R = QQ.old_poly_ring(x)
+
+    assert R.ideal(0, x) == R.ideal(x)
+    assert R.ideal(0, 0) == R.ideal()
+    assert R.ideal(0, x, x) == R.ideal(x)
+
+
 def test_nontriv_global():
     R = QQ.old_poly_ring(x, y, z)