[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1ddeb2e175df by Eric V. Smith in branch 'default': Issue 25483: Add an opcode to make f-string formatting more robust. https://hg.python.org/cpython/rev/1ddeb2e175df -- nosy: +python-dev ___ Python

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4734713a31ed by Eric V. Smith in branch 'default': Issue 25483: Update dis.rst with FORMAT_VALUE opcode description. https://hg.python.org/cpython/rev/4734713a31ed -- ___ Python tracker

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-03 Thread Eric V. Smith
Eric V. Smith added the comment: Brett: https://docs.python.org/devguide/compiler.html#introducing-new-bytecode looks correct (and reminded me to update dis.rst!). -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 93fd7adbc7dd by Eric V. Smith in branch 'default': Issue 25483: Fix doc typo and added versionadded. Thanks, Berker Peksag. https://hg.python.org/cpython/rev/93fd7adbc7dd -- ___ Python tracker

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-03 Thread Berker Peksag
Berker Peksag added the comment: + * ``(flags & 0x03) == 0x00``: *value* is formattedd as-is. Just noticed a small typo: formattedd Also, needs ``.. versionadded:: 3.6`` -- nosy: +berker.peksag ___ Python tracker

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-02 Thread Eric V. Smith
Eric V. Smith added the comment: Right, they're the same because it's a single bit. You 'and' with a mask to get the bits you want, and you 'or' together the values. It's an old habit left over from my bit-twiddling days. I guess the test could really be: have_fmt_spec = (oparg & FVS_MASK)

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-02 Thread Eric V. Smith
Eric V. Smith added the comment: Some formatting improvements. I removed one of the optimizations I was doing, because it's also done in PyObject_Format(). I plan on moving other optimizations into PyObject_Format(), but I'll open a separate issue for that. I swapped the order of the

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks to me that FVS_MASK and FVS_HAVE_SPEC are duplicates. FVS_HAVE_SPEC is set but FVS_MASK is tested. -- ___ Python tracker

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-11-02 Thread Stefan Krah
Stefan Krah added the comment: The MASK idiom is nice and I think it's good to be exposed to it from time to time. -- nosy: +skrah ___ Python tracker ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I'll try to find some reasonable .h file to use and submit a new patch soon. It's Lib/opcode.py. -- nosy: +serhiy.storchaka ___ Python tracker

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith
Eric V. Smith added the comment: Oops. Forgot to include the diff with that last message. But it turns out it doesn't work, anyway, because I put the #define's in opcode.h, which is generated (so my code got deleted!). I'll try to find some reasonable .h file to use and submit a new patch

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Brett Cannon
Brett Cannon added the comment: I know this issue is slowly turning into "make Eric update outdated docs", but if you find that https://docs.python.org/devguide/compiler.html#introducing-new-bytecode is outdated, could you update that doc? -- ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith
Eric V. Smith added the comment: Brett: I'll take a look. Serhiy: I'm looking for a place to put some #defines related to the bit masks and bit values that my FORMAT_VALUE opcode is using for opargs. One option is to just put them in Tools/scripts/generate_opcode_h.py, so that they end up in

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-28 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks, Serihy. I looked at those, and neither one is a great fit. But not having a better option, I went with ceval.h. Here's the patch. -- Added file: http://bugs.python.org/file40880/format-opcode-2.diff ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-27 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: +brett.cannon ___ Python tracker ___ ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-26 Thread Eric V. Smith
Eric V. Smith added the comment: This patch addresses Larry's review, plus bumps the bytecode magic number. -- ___ Python tracker ___

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-26 Thread Eric V. Smith
New submission from Eric V. Smith: Currently, the f-string f'a{3!r:10}' evaluates to bytecode that does the same thing as: ''.join(['a', format(repr(3), '10')]) That is, it literally calls the functions format() and repr(). The same holds true for str() and ascii() with !s and !a,

[issue25483] Improve f-string implementation: FORMAT_VALUE opcode

2015-10-26 Thread Eric V. Smith
Eric V. Smith added the comment: Small cleanups. Fixed a bug in PyCompile_OpcodeStackEffect. -- Added file: http://bugs.python.org/file40864/format-opcode-1.diff ___ Python tracker