Northy1717/SWE-bench-Live huggingface dataset:
Repository: rthalley/dnspython

Issue:
`make_response` fails on messages created with `from_wire` with `keyring=False`
**Describe the bug**

When one creates an `Message` object with the `from_wire` function with the `keyring` parameter set to `False`, call to `make_response` on said message raises unhelpful `TypeError`.

This is because `from_wire` accepts `bool` as a value of `keyring` (with `False` denoting that TSIG checking is disabled). However `make_response` calls `use_tsig` internally which doesn't. This couldn't be caught by the type checker because `keyring` parameter is annotated as `Any`. 

**To Reproduce**
```
import dns.message

# Message with TSIG
wire = bytes.fromhex("c57401100001000000000002086261642d74736967000001000100002904d000008000000c000a0008b1d5143946b93bc9067368613235360000fa00ff00000000003d0b686d61632d736861323536000000685969ff012c0020a7de31f27990b00b2373fe9f481867bc11b7b25d0cb5b9b9769e01d6e82e0e49c57400000000"
)
query = dns.message.from_wire(wire, keyring=False)
dns.message.make_response(query)
```

raises:

```
TypeError: 'NoneType' object is not subscriptable
```

**Context:**
 - dnspython version 2.7.0
 - Python version 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128]
 - OS: Arch Linux



Discussion:

