[issue28272] a redundant check in maybe_small_long

2017-03-01 Thread Oren Milman
Oren Milman added the comment: ping (just to close the issue, I think) -- ___ Python tracker ___ ___

[issue29690] no %z directive for strptime in python2, doc says nothing about it

2017-03-01 Thread Mathieu Dupuy
New submission from Mathieu Dupuy: ➜ ~ cat dt.py from datetime import * dt = datetime.strptime('+1720', '%z') print(dt) ➜ ~ python2 dt.py Traceback (most recent call last): File "dt.py", line 2, in dt = datetime.strptime('+1720', '%z') File "/usr/lib/python2.7/_strptime.py", line

Re: Exposing all methods of a class

2017-03-01 Thread Rick Johnson
On Wednesday, March 1, 2017 at 4:51:34 AM UTC-6, Terry Reedy wrote: > The class listing provided by the pydoc module browser, > also in help(someclass), do list all methods. Try > >>> import tkinter > >>> help(tkinter.Text) > for instance. > > On 2/28/2017 7:16 PM, Rick Johnson wrote: > > IDLE

[issue29679] Add @contextlib.asynccontextmanager

2017-03-01 Thread Nick Coghlan
Nick Coghlan added the comment: In the specific case of contextlib, most of the APIs should be able to transparently support async/await without negatively impacting their synchronous behaviour, so after the python-dev discussion, I think one module with separate sync and async test suites is

Re: Using re to perform grep functionality in Python

2017-03-01 Thread Michael Torrie
On 03/01/2017 02:55 PM, rob...@forzasilicon.com wrote: > Obviously, not what I want. Can anyone feed some input? You've already got some good answers, but I just wanted to point you at this good resource: http://www.dabeaz.com/generators/ Pretty much anything you do in a shell script that

[issue22810] tkinter: "alloc: invalid block:" after askopenfilename

2017-03-01 Thread Todd Goldfinger
Todd Goldfinger added the comment: This crashes reliably on Win10 with the same error message. Place cursor after the 2 in the top spin box. Type 0. I have the following files in Anaconda3/tcl: tcl86t.lib, tcl86tg.lib, tclstub86.lib, tk86t.lib, tk86tg.lib, tkstub86.lib. Python 3.6.0

[issue29594] implementation of __or__ in enum.auto

2017-03-01 Thread Ethan Furman
Ethan Furman added the comment: Serhiy, agreed. Closing. Marc, thanks, I see I missed supporting non-auto() combinations. Feel free to open an issue for that at: https://bitbucket.org/stoneleaf/aenum Either way I'll get that fixed. -- resolution: -> rejected stage: -> resolved

[issue28129] assertion failures in ctypes

2017-03-01 Thread Oren Milman
Oren Milman added the comment: The fix for issue #25659 already replaced the assertions in CDataType_from_buffer and CDataType_from_buffer_copy with if statements (my bad for missing that issue when I opened this one). In addition, that fix added some tests, so I also added some, and created a

[issue28129] assertion failures in ctypes

2017-03-01 Thread Roundup Robot
Changes by Roundup Robot : -- pull_requests: +322 ___ Python tracker ___

Re: Using re to perform grep functionality in Python

2017-03-01 Thread Cameron Simpson
On 01Mar2017 13:55, rob...@forzasilicon.com wrote: I'm relatively new to Python, and I am having some trouble with one of my scripts. Basically, this script connects to a server via ssh, runs Dell's omreport output, and then externally pipes it to a mail script in

Re: Using re to perform grep functionality in Python

2017-03-01 Thread robert
Thanks, Chris. That was nice and easy and very simple. -- https://mail.python.org/mailman/listinfo/python-list

Re: Using re to perform grep functionality in Python

2017-03-01 Thread Chris Angelico
On Thu, Mar 2, 2017 at 8:55 AM, wrote: > Hi All, > > I'm relatively new to Python, and I am having some trouble with one of my > scripts. Basically, this script connects to a server via ssh, runs Dell's > omreport output, and then externally pipes it to a mail script

Using re to perform grep functionality in Python

