PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: tornadoweb/tornado (python)
Issue: obs-fold is implemented incorrectly
The HTTP RFCs specify that when an HTTP/1.1 implementation receives a header line that begins with a space or horizontal tab, it has two choices:
1. Reject the request
2. Concatenate (fold) this line into the previous header line.

Tornado implements this incorrectly. In addition to folding header lines beginning with spaces and tabs, Tornado also folds header lines beginning with any of the following bytes:
- 0x0b
- 0x0c
- 0x0d
- 0x1c
- 0x1d
- 0x1e
- 0x1f
- 0x85
- 0xa0
Pull request description: httputil: Reject header lines beginning with invalid whitespace
The obs-fold feature is defined only for tabs and spaces. The str.isspace() method also accepts other whitespace characters. These characters are not valid in HTTP headers and should be treated as errors instead of triggering line folding.

Fixes #3480

Patch:
diff --git a/tornado/httputil.py b/tornado/httputil.py
index 0f443cdd..5d05cacb 100644
--- a/tornado/httputil.py
+++ b/tornado/httputil.py
@@ -248,7 +248,7 @@ class HTTPHeaders(StrMutableMapping):
         if not line:
             # Empty line, or the final CRLF of a header block.
             return
-        if line[0].isspace():
+        if line[0] in HTTP_WHITESPACE:
             # continuation of a multi-line header
             # TODO(7.0): Remove support for line folding.
             if self._last_key is None:


Test patch:
diff --git a/tornado/test/httputil_test.py b/tornado/test/httputil_test.py
index 53ae4607..221c1dcb 100644
--- a/tornado/test/httputil_test.py
+++ b/tornado/test/httputil_test.py
@@ -287,13 +287,22 @@ Foo: even
             [("Asdf", "qwer zxcv"), ("Foo", "bar baz"), ("Foo", "even more lines")],
         )
 
-    def test_malformed_continuation(self):
+    def test_continuation(self):
+        data = "Foo: bar\r\n\tasdf"
+        headers = HTTPHeaders.parse(data)
+        self.assertEqual(headers["Foo"], "bar asdf")
+
         # If the first line starts with whitespace, it's a
         # continuation line with nothing to continue, so reject it
         # (with a proper error).
         data = " Foo: bar"
         self.assertRaises(HTTPInputError, HTTPHeaders.parse, data)
 
+        # \f (formfeed) is whitespace according to str.isspace, but
+        # not according to the HTTP spec.
+        data = "Foo: bar\r\n\fasdf"
+        self.assertRaises(HTTPInputError, HTTPHeaders.parse, data)
+
     def test_unicode_newlines(self):
         # Ensure that only \r\n is recognized as a header separator, and not
         # the other newline-like unicode characters.
Repository: PagerDuty/go-pagerduty (go)
Issue: UpdateService is not working properly with AlertGroupingParameters
If a PD service has data inside svc.AlerGroupingParameters.Config.Timeout it doesn't appear to be correctly sent when updating, for example if there was an indefinite time-based alert grouping configured.

POC:
```go
package main

import (
	"context"
	"fmt"
	"github.com/PagerDuty/go-pagerduty"
)

var (
	authToken = "<REDACTED>"
	serviceId = "<REDACTED>"
)

func main() {
	client := pagerduty.NewClient(authToken)
	svc, err := client.GetServiceWithContext(context.TODO(), serviceId, nil)
	if err != nil {
		panic(err)
	}

       // If the service has data inside svc.AlertGroupingParameters.Config.Timeout it doesn't appear to be respected, e.g.
       // if there was an indefinite time-based alert grouping configured.
       // pagerduty.AlertGroupingParameters{Type:"time", Config:(*pagerduty.AlertGroupParamsConfig)(0x140001810e0)}
       // pagerduty.AlertGroupParamsConfig{Timeout:0x0, Aggregate:"", Fields:[]string(nil)}

	_, err = client.UpdateServiceWithContext(context.TODO(), *svc)
	if err != nil {
		// Results in panic: HTTP response failed with status code 400,
		// message: Invalid Input Provided (code: 2001): Config is invalid.
		panic(err)
	}
}
```
Pull request description: Fix unmarshaling error with AlertGroupingParameters timeout
Fixes #458 by allowing `Timeout` to be successfully unmarshalled and sent as a 0 when needed instead of being omitted as a default value.

Patch:
diff --git a/service.go b/service.go
index 9206614..3404014 100644
--- a/service.go
+++ b/service.go
@@ -107,7 +107,7 @@ type AlertGroupingParameters struct {
 
 // AlertGroupParamsConfig is the config object on alert_grouping_parameters
 type AlertGroupParamsConfig struct {
-	Timeout   uint     `json:"timeout,omitempty"`
+	Timeout   *uint    `json:"timeout,omitempty"`
 	Aggregate string   `json:"aggregate,omitempty"`
 	Fields    []string `json:"fields,omitempty"`
 }


Test patch:
diff --git a/service_test.go b/service_test.go
index 2012626..b886451 100644
--- a/service_test.go
+++ b/service_test.go
@@ -179,7 +179,7 @@ func TestService_CreateWithAlertGroupParamsTime(t *testing.T) {
 		AlertGroupingParameters: &AlertGroupingParameters{
 			Type: "time",
 			Config: &AlertGroupParamsConfig{
-				Timeout: 2,
+				Timeout: new(uint),
 			},
 		},
 	}
Repository: IAMconsortium/pyam (python)
Issue: `filter()` assumes non-starred `dict` as `keep` kwarg
# Observed (user) error

Just ran into a stupid error where I used `df.filter(dict(foo='bar')` instead of `df.filter(**dict(foo='bar')`, so rather than applying the expected `foo='bar'` rule, the function interprets the dict as the `keep` kwarg.

# Suggested solution

Add a check that `keep` is a boolean, raise error otherwise.
Pull request description: add check that `keep` in `filter()` must be boolean
# Please confirm that this PR has done the following:

- [x] Tests Added
- [x] Documentation Added
- [x] Description in RELEASE_NOTES.md Added

# Description of PR

A non-starred `dict` in `df.filter()` is mis-interpreted as the `keep` kwarg, returning a copy of the full (rather than downselected) `IamDataFrame`. This PR adds a check the `keep` must be boolean.

closes #253


Patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 3cf842e..bbd0b84 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,6 +1,7 @@
 
 # Next Release
 
+- [#261](https://github.com/IAMconsortium/pyam/pull/261) Add a check that `keep` in `filter()` is a boolean
 - [#243](https://github.com/IAMconsortium/pyam/pull/243) Update `pyam.iiasa.Connection` to support all public and private database connections. DEPRECATED: the argument 'iamc15' has been deprecated in favor of names as queryable directly from the REST API.
 - [#241](https://github.com/IAMconsortium/pyam/pull/241) Add `set_meta_from_data` feature
 - [#236](https://github.com/IAMconsortium/pyam/pull/236) Add `swap_time_for_year` method and confirm datetime column is compatible with pyam features
diff --git a/pyam/core.py b/pyam/core.py
index e945530..c563188 100644
--- a/pyam/core.py
+++ b/pyam/core.py
@@ -974,6 +974,10 @@ class IamDataFrame(object):
                ('month', 'hour', 'time')
              - 'regexp=True' disables pseudo-regexp syntax in `pattern_match()`
         """
+        if not isinstance(keep, bool):
+            msg = '`filter(keep={}, ...)` is not valid, must be boolean'
+            raise ValueError(msg.format(keep))
+
         _keep = self._apply_filters(**kwargs)
         _keep = _keep if keep else ~_keep
         ret = copy.deepcopy(self) if not inplace else self


Test patch:
diff --git a/tests/test_core.py b/tests/test_core.py
index 3bc0596..e4df621 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -201,8 +201,15 @@ def test_variable_depth_raises(test_df):
     pytest.raises(ValueError, test_df.filter, level='1/')
 
 
-def test_filter_error(test_df):
-    pytest.raises(ValueError, test_df.filter, foo='foo')
+def test_filter_error_illegal_column(test_df):
+    # filtering by column `foo` is not valid
+    pytest.raises(ValueError, test_df.filter, foo='test')
+
+
+def test_filter_error_keep(test_df):
+    # string or non-starred dict was mis-interpreted as `keep` kwarg, see #253
+    pytest.raises(ValueError, test_df.filter, model='foo', keep=1)
+    pytest.raises(ValueError, test_df.filter, dict(model='foo'))
 
 
 def test_filter_year(test_df):