Patch:
diff --git a/dns/message.py b/dns/message.py
index 1288b205..bd58ae91 100644
--- a/dns/message.py
+++ b/dns/message.py
@@ -1925,7 +1925,7 @@ def make_response(
                 if option.otype == dns.edns.OptionType.PADDING:
                     pad = 468
         response.use_edns(0, 0, our_payload, query.payload, pad=pad)
-    if query.had_tsig:
+    if query.had_tsig and query.keyring:
         assert query.mac is not None
         assert query.keyalgorithm is not None
         response.use_tsig(


Test patch:
diff --git a/tests/test_tsig.py b/tests/test_tsig.py
index 5d7ceba5..4715e393 100644
--- a/tests/test_tsig.py
+++ b/tests/test_tsig.py
@@ -366,3 +366,15 @@ def test_multi(self):
 
     def test_multi_with_pad(self):
         self._test_multi(468)
+
+    def test_make_response_to_unverified(self):
+        # Ensure that we can make a response to an unverified query that
+        # contained a TSIG.
+        q1 = dns.message.make_query("example", "a")
+        q1.use_tsig(keyring, keyname)
+        wire = q1.to_wire()
+
+        q2 = dns.message.from_wire(wire, keyring=False)
+        m = dns.message.make_response(q2)
+
+        self.assertIsNone(m.tsig)
Repository: Kinto/kinto

Issue:
Kinto stopped supporting userids with colons in them
This seems to be because of https://github.com/Kinto/kinto/blob/7881aa28abd015ee2d8fc72c606c43b83df9bae2/kinto/core/initialization.py#L479

This is a breaking change that prevents using userids that have colons in them. Previously kinto used to escape colons by replacing them with `.`

Would you be open to a PR doing the same again?


Discussion:

Patch:
diff --git a/kinto/core/initialization.py b/kinto/core/initialization.py
index aaa2cc226..41eaebfae 100644
--- a/kinto/core/initialization.py
+++ b/kinto/core/initialization.py
@@ -475,8 +475,9 @@ def on_new_response(event):
         # Count unique users.
         user_id = request.prefixed_userid
         if user_id:
-            # Get rid of colons in metric packet (see #1282).
-            auth, user_id = user_id.split(":")
+            auth, user_id = user_id.split(":", 1)
+            # Get rid of colons in metric packet (see #1282 and  #3571).
+            user_id = user_id.replace(":", ".")
             metrics_service.count("users", unique=[("auth", auth), ("userid", user_id)])
 
         status = event.response.status_code


Test patch:
diff --git a/tests/core/test_initialization.py b/tests/core/test_initialization.py
index a57df1504..bebd588ee 100644
--- a/tests/core/test_initialization.py
+++ b/tests/core/test_initialization.py
@@ -382,6 +382,16 @@ def test_statsd_counts_unique_users(self, digest_mocked):
             "users", unique=[("auth", "basicauth"), ("userid", "mat")]
         )
 
+    @mock.patch("kinto.core.utils.hmac_digest")
+    def test_statsd_counts_unique_users_with_colons(self, digest_mocked):
+        digest_mocked.return_value = "user:with:colons"
+        kinto.core.initialize(self.config, "0.0.1", "settings_prefix")
+        app = webtest.TestApp(self.config.make_wsgi_app())
+        app.get("/v0/", headers=get_user_headers("user:with:colons"))
+        self.mocked().count.assert_any_call(
+            "users", unique=[("auth", "basicauth"), ("userid", "user.with.colons")]
+        )
+
     def test_statsd_counts_authentication_types(self):
         kinto.core.initialize(self.config, "0.0.1", "settings_prefix")
         app = webtest.TestApp(self.config.make_wsgi_app())
Repository: ag2ai/faststream

Issue:
Bug: broker.include_router(..., prerfix="") doesn't affect to publishers
```python
from faststream.kafka import KafkaBroker, KafkaRouter

router = KafkaRouter()

publisher = router.publisher("pong")
subscriber = router.subscriber("ping")

@subscriber
@publisher
async def on_ping(): ...

broker = KafkaBroker()
broker.include_router(router, prefix="prefix.")

assert subscriber.topics == ("prefix.ping",)
assert publisher.topic == "prefix.pong"  # assertion error, topic is "pong"
```

Correct subsriber code example: https://github.com/ag2ai/faststream/blob/8018bba64d576f854bfeb6c6d7e474df19eef48d/faststream/broker/core/abc.py#L96

Incorrect publisher code:
https://github.com/ag2ai/faststream/blob/8018bba64d576f854bfeb6c6d7e474df19eef48d/faststream/broker/core/abc.py#L119

Also, we should add a new test like the following one, but for publisher: https://github.com/ag2ai/faststream/blob/main/tests/brokers/base/router.py#L94



Discussion:
Hello, I can work with it
@kodsurfer thank you! Go ahead!



Patch:
diff --git a/faststream/broker/core/abc.py b/faststream/broker/core/abc.py
index c514814b96..c8985554fc 100644
--- a/faststream/broker/core/abc.py
+++ b/faststream/broker/core/abc.py
@@ -116,7 +116,7 @@ def include_router(
                 self._subscribers = {**self._subscribers, key: h}
 
         for p in router._publishers.values():
-            p.add_prefix(self.prefix)
+            p.add_prefix("".join((self.prefix, prefix)))
 
             if (key := hash(p)) not in self._publishers:
                 if include_in_schema is None:


Test patch:
diff --git a/tests/brokers/base/router.py b/tests/brokers/base/router.py
index 02d60cd578..d814750209 100644
--- a/tests/brokers/base/router.py
+++ b/tests/brokers/base/router.py
@@ -1,5 +1,5 @@
 import asyncio
-from typing import Type
+from typing import Any, Type
 from unittest.mock import Mock
 
 import pytest
@@ -191,6 +191,35 @@ def response(m):
 
             assert event.is_set()
 
+    async def test_include_publisher_with_prefix(
+        self,
+        router: BrokerRouter,
+        pub_broker: BrokerUsecase,
+        queue: str,
+        event: asyncio.Event,
+    ) -> None:
+        args2, kwargs2 = self.get_subscriber_params(f"test_{queue}")
+
+        @pub_broker.subscriber(*args2, **kwargs2)
+        async def handler(m: Any) -> None:
+            event.set()
+
+        publisher = router.publisher(queue)
+        pub_broker.include_router(router, prefix="test_")
+
+        async with pub_broker:
+            await pub_broker.start()
+
+            await asyncio.wait(
+                (
+                    asyncio.create_task(publisher.publish("hello")),
+                    asyncio.create_task(event.wait()),
+                ),
+                timeout=self.timeout,
+            )
+
+            assert event.is_set()
+
     async def test_manual_publisher(
         self,
         router: BrokerRouter,
Repository: a2aproject/a2a-python

Issue:
[Feat]: Properly access send message param metadata in agent executor
### Is your feature request related to a problem? Please describe.

In order to implement protocol extension via request metadata, I want to access MessageSendParams.metadata in my agent executor. Today the workaround needs to access RequestContext._params wich is a protected member and should not be accessed directly.

<img width="1089" height="94" alt="Image" src="https://github.com/user-attachments/assets/9291fe32-c33e-4aa4-a326-e59fed389432" />

### Describe the solution you'd like

Add a properto for metadata.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct


Discussion:

Patch:
diff --git a/src/a2a/server/agent_execution/context.py b/src/a2a/server/agent_execution/context.py
index 01055840..782d488b 100644
--- a/src/a2a/server/agent_execution/context.py
+++ b/src/a2a/server/agent_execution/context.py
@@ -1,5 +1,7 @@
 import uuid
 
+from typing import Any
+
 from a2a.server.context import ServerCallContext
 from a2a.types import (
     InvalidParamsError,
@@ -134,6 +136,13 @@ def call_context(self) -> ServerCallContext | None:
         """The server call context associated with this request."""
         return self._call_context
 
+    @property
+    def metadata(self) -> dict[str, Any]:
+        """Metadata associated with the request, if available."""
+        if not self._params:
+            return {}
+        return self._params.metadata or {}
+
     def _check_or_generate_task_id(self) -> None:
         """Ensures a task ID is present, generating one if necessary."""
         if not self._params:


Test patch:
diff --git a/tests/server/agent_execution/test_context.py b/tests/server/agent_execution/test_context.py
index ea90631c..aa72b5a6 100644
--- a/tests/server/agent_execution/test_context.py
+++ b/tests/server/agent_execution/test_context.py
@@ -211,6 +211,17 @@ def test_message_property_with_params(self, mock_params):
         context = RequestContext(request=mock_params)
         assert context.message == mock_params.message
 
+    def test_metadata_property_without_content(self):
+        """Test metadata property returns empty dict when no content are provided."""
+        context = RequestContext()
+        assert context.metadata == {}
+
+    def test_metadata_property_with_content(self, mock_params):
+        """Test metadata property returns the metadata from params."""
+        mock_params.metadata = {'key': 'value'}
+        context = RequestContext(request=mock_params)
+        assert context.metadata == {'key': 'value'}
+
     def test_init_with_existing_ids_in_message(self, mock_message, mock_params):
         """Test initialization with existing IDs in the message."""
         mock_message.taskId = 'existing-task-id'
Repository: python-pillow/Pillow

Issue:
Inconsistent `Image.open(str)`
`Image.open("")` must raise an exception matching `open("")`
```
In [1]: from PIL import Image

In [2]: Image.open("non_existent_file")
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[2], line 1
----> 1 Image.open("non_existent_file")

File ~/.local/lib/python3.13/site-packages/PIL/Image.py:3505, in open(fp, mode, formats)
   3502     filename = os.fspath(fp)
   3504 if filename:
-> 3505     fp = builtins.open(filename, "rb")
   3506     exclusive_fp = True
   3507 else:

FileNotFoundError: [Errno 2] No such file or directory: 'non_existent_file'

In [3]: Image.open("")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~/.local/lib/python3.13/site-packages/PIL/Image.py:3511, in open(fp, mode, formats)
   3510 try:
-> 3511     fp.seek(0)
   3512 except (AttributeError, io.UnsupportedOperation):

AttributeError: 'str' object has no attribute 'seek'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 Image.open("")

File ~/.local/lib/python3.13/site-packages/PIL/Image.py:3513, in open(fp, mode, formats)
   3511     fp.seek(0)
   3512 except (AttributeError, io.UnsupportedOperation):
-> 3513     fp = io.BytesIO(fp.read())
   3514     exclusive_fp = True
   3516 prefix = fp.read(16)

AttributeError: 'str' object has no attribute 'read'
```


Discussion:
I've created #9048 to resolve this.



Patch:
diff --git a/src/PIL/Image.py b/src/PIL/Image.py
index 9fc1c70671b..d209405c4c5 100644
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -3510,8 +3510,6 @@ def open(
     filename: str | bytes = ""
     if is_path(fp):
         filename = os.fspath(fp)
-
-    if filename:
         fp = builtins.open(filename, "rb")
         exclusive_fp = True
     else:


Test patch:
diff --git a/Tests/test_image.py b/Tests/test_image.py
index 069083b1963..6b8b6d42b07 100644
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -160,6 +160,10 @@ def test_set_mode(self) -> None:
         with pytest.raises(AttributeError):
             im.mode = "P"  # type: ignore[misc]
 
+    def test_empty_path(self) -> None:
+        with pytest.raises(FileNotFoundError):
+            Image.open("")
+
     def test_invalid_image(self) -> None:
         im = io.BytesIO(b"")
         with pytest.raises(UnidentifiedImageError):
Repository: pypa/cibuildwheel

Issue:
CIBW_ARCHS should be allowed to be empty
### Description

In cibuildwheel, we treat empty environments variables and unset environment variables identically in most cases. We don't seem to do this for CIBW_ARCHS, though, as setting `CIBW_ARCHS: ${{ matrix.archs }}` doesn't work if archs is not set. I think it should wok like the others.

### Build log

https://github.com/pybind/scikit_build_example/actions/runs/16600944084/job/46960140697

### CI config

https://github.com/pybind/scikit_build_example/blob/f9b0f810f3fd229383bb3b5025547ecb80818e53/.github/workflows/cibw-cc.yaml


Discussion:

Patch:
diff --git a/cibuildwheel/options.py b/cibuildwheel/options.py
index eb28d95d0..e3417adfd 100644
--- a/cibuildwheel/options.py
+++ b/cibuildwheel/options.py
@@ -657,7 +657,9 @@ def globals(self) -> GlobalOptions:
         )
         requires_python = None if requires_python_str is None else SpecifierSet(requires_python_str)
 
-        archs_config_str = args.archs or self.reader.get("archs", option_format=ListFormat(sep=" "))
+        archs_config_str = args.archs or self.reader.get(
+            "archs", option_format=ListFormat(sep=" "), ignore_empty=True
+        )
         architectures = Architecture.parse_config(archs_config_str, platform=self.platform)
 
         # Process `--only`


Test patch:
diff --git a/unit_test/main_tests/main_platform_test.py b/unit_test/main_tests/main_platform_test.py
index 620f86e4e..75d609f6b 100644
--- a/unit_test/main_tests/main_platform_test.py
+++ b/unit_test/main_tests/main_platform_test.py
@@ -278,3 +278,12 @@ def test_pyodide_on_windows(monkeypatch, capsys):
 
     assert exit.value.code == 2
     assert "Building for pyodide is not supported on Windows" in err
+
+
+def test_empty_archs_platform(platform, intercepted_build_args, monkeypatch):
+    monkeypatch.setenv("CIBW_ARCHS", "")
+
+    main()
+
+    options = intercepted_build_args.args[0]
+    assert options.globals.architectures == Architecture.auto_archs(platform)