Vulture 0.6 released

2014-09-08 Thread Jendrik Seipp

vulture - Find dead code


vulture finds unused classes, functions and variables in Python code. 
This helps you cleanup and find errors in your programs. If you run it 
on both your library and test suite you can find untested code.


Due to Python's dynamic nature it is impossible to find all dead code 
for a static code analyzer like vulture, because it ignores scopes and 
scans only token names. Additionally some dynamic items that are not 
explicitly mentioned in the code may be incorrectly reported as dead code.



Download

http://pypi.python.org/pypi/vulture


Features

- Fast: Uses static code analysis
- Lightweight: Only one module
- Complements pyflakes and has the same output syntax
- Supports Python 2.6, 2.7 and 3.x


News

* Ignore function names starting with test_.
* Parse variable names in new format strings (e.g. This is 
{x}.format(x=nice)).

* Only parse alphanumeric variable names in format strings and ignore types.
* Abort with exit code 1 on syntax errors.
* Support installation under Windows by using setuptools (thanks Reuben 
Fletcher-Costin).



Cheers,
Jendrik





--
https://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: ANN: wxPython 3.0.1.0 release

2014-09-08 Thread Marco Prosperi

If I drag a page in the agw.aui notebook I get an exception (it's a traced 
bug). This is an issue that Andrea has fixed some weeks ago but it seems 
left out of this build

Marco


On Sunday, September 7, 2014 6:50:07 AM UTC+2, Robin Dunn wrote:

 Announcing 
 -- 

 wxPython 3.0.1.0 (classic) has been released and is now available for 
 download at http://wxpython.org/download.php.  (Finally! Sorry, but life 
 and work has kept me busy.)  No new features to speak of, but there 
 has been lots of bug fixes in wxWidgets and a few on the wxPython side 
 too. 

 Various binaries are available for 32-bit and 64-bit Windows, and also 
 for OSX using the Carbon and Cocoa APIs, for Python 2.6 and 2.7. 
 Source code is also available at http://wxpython.org/download.php of 
 course, for building your own. 


 What is wxPython? 
 - 

 wxPython is a GUI toolkit for the Python programming language. It 
 allows Python programmers to create programs with a robust, highly 
 functional graphical user interface, simply and easily. It is 
 implemented as a set of Python extension modules that wrap the GUI 
 components of the popular wxWidgets cross platform library, which is 
 written in C++. 

 wxPython is a cross-platform toolkit. This means that the same program 
 will usually run on multiple platforms without modifications. 
 Currently supported platforms are 32-bit and 64-bit Microsoft Windows, 
 most Linux or other Unix-like systems using GTK2, and Mac OS X 10.4+. 
 In most cases the native widgets are used on each platform to provide 
 a 100% native look and feel for the application. 



 -- 
 Robin Dunn 
 Software Craftsman 
 http://wxPython.org 

-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


devpi-2.0.3, devpi-server-2.0.6 and devpi-web-2.1.0 released

2014-09-08 Thread Florian Schulze
The new devpi releases devpi-2.0.3, devpi-server-2.0.6 and 
devpi-web-2.1.0 contain several fixes for the private pypi server 
system/self-updating pypi cache, see the changelog below for details.


The major new change in devpi-web is support for theming, see here for 
more details:


http://doc.devpi.net/latest/web.html#themes

And general documentation at:

http://doc.devpi.net/latest

with tutorials and quickstart documents for particular scenarios.

Note that no export/import procedure is needed if you are already 
running
a 2.X devpi-server.  If upgrading from a 1.2 devpi-server install, you 
need

to upgrade using these instructions:

http://doc.devpi.net/latest/quickstart-server.html#versioning-exporting-and-importing-server-state

Regards,
Florian Schulze

devpi-server 2.0.6
--

- log version information of all found plugins on startup.


devpi-web 2.1.0
---

- allow overwriting of templates for theming.

- show version info for currently active packages/plugins.

- fix encoding issue when loading long description with Python 3.4 on 
Windows.


- requires devpi-server 2.0.6.
--
https://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


cliff 1.7.0 released

2014-09-08 Thread Doug Hellmann
The Oslo team is pleased to release version 1.7.0 of cliff.

This release includes:

$ git log --oneline --no-merges 1.6.1..1.7.0
42675b2 Add release notes for 1.7.0
86fe20f Fix stable integration tests
bf0c611 Updated from global requirements
ac1347c Clean up default tox environment list
db4eef5 Do not allow wheels for stable tests
6bb6944 Set the main logger name to match the application
c383448 CSV formatter should use system-dependent line ending
e3bec7b Make show option compatible with Python 2.6.
9315a32 Use six.add_metaclass instead of __metaclass__
9f331fb fixed typos found by RETF rules
d150502 The --variable option to shell format is redundant
69966df Expose load_commands publicly
a37ef60 Fix wrong method name assert_called_once
4bdf5fc Updated from global requirements
90ea2b2 Fix pep8 failures on rule E265

Please report issues to the bug tracker: https://bugs.launchpad.net/python-cliff

Doug
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


stevedore 1.0.0.0a2 released -- juno rc1

2014-09-08 Thread Doug Hellmann
The Oslo team is pleased to release version 1.0.0.0a2 of stevedore, our first 
release candidate for stevedore for the OpenStack Juno cycle.

This release includes:

$ git log --oneline --no-merges 1.0.0.0a1..1.0.0.0a2
860bd8f Build universal wheels

Please report issues to the stevedore bug tracker: 
https://bugs.launchpad.net/python-stevedore

Doug
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: weakref, memory management and execution slow down in PyQt4

2014-09-08 Thread kjs


Michael Torrie:
 On 09/07/2014 01:11 PM, kjs wrote:
 Thanks for the advice. I commented out the graph generation and PyQt call

 self.app.processEvents()

 where in the class __init__

 self.app = QtGui.QApplication(sys.argv)

 This stopped the weakref proliferation. All other objects grow and
 shrink in number as expected.
 
 Can you make an absolute minimal example with no widgets save the graph
 itself?  You could then go to the PyQt folks with that.  Could be a bug,
 or could be an improper use of something by your code.  This is one of
 the problems with using Qt in other languages: it's not a perfect fit
 for Python's object model as it is C++-based.  So you have to think like
 a C++ programmer, and you might have to manage some resources manually,
 unlike normal Python objects which for the most part take care of
 themselves.
 

The code is minimal[0]. The only other widgets are a start button that
fires off the plotting and a stop button that calls sys.exit().

Lines 112-114 appear to be causing the weakref proliferation.

I do not doubt that I could be using PyQt4 incorrectly. I'll send a
message to the pyqt mailing list as well.

 Also you could try a minimal example using PySide instead of PyQt and
 see if that also manifests the leak.  If so, then the problem could be
 in Qt itself.  Though I suspect the problem is some kind of impedance
 mismatch between C++ and Python.
 

Thanks much,
Kevin

[0]
https://github.com/kevinjos/kaggle-aes-seizure-prediction/blob/master/explore.py


0x8A61431E.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to turn a string into a list of integers?

2014-09-08 Thread Terry Reedy

On 9/8/2014 1:44 AM, Marko Rauhamaa wrote:

Chris Angelico ros...@gmail.com:


The original question was regarding storage - how PEP 393 says that
strings will be encoded in memory in any of three ways (Latin-1,
UCS-2/UTF-16, or UCS-4/UTF-32). But even in our world, that is not
what a string *is*, but only what it is made of.


I'm a bit surprised that kind of CPython implementation detail would go
into a PEP. I had thought PEPs codified Python independently of CPython.


There are multiple PEP that are not strictly about Python the language: 
meta-peps, informational peps, and others about the cpython api, 
implementation, and distribution issues. 393 is followed by

397  Python launcher for Windows  Hammond, v. Löwis
http://legacy.python.org/dev/peps/

The PEP process is a tool for the core development team and the product 
is documentation of decisions and actions thereby



