asyncio 0.4.1 released

2014-02-26 Thread Guido van Rossum
*** NOTE: Python 3.3 only! This module is in the stdlib in Python 3.4. ***

On the heels of Python 3.4.0rc2, I've put a new version of the asyncio
package for Python 3.3 on PyPI: https://pypi.python.org/pypi/asyncio/0.4.1

There's a source distro and a 32-bit Windows wheel. (For 64-bit Windows I
could use some help.)

About asyncio: it's a new stdlib module for asynchronous I/O based on the
yield from statement that was added to Python 3.3. It was inspired by
Twisted and the async support in Tornado (amongst other influences). The
original code name for the project is Tulip and this is where the latest
developments happen: http://code.google.com/p/tulip/. Also check out PEP
3156: http://python.org/dev/peps/pep-3156/.

For Python 2 and 3.2, Victor Stinner has created a backport named Trollius:
https://pypi.python.org/pypi/trollius/0.1.5

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

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


ANN: SfePy 2014.1

2014-02-26 Thread Robert Cimrman

I am pleased to announce release 2014.1 of SfePy.

Description
---
SfePy (simple finite elements in Python) is a software for solving
systems of coupled partial differential equations by the finite element
method. The code is based on NumPy and SciPy packages. It is distributed
under the new BSD license.

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

Highlights of this release
--
- sfepy.fem was split to separate FEM-specific and general modules
- lower memory usage by creating active DOF connectivities directly from field
  connectivities
- new handling of field and variable shapes
- clean up: many obsolete modules were removed, all module names follow naming
  conventions

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

Best regards,
Robert Cimrman and Contributors (*)

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

Vladimír Lukeš, Matyáš Novák, Jaroslav Vondřejc
--
https://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Python : parsing the command line options using optparse

2014-02-26 Thread Ganesh Pal
On Tue, Feb 25, 2014 at 9:55 PM, Peter Otten __pete...@web.de wrote:

As you are just starting I recommend that you use argparse instead of
 optparse.

 I would love to use argparse but  the script that I plan to write has to
run on host machines that Python 2.6

 I have freebsd clients  with python  2.6  dont want to install python new
version on all the host machine which will be eventually upgraded to 2.7 .

I wanted know if I could use argparse with python 2.6 and is it possible to
add  something like   #pkg_add -r install python-argparse and install
python argparse module before I use it.





 If you are asking why short options don't work in conjunction with = -- I
 don't know, it is probably a design choice of the optparse author.
 argparse accepts short options with like -f=1234



 I wanted to know why my sample program does not work  with short hand
option (-p) and works with long hand option .

Here is what is happening ( only short hand with -)

# python-5.py -p=/ifs/1.txt -q=XOR  -f=1234 -n=1 -l

Usage: python-5.py [options]

python-5.py: error: option -q: invalid choice: '=XOR' (choose from 'XOR',
'ADD',

 'SET', 'MODIFY', 'RENAME', 'DELETE', 'KILL')


Result :says  invalid choice: '=XOR'





Long hand Works ( -- , or double hypen ) fine.

C:\Users\bahadg\Desktoppython python-5.py --path=/ifs/1.txt
--operation=XOR  --

offset=1234 --node=1 --log --fixcrc

/ifs/1.txt
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Functions help

2014-02-26 Thread Mark Lawrence

On 26/02/2014 02:06, Cameron Simpson wrote:

On 24Feb2014 13:59, Mark Lawrence breamore...@yahoo.co.uk wrote:

On 24/02/2014 04:01, ru...@yahoo.com wrote:

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.


MRAB has confirmed that as always Thunderbird is working perfectly,
thank you.


He confirmed it worked for him. And yet your copy rendered incorrectly.
MRAB pointed at a possible cause (mixed TABs and spaces).


But you can stick with your bug ridden, badly flawed
tool as long as you like, just expect me to keep complaining until
google fixes it, or people stop using it, or people follow the
instructions that were put up on a Python web site to prevent the
bugs showing up.


Methinks rurpy's GG suggestion was bait aimed specificly at you.
I recognised it as sarcasm (or parody?).

Relax.



Frankly I don't give a damn one way or the other, I'm simply cheesed off 
with seeing garbage coming through from gg, in the same way readers of 
this list are fed up with me complaining about it :)


--
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: Python : parsing the command line options using optparse

2014-02-26 Thread sffjunkie
On Wednesday, 26 February 2014 09:30:21 UTC, Ganesh Pal  wrote:
 Here is what is happening ( only short hand with -)
 
 # python-5.py -p=/ifs/1.txt -q=XOR  -f=1234 -n=1 -l
 
 Usage: python-5.py [options]
 python-5.py: error: option -q: invalid choice: '=XOR' (choose from 'XOR', 
 'ADD',
 
  'SET', 'MODIFY', 'RENAME', 'DELETE', 'KILL')

Short hand options don't use '=' signs. Try

python-5.py -p /ifs/1.txt -q XOR  -f 1234 -n 1 -l

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


Re: Can global variable be passed into Python function?

2014-02-26 Thread Gregory Ewing

Steven D'Aprano wrote:

Standard Pascal? Who uses standard Pascal? I'm talking about MacPascal :-)


Mac Pascal used @ for getting a pointer to
a variable, if I remember rightly.

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


Re: Python : parsing the command line options using optparse

2014-02-26 Thread Peter Otten
Ganesh Pal wrote:

 On Tue, Feb 25, 2014 at 9:55 PM, Peter Otten __pete...@web.de wrote:
 
As you are just starting I recommend that you use argparse instead of
  optparse.
 
  I would love to use argparse but  the script that I plan to write has to
 run on host machines that Python 2.6
 
  I have freebsd clients  with python  2.6  dont want to install python new
 version on all the host machine which will be eventually upgraded to 2.7 .
 
 I wanted know if I could use argparse with python 2.6 and is it possible
 to
 add  something like   #pkg_add -r install python-argparse and install
 python argparse module before I use it.

Probably, but I have no experience with freebsd.

 If you are asking why short options don't work in conjunction with = --
 I don't know, it is probably a design choice of the optparse author.
 argparse accepts short options with like -f=1234
 
  I wanted to know why my sample program does not work  with short hand
 option (-p) and works with long hand option .
 
 Here is what is happening ( only short hand with -)
 
 # python-5.py -p=/ifs/1.txt -q=XOR  -f=1234 -n=1 -l
 
 Usage: python-5.py [options]
 
 python-5.py: error: option -q: invalid choice: '=XOR' (choose from 'XOR',
 'ADD',
 
  'SET', 'MODIFY', 'RENAME', 'DELETE', 'KILL')
 
 
 Result :says  invalid choice: '=XOR'

If you stick with optparse just pass the options without '='

-qXOR

and

-q XOR

should both work.

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


exec and locals

2014-02-26 Thread Steven D'Aprano
I have to dynamically generate some code inside a function using exec, 
but I'm not sure if it is working by accident or if I can rely on it.

Here is a trivial example:


py def spam():
... exec( x = 23 )
... return x
...
py spam()
23


(My real example is more complex than this.)

According to the documentation of exec, I don't think this should 
actually work, and yet it appears to. The documentation says:

The default locals act as described for function locals() 
below: modifications to the default locals dictionary should 
not be attempted. Pass an explicit locals dictionary if you 
need to see effects of the code on locals after function 
exec() returns.

http://docs.python.org/3.4/library/functions.html#exec


I *think* this means that if I want to guarantee that a local variable x 
is created by exec, I need to do this instead:

py def eggs():
... mylocals = {}
... exec( x = 23, globals(), mylocals)
... x = mylocals['x']
... return x
...
py eggs()
23

The fact that it works in spam() above is perhaps an accident of 
implementation? Yes no maybe?



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


Re: exec and locals

2014-02-26 Thread Chris Angelico
On Thu, Feb 27, 2014 at 12:15 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 py def spam():
 ... exec( x = 23 )
 ... return x
 ...
 py spam()
 23


 (My real example is more complex than this.)

 According to the documentation of exec, I don't think this should
 actually work, and yet it appears to.

Doesn't work for me, in IDLE in 3.4.0b2, nor in command-line Python on
3.4.0rc1+ (from hg a couple of weeks ago). But it did (happen to?)
work in 2.7. What version did you use?

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


Re: Python : parsing the command line options using optparse

2014-02-26 Thread Ganesh Pal
On Wed, Feb 26, 2014 at 4:57 PM, Peter Otten __pete...@web.de wrote:

 If you stick with optparse just pass the options without '='

 -qXOR

 and

 -q XOR

 should both work.



Thanks  Peter  and Simon for the hints  it worked  : )  without ' ='

# Python corrupt.py -o INODE -p /ifs/1.txt -q SET -f 1

Current Default Choice :

Choice: INODE
Choice: SET
Choice: 1
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: exec and locals

2014-02-26 Thread Peter Otten
Steven D'Aprano wrote:

 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
 
 Here is a trivial example:
 
 
 py def spam():
 ... exec( x = 23 )
 ... return x
 ...
 py spam()
 23
 
 
 (My real example is more complex than this.)
 
 According to the documentation of exec, I don't think this should
 actually work, and yet it appears to. The documentation says:
 
 The default locals act as described for function locals()
 below: modifications to the default locals dictionary should
 not be attempted. Pass an explicit locals dictionary if you
 need to see effects of the code on locals after function
 exec() returns.
 
 http://docs.python.org/3.4/library/functions.html#exec
 
 
 I *think* this means that if I want to guarantee that a local variable x
 is created by exec, I need to do this instead:
 
 py def eggs():
 ... mylocals = {}
 ... exec( x = 23, globals(), mylocals)
 ... x = mylocals['x']
 ... return x
 ...
 py eggs()
 23
 
 The fact that it works in spam() above is perhaps an accident of
 implementation? Yes no maybe?

eggs() should work in Python 2 and 3,
spam() should work in Python 2, but not in Python 3.

Fun fact: Python 2 tweaks the bytecode (LOAD_NAME instead of LOAD_GLOBAL) to 
make spam() work:

 def spam():
... return x
... 
 dis.dis(spam)
  2   0 LOAD_GLOBAL  0 (x)
  3 RETURN_VALUE
 def spam():
... exec 
... return x
... 
 dis.dis(spam)
  2   0 LOAD_CONST   1 ('')
  3 LOAD_CONST   0 (None)
  6 DUP_TOP 
  7 EXEC_STMT   

  3   8 LOAD_NAME0 (x)
 11 RETURN_VALUE


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


Re: exec and locals

2014-02-26 Thread Peter Otten
Peter Otten wrote:

 Steven D'Aprano wrote:
 
 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
 
 Here is a trivial example:
 
 
 py def spam():
 ... exec( x = 23 )
 ... return x
 ...
 py spam()
 23
 
 
 (My real example is more complex than this.)
 
 According to the documentation of exec, I don't think this should
 actually work, and yet it appears to. The documentation says:
 
 The default locals act as described for function locals()
 below: modifications to the default locals dictionary should
 not be attempted. Pass an explicit locals dictionary if you
 need to see effects of the code on locals after function
 exec() returns.
 
 http://docs.python.org/3.4/library/functions.html#exec
 
 
 I *think* this means that if I want to guarantee that a local variable x
 is created by exec, I need to do this instead:
 
 py def eggs():
 ... mylocals = {}
 ... exec( x = 23, globals(), mylocals)
 ... x = mylocals['x']
 ... return x
 ...
 py eggs()
 23
 
 The fact that it works in spam() above is perhaps an accident of
 implementation? Yes no maybe?
 
 eggs() should work in Python 2 and 3,
 spam() should work in Python 2, but not in Python 3.
 
 Fun fact: Python 2 tweaks the bytecode (LOAD_NAME instead of LOAD_GLOBAL)
 to make spam() work:
 
 def spam():
 ... return x
 ...
 dis.dis(spam)
   2   0 LOAD_GLOBAL  0 (x)
   3 RETURN_VALUE
 def spam():
 ... exec 
 ... return x
 ...
 dis.dis(spam)
   2   0 LOAD_CONST   1 ('')
   3 LOAD_CONST   0 (None)
   6 DUP_TOP
   7 EXEC_STMT
 
   3   8 LOAD_NAME0 (x)
  11 RETURN_VALUE

Some more bytcode fun, because it just occured to me that you can optimize 
away the code that triggered the modification:

 def spam():
... return x
... if 0: exec 
... 
 dis.dis(spam)
  2   0 LOAD_NAME0 (x)
  3 RETURN_VALUE


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


Re: exec and locals

2014-02-26 Thread Alister
On Wed, 26 Feb 2014 13:15:25 +, Steven D'Aprano wrote:

 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
 
 Here is a trivial example:
 
 
 py def spam():
 ... exec( x = 23 )
 ... return x ...
 py spam()
 23
 
 
 (My real example is more complex than this.)
 
 According to the documentation of exec, I don't think this should
 actually work, and yet it appears to. The documentation says:
 
 The default locals act as described for function locals() below:
 modifications to the default locals dictionary should not be
 attempted. Pass an explicit locals dictionary if you need to see
 effects of the code on locals after function exec() returns.
 
 http://docs.python.org/3.4/library/functions.html#exec
 
 
 I *think* this means that if I want to guarantee that a local variable x
 is created by exec, I need to do this instead:
 
 py def eggs():
 ... mylocals = {}
 ... exec( x = 23, globals(), mylocals)
 ... x = mylocals['x']
 ... return x ...
 py eggs()
 23
 
 The fact that it works in spam() above is perhaps an accident of
 implementation? Yes no maybe?

I have no idea but as exec is generally considered to be a bad idea are 
you absolutely sure this is the correct way to achieve your end goal?

perhaps if you detailed your requirement someone may be able to suggest a 
safer solution.


-- 
Regardless of the legal speed limit, your Buick must be operated at
speeds faster than 85 MPH (140kph).
-- 1987 Buick Grand National owners manual.
-- 
https://mail.python.org/mailman/listinfo/python-list


Need help in writing some code so i can re-use it in every module or class

2014-02-26 Thread Unix SA
Hello Experts,

I have requirement, like i want to use below command in python script.

command --username username --password password  Command line
arguments

now my requirement is i want to write some class so i can re-use command
--username username --password password part via importing as module
or class  .. and re-use that in other module or classes .. so i dont have
to write that in every module or classes ..

Now why i wan to do this is ... currently command we are using is going
to change in near future to command1, so i dont have go to every module
and change that command if i have written single module or class and re-use
it in other ?

Hope i am clear enough to describe my issue?

any suggestions ?

Regards,
DJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python : parsing the command line options using optparse

2014-02-26 Thread rodperson

On 2014-02-26 04:30, Ganesh Pal wrote:

On Tue, Feb 25, 2014 at 9:55 PM, Peter
Otten __pete...@web.de wrote:


