[issue2636] Adding a new regex module (compatible with re)
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22825] Modernize TextFile
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: patch messages: 230886 nosy: dstufft, eric.araujo, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Modernize TextFile type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file37151/text_file.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22825 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Adding a new regex module (compatible with re)
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 Grouping. If we wish to therefore bring re to regex standard we could start with those features. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22826] Support context management protocol in bkfile
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: patch messages: 230888 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Support context management protocol in bkfile type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file37152/bkfile.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22826 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
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 provide instructions redirecting people to how they should install pip). * The ``pip`` command is installed as well as ``pipX`` and ``pipX.Y``. * Given the above, --default-pip is hidden and no-oped and --no-default-pip is added to restore the Python 3.x behavior. This also includes a (slightly modified to make it work on 2.x) backport of unittest.mock as test._mock_backport in order to make it reasonable to run the ensurepip tests without actually installing pip. This patch does not include any changes to the Windows installers or to the OS X installers. I've nosey'd Ned Deily for the OS X installer changes, I'm not sure who is doing the Windows Installers now adays. Note: The attached patch does not contain the actual .whl files which are required. This is because it makes the patch into a 2M patch and the tracker didn't like that very much. This patch can be applied and then just copy over the Lib/ensurepip/_bundled directory from Python 3.4. -- files: pep-477.patch keywords: needs review, patch messages: 230889 nosy: doko, dstufft, ncoghlan, ned.deily priority: normal severity: normal stage: patch review status: open title: Backport ensurepip to 2.7 (PEP 477) type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file37154/pep-477.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22828] Backport ensurepip to 2.7 (PEP 477)
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 provide instructions redirecting people to how they should install pip). * The ``pip`` command is installed as well as ``pipX`` and ``pipX.Y``. * Given the above, --default-pip is hidden and no-oped and --no-default-pip is added to restore the Python 3.x behavior. This also includes a (slightly modified to make it work on 2.x) backport of unittest.mock as test._mock_backport in order to make it reasonable to run the ensurepip tests without actually installing pip. This patch does not include any changes to the Windows installers or to the OS X installers. I've nosey'd Ned Deily for the OS X installer changes, I'm not sure who is doing the Windows Installers now adays. -- files: pep-477.patch keywords: needs review, patch messages: 230890 nosy: doko, dstufft, ncoghlan, ned.deily priority: normal severity: normal stage: patch review status: open title: Backport ensurepip to 2.7 (PEP 477) type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file37153/pep-477.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22828 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22828] Backport ensurepip to 2.7 (PEP 477)
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
Changes by Donald Stufft don...@stufft.io: -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22826] Support context management protocol in bkfile
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, bkfile.open(config_c, 'w') as outfp: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22826 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22829] Add --prompt option to venv
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 this case). -- files: venv-prompt-argument.patch keywords: patch messages: 230894 nosy: Łukasz.Balcerzak priority: normal severity: normal status: open title: Add --prompt option to venv versions: Python 3.5 Added file: http://bugs.python.org/file37156/venv-prompt-argument.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21288] hashlib.pbkdf2_hmac Hash Constructor
Changes by Eric Beurre h...@ericbeurre.com: -- nosy: +egbutter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21288 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
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 indicating the position' as meaning 0, 1, 2, ... and I would read it that way if I did not know better. Entries for min() and max() say The key argument specifies a one-argument ordering function like that used for list.sort(). This would be reused here. We also, now, have a Glossary entry for 'key function'. This could be referred to instead. -- assignee: docs@python components: Documentation messages: 230895 nosy: docs@python, terry.reedy priority: normal severity: normal stage: needs patch status: open title: functools.cmp_to_key: misleading key function description type: behavior versions: Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22434] Use named constants internally in the re module
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 equality checks in sre_parse.py: This is deliberate. There is small change that the opcodes could became an integers in future (after adding introspection to pattern object, or make it copyable, or allowing serialization of compiled codes). is instead of == can cause subtle bug. Note that is is used during parsing, but getwidth() is called from sre_compile.py. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22434 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
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 written. It is part of a two sentence paragraph that contrasts cmp functions versus key functions, so the parallel sentence structure is part of what it is trying to communicate. FWIW, interpreting value indicating position as 0, 1, 2, etc isn't incorrect. That is a possible key function. In general, I prefer doc changes to be very minor when they have a history of many people reading them correctly; otherwise, we risk moving away from something that was already working pretty well. -- assignee: docs@python - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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({...})? There are 4 occurrences of this. The semantic match between frozenset and {...} is better than with [...], but the visual gain in nearly nil. I will leave the one idlelib instance in CodeContext for when I am editing the file anyway (for both 3.4 and 3.5), which should be soon. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22826] Support context management protocol in bkfile
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22826 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 reproduced your timing ratio: .16 to .42. For frozenset, I get .36 to .42 in favor of changing to frozenset({...}). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22831] Use with to avoid possible fd leaks
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 will get rid from resource leaking warnings. -- components: Demos and Tools, Library (Lib), Tests files: fd_leaks.diff keywords: patch messages: 230901 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use with to avoid possible fd leaks type: resource usage versions: Python 3.5 Added file: http://bugs.python.org/file37158/fd_leaks.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22831 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile
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 __PYVENV_LAUNCHER__ is no longer needed: 1. Remove the reference to it in distlib, and use sys.executable instead. Once pip incorporates this fix, the Homebrew problem should go away. (I have already made the change in the distlib repo, but this needs to be released in order for pip to consider vendoring it, and then pip needs to be released before Python can incorporate it). 2. Remove references to the environment variable in Python itself, using sys.executable instead. As the env var was an implementation detail, ISTM it could be removed in a 3.4 point release - would you agree? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22434] Use named constants internally in the re module
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 look on it Raymond? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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}) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 update to the current, idiomatic form. Also, the set literal case is special because it has built-in language support, possible peephole optimizations, and there was a repr change as well. That said, it is rarely a good idea to change tests because we don't have tests for tests and because the end-user will never see any value. On the balance, I think this one is a reasonable thing to do, but I would show a great deal more hesitancy for a a huge patch which makes Python sources to use more modern idioms. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 I will not change that unless discussed and agreed on. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
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 rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 the tuple (use dis to see this). so I will not change that unless discussed and agreed on. Maybe, I should just make the patch. It's becoming harder to talk about than to just fix. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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'), there is more benefit to using modern idioms. On the other hand, 'huge' patches can be too much to discuss, justify, and review all at once. Using {.. } for sets consistently is a nice-sized chunk to consider. We can identify, discuss, and decide on each sub-case (I have identified 4 so far). It has the additional benefit of being a performance enhancement. --- 'set((...' is used in distutils (which I will not change) and in many tests. So that is not an issue. 'frozenset((' is used 5 times in regular module code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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: http://bugs.python.org/file37159/set_literal.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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, 'set([', '])', self.maxset) F:\Python\dev\35\lib\reprlib.py: 95: return self._repr_iterable(x, level, 'frozenset([', '])', If it is, its tests will have to be changed too. -- keywords: -patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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. http://bugs.python.org/issue22824 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22791] datetime.utcfromtimestamp() shoud have option for create tz aware datetime
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22791 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22823] Use set literals instead of creating a set from a list
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
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 rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
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 http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
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 rep...@bugs.python.org http://bugs.python.org/issue22830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
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 http://bugs.python.org/issue22830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20152] Derby #15: Convert 50 sites to Argument Clinic across 9 files
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 http://bugs.python.org/issue20152 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22821] Argument of wrong type is passed to fcntl()
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 http://bugs.python.org/issue22821 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20152] Derby #15: Convert 50 sites to Argument Clinic across 9 files
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 http://bugs.python.org/issue20152 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22830] functools.cmp_to_key: misleading key function description
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22832] Tweak parameter names for fcntl module
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 positional-only. It should be easy as the code doesn't need to change thanks to Argument Clinic. Trick will be updating both the code and the docs. -- assignee: docs@python components: Documentation keywords: easy messages: 230931 nosy: brett.cannon, docs@python, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Tweak parameter names for fcntl module type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22832 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part
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 it. import email.header s = 'abc=?koi8-r?q?\xc1\xc2\xd7?=' email.header.decode_header(s) [(b'abc', None), (b'\xc1\xc2\xd7', 'koi8-r')] s = 'abc' email.header.decode_header(s) [('abc', None)] There should be (bytes, None) for both cases. -- components: Library (Lib), email messages: 230932 nosy: barry, py.user, r.david.murray priority: normal severity: normal status: open title: The decode_header() function decodes raw part to bytes or str, depending on encoded part versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part
Changes by py.user bugzilla-mail-...@yandex.ru: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22834] Unexpected FileNotFoundError when current directory is removed
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 the main problem might be code that is trying to dynamically import modules, and the interpreter is trying to search for modules in the current directory. I would expect it to happily go on to the other standard module directories or raise ImportError, just like if the current directory is valid but empty, or an nonexistent directory is in the module search path list. Code to set up missing CWD: import os from tempfile import TemporaryDirectory with TemporaryDirectory() as dir: os.chdir(dir) Quick recovery: os.chdir(/) Examples of failures: \N{COPYRIGHT SIGN} File stdin, line 1 SyntaxError: (unicode error) \N escapes not supported (can't load unicodedata module) datetime.strptime(, ) Traceback (most recent call last): File stdin, line 1, in module File frozen importlib._bootstrap, line 2237, in _find_and_load File frozen importlib._bootstrap, line , in _find_and_load_unlocked File frozen importlib._bootstrap, line 2164, in _find_spec File frozen importlib._bootstrap, line 1940, in find_spec File frozen importlib._bootstrap, line 1911, in _get_spec File frozen importlib._bootstrap, line 1879, in _path_importer_cache FileNotFoundError: [Errno 2] No such file or directory HTTPConnection(localhost).request(GET, /) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/http/client.py, line 1090, in request self._send_request(method, url, body, headers) File /usr/lib/python3.4/http/client.py, line 1128, in _send_request self.endheaders(body) File /usr/lib/python3.4/http/client.py, line 1086, in endheaders self._send_output(message_body) File /usr/lib/python3.4/http/client.py, line 924, in _send_output self.send(msg) File /usr/lib/python3.4/http/client.py, line 859, in send self.connect() File /usr/lib/python3.4/http/client.py, line 836, in connect self.timeout, self.source_address) File /usr/lib/python3.4/socket.py, line 491, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File /usr/lib/python3.4/socket.py, line 530, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): File /usr/lib/python3.4/encodings/__init__.py, line 98, in search_function level=0) File /usr/lib/python3.4/encodings/idna.py, line 3, in module import stringprep, re, codecs File frozen importlib._bootstrap, line 2237, in _find_and_load File frozen importlib._bootstrap, line , in _find_and_load_unlocked File frozen importlib._bootstrap, line 2164, in _find_spec File frozen importlib._bootstrap, line 1940, in find_spec File frozen importlib._bootstrap, line 1911, in _get_spec File frozen importlib._bootstrap, line 1879, in _path_importer_cache FileNotFoundError: [Errno 2] No such file or directory from datetime import datetime from http.client import HTTPConnection These two also generate the FileNotFoundError My workaround is to add this to my test case: self.addCleanup(os.chdir, os.getcwd()) -- components: Interpreter Core messages: 230933 nosy: vadmium priority: normal severity: normal status: open title: Unexpected FileNotFoundError when current directory is removed type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22834 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22835] urllib2/httplib is rendering 400s for every authenticated-SSL request, suddenly
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 fails when connecting to Nginx, locally. I get a 400, with this: html headtitle400 No required SSL certificate was sent/title/head body bgcolor=white centerh1400 Bad Request/h1/center centerNo required SSL certificate was sent/center hrcenternginx/1.4.6 (Ubuntu)/center /body /html This is an example that uses urllib2/httplib, directly: import urllib2 import httplib cert_filepath = '/var/lib/rt_data/ssl/rt.crt.pem' key_filepath = '/var/lib/rt_data/ssl/rt.private_key.pem' url = 'https://deploy_api.local:8443/auth/admin/1/hosts' class HTTPSClientAuthHandler(urllib2.HTTPSHandler): Wrapper to allow for authenticated SSL connections. def __init__(self, key, cert): urllib2.HTTPSHandler.__init__(self) self.key = key self.cert = cert def https_open(self, req): # Rather than pass in a reference to a connection class, we pass in # a reference to a function which, for all intents and purposes, # will behave as a constructor return self.do_open(self.getConnection, req) def getConnection(self, host, timeout=300): return httplib.HTTPSConnection(host, key_file=self.key, cert_file=self.cert) opener = urllib2.build_opener(HTTPSClientAuthHandler(key_filepath, cert_filepath)) response = opener.open(url) response_data = response.read() print(response_data) These are the factors: - It works when connecting to the remote server. Both local and remote are Nginx with similar configs. - cURL works perfectly: curl -s -v -X GET -k --cert /var/lib/rt_data/ssl/rt.crt.pem --key /var/lib/rt_data/ssl/rt.private_key.pem https://server.local:8443/auth/admin/1/hosts - I've tried under Vagrant with Ubuntu 12.04 (2.7.3) and 14.04 (2.7.6). No difference. - It works with Python 3.4 on the local system. This only has only affected 2.7 very suddenly. Due to the error-message above, it seems like there's a break down in sending the certificate/key. I have no idea what's going on, and this has caused me a fair amount of distress. Can you provide me a direction? -- components: Library (Lib) messages: 230934 nosy: Dustin.Oprea priority: normal severity: normal status: open title: urllib2/httplib is rendering 400s for every authenticated-SSL request, suddenly type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22835 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
Changes by Berker Peksag berker.pek...@gmail.com: -- stage: patch review - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22829] Add --prompt option to venv
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 mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17554] Compact output for regrtest
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22813] No facility for test randomisation
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 have a crack at it :). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22813 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21650] add json.tool option to avoid alphabetic sort of fields
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 rep...@bugs.python.org http://bugs.python.org/issue21650 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21650] add json.tool option to avoid alphabetic sort of fields
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 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com