Teleport 0.3.0 released (Lightweight JSON Types)

2014-11-28 Thread alexei
I'm excited to announce Teleport 0.3.0, just 5 weeks after my 0.2.1 
announcement.

This release is based on a brand new language-agnostic specification [0], which 
I submitted as an Internet Draft. This specification, though 
backwards-incompatible with the last one, is a big improvement in simplicity.

A new specification calls for a new implementation and new docs [1]. I am also 
happy to say that the mailing list [2] is no longer empty. Come join the 
discussion!

=
What is Teleport?
=

Teleport is a type system that extends JSON. You can use it for:

* Validating input
* Building JSON serializers
* Building API servers and clients
* Auto-generating API documentation
* Exploring type systems

Teleport's principles:

* Minimalism ( 1000 LOC)
* Portability and extensibility
* Language-agnostic specification
* To enforce existing conventions
* Open Source (MIT license)



[0] https://datatracker.ietf.org/doc/draft-boronine-teleport/
[1] http://teleport-json.org/python/latest/
[2] https://groups.google.com/forum/#!forum/teleport-json
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: SfePy 2014.4

2014-11-28 Thread Robert Cimrman

I am pleased to announce release 2014.4 of SfePy.

Description
---

SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by the finite element method or by the
isogeometric analysis (preliminary support). It is distributed under the new
BSD license.

Home page: http://sfepy.org
Mailing list: http://groups.google.com/group/sfepy-devel
Git (source) repository, issue tracker, wiki: http://github.com/sfepy

Highlights of this release
--

- preliminary support for 1D problems
- data probes using pyVTK library

For full release notes see http://docs.sfepy.org/doc/release_notes.html#id1
(rather long and technical).

Best regards,
Robert Cimrman and Contributors (*)

(*) Contributors to this release (alphabetical order):

Lubos Kejzlar, Vladimir Lukes
--
https://mail.python.org/mailman/listinfo/python-announce-list

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


ANNOUNCE: wxPython 3.0.2.0

2014-11-28 Thread Robin Dunn

Announcing
--

wxPython 3.0.2.0 (classic) has been released and is now available for
download at http://wxpython.org/download.php.  This build includes
fixes for some annoying bugs, including fixing ht Carbon buyild to
actually use Carbon, and also adds the ability to be built for the
GTK3 port.

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


What is wxPython?
-

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

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



--
Robin Dunn
Software Craftsman
http://wxPython.org
--
https://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Can you use self in __str__

2014-11-28 Thread Steven D'Aprano
Seymore4Head wrote:

 def __str__(self):
 s = Hand contains 
 for x in self.hand:
 s = s + str(x) +  
 return s
 
 This is part of a Hand class.  I need a hand for the dealer and a hand
 for the player.
 dealer=Hand()
 player=Hand()
 This prints out 'Hand contains  foo bar
 for both the dealer's hand and the player's hand.
 
 Is there a way to include self in the __string__ so it reads
 Dealer hand contains foo bar
 Player hand contains foo bar

Not unless you tell the instance what name you want it to use.

Instances (objects) have no way of knowing the name of the variable you
attach them to. Or even if there is such a variable -- there could be one,
or none, or a thousand.

Consider:

# one variable, one instance
dealer = Hand()

# three variables, one instance
player1 = player2 = player3 = Hand()

# make that four variables
player4 = player2

# no variable, one instance
print Hand()

some_list = [1, 2, 3, Hand(), 5]


If you ask each instance what their name is, how would they know?


The only way is to give them a name when you create them:

class Hand:
def __init__(self, name):
self.name = name


dealer = Hand(dealer)
player1 = Hand(Bert)
player2 = Hand(Ernie)
player3 = Hand(Scarface)


Now the instances know what their name is, since you've told them, and can
use them any way you like:

def __str__(self):
template = %s's hand contains: 
return (template % self.name) + King of Spades



-- 
Steven

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


Re: Can you use self in __str__

2014-11-28 Thread Dave Angel

On 11/27/2014 10:31 PM, Seymore4Head wrote:

On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel da...@davea.name
wrote:

class Hand:
 def __init__(self):
 self.hand = []
 # create Hand object

 def __str__(self):
 s = 'Hand contains '
 for x in self.hand:
 s = s + str(x) +  
 return s

I am using 2.7 (Codeskulptor).  This is working code.  It starts with
an empty list that gets appended from a full deck of shuffled cards.
dealer=Hand()
player=Hand()
I don't really know how to post working code without posting a lot.  I
am not being too successful in trying to post enough code to have it
work without posting the entire code.
Here is the link if you want to run it.
http://www.codeskulptor.org/#user38_Kka7mh2v9u_9.py
The print out looks like this:
Hand contains H4 DQ.

I can (and am) currently printing the hand like this:
print Player's,player
print Dealer's,dealer

My question is can you add (self) in the __str__ so when you issue the
command print player the player part is included in the __str__.



You've already got self in the __str__ method, or you wouldn't have 
access to self.hand.  But there's no characteristic of 'self' that has 
any idea of a name like dealer or player.  You have to add that if 
you want it, as I suggested in my first guess.  Steven has shown you as 
well, along with a better explanation.


An object does NOT know the name or names that may be bound to it, any 
more than I know what page of the county register has my birth 
certificate recorded.  If I want to know my own name, I'd better 
remember it.  Along with any nicknames I want to respond to.  The way to 
do it is the same way to know the hand that I hold, make an instance 
attribute.  And the place to do that is in the __init__() method.



class Hand:
def __init__(self, myname):
self.hand = []
# create Hand object
self.name = myname

def __str__(self):
s = self.name + ' contains '
for x in self.hand:
s = s + str(x) +  
return s


dealer=Hand(Dealer)
player=Hand(Player)



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


localization virt-manager

2014-11-28 Thread Беляев Игорь
Hello!
I can't install localization for Virt-manager (virt-manager launched on 
python2.7 (Windows XP)).
How do I correctly install location? 
How can I change the value of the environment variable LANG?


-- 
С уважением,
 Беляев Игорь
+79168341810
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can you use self in __str__

2014-11-28 Thread Chris Angelico
On Fri, Nov 28, 2014 at 12:26 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
 dealer=Hand()
 player=Hand()
 This prints out 'Hand contains  foo bar
 for both the dealer's hand and the player's hand.

 Is there a way to include self in the __string__ so it reads
 Dealer hand contains foo bar
 Player hand contains foo bar

No, you can't. You're assuming that the name bound to an object is
somehow part of that object, but it isn't. What would happen if you
did this:

print(Hand())

There's no name, so you can't get that information. The only way to do
it would be to pass that to the Hand object, but you may as well
simply print it out separately.

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


Re: Can you use self in __str__

2014-11-28 Thread Dave Angel

On 11/27/2014 08:43 PM, Chris Angelico wrote:

On Fri, Nov 28, 2014 at 12:26 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:

dealer=Hand()
player=Hand()
This prints out 'Hand contains  foo bar
for both the dealer's hand and the player's hand.

Is there a way to include self in the __string__ so it reads
Dealer hand contains foo bar
Player hand contains foo bar


No, you can't. You're assuming that the name bound to an object is
somehow part of that object, but it isn't. What would happen if you
did this:

print(Hand())

There's no name, so you can't get that information. The only way to do
it would be to pass that to the Hand object, but you may as well
simply print it out separately.


It is very useful for a Hand instance to know its name.

Lots of game strategies treat a collection of such objects identically, 
and then after the fact want to tell them apart.  Printing is one 
example.  But if you've just concluded that object 174fa44 is the 
winner, it'd be nice to be able to tell the user in his own terms.


As you say you shouldn't attempt to guess it, but should pass it into 
the initializer.

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


Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
Benjamin Risher brisher...@gmail.com writes:

 Hello all,

 I'm working on a project to learn asyncio and network programming.  What I'm 
 trying to do is forward a connection from myself to another machine.  Kind of 
 like an asynchronous python implementation of fpipe.

 In a nutshell:

 1 -- start a server listening on localhost
 2 -- connect to server
 3 -- server connects to a listening service (ssh for instance)
 4 -- server handles both connections to pass traffic back and forth through 
 each

 What I have now *kind of* works.  It sends data back and forth, but when I 
 ssh to localhost -p 12345, i never get the password prompt.  It looks like 
 one packet hangs out and doesn't get sent from what I saw in tcpdump.

 Any help would be greatly appreciated.

Do you want to emulate `ssh -L 12345:localhost:22 host`?

 Here's a link to the same code as below, just with syntax highlighting etc...
 http://pastebin.com/iLE4GZH3

There are several issue e.g., unnecessary async(), deprecated Task()
calls but the main issue is that _handle_client() doesn't read
concurrently from the server while client writes to it.

You could use asyncio.wait() to run several tasks in parallel
[1]. Here's a forward-port.py example [2]:

  #!/usr/bin/env python3
  Forward a local tcp port to host:port.
  
  Usage: %(prog)s local_port:host:port
  
  Example:
  
$ python3 forward-port.py 26992:icanhazip.com:80 # start server
  
  and in another window:
  
$ curl localhost:26992 # connect to it
  
  import asyncio
  import logging
  import sys
  
  info = logging.getLogger('forward-port').info
  
  @asyncio.coroutine
  def copy_stream(reader, writer, bufsize=116):
  while True:
  data = yield from reader.read(bufsize)
  if not data:
  break
  writer.write(data)
  yield from writer.drain()
  writer.close()
  
  def port_forwarder(host, port, *, loop):
  @asyncio.coroutine
  def forward(local_reader, local_writer):
  client = local_writer.get_extra_info('peername')
  info('connected client %s %s', *client)
  remote_reader, remote_writer = yield from 
asyncio.open_connection(host, port, loop=loop)
  yield from asyncio.wait([copy_stream(local_reader, remote_writer),
   copy_stream(remote_reader, local_writer)],
  loop=loop)
  info('disconnected client %s %s', *client)
  
  return forward
  
  # main
  logging.basicConfig(level=logging.INFO,
  format=%(asctime)-15s %(message)s, datefmt=%F %T)
  if len(sys.argv) != 2:
  sys.exit(__doc__)
  local_port, host, port = sys.argv[1].split(':') # e.g., 12345:localhost:22
  
  loop = asyncio.get_event_loop()
  server = loop.run_until_complete(asyncio.start_server(port_forwarder(host, 
int(port), loop=loop),
'localhost', 
int(local_port), loop=loop))
  info('listening on: %s %s', *server.sockets[0].getsockname())
  for closing in range(2):
  try:
  loop.run_until_complete(server.wait_closed())
  except KeyboardInterrupt:
  if not closing:
  server.close()
  info('closing server')
  else:
  break
  info('done')
  loop.close()

[1]
https://docs.python.org/3/library/asyncio-task.html#example-parallel-execution-of-tasks

[2] http://pastebin.com/g08YaJyz


--
Akira

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


Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-28 Thread Juan Christian
On Fri Nov 28 2014 at 2:07:32 AM Michael Torrie torr...@gmail.com wrote:
Okay, here's a reworking of the code that invokes a new QThread instance
each time. Note the QThread instance has to be bound to the MainWindow
so that it won't be destroyed when it goes out of scope. Also the
Worker thread sends a signal with the data, so there's no need to check
worker.trades and risk it being invalid data.

Perhaps this would be more what you had in mind.

You may want to look into asynchronous I/O as well. That does not
require threads at all. Fire off a request to load a url, and then get
a callback when it's done.


Now it's working like a charm without any freezes. I'll reproduce this
'Worker' for other stuffs that I need to call the web, but first I have a
question.

Which one would be better in performance, having a single 'Worker' to call
all URLs, having inside this worker functions for each stuff, or having 3~5
different workers doing different stuff. In the end I'll only print the
data when I have them all.

The problem is that I would have a long new_value = Signal(QThread, str,
str), with more then 10 values, is it possible to pass objects here
like new_value = Signal(QThread, ObjA, ObjB, ...) so that in the
'create_topic' I would get the objects and call methods in order to get all
the data?

This approach would be better, because I may be adding more stuff and I
wouldn't need to add tons and tons of new stuff in my signal, only one
object.

You don't need to redo the code, I just need to know if it's a 'good
approach' and if it's possible, from here I can work my way.
-- 
https://mail.python.org/mailman/listinfo/python-list


manipulating an existing plot !

2014-11-28 Thread ram rokr
Hello,
 I already have a script that plots a polygon. But now I'm trying to script 
a python class that would enable me to import the previous plot , make 
instances and control it too(like specifying parameters like spacing , width, 
height or the like). My approach was, to create a new layout and try to import 
the exisiting plot and then try to make instances and manipulate it. 

class DerivedClass(BaseClass):
 
  def __init__(self, layout,topcell):
  self.layout = pya.Layout()
  self.layout.dbu = 0.001
  self.topcell = self.layout.create_cell(TOP)
  l1 = layout.layer(1, 0)
  topcell.shapes(l1).insert(pya.Box(0, 0, 1000, 2000))
  
  self.path = []
  def add_new(self,path):
  self.path.append(path)

  
 
How could I use layer mapping or any other method to accomplish this? Looking 
forward to your advise. Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: localization virt-manager

2014-11-28 Thread Akira Li
Беляев Игорь belyaevigo...@yandex.ru writes:

 I can't install localization for Virt-manager (virt-manager launched on 
 python2.7 (Windows XP)).

virt-manager is a GUI for KVM, Xen, LXC virtual machines. It is a Linux
application.

 How do I correctly install location? 

Do you mean *locale*?

 How can I change the value of the environment variable LANG?

On Windows, you could use *setx* command to set an environment variable.

LANG envvar defines a default value for LC_* envvars on POSIX systems [1]
that define application's locale (after setlocale() call) e.g., in bash:

  $ LANG=en_US.UTF-8 some-program

I don't know whether LANG has any meaning on Windows.

[1] http://pubs.opengroup.org/onlinepubs/007908799/xbd/envvar.html


--
Akira


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


Re: Can you use self in __str__

2014-11-28 Thread Rustom Mody
On Friday, November 28, 2014 6:57:23 AM UTC+5:30, Seymore4Head wrote:
 def __str__(self):
 s = Hand contains 
 for x in self.hand:
 s = s + str(x) +  
 return s
 
 This is part of a Hand class.  I need a hand for the dealer and a hand
 for the player.
 dealer=Hand()
 player=Hand()
 This prints out 'Hand contains  foo bar 
 for both the dealer's hand and the player's hand.
 
 Is there a way to include self in the __string__ so it reads
 Dealer hand contains foo bar
 Player hand contains foo bar

And what do you think should be printed if instead of your code

dealer = Hand()
player = Hand()

we have the following

dealer = Hand()
player = dealer

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


Iterate over text file, discarding some lines via context manager

2014-11-28 Thread fetchinson .
Hi all,

I have a feeling that I should solve this by a context manager but
since I've never used them I'm not sure what the optimal (in the
python sense) solution is. So basically what I do all the time is
this:

for line in open( 'myfile' ):
if not line:
# discard empty lines
continue
if line.startswith( '#' ):
# discard lines starting with #
continue
items = line.split( )
if not items:
# discard lines with only spaces, tabs, etc
continue

process( items )

You see I'd like to ignore lines which are empty, start with a #, or
are only white space. How would I write a context manager so that the
above simply becomes

with some_tricky_stuff( 'myfile' ) as items:
process( items )

Cheers,
Daniel


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
https://mail.python.org/mailman/listinfo/python-list


tabs with tkinter

2014-11-28 Thread ast

Hi

I have been using tkinter for few weeks now and I didn't found
how to make some tabs on a window.

see this picture for a window with tabs
http://www.computerhope.com/jargon/t/tabs.gif

Isn't it feasible with tkinter ?

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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel

On 11/28/2014 10:04 AM, fetchinson . wrote:

