Re: How to generate only rotationally-unique permutations?

2012-05-19 Thread Arnaud Delobelle
On 19 May 2012 06:23, John O'Hagan resea...@johnohagan.com wrote:
 To revisit a question which I'm sure none of you remember from when I posted 
 it
 a year or so ago - there were no takers at the time - I'd like to try again 
 with
 a more concise statement of the problem:

 How to generate only the distinct permutations of a sequence which are not
 rotationally equivalent to any others? More precisely, to generate only the 
 most
 left-packed of each group of rotationally equivalent permutations, such that
 for each permutation p:

This makes me think of Lyndon words.  A Lyndon word is a word which is
the only lexicographical minimum of all its rotations.  There is a
very effective way of generating Lyndon words of length = n.  It may
be possible to adapt it to what you want (obviously as Lyndon words
are aperiodic you'd have to generate Lyndon word of length d | n when
suitable).

-- 
Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to generate only rotationally-unique permutations?

2012-05-19 Thread Zero Piraeus
:

On 19 May 2012 01:23, John O'Hagan resea...@johnohagan.com wrote:
 How to generate only the distinct permutations of a sequence which are not
 rotationally equivalent to any others? More precisely, to generate only the 
 most
 left-packed of each group of rotationally equivalent permutations, such that
 for each permutation p:

It's late and I'm tired (and the solution below isn't a generator), but ...

itertools.permutations() generates results in lexicographic order [1],
so if you reverse-sort the sequence before processing it, when you get
a sequence back whose first item isn't the maximum, you'll know that
you've got all the sequences whose first item *is* the maximum - which
means you can bail at that point.

Wow, that's a nasty sentence. As I said, tired. Anyway - you'll get
dupes if there are non-unique items in the rest of the sequence, so
some form of filtering is required, but you could use a set to handle
that. Something like:

from itertools import permutations

def rot_uniq_perms(seq):
result = set()
seq = sorted(seq, reverse=True)
maximum = seq[0]
for x in permutations(seq):
if x[0] != maximum:
break
else:
result.add(x[::-1])
return result

No idea how this performs compared to your existing solution, but it
might be a starting point.

[1] http://docs.python.org/library/itertools.html#itertools.permutations

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


ctype C library call always returns 0 with Python3

2012-05-19 Thread Johannes Bauer
Hi group,

I'm playing with ctypes and using it to do regressions on some C code
that I compile as a shared library. Python is the testing framework.

This works nicely as long as I do not need the return value (i.e.
calling works as expected and parameters are passed correctly). The
return value of all functions is always zero in my case, however.

Even the example in the standard library fails:

import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))

Always returns 0.

I'm working on a x86-64 Gentoo Linux and can reproduce this behavior
with Python 3.1.4 and Python 3.2.3.

On Python 2.7.3 and Python 2.6.6 the example works fine on my system.

Since I'd like to use Python3, I'm curious to know what changed in the
behavior and how I can get this to run. Any help is greatly appreciated.

Best regards,
Joe

-- 
 Wo hattest Du das Beben nochmal GENAU vorhergesagt?
 Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa hidbv3$om2$1...@speranza.aioe.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctype C library call always returns 0 with Python3

2012-05-19 Thread Nobody
On Sat, 19 May 2012 11:30:46 +0200, Johannes Bauer wrote:

 import ctypes
 libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
 print(libc.strchr(abcdef, ord(d)))

In 3.x, a string will be passed as a wchar_t*, not a char*. IOW, the
memory pointed to by the first argument to strchr() will consist mostly of
NUL bytes.

Either use a bytes instead of a string:

 print(libc.strchr(babcdef, ord(d)))
198291

or specify the argument types to force a conversion:

 libc.strchr.argtypes = [c_char_p, c_int]
 print(libc.strchr(abcdef, ord(d)))
1984755787

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


Re: ctype C library call always returns 0 with Python3

2012-05-19 Thread Colin McPhail

On 19/05/2012 10:30, Johannes Bauer wrote:

Even the example in the standard library fails:

import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))

Always returns 0.


I think there may be two problems with this code:

(1) You are using a 64-bit system but, in the absence of a function 
prototype for strchr, ctypes will be passing and returning 32-bit types. 
To add prototype information put something like:

  libc.strchr.restype = ctypes.c_char_p
  libc.strchr.argtypes = [ctypes.c_char_p, c_int]
before the call of strchr().

(2) In Python3 strings are not plain sequences of bytes by default. In 
your example try passing babcdef instead of abcdef.


-- CMcP

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


Re: Plot a function with matplotlib?

2012-05-19 Thread Vlastimil Brom
2012/5/19 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
 I have matplotlib and iPython, and want to plot a function over an
 equally-spaced range of points.

 That is to say, I want to say something like this:

 plot(func, start, end)

 rather than generating the X and Y values by hand, and plotting a scatter
 graph. All the examples I've seen look something like this:

 from pylab import *
 import numpy as np
 t = arange(0.0, 2.0+0.01, 0.01)  # generate x-values
 s = sin(t*pi)  # and y-values
 plot(t, s)
 show()


 which is fine for what it is, but I'm looking for an interface closer to
 what my HP graphing calculator would use, i.e. something like this:


 plot(lambda x: sin(x*pi), # function or expression to plot,
     start=0.0,
     end=2.0,
    )

 and have step size taken either from some default, or better still,
 automatically calculated so one point is calculated per pixel.

 Is there a way to do this in iPython or matplotlib?


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


Hi,
would a mpmath solution be acceptable?
http://code.google.com/p/mpmath/
http://mpmath.googlecode.com/svn/trunk/doc/build/plotting.html#mpmath.plot


mpmath.plot(ctx, f, xlim=[-5, 5], ylim=None, points=200, file=None,
dpi=None, singularities=[], axes=None)
Shows a simple 2D plot of a function ... or list of functions ...
over a given interval specified by xlim. ...


 import mpmath
 mpmath.plot(lambda x: mpmath.sin(x*mpmath.pi), xlim=[0.0, 2.0])

hth,
  vbr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: .py to .pyc

2012-05-19 Thread Colin J. Williams

On 18/05/2012 7:20 PM, Tony the Tiger wrote:

On Sun, 13 May 2012 23:36:02 +0200, Irmen de Jong wrote:


Why do you care anyway?


Wanna hide his code...?

  /Grrr
Curiosity.  Perhaps there are stack-based processors out there which 
could use the .pyc code more directly.


Colin W.
--
http://mail.python.org/mailman/listinfo/python-list


sqlalchemy: delete() on m:n-relationship

2012-05-19 Thread Wolfgang Meiners
Hi all,

i dont understand, how sqlalchemy deletes from m:n relationships.

Maybe, someone can explain to me, how to delete in the following program:

(pyhton3, sqlalchemy 0.7.0)

