jaraco / jaraco/pyevent

Can't supply a bound method to wsgi.register_app

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
C
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Run the attached code
2. In another xterm, run curl -s http://localhost:33003/foo

What is the expected output? What do you see instead?

Would expect the curl to print out "Yada Yada".

Instead you get an error on the server side:

Exception exceptions.TypeError: 'unbound method http_foo_cb() must be
called with Server instance as first argument (got dict instance instead)'
in 'event.__path_handler' ignored
Segmentation fault

***If on the other hand you create an unbound proxy method (just uncomment
the def at the top, and swap the commented and uncommented register_app lines)

Then the system works.

What version of the product are you using? On what operating system?
r54 from SVN
Linux, Debian Etch, stock Python2.5 from the ETCH repository
Pyrex 0.9.8.4

Please provide any additional information below.

Don't know whether this behavior is intentional. In the event.c file, the
following line:

__pyx_5 = PyObject_CallObject(__pyx_v_app, __pyx_4); if (!__pyx_5)
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 187; goto __pyx_L1;}

is the culprit. It says in the Python docs that PyObject_CallObject should
work just like 'apply', but the same problem does not occur when you just
test the 'apply' built-in.

```

Original issue reported on code.google.com by `bellerm...@gmail.com` on 22 Aug 2008 at 6:41

Attachments:
- [httptest](https://storage.googleapis.com/google-code-attachments/pyevent/issue-13/comment-0/httptest)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the attached httptest reproduction with the bound method passed to register_app, then inspect event.c around the PyObject_CallObject call at line 187 and the callback path. Done means the bound method serves “Yada Yada” for the curl request without a TypeError or segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.