But maybe CPython is to Python what England is to the UK: even the
government is having a hard time making a distinction.


We don't.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread David H. Lipman

From: Ned Batchelder n...@nedbatchelder.com


On 9/7/14 5:41 PM, Tony the Tiger wrote:


Now, kindly get the fuck outta here, you fucking retard!

  /Grrr

That was unnecessary, ineffective, and totally outside the bounds of this 
community's norms: http://www.python.org/psf/codeofconduct


Behave.




He posted via Astraweb to Usenet.  He is not using GMane or a listserver.

The Python.Org CoC does not extend to Usenet unless a FAQ is properly 
published for news:comp.lang.python


You need to filter out Google Groupers who are the cause of spam and abuse.


--
Dave
Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk
http://www.pctipp.ch/downloads/dl/35905.asp 


--
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread Joshua Landau
On 8 September 2014 12:54, David H. Lipman DLipman~nospam~@verizon.net wrote:
 From: Ned Batchelder n...@nedbatchelder.com
 On 9/7/14 5:41 PM, Tony the Tiger wrote:

 Now, kindly get the fuck outta here, you fucking retard!

 That was unnecessary, ineffective, and totally outside the bounds of this
 community's norms: http://www.python.org/psf/codeofconduct

 The Python.Org CoC does not extend to Usenet unless a FAQ is properly
 published for news:comp.lang.python

I don't think allowing people to be disrespectful because they
accessed the forum in a different way is a good idea. I'd rather we
all just be nice.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread Chris Angelico
On Mon, Sep 8, 2014 at 10:41 PM, Joshua Landau jos...@landau.ws wrote:
 I don't think allowing people to be disrespectful because they
 accessed the forum in a different way is a good idea. I'd rather we
 all just be nice.

May I just point out that lots of us didn't even see the original
post? If Tony the Tiger hadn't bothered to quote it, it would
quietly have dropped into oblivion. Let's let this thread finish and
have done with the whole matter.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread Mark Lawrence

On 08/09/2014 14:06, Chris Angelico wrote:

On Mon, Sep 8, 2014 at 10:41 PM, Joshua Landau jos...@landau.ws wrote:

I don't think allowing people to be disrespectful because they
accessed the forum in a different way is a good idea. I'd rather we
all just be nice.


May I just point out that lots of us didn't even see the original
post? If Tony the Tiger hadn't bothered to quote it, it would
quietly have dropped into oblivion. Let's let this thread finish and
have done with the whole matter.

ChrisA



+1

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread Gene Heskett
On Monday 08 September 2014 09:06:46 Chris Angelico did opine
And Gene did reply:
 On Mon, Sep 8, 2014 at 10:41 PM, Joshua Landau jos...@landau.ws wrote:
  I don't think allowing people to be disrespectful because they
  accessed the forum in a different way is a good idea. I'd rather we
  all just be nice.
 
 May I just point out that lots of us didn't even see the original
 post? If Tony the Tiger hadn't bothered to quote it, it would
 quietly have dropped into oblivion. Let's let this thread finish and
 have done with the whole matter.
 
 ChrisA

I am with you on that Chris, nothing with googlegroups in a header last 
long enough to even be seen by fetchmail, its in a mailfilter rule and 
gets nuked on the server.  And life is much simpler.

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread Grant Edwards
On 2014-09-08, Gene Heskett ghesk...@wdtv.com wrote:
 On Monday 08 September 2014 09:06:46 Chris Angelico did opine
 And Gene did reply:
 On Mon, Sep 8, 2014 at 10:41 PM, Joshua Landau jos...@landau.ws wrote:

  I don't think allowing people to be disrespectful because they
  accessed the forum in a different way is a good idea. I'd rather we
  all just be nice.
 
 May I just point out that lots of us didn't even see the original
 post? If Tony the Tiger hadn't bothered to quote it, it would
 quietly have dropped into oblivion. Let's let this thread finish and
 have done with the whole matter.

 I am with you on that Chris, nothing with googlegroups in a header last 
 long enough to even be seen by fetchmail, its in a mailfilter rule and 
 gets nuked on the server.  And life is much simpler.

I plonked everything coming from Google Groups years ago. I never
regretted it for a second, and can recommend doing so without
reservation.  All you have to do is toss anything with a Message-ID
ending in googlegroups.com. For the benefit of anybody using slrn to
read the Usenet group (or presumably reading the mailing list via
gmane), here's the .score file rule:

[*]
Score:: =-
 Message-ID: .*googlegroups.com
 
-- 
Grant Edwards   grant.b.edwardsYow! Now KEN and BARBIE
  at   are PERMANENTLY ADDICTED to
  gmail.comMIND-ALTERING DRUGS ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: We made from water every living thing...

2014-09-08 Thread David H. Lipman

From: Chris Angelico ros...@gmail.com


On Mon, Sep 8, 2014 at 10:41 PM, Joshua Landau jos...@landau.ws wrote:

I don't think allowing people to be disrespectful because they
accessed the forum in a different way is a good idea. I'd rather we
all just be nice.


May I just point out that lots of us didn't even see the original
post? If Tony the Tiger hadn't bothered to quote it, it would
quietly have dropped into oblivion. Let's let this thread finish and
have done with the whole matter.

ChrisA


That true.

One should *never* quote spam.

--
Dave
Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk
http://www.pctipp.ch/downloads/dl/35905.asp
--
https://mail.python.org/mailman/listinfo/python-list


Newer Debian versions of python on older Debian distros?

2014-09-08 Thread Travis Griggs
(I realize that this may be seen as off topic for as a general python question, 
but given my historical experience with the Debian community’s predilection to 
answer all questions with a grumpy “go read the very very very very large and 
ever shifting fine manual”, I’m hoping for better luck here.)

Does anyone have experience with using newer versions of python debian packages 
(in particular, python3 and python3-bson-ext from ‘testing’) on older stable 
versions (‘wheezy’ in this case)? If someone’s figured out how to do this 
easily, I’d love to hear the recipe!

TIA


-- 
https://mail.python.org/mailman/listinfo/python-list


Installing Python 3

2014-09-08 Thread Ashley Forman
Hello,
  My name is Ashley Forman, and I am emailing because I cannot install
python onto my Mac laptop! I have installed Active-TCl 8.5 along with
Python 3.3 and tried with 3.4, and couldn't figure out a solution to my
problem. When I click on IDLE to open, it does not open at all. Therefore,
if you have any information that could help me, then I would really
appreciate it! Thank you!
Best,
Ashley Forman
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: weakref, memory management and execution slow down in PyQt4

2014-09-08 Thread Michael Torrie
On 09/07/2014 02:39 PM, kjs wrote:
 The code is minimal[0]. The only other widgets are a start button that
 fires off the plotting and a stop button that calls sys.exit().

Unfortunately there are no data files in your git repository so I can't
run it.

 
 Lines 112-114 appear to be causing the weakref proliferation.

Is there a reason you are using setattr and getattr instead of a proper
data structure?  both of those calls are rather expensive.  Would
probably be cheaper to use some kind of array, dictionary, or other
purpose-built data structure?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newer Debian versions of python on older Debian distros?

2014-09-08 Thread Chris Angelico
On Tue, Sep 9, 2014 at 5:04 AM, Travis Griggs travisgri...@gmail.com wrote:
 Does anyone have experience with using newer versions of python debian 
 packages (in particular, python3 and python3-bson-ext from ‘testing’) on 
 older stable versions (‘wheezy’ in this case)? If someone’s figured out how 
 to do this easily, I’d love to hear the recipe!


I don't know about grabbing from testing, because that's fraught with
peril... but there's a pretty easy way to get a newer Python: build
from source. Basically, the standard incantation:

$ sudo apt-get build-dep python3
$ hg clone http://hg.python.org/cpython
$ cd cpython
$ ./configure  make  sudo make install

(I like to separate the last three steps, but putting them together works too.)

