msg168015 - (view) |
Author: Brett Cannon (brett.cannon) *  |
Date: 2012-08-12 00:44 |
A classmethod called importlib.abc.SourceLoader.source_to_code(source_bytes, path) would return a code object. By default it would be equivalent to ``compile(source_bytes, source_path, 'exec', dont_inherit=True)``, but others could override this to e.g. convert the source to an AST, optimize the AST, and then call compile() to get the desired code object. |
|
|
msg175635 - (view) |
Author: Brett Cannon (brett.cannon) *  |
Date: 2012-11-15 19:57 |
Might name this compile_source() instead. |
|
|
msg175658 - (view) |
Author: Eric Snow (eric.snow) *  |
Date: 2012-11-15 23:53 |
Though I haven't been able to get to this, I do have a demo of sorts that I've been using elsewhere: https://bitbucket.org/ericsnowcurrently/pylt/src/default/pylt/_importing.py?at=default#cl-225 |
|
|
msg175760 - (view) |
Author: Brett Cannon (brett.cannon) *  |
Date: 2012-11-17 15:54 |
We might want an keyword-only 'optimize' argument that maps to the compile() function's 'optimize' argument. |
|
|
msg175876 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-11-18 15:03 |
New changeset e30bcce5c634 by Brett Cannon in branch 'default': Issue #15627: Add the compile_source() method to http://hg.python.org/cpython/rev/e30bcce5c634 |
|
|
msg176521 - (view) |
Author: Eric Snow (eric.snow) *  |
Date: 2012-11-28 07:48 |
Sorry, just now digging out of a massive backlog here. The originally proposed name of "source_to_code()" might be more appropriate than compile_source(). The relationship to compilation is not compulsory and the name/docstring/docs might imply that. If you're not opposed, Brett, I can make the change. Regardless, glad to see this in. :) |
|
|
msg176554 - (view) |
Author: Brett Cannon (brett.cannon) *  |
Date: 2012-11-28 17:06 |
It might not be compulsory, but how else are you going to get a code object? Then again, get_code() kind of codifies the use of the word "code" for methods that return a code object. So if you want to do the work to change the name then go ahead. |
|
|
msg176970 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-05 07:53 |
New changeset 7caab48f171e by Eric Snow in branch 'default': Issue #15627: This is simply an update to the name of a new method recently added http://hg.python.org/cpython/rev/7caab48f171e |
|
|
msg185589 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2013-03-30 20:01 |
The first commit does something fishy with tests: http://hg.python.org/cpython/rev/e30bcce5c634#l3.1 |
|
|
msg185596 - (view) |
Author: Brett Cannon (brett.cannon) *  |
Date: 2013-03-30 22:37 |
It cleans up the run_unittest() call. You can check the file and see that the "missing" classes are actually not in the module anymore. |
|
|
msg185641 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2013-03-31 18:45 |
Ah, okay. I can’t wait for the time when unittest.main() is used everywhere and we delete run_unittest :) |
|
|