[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Guido van Rossum
Guido van Rossum added the comment: W00t! -- ___ Python tracker ___ ___ Python-bugs-list

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 332cd5ee4ff42c9904c56e68a1028f383f7fc9a8 by Raymond Hettinger (Mark Shannon) in branch 'master': bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181)

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Mark Shannon
Mark Shannon added the comment: Rebased, pushed and CI is green. -- ___ Python tracker ___

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Guido van Rossum
Guido van Rossum added the comment: Awesome! -- ___ Python tracker ___ ___

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Ned Deily
Ned Deily added the comment: Mark, at the moment, you have at least another 14 hours until the announced code freeze deadline :) -- nosy: +ned.deily ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Mark Shannon
Mark Shannon added the comment: If it can wait another hour, I will be at home and can do the rebase then. -- ___ Python tracker ___

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Guido van Rossum
Guido van Rossum added the comment: I expect that Mark only checks his mail occasionally. Sometimes GitHub lets you edit a PR and then you can also resolve the conflict yourself. If that's not the case feel free to fork the PR and submit it yourself. --

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: If Mark can get it in tonight, that would be great. The patch has been ready for a long time. It just needs to have the merge conflicts resolved. Otherwise, I think 3.7beta2 would be fine. --

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Guido van Rossum
Guido van Rossum added the comment: Is this going to make it into beta 1 before tonight? If not should we abandon it or put it off till 3.8 or can it go into 3.7beta2? -- ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: There are a couple of merge conflicts in the patch. Once deconflicted, I think this PR is ready to apply. -- assignee: -> Mark.Shannon ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-20 Thread Guido van Rossum
Guido van Rossum added the comment: There is very little code that depends on __annotations__ at all, and none of it is very subtle. All actual type checking is done by separate tools (mypy, pytype, PyCharm) that don't import the code and don't care about __annotations__. The

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > This PR moves the constant for the name from `co_names` to `co_consts`. There > is no duplication. But if there is an initializer, the name is left in `co_names` too. I don't think this (as well as possible performance

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-19 Thread Guido van Rossum
Guido van Rossum added the comment: I won't object. It makes sense that the implementation of __annotations__ should be low-key. -- ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would like to see this patch go forward. Making __annotations__ special and subtly different just adds to language complexity. -- nosy: +rhettinger ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Mark Shannon added the comment: Works as expected: >>> class C: ... exec('x: int') ... >>> C.__annotations__ {'x': } >>> __annotations__ {} -- ___ Python tracker

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: There is also another corner case to consider: class C: exec('x: int') assert C.__annotations__ == {'x': int} assert __annotations__ == {} I am not sure this one will be covered correctly. But the main argument here is speed I

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Mark Shannon added the comment: > 3. It doesn't add a name constant. Instead it uses a name from the names list > (which already has to contain this name). This PR moves the constant for the name from `co_names` to `co_consts`. There is no duplication. >>> def f(): ...

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Mark Shannon added the comment: PEP 526 explicitly states "as with all dunder attributes, any undocummented use of __annotations__ is subject to breakage without warning" I consider deleting __annotations__ to be undocumented use. Do you really think that an obscure

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: There are several corner cases. For example consider this code: >>> class C: ... del __annotations__ ... x: int Currently this correctly raises NameError, with your replacement it will instead stick {'x': int} in the module

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There some subtle differences. 1. Unlike to LOAD_NAME, STORE_ANNOTATION doesn't fall back to globals if '__annotations__' is not found in locals. The behavior difference is shown by the following example: x: int class

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +5034 stage: needs patch -> patch review ___ Python tracker ___

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gvanrossum, levkivskyi, yselivanov ___ Python tracker ___

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
New submission from Mark Shannon : The STORE_ANNOTATION bytecode is used to implement annotations. The code name : ann is equivalent to __annotations__['name'] = ann Consequently, STORE_ANNOTATION name can be trivially replaced with LOAD_NAME