Skip to content

Fix AttributeError on delete with non-dict response (#564)#634

Merged
jhamon merged 1 commit intomainfrom
jhamon/fix-delete-setattr-issue-564
Apr 7, 2026
Merged

Fix AttributeError on delete with non-dict response (#564)#634
jhamon merged 1 commit intomainfrom
jhamon/fix-delete-setattr-issue-564

Conversation

@jhamon
Copy link
Copy Markdown
Collaborator

@jhamon jhamon commented Apr 7, 2026

Summary

Reopens #564 — we previously believed this was fixed, but the earlier fix only handled the case where the server returns an empty response body. We missed the case where the server returns a non-empty string (as pinecone-local does), which still triggered the same AttributeError: 'str' object has no attribute '_response_info'. We didn't have integration tests covering delete at the time, so the gap went unnoticed. Sorry about that.

The root cause is the same: setattr() is called on the deserialized response data, which fails for primitive types like str that don't support dynamic attribute assignment. The fix guards with hasattr(return_data, "__dict__") so we only attach _response_info to objects that support it.

Changes

  • pinecone/openapi_support/api_client.py — guard setattr on response data
  • pinecone/openapi_support/asyncio_api_client.py — same fix for async client
  • tests/unit/db_data/test_asyncio_delete_bug.py — unit tests for string response bodies
  • tests/integration/rest_asyncio/db/data/test_delete.py — async integration tests for delete by ids and delete_all
  • tests/integration/rest_sync/db/data/test_delete.py — sync integration tests for delete by ids and delete_all
  • scripts/test_pinecone_local_delete.py — one-off repro script for verifying against pinecone-local

Test plan

  • Unit tests pass (14 tests in test_asyncio_delete_bug.py)
  • Async integration tests pass against Pinecone cloud
  • Sync integration tests pass against Pinecone cloud
  • Manual verification against pinecone-local using scripts/test_pinecone_local_delete.py

When the API returns a primitive type (e.g. str) from delete, setattr
fails because primitives don't support dynamic attribute assignment.
Guard with hasattr(__dict__) so we only attach _response_info to objects
that support it. Adds unit, integration, and pinecone-local repro tests.
@jhamon jhamon merged commit 30060d0 into main Apr 7, 2026
43 checks passed
@jhamon jhamon deleted the jhamon/fix-delete-setattr-issue-564 branch April 7, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant