pathwaycom / pathwaycom/pathway
[Bug]: TypeError: Cannot instantiate typing.Any
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 62.3k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce
in pw.io.http.rest_connector if no schema was provided default is:
https://github.com/pathwaycom/pathway/blob/6bcee7efd35dc3d6586160df1a0641b0d55fa8ff/python/pathway/io/http/_server.py#L832
but deserialising is imposible to typing.Any here:
https://github.com/pathwaycom/pathway/blob/6bcee7efd35dc3d6586160df1a0641b0d55fa8ff/python/pathway/io/http/_server.py#L479
Relevant log output
ERROR:root:Failed to cast column 'query' to type 'typing.Any'
Traceback (most recent call last):
File "/Users/nikitos/.pyenv/versions/pathway3/lib/python3.10/site-packages/pathway/io/http/_server.py", line 480, in _cast_types_to_schema
payload[column] = exact_type(payload[column])
File "/Users/nikitos/.pyenv/versions/3.10.19/lib/python3.10/typing.py", line 387, in __call__
raise TypeError(f"Cannot instantiate {self!r}")
TypeError: Cannot instantiate typing.Any
What did you expect to happen?
i temporary use this hack, but not sure is it right: payload[column] = payload[column] if exact_type == typing.Any else exact_type(payload[column])
Version
0.30.1
Docker Versions (if used)
No response
OS
MacOS
On which CPU architecture did you run Pathway?
ARM64 (AArch64, Apple silicon)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in python/pathway/io/http/_server.py at the default schema handling near line 832 and the deserialization logic near line 479. Reproduce the HTTP REST connector case without a schema, then verify that query data no longer triggers TypeError: Cannot instantiate typing.Any and is handled successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100