2017-03-01 Thread robert
Hi All, I'm relatively new to Python, and I am having some trouble with one of my scripts. Basically, this script connects to a server via ssh, runs Dell's omreport output, and then externally pipes it to a mail script in cron. The script uses an external call to grep via subprocess, but I

[issue29679] Add @contextlib.asynccontextmanager

2017-03-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: At third alternative is to create an asynctools module to collect together tools that work with the async keyword but aren't dependent on asyncio. -- ___ Python tracker

[issue29679] Add @contextlib.asynccontextmanager

2017-03-01 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___

[issue29302] add contextlib.AsyncExitStack

2017-03-01 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___

Re: Manual parameter substitution in sqlite3

2017-03-01 Thread Serhiy Storchaka
On 28.02.17 19:28, Skip Montanaro wrote: Most of the time (well, all the time if you're smart), you let the database adapter do parameter substitution for you to avoid SQL injection attacks (or stupid users). So: curs.execute("select * from mumble where key = ?", (key,)) If you want to

[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2017-03-01 Thread Aviv Palivoda
Aviv Palivoda added the comment: I changed the patch to use SQLITE_VERSION_NUMBER and it looks way better. Thanks Serhiy -- ___ Python tracker ___

[issue29594] implementation of __or__ in enum.auto

2017-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't think it is worthwhile. Using underscored names looks pretty pythonic to me. -- ___ Python tracker ___

[issue29689] Asyncio-namespace helpers for async_generators

2017-03-01 Thread Scott Russ
Changes by Scott Russ : -- nosy: +Scott Russ ___ Python tracker ___ ___

[issue29594] implementation of __or__ in enum.auto

2017-03-01 Thread Marc Guetg
Marc Guetg added the comment: @ethan, didn't know about aenum, thanks for showing it to me. However it doesn't seem to support the behavior I'm after (or I'm doing something wrong) import aenum try: class Foo(aenum.Flag): a = aenum.auto() b = a |

[issue29689] Asyncio-namespace helpers for async_generators

2017-03-01 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue29689] Asyncio-namespace helpers for async_generators

2017-03-01 Thread Codey Oxley
New submission from Codey Oxley: Expanding an async_generator to any container-type currently makes you do an async-for loop/comprehension. There are some third-party libs (aitertools) that have helpers but it would be nice for this to be upstream for list, tuple, dict, set, etc. Usage might

