Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
 [snip]
 
 Could you make the program name unique just by combining it with the
 
 repository name in a single string?

In my case I cannot.  But there is a larger reason why I wouldn't do this:  It 
would mean adding a special character that could not be included in the 
repository name, that is, if I were to create a unique-program-name string 
which was of the format repo+-+programName then the repo name could not have 
the - symbol in it.

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


Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
 I'm curious what these practical reasons are.  One my smallest source files 
 has 870 lines in it, my largest nearly 9000.
 
 
 
 If the problem is your editor, you should seriously consider switching.
 

I think that the main reasons for doing so are as follows:

git status provides much more usefull output when the source files are 
separate.  If all your code is in one file, than git status tells you nothing 
about what has changed, yet git diff will provide you with overly verbose 
output.

The seccond reason is that when refactoring code, it is much easier to manage a 
todo list when one knows which files have been processed already/what needs to 
be processed.  This is especially true if the refactor will take several days 
or be done by several people.

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


Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread Chris Angelico
On Thu, Apr 24, 2014 at 5:21 PM,  tim.thel...@gmail.com wrote:
 [snip]

 Could you make the program name unique just by combining it with the

 repository name in a single string?

 In my case I cannot.  But there is a larger reason why I wouldn't do this:  
 It would mean adding a special character that could not be included in the 
 repository name, that is, if I were to create a unique-program-name string 
 which was of the format repo+-+programName then the repo name could not 
 have the - symbol in it.


Can you, then, simply substitute a tuple for the string? Instead of
comparing program name strings, compare tuples of (repo, program_name)
- it should work just fine.

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


ANN: eGenix mxODBC Connect 2.0.5 - Python ODBC Database Interface

2014-04-24 Thread eGenix Team: M.-A. Lemburg

ANNOUNCING
  eGenix.com mxODBC Connect

Python ODBC Database Interface

Version 2.0.5


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.0.5-GA.html


INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Unlike our mxODBC Python extension, mxODBC Connect is designed as
client-server application, so you no longer need to find production
quality ODBC drivers for all the platforms you target with your Python
application.

Instead you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/


NEWS

The 2.0.5 release of mxODBC Connect includes the following
enhancements and fixes:

Security Enhancements
-

 * Upgraded client and server to the most recent eGenix pyOpenSSL
   Distribution 0.13.3.1.0.1.7 (see http://egenix.com/go54 for
   details) to address the recently found Heartbleed Bug in
   OpenSSL 1.0.1 - 1.0.1f:

   - CVE-2014-0160 (Heartbleed Bug): A missing bounds check in the
 handling of the TLS heartbeat extension can be used to reveal
 up to 64kB of memory to a connected client or server. This issue
 did not affect versions of OpenSSL prior to 1.0.1. For information,
 also have a look at the Heartbleed Bug website:
 http://heartbleed.com/

For the full set of changes, please check the mxODBC Connect
change log:

http://www.egenix.com/products/python/mxODBCConnect/changelog.html


mxODBC Connect 2.0 Highlights
-

mxODBC Connect 2.0 was released on 2012-08-20. These are the most
important highlights:

 * mxODBC Connect Server now uses mxODBC 3.2 internally and makes its
   API available in the mxODBC Connect Client. This is a major step
   forward from the mxODBC 3.0 version used in mxODBC Connect Server
   1.0.

 * We've added native Windows x64 builds.

 * mxODBC Connect Client now integrates directly with gevent, allowing
   client applications to run asynchronous tasks while performing
   remote database queries.

Please see the release announcement for full details:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.0.0-GA.html


UPGRADING

You are encouraged to upgrade to this latest mxODBC Connect release.
When upgrading, please always upgrade both the server and the client
installations to the same version - even for patch level releases.

Customers who have purchased mxODBC Connect 2.0 licenses can continue
to use their licenses with this patch level release.

Customers who have purchased mxODBC Connect 1.x licenses can request
20% discount coupons for upgrade purchases. Please contact the
eGenix.com Sales Team (sa...@egenix.com) with your existing license
serials for details.

Users of our stand-alone mxODBC product will have to purchase new
licenses from our online shop in order to use mxODBC Connect.

You can request 30-day evaluation licenses by visiting our web-site
or writing to sa...@egenix.com, stating your name (or the name of the
company) and the number of eval licenses that you need.


Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread Steven D'Aprano
On Thu, 24 Apr 2014 00:21:18 -0700, tim.thelion wrote:

 [snip]
 
 Could you make the program name unique just by combining it with the
 
 repository name in a single string?
 
 In my case I cannot.  But there is a larger reason why I wouldn't do
 this:  It would mean adding a special character that could not be
 included in the repository name, 

Do you support \n or \r or \0 in repo names? If not, then there you go, 
three special characters to choose from.

But I suspect that a tuple of (repo_name, program_name) will be better.



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


ANN: Python Meeting Düsseldorf - 29.04.2014

2014-04-24 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group
 meeting in Düsseldorf, Germany]


ANKÜNDIGUNG

 Python Meeting Düsseldorf

 http://pyddf.de/

   Ein Treffen von Python Enthusiasten und Interessierten
in ungezwungener Atmosphäre.

  Dienstag, 29.04.2014, 19:00 Uhr
  Raum 1, 2.OG im Bürgerhaus Stadtteilzentrum Bilk
Düsseldorfer Arcaden, Bachstr. 145, 40217 Düsseldorf

Diese Nachricht ist auch online verfügbar:
http://www.egenix.com/company/news/Python-Meeting-Duesseldorf-2014-04-29


NEUIGKEITEN

 * Bereits angemeldete Vorträge:

   Charlie Clark