Hi all,

I have a feeling that I should solve this by a context manager but
since I've never used them I'm not sure what the optimal (in the
python sense) solution is. So basically what I do all the time is
this:

for line in open( 'myfile' ):
 if not line:
 # discard empty lines
 continue
 if line.startswith( '#' ):
 # discard lines starting with #
 continue
 items = line.split( )
 if not items:
 # discard lines with only spaces, tabs, etc
 continue

 process( items )

You see I'd like to ignore lines which are empty, start with a #, or
are only white space. How would I write a context manager so that the
above simply becomes

with some_tricky_stuff( 'myfile' ) as items:
 process( items )



I see what you're getting at, but a context manager is the wrong 
paradigm.  What you want is a generator.   (untested)


def mygenerator(filename):
with open(filename) as f:
for line in f:
if not line: continue
if line.startswith('#'): continue
items = line.split()
if not items: continue
yield items

Now your caller simply does:

for items in mygenerator(filename):
  process(items)


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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread fetchinson .
On 11/28/14, Dave Angel da...@davea.name wrote:
 On 11/28/2014 10:04 AM, fetchinson . wrote:
 Hi all,

 I have a feeling that I should solve this by a context manager but
 since I've never used them I'm not sure what the optimal (in the
 python sense) solution is. So basically what I do all the time is
 this:

 for line in open( 'myfile' ):
  if not line:
  # discard empty lines
  continue
  if line.startswith( '#' ):
  # discard lines starting with #
  continue
  items = line.split( )
  if not items:
  # discard lines with only spaces, tabs, etc
  continue

  process( items )

 You see I'd like to ignore lines which are empty, start with a #, or
 are only white space. How would I write a context manager so that the
 above simply becomes

 with some_tricky_stuff( 'myfile' ) as items:
  process( items )


 I see what you're getting at, but a context manager is the wrong
 paradigm.  What you want is a generator.   (untested)

 def mygenerator(filename):
  with open(filename) as f:
  for line in f:
  if not line: continue
  if line.startswith('#'): continue
  items = line.split()
  if not items: continue
  yield items

 Now your caller simply does:

 for items in mygenerator(filename):
process(items)

Great, thanks a lot!

Cheers,
Daniel



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



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Db transactions and locking

2014-11-28 Thread Ian Kelly
On Nov 27, 2014 4:39 PM, Chris Angelico ros...@gmail.com wrote:

 On Fri, Nov 28, 2014 at 5:02 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
  On Nov 27, 2014 4:26 AM, Frank Millman fr...@chagford.com wrote:
  All Python database adaptors that I have used start a transaction when
you
  open a cursor. I have just re-read DB-API 2.0, and I cannot see
anything
  that specifies this behaviour, but AFAICT this is what happens.
 
  I don't know how others work, but cx_Oracle starts a transaction when
you
  execute a statement, not when you open a cursor.

 Is there any material difference here? I mean, sure, you have a
 transaction, it'll show up in logs and stuff, but without any locks,
 it's unlikely to have much impact on the system. Unless you're
 creating and destroying a bunch of unnecessary cursors all the time,
 of course, but that'd be wasteful for other reasons.

Sure. If you commit the transaction and then execute another statement,
you'll get a new transaction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tabs with tkinter

2014-11-28 Thread Peter Otten
ast wrote:

 I have been using tkinter for few weeks now and I didn't found
 how to make some tabs on a window.
 
 see this picture for a window with tabs
 http://www.computerhope.com/jargon/t/tabs.gif
 
 Isn't it feasible with tkinter ?

See http://www.tkdocs.com/tutorial/complex.html#notebook

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


Re: Asyncio problem, looking for advice.

2014-11-28 Thread Benjamin Risher
On Friday, November 28, 2014 6:12:20 AM UTC-6, Akira Li wrote:
 Benjamin Risher writes:
 
  Hello all,
 
  I'm working on a project to learn asyncio and network programming.  What 
  I'm trying to do is forward a connection from myself to another machine.  
  Kind of like an asynchronous python implementation of fpipe.
 
  In a nutshell:
 
  1 -- start a server listening on localhost
  2 -- connect to server
  3 -- server connects to a listening service (ssh for instance)
  4 -- server handles both connections to pass traffic back and forth 
  through each
 
  What I have now *kind of* works.  It sends data back and forth, but when I 
  ssh to localhost -p 12345, i never get the password prompt.  It looks like 
  one packet hangs out and doesn't get sent from what I saw in tcpdump.
 
  Any help would be greatly appreciated.
 
 Do you want to emulate `ssh -L 12345:localhost:22 host`?
 
  Here's a link to the same code as below, just with syntax highlighting 
  etc...
  http://pastebin.com/iLE4GZH3
 
 There are several issue e.g., unnecessary async(), deprecated Task()
 calls but the main issue is that _handle_client() doesn't read
 concurrently from the server while client writes to it.
 
 You could use asyncio.wait() to run several tasks in parallel

 [1]
 https://docs.python.org/3/library/asyncio-task.html#example-parallel-execution-of-tasks
 
 [2] http://pastebin.com/g08YaJyz
 
 
 --
 Akira


Akira, 

First, thank you very much for your response.  It helps tremendously.  I have a 
question or two though, if you don't mind.  

You said Task() is deprecated, but it's not listed as such in the docs.  Is it 
just that it's preferred to use other methods instead of using Task() directly, 
or am I missing something?  

Also, just so I can wrap my head around things, I was trying to mix concurrent 
and procedural programming in the code I provided, correct?  Do you have any 
advice on how to avoid mixing types again in the future? 

Thank you again,
Ben
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Ned Batchelder

On 11/28/14 10:22 AM, Dave Angel wrote:

On 11/28/2014 10:04 AM, fetchinson . wrote:

Hi all,

I have a feeling that I should solve this by a context manager but
since I've never used them I'm not sure what the optimal (in the
python sense) solution is. So basically what I do all the time is
this:

for line in open( 'myfile' ):
 if not line:
 # discard empty lines
 continue
 if line.startswith( '#' ):
 # discard lines starting with #
 continue
 items = line.split( )
 if not items:
 # discard lines with only spaces, tabs, etc
 continue

 process( items )

You see I'd like to ignore lines which are empty, start with a #, or
are only white space. How would I write a context manager so that the
above simply becomes

with some_tricky_stuff( 'myfile' ) as items:
 process( items )



I see what you're getting at, but a context manager is the wrong
paradigm.  What you want is a generator.   (untested)

def mygenerator(filename):
 with open(filename) as f:
 for line in f:
 if not line: continue
 if line.startswith('#'): continue
 items = line.split()
 if not items: continue
 yield items

Now your caller simply does:

for items in mygenerator(filename):
   process(items)




I think it's slightly better to leave the open outside the generator:

def interesting_lines(f):
for line in f:
line = line.strip()
if line.startswith('#'):
continue
if not line:
continue
yield line

with open(my_config.ini) as f:
for line in interesting_lines(f):
do_something(line)

This makes interesting_lines a pure filter, and doesn't care what sort 
of sequence of strings it's operating on.  This makes it easier to test, 
and more flexible.  The caller's code is also clearer in my opinion.


BTW: this example is taken verbatim from my PyCon presentation on 
iteration, it you are interested: http://nedbatchelder.com/text/iter.html


--
Ned Batchelder, http://nedbatchelder.com

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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel

On 11/28/2014 11:01 AM, Ned Batchelder wrote:

On 11/28/14 10:22 AM, Dave Angel wrote:

On 11/28/2014 10:04 AM, fetchinson . wrote:

Hi all,

I have a feeling that I should solve this by a context manager but
since I've never used them I'm not sure what the optimal (in the
python sense) solution is. So basically what I do all the time is
this:

for line in open( 'myfile' ):
 if not line:
 # discard empty lines
 continue
 if line.startswith( '#' ):
 # discard lines starting with #
 continue
 items = line.split( )
 if not items:
 # discard lines with only spaces, tabs, etc
 continue

 process( items )

You see I'd like to ignore lines which are empty, start with a #, or
are only white space. How would I write a context manager so that the
above simply becomes

with some_tricky_stuff( 'myfile' ) as items:
 process( items )



I see what you're getting at, but a context manager is the wrong
paradigm.  What you want is a generator.   (untested)

def mygenerator(filename):
 with open(filename) as f:
 for line in f:
 if not line: continue
 if line.startswith('#'): continue
 items = line.split()
 if not items: continue
 yield items

Now your caller simply does:

for items in mygenerator(filename):
   process(items)




I think it's slightly better to leave the open outside the generator:

def interesting_lines(f):
 for line in f:
 line = line.strip()
 if line.startswith('#'):
 continue
 if not line:
 continue
 yield line

with open(my_config.ini) as f:
 for line in interesting_lines(f):
 do_something(line)

This makes interesting_lines a pure filter, and doesn't care what sort
of sequence of strings it's operating on.  This makes it easier to test,
and more flexible.  The caller's code is also clearer in my opinion.

Thank you, I agree.  I was trying to preserve the factoring that the OP 
had implied.  I notice you also factored out the split.



BTW: this example is taken verbatim from my PyCon presentation on
iteration, it you are interested: http://nedbatchelder.com/text/iter.html



Thanks for the link.  I've started reading it, and I'll definitely read 
the whole thing.


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


Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-28 Thread Michael Torrie
On 11/28/2014 06:06 AM, Juan Christian wrote:
 Which one would be better in performance, having a single 'Worker' to call
 all URLs, having inside this worker functions for each stuff, or having 3~5
 different workers doing different stuff. In the end I'll only print the
 data when I have them all.
 
 The problem is that I would have a long new_value = Signal(QThread, str,
 str), with more then 10 values, is it possible to pass objects here
 like new_value = Signal(QThread, ObjA, ObjB, ...) so that in the
 'create_topic' I would get the objects and call methods in order to get all
 the data?

Yes you can pass objects through signals.  You could pass a dict, or an
instance of one of your own classes.  You could also go back to your
first architecture and pass in an Outpost class instance to the worker
thread when instantiating it, and then the worker could use the outpost
instance to perform the work, then pass it back to your handler through
the signal.

 This approach would be better, because I may be adding more stuff and I
 wouldn't need to add tons and tons of new stuff in my signal, only one
 object.
 
 You don't need to redo the code, I just need to know if it's a 'good
 approach' and if it's possible, from here I can work my way.

Yeah sounds alright. I'm sure there are multiple ways of doing this that
would work.

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


Re: Can you use self in __str__

2014-11-28 Thread Rustom Mody
On Friday, November 28, 2014 7:51:40 PM UTC+5:30, Rustom Mody wrote:
 On Friday, November 28, 2014 6:57:23 AM UTC+5:30, Seymore4Head wrote:
  def __str__(self):
  s = Hand contains 
  for x in self.hand:
  s = s + str(x) +  
  return s
  
  This is part of a Hand class.  I need a hand for the dealer and a hand
  for the player.
  dealer=Hand()
  player=Hand()
  This prints out 'Hand contains  foo bar 
  for both the dealer's hand and the player's hand.
  
  Is there a way to include self in the __string__ so it reads
  Dealer hand contains foo bar
  Player hand contains foo bar
 
 And what do you think should be printed if instead of your code
 
 dealer = Hand()
 player = Hand()
 
 we have the following
 
 dealer = Hand()
 player = dealer
 
 ??

Sorry for repeating -- I see Steven said the same
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread ast

Hi

Here is a solution with a custom iterator which operate on files.
I tested it with a small file. Just a remark, there are no empty line
on a file, there is at least '\n' at the end of each lines but maybe the 
last one. If readline() got an emptyline, then the end of file has been 
reached.



class MyFileItr:
   
   def __init__(self, f):

   self.f = f
   self.line = 

   def __next__(self):

   while True:
   
   self.line = self.f.readline()


   if (self.line == ''):
   raise StopIteration
  
   if not(self.line.startswith('#') or self.line.isspace() or self.line == '\n'):
   
   return self.line


   def __iter__(self):
   return self


   
f = open('test.txt', 'r')


for L in MyFileItr(f):
   print(L, end=)

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


Re: tabs with tkinter

2014-11-28 Thread ast


Peter Otten __pete...@web.de a écrit dans le message de 
news:mailman.16409.1417189956.18130.python-l...@python.org...




See http://www.tkdocs.com/tutorial/complex.html#notebook



thx 


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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel
Please don't start a new thread when responding to an existing topic. 
Just reply-List to the message you're responding to, and include some 
context from that message.


On 11/28/2014 12:06 PM, ast wrote:

Hi

Here is a solution with a custom iterator which operate on files.
I tested it with a small file. Just a remark, there are no empty line
on a file, there is at least '\n' at the end of each lines but maybe the
last one. If readline() got an emptyline, then the end of file has been
reached.


class MyFileItr:
def __init__(self, f):
self.f = f
self.line = 

def __next__(self):

while True:
self.line = self.f.readline()

if (self.line == ''):
raise StopIteration
if not(self.line.startswith('#') or self.line.isspace() or
self.line == '\n'):
return self.line

def __iter__(self):
return self


f = open('test.txt', 'r')

for L in MyFileItr(f):
print(L, end=)



Why would you prefer that over a generator function, as given earlier in 
the thread?  See for example Ned's message.  By using 'yield', you get 
Python to generate all the class boilerplate for you.




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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Marko Rauhamaa
Dave Angel da...@davea.name:

 Why would you prefer that over a generator function, as given earlier
 in the thread? See for example Ned's message. By using 'yield', you
 get Python to generate all the class boilerplate for you.

I think the OP can learn from the comparison. One question, many
lessons:

 * Here's how you write a generator.

 * Here's how you write a context manager class. You run into those
   quite often as well.

 * See how much more suitable a generator is in this case.

No need to shoot down those who only try to be helpful.


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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Chris Angelico
On Sat, Nov 29, 2014 at 4:55 AM, Marko Rauhamaa ma...@pacujo.net wrote:
 I think the OP can learn from the comparison. One question, many
 lessons:

  * Here's how you write a generator.

  * Here's how you write a context manager class. You run into those
quite often as well.

  * See how much more suitable a generator is in this case.

 No need to shoot down those who only try to be helpful.

Since we're so good at it on this list, I will nit-pick: that's not a
context manager class, that's an iterator class. A context manager has
__enter__ and __exit__, an iterator has __iter__ (returning self) and
__next__ (returning or raising StopIteration).

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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com:

 Since we're so good at it on this list, I will nit-pick: that's not a
 context manager class, that's an iterator class. A context manager has
 __enter__ and __exit__, an iterator has __iter__ (returning self) and
 __next__ (returning or raising StopIteration).

Excellent. Learnings will never end.


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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Michael Torrie
On 11/28/2014 08:04 AM, fetchinson . wrote:
 Hi all,
 
 I have a feeling that I should solve this by a context manager but
 since I've never used them I'm not sure what the optimal (in the
 python sense) solution is. So basically what I do all the time is
 this:

I'd personally do it with a generator function.

def filter(input):
for line in input:
if not line:
# discard empty lines
continue
if line.startswith( '#' ):
# discard lines starting with #
continue
items = line.split( )
if not items:
# discard lines with only spaces, tabs, etc
continue
yield items

for line_items in filter(open( 'myfile' )):
process( items )

