[RELEASED] Python 3.2

2011-02-20 Thread Georg Brandl
On behalf of the Python development team, I'm delighted to announce
Python 3.2 final release.

Python 3.2 is a continuation of the efforts to improve and stabilize the
Python 3.x line.  Since the final release of Python 2.7, the 2.x line
will only receive bugfixes, and new features are developed for 3.x only.

Since PEP 3003, the Moratorium on Language Changes, is in effect, there
are no changes in Python's syntax and built-in types in Python 3.2.
Development efforts concentrated on the standard library and support for
porting code to Python 3.  Highlights are:

* numerous improvements to the unittest module
* PEP 3147, support for .pyc repository directories
* PEP 3149, support for version tagged dynamic libraries
* PEP 3148, a new futures library for concurrent programming
* PEP 384, a stable ABI for extension modules
* PEP 391, dictionary-based logging configuration
* an overhauled GIL implementation that reduces contention
* an extended email package that handles bytes messages
* a much improved ssl module with support for SSL contexts and certificate
  hostname matching
* a sysconfig module to access configuration information
* additions to the shutil module, among them archive file support
* many enhancements to configparser, among them mapping protocol support
* improvements to pdb, the Python debugger
* countless fixes regarding bytes/string issues; among them full support
  for a bytes environment (filenames, environment variables)
* many consistency and behavior fixes for numeric operations

For a more extensive list of changes in 3.2, see

http://docs.python.org/3.2/whatsnew/3.2.html

To download Python 3.2 visit:

http://www.python.org/download/releases/3.2/

Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:

http://bugs.python.org/


Enjoy!

- -- 
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


PyCon Australia 2011 - Call for Participation

2011-02-20 Thread Richard Jones
The second PyCon AU will be held in Sydney on the weekend of the 20th
and 21st of August at the Sydney Masonic Center.

  http://pycon-au.org/

We are looking for proposals for Talks on all aspects of Python programming
from novice to advanced levels; applications and frameworks, or how you
have been involved in introducing Python into your organisation. We're
especially interested in short presentations that will teach conference-goers
something new and useful. Can you show attendees how to use a module?
Explore a Python language feature? Package an application?

We welcome first-time speakers; we are a community conference and we are
eager to hear about your experience. If you have friends or colleagues
who have something valuable to contribute, twist their arms to tell us
about it! Please also forward this Call for Proposals to anyone that you
feel may be interested.

To find out more go to the official Call for Proposals page here:

   http://pycon-au.org/2011/conference/proposals/

The deadline for proposal submission is the 2nd of May.


See you in Sydney in August!

 Richard Jones
 PyCon AU Program Chair
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Raymond Hettinger
 e = 10.0 ** -7; n = 0; z = c = complex(-0.75, e)
 while abs(z)  2.0:
n += 1
z = z * z + c

 n * e
3.1415926

Compute π ± e by counting Mandlebrot set iterations :-)


Raymond

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


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Raymond Hettinger
 Compute ð ± e by counting Mandlebrot set iterations :-)

That should be:  pi plus-or-minus e

Raymond

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


Unbinding a name referenced by an enclosing scope

2011-02-20 Thread Grigory Javadyan
From the Python Language Reference (v 3.1):

 It is illegal to unbind a name referenced by an enclosing scope; the compiler 
 will report a SyntaxError.

But when I run the following code:

a = 3
def x():
  global a
  del(a)

print(a)
x()

it works fine; and when I change the order of calls:

x()
print(a)

I get a NameError, not a SyntaxError. Apparently, I'm not
understanding the rule correctly. Can anyone explain it? Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unbinding a name referenced by an enclosing scope

2011-02-20 Thread Peter Otten
Grigory Javadyan wrote:

From the Python Language Reference (v 3.1):
 
 It is illegal to unbind a name referenced by an enclosing scope; the
 compiler will report a SyntaxError.
 
 But when I run the following code:
 
 a = 3
 def x():
   global a
   del(a)
 
 print(a)
 x()
 
 it works fine; and when I change the order of calls:
 
 x()
 print(a)
 
 I get a NameError, not a SyntaxError. Apparently, I'm not
 understanding the rule correctly. Can anyone explain it? Thanks.

The line you quote is probably meant to describe the following:

 def f():
... a = 42
... def g():
... nonlocal a
... del a
...
SyntaxError: can not delete variable 'a' referenced in nested scope

Please file a documentation bug if you can come up with a clarification.
-- 
http://mail.python.org/mailman/listinfo/python-list


hmac module and key format

2011-02-20 Thread Stuart Longland
Hi,

Maybe I'm completely dense with regards to the hmac module and HMAC in
general, but I've searched and cannot find for the life of me the
answer to this very basic question.

What format does hmac require the key to be in?

I have a key in hexadecimal, do I give it the hex?  Do I decode that
to binary and give it that?  Do I try to figure out what passphrase
generated the hex and give it that instead?  Nowhere in the
documentation does it appear to mention what form the key must take,
or how you tell it what form it's in for it to figure it out.  If
someone could enlighten me, I'd be most grateful.

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


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Ben Finney
Raymond Hettinger pyt...@rcn.com writes:

 Compute π ± e by counting Mandlebrot set iterations :-)

Very cool! I love π nerdery.


Raymond Hettinger pyt...@rcn.com writes:

  Compute ð ± e by counting Mandlebrot set iterations :-)

 That should be:  pi plus-or-minus e

It was in my reader. Perhaps your server has encoding trouble?

