Re: Functions help

2014-02-23 Thread Ben Finney
Scott W Dunning swdunn...@cox.net writes:

 I had a question regarding functions.  Is there a way to call a
 function multiple times without recalling it over and over.

You should ask question like this on the “python-tutor” forum. I say
that because this question suggests you have yet to learn about basic
Python features like loops.

My recommendation is that you work your way thoroughly through the
Python tutorial URL:http://docs.python.org/3/tutorial/, doing each
example and experimenting to understand it before progressing.

By the end, you will have a much more comprehensive grasp of the basics
of Python, and have a toolkit of concepts and techniques for addressing
questions like the above.

 Thanks for any help!

Hope that helps! Feel free to ask for help on the Tutor forum
URL:https://mail.python.org/mailman/listinfo/tutor.

-- 
 \   “We spend the first twelve months of our children's lives |
  `\  teaching them to walk and talk and the next twelve years |
_o__)   telling them to sit down and shut up.” —Phyllis Diller |
Ben Finney

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


Re: Wheezy.web - is it been developed?

2014-02-23 Thread Andriy Kornatskyy
Marcio,

The existence of forum site / mailing list does not guarantee your problem will 
be solved. The bitbucket.org doesn’t offer mailing list feature, however you 
can subscribe to any changes happening by following me or concrete project 
there.

The specific issues can be tracked down to commit via issues list.

What relates to mailing list… I have sent request to google groups to allow dot 
in name, however there was no reply yet. I suppose that might take a week to 
hear something back from them.

Anyway, should you have any specific questions please use this mailing list or 
contact me directly. I will be happy to answer in either case.

Thanks.

Andriy Kornatskyy

On Feb 22, 2014, at 11:48 PM, milos2...@gmail.com wrote:

 Let's open a group for Wheezy.web. I'm just wondering which forum site to 
 choose? Any suggestions?
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Wheezy.web - is it been developed?

2014-02-23 Thread Andriy Kornatskyy
Chris,

Your comments are very valuable. I didn’t find any free mailman lists, so it 
appears google groups is the only option.

Thanks.

Andriy Kornatskyy

On Feb 23, 2014, at 12:30 AM, Chris Angelico ros...@gmail.com wrote:

 On Sun, Feb 23, 2014 at 8:48 AM,  milos2...@gmail.com wrote:
 Let's open a group for Wheezy.web. I'm just wondering which forum site to 
 choose? Any suggestions?
 
 If you want to discuss something serious, use a Mailman list.
 Everywhere I go, Mailman lists have high signal-to-noise ratios,
 higher than pretty much everything else I know. (And most of the
 problems on python-list come from the newsgroup side. Google Groups's
 messes, a lot of the spam, it's all from comp.lang.python rather than
 python-list.) Use a web forum like PHPBB or VBulletin if you think you
 need to; a Facebook or G+ group if you want inanity; a weekly
 get-together if you want tea; but a Mailman list if you want solid
 content.
 
 ChrisA
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Functions help

2014-02-23 Thread Steven D'Aprano
On Sat, 22 Feb 2014 22:43:17 -0700, Scott W Dunning wrote:

 Hello,
 
 I had a question regarding functions.  Is there a way to call a function
 multiple times without recalling it over and over.  Meaning is there a
 way I can call a function and then add *5 or something like that?


Sorry, I don't really understand your question. Could you show an example 
of what you are doing?

Do you mean add 5 or *5?  Add *5 doesn't really mean anything to me.



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


Mac vs. Linux for Python Development

2014-02-23 Thread twiz
Hello,

I'm sure this is a common question but I can't seem to find a previous thread 
that addresses it.   If one one exists, please point me to it.

I've been developing with python recreationally for a while on Ubuntu but will 
soon be transitioning to full-time python development.  I have the option of 
using a Mac or Ubuntu environment and I'd like to hear any thoughts on the pros 
and cons of each. Specifically, how's the support for numpy and scipy?  How are 
the IDEs?

Since I generally like working with a Mac, I'd like to hear if there are any 
significant downsides to python dev on OsX.  

Thanks

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


Re: Wheezy.web - is it been developed?

2014-02-23 Thread Chris Angelico
On Sun, Feb 23, 2014 at 7:21 PM, Andriy Kornatskyy
andriy.kornats...@live.com wrote:
 Chris,

 Your comments are very valuable. I didn’t find any free mailman lists, so it 
 appears google groups is the only option.

The easiest way is usually to just host one. I couldn't find any
mailing list about Alice in Wonderland, so I created one:

http://lists.rosuav.com/cgi-bin/mailman/listinfo/alice

Mailman is free and, to drag this vaguely back on topic, is written in Python.

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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Chris Angelico
On Sun, Feb 23, 2014 at 7:43 PM, twiz twiza...@gmail.com wrote:
 I'm sure this is a common question but I can't seem to find a previous thread 
 that addresses it.   If one one exists, please point me to it.

 I've been developing with python recreationally for a while on Ubuntu but 
 will soon be transitioning to full-time python development.  I have the 
 option of using a Mac or Ubuntu environment and I'd like to hear any thoughts 
 on the pros and cons of each. Specifically, how's the support for numpy and 
 scipy?  How are the IDEs?

 Since I generally like working with a Mac, I'd like to hear if there are any 
 significant downsides to python dev on OsX.

There have been some issues with running Python on OSX, so you'd want
to make sure you're running the very latest; for instance, 3.3.4 fixed
some issues with 10.9 Mavericks. Generally, I'd say you'll do
reasonably well on either platform, as long as you're happy with the
editor and related tools; but personally, I love my Linux for
development. I use Debian (Ubuntu is closely related to Debian), with
Xfce, SciTE, and roughly ten thousand terminal windows - that's my
IDE. SciTE is available for a Mac, and there are plenty of other
excellent text editors as well, so you shouldn't have any trouble on
that score.

Your text editor is probably more important to your productivity than
your OS is. Whether you're on Windows, Mac OS, or Linux, or something
more obscure like OS/2, you can run your scripts just fine (OS/2 isn't
an officially supported Python platform, but I have a third-party
build that works fine for me); the important part is getting code from
your brain through your fingers into the computer, and a good editor
can help hugely with that. You'll hear advocates for vi/vim, emacs,
and myriad others, but ultimately, just grab one that looks good and
get to know it :)

Personally, I'd recommend going Linux, for the openness; among other
benefits, it's generally easier to build C stuff from source on Linux
than on pretty much any other platform. But you should be able to use
your preferred Mac just fine, and learning something new is a cost
that's hard to justify.

Just do be sure (and yes, I'm reiterating this) that you're on the
very latest Python you can get. At the moment, that's 3.3.4, but soon
there'll be a 3.4 release.

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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Andriy Kornatskyy
I used to do core python development using debian linux (gnome). All way long 
work just fine. However recently I have had a chance to try MacOS X 10.8 and 
later 10.9. I used macports.org to setup everything I found “missing”.

Vim works fine regardless the platform… quite happy.

Thanks.

Andriy Kornatskyy

On Feb 23, 2014, at 10:43 AM, twiz twiza...@gmail.com wrote:

 Hello,
 
 I'm sure this is a common question but I can't seem to find a previous thread 
 that addresses it.   If one one exists, please point me to it.
 
 I've been developing with python recreationally for a while on Ubuntu but 
 will soon be transitioning to full-time python development.  I have the 
 option of using a Mac or Ubuntu environment and I'd like to hear any thoughts 
 on the pros and cons of each. Specifically, how's the support for numpy and 
 scipy?  How are the IDEs?
 
 Since I generally like working with a Mac, I'd like to hear if there are any 
 significant downsides to python dev on OsX.  
 
 Thanks
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:

 The big difference is that in fixed location languages, it makes
 sense to talk about the address of a *variable*.

The address could be a symbol, too.

The Python statement

   xyz = 3

places a number in the address xyz.

You can read the value from the address xyz with

   locals()[xyz]


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


Re: Google app engine database

2014-02-23 Thread Kev Dwyer
glenn.a.is...@gmail.com wrote:

 Is there a way to make sure that whenever you're making google engine app
 iterations to a database that that info does not get wiped/deleted. 
 Please advise

It's not clear what you mean here; I'll guess that by iterations you mean
changes by database you mean the db or ndb datastore and by info you 
mean data stored in the datastore.  Apologies if this isn't so.

Appengine doesn't document any migration utilities to handle changes in your 
datastore schema, so you need to manage the effects of such changes 
yourself.

To ensure that you do not lose data when changing your model code, avoid 
making destructive changes to your models, i.e.

 - don't delete properties from a model
 - don't rename properties on a model 

If you must make these changes for some reason, you'll need to migrate the 
data somehow.

In my experience with Appengine, data is not actaully lost if you make 
destructive changes to your models, it becomes inaccessible becuae the 
property names it was stored under no longer exist on the model.  In theory 
you could access the data by adding the proprties back to the model or 
(maybe) by loading a different model definition in the remote shell, but 
this is not something that you would want to rely on in a production 
environment.

tl,dr: it's ok to add new properties to you models, but don't remove or 
rename properties.

Hope that helps,

Kev

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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread twiz
Hi Chris, thanks for the reply.  

Yes,  I agree. The main consideration is always the development experience.  
However, I do know that python has had some problems with other OSs 
(notoriously windows) and I want to avoid unnecessary compatibility issues. 

Can you elaborate on some of the problems running python on OSX (or point me to 
a relavant link)?

Thanks

Tommer


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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Chris Angelico
On Sun, Feb 23, 2014 at 9:17 PM, twiz twiza...@gmail.com wrote:
 Can you elaborate on some of the problems running python on OSX (or point me 
 to a relavant link)?

You could poke around on the archives of this list and python-dev, but
the best link I have handy is this, which has only a brief note:

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

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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Chris Angelico
On Sun, Feb 23, 2014 at 8:52 PM, Marko Rauhamaa ma...@pacujo.net wrote:
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:

 The big difference is that in fixed location languages, it makes
 sense to talk about the address of a *variable*.

 The address could be a symbol, too.

 The Python statement

xyz = 3

 places a number in the address xyz.

 You can read the value from the address xyz with

locals()[xyz]

No, you cannot. That's the exact line of thinking that leads to
problems. You are not placing a number at the address xyz, you are
pointing the name xyz to the number 3. That number still exists
elsewhere.

xyz = 3
abc = xyz

Does this copy the 3 from xyz into abc? In C, it would. Those
variables might not exist anywhere, but they must, by definition, be
storing the integer 3. And that integer has been copied. But in
Python, no it does not. It doesn't *copy* anything. And if you fiddle
with the integer 3 in some way, making it different, it'll be
different whether you look at xyz or abc, because they're the same 3.
You can't see that with integers because Python's int is immutable,
but this is where the confusion about mutable vs immutable objects
comes from. Immutable objects behave *sufficiently similarly* to the
C/Pascal model that it's possible to think Python works the same way,
but it doesn't.

The nearest C equivalent to what I'm talking about is pointers.
(CPython objects are basically used with pointers anyway. When you get
back an object reference from a CPython API function, you get a
pointer, optionally with the responsibility for one of its
references.) This is broadly how Python objects work:

/* Python strings are immutable, so the equivalent would be a list. */
/* I'm using a string because C doesn't have a list type. */
char *xyz = strcpy(malloc(20),Hello, world!);
char *abc = xyz;

xyz[1] = 'a';
printf(abc has: %s\n, abc);

That'll show that abc has Hallo, world!, even though it was through
xyz that the change was made. The thing that is that string is the
puddle of bytes on the heap (allocated with the malloc(20) up above).
The name just has a reference to that. Creating another reference to
the same object doesn't change anything.

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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Steven D'Aprano
On Sun, 23 Feb 2014 11:52:05 +0200, Marko Rauhamaa wrote:

 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
 
 The big difference is that in fixed location languages, it makes
 sense to talk about the address of a *variable*.
 
 The address could be a symbol, too.
 
 The Python statement
 
xyz = 3
 
 places a number in the address xyz.

It doesn't matter whether addresses are numeric or symbolic, Python does 
not use that model for variables. Consider this example. There are a few 
steps, so let's go through them. First we prove that so-called address 
abc and xyz are distinct. If they were the same address, then they 
would logically have to contain the same value, but that is not the case:

abc = 23
xyz = 42
assert abc != xyz


This proves that the two addresses are different.

Now we prove that they are the same address:

abc = xyz = []
xyz.append(42)
assert abc == [42]


If they were different, then modifying the object at xyz cannot modify 
the object at abc. So we have a contradiction: addresses abc and xyz 
are both the same address, and different addresses.

There is a way to wiggle out of the contradiction: accept that the 
addresses are distinct, but claim that a single object can be in two 
different locations at once. But if we make that argument, we are 
stretching the metaphor of location quite considerably. Absent time-
travel, objects cannot be in two locations at once. Claiming that they 
can be requires stretching the metaphor of location past breaking point.

Self-confession time: some years ago, I used to make exactly that 
argument. I used to argue that the right way to visualise Python's 
variable model was to consider that objects were stored in variables in 
exactly the way you are suggesting. I didn't describe them as symbolic 
addresses, but otherwise the model was the same. In order to make the 
model work, I argued that objects could be in more than one place at 
once, including *inside* itself:

L = []
L.append(L)

and explicitly argued that this didn't matter. After all, if I can watch 
Doctor Who and accept the concept of his TARDIS materialising inside 
itself, I can understand the idea of a list being inside itself.

That was before I really grasped the difference between the name binding 
and fixed location variable models. While I'm still fond of the concept 
of a box being inside itself, I've come to understand that having to 
stretch the metaphor of location so far simply indicates that the 
metaphor does not work with Python's semantics.

Python's actual behaviour is not a good fit for the variables are 
locations model, not even if you think of locations in the abstract with 
symbolic names rather the numeric addresses.



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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com:
 That's the exact line of thinking that leads to problems. You are not
 placing a number at the address xyz, you are pointing the name xyz
 to the number 3. That number still exists elsewhere.

And?

In C, I can say:

   Number *o = malloc(sizeof *o);
   o-value = 3;

Your statement is valid: the number 3 resides elsewhere than the
variable o.

As for Python, there's nothing in the Python specification that would
prevent you from having, say, 63-bit integers as representing
themselves. IOW, you could physically place such integers as themselves
as the reference and the number would not physically exist elsewhere.

Bottom line, there's no fundamental difference between C and Python
variables.


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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Chris Angelico
On Sun, Feb 23, 2014 at 10:01 PM, Marko Rauhamaa ma...@pacujo.net wrote:
 As for Python, there's nothing in the Python specification that would
 prevent you from having, say, 63-bit integers as representing
 themselves. IOW, you could physically place such integers as themselves
 as the reference and the number would not physically exist elsewhere.

What would id(5) be? Some constant? What would id(id([])) be?

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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Günther Dietrich
twiz twiza...@gmail.com wrote:

I've been developing with python recreationally for a while on Ubuntu but will 
soon be transitioning to full-time python development.  I have the option of 
using a Mac or Ubuntu environment and I'd like to hear any thoughts on the 
pros and cons of each.

I've been working with Windows, Unix/Linux (X) and Max OS since 1989. In 
my experience the GUI of Mac OS is the most user friendly of the the 
three.


Specifically, how's the support for numpy and scipy?  
How are the IDEs?

Since I generally like working with a Mac, I'd like to hear if there are any 
significant downsides to python dev on OsX.  

Eclipse and the PyDev and MercurialEclipse plug-ins are available for 
Windows, Linux and Mac OS.
So, if I had the choice, I would go with the Mac.



Best regards,

Günther
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Ned Deily
In article 
CAPTjJmpHGkJ=n+wwwkpatmbihbn38ywm+_6j7zf5+uva_dx...@mail.gmail.com,
 Chris Angelico ros...@gmail.com wrote:
 On Sun, Feb 23, 2014 at 9:17 PM, twiz twiza...@gmail.com wrote:
  Can you elaborate on some of the problems running python on OSX (or point 
  me to a relavant link)?
 
 You could poke around on the archives of this list and python-dev, but
 the best link I have handy is this, which has only a brief note:
 
 http://www.python.org/download/releases/3.3.4/

The primary issue for 10.9 was an incompatible change in the system 
libedit's readline compatibility API which could cause Pythons built on 
earlier versions of OS X to crash on 10.9 when used interactively.  
Fixed in the current 2.7.6 and 3.3.4 and 3.4.0rc python.org installers.  
Also, if you are going to use IDLE or Tkinter with a python.org Python, 
make sure you have the latest ActiveTcl 8.5.15.0 (actually .1) 
installed, if possible.

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

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

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


WORLD FAMOUS EVOLUTIONIST IN PRISON -- THE THRINAXODON TIMES

2014-02-23 Thread TERMINATOR OF TALK.ORIGINS

==
 BREAKING NEWS
==

RICHARD LEAKEY RECENTLY SENT TO PRISON AFTER BEING CAUGHT SCAMMING 
MILLIONS OF YOUNG PEOPLE INTO THE SCAM OF EVOLUTION.


THRINAXODON, WHO WAS THE LEAD PROSECUTOR SAID THIS TO THE NY TIMES:


 It strikes me silly that one of the world's leading 
evolutionary charlatans finally get put into the place they deserve: PRISON


I've been trying FOR YEARS TO GET THESE BASTARDS (LEAKEY, DAWKINS, ETC.) 
FOR YEARS INTO TOP-MAX PRISONS. ONE HAS FINALLY BEEN SENT, RICHARD 
LEAKEY. May the rest of the charlatans fall? Who knows. But, this is a 
warning to all con artists making a buck out of taking peoples souls 
(e.g. evolutionary bullshit).


LEAKEY WAS SENTENCED TO THREE LIFE SENTENCES AND NO CHANCE OF BAIL. 
THRINAXODON LED A MOB OF 3,000,000 PEOPLE TO THE PRISON, AND WE ALL 
CHEERED WITH HAPPINESS THAT OUR KIDS WILL NO LONGER BE FORCED-FED BULLSHIT!


==
EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN:

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f#

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82#



http://thrinaxodon.wordpress.com/

===

THRINAXODON ONLY HAD THIS TO SAY:

I..I...I...Can't believe it. This completely disproved Darwinian
orthodoxy.

===

THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING
WITH FEAR.

===
THESE ASSHOLES ARE GOING TO DIE:
THOMAS AQUINAS;
ALDOUS HUXLEY;
BOB CASANVOVA;
SkyEyes;
DAVID IAIN GRIEG;
MARK ISAAK;
JOHN HARSHAM;
RICHARD NORMAN;
DR. DOOLITTLE;
CHARLES DARWIN;
MARK HORTON;
ERIK SIMPSON;
HYPATIAB7;
PAUL J. GANS;
JILLERY;
WIKI TRIK;
THRINAXODON;
PETER NYIKOS;
RON OKIMOTO;
JOHN S. WILKINS
===

THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A
HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT
THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD
TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY
FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep
people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS
SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That
is a myth, for people to believe in science. THRINAXODON PLANS TO
BRING DOOM TO SCIENCE, ITSELF.



THRINAXODON IS NOW ON TWITTER
--
Thrinaxodon, the ultimate defender of USENET.
--
https://mail.python.org/mailman/listinfo/python-list


[ANN] pyOpenSSL 0.14

2014-02-23 Thread exarkun

Greetings fellow Pythoneers,

I'm happy to announce that pyOpenSSL 0.14 is now available.

pyOpenSSL is a set of Python bindings for OpenSSL.  It includes some 
low-level cryptography APIs but is primarily focused on providing an API 
for using the TLS protocol from Python.


Check out the PyPI page (https://pypi.python.org/pypi/pyOpenSSL) for 
downloads.


This release of pyOpenSSL adds:

* Support for TLSv1.1 and TLSv1.2

* First-class support for PyPy

* New flags, such as MODE_RELEASE_BUFFERS and OP_NO_COMPRESSION

* Some APIs to access to the SSL session cache

* A variety of bug fixes for error handling cases

Additionally, there are three major changes to the project:

First, the documentation has been converted from LaTeX (CPython's 
previous documentation system) to Sphinx (CPython's new documentation 
system ;).  You can find the new documentation on the PyPI documentation 
site (https://pythonhosted.org/pyOpenSSL/) or 
https://pyopenssl.readthedocs.org/).


Second, pyOpenSSL is no longer implemented in C as a collection of 
extension modules using the Python/C API. Instead, pyOpenSSL is now a 
pure-Python project with a dependency on a new project, cryptography 
(https://github.com/pyca/cryptography), which provides (among other 
things) a cffi-based interface to OpenSSL.


This change means that pyOpenSSL development is now more accessible to 
Python programmers with little or no experience with C. This is also how 
pyOpenSSL is now able to support PyPy.


Finally, the project's code hosting has moved from Launchpad to Github. 
Many branches remain only on Launchpad along with their associated bug 
reports. Over the coming releases I hope that the fixes and features in 
these branches will be ported to Python and incorporated into the 
pyOpenSSL master development branch. Bug tracking has been disabled on 
Launchpad so that the amount of useful information hosted there can 
gradually dwindle to nothing. Please use Github 
(https://github.com/pyca/pyopenssl) for further development and bug 
reporting.


Thanks and enjoy,
Jean-Paul
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can global variable be passed into Python function?

2014-02-23 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com:

 On Sun, Feb 23, 2014 at 10:01 PM, Marko Rauhamaa ma...@pacujo.net wrote:
 As for Python, there's nothing in the Python specification that would
 prevent you from having, say, 63-bit integers as representing
 themselves. IOW, you could physically place such integers as
 themselves as the reference and the number would not physically exist
 elsewhere.

 What would id(5) be? Some constant? What would id(id([])) be?

Any suitable scheme would do. For example, id(n) == n for 63-bit
integers; other objects are dynamically sequence-numbered starting from
a high base (here, 2 ** 64):

id(5)
   5
id([])
   18446744073709551620
id(id([]))
   18446744073709551624

Or id(n) == 2 * n for 63-bit integers; other objects are dynamically
sequence-numbered using only odd integers starting from 1:

id(5)
   10
id([])
   7
id(id([]))
   18

Or id(n) == 2 ** 64 + n for 63-bit integers; other objects get the
RAM address of the internal ḿemory block:

id(5)
   18446744073709551621
id([])
   3074657068
id(id([]))
   18446744076784207372

The possibilities are endless.


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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Chris Angelico
On Mon, Feb 24, 2014 at 2:24 AM, Marko Rauhamaa ma...@pacujo.net wrote:
 Or id(n) == 2 ** 64 + n for 63-bit integers; other objects get the
 RAM address of the internal ḿemory block:

 id(5)
18446744073709551621
 id([])
3074657068
 id(id([]))
18446744076784207372

Assuming you define 63-bit integers either as 0=n2**63 or as
-2**62=n2**62, this could work, but it would depend on never using
memory with addresses with bit 63 set, as id() is (if I recall
correctly) supposed to return an integer in the native range. I'm not
sure you can depend on that sort of pattern of memory usage.

In any case, you'd need some way to pretend that every integer is
really an object, so you'd need to define id(), the 'is' operator, and
everything else that can work with objects, to ensure that they
correctly handle this. It would be a reasonable performance
improvement to use native integers for the small ones (where small
integers might still be fairly large by human standards), but unlike
in languages like Pike (which does something like what you're saying),
Python has a concept of object identity which can't be broken.
(Pike's integers simply _are_, they aren't considered separate
objects. You can't test them for identity. Its strings, also, simply
are, although since Pike strings are guaranteed to be interned, their
values and identities really are the same. To Pike, it's only more
complex types that need to distinguish value from identity.) So this
optimization, which certainly does make sense on the face of it, would
potentially make a mess of things elsewhere.

I'm sure PyPy optimizes small integers somewhat, though.

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


[RELEASED] Python 3.3.5 release candidate 1

2014-02-23 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On behalf of the Python development team, I'm happy to announce
the release of Python 3.3.5, release candidate 1.

Python 3.3.5 includes a fix for a regression in zipimport in 3.3.4
(see http://bugs.python.org/issue20621) and a few other bugs.

Python 3.3 includes a range of improvements of the 3.x series, as well
as easier porting between 2.x and 3.x.  In total, almost 500 API items
are new or improved in Python 3.3.  For a more extensive list of
changes in the 3.3 series, see

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

To download Python 3.3.5 visit:

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


This is a preview release, please report any bugs to

 http://bugs.python.org/

The final release is scheduled one week from now.


Enjoy!

- -- 
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.3's contributors)
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)

iEYEARECAAYFAlMKIPEACgkQN9GcIYhpnLCjXACfQwbC/eD/lhKAZ+XCwTwYPVWj
GMwAnjWkbdk7hqsKoh12EiagpGApEPSA
=2BCx
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can global variable be passed into Python function?

2014-02-23 Thread Terry Reedy

On 2/23/2014 6:01 AM, Marko Rauhamaa wrote:


As for Python, there's nothing in the Python specification that would
prevent you from having, say, 63-bit integers as representing
themselves. IOW, you could physically place such integers as themselves
as the reference and the number would not physically exist elsewhere.


The Python spec requires that ints act as if they are independent 
objects with about 20 attributes and methods. The language spec is based 
on duck typing everything as an object with a class and attributes.


Revised code would have to either turn the reference int into a real 
object on every access (which would be tremendously inefficient), or 
code special case treatment of reference ints into *every* piece code 
that might act on ints (which is all over the interpreter) so as to 
simulate the int object behavior. id(someint) is the least of the problems.


Special-casing ints to store the value in the reference has been 
proposed and rejected. I do not remember how far anyone went in trying 
to code the idea, but I doubt that anyone got as far as getting the test 
suite to pass.



Bottom line, there's no fundamental difference between C and Python
variables.


Hogwash. Int variables are not all variables. And as I explained above, 
even if one stored Python ints much like C ints, one would have to add 
code to hide the fact that one had done so.


--
Terry Jan Reedy

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


Problem with the console on the new python.org site

2014-02-23 Thread Pierre Quentel
The new home page of python.org is very nice, congratulations !

But there is a problem with the online console provided by PythonAnywhere : 
with my azerty keyboard, I can't enter characters such as ) or ] - very 
annoying !

It this going to be fixed soon ?

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


Re: Can tuples be replaced with lists all the time?

2014-02-23 Thread 88888 Dihedral
On Sunday, February 23, 2014 12:06:13 PM UTC+8, Sam wrote:
 My understanding of Python tuples is that they are like immutable lists. If 
 this is the cause, why can't we replace tuples with lists all the time (just 
 don't reassign the lists)? Correct me if I am wrong.
==

OK, lets be serious about high-level
programming lnguages.

Python is a dynamical typed
( name binding mechnism implicitly),
imperative language with the built in auto GC and the heap plus stack 
managements in the bundled scriptor.

A tuple is treated immutable and
a list is mutable in Python.

I suggest one can read
the introductions about Erlang 
which is a non-imperative high 
level language in the 5 to 6 th gen
programming languages in back-end 
server applictions for the robustness
and maintainence costs.

Neverthless, Python is regarded as a programming firendly language 
when comparing with other high level 
languages. 


 






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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com:

 id() is (if I recall correctly) supposed to return an integer in the
 native range

That restriction seems beyond the scope of the language definition.
Still, it can be trivially provided for.

 In any case, you'd need some way to pretend that every integer is
 really an object, so you'd need to define id(), the 'is' operator, and
 everything else that can work with objects, to ensure that they
 correctly handle this.

Trivial, I should say.

 It would be a reasonable performance improvement to use native
 integers for the small ones

Maybe. Point is, whether it's done this way or that is irrelevant from
the point of view of functional correctness. Whether an integer is an
object or not has absolutely nothing to do with the implementation of
the interpreter.

And thus, Python variables are barely distinguishable from C variables.


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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Marko Rauhamaa
Terry Reedy tjre...@udel.edu:

 Special-casing ints to store the value in the reference has been
 proposed and rejected. I do not remember how far anyone went in trying
 to code the idea, but I doubt that anyone got as far as getting the
 test suite to pass.

FWIW, elisp essentially does that. Anyway, we are discussing this to
make it clear that the language definition is abstract. All compliant
implementations are equally correct. It doesn't make any difference
whatsoever for a Python programmer how this or that object type has been
implemented under the hood.

 Hogwash. Int variables are not all variables. And as I explained
 above, even if one stored Python ints much like C ints, one would have
 to add code to hide the fact that one had done so.

URL: http://www.brainyquote.com/quotes/quotes/s/salvadorda103580.html

   The only difference between me and a madman is that I'm not mad.


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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Mark Lawrence

On 23/02/2014 21:04, Marko Rauhamaa wrote:


And thus, Python variables are barely distinguishable from C variables.



To repeat what Terry Reedy said earlier, hogwash.  Looks as if I've 
another member of my dream team, who can proudly sit alongside our self 
appointed resident unicode expert.


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


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Looking for someone who can build a 64-bit version of SpamBayes installer for Windows

2014-02-23 Thread Skip Montanaro
SpamBayes development has been dormant for several years, however it
still has a reasonably good following among the Outlook crowd. (I
guess Microsoft has still not provided good spam filtering tools for
Outlook?) Anyway, though all of SpamBayes is written in pure Python,
there is still a small amount of glue code (Microsoft Visual
C++-generated dialogs, I think) which is written in C++. As more and
more Windows users have moved to 64-bit versions of Windows and
Outlook, we've had more and more reports of failures.

I think all that's necessary (speaking as someone who knows nothing
about Windows) is for someone to build a 64-bit version of the
SpamBayes installer for Windows. I don't know how hard that would be,
but I presume that for someone with some experience in this area it
probably wouldn't be difficult. The current SpamBayes code base should
run with Python 2.7.

Anybody available to help?

Thanks,

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


Re: Can global variable be passed into Python function?

2014-02-23 Thread Steven D'Aprano
On Sun, 23 Feb 2014 23:10:36 +0200, Marko Rauhamaa wrote:

 Terry Reedy tjre...@udel.edu:
 
 Special-casing ints to store the value in the reference has been
 proposed and rejected. I do not remember how far anyone went in trying
 to code the idea, but I doubt that anyone got as far as getting the
 test suite to pass.
 
 FWIW, elisp essentially does that. Anyway, we are discussing this to
 make it clear that the language definition is abstract. 

No. The language definition is concrete: it describes a concrete 
interface. You are confusing the interface with the implementation: the 
language definition is only abstract with regard to the implementation, 
which is free to vary, so long as the interface remains the same.

Regardless of the implementation, Python code must behave in certain 
ways, and the reference implementation CPython defines the semantics of 
variable as name binding, not fixed locations. Can this by implemented 
using fixed locations? Of course it can, and is: the proof is that 
CPython's name binding variables are implemented in C, which uses fixed 
location variables.


 All compliant
 implementations are equally correct. It doesn't make any difference
 whatsoever for a Python programmer how this or that object type has been
 implemented under the hood.

Performance can matter :-)

But you are correct, as far as it goes. Where you are going wrong is by 
confusing the semantics of Python code with the underlying implementation 
of the Python virtual machine.


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


Re: Functions help

2014-02-23 Thread alex23

On 23/02/2014 3:43 PM, Scott W Dunning wrote:

I had a question regarding functions.  Is there a way to call a function 
multiple times without recalling it over and over.  Meaning is there a way I 
can call a function and then add *5 or something like that?


The same way you repeat anything in Python: with a loop construct.

for _ in range(5):
func()
--
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread Rhodri James
On Sun, 23 Feb 2014 05:43:17 -, Scott W Dunning swdunn...@cox.net  
wrote:


I had a question regarding functions.  Is there a way to call a function  
multiple times without recalling it over and over.  Meaning is there a  
way I can call a function and then add *5 or something like that?


The usual way to call a function several times is to use a loop, like this:

  for i in range(5):
  my_function()

The function range returns the sequence of numbers 1, 2, 3, 4 and 5 [*],  
so this has the same effect as if you had typed:


  my_function()
  my_function()
  my_function()
  my_function()
  my_function()

This isn't a great advantage if you just want to call the function two or  
three times, but when you want to call it two or three hundred times it  
matters a lot more!  You can still use the same technique if you want to  
pass different parameters to the function each time you call it:


  for i in range(6):
  print(i*i)

  for day in (Mon, Tue, Wed, Thu, Fri):
  do_stuff_for_day(day)

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


Re: Functions help

2014-02-23 Thread Mark Lawrence

On 24/02/2014 00:55, alex23 wrote:

On 23/02/2014 3:43 PM, Scott W Dunning wrote:

I had a question regarding functions.  Is there a way to call a
function multiple times without recalling it over and over.  Meaning
is there a way I can call a function and then add *5 or something like
that?


The same way you repeat anything in Python: with a loop construct.

 for _ in range(5):
 func()


For the benefit of newbies, besides the obvious indentation error above, 
the underscore basically acts as a dummy variable.  I'll let the 
language lawyers give a very detailed, precise description :)


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


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Remove comma from tuples in python.

2014-02-23 Thread Cameron Simpson
On 21Feb2014 09:32, Roy Smith r...@panix.com wrote:
 In article mailman.7230.1392992078.18130.python-l...@python.org,
  Peter Otten __pete...@web.de wrote:
  [x*x for (x,) in lst]
 
  [paraphrasing...] can be better written as:
 
  [x*x for [x] in items]
 
 I'm torn between, Yes, the second form is distinctly easier to read 
 and, If you think the second form is easier to read, you're admitting 
 you're not really fluent in Python.

+1 QOTW
-- 
Cameron Simpson c...@zip.com.au

It is a tale told by an idiot, full of sound and fury, signifying nothing.
- William Shakespeare
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread Scott W Dunning

On Feb 23, 2014, at 1:44 AM, Steven D'Aprano 
steve+comp.lang.pyt...@pearwood.info wrote:
 
 Sorry, I don't really understand your question. Could you show an example 
 of what you are doing?
 
 Do you mean add 5 or *5?  Add *5 doesn't really mean anything to me.
Sorry I forgot to add the code that I had to give an example of what I was 
talking about.  I’ll put it below, sorry that it’s so long.  A couple of people 
have basically answered my question though.  I take it was I was talking about 
was a loop, which I haven’t learned in school yet but, it seems semi 
self-explanatory.   As you can see I added a loop in there about half way down 
the code (i put it in bold) and it seemed to do what I want.  Now I’m going to 
try and do what Rhodri suggested, a range function?  I’m not sure exactly what 
that’ll do but I think it’ll clean up my code more and make things easier to 
call?  

from turtle import *
from math import sin, sqrt, radians

def star(width):
R = (width)/(2*sin(radians(72)))
A = (2*width)/(3+sqrt(5))
penup()
left(18)
penup()
forward(R)
pendown()
left(162)
forward(A)
right(72)
forward(A)
left(144)
forward(A)
right(72)
forward(A)
left(144)
forward(A)
right(72)
forward(A)
left(144)
forward(A)
right(72)
forward(A)
left(144)
forward(A)
right(72)
forward(A)
penup()
left(162)
forward(R)
left(162)
   
showturtle()

def fillstar(color):
fillcolor(color)
begin_fill()
star(25)
end_fill()

red = red
fillstar(red)

def space(width):
penup()
forward(2*width)
pendown()

space(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

def row(width):
penup()
right(90)
forward(width)
right(90)
forward(11*width)
right(180)
pendown()
row(25)

for i in range (5):
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)

row(25)

fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)
fillstar(red)
space(25)


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


Re: Functions help

2014-02-23 Thread Travis Griggs


 On Feb 23, 2014, at 17:09, Mark Lawrence breamore...@yahoo.co.uk wrote:
 
 For the benefit of newbies, besides the obvious indentation error above, the 
 underscore basically acts as a dummy variable.  I'll let the language lawyers 
 give a very detailed, precise description :)

You mean a dummy name binding, right? If we say variable we might confuse 
those newly arrived pilgrims from other language kingdom.



(If you squint hard, I think there's some facetious tags in there :) )
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread alex23

On 24/02/2014 11:09 AM, Mark Lawrence wrote:

On 24/02/2014 00:55, alex23 wrote:


 for _ in range(5):
 func()


the obvious indentation error above


Stupid cutpaste :(
--
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread Scott W Dunning

On Feb 23, 2014, at 12:59 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 
 You should ask question like this on the “python-tutor” forum.

Thanks Ben, I wasn’t aware of PythonTutor.  

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


Re: Problem with the console on the new python.org site

2014-02-23 Thread Steven D'Aprano
On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote:

 The new home page of python.org is very nice, congratulations !

The best I can say about it is that I'm extremely underwhelmed by the 
design, which is far more busy and colourful than the old design (this 
is not a complement), and not happy that it doesn't work correctly 
without Javascript.

 
 But there is a problem with the online console provided by
 PythonAnywhere : with my azerty keyboard, I can't enter characters such
 as ) or ] - very annoying !
 
 It this going to be fixed soon ?

Not unless somebody raises it as a bug, or uses the feedback form to 
notify the web developers.


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


Re: Functions help

2014-02-23 Thread Scott W Dunning
I understood what you meant because I looked up loops in the python 
documentation since we haven’t got there yet in school. 


On Feb 23, 2014, at 6:39 PM, alex23 wuwe...@gmail.com wrote:

 On 24/02/2014 11:09 AM, Mark Lawrence wrote:
 On 24/02/2014 00:55, alex23 wrote:
 
 for _ in range(5):
 func()
 
 the obvious indentation error above
 
 Stupid cutpaste :(
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Functions help

2014-02-23 Thread Benjamin Kaplan
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
 On 24/02/2014 11:09 AM, Mark Lawrence wrote:

 On 24/02/2014 00:55, alex23 wrote:


  for _ in range(5):
  func()


 the obvious indentation error above


 Stupid cutpaste :(
 --

Your message came through fine for me (viewing as mailing list in
gmail). Mark's client must be dropping spaces.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread Mark Lawrence

On 24/02/2014 02:55, Benjamin Kaplan wrote:

On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:

On 24/02/2014 11:09 AM, Mark Lawrence wrote:


On 24/02/2014 00:55, alex23 wrote:



  for _ in range(5):
  func()



the obvious indentation error above



Stupid cutpaste :(
--


Your message came through fine for me (viewing as mailing list in
gmail). Mark's client must be dropping spaces.



I'm reading gmane.comp.python.general using Thunderbird 24.3.0 on Windows 7.

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


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Mac vs. Linux for Python Development

2014-02-23 Thread Dave Cook
On 2014-02-23, twiz twiza...@gmail.com wrote:

 I've been developing with python recreationally for a while on
 Ubuntu but will soon be transitioning to full-time python development.
 I have the option of using a Mac or Ubuntu environment and I'd like to
 hear any thoughts on the pros and cons of each. Specifically, how's
 the support for numpy and scipy?

I had problems trying to build my own scipy stack on Maverick, but
installing Anaconda's Python distribution solved that.

Overall, Python works very well on OS X, but feels better integrated
to me under Linux.

I'll note that Macs are very popular among the members of pythonsd.  I
think this is particularly true of the Django developers.

Dave Cook

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


Re: Functions help

2014-02-23 Thread MRAB

On 2014-02-24 03:21, Mark Lawrence wrote:

On 24/02/2014 02:55, Benjamin Kaplan wrote:

On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:

On 24/02/2014 11:09 AM, Mark Lawrence wrote:


On 24/02/2014 00:55, alex23 wrote:



  for _ in range(5):
  func()



the obvious indentation error above



Stupid cutpaste :(
--


Your message came through fine for me (viewing as mailing list in
gmail). Mark's client must be dropping spaces.



I'm reading gmane.comp.python.general using Thunderbird 24.3.0 on Windows 7.


It looked OK to me (also using Thunderbird).

However, examining the source, I can see that the first line is
indented with 5 spaces and the second line with 1 tab.

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


[RELEASED] Python 3.4.0 release candidate 2 is now available

2014-02-23 Thread Larry Hastings



On behalf of the Python development team, I'm delighted to announce
the second and final release candidate of Python 3.4.

This is a preview release, and its use is not recommended for
production settings.

Python 3.4 includes a range of improvements of the 3.x series, including
hundreds of small improvements and bug fixes.  Major new features and
changes in the 3.4 release series include:

* PEP 428, a pathlib module providing object-oriented filesystem paths
* PEP 435, a standardized enum module
* PEP 436, a build enhancement that will help generate introspection
   information for builtins
* PEP 442, improved semantics for object finalization
* PEP 443, adding single-dispatch generic functions to the standard library
* PEP 445, a new C API for implementing custom memory allocators
* PEP 446, changing file descriptors to not be inherited by default
   in subprocesses
* PEP 450, a new statistics module
* PEP 451, standardizing module metadata for Python's module import system
* PEP 453, a bundled installer for the *pip* package manager
* PEP 454, a new tracemalloc module for tracing Python memory allocations
* PEP 456, a new hash algorithm for Python strings and binary data
* PEP 3154, a new and improved protocol for pickled objects
* PEP 3156, a new asyncio module, a new framework for asynchronous I/O

Python 3.4 is now in feature freeze, meaning that no new features will be
added.  The final release is projected for mid-March 2014.


The python.org web site has recently been updated to something 
completely new, and I'm having some difficulty updating it.  For now 
I've made Python 3.4.0rc2 available on the legacy web site:


http://legacy.python.org/download/releases/3.4.0/

Once I can update the new web site, Python 3.4.0rc2 will be available here:

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

(I'm not sure what the final URL will be, but you'll see it listed on 
that page.)



Please consider trying Python 3.4.0rc2 with your code and reporting any
new issues you notice to:

 http://bugs.python.org/


Enjoy!

--
Larry Hastings, Release Manager
larry at hastings.org
(on behalf of the entire python-dev team and 3.4's contributors)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-23 Thread rurpy
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
 On 24/02/2014 02:55, Benjamin Kaplan wrote:
 On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
 On 24/02/2014 11:09 AM, Mark Lawrence wrote:
 On 24/02/2014 00:55, alex23 wrote:
   for _ in range(5):
   func()
 the obvious indentation error above
 
 Stupid cutpaste :(

 Your message came through fine for me (viewing as mailing list in
 gmail). Mark's client must be dropping spaces.
 
 I'm reading gmane.comp.python.general using Thunderbird 24.3.0 on Windows 7.

The original message was properly indented on Google Groups.
Perhaps you should switch to GG or some non-broken client that
doesn't mangle whitespace.

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


[issue20741] Documentation archives should be available also in tar.xz format

2014-02-23 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis:

Source archives (e.g. in [1]) are available in tgz and tar.xz formats, but 
documentation archives (e.g. in [2]) are available only in tar.bz2 and zip 
formats.
I suggest that documentation archives be available also in tar.xz format.

[1] http://www.python.org/ftp/python/3.3.4/
[2] http://www.python.org/ftp/python/doc/3.3.4/

--
keywords: easy
messages: 211985
nosy: Arfrever, georg.brandl
priority: normal
severity: normal
status: open
title: Documentation archives should be available also in tar.xz format
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue20712] Make inspect agnostic about whether functions are implemented in Python or C

2014-02-23 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/issue20712
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20571] test_codecs currently failing on several Windows buildbots

2014-02-23 Thread STINNER Victor

STINNER Victor added the comment:

Ah yes, sorry. I forgot that the utf-7 change was also applied to 3.3.

--

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



[issue20712] Make inspect agnostic about whether functions are implemented in Python or C

2014-02-23 Thread Nick Coghlan

Nick Coghlan added the comment:

The problem is that ismethod() is not a particularly well-defined concept, 
except insofar as it means behaves the same way as the callable returned when 
a Python function is retrieved through a class instance.

isboundmethod() could be well-defined, especially if it was introduced in 
parallel with a types.BoundMethod ABC that standardised the __func__ property.

--

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



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-02-23 Thread akira

akira added the comment:

The point of the locale issue is that notBefore, notAfter strings do not 
change if your locale changes. You don't need a new regex for each locale.

I've attached ssl_cert_time_seconds.py file that contains example 
cert_time_to_seconds(cert_time) implementation that fixes both the timezone and 
the locale issues.

--
Added file: http://bugs.python.org/file34197/ssl_cert_time_seconds.py

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



[issue20742] 2to3 zip fixer doesn't fix for loops.

2014-02-23 Thread David Jones

New submission from David Jones:

Consider the following code:

for z in zip([1]):pass

2to3 does not convert the zip in this code to list(zip(...)); it does not 
change this code at all.

That can be an (obscure) bug because the zip in Python 2 has different 
semantics from the zip in Python 3.

The output of this program

from __future__ import print_function
S = []

def l(c):
  for i in [0,1]:
S.append(c)
yield i
  S.append(c.upper())

la = l('a')
lb = l('b')

for a,b in zip(la, lb):
  S.append(#)
print(''.join(S))

is different in Python 2 and Python 3 (when converted with 2to3, which doesn't 
change the program).

In Python 2 the output is:

ababA##

In Python 3 the output is:

ab#ab#A


Obviously this example is somewhat contrived, but I have a non-contrived 
example involving decoding PNG images (if anyone is interested).

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 211989
nosy: drj
priority: normal
severity: normal
status: open
title: 2to3 zip fixer doesn't fix for loops.
type: behavior
versions: Python 3.2

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



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-02-23 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Terry, I had the same problem with that failing 
test_httpservers.test_invalid_request using the latest build on Windows. 
After debugging, I found out that the problem was caused by my antivirus 
solution. Its http scanning engine caught malformed http requests, like the one 
in the test (gEt / hTTP/1.0\r\nhost: 127.0.0.1:50340\r\nAccept-Encoding: 
identity\r\n\r\n; for instance) and it modified the first line by uppercasing 
it, thus making the perfect condition for a failing test.

--
nosy: +Claudiu.Popa

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



[issue20742] 2to3 zip fixer doesn't fix for loops.

2014-02-23 Thread Peter Otten

Peter Otten added the comment:

Hm, I would expect that in 99 times out of 100 the extra list(...) would be 
removed in a manual step following the automated conversion.

I'd really like to see the non-contrived example with a justified use of this 
evil side effect ;)

--
nosy: +peter.otten

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



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Akira, do you want to write a proper patch with tests? If you are interested, 
you can take a look at http://docs.python.org/devguide/

You'll also have to sign a contributor's agreement at 
http://www.python.org/psf/contrib/contrib-form/

--

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



[issue20069] Add unit test for os.chown

2014-02-23 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch that is considerate towards Windows for Python 3.4. I'll fix 
the patch for Python 2.7 later.

--
Added file: http://bugs.python.org/file34198/add_unit_test_os_chown_v2.patch

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



[issue20069] Add unit test for os.chown

2014-02-23 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: http://bugs.python.org/file33266/add_unit_test_os_chown.patch

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



[issue20199] status of module_for_loader and utils._module_to_load

2014-02-23 Thread R. David Murray

R. David Murray added the comment:

What you might want to do instead is wait until just before final (or until I 
say I am done, if we get that lucky) and copy the whole 3.4 whatsnew file over. 
 I'm up through Alpha 1 in the NEWS file at this point, and I do intend to 
continue to to work on it.

--

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



[issue20636] Better repr for tkinter widgets

2014-02-23 Thread Ezio Melotti

Ezio Melotti added the comment:

 tkinter.Button object .3070343372.3066782348

Not knowing the internal of tkinter, this seems somewhat confusing.
Is that an anonymous name/id?

 tkinter.Button object .panel.b1

This already looks more useful.  How is that determined?  Why the first 
object is missing (i.e. .panel seems to be an attribute of a missing object)?


Regarding the patch, are you sure that .__class__.__module__ is always 
available?  I seem to remember that it might be missing in some cases, e.g. 
modules written in C (but I might be confusing it with something else like 
__file__).

--
nosy: +ezio.melotti

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



[issue20643] Strange dot in documentation (after generator.close)

2014-02-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Serhiy, you seem to have added that line (in #19190).  Was it a mistake or is 
it supposed to do something?

--
nosy: +ezio.melotti, serhiy.storchaka
stage:  - needs patch
type:  - enhancement

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



[issue20677] Minor typo in enum docs

2014-02-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 569589d3abb5 by Ezio Melotti in branch 'default':
#20677: fix typo in enum docs.  Patch by Saimadhav Heblikar.
http://hg.python.org/cpython/rev/569589d3abb5

--
nosy: +python-dev

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



[issue20677] Minor typo in enum docs

2014-02-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the report and the patch!

--
assignee: docs@python - ezio.melotti
nosy: +ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-02-23 Thread Jeff Allen

Jeff Allen added the comment:

Thanks for adding to the evidence here. As discussed above, disabling the 
security product (which is Bitdefender) on my PC didn't stop the problem for 
me, and I'm reluctant to uninstall. I narrowed it to the Windows Base Filtering 
Engine, but perhaps the behaviour of the BFE is extended by installing BD.

If so, you could say this is not a Python problem, it is caused by BD 
normalising the HTTP. Or BD could say it is caused by expecting a defined 
result from abnormal HTTP.

I took the view it were best fixed at our end. I found I could test the same 
thing (AFAICT), but modify the tests so they don't get interfered with.
http://bugs.jython.org/issue2109
http://hg.python.org/jython/rev/6441fcfd940b

Would a patch made from this be applicable to CPython?

--

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Artur R. Czechowski

Artur R. Czechowski added the comment:

Proper patch with tests available in remote hg repo attached to this comment.

--
hgrepos: +217

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Artur R. Czechowski

Changes by Artur R. Czechowski artu...@hell.pl:


Removed file: http://bugs.python.org/file34167/minidom.patch

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



[issue20636] Better repr for tkinter widgets

2014-02-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

  tkinter.Button object .3070343372.3066782348
 
 Not knowing the internal of tkinter, this seems somewhat confusing.
 Is that an anonymous name/id?

If the name parameter is not specified, repr(id(self)) is used. Here is a 
button with id() == 3066782348, its parent has id() == 3070343372 and its 
grandparent is root. str() for this button returns full name 
.3070343372.3066782348.

  tkinter.Button object .panel.b1
 
 This already looks more useful.  How is that determined?  Why the first
 object is missing (i.e. .panel seems to be an attribute of a missing
 object)?

Tk widgets are organized in hierarchical structure and names look similar to 
file system names. . is the root, .frame is a frame in the root, 
.frame.b1 is a button in frame .frame.

 Regarding the patch, are you sure that .__class__.__module__ is always
 available?  I seem to remember that it might be missing in some cases, e.g.
 modules written in C (but I might be confusing it with something else like
 __file__).

Yes, for example __module__ is absent in _tkinter.TkappType. But I think that 
every Python implemented class has __module__.

--

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



[issue20637] Support key-sharing dictionaries in subclasses

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks. I've committed a patch after augmenting the tests a bit, so it'll be in 
3.4.1 as well as 3.5.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions: +Python 3.4

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



[issue20637] Support key-sharing dictionaries in subclasses

2014-02-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16229573e73e by Antoine Pitrou in branch 'default':
Issue #20637: Key-sharing now also works for instance dictionaries of 
subclasses.  Patch by Peter Ingebretson.
http://hg.python.org/cpython/rev/16229573e73e

--
nosy: +python-dev

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



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-02-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Except where specifically indicated otherwise, the Python test suite should be 
the same, and correct, for all implementations. If that change is correct for 
Jython, it should be correct for CPython.

David, Ezio, or Senthil: does the change in the Jython patch look correct to 
any of you, enough that we should apply it?

--
components: +Tests
nosy: +ezio.melotti, orsenthil, r.david.murray
stage:  - patch review
type:  - behavior

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



[issue20643] Strange dot in documentation (after generator.close)

2014-02-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It was supposed to reset current class. Perhaps correct way is to remove this 
directive (and other class directive above) at all.

--
keywords: +patch
nosy: +georg.brandl
stage: needs patch - patch review
type: enhancement - behavior
versions: +Python 2.7, Python 3.3
Added file: http://bugs.python.org/file34199/docs_generator_class.patch

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



[issue6815] UnicodeDecodeError in os.path.expandvars

2014-02-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Witnessed on 2.7, 3.3, 3.4:

$ ./python -m test -uall -R3:3 test_tcl 
[1/1] test_tcl
beginning 6 repetitions
123456
..
test_tcl leaked [12, 12, 12] references, sum=36
test_tcl leaked [5, 5, 5] memory blocks, sum=15

--
components: Library (Lib), Tkinter
messages: 212006
nosy: pitrou, serhiy.storchaka
priority: high
severity: normal
stage: needs patch
status: open
title: test_tcl memory leak
type: resource usage
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue20744] shutil should not use distutils

2014-02-23 Thread Matthias Klose

New submission from Matthias Klose:

shutil imports distutils in _call_external_zip just for the calling of an 
external command.  This should be done using subprocess these days.

--
components: Library (Lib)
messages: 212007
nosy: doko
priority: normal
severity: normal
stage: needs patch
status: open
title: shutil should not use distutils
type: behavior
versions: Python 3.3, Python 3.4

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



[issue20745] test_statistics fails in refleak mode

2014-02-23 Thread Antoine Pitrou

New submission from Antoine Pitrou:

$ ./python -m test -W -R3:3 test_statistics
[1/1] test_statistics
[...]

==
FAIL: assertApproxEqual (test.test_statistics.NumericTestCase)
Doctest: test.test_statistics.NumericTestCase.assertApproxEqual
--
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 2193, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for 
test.test_statistics.NumericTestCase.assertApproxEqual
  File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 153, 
in assertApproxEqual

--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 165, in 
test.test_statistics.NumericTestCase.assertApproxEqual
Failed example:
class MyTest(NumericTestCase):
def test_number(self):
x = 1.0/6
y = sum([x]*6)
self.assertApproxEqual(y, 1.0, tol=1e-15)
def test_sequence(self):
a = [1.001, 1.001e-10, 1.001e10]
b = [1.0, 1e-10, 1e10]
self.assertApproxEqual(a, b, rel=1e-3)
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest 
test.test_statistics.NumericTestCase.assertApproxEqual[0], line 1, in module
class MyTest(NumericTestCase):
NameError: name 'NumericTestCase' is not defined
--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 177, in 
test.test_statistics.NumericTestCase.assertApproxEqual
Failed example:
suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest 
test.test_statistics.NumericTestCase.assertApproxEqual[3], line 1, in module
suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
NameError: name 'MyTest' is not defined
--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 178, in 
test.test_statistics.NumericTestCase.assertApproxEqual
Failed example:
unittest.TextTestRunner(stream=StringIO()).run(suite)
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest 
test.test_statistics.NumericTestCase.assertApproxEqual[4], line 1, in module
unittest.TextTestRunner(stream=StringIO()).run(suite)
NameError: name 'suite' is not defined


==
FAIL: _DoNothing (test.test_statistics)
Doctest: test.test_statistics._DoNothing
--
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 2193, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test.test_statistics._DoNothing
  File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 99, in 
_DoNothing

--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 112, in 
test.test_statistics._DoNothing
Failed example:
approx_equal(12.345, 12.346, tol=1e-3)
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest test.test_statistics._DoNothing[0], line 1, in module
approx_equal(12.345, 12.346, tol=1e-3)
NameError: name 'approx_equal' is not defined
--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 114, in 
test.test_statistics._DoNothing
Failed example:
approx_equal(12.345e6, 12.346e6, tol=1e-3)  # tol is too small.
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest test.test_statistics._DoNothing[1], line 1, in module
approx_equal(12.345e6, 12.346e6, tol=1e-3)  # tol is too small.
NameError: name 'approx_equal' is not defined
--
File /home/antoine/cpython/default/Lib/test/test_statistics.py, line 120, in 
test.test_statistics._DoNothing
Failed example:
approx_equal(12.345, 12.346, 

[issue20746] test_pdb fails in refleak mode

2014-02-23 Thread Antoine Pitrou

New submission from Antoine Pitrou:

$ ./python -m test -W -R3:3 test_pdb
[1/1] test_pdb
[...]

==
FAIL: test_list_commands (test.test_pdb)
Doctest: test.test_pdb.test_list_commands
--
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 2193, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test.test_pdb.test_list_commands
  File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 288, in 
test_list_commands

--
File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 311, in 
test.test_pdb.test_list_commands
Failed example:
with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
'list',  # list first function
'step',  # step into second function
'list',  # list second function
'list',  # continue listing to EOF
'list 1,3',  # list specific lines
'list x',# invalid argument
'next',  # step to import
'next',  # step over import
'step',  # step into do_nothing
'longlist',  # list all lines
'source do_something',  # list all lines of function
'source fooxxx',# something that doesn't exit
'continue',
]):
   test_function()
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest test.test_pdb.test_list_commands[2], line 1, in module
with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
NameError: name 'PdbTestInput' is not defined


==
FAIL: test_next_until_return_at_return_event (test.test_pdb)
Doctest: test.test_pdb.test_next_until_return_at_return_event
--
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 2193, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for 
test.test_pdb.test_next_until_return_at_return_event
  File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 603, in 
test_next_until_return_at_return_event

--
File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 617, in 
test.test_pdb.test_next_until_return_at_return_event
Failed example:
with PdbTestInput(['break test_function_2',
   'continue',
   'return',
   'next',
   'continue',
   'return',
   'until',
   'continue',
   'return',
   'return',
   'continue']):
test_function()
Exception raised:
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 1324, in __run
compileflags, 1), test.globs)
  File doctest test.test_pdb.test_next_until_return_at_return_event[2], 
line 1, in module
with PdbTestInput(['break test_function_2',
NameError: name 'PdbTestInput' is not defined


==
FAIL: test_pdb_basic_commands (test.test_pdb)
Doctest: test.test_pdb.test_pdb_basic_commands
--
Traceback (most recent call last):
  File /home/antoine/cpython/default/Lib/doctest.py, line 2193, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test.test_pdb.test_pdb_basic_commands
  File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 62, in 
test_pdb_basic_commands

--
File /home/antoine/cpython/default/Lib/test/test_pdb.py, line 81, in 
test.test_pdb.test_pdb_basic_commands
Failed example:
with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
'step',   # entering the function call
'args',   # display function args
'list',   # list function source
'bt', # display backtrace
'up', # step up to test_function()
'down',   # step down to test_function_2() again
'next',   # stepping to print(foo)
'next',   # stepping to the for loop
'step',   # stepping into the for loop
'until',  # continuing until out of the for loop
'next',   # executing the print(bar)
'jump 8', # jump over second for loop
   

[issue20744] shutil should not use distutils

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Does it pose an actual problem?

--
nosy: +pitrou

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



[issue20747] Charset.header_encode in email.charset doesn't take a maxlinelen argument and has inconsistent behavior with different encodings

2014-02-23 Thread Rik

New submission from Rik:

If you look at the `header_encode` method in the `Charset` class in 
`email.charset`, you'll see that depending on the `header_encoding` that is set 
on the `Charset` instance, it will either encode it using base64 or 
quoted-printable (QP):

http://hg.python.org/cpython/file/3a1db0d2747e/Lib/email/charset.py#l351

However, QP always uses `maxlinelen=None` and base64 doesn't. This results in 
the following behaviour:

- If you use base64 encoding and your header size is longer than the default 
`maxlinelen`, it will be split over multiple lines.
- If you use QP encoding with the same header it doesn't get split over 
multiple lines.

You can easily test it with this snippet:

from email.charset import Charset, BASE64, QP

header = (
'tejkstj tlkjes takldjf aseio neaoiflk asnfoieas nflkdan foeias '
'naskln ioeasn kldan flkansoie naslk dnaslk fndaslk fneoisaf '
'neklasn dfklasnf oiasenf lkadsn lkfanldk fas dfknaioe nas'
)

charset = Charset('utf-8')

charset.header_encoding = BASE64
print 'BASE64:'
print charset.header_encode(header)

charset.header_encoding = QP
print 'QP:'
print charset.header_encode(header)

Which will output:

BASE64:
=?utf-8?b?dGVqa3N0aiB0bGtqZXMgdGFrbGRqZiBhc2VpbyBuZWFvaWZsayBhc25mb2llYXMg?=
 
=?utf-8?b?bmZsa2RhbiBmb2VpYXMgbmFza2xuIGlvZWFzbiBrbGRhbiBmbGthbnNvaWUgbmFz?=
 
=?utf-8?b?bGsgZG5hc2xrIGZuZGFzbGsgZm5lb2lzYWYgbmVrbGFzbiBkZmtsYXNuZiBvaWFz?=
 =?utf-8?b?ZW5mIGxrYWRzbiBsa2ZhbmxkayBmYXMgZGZrbmFpb2UgbmFz?=
QP:

=?utf-8?q?tejkstj_tlkjes_takldjf_aseio_neaoiflk_asnfoieas_nflkdan_foeias_naskln_ioeasn_kldan_flkansoie_naslk_dnaslk_fndaslk_fneoisaf_neklasn_dfklasnf_oiasenf_lkadsn_lkfanldk_fas_dfknaioe_nas?=

This is inconsistent behavior.

Aside from that, I think the `header_encode` method should accept an argument 
`maxlinelen` that defaults to an appropriate value (probably 76), but which you 
can overwrite on free will.

This is (I think) also necessary because the `Header` class in `email.header` 
has a `maxlinelen` attribute that is used for the same purpose. Normally this 
works fine, but when you specified a charset for your header, it uses the 
`Charset` class and the `maxlinelen` is lost. This is happening here:

http://hg.python.org/cpython/file/3a1db0d2747e/Lib/email/header.py#l368

You see, the `_encode_chunks` takes the `maxlinelen` argument but doesn't pass 
it on to the `header_encode` method of `charset` (which is a `Charset` 
instance).

As such, you can see this issue in action with the following snippet:

from email.header import Header

maxlinelen = 999

print 'No charset:'
print Header(
u'asdfjk lasjdf sajdfl ajsdfaj sdlkfjas kfladjs flkajsdflk jsadklf 
jadslkfj adslkfj asdlkjf lksadjfkldas jfkldasj fkadsj fladsjf kladsjfk 
asdjfkldasasd kfaj  kfladsj fkadsjf asdf ',
maxlinelen=maxlinelen
).encode()

print 'Charset with special characters:'
print Header(
u'attachment; filename=ajdsklfj klasdjfkl asdjfkl jadsfja sdflkads fad 
fads adsf dasjfkl jadslkfj dlasf asd \u6211\u6211\u6211 jo \u6211\u6211 jo 
\u6211\u6211',
charset='utf-8',
maxlinelen=999
).encode()

Which will output:

No charset:
asdfjk lasjdf sajdfl ajsdfaj sdlkfjas kfladjs flkajsdflk jsadklf jadslkfj 
adslkfj asdlkjf lksadjfkldas jfkldasj fkadsj fladsjf kladsjfk asdjfkldasasd 
kfaj  kfladsj fkadsjf asdf
Charset with special characters:
=?utf-8?b?YXR0YWNobWVudDsgZmlsZW5hbWU9ImFqZHNrbGZqIGtsYXNkamZrbCBhc2RqZmts?=
 
=?utf-8?b?IGphZHNmamEgc2RmbGthZHMgZmFkIGZhZHMgYWRzZiBkYXNqZmtsIGphZHNsa2Zq?=
 =?utf-8?b?IGRsYXNmIGFzZCDmiJHmiJHmiJEgam8g5oiR5oiRIGpvIOaIkeaIkSI=?=

This is currently an issue we're experiencing in Django, see our issue in the 
issue tracker:
https://code.djangoproject.com/ticket/20889#comment:4

--
components: Library (Lib), email
messages: 212011
nosy: barry, r.david.murray, rednaw
priority: normal
severity: normal
status: open
title: Charset.header_encode in email.charset doesn't take a maxlinelen 
argument and has inconsistent behavior with different encodings
type: behavior
versions: Python 2.7

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This actually appeared with 89b738e3d0c9, i.e. it's not a regression but an 
existing leak that was uncovered by a new test.

--

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Actually, this looks mostly like a cleanup issue in the tests. Following patch 
seems to solve it:

diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -376,6 +376,7 @@ class TclTest(unittest.TestCase):
 result = arg
 return arg
 self.interp.createcommand('testfunc', testfunc)
+self.addCleanup(self.interp.tk.deletecommand, 'testfunc')
 def check(value, expected, eq=self.assertEqual):
 r = self.interp.call('testfunc', value)
 self.assertIsInstance(result, str)

--

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Antoine Pitrou

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


--
components: +Tests
priority: high - normal

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



[issue20748] 3.4rc2 MSI uninstallation leaves behind ensurepip _uninstall .pyc

2014-02-23 Thread Martin v . Löwis

New submission from Martin v. Löwis:

The installer currently leaves behind a single pyc file, namely 

Lib\ensurepip\__pycache__\_uninstall.cpython-34.pyc

I believe that the problem is that installer computes the list of files to be 
removed in the script generation phase, finding out what files match 
__pycache__\*.*. The _uninstall .pyc is not there yet. Then, during script 
execution, first pip uninstallation is run, creating the pyc file, then the 
(precomputed) list of files is removed.

In rc1, this was not a problem because PIP removal happened in the UI phase 
(i.e. before script execution); this was changed to support elevated privileges 
in #20641.

The simplest work-around could be to run pip uninstallation with -B. I just 
edited the MSI with orca, and that seems to work fine.

If anybody can suggest how installer could be instructed to remove the .pyc 
regularly through the RemoveFiles action, I'd appreciate any help.

--
messages: 212014
nosy: loewis
priority: release blocker
severity: normal
status: open
title: 3.4rc2 MSI uninstallation leaves behind ensurepip _uninstall .pyc

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


Added file: http://bugs.python.org/file34167/minidom.patch

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Artur: Please provide the follwing information (in this bug report, or in any 
other bug report you create in the future)
1. this is what I did
2. this is what happened
3. this is what should have happened instead
In this case, a Python script that ought to work but currently fails would be 
appreciated.

I fail to see how two CDATA sections in one element are related to support 
for ]] inside CDATA. In your example, there is no ]] inside CDATA, just two 
subsequent CDATA sections.

--
nosy: +loewis

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



[issue1524639] Fix Tkinter Tcl-commands memory-leaks

2014-02-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

There is a little related but more complex issue1524639.

--
assignee:  - pitrou
stage: needs patch - commit review

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 38a06e411698 by Antoine Pitrou in branch '3.3':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/38a06e411698

New changeset 10b1f60a72fa by Antoine Pitrou in branch 'default':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/10b1f60a72fa

--
nosy: +python-dev

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 00393de6919d by Antoine Pitrou in branch '2.7':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/00393de6919d

--

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



[issue20743] test_tcl memory leak

2014-02-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, fixed now.

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

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



[issue6143] IDLE - an extension to clear the shell window

2014-02-23 Thread Tal Einat

Tal Einat added the comment:

Terry, please do give Squeezer a try before making a decision! Squeezer may be 
slightly more complex than ClearWindow in concept and in code, but IMO it is 
simpler and more appropriate for use by a novice user.

I'm attaching a screenshot to give a feeling of what working in the IDLE shell 
with Squeezer looks like. This screenshot was taken on Windows. Note that the 
second squeezed text is the very long Max recursion depth exception 
traceback, which I manually squeezed after it was printed.

Now I'll try to make the case for Squeezer one last time...


Nobody expects a Squeezer Inquisition! Amongst Squeezer's weaponry are such 
diverse elements as:

1. No fear! Squeezer automatically catches overly long outputs for users, so 
they need not fear crashing IDLE or losing their history just by printing 
something long accidentally.

2. No surprise! Squeezer requires no learning and is completely 
self-explanatory. It's an in-line button with a label of the form Squeezed 
text (13412 lines). Hovering over it with the mouse shows tooltip listing the 
various available interactions (expand, copy, preview). Don't want the text to 
be squeezed? Double-click and the button is replaced by the original text!

3. Ruthless efficiency! With Squeezer, IDLE will never slow down to a crawl 
again! (Well, unless you explicitly expand a very long output.)

4. Dashing red uniforms! Okay, not really, but it does look nice.

Also, beware *the comfy chair*! Squeezer conveniently allows one to manually 
squeeze exception tracebacks and other outputs to clean up the shell history. 
This is available via the right-click context menu.


Finally, I'll mention that ClearWindow forces a user to choose: delete your 
entire shell history, or keep it all. Squeezer allows a user to choose which 
parts to hide and which to keep, and nothing is ever lost since squeezed text 
can always be expanded again.

That's it. If this doesn't convince people of the utility of Squeezer, I truly 
believe nothing else will.

--
Added file: http://bugs.python.org/file34200/Squeezer Screenshot.PNG

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



[issue1529353] Squeezer - squeeze large output in the interpreter

2014-02-23 Thread Tal Einat

Tal Einat added the comment:

See msg212020 for a Python-style explanation of the utility of the Squeezer 
extension.

--

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



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-02-23 Thread akira

akira added the comment:

Antoine, I've signed the agreement. I've added ssl_cert_time_toseconds.patch 
with code, tests, and documention updates.

--
keywords: +patch
Added file: http://bugs.python.org/file34201/ssl_cert_time_to_seconds.patch

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



[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express

2014-02-23 Thread ipatrol

ipatrol added the comment:

The latest patch has an indentation error in an if-else clause, but I can't 
figure out what exactly was intended by the author.

--

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Peter Otten

Changes by Peter Otten __pete...@web.de:


--
nosy: +peter.otten

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



[issue20646] 3.4 cherry-pick: 180e4b678003 select and kqueue round the timeout aways from zero

2014-02-23 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I don't see why this cannot wait until 3.4.1.

True, rounding away from zero is desirable in these cases but it seems like 
this should be a non issue most of the time and any distro (ubuntu) that picks 
up 3.4.0 can apply this fix to their own python package if they ever find this 
causing an actual problem.

It was never explained in the original #20320 why anything considers it sane to 
call a selector with a non-zero microscopic timeout in the first place and 
expect well defined behavior. IMNSHO desiring any timeout less than a 
millisecond is asking for trouble from a variety of OS APIs.

--
nosy: +gregory.p.smith

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Artur R. Czechowski

Artur R. Czechowski added the comment:

Martin, the exact information you need are:

1. this is what I did:

#!/usr/bin/env python
import unittest
import xmlrunner

class Foo(unittest.TestCase):
def testFoo(self):
self.assertTrue(False, ']]')

unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

2. this is what happened:
arturcz@szczaw:/tmp$ ./cdata.py 

Running tests...
--
F
==
FAIL [0.000s]: testFoo (__main__.Foo)
--
Traceback (most recent call last):
  File ./cdata.py, line 7, in testFoo
self.assertTrue(False, ']]')
AssertionError: ]]

--
Ran 1 test in 0.001s

FAILED (failures=1)

Generating XML reports...
Traceback (most recent call last):
  File ./cdata.py, line 9, in module
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))
  File /usr/lib/python2.7/unittest/main.py, line 95, in __init__
self.runTests()
  File /usr/lib/python2.7/unittest/main.py, line 232, in runTests
self.result = testRunner.run(self.test)
  File /usr/lib/python2.7/dist-packages/xmlrunner/__init__.py, line 415, in 
run
result.generate_reports(self)
  File /usr/lib/python2.7/dist-packages/xmlrunner/__init__.py, line 312, in 
generate_reports
xml_content = doc.toprettyxml(indent='\t')
  File /usr/lib/python2.7/xml/dom/minidom.py, line 58, in toprettyxml
self.writexml(writer, , indent, newl, encoding)
  File /usr/lib/python2.7/xml/dom/minidom.py, line 1749, in writexml
node.writexml(writer, indent, addindent, newl)
  File /usr/lib/python2.7/xml/dom/minidom.py, line 814, in writexml
node.writexml(writer, indent+addindent, addindent, newl)
  File /usr/lib/python2.7/xml/dom/minidom.py, line 814, in writexml
node.writexml(writer, indent+addindent, addindent, newl)
  File /usr/lib/python2.7/xml/dom/minidom.py, line 814, in writexml
node.writexml(writer, indent+addindent, addindent, newl)
  File /usr/lib/python2.7/xml/dom/minidom.py, line 1150, in writexml
raise ValueError(']]' not allowed in a CDATA section)
ValueError: ']]' not allowed in a CDATA section

and empty directory test-reports has been created.

3. this is what should have happened instead:
arturcz@szczaw:/tmp$ ./cdata.py 

Running tests...
--
F
==
FAIL [0.000s]: testFoo (__main__.Foo)
--
Traceback (most recent call last):
  File ./cdata.py, line 7, in testFoo
self.assertTrue(False, ']]')
AssertionError: ]]

--
Ran 1 test in 0.001s

FAILED (failures=1)

Generating XML reports...

and file test-reports/TEST-Foo-${timestamp}.xml is created with following 
content:
?xml version=1.0 ?
testsuite errors=0 failures=1 name=Foo-20140223203423 tests=1 
time=0.000
testcase classname=Foo name=testFoo time=0.000
failure message=]]gt; type=AssertionError
![CDATA[Traceback (most recent call last):
  File ./cdata.py, line 7, in testFoo
self.assertTrue(False, '![CDATA[')
AssertionError: ![CDATA[
]] /failure
/testcase
system-out
![CDATA[]]/system-out
system-err
![CDATA[]]/system-err
/testsuite

however, on the level of minidom.py module, there is an exact test provided in 
attached repository.

PS. I removed the patch by purpose - it's wrong and someone could be misleaded 
by it. The correct solution I propose is in the attached repository.

--

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



[issue17997] ssl.match_hostname(): sub string wildcard should not match IDNA prefix

2014-02-23 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

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



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-02-23 Thread Jeff Allen

Jeff Allen added the comment:

Actual patch for your convenience. I'm not set up to build CPython from source, 
so I've tested this with my installed CPython 2.7.6, and it's clean.

[As for keeping the tests in sync, yes that's our aim. Jython's Lib contains 
only the customised versions, and everything else comes from a copy of 
CPython's in lib-python/2.7. I'm always looking for a chance to delete one 
(i.e. use the common file).]

--
keywords: +patch
nosy: +fwierzbicki
Added file: http://bugs.python.org/file34202/issue20155_py.patch

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


Removed file: http://bugs.python.org/file34167/minidom.patch

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



[issue20714] Allow for ]] in CDATA in minidom

2014-02-23 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I fail to see the bug in Python. minidom is behaving correctly. The error is in 
xmlrunner, which does

  error_info = str(test_result.get_error_info())
  failureText = xml_document.createCDATASection(error_info)

This is incorrect - it would have to check that error_info does not contain ]] 
(since CDATA sections must not contain ]]). If it finds ]] in the error_info, 
it would have to create two CDATA sections, e.g. one up to and including ]], 
and the second one starting at  (repeated if there is more than one occurrence 
of ]] in error_info.

Alternatively, it should just create a text node, since writing a text node 
will properly escape all special characters in error_info.

--

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



  1   2   >