For an excellent presentation on this sort of thing, see:
http://www.dabeaz.com/generators/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
Benjamin Risher brisher...@gmail.com writes:

 On Friday, November 28, 2014 6:12:20 AM UTC-6, Akira Li wrote:
 Benjamin Risher writes:
 
  Hello all,
 
  I'm working on a project to learn asyncio and network programming.
  What I'm trying to do is forward a connection from myself to
  another machine.  Kind of like an asynchronous python
  implementation of fpipe.
 
  In a nutshell:
 
  1 -- start a server listening on localhost
  2 -- connect to server
  3 -- server connects to a listening service (ssh for instance)
  4 -- server handles both connections to pass traffic back and forth 
  through each
 
  What I have now *kind of* works.  It sends data back and forth,
  but when I ssh to localhost -p 12345, i never get the password
  prompt.  It looks like one packet hangs out and doesn't get sent
  from what I saw in tcpdump.
 
  Any help would be greatly appreciated.
 
 Do you want to emulate `ssh -L 12345:localhost:22 host`?
 
  Here's a link to the same code as below, just with syntax highlighting 
  etc...
  http://pastebin.com/iLE4GZH3
 
 There are several issue e.g., unnecessary async(), deprecated Task()
 calls but the main issue is that _handle_client() doesn't read
 concurrently from the server while client writes to it.
 
 You could use asyncio.wait() to run several tasks in parallel

 [1]
 https://docs.python.org/3/library/asyncio-task.html#example-parallel-execution-of-tasks
 
 [2] http://pastebin.com/g08YaJyz
 


 Akira, 

 First, thank you very much for your response.  It helps tremendously.
 I have a question or two though, if you don't mind.

 You said Task() is deprecated, but it's not listed as such in the
 docs.  Is it just that it's preferred to use other methods instead of
 using Task() directly, or am I missing something?

asyncio is a provisional API [3], it may change without notice (though
it shouldn't without a reason). From asyncio docs [4]:

  Don’t directly create Task instances: use the async() function or the
  BaseEventLoop.create_task() method.

The reason is probably to support Trollius (asyncio for Python 2) [5].

 Also, just so I can wrap my head around things, I was trying to mix
 concurrent and procedural programming in the code I provided, correct?
 Do you have any advice on how to avoid mixing types again in the
 future?

In short, the main issue was that your code executed some parts
sequentially e.g., A then B:

  yield from A
  yield from B # this is not reached until A finishes

that needed to be run concurrently:

  yield from asyncio.wait([A, B])

or in general, if you don't need to wait the results:

  asyncio.async(A)
  asyncio.async(B) 

  # ... yield later, to pass the control to the event loop
(Task._step/_fut_waiter dance ☯)

Ask, if you have any specific questions about the code
http://pastebin.com/g08YaJyz 

There is a bug at the end. info('done') should be outside the loop
(improper indent).

[3] https://www.python.org/dev/peps/pep-0411
[4] https://docs.python.org/3/library/asyncio-task.html#asyncio.Task
[5] https://code.google.com/p/tulip/issues/detail?id=185


--
Akira

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


Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Akira Li
Ned Batchelder n...@nedbatchelder.com writes:

 On 11/28/14 10:22 AM, Dave Angel wrote:
 On 11/28/2014 10:04 AM, fetchinson . wrote:
 Hi all,

 I have a feeling that I should solve this by a context manager but
 since I've never used them I'm not sure what the optimal (in the
 python sense) solution is. So basically what I do all the time is
 this:

 for line in open( 'myfile' ):
  if not line:
  # discard empty lines
  continue
  if line.startswith( '#' ):
  # discard lines starting with #
  continue
  items = line.split( )
  if not items:
  # discard lines with only spaces, tabs, etc
  continue

  process( items )

 You see I'd like to ignore lines which are empty, start with a #, or
 are only white space. How would I write a context manager so that the
 above simply becomes

 with some_tricky_stuff( 'myfile' ) as items:
  process( items )


 I see what you're getting at, but a context manager is the wrong
 paradigm.  What you want is a generator.   (untested)

 def mygenerator(filename):
  with open(filename) as f:
  for line in f:
  if not line: continue
  if line.startswith('#'): continue
  items = line.split()
  if not items: continue
  yield items

 Now your caller simply does:

 for items in mygenerator(filename):
process(items)



 I think it's slightly better to leave the open outside the generator:

 def interesting_lines(f):
 for line in f:
 line = line.strip()
 if line.startswith('#'):
 continue
 if not line:
 continue
 yield line

 with open(my_config.ini) as f:
 for line in interesting_lines(f):
 do_something(line)

 This makes interesting_lines a pure filter, and doesn't care what sort
 of sequence of strings it's operating on.  This makes it easier to
 test, and more flexible.  The caller's code is also clearer in my
 opinion.

 BTW: this example is taken verbatim from my PyCon presentation on
 iteration, it you are interested:
 http://nedbatchelder.com/text/iter.html

The conditions could be combined in this case:

  def iter_rows(lines):
  for line in lines:
  items = line.split()
  if items and not items[0].startswith('#'):
 yield items # space-separated non-emtpy non-comment items
  
  with open(filename):
  for items in iter_rows(file):
  process(items)


--
Akira

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


Re: tabs with tkinter

2014-11-28 Thread Terry Reedy

On 11/28/2014 10:52 AM, Peter Otten wrote:

ast wrote:


I have been using tkinter for few weeks now and I didn't found
how to make some tabs on a window.

see this picture for a window with tabs
http://www.computerhope.com/jargon/t/tabs.gif

Isn't it feasible with tkinter ?


See http://www.tkdocs.com/tutorial/complex.html#notebook


Notebook is one of the newer, ttk-only widgets.

--
Terry Jan Reedy

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


Re: I love assert

2014-11-28 Thread Steven D'Aprano
alister wrote:

 And as may wiser people than me have already highlighted Assertions can
 be switched off in python which means they cannot be relied upon in
 production code invalidating the authors suggestion that they can
 automate bug reports  Extend testing into the lifetime of the product

I'm afraid that you appear to have missed the point of assertions as tests.
Since they should never be used to *enforce* correct behaviour, but only to
*verify* behaviour is correct (i.e. as a form of testing), it doesn't
matter if you disable them. If I turn them off, all that happens is that
the tests won't run *for me*. The software will still be just as correct,
or just as buggy, regardless of the assertions.

But not everyone will turn them off. Even if *everybody else* turns them
off, you, the developer of the software, surely won't[1] since you're not
an idiot. (Why write assertions only to never use them?) That means that
whenever you run your software during the process of development, your
assertions will run.

In a complex, rich software application, you may not have unit tests for
every possible path through the software. But if you put assertions at the
intersections of paths (e.g. at the top of each loop, or the entry and exit
of each function), then even if you don't have a unit test for a particular
path, at least the assertions will be there to provide limited testing. In
other words, correctly written assertions can provide simple but effective
test coverage of 100% of your application.

I stress that assertions aren't a replacement for unit testing, but they
compliment unit testing: assertions can help cover code missed by your unit
tests, and check that your unit tests are correct.

If the user of your application disables assertions, they will be no worse
off than if you didn't write those assertions at all. And if they enable
assertions, then they get extended testing throughout the lifetime of the
product *for free*.

(Well, perhaps not *quite* for free, since assertions do have some
performance cost. But very cheaply.)




[1] Thanks to Python defaulting to __debug__ = True, the problem is getting
people to remember to test their software with assertions disabled, not to
get them to enable them.


-- 
Steven

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


Re: I love assert

2014-11-28 Thread MRAB

On 2014-11-29 01:30, Steven D'Aprano wrote:
[snip]

I stress that assertions aren't a replacement for unit testing, but they
compliment unit testing: assertions can help cover code missed by your unit
tests, and check that your unit tests are correct.


[snip]

I think you meant complement. :-)

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


Re: I love assert

2014-11-28 Thread Chris Angelico
On Sat, Nov 29, 2014 at 1:56 PM, MRAB pyt...@mrabarnett.plus.com wrote:
 On 2014-11-29 01:30, Steven D'Aprano wrote:
 [snip]

 I stress that assertions aren't a replacement for unit testing, but they
 compliment unit testing: assertions can help cover code missed by your
 unit
 tests, and check that your unit tests are correct.

 [snip]

 I think you meant complement. :-)

assert Unit tests are soo clever

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


Re: Can you use self in __str__