Status openpyxl, bzw. Lösung neuer Probleme
IndexedList - eine Liste optimiert für in Abfragen
Bericht von der PyCon 2014 in Montreal

   Marc-Andre Lemburg
   Python Code mit lib2to3 modernisieren
   DDOS Attacken mit Python bekämpfen
   Bericht von der FOSDEM 2014

   Wir suchen noch weitere Vorträge. Bei Interesse, bitte unter
   i...@pyddf.de melden.

 * Geänderte Startzeit:

   Dieses Mal treffen wir uns erst um 19:00 Uhr im
   Bürgerhaus in den Düsseldorfer Arcaden, da wir keinen Termin
   für 18 Uhr bekommen haben. Hier eine kurze Beschreibung:

   Das Bürgerhaus teilt sich den Eingang mit dem Schwimmbad
   und befindet sich an der Seite der Tiefgarageneinfahrt der
   Düsseldorfer Arcaden.

   Über dem Eingang steht ein großes “Schwimm’'in Bilk”
   Logo. Hinter der Tür direkt links zu den zwei Aufzügen,
   dann in den 2. Stock hochfahren. Der Eingang zum Raum 1
   liegt direkt links, wenn man aus dem Aufzug kommt.

   Google Street View: http://bit.ly/11sCfiw


EINLEITUNG

Das Python Meeting Düsseldorf ist eine regelmäßige Veranstaltung in
Düsseldorf, die sich an Python Begeisterte aus der Region wendet:

 * http://pyddf.de/

Einen guten Überblick über die Vorträge bietet unser YouTube-Kanal,
auf dem wir die Vorträge nach den Meetings veröffentlichen:

 * http://www.youtube.com/pyddf/

Veranstaltet wird das Meeting von der eGenix.com GmbH, Langenfeld,
in Zusammenarbeit mit Clark Consulting  Research, Düsseldorf:

 * http://www.egenix.com/
 * http://www.clark-consulting.eu/


PROGRAMM

Das Python Meeting Düsseldorf nutzt eine Mischung aus Open Space
und Lightning Talks, wobei die Gewitter bei uns auch schon mal
20 Minuten dauern können ;-).

Lightning Talks können vorher angemeldet werden, oder auch
spontan während des Treffens eingebracht werden. Ein Beamer mit
XGA Auflösung steht zur Verfügung. Folien bitte als PDF auf USB
Stick mitbringen.

Lightning Talk Anmeldung bitte formlos per EMail an i...@pyddf.de


KOSTENBETEILIGUNG

Das Python Meeting Düsseldorf wird von Python Nutzern für Python
Nutzer veranstaltet. Um die Kosten zumindest teilweise zu
refinanzieren, bitten wir die Teilnehmer um einen Beitrag
in Höhe von EUR 10,00 inkl. 19% Mwst, Schüler und Studenten
zahlen EUR 5,00 inkl. 19% Mwst.

Wir möchten alle Teilnehmer bitten, den Betrag in bar mitzubringen.


ANMELDUNG

Da wir nur für ca. 20 Personen Sitzplätze haben, möchten wir
bitten, sich per EMail anzumelden. Damit wird keine Verpflichtung
eingegangen. Es erleichtert uns allerdings die Planung.

Meeting Anmeldung bitte formlos per EMail an i...@pyddf.de


WEITERE INFORMATIONEN

Weitere Informationen finden Sie auf der Webseite des Meetings:

http://pyddf.de/

Mit freundlichen Grüßen,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: Wing IDE 5.0.6 released

2014-04-24 Thread Wingware

Hi,

Wingware has released version 5.0.6 of Wing IDE, our cross-platform 
integrated

development environment for the Python programming language.

Wing IDE includes a professional quality code editor with vi, emacs, 
visual studio,
and other key bindings, auto-completion, call tips, goto-definition, 
find uses, refactoring,
context-aware auto-editing, a powerful graphical debugger, version 
control, unit testing,

search, and many other features.  For details see http://wingware.com/

Changes in this minor release include:

* New auto-editing operation for starting a new block when ':' is 
pressed while a range
  of lines is selected. This also auto-enters 'except:' if 'try' is 
then entered.

* Offer completion on argument names in a def
* New Editor  Block Comment Style preference option to use PEP8 style 
indented '# '

  for commenting out code
* On OS X, Wing no longer quits when the last window is closed, to match 
the standard

  for Mac applications
* Restart correctly after downloading patches
* Pick up changes made in the debug dialog when debugging a named entry 
point

* Avoid hiding file selection auto-completer popup too soon
* Set sys.path[0] correctly in Python Shell on OS X and Linux
* Fix cleanup after auto-invocation that spans multiple lines
* About 15 other bug fixes

For details see http://wingware.com/pub/wingide/5.0.6/CHANGELOG.txt

A summary of new features in Wing 5:

* Redesigned GUI based on Qt and PySide
* Native GUI on OS X (and better overall OS-native look and feel)
* Tools and editors can be dragged around
* Toolbar and editor and Project context menus are configurable
* Optional mode that opens different sets of files in each editor split
* Sharable color palettes and syntax highlighting configurations
* Auto-editing is on by default (except some operations that have a 
learning curve)

* Named file sets
* Sharable launch configurations
* Named entry points
* More control over unit testing environment
* Lockable editor splits
* Initial preferences dialog for new users
* Support for Python 3.4
* Support for Django 1.6
* Support for matplotlib on Anaconda and with MacOSX backend
* Improved Source Assistant with PEP 287 docstring rendering and return 
types

* Improved integrated and PDF documentation

For more information on what's new in Wing 5, see 
http://wingware.com/wingide/whatsnew


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com


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


Re: why my cur.executescript can not run?

2014-04-24 Thread Peter Otten
length power wrote:

 When cur.execute be used, i get right output.
 
 import sqlite3
 con=sqlite3.connect(:memory:)
 cur=con.cursor()
 sql1=attach database 'g:\\workspace\\data\\Cinfo.sqlite' as Cinfo;
 sql2=select * from Cinfo.ipo;
 cur.execute(sql1)
 cur.execute(sql2)
 con.commit()
 x=cur.fetchall()print(x)
 
 When i change it into cur.executescript, nothing can get.
 
 import sqlite3
 con=sqlite3.connect(:memory:)
 cur=con.cursor()
 sql_script=
 attach database 'g:\\workspace\\data\\Cinfo.sqlite' as Cinfo;
 select * from Cinfo.ipo;
 cur.executescript(sql_script)
 con.commit()
 x=cur.fetchall()print(x)
 
 I want to know why?

The difference has nothing to do with your specific code, as the following 
minimal example shows:

 import sqlite3
 cs = sqlite3.connect(:memory:).cursor()
 cs.execute(select 42;).fetchall()
[(42,)]
 cs.executescript(select 42;).fetchall()
