[issue2636] Adding a new regex module (compatible with re)

2014-11-09 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for pushing this one forward Serhiy! Your approach sounds like a fine plan to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636 ___

[issue22825] Modernize TextFile

2014-11-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch makes distutils.text_file.TextFile support context management and iterator protocols. It makes the use of TextFile simpler. The patch also includes other minor modernizations. -- components: Distutils files: text_file.diff keywords:

[issue2636] Adding a new regex module (compatible with re)

2014-11-09 Thread Jeffrey C. Jacobs
Jeffrey C. Jacobs added the comment: If I recall, I started this thread with a plan to update re itself with implementations of various features listed in the top post. If you look at the list of files uploaded by me there are seme complete patches for Re to add various features like Atomic

[issue22826] Support context management protocol in bkfile

2014-11-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch makes bkfile (file-like class used in freeze) support the context management protocol. This makes bkfile more file-like and makes the use of it simpler and more robust. -- components: Demos and Tools files: bkfile.diff keywords:

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
New submission from Donald Stufft: As specified in PEP 477, this backports PEP 453 (ensurepip) to the Python 2.7 branch. Key differences from PEP 453 are: * It is not run by default in the Makefile * There is no venv modules, so downstream can remove it (though are asked to patch it to

[issue22828] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
New submission from Donald Stufft: As specified in PEP 477, this backports PEP 453 (ensurepip) to the Python 2.7 branch. Key differences from PEP 453 are: * It is not run by default in the Makefile * There is no venv modules, so downstream can remove it (though are asked to patch it to

[issue22828] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
Donald Stufft added the comment: Closing this in favor of http://bugs.python.org/issue22827 -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22828

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
Changes by Donald Stufft don...@stufft.io: -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
Donald Stufft added the comment: Second patch just fixes the docs to specify the correct behavior for 2.7 and it fixes ensurepip.bootstrap() to match the default 2.7 behavior when executing python -m ensurepip. -- Added file: http://bugs.python.org/file37155/pep-477-2.patch

[issue22826] Support context management protocol in bkfile

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: This looks correct and it improves readability. One nit, please put the doubled with on a single line instead of using the awkward line break (which looks weird with respect to the indentation of the with-block): +with open(config_c_in) as infp,

[issue22829] Add --prompt option to venv

2014-11-09 Thread Łukasz Balcerzak
New submission from Łukasz Balcerzak: virtualenv tool allows to set alternative prompt prefix, Python's venv module should allow this too. Basically, this allows one to run: python -mvenv --prompt Quux myenv And see (Quux) as a prefix after environment activation (instead of the myenv in

[issue21288] hashlib.pbkdf2_hmac Hash Constructor

2014-11-09 Thread Eric Beurre
Changes by Eric Beurre h...@ericbeurre.com: -- nosy: +egbutter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21288 ___ ___ Python-bugs-list

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Terry J. Reedy
New submission from Terry J. Reedy: https://docs.python.org/3.4/library/functools.html#functools.cmp_to_key says A key function is a callable that accepts one argument and returns another value indicating the position in the desired collation sequence. A python list poster (Veek M) 'value

[issue22434] Use named constants internally in the re module

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Raymond for the review. I especially like the removal of superfluous OPCODES dictionary lookups The disadvantage is that now backporting patches to old branches is harder. Since the op codes are singletons, you can use identity tests instead of

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'll add a link to the glossary entry for key function and to the sorting howto. Also, I'll change value indicating the position to value to be used as the sort key. The form sentence being discussed should probably remain close to how it is currently

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: I will prepare a 3.5 patch for this. There are not many instances other than those you found (but several times as many in tests). I presume that most non-test instances were converted by the 2to3 fixer. How about frozenset([...]) to frozenset({...})?

[issue22826] Support context management protocol in bkfile

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Raymond. I found my old patch written 5 months ago. It drastically simplifies bkfile by using monkey-patching. What approach looks better to you? -- Added file: http://bugs.python.org/file37157/bkfile2.patch

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: I did not look at Docs yet. I could not repeat the timing results on my machine running from the command line, as I got '0.015 usec per loop' for both, and same for both frozenset variations. Running timeit.repeat interactively and selecting the best

[issue22831] Use with to avoid possible fd leaks

2014-11-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Here is large patch which convert a code which potentially can leak file descriptor to use the with statement so files are always closed. This can make effect mainly on alternative Python implementation without reference counting. But even on CPython this

[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2014-11-09 Thread Vinay Sajip
Vinay Sajip added the comment: I don't quite understand why you use __PYVENV_LAUNCHER__ When I first developed the venv functionality it was definitely needed, but it looks as if it is not needed now. Perhaps to fix this completely, the following needs to be done, on the assumption that

[issue22434] Use named constants internally in the re module

2014-11-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22434 ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Isn't such changes considered code churn? If it is not, I have a huge patch which makes Python sources to use more modern idioms, including replacing set constructors with set literals (I have counted three occurrences not in tests). Are you interesting to

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: [I will prepare a 3.5 patch for this.] Thanks, I will review when you're done. [How about frozenset([...]) to frozenset({...})? ] Yes, the frozenset() examples should change to match the actual repr: frozenset([10, 20, 30]) frozenset({10, 20, 30})

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Isn't such changes considered code churn?] This sort of thing is always a judgment call. The patch will affect very few lines of code, give a little speed-up, and make the code easier to read. In the case of the docs, it is almost always worthwhile to

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: My timing for set((1,2,3)) is .29, faster than for set([1,2,3]) (.42) but still slower than for {1,2,3} (.16). So I will change such instances also. The same timing for frozenset((1,2,3)) (.29) is faster than the best timing for frozenset({1,2,3}), (.36), so

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Matthias Klose
Matthias Klose added the comment: The mock backport doesn't come with a license. Please either include it in the file, or make it clear that the backport has the same license as python (?). -- nosy: +michael.foord ___ Python tracker

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
Donald Stufft added the comment: The backport is taken from Python 3.4 so it's the same license as everything else. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___

[issue22827] Backport ensurepip to 2.7 (PEP 477)

2014-11-09 Thread Donald Stufft
Donald Stufft added the comment: IOW it's literally Lib/unittest/mock.py from the 3.x series. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: The same timing for frozenset((1,2,3)) (.29) is faster than the best timing for frozenset({1,2,3}), (.36), I don't see the tuple form used anywhere in the code. The timing is a bit quicker for the tuple form because the peephole optimizer constant folds

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, about your 'huge patch' to modernize code: I am more positive than some because: 1) To me, a one-time gentile change is not 'churning'. 2) As we link to many, most, or even all python-coded stdlib modules (I think there is a proposal for 'all'),

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Attaching a patch. Doesn't change tests for the reasons mentioned above. Leaves idle, 2-to-3, and mocking for their respective module maintainers to deal with holistically (as part of their routine maintenance). -- keywords: +patch Added file:

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree with your comments and proposed changes and will leave this to you. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22830 ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Okay, I missed the frozenset(( examples in my search. There are all in one-time set-up code. Attaching a patch for them as well. -- Added file: http://bugs.python.org/file37160/more_set_literals.patch ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You have missed Parser/asdl.py and Tools/clinic/clinic.py. -- Added file: http://bugs.python.org/file37161/set_literal_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, as I said before, please omit idlelib/CodeContext. You both skipped reprlib.py. Should it be changed to produce the standard repr() result? The existing lines: F:\Python\dev\35\lib\reprlib.py: 91: return self._repr_iterable(x, level,

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Hmm, didn't look at those parts of the tree. I'll change the one-line in Parser and leave the little atrocities in clinic.py for Larry to fix :-) Reprlib was skipped intentionally. There is a separate tracker item for it.

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: If there are no objections, I would like to apply my two patches (plus the one-line asdl.py change) and leave the rest to the discretion the module maintainers (mock, code context, clinic, and 2-to-3). -- ___

[issue22791] datetime.utcfromtimestamp() shoud have option for create tz aware datetime

2014-11-09 Thread Akira Li
Akira Li added the comment: I agree the documentation should nudge towards aware datetime objects. I've attached a documentation patch as an example. -- keywords: +patch Added file: http://bugs.python.org/file37162/issue22791-utcfromtimestamp-aware.diff

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4480506137ed by Raymond Hettinger in branch 'default': Issue #22823: Use set literals instead of creating a set from a list https://hg.python.org/cpython/rev/4480506137ed -- nosy: +python-dev ___ Python

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Larry, would you care to apply or approve Serhiy's updates to clinic.py? -- assignee: rhettinger - larry nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Berker Peksag
Berker Peksag added the comment: Here's a patch to use set literals and frozenset({'a'}) in reprlib. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file37163/issue22824.diff ___ Python tracker

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: That looks great. Go ahead an apply (with a MISC/NEWS entry and an update to the example on line 22 of Docs/tutorial/stdlib2.rst). -- assignee: - berker.peksag ___ Python tracker rep...@bugs.python.org

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the review, Raymond. Patch updated: - Updated the documentation - Added two test cases for set literals - Replaced old run_unittest calls with ``unittest.main()`` -- Added file: http://bugs.python.org/file37164/issue22824_v2.diff

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset dbe1744ec62e by Raymond Hettinger in branch '2.7': Issue 22830: Clarify docs for functools.cmp_to_key(). https://hg.python.org/cpython/rev/dbe1744ec62e -- nosy: +python-dev ___ Python tracker

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 63274cf1b40d by Raymond Hettinger in branch '3.4': Issue 22830: Clarify docs for functools.cmp_to_key(). https://hg.python.org/cpython/rev/63274cf1b40d -- ___ Python tracker rep...@bugs.python.org

[issue20152] Derby #15: Convert 50 sites to Argument Clinic across 9 files

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6e6532d313a1 by Brett Cannon in branch 'default': Issue 20152, 22821: Port the fcntl module to Argument Clinic. https://hg.python.org/cpython/rev/6e6532d313a1 -- ___ Python tracker rep...@bugs.python.org

[issue22821] Argument of wrong type is passed to fcntl()

2014-11-09 Thread Brett Cannon
Brett Cannon added the comment: Fixed in 3.5 as part of 6e6532d313a1 as it was easier to integrate it as part of the Clinic patch. -- stage: patch review - commit review versions: -Python 3.5 ___ Python tracker rep...@bugs.python.org

[issue20152] Derby #15: Convert 50 sites to Argument Clinic across 9 files

2014-11-09 Thread Brett Cannon
Brett Cannon added the comment: Finally finished! I am never trusting Larry to count anything ever again. ;) -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org

[issue22830] functools.cmp_to_key: misleading key function description

2014-11-09 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22830 ___

[issue22832] Tweak parameter names for fcntl module

2014-11-09 Thread Brett Cannon
New submission from Brett Cannon: http://bugs.python.org/review/20152/ is filled with various suggestions from Serhiy on how to update the function parameters in the fcntl module to more closely match what is in the man pages. This should be fully backwards-compatible as the parameters are

[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2014-11-09 Thread py.user
New submission from py.user: It depends on encoded part in the header, what email.header.decode_header() returns. If the header has both raw part and encoded part, the function returns (bytes, None) for the raw part. But if the header has only raw part, the function returns (str, None) for

[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2014-11-09 Thread py.user
Changes by py.user bugzilla-mail-...@yandex.ru: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list

[issue22834] Unexpected FileNotFoundError when current directory is removed

2014-11-09 Thread Martin Panter
New submission from Martin Panter: I encountered this when I added a unit test case that invoked os.chdir() with a temporary directory on Linux. After the directory was removed, some of the subsequent test cases failed, although I don’t think they should depend on a particular CWD. I suspect

[issue22835] urllib2/httplib is rendering 400s for every authenticated-SSL request, suddenly

2014-11-09 Thread Dustin Oprea
New submission from Dustin Oprea: I am trying to do an authenticated-SSL request to an Nginx server using *requests*, which wraps urllib2/httplib. It's worked perfectly for months until Friday on my local system (Mac 10.9.5), and there have been no upgrades/patches. My Python 2.7.6 client

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 147fda13bec8 by Raymond Hettinger in branch 'default': Issue #22824: Updated reprlib output format for sets to use set literals. https://hg.python.org/cpython/rev/147fda13bec8 -- nosy: +python-dev ___

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the patch. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___

[issue22824] Update reprlib to use set literals

2014-11-09 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- stage: patch review - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___

[issue22829] Add --prompt option to venv

2014-11-09 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +ncoghlan, vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22829 ___ ___ Python-bugs-list

[issue17554] Compact output for regrtest

2014-11-09 Thread Berker Peksag
Berker Peksag added the comment: issue17554-urlfetch.diff LGTM. -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17554 ___

[issue22813] No facility for test randomisation

2014-11-09 Thread sbspider
sbspider added the comment: And what do you think would it be useful for? I mean, it shouldn't be too hard to implement, a couple of hours at most, but I can't seem to see what would be the purpose. However, if you think that there is enough of a use case behind it, then I would be happy to

[issue21650] add json.tool option to avoid alphabetic sort of fields

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 58a871227e5b by Berker Peksag in branch 'default': Issue #21650: Add an `--sort-keys` option to json.tool CLI. https://hg.python.org/cpython/rev/58a871227e5b -- nosy: +python-dev ___ Python tracker

[issue21650] add json.tool option to avoid alphabetic sort of fields

2014-11-09 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the reviews. -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21650 ___