[issue23967] Make inspect.signature expression evaluation more powerful

2020-05-29 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue23967] Make inspect.signature expression evaluation more powerful

2020-03-30 Thread Eric Wieser
Eric Wieser added the comment: > To make this work I had to write an ast printer that produces evaluatable > Python code. Note that it's not complete, I know it's not complete, it's > missing loads of operators. Assume that if this is a good idea I will add > all the missing operators. No

[issue23967] Make inspect.signature expression evaluation more powerful

2020-03-30 Thread Eric Wieser
Change by Eric Wieser : -- nosy: +Eric Wieser ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-25 Thread Nick Coghlan
Nick Coghlan added the comment: Right, Larry and I had a fairly long discussion about this idea at the sprints, and I was satisfied that all the cases where he's proposing to use this are safe: in order to exploit them you need to be able to set __text_signature__ on arbitrary objects, and if

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-23 Thread Larry Hastings
Larry Hastings added the comment: It's only used for signatures in builtins. Any possible security hole here is uninteresting because the evil hacker already got to run arbitrary C code in the module init. Because it's only used for signatures in builtins, we shouldn't encounter a function w

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using complex expressions is deceitful. In Python functions the default value is evaluated only once, at function creation time, but inspect.signature will evaluate it every time. For example foo(x={}) and foo(x=dict()) means the same in function declaration

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-23 Thread Larry Hastings
Larry Hastings added the comment: Cleaned up the patch some more--the code was stupid in a couple places. I think it's ready to go in. -- Added file: http://bugs.python.org/file39181/larry.improved.signature.expressions.3.txt ___ Python tracker

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-19 Thread Larry Hastings
Larry Hastings added the comment: Whoops. Here's the revised patch. -- Added file: http://bugs.python.org/file39123/larry.improved.signature.expressions.2.txt ___ Python tracker __

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-19 Thread Larry Hastings
Larry Hastings added the comment: Thanks to #24002 I now know how to write evalify_node properly. This patch is now much better. Note that I deliberately made the new function _eval_ast_expr() as a "private" module-level routine. I need that same functionality in Argument Clinic too, so if

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-18 Thread Larry Hastings
Larry Hastings added the comment: I should mention that evalify_node() is pretty hacked up here, and is not ready to be checked in. (I'm proposing separately that we simply add something like this directly into the standard library, see issue #24002.) -- _

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-16 Thread Peter McCormick
Peter McCormick added the comment: I missed the fact that Larry's patch obviates the need for the `builtins.` prefix, shortening the Argument Clinic parameter specification into: backlog: int(py_default="min(SOMAXCONN, 128)", c_default="Py_MIN(SOMAXCONN, 128)") -- ___

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-15 Thread Peter McCormick
Peter McCormick added the comment: This definitely works for the _socket.listen use case! In terms of generating such a signature using Argument Clinic, currently this is required: backlog: int(py_default="builtins.min(SOMAXCONN, 128)", c_default="Py_MIN(SOMAXCONN, 128)") = 000 The atta

[issue23967] Make inspect.signature expression evaluation more powerful

2015-04-15 Thread Larry Hastings
New submission from Larry Hastings: Peter's working on converting socket to use Argument Clinic. He had a default that really should look like this: min(SOME_SOCKET_MODULE_CONSTANT, 128) "min" wasn't something we'd needed before. I thought about it and realized we could do a much better