As you are just starting I recommend that you use argparse instead of

 optparse.

 I would love to use argparse but  the script that I plan to write
has to run on host machines that Python 2.6

 I have freebsd clients  with python  2.6  dont want to install
python new version on all the host machine which will be eventually
upgraded to 2.7 .

I wanted know if I could use argparse with python 2.6 and is it
possible to add  something like   #pkg_add -r install
python-argparse and install python argparse module before I use it.


They must be running an older version of FreeBSD since the default 
version of python is 2.7.


There is a FreeBSD package for argparse, the command would be something 
like

   pkg_add -r install py26-argparse


Rod

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


Re: python

2014-02-26 Thread Rodrick Brown
L
 On Feb 25, 2014, at 8:27 PM, Karthik Reddy challakart...@gmail.com wrote:
 
 Thank you,
 
 but from by reaserch i got these requirements ..
 
 Python, django, Twisted, MySQL, PyQt, PySide, xPython.
 
 *Technical proficiency with Python and Django.
 *Technical proficiency in JavaScript.
 *Experience with MySQL / PgSQL.
 *Unix/Linux expertise.
 *Experience with MVC design patterns and solid algorithm skills.
 
 Core Python, DJango Framework, Web2Py, Google App engine, CherryPy ( Basic 
 Introduction)
 
 The problem for me is whether i have to learn all these technologies to work 
 as a python developer..
 
Learn core python fundamentals and idioms and everything else should come easy 
over time with a little experience and time. 
 
 
  
 On Tuesday, February 25, 2014 12:58:15 AM UTC+5:30, CM wrote:
 On Monday, February 24, 2014 3:31:11 AM UTC-5, Karthik Reddy wrote:
 
 I worked as a weblogic administrator and now i am changing to development 
 and i am very much interested in python . please suggest me what 
 are the things i need to learn more  rather than python to get an I.T job. 
 I came to know about  Django but i am in a confusion please help me 
 .
 
 
 
 I recommend you look at job advertisements in areas you'd like to work (both
 
 areas of the world and areas within IT) and see what they seem to want.
 
 
 
 Also, consider more informative subject lines to future posts.  :D
 -- 
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


EVOLUTIONISTS DESTROYED IN 5 SECONDS

2014-02-26 Thread Thrinaxodon

=
BREAKING NEWS!!!
=

THRINAXODON FOUND 300 FOSSILS FROM DEVONIAN STRATA FROM GREENLAND LAST 
TUESDAY, ONE WAS A COMPLETE HUMAN PELVIS!


THRINAXODON ALSO FOUND 6 PRIMITIVE STONE TOOLS FROM THE SITE, AS WELL AS 
CHARCOAL!


PETER NYIKOS WAS FORCED TO ACCEPT THAT HUMANS HAVE ORIGINS IN THE 
DEVONIAN AND HUMAN EVOLUTION IS A SCAM.


THE SMITHSONIAN IS GOING NUTS OVER THIS FIND, I WILL HAVE TO PATENT IT 
BEFORE ANYONE ELSE!


SEE YA FUCKERS!

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
--
https://mail.python.org/mailman/listinfo/python-list


Re: python

2014-02-26 Thread Karthik Reddy
On Monday, February 24, 2014 2:01:11 PM UTC+5:30, Karthik Reddy wrote:
 I worked as a weblogic administrator and now i am changing to development and 
 i am very much interested in python . please suggest me what are the 
 things i need to learn more  rather than python to get an I.T job. I came to 
 know about  Django but i am in a confusion please help me .


Thank you for guidance 

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


Re: Need help in writing some code so i can re-use it in every module or class

2014-02-26 Thread Jean-Michel Pichavant
- Original Message - 

 Hello Experts,

 I have requirement, like i want to use below command in python
 script.

 command --username username --password password Command line
 arguments

 now my requirement is i want to write some class so i can re-use
 command --username username --password password part via
 importing as module or class .. and re-use that in other module or
 classes .. so i dont have to write that in every module or classes
 ..

 Now why i wan to do this is ... currently command we are using is
 going to change in near future to command1, so i dont have go to
 every module and change that command if i have written single module
 or class and re-use it in other ?

 Hope i am clear enough to describe my issue?

 any suggestions ?

 Regards,
 DJ

Hi,

Have a look at http://docs.python.org/2/library/argparse.html

Then create a module, for instance myParser, that defines the common paser, and 
in each of your scripts import that module and use the parser.

*Untested code*

myParser.py

import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
#then define the parser


then in a script:

script.py

import myParser

if __name__ == '__main__':
args = myParser.parser.parse_args()
# and so on...

Cheers,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Issue 7503

2014-02-26 Thread Mark Lawrence
I'm not sure where to flag this up so reckon here's as good a place as 
any.  I noticed this afternoon 26/02/2014 between 16:05 and 16:09 four 
messages on the bug tracker mailing list about the subject issue, but 
http://bugs.python.org/issue7503 has not been updated yet and it's now 
18:50.  Technical glitch, people only just signing up or what?


--
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: Can global variable be passed into Python function?

2014-02-26 Thread MRAB

On 2014-02-26 10:59, Gregory Ewing wrote:

Steven D'Aprano wrote:

Standard Pascal? Who uses standard Pascal? I'm talking about MacPascal :-)


Mac Pascal used @ for getting a pointer to
a variable, if I remember rightly.


So did Turbo Pascal. Delphi, which is what Turbo Pascal became, is the
same.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Issue 7503

2014-02-26 Thread Ned Deily
In article leld4i$d6g$1...@ger.gmane.org,
 Mark Lawrence breamore...@yahoo.co.uk wrote:
 I'm not sure where to flag this up so reckon here's as good a place as 
 any.  I noticed this afternoon 26/02/2014 between 16:05 and 16:09 four 
 messages on the bug tracker mailing list about the subject issue, but 
 http://bugs.python.org/issue7503 has not been updated yet and it's now 
 18:50.  Technical glitch, people only just signing up or what?

Thanks for noticing this.  I happened to independently see it before 
reading your post and we've fixed the problem causing the fail and 
manually posted the dropped updates.

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

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


Re: exec and locals

2014-02-26 Thread Steven D'Aprano
On Wed, 26 Feb 2014 14:46:39 +0100, Peter Otten wrote:

 Steven D'Aprano wrote:
 
 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
 
 Here is a trivial example:
 
 
 py def spam():
 ... exec( x = 23 )
 ... return x
 ...
 py spam()
 23
 
 
 (My real example is more complex than this.)
 
 According to the documentation of exec, I don't think this should
 actually work, and yet it appears to. The documentation says:
 
 The default locals act as described for function locals() below:
 modifications to the default locals dictionary should not be
 attempted. Pass an explicit locals dictionary if you need to see
 effects of the code on locals after function exec() returns.
 
 http://docs.python.org/3.4/library/functions.html#exec
 
 
 I *think* this means that if I want to guarantee that a local variable
 x is created by exec, I need to do this instead:
 
 py def eggs():
 ... mylocals = {}
 ... exec( x = 23, globals(), mylocals) ... x =
 mylocals['x']
 ... return x
 ...
 py eggs()
 23
 
 The fact that it works in spam() above is perhaps an accident of
 implementation? Yes no maybe?
 
 eggs() should work in Python 2 and 3, spam() should work in Python 2,
 but not in Python 3.

Aha! That explains it -- I was reading the 3.x docs and testing in Python 
2.7.

Thanks everyone for answering.