-- 
 \   Moriarty: “Forty thousand million billion dollars? That money |
  `\must be worth a fortune!” —The Goon Show, _The Sale of |
_o__)   Manhattan_ |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hmac module and key format

2011-02-20 Thread Paul Rubin
Stuart Longland redhat...@gentoo.org writes:
 What format does hmac require the key to be in?

It's an arbitrary string.  

I have a key in hexadecimal, do I give it the hex?  Do I decode that
to binary and give it that?  

Probably yes.  Do you have test vectors?  See if they work.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Martin Gregorie
On Sun, 20 Feb 2011 22:42:17 +1100, Ben Finney wrote:

 Raymond Hettinger pyt...@rcn.com writes:
 
 Compute π ± e by counting Mandlebrot set iterations :-)
 
 Very cool! I love π nerdery.
 
 
 Raymond Hettinger pyt...@rcn.com writes:
 
  Compute ð ± e by counting Mandlebrot set iterations :-)

 That should be:  pi plus-or-minus e
 
 It was in my reader. Perhaps your server has encoding trouble?

Same here (Pan reader, Fedora 14).



-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org   |
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 3.2 and html.escape function

2011-02-20 Thread Gerald Britton
I see that Python 3.2 includes a new module -- html -- with a single
function -- escape.  I would like to know how this function differs
from xml.sax.saxutils.escape and, if there is no difference (or only a
minor one), what the need is for this new module and its lone function

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


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Steven D'Aprano
On Sun, 20 Feb 2011 00:08:58 -0800, Raymond Hettinger wrote:

 e = 10.0 ** -7; n = 0; z = c = complex(-0.75, e) 
 while abs(z)  2.0:
   n += 1
   z = z * z + c
 
 n * e
 3.1415926

Absolutely brilliant! That alone justifies including complex as a built-
in type. *wink*


 Compute π ± e by counting Mandlebrot set iterations :-)

eps would be a better name than e. As I read it, π ± e would be some 
number between 0.423310825130748 and 5.859874482048838, which isn't a 
terribly impressive approximation :)

BTW, I see the symbol in your post as π (pi), not ð (lowercase eth).



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


Re: Python 3.2 and html.escape function

2011-02-20 Thread Steven D'Aprano
On Sun, 20 Feb 2011 08:15:35 -0500, Gerald Britton wrote:

 I see that Python 3.2 includes a new module -- html -- with a single
 function -- escape.  I would like to know how this function differs from
 xml.sax.saxutils.escape and, if there is no difference (or only a minor
 one), what the need is for this new module and its lone function

Unless the html API has changed radically since Python 3.2a, I believe 
you are mistaken.

[steve@sylar ~]$ python3.2
Python 3.2a1 (r32a1:83318, Aug 12 2010, 02:17:22)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type help, copyright, credits or license for more information.
 import html
 help(html)

which gives me the following information:



Help on package html:

NAME
html - # This directory is a Python package.

FILE
/usr/local/lib/python3.2/html/__init__.py

MODULE DOCS
http://docs.python.org/library/html

PACKAGE CONTENTS
entities
parser



So html is not a module, but a package that includes two sub-modules, 
entities and parser. I see no sign of anything called escape in either 
the top level html package, or either of the sub-modules, and the word 
escape only appears twice in the whole package, both times as 
unescape:


[steve@sylar ~]$ cd /usr/local/lib/python3.2/html/
[steve@sylar html]$ ls
entities.py  __init__.py  parser.py  __pycache__
[steve@sylar html]$ grep -i escape *.py
parser.py:attrvalue = self.unescape(attrvalue)
parser.py:def unescape(self, s):


So I don't know what you are looking at, but I don't believe it is the 
standard html package in the Python standard library. Perhaps you have 
accidentally shadowed it with your own html module? Try this:

 import html
 html.__file__
'/usr/local/lib/python3.2/html/__init__.py'



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


Re: Python 3.2 and html.escape function

2011-02-20 Thread Peter Otten
Steven D'Aprano wrote:

 On Sun, 20 Feb 2011 08:15:35 -0500, Gerald Britton wrote:
 
 I see that Python 3.2 includes a new module -- html -- with a single
 function -- escape.  I would like to know how this function differs from
 xml.sax.saxutils.escape and, if there is no difference (or only a minor
 one), what the need is for this new module and its lone function
 
 Unless the html API has changed radically since Python 3.2a, I believe
 you are mistaken.

Adding a function is not /that/ radical, and it has happened, see

http://docs.python.org/dev/py3k/library/html.html

The check-in message that is linked there claims that html.escape() is 
supposed to replace cgi.escape()

Side note: there has been a discussion whether it's a good idea to put a 
function into a package, see

http://mail.python.org/pipermail/python-dev/2011-January/107635.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to gain root privileges

2011-02-20 Thread GSO
 http://hal.freedesktop.org/docs/polkit/pkexec.1.html
 http://hal.freedesktop.org/docs/polkit/polkit.8.html
 http://www.freedesktop.org/wiki/Software/PolicyKit

 A python package:

 http://pypi.python.org/pypi?:action=searchterm=polkitsubmit=search

 But there is example python code here:

 http://hal.freedesktop.org/docs/polkit/polkit-apps.html


A quick note for completeness on policykit - it takes two config files
to manage policykit (which threw me a bit), see pkexec, but see also
pklocalauthority to authorise users:

http://hal.freedesktop.org/docs/polkit/pklocalauthority.8.html
http://mdzlog.alcor.net/2010/06/27/navigating-the-policykit-maze/

Also on the subject of creating/ running a daemon from init, a
template for python code to do this here:

http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Anssi Saari
Ben Finney ben+pyt...@benfinney.id.au writes:

 Raymond Hettinger pyt...@rcn.com writes:

 Compute π ± e by counting Mandlebrot set iterations :-)

 Very cool! I love π nerdery.


 Raymond Hettinger pyt...@rcn.com writes:

  Compute ð ± e by counting Mandlebrot set iterations :-)

 That should be:  pi plus-or-minus e

 It was in my reader. Perhaps your server has encoding trouble?

He (or rather Google) used iso-8859-7 as a character set, which is the
Latin/Greek alphabet and definitely has pi at 0xF0. Not exactly a
common character set though. Running a iso-8859-1 font in a terminal
means I see a ? instead of pi...
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 3.2 and html.escape function

2011-02-20 Thread Gerald Britton
Forgot to include the reference:

http://docs.python.org/dev/whatsnew/3.2.html

html
A new html module was introduced with only a single function,
escape(), which is used for escaping reserved characters from HTML
markup:

 import html
 html.escape('x  2  x  7')
'x gt; 2 amp;amp; x lt; 7'

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


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Roy Smith
In article 87oc679bl2@benfinney.id.au,
 Ben Finney ben+pyt...@benfinney.id.au wrote:

 Raymond Hettinger pyt...@rcn.com writes:
 
  Compute � � e by counting Mandlebrot set iterations :-)
 
 Very cool! I love � nerdery.
 
 
 Raymond Hettinger pyt...@rcn.com writes:
 
   Compute ð ± e by counting Mandlebrot set iterations :-)
 
  That should be:  pi plus-or-minus e
 
 It was in my reader. Perhaps your server has encoding trouble?

He was probably reading the nroff man page.

(ducking and running)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to use Python well?

2011-02-20 Thread Chris Jones
On Sat, Feb 19, 2011 at 05:27:24PM EST, Cameron Simpson wrote:

[..]

 Any yet I (and others, based on stuff I've seen) find info to be a
 disaster. Why?
 
  - it forces the reader to use a non-standard pager to look
at info, typically the utterly weird one that comes with the info
command.

On the rare occcasions I used it, navigation was such an uphill battle
that I often forgot what I was looking for in the first place.

The user using a terminal _should_ get to use their own pager
because their fingers know how to drive it. 

I stumbled into this some time ago and never looked back:

  https://alioth.debian.org/projects/pinfo/

It was love at first sight since it actually has the good taste to use
by default the same vi-like navigation key bindings I have set up for
myself in the ELinks web browser, which I tend to favor over GUIs
browsers when I'm reading html docs. 

When you need to do brutal force searches, you could also take a look at
the vim ‘info’ plugin. On debian distributions, it is part of the
‘vim-scripts’ package and can be invoked by the ‘:Info’ Ex-mode command.
You can then use the ‘:helpgrep’ command to create a list of matches
that you can navigate in the same user-friendly way as you would use for
the Vim help files. In a nutshell, instead of getting cross-eyed trying
to locate the highlighted area on the screen to find the current match
and hit some ‘find next’ button (or use any functionally similar
mechanism) repeatedly, you are presented with a list of all your matches
in their context. It is then just a matter of navigating to the one(s)
that looks more promising and just hit enter to open the corresponding
doc page in another Vim sub-window.

Info, in its tiny pieces of text linked to other tiny pieces of
text form, does not lend itself to this and the browser it does
offer on a terminal is arcane.

That also happens with html docs, with the single page vs. chunked
formats. I have been rather enraged myself when researching something or
other and felt I'd hit the jackpot when I found the perfect document
online, only to have to read through the whole thing anyway because only
the chunked format was available, and save from downloading all the bits
and pieces and somehow recreating the single page version, there was no
way I could run a global search.

My main criticism of the man format is that it does not provide both.

Here's an example. Since I don't write bash scripts on a regular basis,
I often have to refer to the bash documentation. If I use man, I can
search for instance for ‘SHELL BUILTIN’ alright, but the trouble is that
there are about a dozen matches in this giant man page before I actually
get to the ‘SHELL BUILTINS’ section. The info format, on the other hand,
provides and index of the builtins, where I quickly find precisely what
I am looking for. 

Generally speaking, I find that man pages are fine for anything that's,
well.. about one page and that I can display on one screen (that's 92
lines on my display) have has major limitations for anything much
longer.

But see below (*).
 
  - the info pages end up as a scattering of tiny cross linked (if
you're lucky) pieces with little information on one place/page.
So you can't, for example, stand at the top of the doco page and
search for a term.

Not sure which particular info manual(s) you are referring to.

There are also info documents that are nicely structured.. with a table
of contents, an index, and sections of manageable proportions that
provided you don't use the ridiculous ‘info’ viewer, make on-screen
reading a pleasure, especially when you have decided to read the manual
cover to cover. GNU/screen is a good example. The gdb manual is another.

Perhaps it's also a matter of who wrote the doc, how good he is at
writing doc, and how much effort he put in designing and writing the
doc. And tools that automate the conversion from man to info and back
may also have something to do with this sorry state of affairs.

 Frankly, info is usually a step backward, speaking as a reader.

I am also speaking as a reader and I find that both the man and the info
format (and html as well, for that matter) have their merits, and it's
a question of choosing the right format, depending on the circumstances
and what you are trying to do. 

 * I grew enraged at the prevalence of GNU unix tools with only info
   for doco, and no manual pages or manual pages that said we don't put
   anything useful here, go read the info pages, the stuff here may not
   even be maintained (I'm serious - see the bottom of a lot of the
   rather trite manual pages that ship with GNU this/that/the-other).

Same here... Especially when adding insult to injury, your favorite
distribution ships a man page that directs you to the info manual, but
does not ship the info version due to licensing disagreements, and you
have to download the info version from gnu.org, create your own debian
package.. etc. etc. 

Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Martin v. Loewis
 eps would be a better name than e. 

py ε = 10.0 ** -7; n = 0; z = c = complex(-0.75, ε)
py while abs(z)  2.0:
... n += 1
... z = z * z + c
...
py π = n * ε
py print(π)
3.1415926

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


Re: hmac module and key format

2011-02-20 Thread Peter Pearson
On Sun, 20 Feb 2011 04:01:20 -0800, Paul Rubin no.email@nospam.invalid wrote:
 Stuart Longland redhat...@gentoo.org writes:
 What format does hmac require the key to be in?

 It's an arbitrary string.  

 I have a key in hexadecimal, do I give it the hex?  Do I decode that
 to binary and give it that?  

 Probably yes.  Do you have test vectors?  See if they work.

Test case from http://www.faqs.org/rfcs/rfc2104.html :


  key = 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  key_len = 16 bytes
  data =Hi There
  data_len =8  bytes
  digest =  0x9294727a3638bb1c13f48ef8158bfc9d

Using the hmac module:

 hmac.hmac_md5( Hi There, 16*\x0b )
'\x92\x94rz68\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d'


-- 
To email me, substitute nowhere-spamcop, invalid-net.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Ben Finney
Anssi Saari a...@sci.fi writes:

 Ben Finney ben+pyt...@benfinney.id.au writes:
  It [appeared correctly] in my reader. Perhaps your server has
  encoding trouble?

 He (or rather Google) used iso-8859-7 as a character set, which is the
 Latin/Greek alphabet and definitely has pi at 0xF0. Not exactly a
 common character set though. Running a iso-8859-1 font in a terminal
 means I see a ? instead of pi...

Another good reason to eschew legacy encodings and use a Unicode
character encoding for all internet messages, like the extremely common
UTF-8. Get to it, Raymond! :-)

-- 
 \  “I knew things were changing when my Fraternity Brothers threw |
  `\   a guy out of the house for mocking me because I'm gay.” |