Alternatively, you could just run Debian Jessie. I have a few Jessie
systems on the network, with a Python 3.4 IIRC, and there've been no
stability problems lately. Both options are pretty easy.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip install PyOpenGL have problem

2014-09-08 Thread Michael Torrie
On 09/06/2014 11:15 PM, วรรณพงษ์ ภัททิยไพบูลย์ wrote:
 pip install -U PyOpenGL PyOpenGL_accelerate 
 :(

I don't recognize that particular error message...

If you require assistance you need to copy and paste the output from the
command so people can know exactly what failed.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing Python 3

2014-09-08 Thread Ned Deily
In article 
cambegteobpypbyuyjnnknb+jwdwp6+axwhah9mxu-novrp-...@mail.gmail.com,
 Ashley Forman forma...@mail.chapman.edu wrote:
   My name is Ashley Forman, and I am emailing because I cannot install
 python onto my Mac laptop! I have installed Active-TCl 8.5 along with
 Python 3.3 and tried with 3.4, and couldn't figure out a solution to my
 problem. When I click on IDLE to open, it does not open at all. Therefore,
 if you have any information that could help me, then I would really
 appreciate it! Thank you!

Clicking on the IDLE icon is fine - unless it is doesn't work, in which 
case error messages associated with the failure may end up in a system 
log rather than being display directly to you.  It's easier to debug 
problems like this by launching IDLE from a terminal session than by 
double-clicking on it.  Assuming you installed Python 3.4 (3.4.1 is 
current) from one of the python.org installers, open a terminal shell 
window, for example by using the Terminal.app (found in 
/Applications/Utilities).  Then, in the shell window, try typing:

/usr/local/bin/idle3.4 

If IDLE fails, there should be some sort of error message in the 
terminal window.  If it is not clear what the problem is, copy and paste 
them to the group here.

You can also just try launching Python itself and verify that it works 
without IDLE:

/usr/local/bin/python3.4

Good luck!

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: weakref, memory management and execution slow down in PyQt4

2014-09-08 Thread kjs
Thanks for the consideration Michael. If you do get the data, and are
able to run the code, let me know if you notice anything interesting.


Michael Torrie:
 On 09/07/2014 02:39 PM, kjs wrote:
 The code is minimal[0]. The only other widgets are a start button that
 fires off the plotting and a stop button that calls sys.exit().
 
 Unfortunately there are no data files in your git repository so I can't
 run it.

The data is available from the internet[0] in the form of 3+GB gziped
blobs. In case you don't want to register an account with Kaggle and
download 3GB to execute the code, I have uploaded a sample file to a
Tahoe LAFS grid accessible via tor. If you're interested in downloading
the data, please let me know and I'll share the read capability with
you. Additionally, I should write some tests the use mock data. I'll let
you know if I get around to this.

 

 Lines 112-114 appear to be causing the weakref proliferation.
 
 Is there a reason you are using setattr and getattr instead of a proper
 data structure?  both of those calls are rather expensive.  Would
 probably be cheaper to use some kind of array, dictionary, or other
 purpose-built data structure?
 

You're right, a dictionary can do everything I need and more. This
happened to be the first thing I thought of, and I didn't imagine it
would be very expensive. I figured it was simply a different way of
defining and retrieving a class variable. IE setattr(self, foo, True) ==
self.foo = True.

Thanks,
Kevin

[0] http://www.kaggle.com/c/seizure-prediction/data


0x8A61431E.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip install PyOpenGL have problem

2014-09-08 Thread Michael Torrie
On 09/08/2014 08:18 PM, Michael Torrie wrote:
 On 09/06/2014 11:15 PM, วรรณพงษ์ ภัททิยไพบูลย์ wrote:
 pip install -U PyOpenGL PyOpenGL_accelerate 
 :(
 
 I don't recognize that particular error message...
 
 If you require assistance you need to copy and paste the output from the
 command so people can know exactly what failed.

You might try googling as well:

https://www.google.ca/search?q=python3+pip+windows

There seems to be a number of pages that talk about installing pip if
it's not there (using easy_install if I recall correctly).

-- 
https://mail.python.org/mailman/listinfo/python-list


Passing a list into a list .append() method

2014-09-08 Thread JBB
I have a list with a fixed number of elements which I need to grow; ie. add
rows of a fixed number of elements, some of which will be blank.  

e.g. [['a','b','c','d'], ['A','B','C','D'], ['', 'aa', 'inky', ''], ['',
'bb', 'binky', ''], ... ]

This is a reduced representation of a larger list-of-lists problem that had
me running in circles today.  

I think I figured out _how_ to get what I want but I am looking to
understand why one approach works and another doesn't.

1) What does NOT work as desired:

proc_file = []
proc_file = [['a','b','c','d']]
proc_file.append(['A','B','C','D'])
blank_r = ['','','','']

qq = ['aa','bb','cc','dd']
rr = ['inky', 'binky', 'pinky', 'clyde']

for i,j in enumerate(zip(qq,rr)):
proc_file.append((blank_r))  # Add a row of blanks
proc_file[i+2][1] = j[0]
proc_file[i+2][2] = j[1]
print len(proc_file), blank_r, proc_file

print
print
proc_file

3 ['', 'aa', 'inky', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['',
'aa', 'inky', '']]
4 ['', 'bb', 'binky', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['',
'bb', 'binky', ''], ['', 'bb', 'binky', '']]
5 ['', 'cc', 'pinky', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['',
'cc', 'pinky', ''], ['', 'cc', 'pinky', ''], ['', 'cc', 'pinky', '']]
6 ['', 'dd', 'clyde', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['',
'dd', 'clyde', ''], ['', 'dd', 'clyde', ''], ['', 'dd', 'clyde', ''], ['',
'dd', 'clyde', '']]


Out[82]:

[['a', 'b', 'c', 'd'],
 ['A', 'B', 'C', 'D'],
 ['', 'dd', 'clyde', ''],
 ['', 'dd', 'clyde', ''],
 ['', 'dd', 'clyde', ''],
 ['', 'dd', 'clyde', '']]

2) What works as desired:

proc_file = []
proc_file = [['a','b','c','d']]
proc_file.append(['A','B','C','D'])
blank_r = ['','','','']

qq = ['aa','bb','cc','dd']
rr = ['inky', 'binky', 'pinky', 'clyde']

for i,j in enumerate(zip(qq,rr)):
proc_file.append(list(blank_r))  # Change it to list(blank_r) and it works
proc_file[i+2][1] = j[0]
proc_file[i+2][2] = j[1]
print len(proc_file), blank_r, proc_file

print
print
proc_file

3 ['', '', '', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['', 'aa',
'inky', '']]
4 ['', '', '', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['', 'aa',
'inky', ''], ['', 'bb', 'binky', '']]
5 ['', '', '', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['', 'aa',
'inky', ''], ['', 'bb', 'binky', ''], ['', 'cc', 'pinky', '']]
6 ['', '', '', ''] [['a', 'b', 'c', 'd'], ['A', 'B', 'C', 'D'], ['', 'aa',
'inky', ''], ['', 'bb', 'binky', ''], ['', 'cc', 'pinky', ''], ['', 'dd',
'clyde', '']]


Out[83]:

[['a', 'b', 'c', 'd'],
 ['A', 'B', 'C', 'D'],
 ['', 'aa', 'inky', ''],
 ['', 'bb', 'binky', ''],
 ['', 'cc', 'pinky', ''],
 ['', 'dd', 'clyde', '']]

 Due diligence

I've read extensively on how arguments are passed to functions but I don't
think they are completely applicable here (though interesting nevertheless)

http://www.jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/


https://www.udacity.com/wiki/common-python-pitfalls

and others.

It looks like .append binds blank_r to proc_file in 1).  I change proc_file
and blank_r changes along with it.  Should I expect this? I understand lists
are mutable but I didn't expect that they could be associated/bound in this
manner.