=
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 '''
 Created on 19.05.2012
 
 @author: wolfgang
 
 '''
 
 from sqlalchemy import *
 
 from sqlalchemy.orm.session import sessionmaker
 from sqlalchemy.orm import relationship, backref
 from sqlalchemy.ext.declarative import declarative_base
 
 
 Base = declarative_base()
 
 class Book(Base):
 __tablename__='books'
 
 def __init__(self, title, authors):
 # here authors is a list of items of type Autor
 self.title = title
 for author in authors:
 self.authors.append(author)
 
 bid = Column(Integer, primary_key=True)
 title = Column(String, index=True)
 
 authors = relationship('Author', secondary='author_book', 
backref=backref('books', order_by='Book.title', 
 cascade='all, delete'),
cascade='all, delete')
 
 class Author(Base):
 __tablename__ = 'authors'
 
 def __init__(self, name):
 self.name = name
 
 aid = Column(Integer, primary_key=True)
 name = Column(String, index=True)
 
 
 # Association table between authors and books:
 author_book = Table('author_book', Base.metadata,
 Column('aid', Integer, ForeignKey('authors.aid'), 
 primary_key=True),
 Column('bid', Integer, ForeignKey('books.bid'), 
 primary_key=True))
 
 
 class DB:
 def __init__(self, dbname=None, echo=False):
 self.dbname = dbname if dbname else ':memory:'
 self.dbfile = 'sqlite:///{db}'.format(db=self.dbname)
 self.engine = create_engine(self.dbfile)
 Base.metadata.create_all(self.engine)
 self.Session = sessionmaker(self.engine)
 
 def find_or_create_author(session, name):
 qauthor = session.query(Author).filter_by(name=name)
 if qauthor.count() == 0:
 session.add(Author(name=name))
 return qauthor.one()
 
 if __name__ == '__main__':
 
 db = DB(dbname='booksdb.sqlite', echo=True)
 session = db.Session()
 
 # insert 4 books into db
 session.add_all([Book(title='Title a',
   authors=[find_or_create_author(session, 
 name='Author 1'),
find_or_create_author(session, 
 name='Author 2')]),
  Book(title='Title b',
   authors=[find_or_create_author(session, 
 name='Author 1'),
find_or_create_author(session, 
 name='Author 2')]),
  Book(title='Title c',
   authors=[find_or_create_author(session, 
 name='Author 3'),
find_or_create_author(session, 
 name='Author 4')]),
  Book(title='Title d',
   authors=[find_or_create_author(session, 
 name='Author 3'),
find_or_create_author(session, 
 name='Author 4')])])
 
 session.commit()
 
 # At this point there are 4 book in db, the first 2 written by Author 1 
 and Author 2,
 # the last 2 written by Author 3 and Author 4.
 # Now, i delete books with bid == 1 and bid == 3:
 
 book1 = session.query(Book).filter_by(bid=1).one()
 session.delete(book1)
 
 session.query(Book).filter_by(bid=3).delete()
 
 session.commit()
 
 # The first query deletes to much: Title b is related to Author 1 and 
 Author 2
 # this relation has dissapeared from the db
 
 # The last query deletes to less: There is no Title 3, but the entries 
 # of this book remain in the associationtable.
 
 # How is this done right?
==

after i run this program, the contents of booksdb.sqlite has the
following data:

$ sqlite3 booksdb.sqlite
SQLite version 3.6.12
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlite select * from author_book;
3|3
4|3
3|4
4|4

sqlite select * from
   ... books natural inner join author_book
   ... natural inner join authors;
4|Title d|3|Author 3
4|Title d|4|Author 4

which means, association between Title b and ist authors is lost,
information on Title c is still in author_book table.

Thank you for any help

Wolfgang
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions on __slots__

2012-05-19 Thread Adam Tauno Williams
On Fri, 2012-05-18 at 09:53 -0700, Charles Hixson wrote: 
 Does __slots__ make access to variables more efficient?

Absolutely, yes.

 If one uses property() to create a few read-only pseudo-variables, does 
 that negate the efficiency advantages of using __slots__?
 (Somehow I feel the documentation needs a bit of improvement.)

If you are tempted to use property, setattr, etc... then do not use
__slots__.  __slots__ should really only be used for Fly Weight pattern
type work, or at least for objects with a limited scope and will not be
inherited from.


signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Plot a function with matplotlib?

2012-05-19 Thread Alex van der Spek
On Sat, 19 May 2012 01:59:59 +, Steven D'Aprano wrote:

 I have matplotlib and iPython, and want to plot a function over an
 equally-spaced range of points.
 
 That is to say, I want to say something like this:
 
 plot(func, start, end)
 
 rather than generating the X and Y values by hand, and plotting a
 scatter graph. All the examples I've seen look something like this:
 
 from pylab import *
 import numpy as np
 t = arange(0.0, 2.0+0.01, 0.01)  # generate x-values s = sin(t*pi)  #
 and y-values
 plot(t, s)
 show()
 
 
 which is fine for what it is, but I'm looking for an interface closer to
 what my HP graphing calculator would use, i.e. something like this:
 
 
 plot(lambda x: sin(x*pi), # function or expression to plot,
  start=0.0,
  end=2.0,
 )
 
 and have step size taken either from some default, or better still,
 automatically calculated so one point is calculated per pixel.
 
 Is there a way to do this in iPython or matplotlib?

Not to my knowledge unless you code it yourself.

However in gnuplot (www.gnuplot.info)

gnuplot set xrange[start:end]
gnuplot foo(x)=mycomplicatedfunction(x)
gnuplot plot foo(x)

or shorter still

gnuplot plot [start:end] foo(x)

without the need to set the xrange in advance.

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


Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-19 Thread Adam Tauno Williams
On Thu, 2012-05-17 at 11:13 +1000, Chris Angelico wrote: 
 On Thu, May 17, 2012 at 9:01 AM, Ethan Furman et...@stoneleaf.us wrote:
  A record is an interesting critter -- it is given life either from the user
  or from the disk-bound data;  its fields can then change, but those changes
  are not reflected on disk until .write_record() is called;  I do this
  because I am frequently moving data from one table to another, making
  changes to the old record contents before creating the new record with the
  changes -- since I do not call .write_record() on the old record those
  changes do not get backed up to disk.
 I strongly recommend being more explicit about usage and when it gets
 written and re-read, 

You need to define a 'session' that tracks records and manages flushing.
Potentially it can hold a pool of weak references to record objects that
have been read from disk.  Record what records are 'dirty' and flush
those to disk explicitly or drop all records ('essentially rollback').
That is the only sane way to manage this.

 rather than relying on garbage collection.

+1 +1 Do *not* rely on implementation details as features.  Sooner or
later doing so will always blow-up.

 Databasing should not be tied to a language's garbage collection.
 Imagine you were to reimplement the equivalent logic in some other
 language - could you describe it clearly? If so, then that's your
 algorithm. If not, you have a problem.


signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Plot a function with matplotlib?

2012-05-19 Thread Miki Tebeka
 I'm looking for an interface closer to 
 what my HP graphing calculator would use, i.e. something like this:
 
 
 plot(lambda x: sin(x*pi), # function or expression to plot,
  start=0.0,
  end=2.0,
 )
 
 and have step size taken either from some default, or better still, 
 automatically calculated so one point is calculated per pixel.
 
 Is there a way to do this in iPython or matplotlib?
I don't think there is, but using range and list comprehension you can write a 
little utility function that does that:

HTH
--
Miki Tebeka miki.teb...@gmail.com
http://pythonwise.blogspot.com

def simplot(fn, start, end):
xs = range(start, end+1)
plot(xs, [fn(x) for x in xs)])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: bash/shell to python

2012-05-19 Thread Michael Torrie
On 05/16/2012 08:16 PM, Rita wrote:
 I currently build a lot of interfaces/wrappers to other applications
 using bash/shell. One short coming for it is it lacks a good method
 to handle arguments so I switched to python a while ago to use
 'argparse' module.

Actually there is a great way of parsing command line options in
bash, using the GNU getopt program.  See:
http://www.manpagez.com/man/1/getopt/

This command is available on all Linux systems, and most BSD systems.
There's also freegetopt, a BSD implementation for unix, MSDOS, or Windows.

 Its a great complement to subprocess module. I was wondering if there
 is a generic framework people follow to build python scripts which
 are replacing shell scripts? Is there a guide or a template to
 follow?

