PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: wntrblm/nox (python)

Issue:
test_run_env_systemroot seems to be failing on python 3.12.8
### Current Behavior

nox' test `test_run_env_systemroot` fails on python 3.12.8

### Expected Behavior

`test_run_env_systemroot` should not fail on >=python 3.12.8

### Steps To Reproduce

I am reporting this as a failure of a current rebuilding on NixOS that bumped python 3.12.7 -> 3.12.8.

The build logs from CI can be found here: https://hydra.nixos.org/build/281820678/nixlog/1

I tried to dig into the source code changes of 3.12.8 for `shutil.which` and i think the test is failing because of the following change:
https://github.com/python/cpython/commit/8899e85de100557899da05f0b37867a371a73800

The change intention on cpython is to fix behavior for which on windows systems.
The `test_run_env_systemroot` is running `shutil.which` with mocked `sys.platform = "win32"` so should be affected by the change.

In `Lib/shutil.py` the line 1558 change removes `cmd` from the windows lookup path thus the test is failing in our ci suite.





### Environment

```Markdown
- OS: NixOS 25.05 (nixos-unstable)
- Python: 3.12.8
- Nox: 2024.10.09
```


### Anything else?

In addition `os.pathsep` (line 1553) does return an unexpected  pathseperator when having the mock `sys.platform = "win32"` active. So i kind of have the feeling that the overall test setup is not correct when building in linux systems

I am actually not sure why `sys.platform` is mocked on the test at all, shouldnt it work the same on any platform?

Pull request:
tests: fix broken mock on CPython 3.12.8+
Should fix #902 and our test suite, where 3.12 and 3.13 are failing.


Patch:
diff --git a/nox/command.py b/nox/command.py
index fe30307..dc5e57d 100644
--- a/nox/command.py
+++ b/nox/command.py
@@ -31,6 +31,8 @@ if TYPE_CHECKING:
 
 __all__ = ["CommandFailed", "ExternalType", "run", "which"]
 
+_PLATFORM = sys.platform
+
 
 def __dir__() -> list[str]:
     return __all__
@@ -72,7 +74,7 @@ def _clean_env(env: Mapping[str, str | None] | None = None) -> dict[str, str] |
     clean_env = {k: v for k, v in env.items() if v is not None}
 
     # Ensure systemroot is passed down, otherwise Windows will explode.
-    if sys.platform == "win32":
+    if _PLATFORM.startswith("win"):
         clean_env.setdefault("SYSTEMROOT", os.environ.get("SYSTEMROOT", ""))
 
     return clean_env


Test patch:
diff --git a/tests/test_command.py b/tests/test_command.py
index bfb8527..dd1af5f 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -162,7 +162,7 @@ def test_run_env_remove(monkeypatch: pytest.MonkeyPatch) -> None:
     )
 
 
-@mock.patch("sys.platform", "win32")
+@mock.patch("nox.command._PLATFORM", "win32")
 def test_run_env_systemroot() -> None:
     systemroot = os.environ.setdefault("SYSTEMROOT", "sigil")
Repository: swiftlang/swift-syntax (swift)

Issue:
Prefer the first lexical error in a string literal segment
### Description

In `lexInStringLiteral` we currently overwrite the current lexer error when evaluating the result of `lexCharacterInStringLiteral`, we ought to only overwrite if the error isn't already present such that we prefer the first lexical error.

### Steps to Reproduce

_No response_

Pull request:
Resolves: #1480

Patch:
diff --git a/Sources/SwiftParser/Lexer/Cursor.swift b/Sources/SwiftParser/Lexer/Cursor.swift
index 6497ac19456..40a645af84d 100644
--- a/Sources/SwiftParser/Lexer/Cursor.swift
+++ b/Sources/SwiftParser/Lexer/Cursor.swift
@@ -1913,7 +1913,10 @@ extension Lexer.Cursor {
           return Lexer.Result(.stringSegment, error: error)
         }
       case .error(let errorKind):