I first tried protecting blank_r by passing it as a tuple.  That caused an
expected mismatch error.

Next, I tried passing it as list(tuple(blank_r)) which worked.  Then, I
finally settled on 2) where I dispensed with the tuple conversion.







-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18766] IDLE: Autocomplete in editor doesn't work for un-imported modules

2014-09-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue is about name completion and not path completion. I have re-reviewed 
the patch, current code, current behavior, and the fetch_completions doctstring 
that more or less explains why name completion cannot reliably work given how 
Idle now works.

I would add to the docstring that even after running the editor file and before 
running anything else, there can still be problems.  If one adds 'from mod 
import SomeClass' and types 'SomeClass.', there will be no help.  This patch 
will not help either. Getting completions for 'sc.', where 'sc' is an instance 
of SomeClass, without running code, is an even harder problem. There is, in a 
sense, no substitute for running the code up to the point where name completion 
is wanted.  Perhaps an explicit Show Completions(Name completion seems fairly 
common; I wonder how other editors handle it.)

Idle once ran user code in the idle process, which meant that any module ever 
imported by running any editor buffer would still be in sys.modules. Thus 
looking for modules in the Idle process sys.modules was more or less guaranteed 
to work, and would substitute for the user __main__ module (within the Idle 
process) being cleared by running another editor buffer.

Idle now, without the -N option, runs edited files in a *new* user processes.  
The problem for name completion (and calltips, and shell interaction with the 
old process) is that Idle discards the previous user process.  So running file 
B discards the information needed for name completion with file A.  A possible 
solution to this is to keep a user process for each file and not discard 
information we may want.

I thought of this idea about a month ago because I am sometimes annoyed when 
running any file discards an interactive shell process I am not really done 
with.  After running a file, I sometimes retype or rerun code to recreate the 
bidings I had before running an editor file.  This change would also help this 
issue and a similar one with calltips.  I plan to make this proposal the 
subject of another issue.

If I open Idle with Shell and open a new editor window, then, as Phil noted, 
typing 're.' and waiting brings up a list of re attributes, whereas 'datetime.' 
does not.  A year ago, 'textwrap.' did not, whereas now it does, thus 
illustratig the arbitrary nature of current behavior.

Phil's proposal is to make 'datetime.' act like 're.' by importing datetime.  
There are two things I do not like about this.  First, if there is no 'import 
re' in the file, then putting, say, 're.DOTALL' into the file is a bug in that 
it will be a NameError when the file is run. I might rather make 'import re' 
work like 'import datetime', that is fail, by not using sys.module as a backup. 
Second, the import is done in a process that does not belong to the editor, 
adding a name binding where is does not belong, and will have to be done again 
when the file is run.

Phil notes that the current workaround it to do the import in the shell (which, 
as noted, does it in the wrong place) or run the file (which, as noted, deleted 
the current process).  If there were a separate process for each editor, then 
either running the process or doing the import would not have the problems 
listed above.  If we did do an auto import, it would be under the presumption 
that it would be imported into that particular process in a later run.  We 
could also think about doing something else, like checking whether 'import xxx' 
is in the file and either inserting it or at least warning the user to do so.

I would add to the docstring that even after running the editor file and before 
running anything else, there can still be problems.  If one adds 'from mod 
import SomeClass' and types 'SomeClass.', there will be no help.  This patch 
will not help either. Getting completions for 'sc.', where 'sc' is an instance 
of SomeClass, without running code, is an even harder problem. There is, in a 
sense, no substitute for running the code up to the point where name completion 
is wanted.  Perhaps an explicit Show Completions or Cntl-Space should do so.  
This would be more feasible with a separate process so it did not have the side 
effect of killing the existing user process.

Name completion seems fairly common; I wonder how other editors handle it.

---
In my previous post, I suggested that get_entity does too much by copying to 
namespaces into one, looking up one name, and discarding the new combined 
namespace.  Looking more, it also occurs to me that the eval is not needed, as 
eval(name, namespace) is the same as getattr(name, namespace). I believe the 
following would do what the current get_entity does. it now does.

def get_entity(name):  # should be a standalone utility function
try:
ob = __main__.__dict__[name]
except KeyError:
try:
ob = sys.modules[name]
except KeyError:
   raise NameError('cannot find %s' % name) from 

[issue22358] Unnecessary JUMP_FORWARD(0) (NOP) in if statements without else or elif

2014-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue11471.

Explicit check for NULL is not needed because the asdl_seq_LEN() macro checks 
its argument for NULL.

--
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - If without else generates redundant jump
versions:  -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22358
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11471] If without else generates redundant jump

2014-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

Attila Fazekas just has provided almost the same patch in issue22358.

--
stage: patch review - commit review
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11471
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21112] 3.4 regression: unittest.expectedFailure no longer works on TestCase subclasses

2014-09-08 Thread Michael Foord

Michael Foord added the comment:

The patch looks good to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21112
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20071] What should happen if someone runs ./python -m ensurepip in the build environment?

2014-09-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +dstufft, ncoghlan, ned.deily
versions: +Python 2.7, Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20071
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20417] ensurepip should not be installed with --without-ensurepip

2014-09-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20417
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22359] Remove incorrect uses of recursive make

2014-09-08 Thread Jonas Wagner

New submission from Jonas Wagner:

The attached patch fixes issues with Python's Makefile, which manifest when 
doing parallel builds. The Makefile invoked make recursively for some 
targets. This caused some files (which were depended upon by multiple targets) 
to be built by both the original make and the sub-make.

Besides duplicate work, this caused failed builds with non-threadsafe compilers.

The proposed patch removes recursive calls to make, and instead builds all 
targets in the same make process.

--
components: Build
files: makefile_parallel.patch
keywords: patch
messages: 226563
nosy: Sjlver
priority: normal
severity: normal
status: open
title: Remove incorrect uses of recursive make
type: compile error
versions: Python 3.5
Added file: http://bugs.python.org/file36570/makefile_parallel.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22359
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck

New submission from Christoph Wruck:

Currently we have a split function which splits a str/bytestr into
chunks of their underlying data. This works great for the most tivial jobs.
But there is no possibility to pass an offset parameter into the split
function which indicates the next user-defined starting index.

Actually the next starting position will be build upon the last starting
position (of found sep.) + separator length + 1.

It should be possible to manipulate the next starting index by changing this
behavior into:

last starting position (of found sep.) + separator length + OFFSET.

NOTE: The slicing start index (for substring) stay untouched.

This will help us to solve splitting sequences with one or more consecutive
separators. The following demonstrates the actually behavior.

 s = 'abc;;def;hij'
 s.split(';')
['abc', '', 'def', 'hij']

This works fine for both str/bytes values.
The following demonstrates an offset variant of split function.

 s = 'abc;;def;hij'
 s.split(';', offset=1)
['abc', ';def', 'hij']

The behavior of maxcount/None sep. parameter should be generate the same
output as before.

A change will be affect (as far as I can see):
- split.h
- split_char/rsplit_char
- split/rsplit

--
messages: 226564
nosy: cwr
priority: normal
severity: normal
status: open
title: Adding manually offset parameter to str/bytes split function
type: enhancement
versions: Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19693] make altinstall make install behaviour differs from make install

2014-09-08 Thread Nick Coghlan

Nick Coghlan added the comment:

No change for 3.x (unless something changed on the pip side that I'm not
aware of).

For 2.7, the Makefile changes, at least for the install and altinstall
targets, were deliberately excluded from the backport PEP.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19693
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20417] ensurepip should not be installed with --without-ensurepip

2014-09-08 Thread Nick Coghlan

Nick Coghlan added the comment:

As Donald notes, this was explicitly covered in the PEP: the onus is on the 
distros to make ensurepip and pyvenv work in a way that complies with their 
debundling requirements (e.g. by using rewheel, or redirecting to the system 
installer).