_o__)  —postsecret.com, 2010-01-19 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython in the context of Eclipse

2011-02-20 Thread Brendan Simon (eTRIX)

On 20/02/2011 10:00 PM, python-list-requ...@python.org wrote:

Subject:
wxPython in the context of Eclipse
From:
Fred Marshall fmarshallxremove_th...@acm.org
Date:
Sat, 19 Feb 2011 23:22:44 -0800

To:
python-list@python.org


I asked earlier:

How do I use wxPython or wxGlade in the context of Eclipse?

A link to a howto would be great!

I guess nobody knows or cares to answer?


Have you tried the wxPython mailing list.  You will probably have more 
wxPython users to draw upon than this list ;-)


I use Eclipse with wxPython and it works fine.  You need to install the 
Eclipse PyDev module (which I presume you have already done).
If I recall correctly, I had to specify the python interpreter to use.  
It added a whole lot of paths to the PYTHONPATH variable which caused me 
some grief.  I ended up removing them all (or most of them) and it 
worked fine after that.


Cheers, Brendan.

--
Brendan Simon
www.etrix.com.au

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


[RELEASED] Python 3.2

2011-02-20 Thread Georg Brandl
On behalf of the Python development team, I'm delighted to announce
Python 3.2 final release.

Python 3.2 is a continuation of the efforts to improve and stabilize the
Python 3.x line.  Since the final release of Python 2.7, the 2.x line
will only receive bugfixes, and new features are developed for 3.x only.

Since PEP 3003, the Moratorium on Language Changes, is in effect, there
are no changes in Python's syntax and built-in types in Python 3.2.
Development efforts concentrated on the standard library and support for
porting code to Python 3.  Highlights are:

* numerous improvements to the unittest module
* PEP 3147, support for .pyc repository directories
* PEP 3149, support for version tagged dynamic libraries
* PEP 3148, a new futures library for concurrent programming
* PEP 384, a stable ABI for extension modules
* PEP 391, dictionary-based logging configuration
* an overhauled GIL implementation that reduces contention
* an extended email package that handles bytes messages
* a much improved ssl module with support for SSL contexts and certificate
  hostname matching
* a sysconfig module to access configuration information
* additions to the shutil module, among them archive file support
* many enhancements to configparser, among them mapping protocol support
* improvements to pdb, the Python debugger
* countless fixes regarding bytes/string issues; among them full support
  for a bytes environment (filenames, environment variables)
* many consistency and behavior fixes for numeric operations

For a more extensive list of changes in 3.2, see

http://docs.python.org/3.2/whatsnew/3.2.html

To download Python 3.2 visit:

http://www.python.org/download/releases/3.2/

Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:

http://bugs.python.org/


Enjoy!

- -- 
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE won't wrap lines of text

2011-02-20 Thread Terry Reedy

On 2/19/2011 6:56 PM, Richard D. Moores wrote:

Vista
Python 3.1.3

I can't figure out how to get IDLE to wrap text pasted in from, say, a
newspaper article. Usually, a each paragraph will appear as one long
unwrapped line, with no way to read the whole line, because no
horizontal bar is created. I haven't found anything about this in
either the options or the help.


The IDLE editor was designed for writing Python code, not general text. 
It is expected that you will limit line lengths to what can be seen on 
your screen.


--
Terry Jan Reedy

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


Re: IDLE won't wrap lines of text

2011-02-20 Thread Rhodri James
On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores rdmoo...@gmail.com  
wrote:



Vista
Python 3.1.3

I can't figure out how to get IDLE to wrap text pasted in from, say, a
newspaper article. Usually, a each paragraph will appear as one long
unwrapped line, with no way to read the whole line, because no
horizontal bar is created. I haven't found anything about this in
either the options or the help.


I hate to ask, but why are you doing this?  IDLE isn't a general-purpose  
editor, it's a programming editor specifically for Python, and as such  
it's entirely appropriate for it to discourage overly long lines.


--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


SQLite server using execnet ?

2011-02-20 Thread Stef Mientki
hello,

knowing that SQllite is not a client/server database,
still want to see if a simple client/server setup would solve my current 
problems for the moment
(because I love the simplicity of SQLlite,
and planned to go to a client / server database in the future)

Now I wonder if anyone has considered  to use Python execnet-module to realize 
a simple SLQlite
client / server application.

If I look at the documentation of execnet,
(and I realize that I'm a great optimist)
it would take between 20 and 50 lines of Python code.

thanks very much for your opinions.
cheers,
Stef Mientki

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


Re: Problems of Symbol Congestion in Computer Languages

2011-02-20 Thread BartC



WestleyMartínez aniko...@gmail.com wrote in message 
news:mailman.202.1298081685.1189.python-l...@python.org...




You have provided me with some well thought out arguments and have
stimulated my young programmer's mind, but I think we're coming from
different angles. You seem to come from a more math-minded, idealist
angle, while I come from a more practical angle. Being a person who has
had to deal with the í in my last name


What purpose does the í serve in your last name, and how is it different 
from i?


(I'd have guessed it indicated stress, but it looks Spanish and I thought 
that syllable was stressed anyway.)


--
Bartc


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


Re: IDLE won't wrap lines of text

2011-02-20 Thread Richard D. Moores
On Sun, Feb 20, 2011 at 16:31, Rhodri James rho...@wildebst.demon.co.uk wrote:
 On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores rdmoo...@gmail.com
 wrote:

 Vista
 Python 3.1.3

 I can't figure out how to get IDLE to wrap text pasted in from, say, a
 newspaper article. Usually, a each paragraph will appear as one long
 unwrapped line, with no way to read the whole line, because no
 horizontal bar is created. I haven't found anything about this in
 either the options or the help.

 I hate to ask, but why are you doing this?  IDLE isn't a general-purpose
 editor, it's a programming editor specifically for Python, and as such it's
 entirely appropriate for it to discourage overly long lines.

Take a look at http://tutoree7.pastebin.com/EmyQTaYt

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


Re: IDLE won't wrap lines of text

2011-02-20 Thread Rhodri James
On Mon, 21 Feb 2011 01:41:12 -, Richard D. Moores rdmoo...@gmail.com  
wrote:


On Sun, Feb 20, 2011 at 16:31, Rhodri James  
rho...@wildebst.demon.co.uk wrote:
On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores  
rdmoo...@gmail.com

wrote:


Vista
Python 3.1.3

I can't figure out how to get IDLE to wrap text pasted in from, say, a
newspaper article. Usually, a each paragraph will appear as one long
unwrapped line, with no way to read the whole line, because no
horizontal bar is created. I haven't found anything about this in
either the options or the help.


I hate to ask, but why are you doing this?  IDLE isn't a general-purpose
editor, it's a programming editor specifically for Python, and as such  
it's

entirely appropriate for it to discourage overly long lines.


Take a look at http://tutoree7.pastebin.com/EmyQTaYt


I see.  I'd recommend the approach of sticking your source data in a
separate text file (using a text editor rather than IDLE) in any case;
it's much less of a pain to change what you are working on that way.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE won't wrap lines of text

2011-02-20 Thread Richard D. Moores
On Sun, Feb 20, 2011 at 18:32, Rhodri James rho...@wildebst.demon.co.uk wrote:
 On Mon, 21 Feb 2011 01:41:12 -, Richard D. Moores rdmoo...@gmail.com
 wrote:

 On Sun, Feb 20, 2011 at 16:31, Rhodri James rho...@wildebst.demon.co.uk
 wrote:

 On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores
 rdmoo...@gmail.com
 wrote:

 Vista
 Python 3.1.3

 I can't figure out how to get IDLE to wrap text pasted in from, say, a
 newspaper article. Usually, a each paragraph will appear as one long
 unwrapped line, with no way to read the whole line, because no
 horizontal bar is created. I haven't found anything about this in
 either the options or the help.

 I hate to ask, but why are you doing this?  IDLE isn't a general-purpose
 editor, it's a programming editor specifically for Python, and as such
 it's
 entirely appropriate for it to discourage overly long lines.

 Take a look at http://tutoree7.pastebin.com/EmyQTaYt

 I see.  I'd recommend the approach of sticking your source data in a
 separate text file (using a text editor rather than IDLE) in any case;
 it's much less of a pain to change what you are working on that way.

Problem is I know of no text editor that can handle Japanese.

Thanks,

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


Re: IDLE won't wrap lines of text

2011-02-20 Thread André Roberge
On Sunday, February 20, 2011 10:51:38 PM UTC-4, Dick Moores wrote:
 On Sun, Feb 20, 2011 at 18:32, Rhodri James rho...@wildebst.demon.co.uk 
 wrote:
  On Mon, 21 Feb 2011 01:41:12 -, Richard D. Moores rdmo...@gmail.com
  wrote:
 
  On Sun, Feb 20, 2011 at 16:31, Rhodri James rho...@wildebst.demon.co.uk
  wrote:
 
  On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores
  rdmo...@gmail.com
  wrote:
 
  Vista
  Python 3.1.3
 
  I can't figure out how to get IDLE to wrap text pasted in from, say, a
  newspaper article. Usually, a each paragraph will appear as one long
  unwrapped line, with no way to read the whole line, because no
  horizontal bar is created. I haven't found anything about this in
  either the options or the help.
 
  I hate to ask, but why are you doing this?  IDLE isn't a general-purpose
  editor, it's a programming editor specifically for Python, and as such
  it's
  entirely appropriate for it to discourage overly long lines.
 
  Take a look at http://tutoree7.pastebin.com/EmyQTaYt
 
  I see.  I'd recommend the approach of sticking your source data in a
  separate text file (using a text editor rather than IDLE) in any case;
  it's much less of a pain to change what you are working on that way.
 
 Problem is I know of no text editor that can handle Japanese.
 
 Thanks,
 
 Dick


The editor in Crunchy (http://code.google.com/p/crunchy) appears to be working 
just fine with the sample code you posted (at least when using Python 3 - I got 
an error when using it to run the code with Python 2). That being said, I would 
not recommend it for heavy work 

An editor that seems to work just fine (although it took a long time to load 
the sample code) is SublimeText (http://www.sublimetext.com/) - version 2 
alpha; it is becoming my editor of choice.

André

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


Re: Problems of Symbol Congestion in Computer Languages

2011-02-20 Thread alex23
rantingrick rantingr...@gmail.com wrote:
 You lack vision.

And you lack education.

 Evolution is the pursuit of perfection at the expense of anything and
 everything!

Evolution is the process by which organisms change over time through
genetically shared traits. There is no 'perfection', there is only
'fitness', that is, survival long enough to reproduce. Fitness is not
something any of your ideas possess.

The rest of your conjecture about my opinions and beliefs is just pure
garbage. You'd get far fewer accusations of being a troll if you
stopped putting words into other peoples mouths; then we'd just think
you're exuberantly crazy.

Also, Enough! With! The! Hyperbole! Already! Visionary is _never_ a
self-appointed title.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SQLite server using execnet ?

2011-02-20 Thread Grigory Javadyan
Are you sure you'll still be able to guarantee the ACID'ity of
transactions? What about performance? Also, what kind of load are you
expecting? I believe this will choke under too much simultaneous
queries.

On Mon, Feb 21, 2011 at 4:55 AM, Stef Mientki stef.mien...@gmail.com wrote:
 hello,

 knowing that SQllite is not a client/server database,
 still want to see if a simple client/server setup would solve my current 
 problems for the moment
 (because I love the simplicity of SQLlite,
 and planned to go to a client / server database in the future)

 Now I wonder if anyone has considered  to use Python execnet-module to 
 realize a simple SLQlite
 client / server application.

 If I look at the documentation of execnet,
 (and I realize that I'm a great optimist)
 it would take between 20 and 50 lines of Python code.

 thanks very much for your opinions.
 cheers,
 Stef Mientki

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

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


Re: Problems of Symbol Congestion in Computer Languages

2011-02-20 Thread Steven D'Aprano
On Sun, 20 Feb 2011 20:52:36 -0800, alex23 wrote:

 Also, Enough! With! The! Hyperbole! Already! Visionary is _never_ a
 self-appointed title.

You only say that because you lack the vision to see just how visionary 
rantingrick's vision is1!11!



Followups set to c.l.p.


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


[issue11254] distutils doesn't byte-compile .py files to __pycache__ during installation

2011-02-20 Thread Stefan Behnel

New submission from Stefan Behnel sco...@users.sourceforge.net:

During installation of Python packages (setup.py install or bdist), distutils 
puts .pyc files into the installed source directory, instead of moving them 
into __pycache__. This may mean that they are not getting used after 
installation (with potentially no way of getting updated due to lack of write 
access by users), and that source files that get imported during installation 
may end up with .pyc files in both the source directory and the __pycache__ 
directory in the installed package.

The relevant python-dev thread is here:

http://thread.gmane.org/gmane.comp.python.devel/121248/

--
assignee: tarek
components: Distutils
messages: 128897
nosy: eric.araujo, scoder, tarek
priority: normal
severity: normal
status: open
title: distutils doesn't byte-compile .py files to __pycache__ during 
installation
type: behavior
versions: Python 3.2

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



[issue11252] Handling statement OR assignment continuation '\' on Win32 platform

2011-02-20 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Why do you think this is a bug in Python as opposed to one in the script 
parsing the .conf file?

--
nosy: +georg.brandl
resolution:  - invalid
status: open - pending

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



[issue11254] distutils doesn't byte-compile .py files to __pycache__ during installation

2011-02-20 Thread Stefan Behnel

Stefan Behnel sco...@users.sourceforge.net added the comment:

Here's a patch. I basically copied over the way py_compile determines the .pyc 
file name.

It works for me for a normal installation. However, I couldn't test it with 
-O, as 2to3 crashes for me when I enable it during installation. I guess 
that's a separate issue.

--
keywords: +patch
Added file: http://bugs.python.org/file20802/issue11254.patch

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



[issue11255] 2to3 throws AttributeError during distutils installation with -O

2011-02-20 Thread Stefan Behnel

New submission from Stefan Behnel sco...@users.sourceforge.net:

When running a distutils installation of Cython (which uses lib2to3) as 
python3.2 -O setup.py bdist, I get this:

Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
Traceback (most recent call last):
  File setup.py, line 319, in module
**setup_args
  File /opt/python3.2-opt/lib/python3.2/distutils/core.py, line 149, in setup
dist.run_commands()
  File /opt/python3.2-opt/lib/python3.2/distutils/dist.py, line 919, in 
run_commands
self.run_command(cmd)
  File /opt/python3.2-opt/lib/python3.2/distutils/dist.py, line 938, in 
run_command
cmd_obj.run()
  File /opt/python3.2-opt/lib/python3.2/distutils/command/bdist.py, line 132, 
in run
self.run_command(cmd_name)
  File /opt/python3.2-opt/lib/python3.2/distutils/cmd.py, line 315, in 
run_command
self.distribution.run_command(command)
  File /opt/python3.2-opt/lib/python3.2/distutils/dist.py, line 938, in 
run_command
cmd_obj.run()
  File /opt/python3.2-opt/lib/python3.2/distutils/command/bdist_dumb.py, line 
74, in run
self.run_command('build')
  File /opt/python3.2-opt/lib/python3.2/distutils/cmd.py, line 315, in 
run_command
self.distribution.run_command(command)
  File /opt/python3.2-opt/lib/python3.2/distutils/dist.py, line 938, in 
run_command
cmd_obj.run()
  File /opt/python3.2-opt/lib/python3.2/distutils/command/build.py, line 128, 
in run
self.run_command(cmd_name)
  File /opt/python3.2-opt/lib/python3.2/distutils/cmd.py, line 315, in 
run_command
self.distribution.run_command(command)
  File /opt/python3.2-opt/lib/python3.2/distutils/dist.py, line 938, in 
run_command
cmd_obj.run()
  File /opt/python3.2-opt/lib/python3.2/distutils/command/build_py.py, line 
404, in run
self.run_2to3(self.updated_files)
  File /opt/python3.2-opt/lib/python3.2/distutils/util.py, line 649, in 
run_2to3
return run_2to3(files, self.fixer_names, self.options, self.explicit)
  File /opt/python3.2-opt/lib/python3.2/distutils/util.py, line 597, in 
run_2to3
r.refactor(files, write=True)
  File /opt/python3.2-opt/lib/python3.2/lib2to3/refactor.py, line 296, in 
refactor
self.refactor_file(dir_or_file, write, doctests_only)
  File /opt/python3.2-opt/lib/python3.2/lib2to3/refactor.py, line 349, in 
refactor_file
tree = self.refactor_string(input, filename)
  File /opt/python3.2-opt/lib/python3.2/lib2to3/refactor.py, line 381, in 
refactor_string
self.refactor_tree(tree, name)
  File /opt/python3.2-opt/lib/python3.2/lib2to3/refactor.py, line 442, in 
refactor_tree
find_root(node)
  File /opt/python3.2-opt/lib/python3.2/lib2to3/fixer_util.py, line 276, in 
find_root
while node.type != syms.file_input:
AttributeError: 'NoneType' object has no attribute 'type'

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 128900
nosy: scoder
priority: normal
severity: normal
status: open
title: 2to3 throws AttributeError during distutils installation with -O
type: crash
versions: Python 3.2

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



[issue11127] sockets should not be pickleable

2011-02-20 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

the correct way is to provide a __getstate__ method for socket right? I have 
implemented that in the attached patch.

--
keywords: +patch
nosy: +xuanji
Added file: http://bugs.python.org/file20803/issue11127.patch

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



[issue11256] inspect.getcallargs raises TypeError on valid arguments

2011-02-20 Thread Daniel Urban

New submission from Daniel Urban urban.dani...@gmail.com:

inspect.getcallargs raises TypeError if given a function with only **kwargs, 
and some keyword arguments:

Python 3.3a0 (py3k:88451, Feb 20 2011, 12:37:22) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 
 from inspect import getcallargs
 
 def f(**kwargs): pass
... 
 f(a=1, b=2)
 
 getcallargs(f, a=1, b=2)
Traceback (most recent call last):
...
TypeError: f() takes no arguments (2 given)


In line 946 of inspect.py the num_args == 0 and num_total condition is true: 
the function expects 0 positional arguments and got more than zero arguments, 
but in this case these are keyword arguments, so it shouldn't raise TypeError.

--
components: Library (Lib)
messages: 128902
nosy: benjamin.peterson, durban, gsakkis
priority: normal
severity: normal
status: open
title: inspect.getcallargs raises TypeError on valid arguments
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue11254] distutils doesn't byte-compile .py files to __pycache__ during installation

2011-02-20 Thread Éric Araujo

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

Patch looks good.  Regarding the problem with 2to3 and -O, maybe you can run 
2to3 manually, copy the setup.py and run python3.2 -0.  
disutils.util.byte_compile is not tested, so this patch requires at least 
careful manual testing, and if possible a unit test.

In distutils2, it may be possible to replace this function with a compileall 
call.

--
components: +Distutils2
nosy: +alexis, barry
stage:  - patch review
versions: +3rd party, Python 3.3

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



[issue11133] inspect.getattr_static code execution

2011-02-20 Thread Florian Mayer

Florian Mayer florma...@aim.com added the comment:

Apparently another way to get getattr_static to execute code in Python 2.3rc3 
is simply the following.

 class Foo:
... @property
... def __dict__(self):
... print(Hello, World.)
... return {}
... 
 import inspect
 inspect.getattr_static(Foo(), 'a')
Hello, World.
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/name/opt/lib/python3.2/inspect.py, line 1130, in getattr_static
raise AttributeError(attr)
AttributeError: a


--
nosy: +segfaulthunter

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread yeswanth

yeswanth swamiyeswa...@yahoo.com added the comment:

I guess this needs to be reviewed . Added support for checking version in 
mkcfg.py by making use of suggest_normalized_version .. (didnt not an error  
for non matching suggestion , though it will prompt for the version  it again )

--
Added file: http://bugs.python.org/file20804/diff

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread Éric Araujo

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

Not bad!  You need to test the script, at least manually, if possible with unit 
tests.  This typo slipped in:

+   self.data.get['version']=suggested_version
Remove “.get” (also add spaces around operators).

--

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



[issue11256] inspect.getcallargs raises TypeError on valid arguments

2011-02-20 Thread Daniel Urban

Daniel Urban urban.dani...@gmail.com added the comment:

Here is a patch. It also includes tests that would have detected this bug. It 
also corrects a case when getcallargs raised an exception with a different 
message (there are tests also for this):

 def f(**kwargs): pass
... 
 f(1, a=2)
Traceback (most recent call last):
...
TypeError: f() takes exactly 0 positional arguments (2 given)
 
 getcallargs(f, 1, a=2)
Traceback (most recent call last):
...
TypeError: f() takes no arguments (2 given)

There is a comment in the patch about this case: the message given by Python is 
also incorrect, because it says that 2 positional arguments are given, but 
there was only 1 positional argument (the other was a keyword argument).  The 
patch currently handles this case by producing the same (incorrect) message as 
Python.

--
keywords: +patch
Added file: http://bugs.python.org/file20805/issue11256.diff

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



[issue11254] distutils doesn't byte-compile .py files to __pycache__ during installation

2011-02-20 Thread Antoine Pitrou

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


--
priority: normal - critical

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread yeswanth

Changes by yeswanth swamiyeswa...@yahoo.com:


Removed file: http://bugs.python.org/file20804/diff

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread yeswanth

yeswanth swamiyeswa...@yahoo.com added the comment:

Sorry for the typo. I ran the code though and it worked fine. I guess might 
have patched a wrong file :( . Made the changes as you asked. Will try for the 
unit tests :)

--
Added file: http://bugs.python.org/file20806/diff

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread yeswanth

Changes by yeswanth swamiyeswa...@yahoo.com:


Removed file: http://bugs.python.org/file20806/diff

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



[issue11060] distutils2 sdist does not complain about version that is not PEP 386 compliant

2011-02-20 Thread yeswanth

Changes by yeswanth swamiyeswa...@yahoo.com:


Added file: http://bugs.python.org/file20807/diff

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



[issue11257] asyncore stores unnecessary object references

2011-02-20 Thread Марк Коренберг

New submission from Марк Коренберг socketp...@gmail.com:

asyncore.py:
---
def add_channel(self, map=None):
#self.log_info('adding channel %s' % self)
if map is None:
map = self._map
map[self._fileno] = self
-

As we see, it add itself to a map, creating unnecessary refences to 'self'.

Such code should be rewritten via weakref. Now it's unknown when object will 
garbage collected. For example, if someone forget to call close(), object will 
stuck, eating file descriptor and memory... 

When using weakref, we may guarantee (via callback fcuntion), that we call 
close() when last reference to object has been lost. Also, such behaviour 
guarantee, that object will be garbage collected when last user's reference has 
gone.

To approve my thoughts, see code:
--
class MyServer(asyncore.dispatcher):
def __init__(self, listenaddr):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.set_reuse_addr()
self.bind(listenaddr)
self.listen(5)
def handle_accept(self):
while 1:
r=self.accept()
if r is None:
break
my_conn_handler(r[0])

As we see, we create a new instance via my_conn_handler(), and we do not store 
reference to it, but object will not be garbage collected. It's unexpected 
behaviour.

--
components: Library (Lib)
messages: 128909
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asyncore stores unnecessary object references
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Jonas H.

New submission from Jonas H. jo...@lophus.org:

(This applies to all versions of Python I investigated, although the attached 
patch is for Python 2.7)

I wondered why `import uuid` took so long, so I did some profiling.

It turns out that `find_library` wastes at lot of time because of this crazy 
regular expression in `_findSoname_ldconfig`.

A quick look at the ldconfig source (namely, the print_cache routine which is 
invoked when you call `ldconfig -p`, 
http://sourceware.org/git/?p=glibc.git;a=blob;f=elf/cache.c#l127) confirmed my 
suspicion that the ldconfig's output could easily be parsed without such a 
regex monster.

I attached two patches that fix this problem. Choose one! ;-)

The ctypes tests pass with my fixes, and here comes some benchmarking:

$ cat benchmark_ctypes.py 
from ctypes.util import find_library
for i in xrange(10):
  for lib in ['mm', 'c', 'bz2', 'uuid']:
find_library(lib)

# Current implementation
$ time python benchmark_ctypes.py 
real0m11.813s
...
$ time python -c 'import uuid'
real0m0.625s
...

# With my patch applied
$ cp /tmp/ctypesutil.py ctypes/util.py
$ time python benchmark_ctypes.py 
real0m1.785s
...
$ time python -c 'import uuid'
real0m0.182s
...

--
assignee: theller
components: ctypes
files: faster-find-library1.diff
keywords: patch
messages: 128910
nosy: jonash, theller
priority: normal
severity: normal
status: open
title: ctypes: Speed up find_library() on Linux by 500%
type: performance
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20808/faster-find-library1.diff

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Jonas H.

Changes by Jonas H. jo...@lophus.org:


Added file: http://bugs.python.org/file20809/faster-find-library2.diff

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Jonas H.

Jonas H. jo...@lophus.org added the comment:

(might also be related to http://bugs.python.org/issue11063)

--

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Antoine Pitrou

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


--
nosy: +pitrou
stage:  - patch review
versions:  -Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Antoine Pitrou

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

Here is the first patch adapted for py3k.

--
Added file: http://bugs.python.org/file20810/faster-find-library1-py3k.diff

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



[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-02-20 Thread Antoine Pitrou

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

Actually, re.escape is probably still needed around name.

--

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



[issue11259] asynchat

2011-02-20 Thread Марк Коренберг

New submission from Марк Коренберг socketp...@gmail.com:

asynchat does not check if terminator is negative integer. so constructions 
like self.ac_in_buffer[:n] will lead to misbehaviour.

When that integer goes from net, attack can be crafted. For example, on 
Content-Length field.

--
components: Library (Lib)
messages: 128914
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asynchat
type: security

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



[issue11259] asynchat does not check if terminator is negative integer

2011-02-20 Thread Марк Коренберг

Changes by Марк Коренберг socketp...@gmail.com:


--
title: asynchat - asynchat does not check if terminator is negative integer

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



[issue11127] sockets should not be pickleable

2011-02-20 Thread Antoine Pitrou

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

You also need to a test to Lib/test/test_socket.py.

--

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



[issue11133] inspect.getattr_static code execution

2011-02-20 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Attached is a patch that fixes the issue: The dict methods are now used 
directly and before every access to an instance's __dict__ attribute, it is 
checked that that attribute is really the instance's attribute and not a class 
attribute of the instance's type.

--
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file20811/inspect_issue_11133.patch

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



[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-20 Thread Xavier Morel

New submission from Xavier Morel xavier.mo...@masklinn.net:

argparse has been merged to the standard library in 3.2, and (tell me if I'm 
wrong) would therefore be the best-practices way to parse command-line 
arguments.

Numerous stdlib modules can be used as scripts, but they tend to have ad-hoc 
documentation (if they are at all documented) and arguments parsing (using any 
of the 4 available methods in Python: straight from sys.argv, getopt, optparse 
and argparse).

I picked smtpd as a first shot since it does something useful (SMTP proxy) and 
has a pretty good (if ad-hoc) command-line documentation.

smtpd is currently using getopt for its options parsing and the argument 
parsing is very cleanly factored: the port only had to replace the 
implementation of the `parseargs` function (and add and remove some helpers).

* The port keeps the existing arguments semantics (including the mandatory 
host:port syntax for the local and remote specs if overridden)

* The port tries to maintain the old error messages, but due to the way 
argparse works (or the way I used it for the specs) the parity is not perfect 
when providing incorrect specs

* The CLI help uses argparse's formatting, and the documentation for the local 
and remote specs was set on these arguments rather than as an epilog. The 
version string was also removed from the help screen

* Because they are set by argparse's arguments validation, the status codes on 
incorrect arguments are slightly different:
  - running smtpd.py as a regular user without the `--nosetuid` flag still 
exits with status 1
  - providing incorrect spec formats (missing or non-int port) or providing too 
many positional arguments (3 or more) now exits with status 2 (formerly 1)

--
assignee: docs@python
components: Documentation, Library (Lib)
files: smtpd-to-argparse.diff
keywords: patch
messages: 128917
nosy: barry, docs@python, xmorel
priority: normal
severity: normal
status: open
title: smtpd-as-a-script feature should be documented and should use argparse
versions: Python 3.3
Added file: http://bugs.python.org/file20812/smtpd-to-argparse.diff

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



[issue11260] smtpd-as-a-script feature should be documented and should use argparse

2011-02-20 Thread Xavier Morel

Xavier Morel xavier.mo...@masklinn.net added the comment:

Second patch: documenting smtpd-as-a-script in the module's rst

--
Added file: http://bugs.python.org/file20813/smtpd-as-script-doc.diff

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



[issue11199] urllib hangs when closing connection

2011-02-20 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

The problem is due to the way urllib closes a FTP data transfer.
The data channel is closed, and a shutdown hook is called that waits for a 
message on the control channel. But in that case, when the data connection is 
closed while the transfer is in progress, the server doesn't send any further 
message on the control channel, and we remain stuck (note that if the data 
channel is closed after the file has been transfered, in that case an end of 
transfer message is sent, which explains why this dones't happen with the sleep 
in between).
The solution is to first wait for a message on the control channel, and then 
close the data channel (which makes sense, a close hook is generally called 
before closing the corresponding connection).
The attached patch just does that.
Note that I'm not sure why we need to wait for a further message on the control 
channel (maybe it's part of an RFC or something...).

--
keywords: +patch
nosy: +neologix
Added file: http://bugs.python.org/file20814/urllib_ftp_close.diff

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



[issue11199] urllib hangs when closing connection

2011-02-20 Thread Antoine Pitrou

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


--
nosy: +giampaolo.rodola, orsenthil
stage:  - patch review
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6

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



[issue11259] asynchat does not check if terminator is negative integer

2011-02-20 Thread Antoine Pitrou

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


--
assignee:  - giampaolo.rodola
nosy: +giampaolo.rodola

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



[issue11257] asyncore stores unnecessary object references

2011-02-20 Thread Antoine Pitrou

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


--
assignee:  - giampaolo.rodola
nosy: +giampaolo.rodola

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



[issue11257] asyncore stores unnecessary object references

2011-02-20 Thread Giampaolo Rodola'

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

 Such code should be rewritten via weakref.

Can you write a patch?

--

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



[issue11199] urllib hangs when closing connection

2011-02-20 Thread Charles-Francois Natali

Changes by Charles-Francois Natali neolo...@free.fr:


Added file: http://bugs.python.org/file20815/urllib_ftp_close_27.diff

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



[issue11259] asynchat does not check if terminator is negative integer

2011-02-20 Thread Giampaolo Rodola'

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

What do you mean by constructions like self.ac_in_buffer[:n] will lead to 
misbehaviour.?
Please try to be more precise (e.g. by providing a piece of code which 
demonstrates the issue).

--

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



[issue11261] urlopen breaks when data parameter is used.

2011-02-20 Thread David Phillips

New submission from David Phillips david.193.phill...@gmail.com:

The following code works on python 3.1.3 but fails on Python 3.2rc2 
(r32rc2:88269, Jan 30 2011, 14:30:28). (I run Mac OS X, version 10.6.6.)

-

import urllib, urllib.request, urllib.error, urllib.parse

form = urllib.parse.urlencode({'field1':'Log in'})
try:
response = urllib.request.urlopen('http://www.google.com/', form)
except urllib.error.HTTPError as exception:
print (exception)

---

When loaded, the following error messages are generated:

---
Traceback (most recent call last):
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/urllib/request.py,
 line 1057, in do_request_
mv = memoryview(data)
TypeError: cannot make memory view because object does not have the buffer 
interface

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 2, in module
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/urllib/request.py,
 line 138, in urlopen
return opener.open(url, data, timeout)
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/urllib/request.py,
 line 364, in open
req = meth(req)
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/urllib/request.py,
 line 1062, in do_request_
data))
ValueError: Content-Length should be specified 
for iterable data of type class 'str' 'field1=Log+in'



--
components: Library (Lib)
messages: 128922
nosy: david193
priority: normal
severity: normal
status: open
title: urlopen breaks when data parameter is used.
type: crash
versions: Python 3.2

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



[issue11261] urlopen breaks when data parameter is used.

2011-02-20 Thread Ned Deily

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


--
nosy: +orsenthil

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



[issue11259] asynchat does not check if terminator is negative integer

2011-02-20 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue11262] re.sub replaces only first 32 matches with re.U flag

2011-02-20 Thread Eugene Morozov

New submission from Eugene Morozov eugene.moro...@gmail.com:

There's a peculiar and difficult to find bug in the re.sub method. Try 
following example:
 text = 'X'*4096
 nt = re.sub(uXX, u., text, re.U)
 nt
u'XXX' (only 32 dots, the rest of the string is not 
changed).

If I first compile regexp, and then perform compiled_regexp.sub, everything 
seems to work correctly.

--
components: Regular Expressions
messages: 128923
nosy: Eugene.Morozov
priority: normal
severity: normal
status: open
title: re.sub replaces only first 32 matches with re.U flag
type: security
versions: Python 2.6

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



[issue9995] setup.py register sdist upload requires pass to be saved

2011-02-20 Thread Martin v . Löwis

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

Instead of using http over TCP and basic auth to upload stuff to PyPI, you can 
also use SSH. In this case, no password is needed at all.

--
nosy: +loewis

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



[issue11262] re.sub replaces only first 32 matches with re.U flag

2011-02-20 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

If you read docs carefully, you notice that re.sub doesn't accept flags 
argument. Its 4th argument is count, re.U numerical value is 32.

Closing as invalid. There are some duplicates too, I'm sure.

--
nosy: +SilentGhost
resolution:  - invalid
status: open - closed

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



[issue11263] Wrong link to source code of ftplib

2011-02-20 Thread Reiner Gerecke

New submission from Reiner Gerecke mr.squ...@gmail.com:

The link to the source code of the ftp module at the top of the documentation 
(http://docs.python.org/release/3.2/library/ftplib.html) points to a 
non-existant page.

  **Source code:** :source:`Lib/ftp.py`

It is referencing ftp.py, but needs to be ftplib.py.

--
assignee: docs@python
components: Documentation
messages: 128926
nosy: Reiner.Gerecke, docs@python
priority: normal
severity: normal
status: open
title: Wrong link to source code of ftplib
versions: Python 3.2, Python 3.3

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



[issue11263] Wrong link to source code of ftplib

2011-02-20 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

here is the patch

--
keywords: +patch
nosy: +SilentGhost
stage:  - patch review
Added file: http://bugs.python.org/file20816/ftplib.rst.diff

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



[issue11200] Addition of abiflags breaks distutils

2011-02-20 Thread Toshio Kuratomi

Toshio Kuratomi a.bad...@gmail.com added the comment:

Ha!  Your reply jogged my memory.  MvL mentioned exactly the potential for this 
backwards incompatibility here: 
http://mail.python.org/pipermail/python-dev/2010-December/106351.html when 
talking about whether other API changes could go into distutils to support 
accepted PEPs.

tarek, eric, since python-3.2 is now out, I assume that you're going to want to 
port distribute rather than back the changes out of distutils.  Do you want a 
bug report or is this high enough priority that you're already working on it?

--
status: pending - open

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



[issue11226] subprocesses experience mysterious delay in receiving stdin EOF

2011-02-20 Thread Yang Zhang

Yang Zhang yang.pythonb...@mailnull.com added the comment:

After way too much time, I figured it out, after a quote from this post jumped 
out at me:

  See the I/O on Pipes and FIFOs section of pipe(7) (man 7 pipe)

  If all file descriptors referring to the write end of a pipe have
  been closed, then an attempt to read(2) from the pipe will see end-of-
  file (read(2) will return 0).

I should've known this, but it never occurred to me - had nothing to do with 
Python in particular. What was happening was: the subprocesses were getting 
forked with open (writer) file descriptors to each others' pipes. As long as 
there are open writer file descriptors to a pipe, readers won't see EOF.

E.g.:

  p1=Popen(..., stdin=PIPE, ...)
# creates a pipe the parent process can write to
  p2=Popen(...)
# inherits the writer FD - as long as p2 exists, p1 won't see EOF

Turns out there's a close_fds parameter to Popen, so the solution is to pass 
close_fds=True. All simple and obvious in hindsight, but still managed to cost 
at least a couple eyeballs good chunks of time.

--
resolution:  - invalid
status: open - closed

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



[issue11261] urlopen breaks when data parameter is used.

2011-02-20 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Sun, Feb 20, 2011 at 10:07:31PM +, David Phillips wrote:

 The following code works on python 3.1.3 but fails on Python 3.2rc2
 (r32rc2:88269, Jan 30 2011, 14:30:28). (I run Mac OS X, version
 10.6.6.)

Is that a real world code? (As in used in production)?  Because,
things have been a bit tightened in 3.2 and it expects data to be
bytes and throws an exception if it is not bytes.

urlencode will output str and you have explicitly encode it to bytes
(Using the value Accept-Encoding response header) before you send the
data to urlopen. The updated docs reflect this change.

--

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



[issue11224] 3.2: tarfile.getmembers causes 100% cpu usage on Windows

2011-02-20 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

Lars, the attached patch fixes the issue. I'll add this to ActivePython 3.2. 
Thanks.

--

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



[issue11252] Handling statement OR assignment continuation '\' on Win32 platform

2011-02-20 Thread Suresh Kalkunte

Suresh Kalkunte sskalku...@gmail.com added the comment:

If the defect was with the script, the failure to bypass the '\' notation would 
have to be true on Redhat Linux. Since build.conf with '\' notation gets parsed 
without errors on Redhat Linux, I am under the impression the parsing performed 
by Python on Win32 recognizes '\' as a legitimate file token resulting in the 
script to fail.

In summary, I view semantics of '\' being different in Win32 vs. Linux as an 
inconsistency and hence thought it to be a possible defect in Python. However, 
if Python scripts do not guarantee platform independence, i.e, one's scripts 
need to be cognizant of platform idiosyncrasy, then, I believe it is not a bug 
in Python.

--
status: pending - open

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



[issue7330] PyUnicode_FromFormat segfault

2011-02-20 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

   With your patch, %.200s truncates the input string to 200 *characters*, 
   but I think that it should truncate to 200 *bytes*, as printf does.
  
  Sorry, I don't understand. The result of PyUnicode_FromFormatV() is a 
  unicode object. Then how to truncate to 200 *bytes*?

 You can truncate the input char* on the call to PyUnicode_DecodeUTF8:
pass a size smaller than strlen(s).


Now I wonder how should we treat precision formatters of '%s'. First of all, 
the PyUnicode_FromFormat() should behave like C printf(). In C printf(), the 
precision formatter of %s is to specify a maximum width of the displayed 
result. If final result is longer than that value, it must be truncated. That 
means the precision is applied on the final result. While python's 
PyUnicode_FromFormat() is to produce unicode strings, so the width and 
precision formatter should be applied on the final unicode string result. And 
the format stage is split into two ones, one is converting each paramater to an 
unicode string, another one is to put the width and precision formatters on 
them. So I wonder if we should apply the precision formatter on the converting 
stage, that is, to PyUnicode_DecodeUTF8(). So in my opinion precision should 
not be applied to input chars, but output unicodes.

I hope I didn't misunderstand something.

So haypo, what's your opinion.

--

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



[issue7330] PyUnicode_FromFormat segfault

2011-02-20 Thread Ray.Allen

Changes by Ray.Allen ysj@gmail.com:


Removed file: http://bugs.python.org/file20739/issue_7330.diff

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



[issue11264] Format Specification Mini-Language missing type 'i'?

2011-02-20 Thread Matt Joiner

New submission from Matt Joiner anacro...@gmail.com:

The Format Specification Mini-Language is missing type 'i', generally the same 
as 'd', and ubiquitous in the libraries from which the specification is 
derived. See the 'd,i' conversion specifier in C: 
http://linux.die.net/man/3/printf, and the Old String Formatting Operations: 
http://docs.python.org/dev/py3k/library/stdtypes.html#old-string-formatting-operations.

 '{:d}'.format(3)
'3'
 '{:i}'.format(3)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: Unknown format code 'i' for object of type 'int'

--
components: Interpreter Core
messages: 128934
nosy: anacrolix
priority: normal
severity: normal
status: open
title: Format Specification Mini-Language missing type 'i'?
versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3

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



[issue11261] urlopen breaks when data parameter is used.

2011-02-20 Thread David Phillips

David Phillips david.193.phill...@gmail.com added the comment:

Converting the type of my variable form from string to bytes did, indeed, 
allow the code to run, but I have to wonder about changing the inputs to 
urlopen like this. 

The 3.1.3 docs call for the data parameter to be string, and I presume that has 
been the case all along. Changing the data parameter from string to bytes may 
be a relatively clean change to make, but this change is going to break a lot 
of existing code. Are you sure you want to do that?

--

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



[issue11257] asyncore stores unnecessary object references

2011-02-20 Thread Марк Коренберг

Марк Коренберг socketp...@gmail.com added the comment:

--- asyncore.py 2010-09-15 22:18:21.0 +0600
+++ asyncore.py 2011-02-21 09:43:15.033839614 +0500
@@ -58,7 +58,7 @@
 try:
 socket_map
 except NameError:
-socket_map = {}
+socket_map = weakref.WeakValueDictionary()
 
 def _strerror(err):
 try:

--

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



[issue11257] asyncore stores unnecessary object references

2011-02-20 Thread Марк Коренберг

Марк Коренберг socketp...@gmail.com added the comment:

sorry, forgot 
import weakref

--

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



[issue11259] asynchat does not check if terminator is negative integer

2011-02-20 Thread Марк Коренберг

Марк Коренберг socketp...@gmail.com added the comment:

asynchat.py: class async_chat: handle_read():
---
elif isinstance(terminator, int) or isinstance(terminator, long):
# numeric terminator
n = terminator
if lb  n:
self.collect_incoming_data (self.ac_in_buffer)
self.ac_in_buffer = ''
self.terminator = self.terminator - lb
else:
self.collect_incoming_data (self.ac_in_buffer[:n])
self.ac_in_buffer = self.ac_in_buffer[n:]
self.terminator = 0
self.found_terminator()
--
suppose, terminator is -10. if lb  n never match. So, else branch executed.
next, it will call self.collect_incoming_data (self.ac_in_buffer[:n]), to 
push data to user. It should push some data from beginning of the buffer, 
intead of this, total buffer except last 10  characters pushed.

Moreover, self.ac_in_buffer = self.ac_in_buffer[n:] shoudl give tail of the 
buffer, ut instead of this, self.ac_in_buffer will contain part of the tail.

Such behaviour may break protocol parsing. In my case, malicious user pass 
'Content-Length: -100' and totally break protocol parsing. Crafted values may 
gain memory leak.

In any way, author of this code does not thought about negative n in 
constructions [:n] or [n:].

--

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



[issue11265] asyncore does not check for EAGAIN errno

2011-02-20 Thread Марк Коренберг

New submission from Марк Коренберг socketp...@gmail.com:

According to man:
--
ERRORS
   EAGAIN or EWOULDBLOCK
The socket is marked nonblocking and no connections are present to be accepted. 
 POSIX.1-2001 allows either error to be returned for this case, and does not 
require these constants to have the same value, so a portable application 
should check for both possibilities.
-

patch included

--
components: Library (Lib)
files: z.patch
keywords: patch
messages: 128939
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asyncore does not check for EAGAIN errno
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20817/z.patch

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



[issue11265] asyncore does not check for EAGAIN errno

2011-02-20 Thread Марк Коренберг

Changes by Марк Коренберг socketp...@gmail.com:


--
type:  - behavior

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



[issue11266] asyncore does not handle EINTR in recv, send, connect, accept,

2011-02-20 Thread Марк Коренберг

New submission from Марк Коренберг socketp...@gmail.com:

in spite of usage of non-blocking IO, syscalls may return EINTR if signal 
arrive during some syscalls.

It is desirable to re-call syscall after receiving EINTR. Trivial loops should 
be implemented around (recv, send, connect, accept)

--
components: Library (Lib)
messages: 128940
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asyncore does not handle EINTR in recv, send, connect, accept,
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue10867] mmap.flush() issue msync() even if mapping was created with prot=mmap.PROT_READ only

2011-02-20 Thread Марк Коренберг

Changes by Марк Коренберг socketp...@gmail.com:


--
resolution:  - duplicate
status: open - closed

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



[issue11263] Wrong link to source code of ftplib

2011-02-20 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue11267] asyncore does not check for POLLERR and POLLHUP if neither readable nor writable

2011-02-20 Thread Марк Коренберг

New submission from Марк Коренберг socketp...@gmail.com:

asyncore.py: poll2() :

if flags:
# Only check for exceptions if object was either readable
# or writable.
flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL
pollster.register(fd, flags)


This is unexpected behaviour. Why descriptor does not get polled if neither 
read nor write selected ? So I can not track dropping of connection if I do not 
want neither read nor write. I think if flags: should be removed.

--
components: IO, Library (Lib)
messages: 128941
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asyncore does not check for POLLERR and POLLHUP if neither readable nor 
writable
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue11268] Mac OS/X installer fails if documentation was previously installed.

2011-02-20 Thread Raymond Hettinger

New submission from Raymond Hettinger rhettin...@users.sourceforge.net:

The 3.2.0 install failed at the documentation step.  I believe this happened 
because I had already install the release candidate beforehand, so it looks 
like on of the steps is not checking for existing files.

--
assignee: ned.deily
components: Installation
messages: 128942
nosy: ned.deily, rhettinger
priority: normal
severity: normal
status: open
title: Mac OS/X installer fails if documentation was previously installed.
type: behavior
versions: Python 3.2, Python 3.3

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



[issue11264] Format Specification Mini-Language missing type 'i'?

2011-02-20 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

IMO the new format language was quite right to do away with redundant 
specifiers, since d and i are completely equivalent.

--
assignee:  - eric.smith
nosy: +eric.smith, georg.brandl

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



[issue11261] urlopen breaks when data parameter is used.

2011-02-20 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Quite a few docs still say string where in fact bytes are expected in Python 
3.x; we're updating these as we go along.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, georg.brandl

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



  1   2   >