[issue41095] inspect.signature() doesn't parse __text_signature__ containing a newline character

2020-06-23 Thread Anthony Sottile


Anthony Sottile  added the comment:

Looking into this, it appears to be due to the default value and not due to the 
newline

I've stumbled upon two simplifications to the routines in inspect but not a fix 
for this

1. https://github.com/python/cpython/pull/21100
2. https://github.com/python/cpython/pull/21104

the following code is hit because `ast.literal_eval(...)` fails for the `|`d 
expression:

https://github.com/python/cpython/blob/2f9ada96e0d420fed0d09a032b37197f08ef167a/Lib/inspect.py#L2069-L2070

this causes the parameter to be skipped entirely

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41095] inspect.signature() doesn't parse __text_signature__ containing a newline character

2020-06-23 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch
nosy: +Anthony Sottile
nosy_count: 3.0 -> 4.0
pull_requests: +20269
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21066

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41095] inspect.signature() doesn't parse __text_signature__ containing a newline character

2020-06-23 Thread STINNER Victor


New submission from STINNER Victor :

$ ./python
Python 3.10.0a0 (heads/unicode_latin1:40855c7064, Jun 24 2020, 00:20:07) 
>>> import select
>>> select.epoll.register.__text_signature__
'($self, /, fd,\n eventmask=select.EPOLLIN | select.EPOLLPRI | 
select.EPOLLOUT)'

>>> import inspect
>>> inspect.signature(select.epoll.register)


=> eventmask parameter is gone!

Either signature() must raise an exception, or it must handle a 
__text_signature__ containing a newline character.

Issue spotted on bpo-31938 when fixing "./python -m pydoc select".

By the way, as expected, pydoc shows:

Help on method_descriptor in select.epoll:
---
$ ./python -m pydoc select.epoll.register

select.epoll.register = register(self, /, fd)
Registers a new fd or raises an OSError if the fd is already registered.
(...)
---

--
components: Library (Lib)
messages: 372213
nosy: serhiy.storchaka, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: inspect.signature() doesn't parse __text_signature__ containing a 
newline character
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com