The --without-ensurepip flag is there to disable running it at install time. 
Fully removing the ensurepip module is not a supported configuration - if a 
distro wants to do that, they're going to have to carry a patch.

--
resolution:  - wont fix
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20417
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22353] re.findall() documentation lacks information about finding THE LAST iteration of repeated capturing group (greedy)

2014-09-08 Thread Mateusz Dobrowolny

Mateusz Dobrowolny added the comment:

The official help
https://docs.python.org/3/library/re.html?highlight=findall#re.findall
in fact contains more information, especially the one mentioned in 
http://bugs.python.org/issue3384.

Regarding my issue - I am afraid it was my misunderstanding, because it looks 
like Regular Expressions return always LAST match and Python re.findall reutrns 
what it is said to be: the list of groups.
And since I repeat a captured group, I get only the last match.

More here for example here:
http://www.regular-expressions.info/captureall.html

I was learning regexp yesterday, and first I reported this without knowing 
everytnig about capturing groups.

If returning the last match for repeting a capturing group is defined within 
RegEx itself, than there is no need to mention it in Python documentation...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22353
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22361] Ability to join() threads in concurrent.futures.ThreadPoolExecutor

2014-09-08 Thread Luca Falavigna

New submission from Luca Falavigna:

I have a program which waits for external events (mostly pyinotify events), and 
when events occur a new worker is created using 
concurrent.futures.ThreadPoolExecutor. The following snippet represents shortly 
what my program does:

from time import sleep
from concurrent.futures import ThreadPoolExecutor

def func():
print(start)
sleep(10)
print(stop)

ex = ThreadPoolExecutor(1)

# New workers will be scheduled when an event
# is triggered (i.e. pyinotify events)
ex.submit(func)

# Dummy sleep
sleep(60)

When func() is complete, I'd like the underlying thread to be terminated. I 
realize I could call ex.shutdown() to achieve this, but this would prevent me 
from adding new workers in case new events occur. Not calling ex.shutdown() 
leads to have unfinished threads which pile up considerably:

(gdb) run test.py
Starting program: /usr/bin/python3.4-dbg test.py
[Thread debugging using libthread_db enabled]
[New Thread 0x7688e700 (LWP 17502)]
start
stop
^C
Program received signal SIGINT, Interrupt.
0x76e41963 in select () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) info threads
  Id   Target Id Frame
  2Thread 0x7688e700 (LWP 17502) python3.4-dbg 0x77bce420 in 
sem_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
* 1Thread 0x77ff1700 (LWP 17501) python3.4-dbg 0x76e41963 in 
select () from /lib/x86_64-linux-gnu/libc.so.6
(gdb)

Would it be possible to add a new method (or a ThreadPoolExecutor option) which 
allows to join the underlying thread when the worker function returns?

--
components: Library (Lib)
messages: 226569
nosy: dktrkranz
priority: normal
severity: normal
status: open
title: Ability to join() threads in concurrent.futures.ThreadPoolExecutor
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22361
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I'm afraid I don't understand the purpose of this feature request, or what the 
behaviour is.

You show a simple example:

 s = 'abc;;def;hij'
 s.split(';', offset=1)
['abc', ';def', 'hij']

but I don't understand why you want to keep the second semi-colon. I would have 
thought this would be more useful:

# treat runs of the separator as if it were a single separator
['abc', 'def', 'hij']


It might help if you explain under what circumstances you would use this. Also, 
how does the caller choose a value for offset? Say, I read a string from a data 
file, or from the user. How do I know what offset to use?

I'm not sure I understand what this offset parameter is supposed to do in 
general. Here are some examples showing what I think you want, can you tell me 
if I'm right?

'spam--eggs--cheesetoast'.split('-', offset=1)
-- ['spam', '-eggs', '-cheese', '-', '-toast']


'spam--eggs--cheese--toast'.split('-', offset=8)
-- ['spam', '-eggs--cheese', '-toast']

--
nosy: +steven.daprano

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22362] Warn about octal escapes 0o377 in re

2014-09-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently the re module accepts octal escapes from \400 to \777, but ignore 
highest bit.

 re.search(r'\542', 'abc')
_sre.SRE_Match object; span=(1, 2), match='b'

This behavior looks surprising and is inconsistent with the regex module which 
preserve highest bit. Such escaping is not portable across different regular 
exception engines.

I propose to add a warning when octal escape value is larger than 0o377. Here 
is preliminary patch which adds UserWarning. Or may be better to emit 
DeprecationWarning and then replace it by ValueError in future releases?

--
components: Library (Lib), Regular Expressions
files: re_octal_escape_overflow.patch
keywords: patch
messages: 226570
nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Warn about octal escapes  0o377 in re
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36571/re_octal_escape_overflow.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Such problems are solved by using regular expressions.

 re.findall('(?:^|(?=;)).?[^;]*', 'abc;;def;hij')
['abc', ';def', 'hij']

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22355] inconsistent results with inspect.getsource() / inspect.getsourcelines()

2014-09-08 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +yselivanov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22355
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22363] argparse AssertionError with add_mutually_exclusive_group and help=SUPPRESS

2014-09-08 Thread Zacrath

New submission from Zacrath:

Executing the attached script causes an AssertionError.

Traceback (most recent call last):
  File bug.py, line 18, in module
parser.format_usage()
  File /usr/lib/python3.4/argparse.py, line 2318, in format_usage
return formatter.format_help()
  File /usr/lib/python3.4/argparse.py, line 287, in format_help
help = self._root_section.format_help()
  File /usr/lib/python3.4/argparse.py, line 217, in format_help
func(*args)
  File /usr/lib/python3.4/argparse.py, line 338, in _format_usage
assert ' '.join(opt_parts) == opt_usage
AssertionError

The script was tested in a clean Python installation.

If any of the arguments are removed, there is no AssertionError exception.
If help=SUPPRESS is removed, there is no AssertionError exception.

This bug appears to have existed since Python 3.2, the first version that 
included argparse.

--
files: bug.py
messages: 226572
nosy: Zacrath, bethard
priority: normal
severity: normal
status: open
title: argparse AssertionError with add_mutually_exclusive_group and 
help=SUPPRESS
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36572/bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22363
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20071] What should happen if someone runs ./python -m ensurepip in the build environment?

2014-09-08 Thread Nick Coghlan

Nick Coghlan added the comment:

The whole sys.path initialisation scheme is pretty broken when running from a 
source checkout, so the short answer is it won't work, and it isn't really 
fixable in a maintenance release.

System Python 3:

sys.path = [
'/home/ncoghlan/devel/py3k',
'/usr/lib64/python33.zip',
'/usr/lib64/python3.3',
'/usr/lib64/python3.3/plat-linux',
'/usr/lib64/python3.3/lib-dynload',
'/home/ncoghlan/.local/lib/python3.3/site-packages',
'/usr/lib64/python3.3/site-packages',
'/usr/lib/python3.3/site-packages',
]

My source checkout:

sys.path = [
'/home/ncoghlan/devel/py3k',
'/usr/local/lib/python35.zip',
'/home/ncoghlan/devel/py3k/Lib',
'/home/ncoghlan/devel/py3k/Lib/plat-linux', 
'/home/ncoghlan/devel/py3k/build/lib.linux-x86_64-3.5',
'/home/ncoghlan/devel/py3k/Modules',
'/home/ncoghlan/.local/lib/python3.5/site-packages',
]   
 

We should probably have an explicit check for that in ensurepip so it bails out 
as an unsupported operation rather than doing something weird. Looking in 
sys.path for os.path.join(os.path.dirname(sys.executable), 'Lib') should be a 
fairly reliable indicator that we're running from a source checkout.

Actually *fixing* it to do something sensible would require a lot of work on 
the sys.path initialisation code, and I frankly consider that impractical given 
the current state of getpath.c.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20071
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20071] What should happen if someone runs ./python -m ensurepip in the build environment?