By the way, if anyone cares what my actual use-case is, I have a function 
that needs to work under Python 2.4 through 3.4, and it uses a with 
statement. With statements are not available in 2.4 (or 2.5, unless you 
give a from __future__ import). So after messing about for a while with 
circular imports and dependency injections, I eventually settled on some 
code that works something like this:


def factory():
blah blah blah
try:
exec(def inner():
with something:
return something
, globals(), mylocals)
inner = mylocals['inner']
except SyntaxError:
def inner():
# manually operate the context manager
call context manager __enter__
try:
try:
return something
except:  # Yes, a bare except. Catch EVERYTHING.
blah blah blah
finally:
call context manager __exit__
blah blah blah
return inner


(By the way, yes, I have to use a bare except, not just except 
BaseException. Python 2.4 and 2.5 still have string exceptions.)


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


Re: exec and locals

2014-02-26 Thread Steven D'Aprano
On Wed, 26 Feb 2014 14:00:59 +, Alister wrote:

 On Wed, 26 Feb 2014 13:15:25 +, Steven D'Aprano wrote:
 
 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
[...]

 I have no idea but as exec is generally considered to be a bad idea are
 you absolutely sure this is the correct way to achieve your end goal?
 
 perhaps if you detailed your requirement someone may be able to suggest
 a safer solution.

Thanks for your concern, but what I'm doing is perfectly safe. The string 
being exec'ed is a string literal known at compile-time and written by me 
(see my previous email for details) and the only reason I'm running it 
with exec at runtime rather than treating it as normal source code is 
that it relies on a feature that may not be available (with statement).

The joys of writing code that has to run under multiple incompatible 
versions of Python.


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


Re: Functions help

2014-02-26 Thread rurpy
On 02/25/2014 07:52 PM, Ethan Furman wrote:
 On 02/23/2014 08:01 PM, ru...@yahoo.com wrote:
 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.
 
 LOL!  How long have you waited to say that?  ;)

A while.  It was worth the wait though. :-)

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


Re: exec and locals

2014-02-26 Thread Gregory Ewing

Steven D'Aprano wrote:

except SyntaxError:
def inner():
# manually operate the context manager
call context manager __enter__
try:
try:
return something
except:  # Yes, a bare except. Catch EVERYTHING.
blah blah blah
finally:
call context manager __exit__


Why not just use this version all the time? It should
work in both 2.x and 3.x.

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


Re: exec and locals

2014-02-26 Thread Dan Sommers
On Thu, 27 Feb 2014 00:25:45 +, Steven D'Aprano wrote:

 By the way, if anyone cares what my actual use-case is, I have a
 function that needs to work under Python 2.4 through 3.4, and it uses
 a with statement. With statements are not available in 2.4 (or 2.5,
 unless you give a from __future__ import). So after messing about for
 a while with circular imports and dependency injections, I eventually
 settled on some code that works something like this:

 def factory():
 blah blah blah
 try:
 exec(def inner():
 with something:
 return something
 , globals(), mylocals)
 inner = mylocals['inner']
 except SyntaxError:
 def inner():
 # manually operate the context manager
 call context manager __enter__
 try:
 try:
 return something
 except:  # Yes, a bare except. Catch EVERYTHING.
 blah blah blah
 finally:
 call context manager __exit__
 blah blah blah
 return inner

So why not something simpler?

def factory():

def inner():
'''Manually operate the context manager in order to maintain
compatibility with Python 2.4 through 3.4.'''
call context manager __enter__
try:
try:
return something
except:  # Yes, a bare except. Catch EVERYTHING.
blah blah blah
finally:
call context manager __exit__
blah blah blah
return inner

I claim that the less unnecessary code you write, the fewer bugs you
will have.

Does my code misbehave under any of your target versions?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: exec and locals

2014-02-26 Thread Dave Angel
 Steven D'Aprano st...@pearwood.info Wrote in message:
 On Wed, 26 Feb 2014 14:46:39 +0100, Peter Otten wrote:
 
 Steven D'Aprano wrote:
 
 I have to dynamically generate some code inside a function using exec,
 but I'm not sure if it is working by accident or if I can rely on it.
 
 I eventually settled on some 
 code that works something like this:
 
 
 def factory():
 blah blah blah
 try:
 exec(def inner():
 

Before I would use exec,  I'd look hard at either generating a
 source file to import,  or using a preprocessor.  And if this
 code was to be installed,  make the version choice or the
 preprocess step happen at install time.

I once implemented a system that generated 20k lines of C++ header
 and sources. And the generated code was properly indented and
 fairly well commented. 



-- 
DaveA

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


Re: python

2014-02-26 Thread prashanth B.G
Hi Karthik,

 Good that you have interest in switching to dev from admin
stuff. Since you are already an admin , you wouldn't have problems with
administrating an os (probabally weblogic deployment was on an ux/linux
machine) or a database. The requirements that you see are a mix of
different technologies for building a web application. But then Python and
Javascript are the two major ones which you will have to focus on .

Javascript is needed along with html and css for the front end alone . Most
of the times the front end is only a consumer of the information from the
backend except for the user interaction events where in information flows
in the opposite way. The backend has the bussiness logic implemented and
could be in any language here it is Python and of course this interacts
with the database. So you could ignore the rest of the technologies for a
while and learn Python till you become comfortable with - Maybe writing
small sysadmin scripts or anything which may be of personal interest to you
.

There are several tutorials which others have pointed out .. May be you can
take a look at http://swaroopch.com/notes/python/  (easy) or
http://www.diveintopython.net/  (slightly deeper) . Once you get a hold,
you could move on to Django which runs on top of Python to get a feel of
webframeworks . This would be the time when you would need to lean
javascript to make user interaction possible (JS is also a complete
language in itself and would need some weeks to start with).

The rest like mysql , html , css are something which you could learn when
the need arises since you don't have to go too deep into these and that the
basics are not too difficult to understand . Once you start working on web
dev stuff you will have to know the design patterns further of with mvc is
a part . This would definitely take some time and effort but it would
be worth learning .

Hope this helps :-)

Thanks.


On Thu, Feb 27, 2014 at 9:21 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote:

 On Tue, 25 Feb 2014 17:27:19 -0800 (PST), Karthik Reddy
 challakart...@gmail.com declaimed the following:

 Thank you,
 
 but from by reaserch i got these requirements ..
 
 Python, django, Twisted, MySQL, PyQt, PySide, xPython.
 
  *Technical proficiency with Python and Django.

 Web application framework

  *Technical proficiency in JavaScript.

 Client-side web application

  *Experience with MySQL / PgSQL.

 Relational database -- unless you need to fully administer the
 DBMS or
 use direct/obscure commands, knowing generic SQL may be enough (note that
 Django will likely be using it's own ORM package so even SQL may not be
 needed)

  *Unix/Linux expertise.

 Well... that implies being fluent in the OS (probably at the shell
 scripting level).

  *Experience with MVC design patterns and solid algorithm skills.

 While I know the term, I've not had much experience with the
 application... Separation of the data (model) from the user interface
 (view) and the logic linking the two (controller).

 Algorithm is another matter (the word basically is equivalent to
 recipe).

 
 Core Python, DJango Framework, Web2Py, Google App engine, CherryPy (
 Basic Introduction)
 
 The problem for me is whether i have to learn all these technologies to
 work as a python developer..
 

 Django, Web2Py, GAE, CherryPy are all focused on /web-based/
 (HTTP/HTML) applications. Python is just the implementation language.

 If the goal is just pure Python none of those may be applicable.
 For
 example, my most recent Python task was to generate UDP data packets to be
 fed through Cross Domain Solution boxes... I had to generate packets of
 various sizes, with some variation of contents [stuff that was supposed to
 trigger drop or edit actions in the CDS box]. Wireshark was used to
 capture the out-bound packets and the CDS-passed in-bound packets. Python
 was used to match the Wireshark captures to produce an SQLite database.
 Another Python program then extracted the latency data [outbound timestamp
 vs inbound timestamp] for the packets and create a CSV file for Excel
 plotting.

 That's three Python programs, yet none are web related. They
 required
 an understanding of the socket library, threading [the SQLite database
 relied on threads to read the two Wireshark capture files, filtering out
 all but the packet time-stamp and data ID string, and a third thread to
 match the out/in packets for latency -- and reporting any missing packets],
 and CSV library. Oh, and development of algorithms to do that processing.

 --
 Wulfraed Dennis Lee Bieber AF6VN
 wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

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




