pathwaycom / pathwaycom/pathway

[Bug]: TypeError: Cannot instantiate typing.Any

Open Beginner friendly
#227 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.