2014-09-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Note that if I find time to implement the startup sequence redesign for PEP 
432/issue #22257 (which is finally starting to look like it may actually happen 
some time in the next few months), a proper fix may end up being possible for 
3.5.

We shouldn't bet on that, though, and the explicit failure is definitely the 
best we'll be able to do for 3.4 and the 2.7 backport.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20071
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22359] Remove incorrect uses of recursive make

2014-09-08 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +doko

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22359
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22364] Unify error messages of re and regex

2014-09-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In some cases standard re module and third-party regex modules raise exceptions 
with different error messages.

1. re.match(re.compile('.'), 'A', re.I)

  re:Cannot process flags argument with a compiled pattern
  regex: can't process flags argument with a compiled pattern

2. re.compile('(?Pfoo_123')

  re:unterminated name
  regex: missing 

3. re.compile('(?Pfoo_123a)(?P=foo_123')

  re:unterminated name
  regex: missing )

4. regex.sub('(?Pax)', r'\ga', 'xx')

  re:unterminated group name
  regex: missing 

5. re.sub('(?Pax)', r'\g', 'xx')

  re:unterminated group name
  regex: bad group name

6. re.sub('(?Pax)', r'\ga a', 'xx')

  re:bad character in group name
  regex: bad group name

7. re.sub('(?Pax)', r'\g-1', 'xx')

  re:negative group number
  regex: bad group name

8. re.compile('(?Pfoo_123a)(?P=!)')

  re:bad character in backref group name '!'
  regex: bad group name

9. re.sub('(?Pax)', r'\g', 'xx')

  re:missing group name
  regex: missing 

10. re.compile('a\\')
re.sub('x', '\\', 'x')

  re:bogus escape (end of line)
  regex: bad escape

11. re.compile(r'\1')

  re:bogus escape: '\1'
  regex: unknown group

12. re.compile('[a-')

  re:unexpected end of regular expression
  regex: bad set

13. re.sub(b'.', 'b', b'c')

  re:expected bytes, bytearray, or an object with the buffer interface, str 
found
  regex: expected bytes instance, str found

14. re.compile(r'\w', re.UNICODE | re.ASCII)

  re:ASCII and UNICODE flags are incompatible
  regex: ASCII, LOCALE and UNICODE flags are mutually incompatible

15. re.compile('(abc')

  re:unbalanced parenthesis
  regex: missing )

16. re.compile('abc)')

  re:unbalanced parenthesis
  regex: trailing characters in pattern

17. re.compile(r'((.)\1+)')

  re:cannot refer to open group
  regex: can't refer to an open group

Looks as in one case re messages are better, and in other cases regex messages 
are better. In any case it would be good to unify error messages in both 
modules.

--
components: Library (Lib), Regular Expressions
messages: 226575
nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Unify error messages of re and regex
type: enhancement
versions: Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22364
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22364] Unify error messages of re and regex

2014-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

18. re.compile(r'.???')

  re:multiple repeat
  regex: nothing to repeat at position 3

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22364
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22327] test_gdb failures on Ubuntu 14.10

2014-09-08 Thread Philippe Devalkeneer

Changes by Philippe Devalkeneer phil.le.bienheur...@gmail.com:


--
nosy: +flupke

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22327
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck

Christoph Wruck added the comment:

Hi Steven

exactly - you're right with this.

'spam--eggs--cheesetoast'.split('-', offset=1)
-- ['spam', '-eggs', '-cheese', '-', '-toast']

'spam--eggs--cheese--toast'.split('-', offset=8)
-- ['spam', '-eggs--cheese', '-toast']

Okay - the name offset might be an unfortunate choice and you are right that 
this could be hard to understand for a caller. 

One more examples:

The following removes all escape signs to process the octal escape sequences in 
a second way if the first three characters are digits.

'spam\\055055-eggs-rest'.split('\\', offset=1)
-- ['spam', '055', '\\055-eggs-', '\\rest']

# could speed up the split built-in func if a caller knows that every chunk is 
3 chars long?
'tic-tac-toe'.split('-', offset=3)

A caller could use the offset parameter to keep all separators between
the last found and offset if it's a part of a chunk. Or if he awaiting a 
separator followed by itself which should be keeped - in doubt with the same 
length of separator.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14076] sqlite3 module ignores placeholders in CREATE TRIGGER code

2014-09-08 Thread Philippe Devalkeneer

Changes by Philippe Devalkeneer phil.le.bienheur...@gmail.com:


--
nosy: +flupke

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14076
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22240] argparse support for python -m module in help

2014-09-08 Thread Miki Tebeka

Miki Tebeka added the comment:

Anything else I need to solve to get this patch accepted?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22240
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread R. David Murray

R. David Murray added the comment:

If you want to do complex splitting, the supported way to do so is re.split.  
Feel free to take this to python-ideas if you think there is sufficient reason 
for baking a particular additional splitting functionality into str.split.

--
nosy: +r.david.murray
resolution:  - rejected
stage:  - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22240] argparse support for python -m module in help

2014-09-08 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22240
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22360] Adding manually offset parameter to str/bytes split function

2014-09-08 Thread Christoph Wruck

Christoph Wruck added the comment:

Serhiy, you will be right if you've to split a complex string such spliting 
strings with more than one separator. In this case I would prefer a regex bases 
solution too. Otherwise we could actually use the re-lib for every of those 
jobs without using the fast built-in str/bytes split function. Unfortunately 
lags re.split/findall again str/bytes split function.

--
resolution: rejected - 
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22360
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21929] Rounding properly

2014-09-08 Thread Robert

Robert added the comment:

I'm not sure if this is related or not, but on 3.4.1 I get the following: 

 print(round(float(3/2)))
2 (as expected)
 print(round(float(5/2)))
2 (expected 3, as float should round .5 up)

--
nosy: +fenofonts

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21929
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22359] Remove incorrect uses of recursive make

2014-09-08 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22359
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11471] If without else generates redundant jump

2014-09-08 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11471
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
assignee: michael.foord - barry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
versions:  -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22365] SSLContext.load_verify_locations(cadata) does not accept CRLs

2014-09-08 Thread Ralph Broenink

New submission from Ralph Broenink:

Issue #18138 added support for the cadata argument in 
SSLContext.load_verify_locations. However, this argument does not support 
certificate revocation lists (CRLs) to be added (at least not in PEM format):

ssl.SSLError: [PEM: NO_START_LINE] no start line (_ssl.c:2633)

The documentation of this method is rather vague on this subject and does not 
state explicitly this is not allowed:

This method can also load certification revocation lists (CRLs) in PEM or 
or DER format. In order to make use of CRLs, SSLContext.verify_flags must be 
configured properly.

I think CRLs should be allowed to be loaded using the cadata argument. However, 
the documentation could use some polishing too: At least one of cafile or 
capath must be specified. is outdated since the introduction of cadata.

--
components: Extension Modules
messages: 226582
nosy: Ralph.Broenink
priority: normal
severity: normal
status: open
title: SSLContext.load_verify_locations(cadata) does not accept CRLs
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22365
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22365] SSLContext.load_verify_locations(cadata) does not accept CRLs

2014-09-08 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex, christian.heimes, dstufft, giampaolo.rodola, janssen, pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22365
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21929] Rounding properly

2014-09-08 Thread Geoffrey Spear

Geoffrey Spear added the comment:

Robert:

That is not related. Python 3's round() function, as documented, rounds halves 
to the even choice; what you describe is the expected behavior.

--
nosy: +geoffreyspear

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21929
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22339] Incorrect behavior when subclassing enum.Enum

2014-09-08 Thread Kiss György

Kiss György added the comment:

Thanks for the tip! That looks much better.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22339
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

One thing I really do not like about Rob's last patch is that it exacerbates 
the documentation discrepancy for loadTestsFromModule().  As previously 
mentioned, use_load_tests arg was already not documented, and now the patch 
adds another undocumented pattern default arg.  Undocumented unofficial APIs 
are really a fib - we treat them as official APIs for backward compatibility 
reasons anyway, so I think it behooves us to document them.