-- 
 *HAVE A NICE DAY *

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


Re: exec and locals

2014-02-26 Thread Steven D'Aprano
On Thu, 27 Feb 2014 16:34:33 +1300, Gregory Ewing wrote:

 Steven D'Aprano wrote:
 except SyntaxError:
 def inner():
 # manually operate the context manager call context manager
 __enter__
 try:
 try:
 return something
 except:  # Yes, a bare except. Catch EVERYTHING.
 blah blah blah
 finally:
 call context manager __exit__
 
 Why not just use this version all the time? It should work in both 2.x
 and 3.x.

Because that's yucky. It's an aesthetic thing: when supported, I want the 
Python interpreter to manage the context manager.

The exec part is only half a dozen lines, only three lines of source 
code. It's no burden to keep it for the cases where it works (that is, at 
least 2.6 onwards).


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


Re: exec and locals

2014-02-26 Thread Steven D'Aprano
On Wed, 26 Feb 2014 23:20:10 -0500, Dave Angel wrote:

 Before I would use exec,  I'd look hard at either generating a
  source file to import,  

Yes, I went through the process of pulling out the code into a separate 
module, but that just made more complexity and was pretty nasty. If the 
function was stand-alone, it might have worked, but it needed access to 
other code in the module, so there were circular dependencies.


 or using a preprocessor. 

I don't think that it's easier/better to write a custom Python 
preprocessor and run the entire module through it, just to avoid a three-
line call to exec.

Guys, I know that exec is kinda dangerous and newbies should be 
discouraged from throwing every string they see at it, but this isn't my 
second day Python programming, and it's not an accident that Python 
supports the dynamic compilation and execution of source code at runtime. 
It's a deliberate language feature. We're allowed to use it :-)


 And if this code was
  to be installed,  make the version choice or the preprocess step happen
  at install time.

Completely inappropriate in my case. This is a module which can be called 
from multiple versions of Python from a single installation.


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


Re: exec and locals

2014-02-26 Thread Chris Angelico
On Thu, Feb 27, 2014 at 3:47 PM, Steven D'Aprano st...@pearwood.info wrote:
 Guys, I know that exec is kinda dangerous and newbies should be
 discouraged from throwing every string they see at it, but this isn't my
 second day Python programming, and it's not an accident that Python
 supports the dynamic compilation and execution of source code at runtime.
 It's a deliberate language feature. We're allowed to use it :-)

Code smell means look at this. It doesn't mean don't use this
feature ever. :) Steven's looked into this thoroughly, I'm sure, and
exec is important.

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


Strange behavior with sort()

2014-02-26 Thread ast

Hello

box is a list of 3 integer items

If I write:

   box.sort()
   if box == [1, 2, 3]:


the program works as expected. But if I write:

   if box.sort() == [1, 2, 3]:

it doesn't work, the test always fails. Why ?

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


Deepcopying a byte string is quicker than copying it - problem?

2014-02-26 Thread Frank Millman
Hi all

I noticed this a little while ago, but dismissed it as a curiosity. On 
reflection, I decided to mention it here in case it indicates a problem.

This is with python 3.3.2.

C:\python -m timeit -s import copy copy.copy('a'*1000)
10 loops, best of 3: 6.91 usec per loop

C:\python -m timeit -s import copy copy.deepcopy('a'*1000)
10 loops, best of 3: 11.8 usec per loop

C:\python -m timeit -s import copy copy.copy(b'a'*1000)
1 loops, best of 3: 79.9 usec per loop

C:\python -m timeit -s import copy copy.deepcopy(b'a'*1000)
10 loops, best of 3: 11.7 usec per loop

As you can see, deepcopying a string is slightly slower than copying it.

However, deepcopying a byte string is orders of magnitude quicker than 
copying it.

Actually, looking closer, it is the 'copy' that is slow, not the 'deepcopy' 
that is quick..

Expected, or odd?

Frank Millman



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


Re: Strange behavior with sort()

2014-02-26 Thread Frank Millman

ast nom...@invalid.com wrote in message 
news:530eda1d$0$2061$426a7...@news.free.fr...
 Hello

 box is a list of 3 integer items

 If I write:

box.sort()
if box == [1, 2, 3]:


 the program works as expected. But if I write:

if box.sort() == [1, 2, 3]:

 it doesn't work, the test always fails. Why ?


Try the following in the interpreter -

 box = [3, 2, 1]
 box.sort()
 box
[1, 2, 3]

 box = [3, 2, 1]
print(box.sort())
None
 box
[1, 2, 3]

box.sort() sorts box 'in situ', but does not return anything. That is why 
the second example prints None.

In your second example, you are comparing the return value of box.sort() 
with [1, 2, 3]. As the return value is None, they are unequal.

HTH

Frank Millman



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


Re: Strange behavior with sort()

2014-02-26 Thread Eduardo A . Bustamante López
On Thu, Feb 27, 2014 at 07:24:24AM +0100, ast wrote:
 Hello
 
 box is a list of 3 integer items
 
 If I write:
 
box.sort()
if box == [1, 2, 3]:
 
 
 the program works as expected. But if I write:
 
if box.sort() == [1, 2, 3]:
 
 it doesn't work, the test always fails. Why ?
 
 Thx
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Because when you call the .sort() method on a list, it does the sort
in-place, instead of returning a sorted copy of the list. Check this:

 [2,1,3].sort()
 

The method does not return a value, that's why the direct comparison
fails.

What you might want is to use the sorted() method on the list, like
this:

 sorted([2,1,3])
[1, 2, 3]
 sorted([2,1,3]) == [1,2,3]
True

-- 
Eduardo Alan Bustamante López
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange behavior with sort()

2014-02-26 Thread Lele Gaifax
ast nom...@invalid.com writes:

 If I write:

box.sort()
if box == [1, 2, 3]:

 the program works as expected. But if I write:

if box.sort() == [1, 2, 3]:

 it doesn't work, the test always fails. Why ?

Because very often methods **dont't** return the object they are applied
(self that is).

This works though:

 box = [1,3,2]
 sorted(box) == [1,2,3]
True

hth, ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

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


Re: Strange behavior with sort()

2014-02-26 Thread Marko Rauhamaa
ast nom...@invalid.com:

 if I write:

if box.sort() == [1, 2, 3]:

 it doesn't work, the test always fails. Why ?

The list.sort() method returns None.

The builtin sorted() function returns a list:

   if sorted(box) == [1, 2, 3]:

would work.

Note that the list.sort() method is often preferred because it sorts the
list in place while the sorted() function must generate a fresh, sorted
list.


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


Re: Strange behavior with sort()

2014-02-26 Thread ast