Besides the advice given by the other posters in this thread, here is a
very good document on some unique aspects of python that are well suited
to doing system programming or shell scripting in python:

http://www.dabeaz.com/generators/

This describes how generators can be used to replace pipes with
something that is quite efficient and very pythonic.  See the
presentation pdf first.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctype C library call always returns 0 with Python3

2012-05-19 Thread Hans Mulder
On 19/05/12 13:20:24, Nobody wrote:
 On Sat, 19 May 2012 11:30:46 +0200, Johannes Bauer wrote:
 
 import ctypes
 libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
 print(libc.strchr(abcdef, ord(d)))
 
 In 3.x, a string will be passed as a wchar_t*, not a char*. IOW, the
 memory pointed to by the first argument to strchr() will consist mostly of
 NUL bytes.
 
 Either use a bytes instead of a string:
 
print(libc.strchr(babcdef, ord(d)))
   198291
 
 or specify the argument types to force a conversion:
 
libc.strchr.argtypes = [c_char_p, c_int]
print(libc.strchr(abcdef, ord(d)))
   1984755787

You'll also want to specify the return type:

 libc.strchr.argtypes = [c_char_p, c_int]
 print(libc.strchr(babcdef, ord(d)))
7224211
 libc.strchr.restype = c_char_p
 print(libc.strchr(babcdef, ord(d)))
b'def'

Hope this helps,

-- HansM

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


Re: How to generate only rotationally-unique permutations?

2012-05-19 Thread John O'Hagan
On Sat, 19 May 2012 09:15:39 +0100
Arnaud Delobelle arno...@gmail.com wrote:

 On 19 May 2012 06:23, John O'Hagan resea...@johnohagan.com wrote:
[...]
 
  How to generate only the distinct permutations of a sequence which are not
  rotationally equivalent to any others? More precisely, to generate only the
  most left-packed of each group of rotationally equivalent permutations,
  such that for each permutation p:
 
 This makes me think of Lyndon words.  A Lyndon word is a word which is
 the only lexicographical minimum of all its rotations.  There is a
 very effective way of generating Lyndon words of length = n.  It may
 be possible to adapt it to what you want (obviously as Lyndon words
 are aperiodic you'd have to generate Lyndon word of length d | n when
 suitable).
 

Thanks for your suggestion. The Lyndon word generators I found were not
quite what I was after as they didn't guarantee giving sequences with the same
elements. but your suggestion led me to necklaces:

http://en.wikipedia.org/wiki/Necklace_ (combinatorics)
 
of which Lyndon words represent a special aperiodic case. I found these
algorithms for generating necklaces:

http://www.sagenb.org/src/combinat/necklace.py

which seems to be exactly what I want. Thanks!

Regards,
--
John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jython 2.7 alpha1 is out!

2012-05-19 Thread Guido van Rossum
Congrats Frank!

I reposted this on my G+ account and got some interesting comments.
https://plus.google.com/u/0/115212051037621986145/posts/ifyqW3JBd3a

There's got to be a way for you to make money off the Oracle connection!

(PS: It would have been nice if there was an announcement page on the
Jython website/wiki instead of having to link to a mailing list
archive page. :-)

--Guido

On Thu, May 17, 2012 at 1:56 PM, fwierzbi...@gmail.com
fwierzbi...@gmail.com wrote:
 On behalf of the Jython development team, I'm pleased to announce that
 Jython 2.7 alpha1 is available for download here:
 http://sourceforge.net/projects/jython/files/jython-dev/2.7.0a1/jython_installer-2.7a1.jar/downloaddownload.
 See the installation instructions here:
 http://wiki.python.org/jython/InstallationInstructions

 I'd like to thank Adconion Media Group for sponsoring my work on
 Jython 2.7. I'd also like to thank the many contributors to Jython.

 Jython 2.7 alpha1 implements much of the functionality introduced by
 CPython 2.6 and 2.7. There are still some missing features, in
 particular bytearray and the io system are currently incomplete.

 Please report any bugs here: http://bugs.jython.org/ Thanks!

 -Frank
 --
 http://mail.python.org/mailman/listinfo/python-announce-list

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



-- 
--Guido van Rossum (python.org/~guido)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions on __slots__

2012-05-19 Thread Charles Hixson

On 05/19/2012 06:39 AM, Adam Tauno Williams wrote:

On Fri, 2012-05-18 at 09:53 -0700, Charles Hixson wrote:
   

Does __slots__ make access to variables more efficient?
 

Absolutely, yes.

   

If one uses property() to create a few read-only pseudo-variables, does
that negate the efficiency advantages of using __slots__?
(Somehow I feel the documentation needs a bit of improvement.)
 

If you are tempted to use property, setattr, etc... then do not use
__slots__.  __slots__ should really only be used for Fly Weight pattern
type work, or at least for objects with a limited scope and will not be
inherited from.
   
Thank you.  What I really wanted was a named list, sort of like a 
named tuple, only modifiable, but since the only way to do it was to 
create a class, I started thinking of reasonable operations for it to 
perform (data hiding, etc.)  Sounds like I should go back to the named 
list idea.


--
Charles Hixson

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


Re: How to generate only rotationally-unique permutations?