[]

The docs don't say so explicitly, but my guess is that executescript() is 
meant to execute sql statements for their side effect (like populating a 
database) only, not to return a result. Please file a bug report if you want 
a clarification in the docs.


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


Re: Installing PyGame?

2014-04-24 Thread rohit782192
On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote:
 Perhaps this isn't the right place to post this, but it's the only place I 
 could find.
 
 
 
 I asked yesterday or the day before about Python Game Development, and have 
 found a few tutorials on PyGame. Now I have a bigger problem: HOW THE HECK DO 
 I INSTALL PYGAME!?!?! System Details:
 
 
 
 * Mac OS X 10.8.4 Mountain Lion
 
 * 4GB DDR3 RAM
 
 
 
 I do have Window's installed, as well as Ubuntu 11.04 but I would like to use 
 Mac OS X if possible. I've tried using MacPorts, Fink, the Mac DMG, source 
 installing, installing NumPY, just about every way possible. I can't seem to 
 get it working, I keep getting an error in all my versions of IDLE. I've 
 tried:
 
 
 
 * IDLE 2.5
 
 * IDLE 2.7.2
 
 * IDLE 2.7.3
 
 * IDLE 3.1
 
 * IDLE 3.3.1
 
 
 
 None of the versions work. I'm using PyGame 1.9.1.
 
 
 
 Thanks! Any help is appreciated!

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


Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
 A reasonable compromise might be to keep the *data* assocated
 
 with a SubuserProgram in a class, maybe together with a few
 
 methods that are tightly coupled to it, but have the major
 
 pieces of functionality such as install() implemented by
 
 separate functions that operate *on* the class, rather than
 
 being inside it.
 

I think this is sound advice.  I'm still not sure what I'll come up with.

One of the other reasons why an OOP model might be right for me is that of 
caching.  I currently load a lot of attributes regarding programs from disk, 
and I do so multiple times, I could either pass those attributes around, OR, 
using a class, I could store those attributes in the object after loading them 
just once.  I have no experience with OOP except in the domain of GUIs(where it 
seems inescapable, all major toolkits use OOP), so I'm not yet sure how this 
will turn out.

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


Re: Installing PyGame?

2014-04-24 Thread Terry Reedy

On 4/24/2014 11:32 AM, rohit782...@gmail.com wrote:

When you post, please do more than just quote. If you are relaying a
private email, please say so.


On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote:


I did not see the original post, if indeed there was a public one.

[snip pygame/numpy problems]
...

I do have Window's installed, as well as Ubuntu 11.04 but I would
like to use Mac OS X if possible. I've tried using MacPorts, Fink,
the Mac DMG, source installing, installing NumPY, just about every
way possible. I can't seem to get it working, I keep getting an
error in all my versions of IDLE. I've tried:



* IDLE 2.5
* IDLE 2.7.2
* IDLE 2.7.3
* IDLE 3.1
* IDLE 3.3.1


Idle depends on tkinter. Tkinter depends on having a tcl/tk that works, 
at least for tkinter. The following page has essential info about 
getting the right tcl/tk installed.

https://www.python.org/download/mac/tcltk

--
Terry Jan Reedy

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


Re: Installing PyGame?

2014-04-24 Thread Steven D'Aprano
On Thu, 24 Apr 2014 15:15:09 -0400, Terry Reedy wrote:

 On 4/24/2014 11:32 AM, rohit782...@gmail.com wrote:
 
 When you post, please do more than just quote. If you are relaying a
 private email, please say so.
 
 On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote:
 
 I did not see the original post, if indeed there was a public one.

Check out the date. It was over ten months ago.





-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing PyGame?

2014-04-24 Thread Gregory Ewing

rohit782...@gmail.com wrote:

On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote:


Now I have a bigger problem: HOW THE HECK
DO I INSTALL PYGAME!?!?! System Details:

I've tried using MacPorts, Fink, the Mac DMG,
source installing, installing NumPY, just about every way possible.


My advice would be to steer clear of things like Fink and MacPorts
and do things the native MacOSX way wherever possible. That means
using a framework installation of Python and framework versions of
the various libraries that PyGame uses.

There are a number of steps to getting pygame working:

1) Make sure you have a working framework installation of an
appropriate version of Python. I installed mine from source,
but a binary installation should work too. Depending on your
MacOSX version, the system python might be sufficient.

2) Install framework versions of the SDL library and other
libraries that pygame uses.

You may need to hunt around a bit, but you should be able to find
DMG installers for all of these. In my /Library/Frameworks I have:

SDL.framework
SDL-QD.framework
SDL_image.framework
SDL_mixer.framework
SDL_net.framework
SDL_ttf.framework

3) Install pygame itself with the usual 'python setup.py install'.
If you have all the relevant libraries, the installer will auto
detect them and use them. At the end, it will tell you which ones
it couldn't find. Pygame will work without some of them, but those
features won't be available. You can add more libraries and run
setup.py again if you need to.

4) Specific games may require other Python libraries such as
Numpy etc.

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


Re: Installing PyGame?

2014-04-24 Thread Gregory Ewing

Terry Reedy wrote:
Idle depends on tkinter. Tkinter depends on having a tcl/tk that works, 
at least for tkinter. The following page has essential info about 
getting the right tcl/tk installed.

https://www.python.org/download/mac/tcltk


Also keep in mind that you don't *have* to use IDLE at all.
I do all my Python development on MacOSX using BBEdit Lite
and the Terminal.

If nothing else, you can try out pygame that way to see
whether your problem is a pygame-related one or something
else.

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


Re: Installing PyGame?

2014-04-24 Thread Ned Deily
In article brtt0jf10j...@mid.individual.net,
 Gregory Ewing greg.ew...@canterbury.ac.nz wrote:
 My advice would be to steer clear of things like Fink and MacPorts
 and do things the native MacOSX way wherever possible. That means
 using a framework installation of Python and framework versions of
 the various libraries that PyGame uses.

FYI, MacPorts Pythons are framework installations.  And I disagree that 
installing a bunch of disparate software from various sources via binary 
installers and/or source is to be preferred to a modern third-party 
package manager on OS X like MacPorts or Homebrew.  That's just setting 
yourself up for a long-term maintenance headache.  What could be easier 
than:

sudo port install py27-game

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

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


Re: retrieve source code from code object as returned by compile()

2014-04-24 Thread Justin Ezequiel
On Thursday, April 24, 2014 1:53:38 PM UTC+8, Gregory Ewing wrote:
 Alternatively you could create a .pyc file out of the code
 object and then use Easy Python Decompiler on that. The
 following snippet of code should do that:
 
 (Taken from: 
 
 http://stackoverflow.com/questions/8627835/generate-pyc-from-python-ast)

Woohoo! Success! Thank you Greg!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing PyGame?

2014-04-24 Thread Ryan Hiebert
On Thu, Apr 24, 2014 at 9:38 PM, Ned Deily n...@acm.org wrote:

 In article brtt0jf10j...@mid.individual.net,
  Gregory Ewing greg.ew...@canterbury.ac.nz wrote:
  My advice would be to steer clear of things like Fink and MacPorts
  and do things the native MacOSX way wherever possible. That means
  using a framework installation of Python and framework versions of
  the various libraries that PyGame uses.

 FYI, MacPorts Pythons are framework installations.  And I disagree that
 installing a bunch of disparate software from various sources via binary
 installers and/or source is to be preferred to a modern third-party
 package manager on OS X like MacPorts or Homebrew.  That's just setting
 yourself up for a long-term maintenance headache.  What could be easier
 than:

 sudo port install py27-game

 I'd love to hear more about Greg's take on MacPorts. I've chosen to use
MacPorts because it keeps things separate, because when things get hosed
using the system libraries, I don't have to erase my whole system to get
back to a vanilla OS X install. Unfortunately, it seems like the
differences in which libraries are used, what options are enabled at
library build time, etc, make it difficult to ensure that things always
work when you try to use the stuff built-in to the system, and untangling
the Homebrew mess can be painful.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21342] multiprocessing RLock and Lock raise incorrect exceptions when releasing an unlocked lock.

2014-04-24 Thread Steinn Steinsen

New submission from Steinn Steinsen:

In the documentation of multiprocessing the locks, RLock and Lock, 
are said to be clones of their respective threading synchronization primitives.

There is an inconsistency in what exceptions are raised when an
unlocked lock is released. According to the threading documentation a 
RuntimeError should be raised.

Lock.release raises ValueError 
RLock.release raises AssertionError

Tested this in python 2.7, 3.2, 3.4, 3.5 and broken in all those versions.

The attached patch fixes this for 3.5

--
components: Library (Lib)
files: release_exceptions.patch
keywords: patch
messages: 217117
nosy: steinn
priority: normal
severity: normal
status: open
title: multiprocessing RLock and Lock raise incorrect exceptions when releasing 
an unlocked lock.
type: behavior
versions: Python 2.7, Python 3.2, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35017/release_exceptions.patch

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



[issue16104] Compileall script: add option to use multiple cores

2014-04-24 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Added a new version of the patch which incorporates suggestions made by Jim. 
Thanks for the review!

--
Added file: http://bugs.python.org/file35018/issue16104_8.patch

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



[issue21343] os.path.relpath returns inconsistent types

2014-04-24 Thread Matt Bachmann

New submission from Matt Bachmann:

I noticed an issue passing in unicode to os.path.relpath.

Specifically that in some cases when passing in unicode I would get back 
unicode and others I would get back a string. Below I demonstrate the issue. I 
also attached a patch.

Is this an issue or am I misunderstanding something. Is the patch reasonable? 
Totally willing to improve and i'll admit I cannot test the ntpath version.

Python 2.7.6 (default, Apr  9 2014, 11:48:52)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type help, copyright, credits or license for more information.
 import os
 os.path.relpath(u'.', u'.')
'.'
 os.path.relpath(u'.', u'../')
u'bachmann'

--
components: Library (Lib)
files: reldir.patch
keywords: patch
messages: 217119
nosy: Matt.Bachmann
priority: normal
severity: normal
status: open
title: os.path.relpath returns inconsistent types
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file35019/reldir.patch

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



[issue17552] socket.sendfile()

2014-04-24 Thread Charles-François Natali

Charles-François Natali added the comment:

 A useful parameter instead would be to support sending only part of the file,
 so adding a count argument.

 Have you read my patch? This is already provided by the offset parameter.

Of course I read your patch ;-)
I mean I'd like a parameter for the offset, and another one for the
number of bytes to send, like in Java's version (and sendfile(), see
below).

 I really don't like the blocksize argument.
 I've *never* seen code which explicitly uses a blocksize

 Both sendfile() and TransmitFile provide a blocksize parameter for very 
 good reasons therefore it seems natural that an API built on top of them 
 exposes the same parameter as well.

No, they expose a *count* parameter:
http://linux.die.net/man/2/sendfile

ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
count is the number of bytes to copy between the file descriptors.


You're mixing up blocksize, which is the maximum number of bytes to
transfer in one syscall and only makes sense in the context of
repeated syscalls, and count, which is the total amount of data you
want the function to transfer.
No sensible sendfile-like API exposes a maximum blocksize to send at
once, since the goal is to limit copies and system calls: you just
pass a source and destination FD, a starting offset, and a number of
bytes to transfer, and the syscall takes care of the rest.

Here, you basically implement sendall() on top of sendfile() (in
pseudo-code, using a buffer instead of a file and not taking into
account short writes but the idea if the same):