Thanks for the very clear explanation
--
https://mail.python.org/mailman/listinfo/python-list


Re: Strange behavior with sort()

2014-02-26 Thread Gary Herron

On 02/26/2014 10:24 PM, ast wrote:

Hello

box is a list of 3 integer items

If I write:

   box.sort()
   if box == [1, 2, 3]:


the program works as expected. But if I write:

   if box.sort() == [1, 2, 3]:


Most such questions can be answered by printing out the values in 
question and observing first hand what the value is.


So, print out box.sort() to see what it is.  You might be surprised.

Hint: box.sort() does indeed cause box to be sorted, and the sorted list 
is left in box, but the sorted list is not returned as a function value.




it doesn't work, the test always fails. Why ?

Thx


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


Re: Strange behavior with sort()

2014-02-26 Thread Larry Hudson

On 02/26/2014 10:24 PM, ast wrote:

Hello

box is a list of 3 integer items

If I write:

box.sort()
if box == [1, 2, 3]:


the program works as expected. But if I write:

if box.sort() == [1, 2, 3]:

it doesn't work, the test always fails. Why ?

Thx


sort() sorts the sequence in place, but it _returns_ None.
Your second example becomes the equivalent of:

box.sort()
if None == [1, 2, 3]:

So although your box does become sorted, it is NOT what is compared in your if 
statement.

BTW, the sorted() function won't work here either.  It will return the sorted sequence, but it 
leaves the original unchanged.


 -=- Larry -=-

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