-        error = LexingDiagnostic(errorKind, position: self)
+        // Only overwrite error if we had not found an earlier error yet
+        if error == nil {
+          error = LexingDiagnostic(errorKind, position: self)
+        }
         self = clone
       case .endOfString:
         return Lexer.Result(


Test patch:
diff --git a/Tests/SwiftParserTest/ExpressionTests.swift b/Tests/SwiftParserTest/ExpressionTests.swift
index 17c6fbf026e..007bcc55f8a 100644
--- a/Tests/SwiftParserTest/ExpressionTests.swift
+++ b/Tests/SwiftParserTest/ExpressionTests.swift
@@ -611,6 +611,13 @@ final class ExpressionTests: XCTestCase {
         DiagnosticSpec(locationMarker: "2️⃣", message: #"expected '"' to end string literal"#, fixIts: [#"insert '"'"#]),
       ]
     )
+
+    assertParse(
+      ###""1️⃣\1 \1""###,
+      diagnostics: [
+        DiagnosticSpec(message: "invalid escape sequence in literal")
+      ]
+    )
   }
 
   func testAdjacentRawStringLiterals() {
Repository: prometheus/procfs (go)

Issue:
Cgroup paths containing ":" are not supported
Considering https://github.com/prometheus/procfs/blob/bc932d6aaa40fc66d46db859e9e03d954dc622c1/proc_cgroup.go#L52 it is clear that if the path contains additional ":" characters, the path will be truncated.

Colons may be inserted, for example when running kubernetes with containerd using a `systemd` cgroup-driver.

See:
* https://github.com/containerd/containerd/blob/c35b4cfed520bf4827737f294f9292ffa73bdf8b/pkg/cri/server/helpers_linux.go#L67

And how containerd parses the file: https://github.com/containerd/cgroups/blob/8a68de567b68b30602948417a7a8e99ccf00ee9b/utils.go#L305

Changing:
```
	fields := strings.Split(cgroupStr, ":")
```
to
```
	fields := strings.SplitN(cgroupStr, ":", 3)
```
should address this.

Pull request:
Allow cgroup paths containing colons
This change adds support for cgroup paths containing colons in the /procs/<pid>/cgroup file.

This is prompted by the following:
* The spec specifies that the *three* fields are separated by colons and does not forbid them in the path
* Tools such as containerd joins path components with colons when using systemd as a cgroup provider

This closes #353  


Patch:
diff --git a/proc_cgroup.go b/proc_cgroup.go
index 4abd464..0094a13 100644
--- a/proc_cgroup.go
+++ b/proc_cgroup.go
@@ -49,7 +49,7 @@ type Cgroup struct {
 func parseCgroupString(cgroupStr string) (*Cgroup, error) {
 	var err error
 
-	fields := strings.Split(cgroupStr, ":")
+	fields := strings.SplitN(cgroupStr, ":", 3)
 	if len(fields) < 3 {
 		return nil, fmt.Errorf("at least 3 fields required, found %d fields in cgroup string: %s", len(fields), cgroupStr)
 	}


Test patch:
diff --git a/proc_cgroup_test.go b/proc_cgroup_test.go
index f530edb..00ab2b4 100644
--- a/proc_cgroup_test.go
+++ b/proc_cgroup_test.go
@@ -56,13 +56,13 @@ func TestParseCgroupString(t *testing.T) {
 			},
 		},
 		{
-			name:      "extra fields (such as those added by later kernel versions)",
-			s:         "0::/:foobar",
+			name:      "path containing colons",
+			s:         "0::/some/long/path:foobar",
 			shouldErr: false,
 			cgroup: &Cgroup{
 				HierarchyID: 0,
 				Controllers: nil,
-				Path:        "/",
+				Path:        "/some/long/path:foobar",
 			},
 		},
 		{