[issue25324] Importing tokenize modifies token

2017-06-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: -> resolved status: open -> closed versions: +Python 3.7 -Python 2.7, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-06-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 5cefb6cfdd089d237ba6724bb5311ee4f04be59f by Serhiy Storchaka in branch 'master': bpo-25324: Move the description of tokenize tokens to token.rst. (#1911) https://github.com/python/cpython/commit/5cefb6cfdd089d237ba6724bb5311ee4f04be59f

[issue25324] Importing tokenize modifies token

2017-06-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1991 ___ Python tracker ___ ___

[issue25324] Importing tokenize modifies token

2017-06-01 Thread STINNER Victor
STINNER Victor added the comment: Albert-Jan Nijburg added the comment: > Aah! Oops I can fix later today. Don't worry. Our test suite and all reviewers also missed it ;-) -- ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-06-01 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: New changeset c9ccacea3ff441b1ff519c7399602b7db16f9783 by Mariatta (Albert-Jan Nijburg) in branch 'master': bpo-25324: add missing comma in Parser/tokenizer.c (GH-1910) https://github.com/python/cpython/commit/c9ccacea3ff441b1ff519c7399602b7db16f9783

[issue25324] Importing tokenize modifies token

2017-06-01 Thread Albert-Jan Nijburg
Changes by Albert-Jan Nijburg : -- pull_requests: +1990 ___ Python tracker ___ ___

[issue25324] Importing tokenize modifies token

2017-06-01 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: Aah! Oops I can fix later today. On Thu, 1 Jun 2017 at 18:08, STINNER Victor wrote: > > STINNER Victor added the comment: > > We got a bug report from Coverity: > > *** CID 1411801: Incorrect expression (MISSING_COMMA) >

[issue25324] Importing tokenize modifies token

2017-06-01 Thread STINNER Victor
STINNER Victor added the comment: We got a bug report from Coverity: *** CID 1411801: Incorrect expression (MISSING_COMMA) /Parser/tokenizer.c: 111 in () 105 "OP", 106 "AWAIT", 107 "ASYNC", 108 "", 109 "COMMENT", 110 "NL", >>> CID 1411801:

[issue25324] Importing tokenize modifies token

2017-05-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset fc354f07855a9197e71f851ad930cbf5652f9160 by Victor Stinner (Albert-Jan Nijburg) in branch 'master': bpo-25324: copy tok_name before changing it (#1608) https://github.com/python/cpython/commit/fc354f07855a9197e71f851ad930cbf5652f9160 --

[issue25324] Importing tokenize modifies token

2017-05-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If move COMMENT, NL and ENCODING to the token module, their documentation should be moved from tokenize.rst to token.rst. I have asked on Python-Dev whether this is a right way. [1] [1] https://mail.python.org/pipermail/python-dev/2017-May/148080.html

[issue25324] Importing tokenize modifies token

2017-05-31 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: I've updated token.rst and Misc/NEWS. Let me know if the wording is correct. -- ___ Python tracker ___

[issue25324] Importing tokenize modifies token

2017-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If merge this only in master, the new members of the token module should be documented (add a versionchanged directive in token.rst). This also needs a Misc/NEWS entry. -- ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-05-30 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: Let me know if you want me to add/change anything about my PR :) I'm happy to do so. -- ___ Python tracker ___

[issue25324] Importing tokenize modifies token

2017-05-30 Thread STINNER Victor
STINNER Victor added the comment: I suggest to only modify the master branch. Nobody complained before. It's only a very minor surprising behaviour. -- ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Albert-Jan's patch should be merged prior my patch for issue30455, because it can be backported, by my patch shouldn't. But first we should compare them and find differences in results. My patch adds COMMENT, NL and ENCODING in the documentation,

[issue25324] Importing tokenize modifies token

2017-05-30 Thread STINNER Victor
STINNER Victor added the comment: https://github.com/python/cpython/pull/1608 doesn't include a Misc/NEWS entry, but I don't want to stress albertjan with Misc/NEWS since I was already annoying enough on the review :-) I'm not sure that the change deserves a NEWS entry. If you consider that

[issue25324] Importing tokenize modifies token

2017-05-24 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: I've updated the PR and added the tokenize tokens to token.h and their names to tokenizer.c. This way they'll show up when you run token.py. The names will always be in tok_name and tokenizer.py will use those. Not breaking the public api and no longer

[issue25324] Importing tokenize modifies token

2017-05-16 Thread STINNER Victor
STINNER Victor added the comment: > lib2to3 appears to have it's own token.py as well with NL and COMMENT > withtout ENCODING... Oh you are right: Lib/lib2to3/pgen2/driver.py uses Lib/lib2to3/pgen2/token.py. -- ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-05-16 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: lib2to3 appears to have it's own token.py as well with NL and COMMENT withtout ENCODING... Lib/lib2to3/pgen2/token.py -- ___ Python tracker

[issue25324] Importing tokenize modifies token

2017-05-16 Thread Albert-Jan Nijburg
Albert-Jan Nijburg added the comment: > I prefer to add tokenize tokens directly in Lib/token.py, and then get > COMMENT, NL and ENCODING using tok_name.index(). That would make more sense from a breaking change perspective, but we would step on the toes of anyone adding `COMMENT`, `NL`, or

[issue25324] Importing tokenize modifies token

2017-05-16 Thread STINNER Victor
STINNER Victor added the comment: Another example from Tools/i18n/pygettext.py, TokenEater:: def __call__(self, ttype, tstring, stup, etup, line): # dispatch ##import token ##print >> sys.stderr, 'ttype:', token.tok_name[ttype], \ ## 'tstring:', tstring

[issue25324] Importing tokenize modifies token

2017-05-16 Thread STINNER Victor
STINNER Victor added the comment: Extract of Lib/lib2to3/pgen2/driver.py: if type in (tokenize.COMMENT, tokenize.NL): ... if debug: self.logger.debug("%s %r (prefix=%r)", token.tok_name[type], value, prefix) The code uses tokenize.COMMENT and

[issue25324] Importing tokenize modifies token

2017-05-16 Thread STINNER Victor
STINNER Victor added the comment: > I would fix this by making tokenize.tok_name a copy. It looks like this > behaviour dates back to 1997 (see revision 1efc4273fdb7). token.tok_name is part of the Python public API: https://docs.python.org/dev/library/token.html#token.tok_name whereas

[issue25324] Importing tokenize modifies token

2017-05-16 Thread Albert-Jan Nijburg
Changes by Albert-Jan Nijburg : -- pull_requests: +1699 ___ Python tracker ___ ___

[issue25324] Importing tokenize modifies token

2015-12-22 Thread Joseph Gordon
Changes by Joseph Gordon : -- nosy: +josephgordon ___ Python tracker ___ ___

[issue25324] Importing tokenize modifies token

2015-10-06 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Importing the tokenize modifies the content of the token module. >>> import token >>> len(token.tok_name) 59 >>> import tokenize >>> len(token.tok_name) 61 Such side effect looks as bad design to me. Either token.tok_name should contain elements needed

[issue25324] Importing tokenize modifies token

2015-10-06 Thread STINNER Victor
STINNER Victor added the comment: I agree :-) Do you want to work on a patch? -- nosy: +haypo ___ Python tracker ___

[issue25324] Importing tokenize modifies token

2015-10-06 Thread Martin Panter
Martin Panter added the comment: I would fix this by making tokenize.tok_name a copy. It looks like this behaviour dates back to 1997 (see revision 1efc4273fdb7). -- nosy: +martin.panter ___ Python tracker

[issue25324] Importing tokenize modifies token

2015-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I left the decision for modules maintainers. -- ___ Python tracker ___