[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-12-23 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-12-23 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset eee1c7745ab4eb4f75153e71aaa2a62018b7625a by Batuhan Taskaya in 
branch 'master':
bpo-41960: Add globalns and localns parameters to inspect.signature and 
Signature.from_callable (GH-22583)
https://github.com/python/cpython/commit/eee1c7745ab4eb4f75153e71aaa2a62018b7625a


--

___
Python tracker 

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



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-12-23 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> It's been a while, I've lost context for this idea. What problem are you 
> trying to solve here? Are there issues where people have reported problems 
> that this would allow them to solve?

Context: https://github.com/python/cpython/pull/20434#discussion_r499289645

tl;dr: 
import inspect

def foo():
class F: ...
def foo(bar: F): ...
print(inspect.signature(foo))

foo()

Normally, if inspect.signature is able to resolve annotations with the current 
globals()/locals() it will give the resolved version, if not the string 
version. So adding this would allow people to choose which namespace 
inspect.signature will pass to the typing.get_type_hints. 
(inspect.signature(foo, localns=locals()) would give directly the F object 
instead of 'F', etc.)

--

___
Python tracker 

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



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-12-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

It's been a while, I've lost context for this idea. What problem are you trying 
to solve here? Are there issues where people have reported problems that this 
would allow them to solve?

--

___
Python tracker 

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



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-10-06 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21576
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22583

___
Python tracker 

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



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-10-06 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

To resolve annotations in local namespaces (and possibly in different 
contexts), inspect.signature can take globalns and localns parameters.

I'm not inclined to add these into the getfullargspec, but I'd appreciate any 
comments about whether it is a good idea or not!

--
components: Library (Lib)
messages: 378137
nosy: BTaskaya, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Add globalns and localns to the inspect.signature and 
inspect.Signature.from_callable
type: enhancement
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