[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Bohuslav Slavek Kabrda

New submission from Bohuslav Slavek Kabrda:

ModuleFinder.load_module currently only skips 8 bytes before trying to 
marshal.load the rest of the file, but it should skip 12 since 3.3 (magic, 
date, file size). I'm attaching a patch with test case.

BTW this was very painful to find out, since I couldn't find any reference to 
written pyc files - am I searching wrong or is this really not documented 
anywhere?

(Note, that this was originally reported at 
https://bugzilla.redhat.com/show_bug.cgi?id=1060338).

--
components: Library (Lib)
files: fix-bytes-skipped-in-load_module.patch
keywords: patch
messages: 212244
nosy: bkabrda
priority: normal
severity: normal
status: open
title: ModuleFinder.load_module skips incorrect number of bytes in pyc files
versions: Python 3.3, Python 3.4
Added file: 
http://bugs.python.org/file34226/fix-bytes-skipped-in-load_module.patch

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



[issue20779] Add pathlib.chown method

2014-02-26 Thread Vajrasky Kok

New submission from Vajrasky Kok:

For pragmatic and philosophical reasons, I would argue that we should add chown 
to pathlib library.

--
components: Library (Lib)
files: add_chown_to_pathlib.patch
keywords: patch
messages: 212245
nosy: pitrou, vajrasky
priority: normal
severity: normal
status: open
title: Add pathlib.chown method
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file34227/add_chown_to_pathlib.patch

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



[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Poll: http://comments.gmane.org/gmane.comp.python.devel/145974

--

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



[issue9232] Allow trailing comma in any function argument list.

2014-02-26 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue20440] Use Py_REPLACE/Py_XREPLACE macros

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

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



[issue20780] Shadowed (duplicate name but different body) test in test_statistics

2014-02-26 Thread Vajrasky Kok

New submission from Vajrasky Kok:

Line 994 of Lib/test/test_statistics.py:

def test_decimal_mismatched_infs_to_nan(self):
# Test adding Decimal INFs with opposite sign returns NAN.
inf = Decimal('inf')
data = [1, 2, inf, 3, -inf, 4]
with decimal.localcontext(decimal.ExtendedContext):
self.assertTrue(math.isnan(statistics._sum(data)))

def test_decimal_mismatched_infs_to_nan(self):
# Test adding Decimal INFs with opposite sign raises InvalidOperation.
inf = Decimal('inf')
data = [1, 2, inf, 3, -inf, 4]
with decimal.localcontext(decimal.BasicContext):
self.assertRaises(decimal.InvalidOperation, statistics._sum, data)

Here is the patch. I also removed unnecessary import.

--
components: Tests
files: fix_shadowed_test_in_test_statistics.patch
keywords: patch
messages: 212247
nosy: stevenjd, vajrasky
priority: normal
severity: normal
status: open
title: Shadowed (duplicate name but different body) test in test_statistics
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file34228/fix_shadowed_test_in_test_statistics.patch

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



[issue20780] Shadowed (duplicate name but different body) test in test_statistics

2014-02-26 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Added file: 
http://bugs.python.org/file34229/fix_shadowed_test_in_test_statistics.patch

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



[issue20780] Shadowed (duplicate name but different body) test in test_statistics

2014-02-26 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: 
http://bugs.python.org/file34228/fix_shadowed_test_in_test_statistics.patch

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



[issue20246] buffer overflow in socket.recvfrom_into

2014-02-26 Thread Peter Funk

Peter Funk added the comment:

A recently posted proof of concept exploit got a lot of attention:

https://www.trustedsec.com/february-2014/python-remote-code-execution-socket-recvfrom_into/

I suggest some Python core developer should clarify here whether people running 
some publically available python based web service
(Zope, Plone, Roundup, MoinMoin, or whatever) are vulnerable or not.

--
nosy: +pefu

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



[issue20246] buffer overflow in socket.recvfrom_into

2014-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

recvfrom_into() is hardly ever used, including in the stdlib itself.
People using third-party software should check that the software itself doesn't 
call this method (chances are it doesn't).

--

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



[issue20781] BZ2File does decompress some .bz2 files correctly

2014-02-26 Thread James Dominy

New submission from James Dominy:

bz2.BZ2File does not decompress a file (see attached) correctly. This file can 
be decompressed and compressed via stadard unix tools (bzip2 and bunzip2) 
without change.

Consider ...

$ python
Python 2.7.6 (default, Dec  7 2013, 22:49:16) 
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
 import bz2
 import hashlib
 len(bz2.BZ2File(example-file.csv.bz2, r, 0).read())
90
 hashlib.md5(bz2.BZ2File(example-file.csv.bz2, r, 0).read()).hexdigest()
'e2d4ce212a040c879cb256f88c9faab9'
 len(bz2.BZ2File(example-file.csv.bz2, rb, 0).read())
90
 hashlib.md5(bz2.BZ2File(example-file.csv.bz2, rb, 0).read()).hexdigest()
'e2d4ce212a040c879cb256f88c9faab9'
 

It looks like bz2 is not dealing with the second block. This is not the first 
file I've come across that has this problem, and initially I thought it was the 
file not the module. I've attached a copy of the file.

I use gentoo on a 64bit intel core i5.

--
components: IO
files: example-file.csv.bz2
messages: 212250
nosy: James.Dominy
priority: normal
severity: normal
status: open
title: BZ2File does decompress some .bz2 files correctly
versions: Python 2.7
Added file: http://bugs.python.org/file34230/example-file.csv.bz2

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



[issue20781] BZ2File doesn't decompress some .bz2 files correctly

2014-02-26 Thread James Dominy

Changes by James Dominy jgdom...@gmail.com:


--
title: BZ2File does decompress some .bz2 files correctly - BZ2File doesn't 
decompress some .bz2 files correctly

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



[issue20781] BZ2File doesn't decompress some .bz2 files correctly

2014-02-26 Thread James Dominy

James Dominy added the comment:

Whoops, forget to add the output from the standard binutils

$ bzcat example-file.csv.bz2 | wc -c
909602
$ bzcat example-file.csv.bz2 | md5sum
48f4b69b2b8bb0b171ebc36313eb6616  -

As you can see file sizes and hashes do not match

--

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



[issue1508475] transparent gzip compression in urllib

2014-02-26 Thread Martin Panter

Martin Panter added the comment:

I have code that already handles an “gzip” encoded response from urlopen(). All 
three patches leave the Content-Encoding header intact, so I suspect my code 
would try to decompress the body a second time. Deleting this header (as 
already suggested) would work for me.

--
nosy: +vadmium

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



[issue20763] old sys.path_hooks importer does not work with Python 3.4.0rc1

2014-02-26 Thread Yukihiro Nakadaira

Yukihiro Nakadaira added the comment:

It works fine.  Thank you!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20763
___
___
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-26 Thread anuj0990

anuj0990 added the comment:

This is very useful information shared here. I am really thankful for this. a 
href=http://www.99th.co.in 99th.co.in/a

--
nosy: +anuj0990

___
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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Brett Cannon

Brett Cannon added the comment:

It's not documented because the format of .pyc files is considered an internal 
implementation detail.

--
nosy: +georg.brandl, larry
priority: normal - release blocker

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
priority: release blocker - normal

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



[issue14576] IDLE: resolving home directory for configuration uses HOMEDRIVE, HOMEPATH, and USERPROFILE inconsistently on Windows.

2014-02-26 Thread Divyanshu Sharma

Divyanshu Sharma added the comment:

I found a weird solution for the problem. Exchange the names of python and 
pythonw in the python33 folder. This makes the IDLE to call both and as a 
result python opens in both modes simultaneosly, and the subprocess connection 
error don't shows up.

--
nosy: +Divyanshu

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



[issue20782] base64 module docs do not use the terms 'bytes' and 'string' consistently.

2014-02-26 Thread R. David Murray

New submission from R. David Murray:

The base64 documentation (http://docs.python.org/3/library/base64.html) does 
not use the new python3 byte/string terminology consistently (sometimes not 
even within the same paragraph).

--
assignee: docs@python
components: Documentation
messages: 212258
nosy: docs@python, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: base64 module docs do not use the terms 'bytes' and 'string' 
consistently.
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Brett Cannon

Brett Cannon added the comment:

Probably want to make sure that modulefinder uses 
importlib._bootstrap._validate_bytecode_header() to do the parsing.

--

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

Since modulefinder is used by freeze tools (notably cx_Freeze, which seems to 
be the most popular currently), should this be considered a release blocker?

--
nosy: +r.david.murray

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Brett Cannon

Brett Cannon added the comment:

It's been broken since Python 3.3 so this is not a 3.3 regression.

--
keywords: +3.2regression -patch

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Zachary Ware

Zachary Ware added the comment:

Output attached.

--
Added file: http://bugs.python.org/file34231/20501.output

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



[issue20774] collections.deque should ship with a stdlib json serializer

2014-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The problem is that it would be deserialized as a list; this breaks the general 
expectation that serialization formats should round-trip.

(yes, tuple already does this; but I think it is less of a problem for tuples, 
since the list API is a superset of the tuple API except for hashing)

So, perhaps we could ship an optional serializer (under which form?) accepting 
any sequence type (and perhaps any mapping type?), but it shouldn't be the 
default.

--
nosy: +ezio.melotti, pitrou, rhettinger
type:  - enhancement
versions: +Python 3.5 -Python 2.7, Python 3.3

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

Right.  I'm asking if it should be a release blocker for the next 3.3, too :)

I'm not saying it should be, just raising the question.  It's in my mind 
because I'm currently using cx_Freeze in a project for a client.  It could have 
affected me, since I was going to release using 3.3, but as it turns out I have 
to use 2.7 because of a non-ported dependency that I don't have time to port 
myself.

--
keywords:  -3.2regression

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



[issue20759] unittest.mock documentation typos

2014-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 045f048cc116 by Zachary Ware in branch '3.3':
Issue #20759: Fix some typos in the mock docs.
http://hg.python.org/cpython/rev/045f048cc116

New changeset 42ef1c82d645 by Zachary Ware in branch 'default':
Close #20759: Fix some typos in the mock docs. (Merge with 3.3)
http://hg.python.org/cpython/rev/42ef1c82d645

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

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



[issue20759] unittest.mock documentation typos

2014-02-26 Thread Zachary Ware

Zachary Ware added the comment:

Thanks for the report!

--
assignee: docs@python - zach.ware
nosy: +zach.ware

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

Oops, didn't mean to remove the keyword.

--
keywords: +3.2regression

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



[issue7503] multiprocessing AuthenticationError digest sent was rejected when pickling proxy

2014-02-26 Thread Paul Tunison

Paul Tunison added the comment:

I can confirm that this is still an issue with python 2.7.5. My method of 
resolving this locally is similar to xhantu's. I created a sub-class of 
BaseProxy, overriding the __reduce__ method and injecting the authkey into the 
appropriate spot in the super method's returned content.

--
nosy: +Paul.Tunison

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



[issue7503] multiprocessing AuthenticationError digest sent was rejected when pickling proxy

2014-02-26 Thread Paul Tunison

Paul Tunison added the comment:

I can confirm that this is still an issue with python 2.7.5. My method of 
resolving this locally is similar to xhantu's. I created a sub-class of 
BaseProxy, overriding the __reduce__ method and injecting the authkey into the 
appropriate spot in the super method's returned content.

--
nosy: +Paul.Tunison

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



[issue7503] multiprocessing AuthenticationError digest sent was rejected when pickling proxy

2014-02-26 Thread Paul Tunison

Paul Tunison added the comment:

I can confirm that this is still an issue with python 2.7.5. My method of 
resolving this locally is similar to xhantu's. I created a sub-class of 
BaseProxy, overriding the __reduce__ method and injecting the authkey into the 
appropriate spot in the super method's returned content.

--
nosy: +Paul.Tunison

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



[issue20777] PyArg_ParseTupleAndKeywords does not respect arguments format.

2014-02-26 Thread Carlos Ferreira

Carlos Ferreira added the comment:

Solved. This issue had nothing to do with Python API.

--

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



[issue7503] multiprocessing AuthenticationError digest sent was rejected when pickling proxy

2014-02-26 Thread Dhanannjay Deo

Dhanannjay Deo added the comment:

Confirmed for python 2.7.3 on ubuntu 12.04 lts. Why this issue is still open 
after 4 years ?

--
nosy: +Dhanannjay.Deo
versions:  -Python 2.6

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Brett Cannon

Brett Cannon added the comment:

Don't know why this is any more special of a bug because it influences 
cx_freeze compared to any other bug that influences a popular project. I mean 
I'm not going to stop you from making it a blocker but I'm also not going to 
rush to fix it myself either.

--

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



[issue20774] collections.deque should ship with a stdlib json serializer

2014-02-26 Thread Gareth Rees

Gareth Rees added the comment:

The JSON implementation uses these tests to determine how to serialize a Python 
object:

isinstance(o, (list, tuple))
isinstance(o, dict)

So any subclasses of list and tuple are serialized as a list, and any subclass 
of dict is serialized as an object. For example:

 json.dumps(collections.defaultdict())
'{}'
 json.dumps(collections.OrderedDict())
'{}'
 json.dumps(collections.namedtuple('mytuple', ())())
'[]'

When deserialized, you'll get back a plain dictionary or list, so there's no 
round-trip property here.

The tests could perhaps be changed to:

isinstance(o, collections.abc.Sequence)
isinstance(o, collections.abc.Mapping)

I'm not a JSON expert, so I have no informed opinion on whether this is a good 
idea or not, but in any case, this change wouldn't help with deques, as a deque 
is not a Sequence. That's because deques don't have an index method (see 
issue10059 and issue12543).

--
nosy: +Gareth.Rees

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

Well, because of the fact that freeze tools are used to distribute programs on 
the Windows platform.  But, given that it hasn't been reported before and has 
been a problem since 3.3, it seems like there is no rush.

--

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Same as on Linux (and differs from 3.x). Thank you Zachary.

Here is corrected patch. Added also a test which tests that readline() doesn't 
read whole file.

--
Added file: http://bugs.python.org/file34232/fileinput_hook_encoded_3.patch

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file33934/fileinput_hook_encoded.patch

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



[issue20778] ModuleFinder.load_module skips incorrect number of bytes in pyc files

2014-02-26 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
nosy:  -larry

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



[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Barring c++, are we using any C compilers that don't support inlines?
Imho these macros should be functions proper.  Then we could do
Py_Assign(target, Py_IncRef(obj))

It's 2014 already.

--

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file34222/fileinput_hook_encoded_2.patch

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



[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Stefan Krah

Stefan Krah added the comment:

 Barring c++, are we using any C compilers that don't support inlines?

Not that I know of. libmpdec is C99, which seems to be supported by all
obscure commercial compilers on snakebite.

Also there have been no 3.x bug reports due to compilers choking on inline
functions.

--

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Zachary Ware

Zachary Ware added the comment:

New patch passes on Windows.  Without the patch to fileinput.py, the new 
hook_encoded tests pass and the new test_readline test fails (as expected).

--

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



[issue20783] bytearray init fails when \x00 is present

2014-02-26 Thread Andrew P. Lentvorski, Jr.

New submission from Andrew P. Lentvorski, Jr.:

The byte array init fails when \x00 is present

This fails:
ggRAM = bytearray(RAM_SIZE_BYTES, '\x00'*RAM_SIZE_BYTES)

However, this works:
ggRAM = bytearray(RAM_SIZE_BYTES)
ggRAM[:] = '\x00'*RAM_SIZE_BYTES

--
components: Interpreter Core
messages: 212281
nosy: bsder
priority: normal
severity: normal
status: open
title: bytearray init fails when \x00 is present
type: behavior
versions: Python 2.7

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



[issue19218] Use of MutableMapping in os module slows down interpreter startup

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

For backward compatibility, shouldn't

  import _collections_abc

in the __init__ file be

  import _collections_abc as abc

?

--
nosy: +r.david.murray

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



[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Larry Hastings

Larry Hastings added the comment:

 Barring c++, are we using any C compilers that don't support inlines?

CPython advertises itself as C89 compliant, and C89 doesn't have inlines.  You 
need to go to C99 to get inlines.

And before you ask--yes, we support a compiler that is not C99 compliant: 
Microsoft Visual C++.  I'm pretty sure it does have inline support though.

It's possible that every platform officially supported by CPython has a C 
compiler that supports inlines.  I'm pretty sure people compile Python on 
unsupported platforms whose compilers don't have inlines (e.g. OS/2).  Anyway, 
you'd have to get Guido to agree to breaking C89 compatibility, it's not 
something you could do locally on this patch without (most likely) a big 
drawn-out discussion on python-dev.

--

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



[issue20784] 'collections.abc' is no longer defined when collections is imported

2014-02-26 Thread R. David Murray

New submission from R. David Murray:

collections.abc was renamed _collections_abc in issue 19218.  The __init__ file 
was modified to load all the abc into the collections namespace, but the 'abc' 
name itself is no longer defined:

Python 3.3.2 (default, Dec 17 2013, 17:24:42) 
[GCC 4.7.3] on linux
Type help, copyright, credits or license for more information.
 import collections
 collections.abc
module 'collections.abc' from '/usr/lib/python3.3/collections/abc.py'

Python 3.4.0rc1+ (default:1bc585ba5df2, Feb 24 2014, 15:04:31) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 import collections
 collections.abc
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'module' object has no attribute 'abc'

It looks like the import statement for _collections_abc in the __init__ file as 
has missing as abc phrase.

This is probably not important enough to require fixing in the RC, since 
'import collections.abc' works fine, but it is a regression.

--
keywords: 3.4regression
messages: 212284
nosy: Arfrever, barry, christian.heimes, eric.snow, haypo, larry, pitrou, 
python-dev, r.david.murray, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: 'collections.abc' is no longer defined when collections is imported
type: behavior
versions: Python 3.4

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



[issue19218] Use of MutableMapping in os module slows down interpreter startup

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

Opened issue 20784 to address the above.

--

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



[issue20784] 'collections.abc' is no longer defined when collections is imported

2014-02-26 Thread Larry Hastings

Larry Hastings added the comment:

I'm pretty sure that if you import x, there are zero guarantees that x.y 
will work.  The offical line is that you must explicitly import all the deepest 
submodules you use.  So I don't think this is even a bug.

--

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



[issue20783] bytearray init fails when \x00 is present

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

That isn't a valid bytearray initialization call.  The two argument form is 
(string, encoding), not (size, string).  The error message you get is a bit 
funky and not particularly informative, though.  Maybe someone will want to try 
to improve that.

--
nosy: +r.david.murray
stage:  - committed/rejected
versions: +Python 3.4, Python 3.5

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



[issue20784] 'collections.abc' is no longer defined when collections is imported

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

It is a backward compatibility bug.  Something that used to work doesn't any 
more.  And it was explicitly *made* to work previously (the original __init__ 
statement was 'import collections.abc').  And it is is an implementation bug in 
the original patch because otherwise there would be no point in importing 
_collections_abc in __init__.

But you are right, it is relatively unlikely that anyone is relying on it.

--

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



[issue20783] bytearray init fails when \x00 is present

2014-02-26 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
stage: committed/rejected - 

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



[issue20784] 'collections.abc' is no longer defined when collections is imported

2014-02-26 Thread R. David Murray

R. David Murray added the comment:

If we decide we want this (small) backward compatibility break, to make 
collections.abc consistent with the other modules (except os.path), then I 
should mention it in the whatsnew porting section for 3.4, which is really why 
I opened this issue :)

I that case, IMO, the import for _collections_abc should be removed from the 
collections __init__ file (in 3.4.1), just to keep things tidy.

--

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1a1a9d6fb278 by Serhiy Storchaka in branch '2.7':
Issue #20501: fileinput module no longer reads whole file into memory when using
http://hg.python.org/cpython/rev/1a1a9d6fb278

New changeset b4a139713b3b by Serhiy Storchaka in branch '3.3':
Added tests for issue #20501.
http://hg.python.org/cpython/rev/b4a139713b3b

New changeset 1a38fa1f701d by Serhiy Storchaka in branch 'default':
Added tests for issue #20501.
http://hg.python.org/cpython/rev/1a38fa1f701d

--
nosy: +python-dev

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



[issue20784] 'collections.abc' is no longer defined when collections is imported

2014-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I'm pretty sure that if you import x, there are zero guarantees that
 x.y will work.  The offical line is that you must explicitly import
 all the deepest submodules you use.

I'm not sure why you're saying that. I think it's quite common to only
import os and then use os.path.

--

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Serhiy Storchaka

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


--
assignee: docs@python - serhiy.storchaka

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



[issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

2014-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Zachary that ran tests for me.

Thank you Gunnar for your report.

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

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



  1   2   >