2014-11-28 Thread Shiyao Ma
2014-11-28 13:00 GMT+08:00 Chris Angelico ros...@gmail.com:
 On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma i...@introo.me wrote:
 What if it's in the local namespace of a function or method? IDK, try
 to get that thing first.

Sure enough. I will even avoid using id as it's dependent on CPython
implementation. :)

 What if it's in multiple namespaces? What if it's not in any at all?
 Your solution is not going to work in the general case, AND it's a bad
 idea.
 Please don't do this in any code that I'll ever have to
 maintain.
No way. You will never get my project code in such a form. I am way
more peculiar about readability and robustness than most of my other
ppl.
The point is, the bpate is just for demonstration to show there is a
*possible* way to find the name even you didn't specify it at first
hand.




-- 

吾輩は猫である。ホームーページはhttp://introo.me。
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can you use self in __str__

2014-11-28 Thread Chris Angelico
On Sat, Nov 29, 2014 at 2:16 PM, Shiyao Ma i...@introo.me wrote:
 2014-11-28 13:00 GMT+08:00 Chris Angelico ros...@gmail.com:
 On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma i...@introo.me wrote:
 What if it's in the local namespace of a function or method? IDK, try
 to get that thing first.

 Sure enough. I will even avoid using id as it's dependent on CPython
 implementation. :)

You can use id() on any object. You are guaranteed to get back an
integer which is both stable and unique among all ids of objects that
exist at the same time as the one you called it on. For as long as the
object continues to exist, that number *will* stay the same. Sometimes
that's all you need; for instance, imagine a simple mail server which
produces logs like this:

[142857] Beginning processing of message
[142857] Parsing headers
[314159] Beginning processing of message
[314159] Parsing headers
[142857] Storing in destination mailbox
[314159] Connecting to destination server
[142857] Finished processing of message
[314159] Message accepted by destination
[271871] Beginning processing of message
[314159] Finished processing of message

You can easily see, from the initial numbers, what log lines are
associated with what messages. (Note that emails have their own IDs,
which could in theory be used, but the id() of an internal dict can be
used even before the email's ID has been read - as you see from the
example, a log entry for Parsing headers has to be made prior to
info from the headers being used.) It's not a problem if another
142857 comes up later on; there's a very clear begin and end to the
message, and you're guaranteed that nothing can possibly be
interspersed with a colliding ID.

In other implementations of Python, these numbers might look less
arbitrary (Jython, I believe, allocates them sequentially); but the
code will work just as well on any compliant implementation of the
language, because everything I've said above is a language guarantee,
not a CPython implementation detail.

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


Re: Can you use self in __str__

2014-11-28 Thread Shiyao Ma
2014-11-29 11:36 GMT+08:00 Chris Angelico ros...@gmail.com:
 You can use id() on any object. You are guaranteed to get back an
 integer which is both stable and unique among all ids of objects that
 exist at the same time as the one you called it on. For as long as the
 object continues to exist, that number *will* stay the same. Sometimes
 that's all you need; for instance, imagine a simple mail server which
 produces logs like this:

 [142857] Beginning processing of message
 [142857] Parsing headers
 [314159] Beginning processing of message
 [314159] Parsing headers
 [142857] Storing in destination mailbox
 [314159] Connecting to destination server
 [142857] Finished processing of message
 [314159] Message accepted by destination
 [271871] Beginning processing of message
 [314159] Finished processing of message

 You can easily see, from the initial numbers, what log lines are
 associated with what messages. (Note that emails have their own IDs,
 which could in theory be used, but the id() of an internal dict can be
 used even before the email's ID has been read - as you see from the
 example, a log entry for Parsing headers has to be made prior to
 info from the headers being used.) It's not a problem if another
 142857 comes up later on; there's a very clear begin and end to the
 message, and you're guaranteed that nothing can possibly be
 interspersed with a colliding ID.

 In other implementations of Python, these numbers might look less
 arbitrary (Jython, I believe, allocates them sequentially); but the
 code will work just as well on any compliant implementation of the
 language, because everything I've said above is a language guarantee,
 not a CPython implementation detail.

 ChrisA


Thanks. Informed.
The implementation dependent thing is id(obj) == virtual mem addr
(which caused my bad feeling).
Apparently have nothing to do with it here, though.

And 'id' is seemingly great to differentiate each obj.



--

吾輩は猫である。ホームーページはhttp://introo.me。
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tabs with tkinter

2014-11-28 Thread Peter Otten
Terry Reedy wrote:

 On 11/28/2014 10:52 AM, Peter Otten wrote:
 ast wrote:

 I have been using tkinter for few weeks now and I didn't found
 how to make some tabs on a window.

 see this picture for a window with tabs
 http://www.computerhope.com/jargon/t/tabs.gif

 Isn't it feasible with tkinter ?

 See http://www.tkdocs.com/tutorial/complex.html#notebook
 
 Notebook is one of the newer, ttk-only widgets.

There is also an old Python megawidgets project that offers a notebook:

http://pmw.sourceforge.net/doc/NoteBook.html

To my surprise Python 3 is supported:

https://pypi.python.org/pypi/Pmw

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


[issue22961] ctypes.WinError OSError

2014-11-28 Thread Ned Deily

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


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

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



[issue22947] Enable 'imageop' - Multimedia Srvices Feature module for 64-bit platform

2014-11-28 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +steve.dower, tim.golden, zach.ware

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Bernard Spil added the comment:

When configure is called with correct LDFLAGS and CPPFLAGS for LibreSSL these 
patches to configure, Modules/_ssl.c and Lib/_ssl.py will detect not having 
RAND_egd support in OpenSSL and make the build succeed.

--
Added file: http://bugs.python.org/file37299/patch-configure.ac

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Changes by Bernard Spil pyt...@bachfreund.nl:


Added file: http://bugs.python.org/file37300/patch-Lib_ssl.py

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Changes by Bernard Spil pyt...@bachfreund.nl:


Added file: http://bugs.python.org/file37301/patch-Modules__ssl.c

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Changes by Bernard Spil pyt...@bachfreund.nl:


Removed file: http://bugs.python.org/file37242/patch-Modules__ssl.c

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

patch-configure.ac:
-AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library 
features])

Why do you remove this define?

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I thikn RAND_egd() should probably raise NotImplementedError if the function 
isn't exposed by the ssl library.

--

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



[issue22962] ipaddress: Add optional prefixlen argument to ip_interface and ip_network

2014-11-28 Thread Gary van der Merwe

New submission from Gary van der Merwe:

Currently if one has an ip address in int or IPv4Address/IPv6Address form, it 
is not possilbe to create a ip_interface or ip_network from that with specific 
prefix length, without first converting the address into string form, and then 
appending the prefixlen 

Please could an optional prefixlen argument to ip_interface and ip_network (and 
the __init__ functions for their backing classes) so that one can do this.

e.g: it should work like this:

 ipaddress.ip_interface(167772161, prefixlen=24)
IPv4Interface('10.0.0.1/24')

I would like to do a patch for this. I would just first like some feedback as 
to whether a patch for this would accepted.

--
components: Library (Lib)
messages: 231800
nosy: Gary.van.der.Merwe
priority: normal
severity: normal
status: open
title: ipaddress: Add optional prefixlen argument to ip_interface and ip_network
type: enhancement

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Bernard Spil added the comment:

Victor: That is a change that has been implemented in the downstream port to 
fix wxPython, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192365 this 
ended up in this patch as my primary objective was to fix it for the FreeBSD 
port.

Antoine: Sorry, I'm not a python dev... I'm willing to do the work if you can 
provide the guidance... This was merely a works-for-me(TM) patch. Since 
nothing actually uses egd any longer I would not spend to much effort on it. 
The odds of anyone requiring EGD support _and_ using LibreSSL are negligable. 
EGD is last centuries technology, there's no sense in mixing that with current 
tech.

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

 Victor: That is a change that has been implemented in the downstream port to 
 fix wxPython, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192365 
 this ended up in this patch as my primary objective was to fix it for the 
 FreeBSD port.