2012-05-19 Thread John O'Hagan
On Sat, 19 May 2012 04:21:35 -0400
Zero Piraeus sche...@gmail.com wrote:

 :
 
 On 19 May 2012 01:23, John O'Hagan resea...@johnohagan.com wrote:
  How to generate only the distinct permutations of a sequence which are not
  rotationally equivalent to any others? More precisely, to generate only the
  most left-packed of each group of rotationally equivalent permutations,
  such that for each permutation p:
 
 It's late and I'm tired (and the solution below isn't a generator), but ...
 
 itertools.permutations() generates results in lexicographic order [1],
 so if you reverse-sort the sequence before processing it, when you get
 a sequence back whose first item isn't the maximum, you'll know that
 you've got all the sequences whose first item *is* the maximum - which
 means you can bail at that point.
 
 Wow, that's a nasty sentence. As I said, tired. Anyway - you'll get
 dupes if there are non-unique items in the rest of the sequence, so
 some form of filtering is required, but you could use a set to handle
 that. Something like:
 
 from itertools import permutations
 
 def rot_uniq_perms(seq):
 result = set()
 seq = sorted(seq, reverse=True)
 maximum = seq[0]
 for x in permutations(seq):
 if x[0] != maximum:
 break
 else:
 result.add(x[::-1])
 return result
 
 No idea how this performs compared to your existing solution, but it
 might be a starting point.

Thanks for your reply, but I can't profitably use itertools.permutations, as my
sequences have repeated elements, so I was using a python implementation of the
next_permutation algorithm, which yields only distinct permutations. Your
trick of bailing when x[0] != maximum is, I think, another version of what my
attempt did, that is, remove the maximum, permute the rest, then replace it.
But the problem remains of what to do if there are several maxima.

That is obviated by a solution suggested by another reply, of using a
necklace generator.

Thanks again,
--
John
-- 
http://mail.python.org/mailman/listinfo/python-list


Advantages of logging vs. print()

2012-05-19 Thread Giampaolo Rodolà
Hi all,
I'm currently working on 1.0.0 release of pyftpdlib module.
This new release will introduce some backward incompatible changes in
that certain APIs will no longer accept bytes but unicode.
While I'm at it, as part of this breackage I was contemplating the
possibility to rewrite my logging functions, which currently use the
print statement, and use the logging module instead.

As of right now pyftpdlib delegates the logging to 3 functions:

def log(s):
Log messages intended for the end user.
print s

def logline(s):
Log commands and responses passing through the command channel.
print s

def logerror(s):
Log traceback outputs occurring in case of errors.
print  sys.stderr, s


The user willing to customize logs (e.g. write them to a file) is
supposed to just overwrite these 3 functions as in:


 from pyftpdlib import ftpserver
 def log2file(s):
...open(''ftpd.log', 'a').write(s)
...
 ftpserver.log = ftpserver.logline = ftpserver.logerror = log2file


Now I'm asking: what benefits would imply to get rid of this approach
and use logging module instead?
From a module vendor perspective, how exactly am I supposed to
use/provide logging in my module?
Am I supposed to do this:

import logging
logger = logging.getLogger(pyftpdlib)

...and state in my doc that logger is the object which is supposed
to be used in case the user wants to customize how logs behave?
Is logging substantially slower compared to print()?


Thanks in advance

--- Giampaolo
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/
http://code.google.com/p/pysendfile/
-- 
http://mail.python.org/mailman/listinfo/python-list


setdefault behaviour question

2012-05-19 Thread pete McEvoy
I am confused by some of the dictionary setdefault behaviour, I think
I am probably missing the obvious here.

def someOtherFunct():
print in someOtherFunct
return 42

def someFunct():
myDict = {1: 2}
if myDict.has_key(1):
print myDict has key 1
x = myDict.setdefault(1, someOtherFunct())   #  I didn't
expect someOtherFunct to get called here
print x, x
y = myDict.setdefault(5, someOtherFunct())
print y, y


+

if I call someFunct() I get the following output

myDict has key 1
in someOtherFunct
x 2
in someOtherFunct
y 42


For the second use of setdefault I do expect a call as the dictionary
does not the key. Will the function, someOtherFunct, in setdefault
always be called anyway and it is just that the dictionary will not be
updated in any way?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: setdefault behaviour question

2012-05-19 Thread MRAB

On 19/05/2012 20:44, pete McEvoy wrote:

I am confused by some of the dictionary setdefault behaviour, I think
I am probably missing the obvious here.

def someOtherFunct():
 print in someOtherFunct
 return 42

def someFunct():
 myDict = {1: 2}
 if myDict.has_key(1):
 print myDict has key 1
 x = myDict.setdefault(1, someOtherFunct())   #  I didn't
expect someOtherFunct to get called here
 print x, x
 y = myDict.setdefault(5, someOtherFunct())
 print y, y


+

if I call someFunct() I get the following output

myDict has key 1
in someOtherFunct
x 2
in someOtherFunct
y 42


For the second use of setdefault I do expect a call as the dictionary
does not the key. Will the function, someOtherFunct, in setdefault
always be called anyway and it is just that the dictionary will not be
updated in any way?


The answer is yes.

someOtherFunct() is called and then 1 and the result of
someOtherFunct() are passed as arguments to myDict.setdefault(...).
--
http://mail.python.org/mailman/listinfo/python-list


Re: setdefault behaviour question

2012-05-19 Thread pete McEvoy
Ah - I have checked some previous posts (sorry, should
have done this first) and I now can see that the
lazy style evaluation approach would not be good.
I can see the reasons it behaves this way.

many thanks anyway.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Plot a function with matplotlib?

2012-05-19 Thread Mark Lawrence

On 19/05/2012 02:59, Steven D'Aprano wrote:

I have matplotlib and iPython, and want to plot a function over an
equally-spaced range of points.

That is to say, I want to say something like this:

plot(func, start, end)

rather than generating the X and Y values by hand, and plotting a scatter
graph. All the examples I've seen look something like this:

from pylab import *
import numpy as np
t = arange(0.0, 2.0+0.01, 0.01)  # generate x-values
s = sin(t*pi)  # and y-values
plot(t, s)
show()


which is fine for what it is, but I'm looking for an interface closer to
what my HP graphing calculator would use, i.e. something like this:


plot(lambda x: sin(x*pi), # function or expression to plot,
  start=0.0,
  end=2.0,
 )

and have step size taken either from some default, or better still,
automatically calculated so one point is calculated per pixel.

Is there a way to do this in iPython or matplotlib?




Sorry don't know but wouldn't it make sense to ask on the matplotlib 
users mailing lst, cos like most python users the're extremely friendly?


--
Cheers.

Mark Lawrence.

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


Re: print XML

2012-05-19 Thread Karl Knechtel
What do you want the contents of the file to look like? Why are you
parsing the XML in the first place? (What do you want to happen if the
data on `sys.stdin` isn't actually valid XML?)

On Thu, May 17, 2012 at 9:52 AM, Nibin V M nibi...@gmail.com wrote:
 Hello,

 I have the following code, which will assign  XML data to a variable! What
 is the best method to write the contents of the variable to a file?

 ===
 doc = minidom.parse(sys.stdin)
 ===

 Any help will be highly appreciated!

 Thank you,
 --
 Regards

 Nibin.

 http://TechsWare.in


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




-- 
~Zahlman {:
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: setdefault behaviour question

2012-05-19 Thread Chris Angelico
On Sun, May 20, 2012 at 5:44 AM, pete McEvoy peterx.mce...@gmail.com wrote:
 I am confused by some of the dictionary setdefault behaviour, I think
 I am probably missing the obvious here.

 def someOtherFunct():
    print in someOtherFunct
    return 42

    x = myDict.setdefault(1, someOtherFunct())   #  I didn't
 expect someOtherFunct to get called here

Python doesn't have lazy evaluation as such, but if what you want is a
dictionary that calls a function of yours whenever a value isn't
found, check out collections.defaultdict:

 import collections
 a=collections.defaultdict()
 def func():
print(Generating a default!)
return 42

 a.default_factory=func
 x = a[1]
Generating a default!
 x = a[1]

Tested in 3.2, but should work fine in 2.5 and newer.

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


[issue14684] zlib set dictionary support inflateSetDictionary

2012-05-19 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

The code should be changed to use the buffer API (instead of accepting
only bytes objects). Other than that, I think it's ready for integration.

--

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



[issue14838] IDLE Will not load on reinstall

2012-05-19 Thread Cain

Cain gamingleg...@gmail.com added the comment:

Awesome, that resolved it. Simply started idle through the command window, then 
changed the theme back to the default. Thanks Roger.

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com added the comment:

OK, here's a patch for configure.ac which seems to fix this problem -- if folks 
could review and test it that would be great.

--
keywords: +patch
Added file: http://bugs.python.org/file25634/sqlite3_int64.patch

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



[issue14721] httplib doesn't specify content-length header for POST requests without data

2012-05-19 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

The rule for content-length seems, if there is a body for a request, even if 
the body is  ( empty body), then you should send the Content-Length.

The mistake in the Python httplib was, the set_content_length was called with 
this condition.

if body and ('content-length' not in header_names):

If the body was '', this was skipped. The default for GET and methods which do 
not use body was body=None and that was statement for correct in those cases.

A simple fix which covers the applicable methods and follows the definition of 
content-length seems to me like this:

-if body and ('content-length' not in header_names):
+if body is not None and 'content-length' not in header_names:

I prefer this rather than checking for methods explicitly as it could go into 
unnecessary details. (Things like if you are not sending a body why are you 
sending a Content-Length?. This fails the definition of Content-Length itself). 
The Patch is fine, I would adopt that for the above check and commit it all the 
active versions.

Thanks Arve Knudsen, for the bug report and the patch.

--

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



[issue14854] faulthandler: segfault with SystemError: null argument to internal routine

2012-05-19 Thread Zbyszek Jędrzejewski-Szmek

New submission from Zbyszek Jędrzejewski-Szmek zbys...@in.waw.pl:

Simply running './python -X faulthandler' in the source directory gives me this:

% ./python -X faulthandler
Fatal Python error: Py_Initialize: can't initialize faulthandler
SystemError: null argument to internal routine
[1]25118 abort (core dumped)  ./python -X faulthandler

% gdb ./python core
Core was generated by `./python -X faulthandler'.
Program terminated with signal 6, Aborted.
#0  0x7f52d7ff9475 in *__GI_raise (sig=optimized out)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x7f52d7ff9475 in *__GI_raise (sig=optimized out)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x7f52d7ffc6f0 in *__GI_abort () at abort.c:92
#2  0x004bc984 in Py_FatalError (msg=0x5b3750 Py_Initialize: can't 
initialize faulthandler)
at Python/pythonrun.c:2283
#3  0x004b85ed in Py_InitializeEx (install_sigs=1) at 
Python/pythonrun.c:361
#4  0x004b86ea in Py_Initialize () at Python/pythonrun.c:398
#5  0x004d55a6 in Py_Main (argc=3, argv=0x1b8f010) at Modules/main.c:624
#6  0x0041b120 in main (argc=3, argv=0x7fffc1ebb558) at 
./Modules/python.c:65
(gdb) 
#0  0x7f52d7ff9475 in *__GI_raise (sig=optimized out)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x7f52d7ffc6f0 in *__GI_abort () at abort.c:92
#2  0x004bc984 in Py_FatalError (msg=0x5b3750 Py_Initialize: can't 
initialize faulthandler)
at Python/pythonrun.c:2283
#3  0x004b85ed in Py_InitializeEx (install_sigs=1) at 
Python/pythonrun.c:361
#4  0x004b86ea in Py_Initialize () at Python/pythonrun.c:398
#5  0x004d55a6 in Py_Main (argc=3, argv=0x1b8f010) at Modules/main.c:624
#6  0x0041b120 in main (argc=3, argv=0x7fffc1ebb558) at 
./Modules/python.c:65

--
messages: 161097
nosy: haypo, zbysz
priority: normal
severity: normal
status: open
title: faulthandler: segfault with SystemError: null argument to internal 
routine

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



[issue14721] httplib doesn't specify content-length header for POST requests without data

2012-05-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 57f1d13c2cd4 by Senthil Kumaran in branch '2.7':
Fix Issue14721: Send Content-length: 0 for empty body () in the http.request
http://hg.python.org/cpython/rev/57f1d13c2cd4

New changeset 6da1ab5f777d by Senthil Kumaran in branch '3.2':
Fix Issue14721: Send Content-length: 0 for empty body () in the http.client 
requests
http://hg.python.org/cpython/rev/6da1ab5f777d

New changeset 732d70746fc0 by Senthil Kumaran in branch 'default':
merge - Fix Issue14721: Send Content-length: 0 for empty body () in the 
http.client requests
http://hg.python.org/cpython/rev/732d70746fc0

--
nosy: +python-dev

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



[issue14721] httplib doesn't specify content-length header for POST requests without data

2012-05-19 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

This is fixed in all the branches. Thanks!

--
assignee:  - orsenthil
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue14624] Faster utf-16 decoder

2012-05-19 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Thank you, Antoine. Now only issue14625 waits for review.

 changeset:   77012:3430d7329a3b
 +* UTF-8 and UTF-16 decoding is now 2x to 4x faster.

In fact now UTF-16 decoding faster for a maximum of +25% compared to Python 3.2 
on my computers (and sometimes a little slower yet). 2x to 4x it is faster 
compared to former slow-downed Python 3.3 (thanks to PEP 393).

--

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread Zbyszek Jędrzejewski-Szmek

Changes by Zbyszek Jędrzejewski-Szmek zbys...@in.waw.pl:


--
title: faulthandler: segfault with SystemError: null argument to internal 
routine - faulthandler: fatal error with SystemError: null argument to 
internal routine

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Yuriy Syrovetskiy

New submission from Yuriy Syrovetskiy c...@cblp.su:

IPv4 operations may fail on IPv6 systems, and vice versa. So we have to create 
sockets with the proper address family.

Maybe this behaviour could be incapsulated in socket object, but didn't find a 
good way to do it.

No documentation changed, because I just eliminate lack of implementation of 
already documented feature.

Please help to write tests.

I worked on the 3.2 branch, because the default branch has broken test_logging.

--
components: Library (Lib)
files: mywork.patch
keywords: patch
messages: 161101
nosy: cblp, vinay.sajip
priority: normal
severity: normal
status: open
title: IPv6 support for logging.handlers
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file25635/mywork.patch

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Yuriy Syrovetskiy

Yuriy Syrovetskiy c...@cblp.su added the comment:

More correct description: IPv4 operations may fail on IPv6 systems, and vice 
versa; so we have to detect the proper address family before creating a socket.

--

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

For TCP, socket.create_connection() is your friend. For UDP I'm not sure, but 
adding a helper to the socket module might also be a good idea.

--
nosy: +gregory.p.smith, pitrou
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.4

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The Linux getaddrinfo() man page has an UDP client example which uses connect() 
to decide whether the target address is valid or not.

--

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



[issue14472] .gitignore is outdated

2012-05-19 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Against which branch or Python version your patch is? It doesn't apply cleanly 
on any branch (and yes, I changed the target filename to .gitignore first).

--

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Apparently, connecting the socket is better because some systems (BSDs in 
particular) only report ICMP errors to connected UDP sockets. The Linux man 
page claims that this reporting is necessary regardless of whether the socket 
is connected.

I wonder what will happen under this patch if the server has both v4 and v6 
connectivity, and the client supports v6, but has no connectivity (other than, 
say, on the local link).

--
nosy: +loewis

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Ok, I find no way to override the linker so that it does not search the current 
directory first.
I think it is best, and probably in the spirit of visual studio, to use the 
reference part of a project to facilitate linking between dependency 
projects.  it is designed to take the hassle out of libraries and search paths. 
 I will add references where they are missing.

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 I think it is best, and probably in the spirit of visual studio, to  
 use the reference part of a project to facilitate linking between  
 dependency projects.  it is designed to take the hassle out of  
 libraries and search paths.  I will add references where they are  
 missing.

Sounds good to me.

--

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



[issue14845] list(generator expression) != [list comprehension]

2012-05-19 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Here is an updated patch, with proper project references added and some slight 
cleanup of .props files.

--
Added file: http://bugs.python.org/file25636/pcbuildpatch.patch

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



[issue13152] textwrap: support custom tabsize

2012-05-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d38e821c1b80 by Hynek Schlawack in branch 'default':
#13152: Allow to specify a custom tabsize for expanding tabs in textwrap
http://hg.python.org/cpython/rev/d38e821c1b80

--
nosy: +python-dev

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



[issue13152] textwrap: support custom tabsize

2012-05-19 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

I've added it myself and committed your code – thank you for your contribution 
John!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue14856] argparse: creating an already defined subparsers does not raises an exception

2012-05-19 Thread Étienne Buira

New submission from Étienne Buira etienne.bu...@free.fr:

With this patch, it raises an ArgumentException, instead of overwriting 
previous subparser without notice.

Regards.

--
components: Library (Lib)
files: argparse_no_dup_subparsers.diff
keywords: patch
messages: 161112
nosy: eacb
priority: normal
severity: normal
status: open
title: argparse: creating an already defined subparsers does not raises an 
exception
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file25637/argparse_no_dup_subparsers.diff

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



[issue11647] function decorated with a context manager can only be invoked once

2012-05-19 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

I'm closing this *without* converting ContextDecorator._recreate_cm() to a 
public method (although I'm also attaching the patch that would have done 
exactly that).

My rationale for doing so is that I *still* consider making 
_GeneratorContextManager a subclass of ContextDecorator a design error on my 
part. Converting the existing _recreate_cm() hook to a public refesh_cm() 
method would be actively endorsing that mistake and encouraging others to 
repeat it.

If anyone else wants to pursue this, create a new issue and be prepared to be 
very persuasive. After all, the current module maintainer just rejected his own 
implementation of the feature :)

--
resolution:  - fixed
status: open - closed
Added file: http://bugs.python.org/file25638/issue11647_refresh_cm.diff

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Here is a patch:


$ hg di
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -356,15 +356,15 @@ Py_InitializeEx(int install_sigs)
 
 _PyImportHooks_Init();
 
-/* initialize the faulthandler module */
-if (_PyFaulthandler_Init())
-Py_FatalError(Py_Initialize: can't initialize faulthandler);
-
 /* Initialize _warnings. */
 _PyWarnings_Init();
 
 import_init(interp, sysmod);
 
+/* initialize the faulthandler module */
+if (_PyFaulthandler_Init())
+Py_FatalError(Py_Initialize: can't initialize faulthandler);
+
 _PyTime_Init();
 
 if (initfsencoding(interp)  0)

--
nosy: +pitrou

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



[issue14847] AttributeError: NoneType has no attribute 'utf_8_decode'

2012-05-19 Thread Daniel Swanson

Daniel Swanson popcorn.tomato.d...@gmail.com added the comment:

I attempted to reproduce the error. I didn't, all I got was
'str' object has no attribute 'decode'
here is the whole test.

Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on 
win32
Type copyright, credits or license() for more information.
 b''.decode('utf-8')
''
 ''.decode('utf-8')
Traceback (most recent call last):
  File pyshell#1, line 1, in module
''.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
 b'x'.decode('utf-8')
'x'
 

Appearently, this error does not apply to Python 3.2.2.

--
nosy: +weirdink13

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



[issue14702] os.makedirs breaks under autofs directories

2012-05-19 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 I see no evidence that this is a bug in Linux,


stat(/net/prodigy, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
mkdir(/net/prodigy/tmp, 0777) = -1 EACCES (Permission denied)


As you can see, a stat() is already done on /net/prodigy.
Event if it wasn't done, calling mkdir() ought to trigger the mount.
So this is *definitely* as bug in autofs.

 and I think it's ridiculous to close it when a trivial one-line fix is 
 available.

Which one-line fix do you propose?

 I won't reopen it because it's obvious no one wants to address this. :(

It's not that we don't want to address this, but rather that we want
to avoid introducing hacks to work around OS bugs.

--

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-05-19 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

According to RFC 1808 [0], the netloc must follow //, so this doesn't seem to 
apply to 'tel' URIs.

[0]: http://tools.ietf.org/html/rfc1808.html#section-2.1

--

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



[issue14702] os.makedirs breaks under autofs directories

2012-05-19 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

 
 stat(/net/prodigy, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
 mkdir(/net/prodigy/tmp, 0777) = -1 EACCES (Permission denied)
 
 
 As you can see, a stat() is already done on /net/prodigy.

To be fair, that shouldn’t trigger a mount. Otherwise a `ls -l` on /net
would mount all volumes.

 Event if it wasn't done, calling mkdir() ought to trigger the mount.

I’m not sure if/where the behavior is defined – let’s what the Linux
people say.

--

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-05-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset ff0fd7b26219 by Ezio Melotti in branch '2.7':
#14072: Fix parsing of tel URIs in urlparse by making the check for ports 
stricter.
http://hg.python.org/cpython/rev/ff0fd7b26219

New changeset 9f6b7576c08c by Ezio Melotti in branch '3.2':
#14072: Fix parsing of tel URIs in urlparse by making the check for ports 
stricter.
http://hg.python.org/cpython/rev/9f6b7576c08c

New changeset b78c67665a7f by Ezio Melotti in branch 'default':
#14072: merge with 3.2.
http://hg.python.org/cpython/rev/b78c67665a7f

--
nosy: +python-dev

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



[issue14702] os.makedirs breaks under autofs directories

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 
 stat(/net/prodigy, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
 mkdir(/net/prodigy/tmp, 0777) = -1 EACCES (Permission denied)
 

 As you can see, a stat() is already done on /net/prodigy.

 To be fair, that shouldn’t trigger a mount. Otherwise a `ls -l` on /net
 would mount all volumes.

Not sure what that is: my view is that mkdir should trigger the mount,
/net/prodigy is already there and available. ls -l doesn't invoke mkdir(2),
so you wouldn't get a mount storm when it is mkdir that triggers the mount.

--

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



[issue14036] urlparse insufficient port property validation

2012-05-19 Thread Ezio Melotti

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


--
nosy: +ezio.melotti
status: pending - open

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-05-19 Thread Ezio Melotti

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


--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue14702] os.makedirs breaks under autofs directories

2012-05-19 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

 
 stat(/net/prodigy, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
 mkdir(/net/prodigy/tmp, 0777) = -1 EACCES (Permission denied)
 

 As you can see, a stat() is already done on /net/prodigy.

 To be fair, that shouldn’t trigger a mount. Otherwise a `ls -l` on /net
 would mount all volumes.
 
 Not sure what that is: my view is that mkdir should trigger the mount,
 /net/prodigy is already there and available. ls -l doesn't invoke mkdir(2),
 so you wouldn't get a mount storm when it is mkdir that triggers the mount.

Sure, I was refering (as I hoped that my quoting would indicate) to the
stat on /net/prodigy, not the mkdir. I commented on the mkdir in the
next paragraph.

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

After enabling the eol extension and re-checking out my working copy, I've 
applied the patch successfully, but after I do so, I get this error when trying 
to open the solution in VS2010:

One or more projects in the solution were not loaded correctly

and

C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj : 
error  : The imported project 
C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore_d.props 
was not found. Confirm that the path in the Import declaration is correct, 
and that the file exists on disk.  
C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Ah, good, it looks as though a file is missing from the patch.  I'll fix it.

--

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



[issue14840] Tutorial: Add a bit on the difference between tuples and lists

2012-05-19 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

I think I liked the first version more, possibly with a few minor changes:

 Though tuples may seem very similar to lists, their immutability
 makes them ideal for fundamentally different usage.

I would drop the 'very', and I'm not sure that it's the immutability that 
enables this fundamentally different uses.

 In typical usage, tuples are a heterogenous structure, 
 whereas lists are a homogenous sequence.

Instead of In typical usage this could just be Usually.

 This tends to mean that, in general, tuples are used
 as a cohesive unit while lists are used one member at a time.

This could even be dropped IMHO, or something could be said about index access 
(or attribute access in case of namedtuples) vs iteration.

Maybe something like this could work:

Though tuples may seem similar to lists, they are often used in different 
situations and for different purposes.
Tuples are immutable, and usually contain an heterogeneous sequence of elements 
that are accessed via tuple-unpacking or indexing (or by attribute in the case 
of namedtuples).  [Sometimes tuples are also used as immutable lists.]
Lists are mutable, and their elements are usually homogeneous and are accessed 
by iterating on the list.


FWIW homogeneous tuples are ok too, but here homogeneous is just a special 
case of heterogeneous.  IMHO the main difference between lists and tuples is 
the way you access the elements (and homogeneous vs heterogeneous is just a 
side-effect of this); the fact that they are mutable or not is a secondary 
difference.

--

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



[issue14822] Build unusable when compiled for Win 64-bit release

2012-05-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Could you try with latest default?

--
nosy: +pitrou

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



[issue14857] Direct access to lexically scoped __class__ is broken in 3.3

2012-05-19 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

Currently, __class__ references from methods in 3.3 aren't being mapped 
correctly to the class currently being defined.

This goes against the documented behaviour of PEP 3135, which states explicitly 
that the new zero-argument form is equivalent to super(__class__, firstarg), 
where __class__ is the closure reference.

This breakage is almost certainly due to the fix for #12370

The fact the test suite didn't break is a sign we also have a gap in our test 
coverage.

Given that a workaround is documented in #12370, but there's no workaround for 
this breakage, reverting the fix for that issue may prove necessary (unlike 
that current breakage, at least that wouldn't be a regression from 3.2).

--
keywords: 3.2regression
messages: 161126
nosy: ncoghlan
priority: release blocker
severity: normal
stage: test needed
status: open
title: Direct access to lexically scoped __class__ is broken in 3.3
type: behavior
versions: Python 3.3

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Yuriy Syrovetskiy

Yuriy Syrovetskiy c...@cblp.su added the comment:

On my computer, connect() on a UDP socket always finishes successfully. What's 
wrong?

I tried that C example from man getaddrinfo(3).

--

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 On my computer, connect() on a UDP socket always finishes
 successfully. What's wrong?

Nothing wrong I guess, since connect() on an UDP socket doesn't actually
do anything, network-wise (UDP being an unconnected protocol).

--

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



[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.

2012-05-19 Thread Todd DeLuca

New submission from Todd DeLuca todddel...@gmail.com:

Today I installed distutils2 via pip and ran 'pysetup create'.  During the 
selection of Trove classifiers for Development status I chose '2 - Alpha' but 
setup.cfg ended up incorrectly indicating that my project is Pre-Alpha.

Here is a screenshot of the interactive setup with me choosing '2 - Alpha':

```
Do you want to set Trove classifiers? (y/n): y
Please select the project status:

0 - Planning
1 - Pre-Alpha
2 - Alpha
3 - Beta
4 - Production/Stable
5 - Mature
6 - Inactive

Status: 2
```

Here is the relevant line in setup.cfg:

classifier = Development Status :: 2 - Pre-Alpha

Here are the relevant Trove classifications from 
http://pypi.python.org/pypi?%3Aaction=list_classifiers:

``` 
Development Status :: 1 - Planning
Development Status :: 2 - Pre-Alpha
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Development Status :: 6 - Mature
Development Status :: 7 - Inactive
```

Notice above that the numbers assigned to the Trove classifiers are greater (by 
one) than the numbers displayed in the pysetup script.

The problem is in file distutil2/create.py 
(http://hg.python.org/distutils2/file/d015f9edccb8/distutils2/create.py) in 
class MainProgram, method set_maturity_status().  

Changing the following line:


   676 Status''' % '\n'.join('%s - %s' % (i, maturity_name(n))

To the following:


   676 Status''' % '\n'.join('%s - %s' % (i + 1, maturity_name(n))

Should display the numbers correctly and fix the problem.  I tested this fix on 
my system (using python2.7.3) and it works correctly.

Regards,
Todd

P.S. Apologies for not submitting a Pull request.

--
assignee: eric.araujo
components: Distutils2
messages: 161129
nosy: alexis, eric.araujo, tarek, todddeluca
priority: normal
severity: normal
status: open
title: 'pysetup create' off-by-one when choosing classification maturity status 
interactively.
type: behavior
versions: Python 2.7

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2012-05-19 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

I'm taking Charles-François' review comments here.

 1. since fwalk() uses O(depth directory tree) file descriptors, we might run 
 out
 of FD on really deep directory hierarchies. It shouldn't be a problem in
 practise

Should I mention it in the docs? The old one uses recursion and we don't warn 
about the stack too...

 2. there is a slight API change, since the API exposes the function that
 triggered the failure. I don't think there's a lot a of code that depends on
 this, but it's definitely a change

I was pondering whether I should fake the method names as they pretty much 
map: listdir instead of fwalk and unlink instead of unlink at… what do you all 
think about that?

--

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



[issue14494] __future__.py and its documentation claim absolute imports became mandatory in 2.7, but they didn't

2012-05-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset cc9e5ddd8220 by Petri Lehtinen in branch '2.7':
#14494: Document that absolute imports became default in 3.0 instead of 2.7.
http://hg.python.org/cpython/rev/cc9e5ddd8220

New changeset 7cdc1392173f by Petri Lehtinen in branch '3.2':
#14494: Document that absolute imports became default in 3.0 instead of 2.7.
http://hg.python.org/cpython/rev/7cdc1392173f

New changeset 26661d9bbb36 by Petri Lehtinen in branch 'default':
#14494: Document that absolute imports became default in 3.0 instead of 2.7.
http://hg.python.org/cpython/rev/26661d9bbb36

--
nosy: +python-dev

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 On my computer, connect() on a UDP socket always finishes  
 successfully. What's wrong?

Nothing is wrong. UDP is connection-less, so connect() is a no-op,
except that it remembers the address so you can use send() instead
of sendto(). Any errors due to non-reachability will only happen when
you actually try to send.

--

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



[issue14494] __future__.py and its documentation claim absolute imports became mandatory in 2.7, but they didn't

2012-05-19 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Fixed, thanks for the patch.

BTW, you should sign the PSF Contributor Agreement. See 
http://www.python.org/psf/contrib/.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue14468] Update cloning guidelines in devguide

2012-05-19 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

-   $ hg clone py3k py3.2
-   $ cd py3.2
-   $ hg update 3.2
+   $ hg clone py3k py3.2 -u 3.2

While the second command is more concise, I find the first easier to 
understand, so maybe you could leave both the first time (proposing the concise 
one as an alternative), and then use just the second.
It's also possible to do hg clone py3k#3.2 py3.2.

There are a few differences between the process you describe and the one I 
personally use (e.g. I first commit on 2.7, export/import on 3.2, merge with 
3.3).  Also since I cloned 2.7 using py3k#2.7, I don't think I would be able to 
graft a py3 changeset in 2.7 (but it should work the other way around).

--

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



[issue14855] IPv6 support for logging.handlers

2012-05-19 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 I worked on the 3.2 branch, because the default branch has broken
 test_logging.

What breakage are you referring to? There's a race condition test that fails on 
Windows sometimes, but that's on the 2.7 branch. Apart from that, I don't know 
what breakage you're referring to, so please elaborate.

--

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



[issue14588] PEP 3115 compliant dynamic class creation

2012-05-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset befd56673c80 by Nick Coghlan in branch 'default':
Close #14588: added a PEP 3115 compliant dynamic type creation mechanism
http://hg.python.org/cpython/rev/befd56673c80

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue14859] Patch to make IDLE window rise to top in OS X on launch

2012-05-19 Thread Marc Abramowitz

New submission from Marc Abramowitz msabr...@gmail.com:

On OS X 10.6.8, when I execute idle, I see nothing in the Terminal and the 
IDLE GUI launches but is not visible until I Command-Tab to the Python 
application. I stumbled upon a solution to this problem using OS X's built-in 
/usr/bin/osascript utility. Attaching a patch...

--
components: IDLE
files: osx_raise_idle.patch
keywords: patch
messages: 161137
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: Patch to make IDLE window rise to top in OS X on launch
type: enhancement
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file25639/osx_raise_idle.patch

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



[issue14859] Patch to make IDLE window rise to top in OS X on launch

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com added the comment:

I created the patch against the 2.7 branch of hg, but I just tried it with both 
the 3.2 branch of hg and an installed version of 3.2 and it worked great.

[last: 0] marca@scml-marca:~/dev/hg-repos/cpython$ pushd 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/  
/dev/null
[last: 0] 
marca@scml-marca:/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib$
 patch -p3  osx_raise_idle.patch 
patching file PyShell.py
Hunk #1 succeeded at 1433 (offset -25 lines).

--

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



[issue14859] Patch to make IDLE window rise to top in OS X on launch

2012-05-19 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

This is really a duplicate of Issue11571 which gives an easier way to do this 
directly using Tk calls.  I'll see about getting that applied.

--
nosy: +ned.deily
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - Turtle window pops under the terminal on OSX

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



[issue11647] function decorated with a context manager can only be invoked once

2012-05-19 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread Zbyszek Jędrzejewski-Szmek

Zbyszek Jędrzejewski-Szmek zbys...@in.waw.pl added the comment:

I can confirm that it works with the patch. Thanks!

--

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



[issue14840] Tutorial: Add a bit on the difference between tuples and lists

2012-05-19 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I am ok with Ezio's 3rd version.

--

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

Hum, a test may be added to ensure that we will not have the regression anymore.

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Richard Oudkerk

Richard Oudkerk shibt...@gmail.com added the comment:

PCbuild/build.bat and Modules/_decimal/tests/runall.bat still use vcbuild 
instead of msbuild.

It also seems that if an external dependency is unavailable then msbuild can 
fail to build targets which do not depend on it.  For instance if I rename 
openssl-1.0.1c to something else, then this causes msbuild to fail without 
building ctypes.

I don't think vcbuild had this problem.

--

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

The patch looks good to me.

--

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



[issue11571] Turtle window pops under the terminal on OSX

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com added the comment:

I wonder if this could be applied at some lower level in TkInter, because this 
bug happens with every Tk app -- e.g.: turtle, idle, web2py

--
nosy: +Marc.Abramowitz

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



[issue1602] windows console doesn't print or input Unicode

2012-05-19 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue11571] Turtle window pops under the terminal on OSX

2012-05-19 Thread Ned Deily

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


Removed file: http://bugs.python.org/file21581/unnamed

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



[issue11571] Turtle window pops under the terminal on OSX

2012-05-19 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Marc, it could although that would be a change in behavior that possibly might 
not be desired by all tkinter apps. Perhaps the thing to do is add an optional 
topmost argument to tkinter.Tk() with the default value being True.

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I propose that we declare this issue closed, and defer any new issues arising 
from the switch to VS 2010 in separate issues.

There will surely be many issues over the next weeks and months, and there is 
little point in tracking this all on this single page.

--

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



[issue13210] Support Visual Studio 2010

2012-05-19 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

So closing this issue. Kristjan, if you want your patch reviewed further and/or 
approved by Brian, please copy it into a new issue.

--
status: open - closed

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread Zbyszek Jędrzejewski-Szmek

Zbyszek Jędrzejewski-Szmek zbys...@in.waw.pl added the comment:

% PYTHONFAULTHANDLER=1 ./python -E -c 'import faulthandler; 
faulthandler._sigsegv()'
[3]14516 segmentation fault (core dumped)

Unless I'm missing something, the env. var. is not working as documented.

Patch with two tests is attached: the first does 'python -X faulthandler ...' 
and passes after Antoine's patch, the second does 'PYTHONFAULTHANDLER=YesPlease 
python ...' and does not pass.

--
keywords: +patch
Added file: http://bugs.python.org/file25640/issue14854_faulthandler_tests.diff

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



[issue12760] Add create mode to open()

2012-05-19 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Shouldn't the documentation of builtin open() (in Doc/library/functions.rst) be 
updated too?

--
nosy: +petri.lehtinen

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



[issue1602] windows console doesn't print or input Unicode

2012-05-19 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Not sure whether a solution has already been proposed because the issue is very 
long, but I just bumped into this on Windows and come up with this:


from __future__ import print_function
import sys

def safe_print(s):
try:
print(s)
except UnicodeEncodeError:
if sys.version_info = (3,):
print(s.encode('utf8').decode(sys.stdout.encoding))
else:
print(s.encode('utf8'))

safe_print(u\N{EM DASH})


Couldn't python do the same thing internally?

--

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



[issue14854] faulthandler: fatal error with SystemError: null argument to internal routine

2012-05-19 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

 PYTHONFAULTHANDLER=1 ./python -E ...

Documentation of the -E option Ignore all PYTHON* environment
variables, e.g. PYTHONPATH and PYTHONHOME, that might be set.
http://docs.python.org/dev/using/cmdline.html#cmdoption-E

So the option works as expected.

--

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



[issue1602] windows console doesn't print or input Unicode

2012-05-19 Thread David-Sarah Hopwood

David-Sarah Hopwood david-sa...@jacaranda.org added the comment:

Giampaolo: See #msg120700 for why that won't work, and the subsequent comments 
for what will work instead (basically, using WriteConsoleW and a workaround for 
a Windows API bug). Also see the prototype win_console.patch from Victor 
Stinner: #msg145963

--

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



[issue14721] httplib doesn't specify content-length header for POST requests without data

2012-05-19 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Too late for asking to keep the parenthesis :-). I hate to have to remember 
non-obvious precedence rules :-). Cognitive overhead.

--

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



[issue14860] devguide: Clarify how to run cpython test suite - esp. on 2.7

2012-05-19 Thread Marc Abramowitz

New submission from Marc Abramowitz msabr...@gmail.com:

The way to test on Python 2.7 (discovered on IRC) is:

~/dev/hg-repos/cpython$ ./python.exe -m test.regrtest -j3

This is not documented. I will submit a patch...

--
components: Devguide
files: devguide.patch
keywords: patch
messages: 161155
nosy: Marc.Abramowitz, ezio.melotti
priority: normal
severity: normal
status: open
title: devguide: Clarify how to run cpython test suite - esp. on 2.7
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file25641/devguide.patch

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



[issue14843] support define_macros / undef_macros in setup.cfg

2012-05-19 Thread Daniel Holth

Daniel Holth dho...@fastmail.fm added the comment:

Looks like it can go into [build_ext] but not per-extension

--

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



[issue1602] windows console doesn't print or input Unicode

2012-05-19 Thread Matt Mackall

Changes by Matt Mackall m...@selenic.com:


--
nosy:  -Matt.Mackall

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



[issue14588] PEP 3115 compliant dynamic class creation

2012-05-19 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Great doc patch.  I think it would be worthwhile to backport it.

--

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



[issue14843] support define_macros / undef_macros in setup.cfg

2012-05-19 Thread Daniel Holth

Daniel Holth dho...@fastmail.fm added the comment:

A tuple of (macro, '1') seems to do the trick

define_macros has to be space-separated, not comma-separated

--
hgrepos: +127

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



[issue14843] support define_macros / undef_macros in setup.cfg

2012-05-19 Thread Daniel Holth

Changes by Daniel Holth dho...@fastmail.fm:


--
keywords: +patch
Added file: http://bugs.python.org/file25642/65c3af0d283b.diff

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



  1   2   >