In the same vein, the load_tests Protocol really should tell the truth about 
its third argument - i.e. it will not always be None.

As Michael suggests in http://bugs.python.org/issue16662#msg200274 I think we 
should just remove use_load_tests.  We'll still need to document the new 
pattern=None, unless there's a better way to handle that.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-08 Thread Steve Dower

Steve Dower added the comment:

Right, what the prefix actually means is treat this path as a blob and don't 
do any processing. Some of the things that 'processing' includes are:

* CWD
* invalid names ('foo.' - 'foo')
* adjacent backslashes ('a\\b' - 'a\b')
* forward slashes ('a/b' - 'a\b')
* (probably) short/long file names ('progra~1' - 'Program Files')

A nice side-effect is that you can also use path names longer than 260 
characters, provided your path name is correctly normalized already.

Really, the test for whether to keep or remove the prefix should be to remove 
the prefix and try and resolve the path again. If it succeeds, remove the 
prefix; otherwise, keep it. This can only really be done as part of the 
resolve() call, which would address the original issue, but it may be quite a 
perf. hit. 

I'd still be inclined to add the prefix in str() if the final path length is 
greater than 260 characters, if only because we go from zero chance of it 
working to a non-zero chance. Unfortunately, there seems to be no way to 
process a long path to make it 'safe' to add the prefix (though we can do a few 
of the things and increase the chances) as GetFinalPathName will not work on a 
long path. FWIW, paths longer than 260 chars are a mess and everyone knows it, 
but it's really really hard to fix without breaking back-compat.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22299
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22253] ConfigParser does not handle files without sections

2014-09-08 Thread Guido van Rossum

Guido van Rossum added the comment:

It looks like this feature request tries to change an existing (ancient) module 
into something it isn't.  At the very least can you point to a spec for the 
syntax of POSIX config files?  I always thought they were essentially shell 
scripts, which suggests that they might have a more complex (and different) 
quoting syntax than ConfigParser, so there might be cases where the 
interpretation of a line in a POSIX config file would be different than the 
interpretation of the same line in a .ini file.

--
nosy: +gvanrossum

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22253
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Andres Riancho

Andres Riancho added the comment:

Well, closing this as wont-fix is far from ideal. +4 years have past from the 
last activity in this issue but people are still being hit by this issue.

In my case I'm not creating any special sub-class, I just use one of Python's 
built-in libs:

```python
import cPickle
import Cookie
 
c = Cookie.SimpleCookie()
c['abc'] = 'def'
 
unpickled_highest = cPickle.loads(cPickle.dumps(c, cPickle.HIGHEST_PROTOCOL))
unpickled_default = cPickle.loads(cPickle.dumps(c))
 
print c['abc'].value, c['abc'].value
print unpickled_default['abc'].value, unpickled_default['abc'].value
print unpickled_highest['abc'].value, unpickled_highest['abc'].value
 
assert unpickled_default['abc'].value == c['abc'].value
assert unpickled_highest['abc'].value == c['abc'].value
```

I know there is a work-around (subclass SimpleCookie, override methods, etc.) 
but it's still going to be something that others will have to implement on 
their own, they are going to spend time debugging the issue until they reach 
this bug report, etc.

Batteries included should focus on cutting down development time, and this 
issue increases dev time by introducing strange/hidden limitations to pickle.

Is there any plan to actually fix this in the long term?

--
nosy: +Andres.Riancho

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

pattern will have to be documented and accepted as official API

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

So, I think what I'm going to do is change the sig of the method to:

def loadTestsFromModule(self, module, *args, pattern=None, **kws):

I.e. the new `pattern` arg will be keyword-only. *args and **kws will be parsed 
for use_load_tests usage and a deprecation warning will be issued if found, but 
the argument will be ignored.  load_tests() will always be called if it's found.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Andres Riancho

Andres Riancho added the comment:

Django's issue [0] shows the ugly code people write to work around this python 
bug.

[0] https://code.djangoproject.com/ticket/15863

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22353] re.findall() documentation lacks information about finding THE LAST iteration of repeated capturing group (greedy)

2014-09-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Then let's close this issue.

--
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22353
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Andres Riancho

Changes by Andres Riancho andres.rian...@gmail.com:


--
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Andres Riancho

Changes by Andres Riancho andres.rian...@gmail.com:


--
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22253] ConfigParser does not handle files without sections

2014-09-08 Thread Paul Moore

Paul Moore added the comment:

It's not unreasonable as a new feature, but the default behaviour shouldn't 
change. It matches ini files (like it or not, ConfigParser parses ini-style 
files - the docs even say so), and sectionless values are not standard ini 
format.

I'd suggest a new __init__ option, allow_unnamed_section (default False) that 
permits variables to be placed before the first section header. I'd further 
suggest that the names be treated as if they were in a section with name '', 
for consistency of access with other sections.

It's plausible that people might want the defaults section to be the unnamed 
section. If so, that could be another option, default_is_unnamed (default 
False, if True this implies allow_unnamed_section). But I'm not sure the 
additional complexity is worth it.

--
nosy: +pmoore

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22253
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-08 Thread Alex Gaynor

New submission from Alex Gaynor:

Instead of the ca* arguments it currently takes, these can all be encapsulated 
into an SSLContext argument, which the underlying http.client already supports.

--
components: Library (Lib)
messages: 226594
nosy: alex, christian.heimes, dstufft, giampaolo.rodola, janssen, orsenthil, 
pitrou
priority: normal
severity: normal
status: open
title: urllib.request.urlopen shoudl take a context (SSLContext) argument
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22366
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-08 Thread Alex Gaynor

Alex Gaynor added the comment:

Attached patch against the default branch adds support for this.

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file36573/urlopen-context.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22366
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d0ff527c53da by Barry Warsaw in branch 'default':
- Issue #16662: load_tests() is now unconditionally run when it is present in
http://hg.python.org/cpython/rev/d0ff527c53da

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21931] Nonsense errors reported by msilib.FCICreate for bad argument

2014-09-08 Thread Jeffrey Armstrong

Jeffrey Armstrong added the comment:

Is this patch going to be accepted?  It fixes actual incorrect code in msilib, 
and it seems to have stagnated

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21931
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20597] PATH_MAX already defined on some Windows compilers

2014-09-08 Thread Jeffrey Armstrong

Jeffrey Armstrong added the comment:

Was this ever accepted?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20597
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22364] Unify error messages of re and regex

2014-09-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I'm dubious about this issue. It suggests that the wording of the exceptions is 
part of the API of the two modules.

If the idea is just to copy the best error messages from one module to the 
other, then I guess there is no harm. But if the idea is to guarantee to keep 
the two modules' messages in sync, then I think it is unnecessary and harmful.

--
nosy: +steven.daprano

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22364
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

Thanks for landing this barry, there's a couple quirks with your improvements - 
loadTestsFromModule(mod, foo, bar) will raise a TypeError but not warn about 
foo the way loadTestsFromModule(mod, foo) will.

Secondly, the TypeError has an off-by-one error in its output:

loadTestsFromModule(mod, foo, bar) will claim 2 arguments were passed. Three 
were.


diff -r d0ff527c53da Lib/unittest/loader.py
--- a/Lib/unittest/loader.pyMon Sep 08 14:21:37 2014 -0400
+++ b/Lib/unittest/loader.pyTue Sep 09 07:32:05 2014 +1200
@@ -79,12 +79,12 @@
 # use_load_tests argument.  For backward compatibility, we still
 # accept the argument (which can also be the first position) but we
 # ignore it and issue a deprecation warning if it's present.
-if len(args) == 1 or 'use_load_tests' in kws:
+if len(args) or 'use_load_tests' in kws:
 warnings.warn('use_load_tests is deprecated and ignored',
   DeprecationWarning)
 kws.pop('use_load_tests', None)
 if len(args)  1:
