PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: jazzband/tablib (python)
Issue: Databook unable to load xls
I'm trying to load an xls file however it fails with the following error
```
with open("xls_file", "rb") as fh: 
    imported_data = Databook().load(fh, "xls")
```
```
Traceback (most recent call last):
  File ".\test.py", line 5, in <module>
    imported_data = Databook().load(fh, "xls")
  File "lib\site-packages\tablib\core.py", line 872, in load
    fmt.import_book(self, stream, **kwargs)
  File "lib\site-packages\tablib\formats\_xls.py", line 103, in import_book
    xls_book = xlrd.open_workbook(file_contents=in_stream)
  File "lib\site-packages\xlrd\__init__.py", line 166, in open_workbook
    file_format = inspect_format(filename, file_contents)
  File "lib\site-packages\xlrd\__init__.py", line 57, in inspect_format
    peek = content[:PEEK_SIZE]
TypeError: '_io.BufferedReader' object is not subscriptable
```
Pull request description: Fix crash when loading databook from XLS
`xlrd.open_workbook()` function expects the `file_contents` argument to be a string.

Fixes #522

Patch:
diff --git a/src/tablib/formats/_xls.py b/src/tablib/formats/_xls.py
index 6c8dce7..2c6c527 100644
--- a/src/tablib/formats/_xls.py
+++ b/src/tablib/formats/_xls.py
@@ -100,7 +100,7 @@ class XLSFormat:
 
         dbook.wipe()
 
-        xls_book = xlrd.open_workbook(file_contents=in_stream)
+        xls_book = xlrd.open_workbook(file_contents=in_stream.read())
 
         for sheet in xls_book.sheets():
             data = tablib.Dataset()


Test patch:
diff --git a/tests/test_tablib.py b/tests/test_tablib.py
index 9830d78..e783d41 100755
--- a/tests/test_tablib.py
+++ b/tests/test_tablib.py
@@ -1147,6 +1147,11 @@ class XLSTests(BaseTestCase):
             ])
         )
 
+    def test_book_import_from_stream(self):
+        in_stream = self.founders.xls
+        book = tablib.Databook().load(in_stream, 'xls')
+        self.assertEqual(book.sheets()[0].title, 'Founders')
+
 
 class XLSXTests(BaseTestCase):
     def test_xlsx_format_detect(self):
Repository: yukinarit/pyserde (python)
Issue: from_yaml will return None with empty string
I assume this is a bug and not by design:

```py
from dataclasses import dataclass
from serde.yaml import from_yaml

@dataclass
class Foo:
  bar: str

good = '''
  bar: hello
'''

bad = '''
  no: hello
'''

from_yaml(Foo, good) # Foo(bar='hello') ✅
from_yaml(Foo, bad)  # raises SerdeError ✅
from_yaml(Foo, '')   # None 😱
```

Pull request description: Fix deserializing from incompatible value e.g. None
Closes #369 

Patch:
diff --git a/serde/de.py b/serde/de.py
index b66e24c..633c879 100644
--- a/serde/de.py
+++ b/serde/de.py
@@ -362,8 +362,6 @@ def from_obj(c: Type[T], o: Any, named: bool, reuse_instances: bool) -> T:
         maybe_generic = c
     try:
         thisfunc = functools.partial(from_obj, named=named, reuse_instances=reuse_instances)
-        if o is None:
-            return None
         if is_dataclass_without_de(c):
             deserialize(c)
             return deserializable_to_obj(c)
@@ -951,9 +949,6 @@ def {{func}}(cls=cls, maybe_generic=None, maybe_generic_type_vars=None, data=Non
   if reuse_instances is Ellipsis:
     reuse_instances = {{serde_scope.reuse_instances_default}}
 
-  if data is None:
-    return None
-
   maybe_generic_type_vars = maybe_generic_type_vars or {{cls_type_vars}}
 
   {% for f in fields %}
@@ -1000,9 +995,6 @@ def {{func}}(cls=cls, maybe_generic=None, maybe_generic_type_vars=None, data=Non
   if reuse_instances is Ellipsis:
     reuse_instances = {{serde_scope.reuse_instances_default}}
 
-  if data is None:
-    return None
-
   maybe_generic_type_vars = maybe_generic_type_vars or {{cls_type_vars}}
 
   {% for f in fields %}


Test patch:
diff --git a/tests/test_basics.py b/tests/test_basics.py
index 971a7e2..30e7196 100644
--- a/tests/test_basics.py
+++ b/tests/test_basics.py
@@ -1233,3 +1233,17 @@ def test_nested_dataclass_ignore_wrapper_options() -> None:
     serialized = serde.to_dict(a)
     assert {"foo": {"myLongName": 1}} == serialized
     assert a == serde.from_dict(Wrapper, serialized)
+
+
+def test_deserialize_from_incompatible_value() -> None:
+    @serde.deserialize
+    @dataclasses.dataclass
+    class Foo:
+        v: int
+
+    with pytest.raises(serde.SerdeError):
+        assert serde.from_dict(Foo, None)
+    with pytest.raises(serde.SerdeError):
+        assert serde.from_dict(Foo, "")
+    with pytest.raises(serde.SerdeError):
+        assert serde.from_dict(Foo, 10)
diff --git a/tests/test_de.py b/tests/test_de.py
index 3868393..54ca516 100644
--- a/tests/test_de.py
+++ b/tests/test_de.py
@@ -5,9 +5,6 @@ from serde.de import from_obj
 
 
 def test_from_obj():
-    # None will be None
-    assert from_obj(int, None, False, False) is None
-
     # Primitive
     assert 10 == from_obj(int, 10, False, False)
Repository: kbsali/php-redmine-api (php)
Issue: Create time entry fails due simplexml entity error
Can not create/update a time entry which contains xml entities in comments field:

```
$client->time_entry->create([
    'issue_id' => $id,
    'spent_on' => $spentOn,
    'hours' => $hours,
    'activity_id' => $activityId,
    'comments' => 'some text with xml entities: & < > '
]);
```

`SimpleXMLElement::addChild(): unterminated entity reference`




Pull request description: Handle xml entities in time_entry comments correct
Fixes #233

Patch:
diff --git a/src/Redmine/Api/TimeEntry.php b/src/Redmine/Api/TimeEntry.php
index 1f70ea2..81966b2 100644
--- a/src/Redmine/Api/TimeEntry.php
+++ b/src/Redmine/Api/TimeEntry.php
@@ -78,7 +78,7 @@ class TimeEntry extends AbstractApi
             if ('custom_fields' === $k && is_array($v)) {
                 $this->attachCustomFieldXML($xml, $v);
             } else {
-                $xml->addChild($k, $v);
+                $xml->addChild($k, htmlspecialchars($v));
             }
         }
 


Test patch:
diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php
index 38b01d0..cc00c26 100644
--- a/tests/Unit/Api/TimeEntryTest.php
+++ b/tests/Unit/Api/TimeEntryTest.php
@@ -232,6 +232,7 @@ class TimeEntryTest extends TestCase
             'issue_id' => '15',
             'project_id' => '25',
             'hours' => '5.25',
+            'comments' => 'some text with xml entities: & < > " \' ',
             'custom_fields' => [
                 [
                     'id' => 1,