It looks unrelated to LibreSSL, please split your patch in two parts and open a 
new issue for the wxPython fix.

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Bernard Spil added the comment:

Remove https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192365 patch from this 
patch-set

--
Added file: http://bugs.python.org/file37302/patch-configure.ac

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Changes by Bernard Spil pyt...@bachfreund.nl:


Removed file: http://bugs.python.org/file37299/patch-configure.ac

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

 I thikn RAND_egd() should probably raise NotImplementedError if the function 
 isn't exposed by the ssl library.

I would prefer to follow the model of the os module: don't declare a function 
if it is not supported by the OS.

--

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



[issue22961] ctypes.WinError OSError

2014-11-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

No, OSError.errno is converted from the Windows error code.

There is a translation map (see PC/errmap.h, built with the _dosmaperr() 
function) and the default value is EINVAL.

It's working as intended. What was the winerror code? do you think it should be 
mapped to another errno?

--

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



[issue22961] ctypes.WinError OSError

2014-11-28 Thread Simon Zack

Simon Zack added the comment:

Ok, my bad, I was creating my own OSErrors so I was just testing it out. I just 
found the default to be rather confusing as I thought None would not be mapped 
to anything.

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I would prefer to follow the model of the os module: don't declare a function 
 if it is not supported by the OS.

I don't have any strong feelings, so let's do it like that. RAND_egd() isn't 
useful anyway.

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6f23bc5d480e by Victor Stinner in branch 'default':
Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The
https://hg.python.org/cpython/rev/6f23bc5d480e

--
nosy: +python-dev

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Ok, here is a first commit to try to support LibreSSL in Python 3.5.

Can someone please test to compile Python 3.5 with LibreSSL and run the test 
suite (at least test_ssl) to check that everything is fine? If you confirm that 
the change is correct, I will backport it to Python 2.7 and 3.4. Please mention 
your version of LibreSSL, OS and OS version in your feedback. LibreSSL has 
different releases: 2.0 to 2.1.1. Which one was embeded in OpenBSD 5.6?
http://www.libressl.org/

Bernard Spil's patches don't apply on Python 3.5, I guess that they were 
written for Python 2.7. I also fixed test_ssl.

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

call_soon_after_close.diff looks good but also incomplete: call_later, call_at 
and run_in_executor should also raise an exception if the event loop is closed.

You should also add call_soon_threadsafe to the test.

 So for consistency this patch should grow quite a bit (unless 
 create_connection, add_reader etc. already raise in this case).

Yes, add_reader raises an exception and there is an unit test to ensure that.

create_task() is a little bit special, it does not schedule immediatly a 
coroutine. IMO it makes sense to fail if the loop was closed, I don't see how 
the task can be executed if the loop was executed, so calling create_task() on 
a closed loop looks like a bug.

I suggest to modify the following methods:
- call_soon, call_soon_threadsafe
- call_at, call_later
- run_in_executor
- create_task
- add_signal_handler
- subprocess_exec, subprocess_shell

Did I miss something?

I'm not sure that *all* asyncio methods should must call _check_closed(), it 
may make the code harder to read. If the basic functions like call_soon and 
add_reader already handle the closed status, I guess that all other methods 
will fail loudly, so they don't need to be modified.

For example, stop() calls call_soon() and so will also raises an exception if 
the loop is closed.

Maybe we should add almost all methods to the test checking that calling these 
methods on a closed loop fail.

--

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



[issue22926] asyncio: raise an exception when called from the wrong thread

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch without unit:

- modify get_event_loop() to always raise a RuntimeError if the thread has no 
event loop. Before an AssertionError was not raised if python runs with -O 
option
- modify BaseEventLoop._assert_is_current_event_loop() to fail if the thread 
has an event loop
- modify tests to set the event loop to the newly created event loop, instead 
of setting it to None

--
keywords: +patch
Added file: http://bugs.python.org/file37303/asyncio_thread.patch

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Bernard Spil added the comment:

FAILED (failures=2, errors=2, skipped=5)
That is OK, as these 2 tests should fail with LibreSSL since SSLv2 and SSLv3 
support has been removed from LibreSSL.

ERROR: test_protocol_sslv23 (__main__.ThreadedTests)
ERROR: test_protocol_sslv3 (__main__.ThreadedTests)

--
Added file: http://bugs.python.org/file37304/test_ssl.log

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

 That is OK, as these 2 tests should fail with LibreSSL since SSLv2 and SSLv3 
 support has been removed from LibreSSL.

See the issue #22935.

I prefer to wait until this issue is fixed in Python 3.5, and that test_ssl 
pass on your PC, before backporting this change into Python 2.7  3.4.

--

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



[issue22935] Disabling SSLv3 support

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

FYI LibreSSL also disabled SSLv2 and SSLv3.

--
nosy: +haypo

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



[issue22935] Disabling SSLv3 support

2014-11-28 Thread Matthias Klose

Matthias Klose added the comment:

maybe it's time to generalise this one, still found on all branches:

# Issue #9415: Ubuntu hijacks their OpenSSL and forcefully disables SSLv2
def skip_if_broken_ubuntu_ssl(func):

--
nosy: +doko

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



[issue22914] Rewrite of Python 2/3 porting HOWTO

2014-11-28 Thread Brett Cannon

Brett Cannon added the comment:

I addressed Serhiy's comments and added in some bits that I initially took off 
(-bb, -3, str.__mod__, io.open). Also clarified a couple of things.

--
Added file: http://bugs.python.org/file37305/pyporting.diff

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



[issue22896] Don't use PyObject_As*Buffer() functions

2014-11-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky alexander.belopol...@gmail.com:


--
nosy: +belopolsky

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2014-11-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky alexander.belopol...@gmail.com:


--
nosy: +belopolsky

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



[issue22348] Documentation of asyncio.StreamWriter.drain()

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Sorry for the delay, I pushed asyncio-streams-drain-doc-water-limits.patch, 
thanks for your contribution Martin.

--

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



[issue22348] Documentation of asyncio.StreamWriter.drain()

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8224253ef4b7 by Victor Stinner in branch '3.4':
Closes #22348: Rephrase asyncio.StreamWriter.drain() documentation
https://hg.python.org/cpython/rev/8224253ef4b7

New changeset 1cad9e4bba40 by Victor Stinner in branch 'default':
(Merge 3.4) Closes #22348: Rephrase asyncio.StreamWriter.drain() documentation
https://hg.python.org/cpython/rev/1cad9e4bba40

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2014-11-28 Thread Martin Richard

Martin Richard added the comment:

Hi,

Actually, closing and creating a new loop in the child doesn't work either, at 
least on Linux.

When, in the child, we call loop.close(), it performs:
self.remove_reader(self._ssock)
(in selector_events.py, _close_self_pipe() around line 85)

Both the parent and the child still refer to the same underlying epoll 
structure, at that moment, and calling remove_reader() has an effect on the 
parent process too (which will never watch the self-pipe again).

I attached a test case that demonstrates the issue (and the workaround, 
commented).

--
nosy: +martius
Added file: http://bugs.python.org/file37306/test2.py

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



[issue22394] Update documentation building to use venv and pip

2014-11-28 Thread Brett Cannon

Brett Cannon added the comment:

Attached is a patch against Doc/Makefile to add a venv command to create a venv 
that can be used to build the documentation. Georg, can you give me an LGTM so 
I can commit this?

--
assignee: brett.cannon - georg.brandl
keywords: +patch
nosy: +georg.brandl
stage: needs patch - patch review
Added file: http://bugs.python.org/file37307/doc_venv.diff

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



[issue22685] memory leak: no transport for pipes by create_subprocess_exec/shell

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 737355f61ba2 by Victor Stinner in branch '3.4':
Issue #22685: Debug test_pause_reading() on FreeBSD
https://hg.python.org/cpython/rev/737355f61ba2

--

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



[issue22394] Update documentation building to use venv and pip

2014-11-28 Thread Georg Brandl

Georg Brandl added the comment:

Sure.  (The PyPI name is uppercased, but I guess it doesn't matter.)

--

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



[issue22936] traceback module has no way to show locals

2014-11-28 Thread Chris Rebert

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


--
nosy: +cvrebert

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



[issue22951] unexpected return from float.__repr__() for inf, -inf, nan

2014-11-28 Thread Chris Rebert

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


--
nosy: +cvrebert

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



[issue22931] cookies with square brackets in value

2014-11-28 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue22961] ctypes.WinError OSError

2014-11-28 Thread eryksun

eryksun added the comment:

 the default value is EINVAL.

Should that be specified in the docs? Currently it states that [t]he errno 
attribute is then an approximate translation, in POSIX terms, of that native 
error code.

https://docs.python.org/3/library/exceptions.html#OSError

--
nosy: +eryksun

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



[issue19105] pprint doesn't use all width

2014-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Antoine for your review.

But first variant of the patch doesn't affect an example at the top of this 
issue, it doesn't change string formatting. The second variant makes string 
formatting use all free space at the right. With the patch:

 import pprint
 print('='*80)  # a rule

 pprint.pprint([' '.join(str(i) for i in range(30))]*2)
['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 '
 '29',
 '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 '
 '29']
 pprint.pprint(' '.join(str(i) for i in range(30))*2)
'0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 '
'25 26 27 28 29']]],
 [[['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 '
'25 26 27 28 29'

Could you please make a review of new patch?

--
Added file: http://bugs.python.org/file37308/pprint_all_width_2.patch

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



[issue22963] type in PEP 102

2014-11-28 Thread Harsh Gupta

New submission from Harsh Gupta:

In PEP 102 [1], the link to PEP 101 is broken.

[1]: https://www.python.org/dev/peps/pep-0102/

--
components: Devguide
messages: 231825
nosy: ezio.melotti, hargup
priority: normal
severity: normal
status: open
title: type in PEP 102
type: behavior
versions: Python 3.4

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2014-11-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FYI:  I applied these two changes right after Guido pronounced on PEP 479:

https://mail.python.org/pipermail/python-checkins/2014-November/133252.html

https://mail.python.org/pipermail/python-checkins/2014-November/133253.html

Also, I'm submitting a patch to fix the code in Django that will be broken by 
PEP 479.

--
nosy: +rhettinger

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



[issue22963] broken link in PEP 102

2014-11-28 Thread Harsh Gupta

Changes by Harsh Gupta gupta.hars...@gmail.com:


--
title: type in PEP 102 - broken link in PEP 102

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



[issue22963] broken link in PEP 102

2014-11-28 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. This has already been reported at 
https://github.com/python/pythondotorg/issues/510.

--
nosy: +berker.peksag
resolution:  - third party
stage:  - resolved
status: open - closed

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

 FYI:  I applied these two changes right after Guido pronounced on PEP 479:

Extract of emails:

changeset:   93542:9eb0d0eb0992
parent:  93540:23f8a511050a
user:Raymond Hettinger python at rcn.com
date:Sat Nov 22 21:56:23 2014 -0800

PEP 479:  Don't let StopIteration bubble out of calls to next() inside a 
generator.


changeset:   93543:e8b3083bb148
user:Raymond Hettinger python at rcn.com
date:Sat Nov 22 22:14:41 2014 -0800

PEP 479:  Use the return-keyword instead of raising StopIteration inside a 
generators.

--
nosy: +haypo

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



[issue22962] ipaddress: Add optional prefixlen argument to ip_interface and ip_network

2014-11-28 Thread Berker Peksag

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


--
nosy: +ncoghlan, pmoody
versions: +Python 3.5

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



[issue22676] _pickle's whichmodule() is slow

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

On Windows with Visual Studio, I got a compiler warning. In whichmodule(), 
get_dotted_path() is called with module whereas module is not initialiazed:

dotted_path = get_dotted_path(module, global_name, allow_qualname);

--

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



[issue22389] Add contextlib.redirect_stderr()

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7f12c9c09fb6 by Berker Peksag in branch 'default':
Issue #22389: Add contextlib.redirect_stderr().
https://hg.python.org/cpython/rev/7f12c9c09fb6

--
nosy: +python-dev

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



[issue22389] Add contextlib.redirect_stderr()

2014-11-28 Thread Berker Peksag

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


--
assignee: rhettinger - berker.peksag
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue22955] Pickling of methodcaller, attrgetter, and itemgetter

2014-11-28 Thread Zachary Ware

Zachary Ware added the comment:

Note that pickling of the pure Python version of methodcaller works as expected:

Python 3.4.2 (default, Nov 20 2014, 12:40:10) 
[GCC 4.8.3] on linux
Type help, copyright, credits or license for more information.
 import sys
 sys.modules['_operator'] = None
 import operator
 import pickle
 pickle.loads(pickle.dumps(operator.methodcaller('foo')))
operator.methodcaller object at 0x7ff869945898

The pure Python attrgetter and itemgetter don't work due to using functions 
defined in __init__().

2.7 already raises TypeError on attempts to pickle any of the three.

--
nosy: +zach.ware
title: Pickling of methodcaller and attrgetter - Pickling of methodcaller, 
attrgetter, and itemgetter
versions: +Python 3.4

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



[issue22685] memory leak: no transport for pipes by create_subprocess_exec/shell

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0dd91298eb17 by Victor Stinner in branch 'default':
Issue #22685, asyncio: mock also resume_reading in test_pause_reading()
https://hg.python.org/cpython/rev/0dd91298eb17

--

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



[issue22685] memory leak: no transport for pipes by create_subprocess_exec/shell

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 276515d2ceed by Victor Stinner in branch 'default':
Issue #22685, asyncio: resume_reading() must also be called in 
test_pause_reading()
https://hg.python.org/cpython/rev/276515d2ceed

--

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



[issue22095] Use of set_tunnel with default port results in incorrect post value in host header

2014-11-28 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


Added file: http://bugs.python.org/file37309/issue22095_1.patch

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



[issue22095] Use of set_tunnel with default port results in incorrect post value in host header

2014-11-28 Thread Demian Brecht

Demian Brecht added the comment:

Thanks Serhiy, new patch addresses your comments.

--

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



[issue22964] dbm.open(..., x)

2014-11-28 Thread Antony Lee

New submission from Antony Lee:

It would be nice if dbm.open() supported the x flag that open() now supports 
(create a new db, failing if it already exists).

--
components: Library (Lib)
messages: 231835
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: dbm.open(..., x)
versions: Python 3.4

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



[issue22676] _pickle's whichmodule() is slow

2014-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch.

--
Added file: http://bugs.python.org/file37310/whichmodule_error.patch

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



[issue22964] dbm.open(..., x)

2014-11-28 Thread Berker Peksag

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


--
nosy: +berker.peksag
stage:  - needs patch
type:  - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue22585] os.urandom() should use getentropy() of OpenBSD 5.6

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch using getentropy() if available. I tested it on OpenBSD 5.6 
(the only OS implementing this function...).

The patch prepares also random.c to support Linux getrandom(): issue #22181.

--
keywords: +patch
Added file: http://bugs.python.org/file37311/getentropy.patch

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



[issue16113] SHA-3 (Keccak) support may need to be removed before 3.4

2014-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 21257f916668 by Ned Deily in branch '3.4':
Issue #16113: Also remove test_case_sha3_224_huge
https://hg.python.org/cpython/rev/21257f916668

New changeset bd97eab25c70 by Ned Deily in branch 'default':
Issue #16113: Also remove test_case_sha3_224_huge
https://hg.python.org/cpython/rev/bd97eab25c70

--

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



[issue21356] Support LibreSSL (instead of OpenSSL): make RAND_egd optional

2014-11-28 Thread Bernard Spil

Bernard Spil added the comment:

Merged the patch from haypo back into the FreeBSD port for 2.7 at 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192511
In the process I discovered during test_ssl that I had to patch Lib/socket.py 
as well to make RAND_egd conditional

--

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



  1   2   >