while remaining data to send:
socket.sendfile(data[offset:offset+chunksize)

The way it's supposed to be used is simply:
socket.sendfile(data[offset:offset+count])

That's how everyone one uses sendfile(), that's how Java exposes it,
and that's IMO how it should be exposed.

To sum up, I think there's a fundamental confusion between blocksize
and count in this API: that's what I've been saying since the
beginning of this thread: if you disagree, that's OK, I just want to
make sure we're talking about the same thing ;-)

--

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



[issue17552] socket.sendfile()

2014-04-24 Thread akira

akira added the comment:

use_fallback parameter is mostly a debugging tool.  If it helps to avoid the
indecision; I would side with neologix' remarks and also suggest to drop
the use_fallback parameter.

It seems the patch assumes *offset == nbytes_sent* that is false in general
e.g., if offset  0 at the start of the function.

::

_SEND_BLOCKSIZE = 262144 # ???

def sendfile(self, file, offset=None, nbytes=None,
 *, nbytes_per_send=_SEND_BLOCKSIZE) - nbytes_sent:

Send *nbytes* bytes from regular *file* starting at *offset* position.

Return the number of bytes sent.

If *offset* is ``None``; start at the current file position.
If *nbytes* is ``None``; send file until EOF is reached.

The socket should be connection-oriented e.g., SOCK_STREAM

*nbytes_per_send* is used by a *send()*-based fallback code.
*os.sendfile()* ignores it.

- if socket is blocking (timeout is None) then it may keep
  trying to send data until an error occurs.

  Even on success it may return less than *nbytes* if there is
  not enough data available in *file*.

- if socket is non-blocking and timeout == 0 then fail if
  even a single byte can't be sent immediately

- if socket has timeout  0 then raise the timeout error if
  more than *timeout* seconds pass since the call is started
  and nothing is sent i.e., use a single deadline for all
  system calls (like *socket.send()*).

If timeout is not None then *socket.sendfile()* may send less
bytes than specified.

*file* position after the call is unspecified.


# pseudo-code
total = 0
if offset is None
offset = file.tell()
if nbytes is None:
nbytes = os.path.getsize(file.name)
interval = self.timeout
if interval is not None:
 deadline = now() + interval
while select([], [self], [], interval)[1]: # writable
try:
sent = os.sendfile(self, file, offset, nbytes)
except BlockingIOError as e:
assert getattr(e, 'characters_written', 0) == 0
if interval is not None: # update interval
interval = deadline - now()
if interval  0:
break
continue # ignore
else:
if sent == 0:
return total
total += sent
offset += sent
nbytes -= sent
if nbytes == 0:
return total
if interval is not None: # update interval
interval = deadline - now()
if interval  0:
break
# timeout
if total == 0:
raise TimeoutError
else:
return total

--

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



[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch

Milan Oberkirch added the comment:

Updated the last patch according to the review comments at 
https://bugs.python.org/review/20098/.

--
Added file: http://bugs.python.org/file35020/mangle_from_20140424.patch

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



[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch

Changes by Milan Oberkirch milan...@oberkirch.org:


Added file: http://bugs.python.org/file35021/mangle_from_20140424.patch

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



[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch

Changes by Milan Oberkirch milan...@oberkirch.org:


Removed file: http://bugs.python.org/file35020/mangle_from_20140424.patch

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

New submission from Russell Ballestrini:

The current implementation of difflib's get_close_matches() function computes 
computationally complex scores (ratios) but then tosses them out without giving 
the end-user the chance to have at them.

This patch adds an optional scores boolean argument that may be passed to 
alter the return output from a list of words, to a list of (score, word) tuples.

--
components: Library (Lib)
files: difflib.py
messages: 217123
nosy: russellballestrini
priority: normal
severity: normal
status: open
title: save scores or ratios in difflib get_close_matches
type: enhancement
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file35022/difflib.py

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Changes by Russell Ballestrini russell.ballestr...@gmail.com:


Removed file: http://bugs.python.org/file35022/difflib.py

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Changes by Russell Ballestrini russell.ballestr...@gmail.com:


--
keywords: +patch
Added file: 
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa

Claudiu.Popa added the comment:

It would be easier to review your patch if you'll upload it as a proper patch.

Usually for these cases (modifying the return by passing a specific argument) 
it's best to provide a new function with this functionality, by having 
get_close_matches and get_scored_close_matches (for instance),
which returns the modified result.

--
nosy: +Claudiu.Popa

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Ah, nevermind my first comment.

--

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Russell Ballestrini added the comment:

Claudiu.Popa,

Yes, that was my first idea on how to tackle this issue.

I will create another proper patch that prepares two separate functions:

* get_close_matches
* get_scored_close_matches

Where each are basically wrapper / API functions around a private function that 
holds the algorithm:

* _get_scored_close_matches

--

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Russell Ballestrini added the comment:

New function in difflib: get_scored_matches()

This function acts just like the existing get_close_matches()
function however instead of returning a list of words, it 
returns a list of tuples (score, word) pairs.

This gives the end-user the ability to access the
computationally expensive scores/ratios produced as a by-product.

The new usage does _not_ impact backward compatibility::

   import difflib
   import keyword as _keyword
   difflib.get_scored_matches(wheel, _keyword.kwlist)
  [(0.6, 'while')]
   difflib.get_close_matches(wheel, _keyword.kwlist)
  ['while']

HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: RussellBallestrini
HG: branch 'default'
changed Lib/difflib.py

--
Added file: 
http://bugs.python.org/file35024/difflib-patch-to-save-scores-2.patch

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



[issue17552] socket.sendfile()

2014-04-24 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 [...] I'd like a parameter for the offset, and another one for the
 number of bytes to send.
 To sum up, I think there's a fundamental confusion between blocksize
 and count in this API.

Ah OK, I see what you mean now. If seems we didn't understand each other. =)
And yes, I suppose you're right: if possible we should pass a high value and 
let sendfile() do its thing.
Note that we still have to implement an internal loop ourselves though because 
if the socket has a timeout sendfile() will return before EOF (I've checked 
this just now).

As for what to do, here's what I propose:
- we provide a blocksize argument defaulting to None
- in case of send() and blocksize == None we set it to 262144
- in case of sendfile() we set it to a very high value (4M or something)
- using os.path.getsize(file.name) looks risky to me as the user might have 
changed CWD in the meantime or something

I'm -1 about adding count *and* blocksize parameters. blocksize alone is 
good enough IMO and considering what I've just described it is a better name 
than count.

--

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



[issue21345] multiprocessing.Pool._handle_workers sleeps too long

2014-04-24 Thread Johannes Baiter

New submission from Johannes Baiter:

While testing a module that uses multiprocessing.Pool to distribute load across 
multiple processes, I noticed that my test suite was copmleting very quickly 
(~0.15s) on Python 2.6, while Python 2.7 and above took around 10x as long 
(~1.6s).
Upon debugging this, I pinned the slowdown down to the 'Pool.join()' method. 
Removing it removed the slowdown almost completely.
I then checked the version history of the 'multiprocessing.pool' module between 
2.6 and 2.7 and noticed that when the 'maxtasksperchild' parameter was 
introduced, a thread to handle the workers was introduced, which was 'join()'ed 
when the pool was joined.

This is the function that is executed in the thread (from latest CPython 
checkout):

@staticmethod
def _handle_workers(pool):
thread = threading.current_thread()

# Keep maintaining workers until the cache gets drained, unless the pool
# is terminated.
while thread._state == RUN or (pool._cache and thread._state != 
TERMINATE):
pool._maintain_pool()
time.sleep(0.1)  #  -- Cause of slow 'join()' after 2.6
# send sentinel to stop workers
pool._taskqueue.put(None)
util.debug('worker handler exiting')

I highlighted the portion that makes 'join()' take a rather long time with 
short-lived processes in Python 2.7 and greater.
Replacing it with 'time.sleep(0)' (as is done in '_help_stuff_finish()' later 
in the module) makes joining go as fast as in 2.6.

Is there a specific reason why this sleep period was chosen?

--
components: Library (Lib)
messages: 217129
nosy: Johannes.Baiter
priority: normal
severity: normal
status: open
title: multiprocessing.Pool._handle_workers sleeps too long
type: performance
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Your patch needs tests and documentation update. For examples, you could look 
in test_difflib.py and see how get_close_matches is tested.

--

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Russell Ballestrini added the comment:

get_close_matches() doesn't seem to have any tests... I suppose I should write 
them considering I'm changing the functionality a bit.  

TODO: write tests for 

* difflib.get_close_matches()
* difflib.get_scored_matches()

Determine if docstrings are enough to document the new function.  (I thought it 
would be)

--

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
stage:  - patch review
versions:  -Python 2.7

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Zachary Ware

Zachary Ware added the comment:

Russell Ballestrini wrote:
 Determine if docstrings are enough to document the new function.

No, Doc/library/difflib.rst will need an update.

(Btw, I removed 2.7 from versions because 2.7 is not open to new features, bugs 
and security-critical enhancements only.)

--
nosy: +zach.ware

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Berker Peksag

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


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue21346] typos in test_itertools.py

2014-04-24 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


--
files: test_itertools_typos-py27.patch
keywords: patch
nosy: bdkearns
priority: normal
severity: normal
status: open
title: typos in test_itertools.py
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file35025/test_itertools_typos-py27.patch

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



[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks like there is a bug in CoroWrapper -- when the assert in __init__ fails, 
__del__ gets called imediately after and that triggers this traceback.

However I'm not sure what causes the assert to fail -- it looks like this is 
coming from sleep(), which does not make sense to me.

--

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



[issue21342] multiprocessing RLock and Lock raise incorrect exceptions when releasing an unlocked lock.

2014-04-24 Thread Ned Deily

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


--
nosy: +sbt

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



[issue21345] multiprocessing.Pool._handle_workers sleeps too long

2014-04-24 Thread Ned Deily

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


--
nosy: +sbt

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



[issue21346] typos in test_itertools.py

2014-04-24 Thread Zachary Ware

New submission from Zachary Ware:

Fixed, thanks for the patch!

changeset 90450:1beb3e0507fa 2.7
Issue #21346: Fix typos in test_itertools. Patch by Brian Kearns.

changeset 90451:901b9afc918e 3.4
Issue #21346: Fix typo, make message consistent in test_itertools. Pointed out 
by Brian Kearns.

changeset 90452:21012515c249 default
Closes #21346: Merge with 3.4

--
nosy: +zach.ware
resolution:  - fixed
stage:  - resolved
status: open - closed
versions: +Python 3.4, Python 3.5

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



[issue19662] smtpd.py should not decode utf-8

2014-04-24 Thread Sreepriya Chalakkal

Sreepriya Chalakkal added the comment:

Hi Maciej,
I am travelling now and it might take some delay for me to work on this! I got 
to know that you are working on RFC 6532. You might take this up and fix it as 
this is related to your work and I don't want to create delays.

--

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



[issue21347] Don't use a list argument together with shell=True in subprocess' docs

2014-04-24 Thread akira

New submission from akira:

*Popen([something], shell=True)* works but it is similar to
*Popen([something, arg], shell=True)* that passes arg to /bin/sh on POSIX 
systems instead of something.

It is best to always use a string if `shell=True` is necessary.

It is a common confusion #20344, msg98732, #7839

http://stackoverflow.com/questions/21029154/understanding-python-subprocess-check-outputs-first-argument-and-shell-true
http://stackoverflow.com/questions/20787712/start-openoffice-process-with-python-to-use-with-pyuno-using-subprocess
http://stackoverflow.com/questions/17880847/python-subprocess-error-in-using-cp
http://stackoverflow.com/questions/17226912/why-does-simple-echo-in-subprocess-not-working
http://stackoverflow.com/questions/15109665/subprocess-call-using-string-vs-using-list
http://stackoverflow.com/questions/20128114/pythons-subprocess-does-not-interpret-as-expected-on-cygwin
http://stackoverflow.com/questions/16840427/python-on-linux-subprocess-popen-works-weird-with-shell-true
...

--
assignee: docs@python
components: Documentation
files: docs-subprocess-dont_use_list_with_shell_true.patch
keywords: patch
messages: 217136
nosy: akira, docs@python
priority: normal
severity: normal
status: open
title: Don't use a list argument together with shell=True in subprocess' docs
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file35026/docs-subprocess-dont_use_list_with_shell_true.patch

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +tim.peters

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



[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry

2014-04-24 Thread stoyanov

stoyanov added the comment:

Alternative temporary solution
def enum_types(mimedb):

try:
  ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeEncodeError:
  pass
except Exception: #--
  pass#--
else:
  yield ctype

--
nosy: +quick.es

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Changes by Russell Ballestrini russell.ballestr...@gmail.com:


Removed file: 
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch

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



[issue9731] Add ABCMeta.has_methods and tests that use it

2014-04-24 Thread Claudiu.Popa

Claudiu.Popa added the comment:

I have updated the previous patch, by documenting the new class method.

--
versions: +Python 3.5 -Python 3.4
Added file: http://bugs.python.org/file35027/issue9731.patch

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



[issue8297] AttributeError message text should include module name

2014-04-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d84a69b7ba72 by Ethan Furman in branch 'default':
Issue8297: module attribute lookup failures now include module name in error 
message.
http://hg.python.org/cpython/rev/d84a69b7ba72

--
nosy: +python-dev

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



[issue11874] argparse assertion failure with brackets in metavars

2014-04-24 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


Added file: http://bugs.python.org/file35028/format_usage.patch

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



[issue11874] argparse assertion failure with brackets in metavars

2014-04-24 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


Removed file: http://bugs.python.org/file30941/format_usage.patch

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



[issue21348] File C:\Python27\lib\distutils\msvc9compiler.py, line 295, in query_vcvarsal l raise ValueError(str(list(result.keys()))) ValueError: [u'path']

2014-04-24 Thread Cris

New submission from Cris:

I have Windows 8 64bit and Python 64bit (installed from here: 
https://www.python.org/ftp/python/2.7/python-2.7.amd64.msi)

I also installed pywin32-214.win-amd64-py2.7 (from here 
http://downloads.sourceforge.net/project/pywin32/pywin32/Build%20214/pywin32-214.win-amd64-py2.7.exe?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpywin32%2Ffiles%2Fpywin32%2FBuild%2520214%2Fts=1398376919use_mirror=kent)

When I try to install Scrapy it gives me this error:

  File twisted\runner\topfiles\setup.py, line 14, in lambda
  File .\twisted\python\dist.py, line 413, in _check_header
  File .\twisted\python\dist.py, line 399, in _compile_helper
  File C:\Python27\lib\distutils\msvc9compiler.py, line 469, in compile
self.initialize()
  File C:\Python27\lib\distutils\msvc9compiler.py, line 379, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
  File C:\Python27\lib\distutils\msvc9compiler.py, line 295, in query_vcvarsal
l
raise ValueError(str(list(result.keys(
ValueError: [u'path']

How can I fix it?

--
messages: 217140
nosy: Cris
priority: normal
severity: normal
status: open
title: File C:\Python27\lib\distutils\msvc9compiler.py, line 295, in 
query_vcvarsal l raise ValueError(str(list(result.keys( ValueError: 
[u'path']
type: compile error
versions: Python 2.7

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



[issue8297] AttributeError message text should include module name

2014-04-24 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue20962] Rather modest chunk size in gzip.GzipFile

2014-04-24 Thread William Tisäter

William Tisäter added the comment:

I played around with different file and chunk sizes using attached benchmark 
script.

After several test runs I think 1024 * 16 would be the biggest win without 
losing too many μs on small seeks. You can find my benchmark output here: 
https://gist.github.com/tiwilliam/11273483

My test data was generated with following commands:

dd if=/dev/random of=10K bs=1024 count=10
dd if=/dev/random of=1M bs=1024 count=1000
dd if=/dev/random of=5M bs=1024 count=5000
dd if=/dev/random of=100M bs=1024 count=10
dd if=/dev/random of=1000M bs=1024 count=100
gzip 10K 1M 5M 100M 1000M

--
nosy: +tiwilliam
Added file: http://bugs.python.org/file35029/benchmark_20962.py

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



[issue8297] AttributeError message text should include module name

2014-04-24 Thread Ethan Furman

Ethan Furman added the comment:

Yay, 'resolved' !

--
stage: patch review - resolved

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



[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


Removed file: http://bugs.python.org/file35030/fix_winreg_setvalueex-py27.patch

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



[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


--
files: fix_winreg_setvalueex-py27.patch
keywords: patch
nosy: bdkearns
priority: normal
severity: normal
status: open
title: crash in winreg SetValueEx with memoryview
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file35030/fix_winreg_setvalueex-py27.patch

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



[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


Added file: http://bugs.python.org/file35031/fix_winreg_setvalueex-py27.patch

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2014-04-24 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


Added file: http://bugs.python.org/file35032/newsmerge.py

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2014-04-24 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


Removed file: http://bugs.python.org/file35011/newsmerge.py

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



[issue17552] socket.sendfile()

2014-04-24 Thread akira

akira added the comment:

count and blocksize are completely different.

*count* specifies how many bytes at most socket.sendfile should sent overall. 
It may change the result i.e., it may not be necessary that the file is read 
until EOF.

It has the same meaning as *nbytes* parameter for os.sendfile or *nbytes* in 
msg217121

*blocksize* doesn't change how many bytes is read in the end by 
socket.sendfile. At most it may affect time performance. It is 
*nbytes_per_send* in msg217121

--

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



[issue17552] socket.sendfile()

2014-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I'm -1 about adding count *and* blocksize parameters. blocksize  alone 
 is good enough IMO and considering what I've just described it
 is a better name than count.

I'm confused. Why is blocksize necessary at all?

 using os.path.getsize(file.name) looks risky to me

Why not fstat(fd) ?

--

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Changes by Russell Ballestrini russell.ballestr...@gmail.com:


Removed file: 
http://bugs.python.org/file35024/difflib-patch-to-save-scores.patch

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Russell Ballestrini added the comment:

Ok, this patch is ready for review.

--
Added file: 
http://bugs.python.org/file35033/diff-lib-get-scored-matches-tests-and-docs.patch

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Tim Peters

Tim Peters added the comment:

I wonder whether this new function would attract any users, given that the user 
already has control over the smallest ratio that will be accepted, and over the 
maximum number of close matches returned.  That's always been sufficient for me.

What useful thing(s) can the user do with the scores?  If there are compelling 
uses, in _those_ contexts are the `n` and `cutoff` arguments useful too?  Or 
would it, for example, be more useful to generate all (score, word) pairs and 
let the user filter them as they wish?  Without a concrete use case, there's no 
clear answer.

About existing tests for `get_close_matches()`, those are in the function's 
docstring.  doctest checks them.

About the new tests in the patch, note that comparing lists for equality 
should be done via AssertListEqual, not via AssertEqual.  Don't ask me why, 
but someone will eventually yell about it ;-)

--

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



[issue21292] C API in debug fails

2014-04-24 Thread Steve

Steve added the comment:

Indeed, but not defining _DEBUG for debug compiling is not realistic.  Too many 
dependencies.  I am not even sure it would work, because if we bind with the 
debug libraries, but build with the release headers, it might break.  In any 
case it is not an option we have on the table at this moment.

As for the linking part, I am not sure I am following you.  Your runtime 
libraries and DLLs should not need to be linked to anything.  They may be 
dependent on the release msvcrt, and that is fine (like I said, we can live 
with the Python parts in release).  We have many other such libraries that are 
only in release mode (even when we build in debug).

--

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



[issue14218] include rendered output in addition to markup

2014-04-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The link in the first message does not work. This should:
https://docs.python.org/devguide/documenting.html
The section under discussion, which pydev controls, as opposed to the full .rst 
doc at http://docutils.sourceforge.net/rst.html, is
https://docs.python.org/devguide/documenting.html#restructuredtext-primer
https://docs.python.org/devguide/documenting.html#additional-markup-constructs

I still agree in general with the request. What I tried to say before is that 
showing results somehow reinforces learning. Why does the tutorial start with
 2 + 2
4
? Everyone *knows* that 2 + 2 is 4. Yet is helps to show that Python actually 
does the right thing. Tshepang is asking for something similar.

I agree that one or more tables are needed. The example given could have a 
third column. One thing good about the table is that is gives the goal first, 
and then the means. Contrast that with 
  one asterisk: *text* for emphasis (italics),
This sentence might be ok for a reading guide (if I see one asterisk, what does 
it mean), but not for choosing what to write.

Here is a sentence that would be really clearer with the result:
it must be separated from surrounding text by non-word characters. Use a 
backslash escaped space to work around that: thisis\ *one*\ word.
It took me several seconds to really get that the result would be 
thisisONEword, where the capitals indicate italics.

This sentence I do not understand. Every explicit markup block which isn’t a 
valid markup construct (like the footnotes above) is regarded as a comment. It 
seems to say that the footnote markup given is not valid. And what does 
'regarded as a comment' mean? Is the invalid markup block deleted? specially 
displayed? or displayed normally?

As for style differences: the guide could start with The exact way markup is 
rendered depends on the theme. The examples below are rendered with the 
'devguide' theme used for the rest of the devguide.

I am probably the best person nosy here to write at least a draft of a patch 
since I believe it is needed, have some sense of doc style, but still know .rst 
poorly enough to have difficulties with the current version. It would be a good 
way to finally learn the markup.

It is somewhat confusing that many of the same topics are covered twice, first 
for standard .rst, and then for python extensions. Ezio's example table seems 
to combine both. If this is done (and I think it helpful), there should be a 
column indicating which is which.

--

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



[issue15569] Doc doc: incorrect description of some roles as format-only

2014-04-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There are no versions for the devguide. There is another misplaced role:
:
option
A command-line option of Python. The leading hyphen(s) must be included. If 
a matching cmdoption directive exists, it is linked to. For options of other 
programs or scripts, use simple ``code`` markup.

I think The following role does possibly create a cross-reference, but does 
not refer to objects: should be changed to something like The following roles 
do not refer to module objects, but possibly create cross-references or 
internal links:. Move the three misplaced roles here, along with token and 
term.

--
nosy: +terry.reedy
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini

Russell Ballestrini added the comment:

At some point I plan to write a web API that accepts a word, 'doge' and returns 
a list of possible suggestions and scores.  Later a did you mean dog style 
suggestion could be implemented on top.

We compute the scores, and it is computationally taxing, we shouldn't always 
throw this data away.  Most users will continue to use get_close_matches, some 
users might want to build indexes on the scores.  

Other users may want to cache (memonize) common queries for super fast look 
ups.  Additionally the new function will give end-users the opportunity to 
inspect the scoring algos output.

I prefer to use the same arg spec because it is already widely understood and 
documented.

--

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



[issue16574] clarify policy on updates to final peps

2014-04-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

With respect to editing final peps, I think this issue should be closed. The 
current PEP 1 statement accurately describes what we do, which is that in 
general we do not edit final peps. Moreover, Chris has not submitted a patch 
and I doubt anyone else knows what he thought he might add or where,

The only related question I have is in relation to Martin's point 3.
https://docs.python.org/devguide/documenting.html#id3
has the following:

pep
A reference to a Python Enhancement Proposal. This generates appropriate 
index entries. The text “PEP number” is generated; in the HTML output, this 
text is a hyperlink to an online copy of the specified PEP.

Should we add something like Such links should not be a substitute for 
properly documenting the language in the manuals.

--
nosy: +terry.reedy

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



[issue17227] devguide: buggy heading numbers

2014-04-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The only change is that '25' is now '28'.

A possible solution, without changing Sphinx, is to reduce the headers to a 
couple of words and put the question under the header, possibly in italics.

*Q. How do I do this difficult thing?*

A. Do 2 pushups, sleep 3 hours, drink water, and do it.

I am not sure how this would affect the linked index at the top that appears 
before 28.1 Communications.

--
nosy: +terry.reedy

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



[issue11708] argparse: suggestion for formatting optional positional args

2014-04-24 Thread paul j3

paul j3 added the comment:

This patch adds a ReGroupHelpFormatter class, which regroups positional 
arguments in the usage line as discussed before.  It builds on the reworked 
usage formatter in bugs/python.org/issue11874 (which keeps usage as a list 
longer).

For a complicate parser, usage may look like:

usage: regp [-h] foo [arg1 [arg2 [arg3 [arg3 ...] [arg4

--
keywords: +patch
Added file: http://bugs.python.org/file35034/regroup.patch

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



[issue11708] argparse: suggestion for formatting optional positional args

2014-04-24 Thread paul j3

paul j3 added the comment:

This is a testing script for this patch.  It is not a unit test.
Example:

p = argparse.ArgumentParser()
p.formatter_class = argparse.ReGroupHelpFormatter
p.add_argument('foo')
p.add_argument('arg1',nargs='?')
p.add_argument('arg2',nargs='?')
a = p.add_argument('arg3',nargs='*')
b = p.add_argument('arg4', nargs='?')
# usage: regp [-h] foo [arg1 [arg2 [arg3 [arg3 ...] [arg4

--
Added file: http://bugs.python.org/file35035/test_regroup.py

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