[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2017-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > sqlite3_open_v2 - 2007-09-04 (3.5.0) alpha > sqlite3_prepare_v2 - 2007-01-04 (3.3.9) > sqlite3_close_v2 - 2012-09-03 (3.7.14) There are compile-time checks for supporting SQLite older than 3.2.2. I think it is better to use the preprocessor rather of

[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-01 Thread Brett Cannon
Brett Cannon added the comment: I had thought about trying to pull down the remote but it did seems unnecessarily messy when the SHA1 hash should match across various remotes only when the commits actually match. -- ___ Python tracker

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread R. David Murray
R. David Murray added the comment: We don't make breaking changes unless there is strong motivation, which is lacking here. -- nosy: +r.david.murray ___ Python tracker

[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2017-03-01 Thread Aviv Palivoda
Aviv Palivoda added the comment: from https://www.sqlite.org/changes.html: sqlite3_open_v2 - 2007-09-04 (3.5.0) alpha sqlite3_prepare_v2 - 2007-01-04 (3.3.9) sqlite3_close_v2 - 2012-09-03 (3.7.14) In issue 29355 Ma Lin says that RHEL6 comes with SQLite 3.6.x. I think that removing that

[issue29679] Add @contextlib.asynccontextmanager

2017-03-01 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas
Vinícius Dantas added the comment: If it is tagged for future releases, whoever choose to update their Python version should expect code breaking and API changes, shouldn't them? I don't see code breaking as an issue against this request. On 1 March 2017 at 14:33, Raymond Hettinger

[issue29302] add contextlib.AsyncExitStack

2017-03-01 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue29688] Document Path.absolute

2017-03-01 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- pull_requests: +321 ___ Python tracker ___ ___

[issue29688] Document Path.absolute

2017-03-01 Thread Jim Fasarakis-Hilliard
New submission from Jim Fasarakis-Hilliard: Method absolute of Path objects lacked documentation, proposed PR adds relevant method to docs. -- assignee: docs@python components: Documentation messages: 288767 nosy: Jim Fasarakis-Hilliard, docs@python priority: normal severity: normal

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: It's too late to change this API. As Serhiy says, it risks breaking code that is currently running and correct. Note the the __doc__ on functions is set to None when there is no docstring. For better or worse, returning None is common in the Python

[issue29687] smtplib does not support proxy

2017-03-01 Thread Rares Vernica
New submission from Rares Vernica: smtplib does not support connections through a proxy. The accepted workaround is something like: ``` import smtplib import socks socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, proxy_host, proxy_port) socks.wrapmodule(smtplib) smtp = smtplib.SMTP() ``` The

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This can break a code that checks whether shortDescription() is None. If you an empty string rather than None, just use the expression `shortDescription() or ''`. -- nosy: +serhiy.storchaka ___ Python tracker

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas
Changes by Vinícius Dantas : -- pull_requests: +319 ___ Python tracker ___ ___

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-03-01 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +318 ___ Python tracker ___ ___

[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas
New submission from Vinícius Dantas: I have been browsing around the unittest standard library, and I realized that TestCase's shortDescription() method at lib/pythonX.X/unittest/case.py returns None when the there is no docstring on the test that is running. As shortDescription() should

[issue29302] add contextlib.AsyncExitStack

2017-03-01 Thread Yury Selivanov
Yury Selivanov added the comment: Looking at the code: we don't need to use iscoroutinefunction at all. If we had separate methods for sync and async context managers, you can store the flag if a function is async or sync along with it. So _exit_callbacks should store tuples `(is_async,

[issue29302] add contextlib.AsyncExitStack

2017-03-01 Thread Yury Selivanov
Yury Selivanov added the comment: Alexander, You don't need asyncio.isocoroutinefunction. Please use inspect.iscoroutinefunction and inspect.iscoroutine. Nick, I'm +1 to have a separate class AsyncExitStack. > - assume everything passed to it is a coroutine or an async context manager >

[issue29685] test_gdb failed

2017-03-01 Thread Marco
New submission from Marco: make test output studio@linux:~/Python-3.6.0> ./python -m test -v test_gdb == CPython 3.6.0 (default, Mar 1 2017, 15:51:48) [GCC 4.8.5] == Linux-4.4.49-16-default-x86_64-with-SuSE-42.2-x86_64 little-endian == hash algorithm: siphash24 64bit == cwd:

[issue29410] Moving to SipHash-1-3

2017-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And needed microbenchmarks for different sizes, because the result should be relied on fitting the data in caches of different levels. -- ___ Python tracker

[issue29679] Add @contextlib.asynccontextmanager

2017-03-01 Thread Yury Selivanov
Yury Selivanov added the comment: > In formulating my question for the list, it occurred to me that while > asynccontextmanager doesn't need to depend on asyncio, the AsyncExitStack > proposed in issue 29302 likely will, which pushes me towards favouring the >

[issue27879] add os.syncfs()

2017-03-01 Thread Fred L. Drake, Jr.
Changes by Fred L. Drake, Jr. : -- nosy: +fdrake ___ Python tracker ___ ___

[issue29680] gdb/libpython.py does not work with gdb 7.2

2017-03-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Victor, the gdb commit that you mentioned introduced gdb.GdbError which is different from gdb.error. [1] The correct commit is 621c83642d17cf523c20f55f2ed945a7ec95ea6a. [2] [1]

[issue29410] Moving to SipHash-1-3

2017-03-01 Thread STINNER Victor
STINNER Victor added the comment: This issue is an optimization, but I still don't see any significant speedup :-) Would it be possible to write at least one microbenchmark showing a speedup? Maybe hash()? -- nosy: +haypo ___ Python tracker

Re: Exposing all methods of a class

2017-03-01 Thread Steve D'Aprano
On Mon, 27 Feb 2017 07:15 am, Pete Dowdell wrote: > I use Python, mainly with Django, for work. I was wondering if anyone > has encountered an editor that could display a class with all inherited > methods included in the editor's view of the class code. Python 3.5 (if not earlier) can do most

Re: asyncio does not always show the full traceback

2017-03-01 Thread Frank Millman
"Frank Millman" wrote in message news:o93vs2$smi$1...@blaine.gmane.org... I use asyncio in my project, so most of my functions start with 'async' and most of my calls are preceded by 'await'. If an exception is raised, I usually get the full traceback, but sometimes I just get something

[ANN] Aenum 2.0

2017-03-01 Thread Ethan Furman
For those following the latest Python releases you may have noticed that Python 3.6 Enum got two new types: - Flag - IntFlag Those classes have now been added to aenum (along with a bunch of bug fixes). aenum is available at: https://pypi.python.org/pypi/aenum Besides the four Enum types

ANN: SfePy 2017.1

2017-03-01 Thread Robert Cimrman
I am pleased to announce release 2017.1 of SfePy. Description --- SfePy (simple finite elements in Python) is a software for solving systems of coupled partial differential equations by the finite element method or by the isogeometric analysis (limited support). It is distributed under

[issue29684] Minor regression in PyEval_CallObjectWithKeywords()

2017-03-01 Thread STINNER Victor
STINNER Victor added the comment: Both PR have been merged, I close the issue. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker

Re: Exposing all methods of a class

2017-03-01 Thread Tim Chase
On 2017-03-01 05:50, Terry Reedy wrote: > The class listing provided by the pydoc module browser, also in > help(someclass), do list all methods. Try > >>> import tkinter > >>> help(tkinter.Text) > for instance. I've been stung by opaque objects a couple times: 1) when the method comes from

[issue29684] Minor regression in PyEval_CallObjectWithKeywords()

2017-03-01 Thread INADA Naoki
Changes by INADA Naoki : -- pull_requests: +317 ___ Python tracker ___ ___

[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2017-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is detection in the configure script needed? What are SQLite versions in which _v2 APIs were added? What is minimal supported SQLite version? Don't forget about Windows where autotools are not used. -- nosy: +serhiy.storchaka versions: +Python 3.7

[issue29683] _PyCode_SetExtra behaviour wrong on allocation failure and after realloc

2017-03-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka nosy: +serhiy.storchaka stage: -> patch review versions: +Python 3.6 ___ Python tracker

Re: Looking for documentation on how Python assigns to function parameters

2017-03-01 Thread Jussi Piitulainen
Steve D'Aprano writes: > Given a function like this: > > > def func(alpha, beta, gamma, delta=4, *args, **kw): > ... > > > which is called in some fashion: > > # say > func(1, 2, gamma=3, epsilon=5) > > which may or may not be valid: > > func(1, 2, alpha=0) > > how does Python match up the

Re: Looking for documentation on how Python assigns to function parameters

2017-03-01 Thread Steve D'Aprano
On Wed, 1 Mar 2017 10:18 pm, Steve D'Aprano wrote: [...] > how does Python match up the formal parameters in the `def` statement with > the arguments given in the call to `func`? > > I'm looking for official docs, if possible. So far I've had no luck > finding anything. Never mind, I found it

Looking for documentation on how Python assigns to function parameters

2017-03-01 Thread Steve D'Aprano
Given a function like this: def func(alpha, beta, gamma, delta=4, *args, **kw): ... which is called in some fashion: # say func(1, 2, gamma=3, epsilon=5) which may or may not be valid: func(1, 2, alpha=0) how does Python match up the formal parameters in the `def` statement with the

[issue29640] _PyThreadState_Init and fork race leads to inconsistent key list

2017-03-01 Thread Petr Viktorin
Petr Viktorin added the comment: Here is a proof of concept patch from Jaroslav Škarvada. It fixes the problem by holding the mutex used for PyThread_create_key while forking. To make it more than PoC it needs adding _PyThread_AcquireKeyLock and _ReleaseKeyLock (similar to

Re: Exposing all methods of a class

2017-03-01 Thread Terry Reedy
The class listing provided by the pydoc module browser, also in help(someclass), do list all methods. Try >>> import tkinter >>> help(tkinter.Text) for instance. On 2/28/2017 7:16 PM, Rick Johnson wrote: IDLE has a "class browser" feature (@GUI_XY = File-> Class_Browser) that displays a GUI

[issue29680] gdb/libpython.py does not work with gdb 7.2

2017-03-01 Thread STINNER Victor
STINNER Victor added the comment: It's a regression introduced in Python 3.6 by CPython change: https://github.com/python/cpython/commit/d7d2bc8798da3b083e383e949ba01d61b78e4e4d gdb.error was introduced in gdb 7.3 by the commit 07ca107c2d958b45633ef0cdcce7219a95f0cf01:

[issue29677] 'round()' accepts a negative integer for ndigits

2017-03-01 Thread Vedran Čačić
Vedran Čačić added the comment: This is one of those things that show Python being extremely consistent within itself. Of course, docs should be clarified if needed, but the feature is desirable and useful. -- nosy: +veky ___ Python tracker

[issue27645] Supporting native backup facility of SQLite

2017-03-01 Thread Lele Gaifax
Lele Gaifax added the comment: Thank you Aviv, I applied your suggestions and opened a PR. -- ___ Python tracker ___

[issue27645] Supporting native backup facility of SQLite

2017-03-01 Thread Roundup Robot
Changes by Roundup Robot : -- pull_requests: +315 ___ Python tracker ___

[issue29684] Minor regression in PyEval_CallObjectWithKeywords()

2017-03-01 Thread INADA Naoki
Changes by INADA Naoki : -- pull_requests: +314 ___ Python tracker ___ ___

[issue29684] Minor regression in PyEval_CallObjectWithKeywords()

2017-03-01 Thread INADA Naoki
New submission from INADA Naoki: This issue is spin off issue29548. PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs) should raise TypeError when kwargs is not dict. But after this commit [1], assert(PyDict_Check(kwargs)) can be called when args==NULL. [1]

[issue29683] _PyCode_SetExtra behaviour wrong on allocation failure and after realloc

2017-03-01 Thread Brian Coleman
Brian Coleman added the comment: I have now added a Github pull request here: https://github.com/python/cpython/pull/376 -- ___ Python tracker ___

[issue29683] _PyCode_SetExtra behaviour wrong on allocation failure and after realloc

2017-03-01 Thread Brian Coleman
Changes by Brian Coleman : -- pull_requests: +312 ___ Python tracker ___ ___

[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-03-01 Thread Marco Buttu
Marco Buttu added the comment: > I don't see this point. The other section titles are not about > loops. The preceding chapter introduces while loops as a loop, > not a statement, and this chapter talks about while and for > loops further down the page. What I mean is that currently in every

[issue29683] _PyCode_SetExtra behaviour wrong on allocation failure and after realloc

2017-03-01 Thread Brian Coleman
New submission from Brian Coleman: On PyMem_Malloc failure, _PyCode_SetExtra should set co_extra->ce_size = 0. On PyMem_Realloc failure, _PyCode_SetExtra should set co_extra->ce_size = 0. On PyMem_Realloc success, _PyCode_SetExtra should set all unused slots in co_extra->ce_extras to NULL. I

[issue29671] Add function to gc module to check if any reference cycles have been reclaimed.

2017-03-01 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___

[issue29302] add contextlib.AsyncExitStack

2017-03-01 Thread Alexander Mohr
Alexander Mohr added the comment: Thanks for the feedback Nick! If I get a chance I'll see about refactoring my gist into a base class and two sub-classes with the async supporting non-async but not vice-versa. I think it will be cleaner. Sorry I didn't spend too much effort on the existing

[issue29594] implementation of __or__ in enum.auto

2017-03-01 Thread Ethan Furman
Ethan Furman added the comment: aenum 2.0 [1] has been released. Because it also covers Python 2.7 I had to enhance its auto() to cover |, &, ^, and ~ so that Enum classes could be properly created. At this moment your choices are to use odd naming or aenum (with its enhanced auto). [1]

Re: How to flatten only one sub list of list of lists

2017-03-01 Thread Sayth Renshaw
> Replace the slice row[index:index+1] with row[index], either by building a > new list or in place: > > >>> def show(data): > ...for item in data: print(item) > ... > >>> def flatten_one(rows, index): > ... return [r[:index] + r[index] + r[index+1:] for r in rows] > ... > >>> def