-raise TypeError('loadTestsFromModule() takes 1 positional argument 
but {} were given'.format(len(args)))
+raise TypeError('loadTestsFromModule() takes 1 positional argument 
but {} were given'.format(len(args) + 1))
 if len(kws) != 0:
 # Since the keyword arguments are unsorted (see PEP 468), just
 # pick the alphabetically sorted first argument to complain about,
diff -r d0ff527c53da Lib/unittest/test/test_loader.py
--- a/Lib/unittest/test/test_loader.py  Mon Sep 08 14:21:37 2014 -0400
+++ b/Lib/unittest/test/test_loader.py  Tue Sep 09 07:32:05 2014 +1200
@@ -272,7 +272,7 @@
 # however use_load_tests (which sorts first) is ignored.
 self.assertEqual(
 str(cm.exception),
-'loadTestsFromModule() takes 1 positional argument but 2 were 
given')
+'loadTestsFromModule() takes 1 positional argument but 3 were 
given')
 
 @warningregistry
 def test_loadTestsFromModule__use_load_tests_other_bad_keyword(self):

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

OH! One more thing I just spotted, which is that this change causes 
non-'discover' unittest test loading to invoke load_tests.

IMO this is the Right Thing - its what I intended when I described the protocol 
a few years back, but we should document it, no?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Alexandre or Antoine, do either of you want to either reopen or verify that 
this dict subclass pickle issue was properly closed as won't fix?

--
nosy: +alexandre.vassalotti, pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17401] io.FileIO closefd parameter is not documented nor shown in repr

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

Its more than just a docs issue - AFAICT it isn't possible to tell if closefd 
is set after the object is created.

The presence of the parameter in the signature is there, but it isn't 
documented *where the bulk of the FileIO parameters are* - there are docs for 
mode for instance. Why would we force users to follow breadcrumbs for one 
parameter but not other ones?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17401
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Michael Foord

Michael Foord added the comment:

I agree, load_tests should be honoured even when not invoked through discovery. 
If that wasn't the case it was an unfortunate oversight on my part!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue826897] Proto 2 pickle vs dict subclass

2014-09-08 Thread Andres Riancho

Andres Riancho added the comment:

FYI, I'm using Python 2.7.6

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22240] argparse support for python -m module in help

2014-09-08 Thread paul j3

paul j3 added the comment:

When I apply `prog3.diff` to my 3.5.0dev, and run

python3 -m unittest Lib/test/test_argparse.py

I get 2 failures, both over 'usage: python3 -m [unit]test'.

It also fails with

python3 test_argparse.py

I suspect it would also fail if I ran the tests with `nosetests` (though I'm 
not setup to use that in the development version).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22240
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17401] io.FileIO closefd parameter is not documented nor shown in repr

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

Oh - the the 'open' function docs are fine - they are just a pointer. I was 
specifically referring to the class docs around line 513 of Doc/library/io.rst.

Attached is a patch that changes repr to show this attribute and extends the 
docs to document this as part of FileIO.

--
keywords: +patch
Added file: http://bugs.python.org/file36574/issue17401.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17401
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17381] IGNORECASE breaks unicode literal range matching

2014-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, issue12728 is more complicate case.

Here is a patch which fixes this issue and issue3511.

--
assignee:  - serhiy.storchaka
keywords: +patch
stage:  - patch review
versions: +Python 3.4, Python 3.5 -Python 3.3
Added file: http://bugs.python.org/file36575/re_ignore_case_range.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17381
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-08 Thread Alex Gaynor

Alex Gaynor added the comment:

Added a versionchanged directive to the docs.

--
Added file: http://bugs.python.org/file36576/urlopen-context.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22366
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf

2014-09-08 Thread Andrew Lutomirski

New submission from Andrew Lutomirski:

Linux 3.15 and newer support a vastly superior API for file locking, in which 
locks are owned by open file descriptions instead of by processes.  This is how 
everyone seems to expect POSIX locks to work, but now they can finally work 
that way.

Please add some interface to these locks to fcntl.lockf.  One option would be 
to use them by default and to fall back to standard POSIX locks if they're not 
available.  I don't know whether this would break existing code.

See http://man7.org/linux/man-pages/man2/fcntl.2.html for details.

--
components: Library (Lib)
messages: 226610
nosy: Andrew.Lutomirski
priority: normal
severity: normal
status: open
title: Please add F_OFD_SETLK, etc support to fcntl.lockf
type: enhancement
versions: Python 2.7, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22367
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

@michael - ah I think I inverted the sense of the old parameter. It was 
defaulting True. So - no need to document anything extra:)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

Here is an implementation. I'm probably missing some finesse in the docs.

--
keywords: +patch
Added file: http://bugs.python.org/file36577/issue19746.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19746
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92b292d68104 by Barry Warsaw in branch 'default':
A few tweaks for issue16662 based on feedback from Robert Collins.
http://hg.python.org/cpython/rev/92b292d68104

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

I've just put a patch up for the related issue http://bugs.python.org/issue19746

I'll poke at this one briefly now, since I'm across the related code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22361] Ability to join() threads in concurrent.futures.ThreadPoolExecutor

2014-09-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Can you explain what benefit this would provide? Forcing the thread to exit 
gets you relatively little benefit. If it's an infrequently used executor, I 
suppose you avoid the cost of leaving worker threads blocked waiting for work, 
but that cost is tiny, and you pay for it with increased overhead to dispatch 
new tasks since they have to create new threads instead of using existing 
worker threads.

--
nosy: +josh.rosenberg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22361
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

Ok, here is an implementation that I believe covers everything Michael wanted. 
I examined the other patches, and can rearrange my implementation to be more 
like them if desired - but at the heart of this this bug really has two 
requested changes:
 - deferred reporting of error per Michaels request
 - report missing attributes on packages as an ImportError (if one occurred)

and thus my implementation focuses on those changes.

--
Added file: http://bugs.python.org/file36578/issue7559.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18232] running a suite with no tests is not an error

2014-09-08 Thread Robert Collins

Robert Collins added the comment:

@Terry in principle you're right, there are an arbitrary number of things that 
can go wrong, but in practice what we see is either catastrophic failure where 
nothing is loaded at all *and* no error is returned or localised failure where 
the deferred reporting of failed imports serves quite well enough.

The former is caused by things like the wrong path in a configuration file.

@ezio sure - a boolean option would meet the needs reported to me, I was 
suggesting a specific implementation in an attempt to be generic enough to not 
need to maintain two things if more was added in future.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22361] Ability to join() threads in concurrent.futures.ThreadPoolExecutor

2014-09-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +bquinlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22361
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22363] argparse AssertionError with add_mutually_exclusive_group and help=SUPPRESS

2014-09-08 Thread Zacrath

Zacrath added the comment:

This assert statement is only reached when the usage line is long enough that 
it needs to be wrapped. Which is why the assertion does not happen when an 
argument is removed.

opt_usage is being compared to this string:
[-h] [--arg2 ARG2] [--arg3 ARG3] [--arg4 ARG4] [--arg5 ARG5] [--arg6 ARG6]

opt_usage in this case has the value:
[-h]  [--arg2 ARG2] [--arg3 ARG3] [--arg4 ARG4] [--arg5 ARG5] [--arg6 ARG6]

There is an extra space after [-h]. The value of opt_usage comes from 
_format_actions_usage. And that is where the bug is.

Just before _format_actions_usage returns, the usage string is:
[-h] [ ] [--arg2 ARG2] [--arg3 ARG3] [--arg4 ARG4] [--arg5 ARG5] [--arg6 ARG6]

The method uses this regexp:
[ *]

To remove the extra brackets. But that leaves the extra space after the 
brackets.

The attached patch changes the regexp to:
[ *] ?

So that the extra space is also removed.

The patch also adds a testcase based on the script that reproduces the

--
keywords: +patch
Added file: http://bugs.python.org/file36579/bugfix.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22363
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >