{"action":"created","issue":{"url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/35","repository_url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc","labels_url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/35/comments","events_url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/35/events","html_url":"https://github.com/pengutronix/aiohttp-json-rpc/issues/35","id":349041481,"node_id":"MDU6SXNzdWUzNDkwNDE0ODE=","number":35,"title":"builtin funtions and C functions can not be used as RPC methods","user":{"login":"semigodking","id":2075535,"node_id":"MDQ6VXNlcjIwNzU1MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/2075535?v=4","gravatar_id":"","url":"https://api.github.com/users/semigodking","html_url":"https://github.com/semigodking","followers_url":"https://api.github.com/users/semigodking/followers","following_url":"https://api.github.com/users/semigodking/following{/other_user}","gists_url":"https://api.github.com/users/semigodking/gists{/gist_id}","starred_url":"https://api.github.com/users/semigodking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/semigodking/subscriptions","organizations_url":"https://api.github.com/users/semigodking/orgs","repos_url":"https://api.github.com/users/semigodking/repos","events_url":"https://api.github.com/users/semigodking/events{/privacy}","received_events_url":"https://api.github.com/users/semigodking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-09T09:08:43Z","updated_at":"2018-08-10T16:38:11Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"In latest version, C functions can not be used as RPC methods anymore. Builtin functions are C functions. \r\nFor no reason we use builtins as RPC methods. But, we do want to use C extensions. Wrapping C extensions within python functions is not good idea if there are many extensions.\r\n```\r\nPython 3.6.3 (default, Oct  3 2017, 21:45:48)\r\n[GCC 7.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import inspect\r\n>>> inspect.getfullargspec(min)\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.6/inspect.py\", line 1116, in getfullargspec\r\n    sigcls=Signature)\r\n  File \"/usr/lib/python3.6/inspect.py\", line 2262, in _signature_from_callable\r\n    skip_bound_arg=skip_bound_arg)\r\n  File \"/usr/lib/python3.6/inspect.py\", line 2087, in _signature_from_builtin\r\n    raise ValueError(\"no signature found for builtin {!r}\".format(func))\r\nValueError: no signature found for builtin <built-in function min>\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/lib/python3.6/inspect.py\", line 1122, in getfullargspec\r\n    raise TypeError('unsupported callable') from ex\r\nTypeError: unsupported callable\r\n```\r\n\r\nI also tried a Cython compiled module with source as:\r\n``` python\r\ndef func1(a, b):\r\n    return a + b\r\n```\r\nIt is the same.\r\n```\r\nPython 3.6.3 (default, Oct  3 2017, 21:45:48)\r\n[GCC 7.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import inspect\r\n>>> import t\r\n>>> inspect.getfullargspec(t.func1)\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.6/inspect.py\", line 1116, in getfullargspec\r\n    sigcls=Signature)\r\n  File \"/usr/lib/python3.6/inspect.py\", line 2262, in _signature_from_callable\r\n    skip_bound_arg=skip_bound_arg)\r\n  File \"/usr/lib/python3.6/inspect.py\", line 2087, in _signature_from_builtin\r\n    raise ValueError(\"no signature found for builtin {!r}\".format(func))\r\nValueError: no signature found for builtin <built-in function func1>\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/lib/python3.6/inspect.py\", line 1122, in getfullargspec\r\n    raise TypeError('unsupported callable') from ex\r\nTypeError: unsupported callable\r\n>>> t.func1(1, 2)\r\n3\r\n>>>\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/comments/412137887","html_url":"https://github.com/pengutronix/aiohttp-json-rpc/issues/35#issuecomment-412137887","issue_url":"https://api.github.com/repos/pengutronix/aiohttp-json-rpc/issues/35","id":412137887,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjEzNzg4Nw==","user":{"login":"semigodking","id":2075535,"node_id":"MDQ6VXNlcjIwNzU1MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/2075535?v=4","gravatar_id":"","url":"https://api.github.com/users/semigodking","html_url":"https://github.com/semigodking","followers_url":"https://api.github.com/users/semigodking/followers","following_url":"https://api.github.com/users/semigodking/following{/other_user}","gists_url":"https://api.github.com/users/semigodking/gists{/gist_id}","starred_url":"https://api.github.com/users/semigodking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/semigodking/subscriptions","organizations_url":"https://api.github.com/users/semigodking/orgs","repos_url":"https://api.github.com/users/semigodking/repos","events_url":"https://api.github.com/users/semigodking/events{/privacy}","received_events_url":"https://api.github.com/users/semigodking/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T16:38:11Z","updated_at":"2018-08-10T16:38:11Z","author_association":"CONTRIBUTOR","body":"I am afraid there's no way to inspect C functions unless debug infomation\nis compiled into .so files. Maybe you can try inspection and fall back to\nold implementation when inspection failed.\n\nOn Fri, Aug 10, 2018, 17:47 Florian Scherf <notifications@github.com> wrote:\n\n> Huh interesting! First of all: Thanks for reporting. I've never used\n> cython in one of my rpc projects. The inspect code came in in pr #33\n> <https://github.com/pengutronix/aiohttp-json-rpc/pull/33>.\n> Do you have ideas how inspecting could work with cython? Otherwise i have\n> to make the all introspection optional.\n>\n> btw: in pr #31 <https://github.com/pengutronix/aiohttp-json-rpc/pull/31>\n> you requested the support of synchronous rpc methods which i rejected.\n> Running synchronous code on the rpc is now possible. I will update the docs\n> when i have time\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/pengutronix/aiohttp-json-rpc/issues/35#issuecomment-412034506>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AB-rj2TdL15rF8914qB3IqmgtQPtiMa1ks5uPVacgaJpZM4V1Uik>\n> .\n>\n"}}
{"actor":{"display_login":"semigodking"}}