ordereddict 0.4.5 ( fast implementation of ordereddict and sorteddict in C)

2012-06-18 Thread Anthon van der Neut
After a hiatus of several years, I am pleased to announce version 0.4.5 
of the ordereddict module. This is primarily a bug fix release and will 
be the last one for ordereddict in this form.


Changes:

- fixed a bug in slicing SortedDicts found by Migel Anguel
- fixed a bug reinserting last item again beyond last position found by 
Volkan Çetin
- fixed a bug for repeated deletion and insertion in small ordereddict 
(found and fixed independently by Darren Dowker and Fabio Zadronzy. 
Darren's fix was more elegant (and included extra tests)).


Future direction:
- ordereddict will soon get a new home on the website of my company. 
The sources will then be cloneable and the package made avaialble via PyPi.
- A compatability layer for the new collections.OrderedDict in the 
standard library that passes all the OrderedDict tests has already been 
implemented and will be included in that release.



From the blurb on ordereddict's home-page:

This is an implementation of an ordered dictionary with Key Insertion Order
(KIO: updates of values do not affect the position of the key),
Key Value Insertion Order (KVIO, an existing key's position is removed 
and put at the back).


Sorted dictionaries are also provided. Currently only with Key Sorted Order
(KSO, no sorting function can be specified, but a transform function to
be applied on the key before comparison can be supplied).

It implementation is directly derived from dictobject.c and its speed is
5-10% slower than dict() and 5-9 times faster than Larosa/Foord
excellent pure Python implemention.

This module has been tested under:
   Ubuntu 12.04, gcc 4.6.3, Python 2.7.3
   Ubuntu 8.04, gcc 4.2.4, Python 2.6.4
   Ubuntu 8.04, gcc 4.2.4, Python 2.5.2
   Windows XP, Visual C++ 2008 Express, Python 2.7.3
   Windows XP, Visual C++ 2008 Express, Python 2.6.5

ordereddict's home on the web is at
http://anthon.home.xs4all.nl/Python/ordereddict
there you also find the links where the source can be downloaded.
The .zip file there included a precompiled .pyd file for Windows (Python 
2.7.3).






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

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


Re: How does python bytecode works?

2012-06-18 Thread Kushal Kumaran
On Mon, Jun 18, 2012 at 1:23 AM, Devin Jeanpierre
jeanpierr...@gmail.com wrote:
 On Sun, Jun 17, 2012 at 5:54 AM, gmspro gms...@yahoo.com wrote:

 We know python is written in C.
 C is not portable.

 Badly written C is not portable. But C is probably the most portable
 language on the planet, by virtue of basically every system having a C
 compiler backend.

 The issue is that a lot of people make nonportable assumptions about
 C, and runtimes / OSes / architectures are free to make lots of very
 weird decisions.

 For example, this code is not strictly universally-compatible C. It is
 portable in that the changes required to make it run on any system
 are trivial, but not in the sense that it should be able to compile
 without any changes. (Not unless a cheeky/smart compiler is involved,
 anyway).

 int main () {
    return 0;
 }

 Instead of 0, it should technically return EXIT_SUCCESS AIUI. Most
 people don't care because EXIT_SUCCESS is 0 almost everywhere.


In the interests of pedantry, I will point out that the C standard
requires implementation to treat both 0 and EXIT_SUCCESS to be treated
as successful exits.  The implementation must translate this to
whatever the environment treats as successful termination of the
program.  Ref: specification of the exit(int) function.

 So how does python work on a webserver like apache/httpd for a python
 website?
 How does the intermediate language communicate with server without
 compiling python code?

 Apache is written in C, and can embed CPython. This is easy enough,
 because CPython is written in C, and C works well with other C code.
 CPython itself can communicate with Python code, because it is
 directly responsible for running Python code. So the server
 communicates with CPython, and CPython communicates with the Python
 code. At no time does Python code ever directly touch anything other
 than the interpreter.


 The bytecode doesn't really have much to do with all this, except that
 it is the specific thing that CPython works with.


-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Academic citation of Python

2012-06-18 Thread Curt
On 2012-06-18, Ben Finney ben+pyt...@benfinney.id.au wrote:
 
  Actually it's van Rossum, Guido, not Rossum, Guido van. The
  van is part of the family name, not a middle name. It's like da
  Vinci, Leonardo or von Sydow, Max. On one occasion Guido
  complained that Americans always get his name wrong.

 I've read that now he prefers Guido V. Rossum, Jr.

 Citation needed.

Sorry:

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


Re: lazy evaluation of a variable

2012-06-18 Thread Terry Reedy

On 6/17/2012 5:35 PM, Gelonida N wrote:


I'm having a module, which should lazily evaluate one of it's variables.


If you literally mean a module object, that is not possible. On the 
other hand, it is easy to do with class instances, via the __getattr__ 
special method or via properties.



At the moment I don't know how to do this and do therefore following:
### mymodule.py ###
var = None

def get_var():
 global var
 if var is not None:
 return var
 var = something_time_consuming()



Now the importing code would look like

import mymodule
def f():
 var = mymodule.get_var()

The disadvantage is, that I had to change existing code directly
accessing the variable.



I wondered if there were any way to change mymodule.py such, that the
importing code could just access a variable and the lazy evaluation
would happen transparently.

import mymodule
def f():
 var = mymodule.var


You could now do (untested, too late at night)
# mymodule.py
class _Lazy():
  def __getattr__(self, name):
if name == 'var':
  self.var = something_time_consuming()
  return self.var

lazy = _Lazy()

# user script
from mymodule import lazy
def f():
  var = lazy.var

See Peter's post for using properties instead. That probably scales 
better for multiple lazy attibutes.


--
Terry Jan Reedy



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


post init call

2012-06-18 Thread Prashant
class Shape(object):
def __init__(self, shapename):
self.shapename = shapename


def update(self):
print update

class ColoredShape(Shape):
def __init__(self, color):
Shape.__init__(self, color)
self.color = color
print 1
print 2
print 3
self.update()

User can sub-class 'Shape' and create custom shapes. How ever user must call 
'self.update()' as the last argument when ever he is sub-classing 'Shape'.
I would like to know if it's possible to call 'self.update()' automatically 
after the __init__ of sub-class is done?

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


Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
What is input() supposed to return?

 u'a' == 'a'
True

 r1 = input(':')
:a
 r2 = input(':')
:u'a'
 r1 == r2
False
 type(r1), len(r1)
(class 'str', 1)
 type(r2), len(r2)
(class 'str', 4)


---

sys.argv?

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 1:19 AM, jmfauth wxjmfa...@gmail.com wrote:
 What is input() supposed to return?

 u'a' == 'a'
 True

 r1 = input(':')
 :a
 r2 = input(':')
 :u'a'
 r1 == r2
 False
 type(r1), len(r1)
 (class 'str', 1)
 type(r2), len(r2)
 (class 'str', 4)


 ---

 sys.argv?

 jmf

Python 3 made several backwards-incompatible changes over Python 2.
First of all, input() in Python 3 is equivalent to raw_input() in
Python 2. It always returns a string. If you want the equivalent of
Python 2's input(), eval the result. Second, Python 3 is now unicode
by default. The str class is a unicode string. There is a separate
bytes class, denoted by b, for byte strings. The u prefix is only
there to make it easier to port a codebase from Python 2 to Python 3.
It doesn't actually do anything.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: post init call

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 09:10, schrieb Prashant:
 class Shape(object):
 def __init__(self, shapename):
 self.shapename = shapename
 
 
 def update(self):
 print update
 
 class ColoredShape(Shape):
 def __init__(self, color):
 Shape.__init__(self, color)

Two things here:
1. You pass color as shapename to the baseclass' initialisation
function, which is a bit surprising.
2. You can use super(ColoredShape, self).__init__(color) or even
super(self).__init__(color).


 User can sub-class 'Shape' and create custom shapes. How ever user
 must call 'self.update()' as the last argument when ever he is
 sub-classing 'Shape'.
 I would like to know if it's possible to call 'self.update()'
 automatically after the __init__ of sub-class is done?

You might be able to, by hacking on the (meta?) class and how/when
things are constructed. I'm not sure how to approach that though.

What I would do is to use lazy initialisation, i.e. call update() when
it is actually needed. For that, you could create a decorator and put it
on all methods that require this initialisation.


Good luck!

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On 18 juin, 10:28, Benjamin Kaplan benjamin.kap...@case.edu wrote:
 On Mon, Jun 18, 2012 at 1:19 AM, jmfauth wxjmfa...@gmail.com wrote:
  What is input() supposed to return?

  u'a' == 'a'
  True

  r1 = input(':')
  :a
  r2 = input(':')
  :u'a'
  r1 == r2
  False
  type(r1), len(r1)
  (class 'str', 1)
  type(r2), len(r2)
  (class 'str', 4)

  ---

  sys.argv?

  jmf

 Python 3 made several backwards-incompatible changes over Python 2.
 First of all, input() in Python 3 is equivalent to raw_input() in
 Python 2. It always returns a string. If you want the equivalent of
 Python 2's input(), eval the result. Second, Python 3 is now unicode
 by default. The str class is a unicode string. There is a separate
 bytes class, denoted by b, for byte strings. The u prefix is only
 there to make it easier to port a codebase from Python 2 to Python 3.
 It doesn't actually do anything.


It does. I shew it!

Related:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/3aefd602507d2fbe#

http://mail.python.org/pipermail/python-dev/2012-June/120341.html

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2012 01:19:32 -0700, jmfauth wrote:

 What is input() supposed to return?

Whatever you type.

 u'a' == 'a'
 True

This demonstrates that in Python 3.3, u'a' gives a string equal to 'a'.

 r1 = input(':')
 :a

Since you typed the letter a, r1 is the string a (a single character).

 r2 = input(':')
 :u'a'

Since you typed four characters, namely lowercase u, single quote, 
lowercase a, single quote, r2 is the string u'a' (four characters).



 r1 == r2
 False
 type(r1), len(r1)
 (class 'str', 1)
 type(r2), len(r2)
 (class 'str', 4)

If you call print(r1) and print(r2), that will show you what they hold. 
If in doubt, calling print(repr(r1)) will show extra information about 
the object.


 sys.argv?

What about it?

 
 jmf

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote:

 On 18 juin, 10:28, Benjamin Kaplan benjamin.kap...@case.edu wrote:

 The u prefix is only there to
 make it easier to port a codebase from Python 2 to Python 3. It doesn't
 actually do anything.
 
 
 It does. I shew it!

Incorrect. You are assuming that Python 3 input eval's the input like 
Python 2 does. That is wrong. All you show is that the one-character 
string a is not equal to the four-character string u'a', which is 
hardly a surprise. You wouldn't expect the string 3 to equal the string 
int('3') would you?



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


Re: post init call

2012-06-18 Thread Thomas Rachel

Am 18.06.2012 09:10 schrieb Prashant:

class Shape(object):
 def __init__(self, shapename):
 self.shapename = shapename
 def update(self):
 print update

class ColoredShape(Shape):
 def __init__(self, color):
 Shape.__init__(self, color)
 self.color = color
 print 1
 print 2
 print 3
 self.update()

User can sub-class 'Shape' and create custom shapes. How ever user must call 
'self.update()' as the last argument when ever he is sub-classing 'Shape'.
I would like to know if it's possible to call 'self.update()' automatically 
after the __init__ of sub-class is done?

Cheers


I would construct it this way:

class Shape(object):
def __init__(self, *args):
self.args = args
self.init()
self.update()
# or: if self.init(): self.update()
def init(self):
return False # don't call update
def update(self):
print update
@propery
def shapename(self): return self.args[0]

class ColoredShape(Shape):
 def init(self):
 print 1, 2, 3
 self.update()
 return True
 @property
 def color(self): return self.args[1]


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


Re: post init call

2012-06-18 Thread Peter Otten
Prashant wrote:

 class Shape(object):
 def __init__(self, shapename):
 self.shapename = shapename
 
 
 def update(self):
 print update
 
 class ColoredShape(Shape):
 def __init__(self, color):
 Shape.__init__(self, color)
 self.color = color
 print 1
 print 2
 print 3
 self.update()
 
 User can sub-class 'Shape' and create custom shapes. How ever user must
 call 'self.update()' as the last argument when ever he is sub-classing
 'Shape'. I would like to know if it's possible to call 'self.update()'
 automatically after the __init__ of sub-class is done?

I don't think so. You could however shuffle things around a bit:

class Shape(object):
def __init__(self, shapename, *args, **kw):
self.shapename = shapename
self.init(*args, **kw)
self.update()
def init(self, *args, **kw):
pass
def update(self):
print update

In that constellation you would override init(), not __init__():

class ColoredShape(Shape):
def init(self, color, **kw):
self.color = color
print 1
print 2
print 3


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


Problem with ImapLib and subject in French

2012-06-18 Thread Valentin Mercier
Hi,

I'm trying to search some mails with SUBJECT criteria, but the problem is
the encoding, I'm trying to search french terms (impalib and python V2.7)

I've tried few things, but I think the encoding is the problem, in my mail
header I have something like this:

 =?iso-8859-1?Q?Job:_Full_Backup_Les_Gr=E8ves_du_Lac)_?=

I need to search unseen mail with the FROM and the SUBJECT criteria. I take
those two in parameters in my python script and the second contain special
caracters like é or è, so I encode the string like this:

 temp = header_encode(unicode('Les grèves','utf-8'),
charset='iso-8859-1')

And the string is exactly the same as the header:

=?iso-8859-1?q?Full_Backup_Les_Gr=E8ves?=

But the search function doesn't find my email, and I don't know why, even
if I try with the entire string of the subject.

I hope you can understand my question and my english (I'm from switzerland
so my english is not so good) and you can answer me.

Thanks in advance and best regards

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


module name vs '.'

2012-06-18 Thread Neal Becker
Am I correct that a module could never come from a file path with a '.' in the 
name?

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


Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:19 AM, Neal Becker wrote:
 Am I correct that a module could never come from a file path with a '.' in 
 the 
 name?


No.

Simple example: Create a directory called src.directory
In that directory, create two files

::neal.py::
import becker
print becker.__file__
print becker.hello()


::becker.py::
def hello():
print Inside hello
return returning


Then run neal.py, from that directory;


davea@think:~/temppython/src.directory$ python neal.py
/mnt/data/davea/temppython/src.directory/becker.pyc
Inside hello
returning
davea@think:~/temppython/src.directory$

Observe the results of printing __file__

Other approaches include putting a directory path containing a period
into sys.path



-- 

DaveA

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


Re: module name vs '.'

2012-06-18 Thread Neal Becker
I meant a module

src.directory contains
__init__.py
neal.py
becker.py

from src.directory import neal


On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel d...@davea.name wrote:

 On 06/18/2012 09:19 AM, Neal Becker wrote:
  Am I correct that a module could never come from a file path with a '.'
 in the
  name?
 

 No.

 Simple example: Create a directory called src.directory
 In that directory, create two files

 ::neal.py::
 import becker
 print becker.__file__
 print becker.hello()


 ::becker.py::
 def hello():
print Inside hello
return returning


 Then run neal.py, from that directory;


 davea@think:~/temppython/src.directory$ python neal.py
 /mnt/data/davea/temppython/src.directory/becker.pyc
 Inside hello
 returning
 davea@think:~/temppython/src.directory$

 Observe the results of printing __file__

 Other approaches include putting a directory path containing a period
 into sys.path



 --

 DaveA


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


Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:47 AM, Neal Becker wrote:
 I meant a module
 
 src.directory contains
 __init__.py
 neal.py
 becker.py
 
 from src.directory import neal
 
 
 On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel d...@davea.name wrote:
 
 On 06/18/2012 09:19 AM, Neal Becker wrote:
 Am I correct that a module could never come from a file path with a '.'
 in the
 name?


 No.

 Simple example: Create a directory called src.directory
 In that directory, create two files

 ::neal.py::
 import becker
 print becker.__file__
 print becker.hello()


 ::becker.py::
 def hello():
print Inside hello
return returning


 Then run neal.py, from that directory;


 davea@think:~/temppython/src.directory$ python neal.py
 /mnt/data/davea/temppython/src.directory/becker.pyc
 Inside hello
 returning
 davea@think:~/temppython/src.directory$

 Observe the results of printing __file__

 Other approaches include putting a directory path containing a period
 into sys.path



 --

 DaveA


 

In my example, becker.py is a module and I imported it.  If you're now
asking specifically about using the syntax

from src.directory import neal

that has nothing to do with periods being in a directory name.  That
period in the source code separates a package name from a module name,
and will not find a package named src.directory

-- 

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On 18 juin, 12:11, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
 On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote:
  On 18 juin, 10:28, Benjamin Kaplan benjamin.kap...@case.edu wrote:
  The u prefix is only there to
  make it easier to port a codebase from Python 2 to Python 3. It doesn't
  actually do anything.

  It does. I shew it!

 Incorrect. You are assuming that Python 3 input eval's the input like
 Python 2 does. That is wrong. All you show is that the one-character
 string a is not equal to the four-character string u'a', which is
 hardly a surprise. You wouldn't expect the string 3 to equal the string
 int('3') would you?

 --
 Steven


A string is a string, a piece of text, period.

I do not see why a unicode literal and an (well, I do not
know how the call it) a normal class str should behave
differently in code source or as an answer to an input().

Should a user write two derived functions?

input_for_entering_text()
and
input_if_you_are_entering_a_text_as_litteral()

---

Side effect from the unicode litteral reintroduction.
I do not mind about this, but I expect it does
work logically and correctly. And it does not.

PS English is not my native language. I never know
to reply to an (interro)-negative sentence.

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
Perhaps this will clear things up:

Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC
v.1600 64 bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
 ua = u'a'
 literal_ua = u'a'
 ua == literal_ua
False
 input_ua = input()
u'a'
 input_ua
u'a'
 input_ua == ua
False
 input_ua == literal_ua
True
 eval_ua = eval(literal_ua)
 eval_ua
'a'
 eval(literal_ua) == input_ua
False
 eval(literal_ua) == ua
True
 u'a' == 'a'
True
 u'a' is 'a'
True


-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 10:00 AM, jmfauth wrote:
 SNIP

 A string is a string, a piece of text, period. I do not see why a
 unicode literal and an (well, I do not know how the call it) a normal
 class str should behave differently in code source or as an answer
 to an input(). 

Wrong.  The rules for parsing source code are NOT applied in general to
Python 3's input data, nor to file I/O done with methods like
myfile.readline().  We do not expect the runtime code to look for def
statements, nor for class statements, and not for literals.  A literal
is a portion of source code where there are specific rules applied,
starting with the presence of some quote characters.

This is true of nearly all languages, and in most languages, the
difference is so obvious that the question seldom gets raised.  For
example, in C code a literal is evaluated at compile time, and by the
time an end user sees an input prompt, he probably doesn't even have a
compiler on the same machine.

When an end user types in his data (into an input statement, typically),
he does NOT use quote literals, he does not use hex escape codes, he
does not escape things with backslash.  If he wants an o with an umlaut
on it, he'd better have such a character available on his keyboard.

i'd suggest playing around a little with literal assignments and input
statements and print functions.  In those literals, try entering escape
sequences (eg. ab\x41cd)   Run such programs from the command line,
and observe the output from the prints.  Do this without using the
interactive interpreter, as by default it helpfully displays
expressions with the repr() function, which confuses the issue.


 Should a user write two derived functions? input_for_entering_text()
 and input_if_you_are_entering_a_text_as_litteral() --- Side effect
 from the unicode litteral reintroduction. I do not mind about this,
 but I expect it does work logically and correctly. And it does not. PS
 English is not my native language. I never know to reply to an
 (interro)-negative sentence. jmf 

The user doesn't write functions, the programmer does.  Until you learn
to distinguish between those two phases, you'll continue having this
confusion.

If you (the programmer) want a function that asks the user to enter a
literal at the input prompt, you'll have to write a post-processing for
it, which looks for prefixes, for quotes, for backslashes, etc., and
encodes the result.  There very well may be such a decoder in the Python
library, but input does nothing of the kind.


The literal modifiers (u  or r) are irrelevant here.  The problem
you're having is universal, and not new.  The characters in source code
have different semantic meanings than those entered in input, or read
from file I/O.


-- 

DaveA

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


Re: Problem with ImapLib and subject in French

2012-06-18 Thread Arnaud Delobelle
On 18 June 2012 12:31, Valentin Mercier merciervs...@gmail.com wrote:
 Hi,

 I'm trying to search some mails with SUBJECT criteria, but the problem is
 the encoding, I'm trying to search french terms (impalib and python V2.7)

 I've tried few things, but I think the encoding is the problem, in my mail
 header I have something like this:

  =?iso-8859-1?Q?Job:_Full_Backup_Les_Gr=E8ves_du_Lac)_?=

 I need to search unseen mail with the FROM and the SUBJECT criteria. I take
 those two in parameters in my python script and the second contain special
 caracters like é or è, so I encode the string like this:

              temp = header_encode(unicode('Les grèves','utf-8'),
 charset='iso-8859-1')

 And the string is exactly the same as the header:

 =?iso-8859-1?q?Full_Backup_Les_Gr=E8ves?=

 But the search function doesn't find my email, and I don't know why, even if
 I try with the entire string of the subject.

Can you post the code that doesn't work?  It's hard to debug search
function doesn't find my email.  It would be easier to debug actual
code (note: I'm not a user of imaplib so I'm not promising anything :)

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


Cross-platform mobile application written in Python

2012-06-18 Thread Alex Susu
Hello.

  I would like to point you to a project that I worked on lately: iCam, a
video surveillance cross-platform mobile application (Android, Symbian,
iOS, WinCE) written in Python, which uploads normally media to YouTube and
Picasa. The project can be found at
http://code.google.com/p/icam-mobile-revival/ (also at http://go.to/slog).

  I would be happy to answer questions related to the project and
appreciate if you can provide me feedback.

  With best regards,
Alex Susu
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 16:00, schrieb jmfauth:
 A string is a string, a piece of text, period.

No. There are different representations for the same piece of text even
in the context of just Python. b'fou', u'fou', 'fou' are three different
source code representations, resulting in two different runtime
representation and they all represent the same text: fou.


 I do not see why a unicode literal and an (well, I do not
 know how the call it) a normal class str should behave
 differently in code source or as an answer to an input().

input() retrieves a string from a user, not from a programmer that can
be expected to know the difference between b'\x81' and u'\u20ac'.


 Should a user write two derived functions?
 
 input_for_entering_text()
 and
 input_if_you_are_entering_a_text_as_litteral()

With user above, I guess you mean Python programmer. In that case,
the answer is yes. Although asking the user of your program to learn
about Python's string literal formatting options is a bit much.


 Side effect from the unicode litteral reintroduction.
 I do not mind about this, but I expect it does
 work logically and correctly. And it does not.

Yes it does. The user enters something. Python receives this and
provides it as string. You as a programmer are now supposed to
interpret, parse etc this string according to your program logic.


BTW: Just in case there is a language (native language, not programming
language) problem, don't hesitate to write in your native language, too.
Chances are good that someone here understands you.

Good luck!

Uli

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
Thinks are very clear to me. I wrote enough interactive
interpreters with all available toolkits for Windows
since I know Python (v. 1.5.6).

I do not see why the semantic may vary differently
in code source or in an interactive interpreter,
esp. if Python allow it!

If you have to know by advance what an end user
is supposed to type and/or check it ('str' or unicode
literal) in order to know if the answer has to be
evaluated or not, then it is better to reintroduce
input() and raw_input().

jmf

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Chris Angelico
On Tue, Jun 19, 2012 at 1:44 AM, jmfauth wxjmfa...@gmail.com wrote:
 I do not see why the semantic may vary differently
 in code source or in an interactive interpreter,
 esp. if Python allow it!

When you're asking for input, you usually aren't looking for code. It
doesn't matter about string literal formats, because you don't need to
delimit it. In code, you need to make it clear to the interpreter
where your string finishes, and that's traditionally done with quote
characters:

name = Chris Angelico   # this isn't part of the string, because the
two quotes mark off the ends of it

And you can include characters in your literals that you don't want in
your source code:

bad_chars = \x00\x1A\x0A# three characters NUL, SUB, LF

Everything about raw strings, Unicode literals, triple-quoted strings,
etc, etc, etc, is just variants on these two basic concepts. The
interpreter needs to know what you mean.

With input, though, the end of the string is defined in some other way
(such as by the user pushing Enter). The interpreter knows without any
extra hints where it's to stop parsing. Also, there's no need to
protect certain characters from getting into your code. It's a much
easier job for the interpreter, which translates to being much simpler
for the user: just type what you want and hit Enter. Quote characters
have no meaning.

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Jussi Piitulainen
jmfauth writes:

 Thinks are very clear to me. I wrote enough interactive
 interpreters with all available toolkits for Windows

 r = input()
u'a
Traceback (most recent call last):
  File stdin, line 1, in module
SyntaxError: u'a

Er, no, not really :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 11:32 AM, Jussi Piitulainen wrote:
 jmfauth writes:
 
 Thinks are very clear to me. I wrote enough interactive
 interpreters with all available toolkits for Windows
 
 r = input()
 u'a
 Traceback (most recent call last):
   File stdin, line 1, in module
 SyntaxError: u'a
 
 Er, no, not really :-)
 
You're using 2.x; this thread concerns 3.3, which, as has been repeated
several times, does not evaluate strings passed via input() like 2.x.
That code does not raise a SyntaxError in 3.x.

-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py3.3 unicode literal and input()

2012-06-18 Thread John Roth
On Monday, June 18, 2012 9:44:17 AM UTC-6, jmfauth wrote:
 Thinks are very clear to me. I wrote enough interactive
 interpreters with all available toolkits for Windows
 since I know Python (v. 1.5.6).
 
 I do not see why the semantic may vary differently
 in code source or in an interactive interpreter,
 esp. if Python allow it!
 
 If you have to know by advance what an end user
 is supposed to type and/or check it ('str' or unicode
 literal) in order to know if the answer has to be
 evaluated or not, then it is better to reintroduce
 input() and raw_input().
 

The change between Python 2.x and 3.x was made for security reasons. The 
developers felt, correctly in my opinion, that the simpler operation should not 
pose a security risk of a malicious user entering an expression that would 
corrupt the program.

In Python 3.x the equivalent of Python 2.x's input() function is eval(input()). 
It poses the same security risk: acting on unchecked user data.

John Roth


 jmf

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread David M Chess
 If you (the programmer) want a function that asks the user to enter a
 literal at the input prompt, you'll have to write a post-processing for
 it, which looks for prefixes, for quotes, for backslashes, etc., and
 encodes the result.  There very well may be such a decoder in the Python
 library, but input does nothing of the kind.

As it says at the end of eval() (which you definitely don't want to use 
here due to side effects):

See ast.literal_eval() for a function that can safely evaluate strings 
with expressions containing only literals. 

DC


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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
We are turning in circles. You are somehow
legitimating the reintroduction of unicode
literals and I shew, not to say proofed, it may
be a source of problems.

Typical Python desease. Introduce a problem,
then discuss how to solve it, but surely and
definitivly do not remove that problem.

As far as I know, Python 3.2 is working very
well.

jmf

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 12:55 PM, Andrew Berg wrote:
 On 6/18/2012 11:32 AM, Jussi Piitulainen wrote:
 jmfauth writes:

 Thinks are very clear to me. I wrote enough interactive
 interpreters with all available toolkits for Windows
 r = input()
 u'a
 Traceback (most recent call last):
   File stdin, line 1, in module
 SyntaxError: u'a

 Er, no, not really :-)

 You're using 2.x; this thread concerns 3.3, which, as has been repeated
 several times, does not evaluate strings passed via input() like 2.x.
 That code does not raise a SyntaxError in 3.x.


And you're missing the context. jmfauth thinks we should re-introduce
the input/raw-input distinction so he could parse literal strings.  So
Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams.



-- 

DaveA

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 12:03 PM, Dave Angel wrote:
 And you're missing the context. jmfauth thinks we should re-introduce
 the input/raw-input distinction so he could parse literal strings.  So
 Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams.

You're right. I missed that part of jmfauth's post.
-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Academic citation of Python

2012-06-18 Thread Ethan Furman

Ben Finney wrote:

Curt cu...@free.fr writes:


On 2012-06-16, Christian Heimes li...@cheimes.de wrote:

Actually it's van Rossum, Guido, not Rossum, Guido van. The
van is part of the family name, not a middle name. It's like da
Vinci, Leonardo or von Sydow, Max. On one occasion Guido
complained that Americans always get his name wrong.

I've read that now he prefers Guido V. Rossum, Jr.


Citation needed.


But what format should it take?

;)

~Ethan~

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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Jussi Piitulainen
Andrew Berg writes:
 On 6/18/2012 11:32 AM, Jussi Piitulainen wrote:
  jmfauth writes:
  
  Thinks are very clear to me. I wrote enough interactive
  interpreters with all available toolkits for Windows
  
  r = input()
  u'a
  Traceback (most recent call last):
File stdin, line 1, in module
  SyntaxError: u'a
  
  Er, no, not really :-)
  
 You're using 2.x; this thread concerns 3.3, which, as has been
 repeated several times, does not evaluate strings passed via input()
 like 2.x.  That code does not raise a SyntaxError in 3.x.

I used 3.1.2, and I really meant the not really. And the :-). I
edited out the command that raised the exception.

This thread is weird. If I didn't know that things are very clear to
jmfauth, I would think that the behaviour of input() that I observe
has absolutely nothing to do with the u'' syntax in source code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with ImapLib and subject in French

2012-06-18 Thread Dieter Maurer
Valentin Mercier merciervs...@gmail.com writes:

 I'm trying to search some mails with SUBJECT criteria, but the problem is the
 encoding, I'm trying to search french terms (impalib and python V2.7)

 I've tried few things, but I think the encoding is the problem, in my mail
 header I have something like this:

    =?iso-8859-1?Q?Job:_Full_Backup_Les_Gr=E8ves_du_Lac)_?=

I would expect that it is the task of the IMap server to handle the
header encoding on its side. Check the description of its search function
how it expects its input: does it want it header encoded or in some
other form.


--
Dieter

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


Re: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-18 Thread Duncan Booth
Dieter Maurer die...@handshake.de wrote:

 You can create a tuple in C and then put a reference to itself into
 it, but I am quite convinced that you cannot do it in Python itself.
 (Of course, you could use cython to generate C code with a source
 language very similar to Python).

I don't think you can even do it in C without breaking the specified API: 

PyTuple_SetItem fails if the reference count of the tuple is not 1, but it 
also steals the reference of the object that is being added to the tuple so 
if you don't increment the reference count before attempting to add the 
tuple to itself you've broken the rules for reference counting.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter binding question

2012-06-18 Thread Frederic Rentsch
Hi All,

  For most of an afternoon I've had that stuck-in-a-dead-end feeling 
probing to no avail all permutations formulating bindings, trying to 
make sense of manuals and tutorials. Here are my bindings:

   label_frame.bind ('Enter', self.color_selected)
   label_frame.bind ('Leave', self.color_selectable)
   label_frame.bind ('Button-1ButtonRelease-1', self.pick_record)
   label_frame.bind ('Button-3ButtonRelease-3', self.info_profile)

Enter and Leave work fine. But when I try to select an entered item, 
the moment I push the left or the right button, color_selectable ()
and color_selected () are called again in rapid succession. The same 
effect happens even when I push the middle mouse button which is 
rather weird, because it has no binding. The behavior suggests that 
no event can occur on an entered widget before it is left again and 
if an event other that Leave comes in, the Leave callback gets 
called automatically. That can't be right, though. It isn't possible 
to click an item without entering it. 
   I put traces in all of the four callbacks. So I know what gets
called an what doesn't. Traces are:

   On Enter:
  hit list.color_selected ()
   On Leave:
  hit list.color_selectable ()

Fine so far. 

   Enter:
  hit list.color_selected ()# Still fine
   Button-1 or Button-2 or Button-3:
  hit list.color_selectable ()  # Not so fine!
  hit list.color_selected ()
   ButtonRelease-1 (or -2 or -3)
  (nothing)


Thanks for any suggestion

Frederic


OS: Ubuntu 10.04 LTS
Python: sys.version: 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3]
Tkinter: VERSION 73770 (help (Tkinter), last line)



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


Re: Py3.3 unicode literal and input()

2012-06-18 Thread Terry Reedy

On 6/18/2012 12:39 PM, jmfauth wrote:

We are turning in circles.


You are, not we. Please stop.


You are somehow legitimating the reintroduction of unicode
literals


We are not 'reintroducing' unicode literals. In Python 3, string 
literals *are* unicode literals.


Other developers reintroduced a now meaningless 'u' prefix for the 
purpose of helping people write 23 code that runs on both Python 2 and 
Python 3. Read about it here http://python.org/dev/peps/pep-0414/


In Python 3.3, 'u' should *only* be used for that purpose and should be 
ignored by anyone not writing or editing 23 code. If you are not 
writing such code, ignore it.


 and I shew, not to say proofed, it may

be a source of problems.


You are the one making it be a problem.


Typical Python desease. Introduce a problem,
then discuss how to solve it, but surely and
definitivly do not remove that problem.


The simultaneous reintroduction of 'ur', but with a different meaning 
than in 2.7, *was* a problem and it should be removed in the next release.



As far as I know, Python 3.2 is working very
well.


Except that many public libraries that we would like to see ported to 
Python 3 have not been. The purpose of reintroducing 'u' is to encourage 
more porting of Python 2 code. Period.


--
Terry Jan Reedy



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


Re: module name vs '.'

2012-06-18 Thread Terry Reedy

On 6/18/2012 9:54 AM, Dave Angel wrote:

On 06/18/2012 09:47 AM, Neal Becker wrote:

I meant a module


You are correct that using periods in a module name conflicts with 
periods in import statement syntax.



from src.directory import neal

that has nothing to do with periods being in a directory name.  That
period in the source code separates a package name from a module name,
and will not find a package named src.directory


So one would have to *not* use import statement syntax, but use lower 
level facilities, such as importlib or (untested)


neal = __import__('src.directory', other args)

Conclusion: putting periods in the name of module files (including 
directories) except for .py- extensions, is generally a bad idea.


--
Terry Jan Reedy



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


Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Andrew Berg
Are there any tools out there that will parse a script and tell me if it
is compatible with an arbitrary version of Python and highlight any
incompatibilities? I need to check a few of my scripts that target 3.2
to see if I can make them compatible with 3.0 and 3.1 if they aren't
already. I found pyqver, but it isn't accurate (at least for 3.2/3.3
scripts) and hasn't been updated in 2 years. I could look over the docs
and do it manually, but one of the scripts isn't small, so I'd prefer
not to.
-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On Jun 18, 8:45 pm, Terry Reedy tjre...@udel.edu wrote:
 On 6/18/2012 12:39 PM, jmfauth wrote:

  We are turning in circles.

 You are, not we. Please stop.

  You are somehow legitimating the reintroduction of unicode
  literals

 We are not 'reintroducing' unicode literals. In Python 3, string
 literals *are* unicode literals.

 Other developers reintroduced a now meaningless 'u' prefix for the
 purpose of helping people write 23 code that runs on both Python 2 and
 Python 3. Read about it herehttp://python.org/dev/peps/pep-0414/

 In Python 3.3, 'u' should *only* be used for that purpose and should be
 ignored by anyone not writing or editing 23 code. If you are not
 writing such code, ignore it.

   and I shew, not to say proofed, it may

  be a source of problems.

 You are the one making it be a problem.

  Typical Python desease. Introduce a problem,
  then discuss how to solve it, but surely and
  definitivly do not remove that problem.

 The simultaneous reintroduction of 'ur', but with a different meaning
 than in 2.7, *was* a problem and it should be removed in the next release.

  As far as I know, Python 3.2 is working very
  well.

 Except that many public libraries that we would like to see ported to
 Python 3 have not been. The purpose of reintroducing 'u' is to encourage
 more porting of Python 2 code. Period.

 --
 Terry Jan Reedy

It's a matter of perspective. I expected to have
finally a clean Python, the goal is missed.

I have nothing to object. It is your (core devs)
project, not mine. At least, you understood my point
of view.

I'm a more than two decades TeX user. At the release
of XeTeX (a pure unicode TeX-engine), the devs had,
like Python2/3, to make anything incompatible. A success.
It did not happen a week without seeing a updated
package or a refreshed documentation.

Luckily for me, Xe(La)TeX is more important than
Python.

As a scientist, Python is perfect.
From an educational point of view, I'm becoming
more and more skeptical about this language, a
moving target.

Note that I'm not complaining, only desappointed.

jmf

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


Re: python 3.3 bz2 decompression testing results

2012-06-18 Thread Nadeem Vawda
Hi Pauli,

Thank you for your interest in improving the bz2 module. However, I'm
not sure of what you are saying in your email.

If you believe you have found a bug in the module, then please provide
clear instructions on how to reproduce the error(s), preferably using
just one data file that triggers the problem.

About Valgrind and Linux, I would be happy to fix up any memory leaks
you find. However, bear in mind that running CPython under Valgrind
produces quite a number of warnings even without doing anything with
the bz2 module, so interpreting its output will be take a substantial
amount of effort.

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


Conditional decoration

2012-06-18 Thread Roy Smith
Is there any way to conditionally apply a decorator to a function?
For example, in django, I want to be able to control, via a run-time
config flag, if a view gets decorated with @login_required().

@login_required()
def my_view(request):
pass
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Conditional decoration

2012-06-18 Thread Jeremiah Dodds
r...@panix.com (Roy Smith) writes:

 Is there any way to conditionally apply a decorator to a function?
 For example, in django, I want to be able to control, via a run-time
 config flag, if a view gets decorated with @login_required().

 @login_required()
 def my_view(request):
 pass

You could write a decorator that takes the value of the flag and either
does nothing or decorates it's target function.

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


Re: Conditional decoration

2012-06-18 Thread MRAB

On 18/06/2012 23:16, Roy Smith wrote:

Is there any way to conditionally apply a decorator to a function?
For example, in django, I want to be able to control, via a run-time
config flag, if a view gets decorated with @login_required().

@login_required()
def my_view(request):
 pass


A decorator is just syntactic sugar for function application after the
definition.

This:

@deco
def func():
pass

is just another way of writing:

def func():
pass
func = deco(func)

Not as neat, but you can make it conditional.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Conditional decoration

2012-06-18 Thread Emile van Sebille

On 6/18/2012 3:16 PM Roy Smith said...

Is there any way to conditionally apply a decorator to a function?
For example, in django, I want to be able to control, via a run-time
config flag, if a view gets decorated with @login_required().

@login_required()
def my_view(request):
 pass



class myDecorator(object):
def __init__(self, f):
self.f = f
def __call__(self):
print Entering, self.f.__name__
self.f()
print Exited, self.f.__name__


def null(a): return a


#if condition:
myDecorator = null


@myDecorator
def aFunction():
print aFunction running

aFunction()


Cobbled together from http://www.chrisevans3d.com/pub_blog/?p=530 and 
http://stackoverflow.com/questions/3687046/python-sphinx-autodoc-and-decorated-members


HTH

Emile

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


Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
I tried this:

Python 3.2.2 (default, Feb 24 2012, 20:07:04)
[GCC 4.6.1] on linux2
Type help, copyright, credits or license for more information.
 import sys
 import io
 fh = io.open(sys.stdin)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid file: _io.TextIOWrapper name='stdin' mode='r'
encoding='UTF-8'
 fh = io.open(sys.stdin, rb)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid file: _io.TextIOWrapper name='stdin' mode='r'
encoding='UTF-8'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lazy evaluation of a variable

2012-06-18 Thread Gelonida N

On 06/17/2012 11:35 PM, Gelonida N wrote:

Hi,

I'm not sure whether what I ask for is impossible, but would know how
others handle such situations.



I'm having a module, which should lazily evaluate one of it's variables.
Meaning that it is evaluated only if anybody tries to use this variable.

At the moment I don't know how to do this and do therefore following:


### mymodule.py ###
var = None

def get_var():
global var
if var is not None:
return var
var = something_time_consuming()



Now the importing code would look like

import mymodule
def f():
var = mymodule.get_var()

The disadvantage is, that I had to change existing code directly
accessing the variable.


I wondered if there were any way to change mymodule.py such, that the
importing code could just access a variable and the lazy evaluation
would happen transparently.

import mymodule
def f():
var = mymodule.var


Thanks everybody for your responses. This gave me quite some ideas.

It seems, that none of the solutions would allow to have the changes 
only in the module.


More out of curiosity than out of real necessity I wanted to know, 
whether it would be possible to hide the lazy evaluation from already 
existing code, that has already the import statement written.

So the question basically boiled down to
can one make 'properties' for modules?

It seems no.
Probably there aren't many real use cases except for monkey patching 
libraries or for logging accesses to a module's variable



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


Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 4:13 PM, Jason Friedman ja...@powerpull.net wrote:
 I tried this:

 Python 3.2.2 (default, Feb 24 2012, 20:07:04)
 [GCC 4.6.1] on linux2
 Type help, copyright, credits or license for more information.
 import sys
 import io
 fh = io.open(sys.stdin)
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: invalid file: _io.TextIOWrapper name='stdin' mode='r'
 encoding='UTF-8'
 fh = io.open(sys.stdin, rb)
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: invalid file: _io.TextIOWrapper name='stdin' mode='r'
 encoding='UTF-8'
 --

You want to read from sys.stdin.buffer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Christian Heimes
Am 19.06.2012 01:13, schrieb Jason Friedman:
 I tried this:

sys.stdin wraps a buffered reader which itself wraps a raw file reader.

 sys.stdin
_io.TextIOWrapper name='stdin' mode='r' encoding='UTF-8'
 sys.stdin.buffer
_io.BufferedReader name='stdin'
 sys.stdin.buffer.raw
_io.FileIO name='stdin' mode='rb'

You should read from sys.stdin.buffer unless you really need the bare
metal.

Christian

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


Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
 sys.stdin wraps a buffered reader which itself wraps a raw file reader.

 sys.stdin
 _io.TextIOWrapper name='stdin' mode='r' encoding='UTF-8'
 sys.stdin.buffer
 _io.BufferedReader name='stdin'
 sys.stdin.buffer.raw
 _io.FileIO name='stdin' mode='rb'

 You should read from sys.stdin.buffer unless you really need the bare
 metal.


Thank you, and just to close the loop:

$ cat ~/my-input.py
#!/opt/python/bin/python3
import sys
print(sys.stdin.buffer.read())

$ echo hello | ~/my-input.py
b'hello\n'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
Which leads me to another question ... how can I debug these things?

$ echo 'hello' | python3 -m pdb ~/my-input.py
 /home/jason/my-input.py(2)module()
- import sys
(Pdb) *** NameError: name 'hello' is not defined
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Conditional decoration

2012-06-18 Thread Devin Jeanpierre
On Mon, Jun 18, 2012 at 6:49 PM, Emile van Sebille em...@fenx.com wrote:
 On 6/18/2012 3:16 PM Roy Smith said...
 class myDecorator(object):
    def __init__(self, f):
        self.f = f
    def __call__(self):
        print Entering, self.f.__name__
        self.f()
        print Exited, self.f.__name__

I dunno about other people, but I generally avoid class decorators
because they do not behave the way functions do when applied as a
decorator for a method.

This is a decorator taken out of some of my own source code. I was
mostly dicking around with things, as opposed to actually coding. The
docstring was even more ridiculous.

from functools import reduce

def rapply(*args):
apply(f, ...) - rapply(..., f)
return args[-1](*args[:-1])

def condecorator(condition, *decorators):
if condition:
return lambda f: reduce(rapply, reversed(decorators), f)
else:
return lambda f: f

Example usage:

@condecorator(condition,
   decorator1,
   decorator2)
def decorated(...):
...

equivalent to:

def decorated(...):
...

if condition:
decorated = decorator1(decorator2(decorated))

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


Re: Conditional decoration

2012-06-18 Thread Rob Williscroft
Roy Smith wrote in news:jro9cj$b44$1...@panix2.panix.com in 
gmane.comp.python.general:

 Is there any way to conditionally apply a decorator to a function?
 For example, in django, I want to be able to control, via a run-time
 config flag, if a view gets decorated with @login_required().
 
 @login_required()
 def my_view(request):
 pass

You need to create a decorator that calls either the original
function or the decorated funtion, depending on your condition, 
Something like (untested):

def conditional_login_required( f ):
  _login_required = login_required()(f)
  
  def decorated( request ):
if condition == use-login:
  return _login_required( request )
else:
  return f( request )
  
  return decorated

@conditional_login_required
def my_view(request):
  pass

Replace (condition == use-login) with whatever your run-time 
control flag is.

-- 
Rob.



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


Re: Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Terry Reedy

On 6/18/2012 3:24 PM, Andrew Berg wrote:

Are there any tools out there that will parse a script and tell me if it
is compatible with an arbitrary version of Python and highlight any


Not that I know of.


incompatibilities? I need to check a few of my scripts that target 3.2
to see if I can make them compatible with 3.0 and 3.1 if they aren't
already.


Forget about 3.0. Really. As for 3.1 versus 3.2, there were no core 
syntax changes in 3.2. There were a few, but only a few, enhancements in 
builtin classes. If you have a decent test suite, just run it under 3.1.




--
Terry Jan Reedy



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


constant sharing works differently in REPL than in script ?

2012-06-18 Thread shearichard
Listening to 'Radio Free Python' episode 8 
(http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) I 
heard that Python pre creates some integer constants to avoid a proliferation 
of objects with the same value.

I was interested in this and so I decided to try it out.

First I did this at the prompt :

 c = 1
 print id(1)
26906152
 print id(c)
26906152
 c is 1
True

So that matched what I'd heard and then I did this to test the limits of it :

 c = 259
 print id(259)
26167488
 print id(c)
26167512
 c is 259
False

And that was reasonable too as the podcast mentioned it was only done for a 
small set of integers around zero.

However when I wrote this script :

c = 259
print id(259)
print id(c)
if c is 259:
print %s - yes % (c)
else:
print %s - no  % (c)

I got this output :

C:\data\src\Python\foopython untitled-2.py
26760884
26760884
259 - yes

So what's going on here. The script seems to be sharing objects in a way the 
REPL isn't ?

Can anyone explain please ?

BTW this is all on : Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC 
v.1500 32 bit (Intel)] on win32 .




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


Re: Tkinter binding question

2012-06-18 Thread rantingrickjohnson
On Monday, June 18, 2012 1:21:02 PM UTC-5, Frederic Rentsch wrote:
 Hi All,
 
   For most of an afternoon I've had that stuck-in-a-dead-end feeling 
 probing to no avail all permutations formulating bindings, trying to 
 make sense of manuals and tutorials. Here are my bindings:
 
label_frame.bind ('Enter', self.color_selected)
label_frame.bind ('Leave', self.color_selectable)
label_frame.bind ('Button-1ButtonRelease-1', self.pick_record)
label_frame.bind ('Button-3ButtonRelease-3', self.info_profile)

This example is useless to me. As a matter of fact, your whole explanation of 
the problem is ambitious at best. But you do realize that by binding both the 
click and release of a mouse button to the same callback you will call the 
callback twice? 

Try to create a simplistic and generic example of the problem. Most times 
you'll find the flaw. Most code should start as template that prints messages 
to stdout. Large applications are built by taking babysteps. Not by jumping out 
the fire and into the frying pan! 

WARNING: Debugging large chucks of spaghetti code is bad for your brain! Tip of 
the day: DIVIDE AND CONQUER!

## START CODE ##
from __future__ import print_function
import Tkinter as tk
root = tk.Tk()
root.geometry('200x200+20+20')
root.bind(Enter, lambda e:print(Enter))
root.bind(Leave, lambda e:print(Leave))
root.bind(ButtonRelease-1,
  lambda e:print(ButtonOneRelease))
root.bind(ButtonRelease-3,
  lambda e:print(ButtonThreeRelease))
root.mainloop()
## END CODE ##

Q1: Now, what exactly is the problem? Hmm???
Q2: Can you modify this code to correct the problem? Hmm???
Q3: Why are there so many inconsistencies in the Tkinter API? Hmm???

Tip: NEVER bind ButtonClick to trigger a callback (ESPECIALLY FOR A BUTTON 
CALLBACK!!!). ONLY bind ButtonRelease. Why?  Well because if the user 
accidentally clicks the button, he can move his pointer beyond the boundaries 
of the button and then release the mouse button WITHOUT triggering the 
callback. All good GUI coders follow this design pattern. (Except in certain 
cases where you want a mouse click to trigger an action quickly; like a Listbox 
item or menu, or whatever.)

if GUI.ergonomics  optimal:
raise NeophyteError(Do not pass GUI. Do not collect 100 dollars!)

 Enter and Leave work fine. But when I try to select an entered item, 
 the moment I push the left or the right button, color_selectable ()
 and color_selected () are called again in rapid succession. 

That does not make sense. Are you calling the method w.update() anywhere in 
the callback; or as a consequence of the callback?

 The same 
 effect happens even when I push the middle mouse button which is 
 rather weird, because it has no binding. 

Not necessarily. Many of the Tk widgets come prepackaged with annoying little 
default bindings that would the test the patience of a saint. Like, for 
example, the Tkinter.Text widget. It has a nasty little default binding to 
paste the cut buffer contents when you press MouseButtonTwo. And since it also 
has a default binding of using MouseButtonTwo+MouseMotion to scroll vertically, 
you find yourself inserting cut buffers everywhere!

 The behavior suggests that 
 no event can occur on an entered widget before it is left again and 
 if an event other that Leave comes in, the Leave callback gets 
 called automatically. That can't be right, though. It isn't possible 
 to click an item without entering it. 

Interesting observation. I would say your code is too complicated to properly 
debug. You need to divide and conquer this spaghetti mess.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lazy evaluation of a variable

2012-06-18 Thread rantingrickjohnson
On Sunday, June 17, 2012 6:01:03 PM UTC-5, Steven D#39;Aprano wrote:

 One day, in my Copious Spare Time, I intend to write a proper feature 
 request and/or PEP for such a feature. Obviously the absolute earliest 
 such a feature could be introduced is Python 3.4, about 18 months from 
 now. (Although frankly, I would imagine significant opposition from the 
 more conservative Python developers.)

Well these conservatives must have been suffering from chronic mononucleosis 
because i have never heard a peep from them! I wish they would grow a pair 
and speak up a bit more often because the language would benefit greatly from 
some austerity measures, strong leadership, and most of all; some Gawd damned 
consistency!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: constant sharing works differently in REPL than in script ?

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 7:52 PM,  shearich...@gmail.com wrote:
 Listening to 'Radio Free Python' episode 8 
 (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) I 
 heard that Python pre creates some integer constants to avoid a proliferation 
 of objects with the same value.

 I was interested in this and so I decided to try it out.

 First I did this at the prompt :

 c = 1
 print id(1)
 26906152
 print id(c)
 26906152
 c is 1
 True

 So that matched what I'd heard and then I did this to test the limits of it :

 c = 259
 print id(259)
 26167488
 print id(c)
 26167512
 c is 259
 False

 And that was reasonable too as the podcast mentioned it was only done for a 
 small set of integers around zero.

 However when I wrote this script :

 c = 259
 print id(259)
 print id(c)
 if c is 259:
    print %s - yes % (c)
 else:
    print %s - no  % (c)

 I got this output :

 C:\data\src\Python\foopython untitled-2.py
 26760884
 26760884
 259 - yes

 So what's going on here. The script seems to be sharing objects in a way the 
 REPL isn't ?

 Can anyone explain please ?

 BTW this is all on : Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC 
 v.1500 32 bit (Intel)] on win32 .


Python the language doesn't specify anything about this sort of
behavior. CPython the implementation does all sorts of optimizations
to make code run more efficiently. Caching integers is one of those
optimizations. In the case where the code is compiled all at once (as
in the script) instead of one line at a time (the REPL), it can do
more optimizations. But as I said, none of this is in the
specification so you shouldn't rely on it. The general rule for the
is operator is that unless you specifically know that you need it,
don't use it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Pymongo Error

2012-06-18 Thread Ranjith Kumar
Hi all,
I tried Django with Mongodb while running manage.py syncdb I endup with
this error

note : it works fine with sqlite and mysql db

(django-1.3)ranjith@ranjith:~/
sandbox/python-box/hukkster-core-site/hukk$ ./manage.py syncdb
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/pymongo/connection.py:385:
UserWarning: must provide a username and password to authenticate to
hukkster_testing
  to authenticate to %s % (db,))
Creating tables ...
Traceback (most recent call last):
  File ./manage.py, line 14, in module
execute_manager(settings)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/__init__.py,
line 438, in execute_manager
utility.execute()
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/__init__.py,
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
line 220, in execute
output = self.handle(*args, **options)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
line 351, in handle
return self.handle_noargs(**options)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py,
line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/sql.py,
line 190, in emit_post_sync_signal
interactive=interactive, db=db)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py,
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py,
line 41, in create_permissions
content_type, codename
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
line 107, in _result_iter
self._fill_cache()
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
line 772, in _fill_cache
self._result_cache.append(self._iter.next())
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
line 959, in iterator
for row in self.query.get_compiler(self.db).results_iter():
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
line 229, in results_iter
for entity in self.build_query(fields).fetch(low_mark, high_mark):
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
line 290, in build_query
query.order_by(self._get_ordering())
  File
/home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
line 339, in _get_ordering
raise DatabaseError(Ordering can't span tables on non-relational
backends (%s) % order)
django.db.utils.DatabaseError: Ordering can't span tables on non-relational
backends (content_type__app_label)


DB settings in settings.py

DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'helloworld',
'USER': 'user123',
'PASSWORD': '12424214',
'HOST': 'mongodb://staff.mongohq.com/db-name',
'PORT': 'X',
},
}

my requirement packages,
Django==1.3
dictshield==0.4.4
django-mongodb-engine==0.4.0
django-social-auth==0.6.9
djangotoolbox==0.0.1
httplib2==0.7.4
mongoengine==0.6.10
mongokit==0.8
oauth2==1.5.211
pymongo==2.2
python-openid==2.2.5
simplejson==2.5.2
wsgiref==0.1.2

Please point me what i missed here...

-- 
Cheers,
Ranjith Kumar K,
Chennai.

http://ranjithtenz.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [chennaipy 1376] Pymongo Error

2012-06-18 Thread Ramesh Seshadri
Are you using django-nonrel or basic django version?

Check out  http://www.allbuttonspressed.com/projects/django-nonrel

cheers
Ramesh

On Tue, Jun 19, 2012 at 10:52 AM, Ranjith Kumar ranjitht...@gmail.comwrote:

 Hi all,
 I tried Django with Mongodb while running manage.py syncdb I endup with
 this error

 note : it works fine with sqlite and mysql db

 (django-1.3)ranjith@ranjith:~/
 sandbox/python-box/hukkster-core-site/hukk$ ./manage.py syncdb
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/pymongo/connection.py:385:
 UserWarning: must provide a username and password to authenticate to
 hukkster_testing
   to authenticate to %s % (db,))
 Creating tables ...
 Traceback (most recent call last):
   File ./manage.py, line 14, in module
 execute_manager(settings)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/__init__.py,
 line 438, in execute_manager
 utility.execute()
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/__init__.py,
 line 379, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
 line 191, in run_from_argv
 self.execute(*args, **options.__dict__)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
 line 220, in execute
 output = self.handle(*args, **options)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/base.py,
 line 351, in handle
 return self.handle_noargs(**options)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py,
 line 109, in handle_noargs
 emit_post_sync_signal(created_models, verbosity, interactive, db)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/core/management/sql.py,
 line 190, in emit_post_sync_signal
 interactive=interactive, db=db)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py,
 line 172, in send
 response = receiver(signal=self, sender=sender, **named)
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py,
 line 41, in create_permissions
 content_type, codename
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
 line 107, in _result_iter
 self._fill_cache()
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
 line 772, in _fill_cache
 self._result_cache.append(self._iter.next())
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/django/db/models/query.py,
 line 959, in iterator
 for row in self.query.get_compiler(self.db).results_iter():
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
 line 229, in results_iter
 for entity in self.build_query(fields).fetch(low_mark, high_mark):
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
 line 290, in build_query
 query.order_by(self._get_ordering())
   File
 /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py,
 line 339, in _get_ordering
 raise DatabaseError(Ordering can't span tables on non-relational
 backends (%s) % order)
 django.db.utils.DatabaseError: Ordering can't span tables on
 non-relational backends (content_type__app_label)


 DB settings in settings.py

 DATABASES = {
 'default': {
 'ENGINE': 'django_mongodb_engine',
 'NAME': 'helloworld',
 'USER': 'user123',
 'PASSWORD': '12424214',
 'HOST': 'mongodb://staff.mongohq.com/db-name',
 'PORT': 'X',
 },
 }

 my requirement packages,
 Django==1.3
 dictshield==0.4.4
 django-mongodb-engine==0.4.0
 django-social-auth==0.6.9
 djangotoolbox==0.0.1
 httplib2==0.7.4
 mongoengine==0.6.10
 mongokit==0.8
 oauth2==1.5.211
 pymongo==2.2
 python-openid==2.2.5
 simplejson==2.5.2
 wsgiref==0.1.2

 Please point me what i missed here...

 --
 Cheers,
 Ranjith Kumar K,
 Chennai.

 http://ranjithtenz.wordpress.com



  --
 You received this message because you are subscribed to the Google Groups
 Chennaipy group.
 Wiki at http://nrcfosshelpline.in/chennaipy/
 To post to this group, send email to chenna...@googlegroups.com
 To unsubscribe from this group, send email to
 chennaipy-unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/chennaipy?hl=en
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue14814] Implement PEP 3144 (the ipaddress module)

2012-06-18 Thread Terry J. Reedy

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

 the interfaces of the v4 and v6 variants are deliberately very similar

I am hoping that means 'identical, once the obvious translations are made': v4 
to v6, xxx.xxx.xxx.xxx to whatever the v6 notation is, and anything else?

 documenting everything twice seems like a rather user hostile thing to do.

Agreed. Please factor out common stuff. I see two choices.

1. Document in parallel after an intro explaining the translations

4(args)
6(args)
Return ... (either in 4 terms which user translate for 6 or generic terms).

# This might be better if you expect people to be doing one type of thing with 
both v4 and v6.


2. Document serially, first v4 stuff then v6 stuff (at present, though order 
might be reversed in the future ;-).

v4 stuff
---
4(args)
Return ...

v6 stuff
---
The following v6 functions are the same as the v4 functions above, except that 
ipv4address'es become ipv6address'es etc.
6(args)

# This might be better if you expect people to be doing multiple things with 
either v4 or v6, but not both.

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-06-18 Thread Nick Coghlan

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

My current thoughts are to avoid the usual approach of embedding the method and 
property definitions in the class definitions, and instead have separate 
sections under [1] for

IP Addresses
IP Interfaces
IP Networks

Inside each of those sections, document the constructors directly under the 
section heading, and then separate out these subsections:

Common IP kind properties and methods
IPv4 kind properties and methods (if any)
IPv6 kind properties and methods (if any)

[1] 
http://docs.python.org/dev/library/ipaddress#representing-ip-addresses-and-networks

--

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



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

2012-06-18 Thread Hynek Schlawack

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

Martin, what exactly is the intended proceeding now? Are you going to fix your 
patch and tests as soon as you have time or was that just a PoC and expect 
me/us to bring it into shape? (- troll-free question, I have no idea what to 
do next here and would like to see a safe rmtree in 3.3)

--

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



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-18 Thread Roundup Robot

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

New changeset 8b38a81ba3bf by Petri Lehtinen in branch '2.7':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/8b38a81ba3bf

New changeset 38e2a87c9051 by Petri Lehtinen in branch '3.2':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/38e2a87c9051

New changeset 072b08989731 by Petri Lehtinen in branch 'default':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/072b08989731

--

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



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-18 Thread Petri Lehtinen

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

Perfect, fixed.

--

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



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

2012-06-18 Thread Martin v . Löwis

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

 Martin, what exactly is the intended proceeding now? Are you going to
 fix your patch and tests as soon as you have time or was that just a
 PoC and expect me/us to bring it into shape? (- troll-free question,
 I have no idea what to do next here and would like to see a safe
 rmtree in 3.3)

I still plan to work on this, but I'm also really really short on time.
I still favor my own approach (obviously), so if you want to bring it
into shape - that would be appreciated.

--

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



[issue9559] mailbox.mbox creates new file when adding message to mbox

2012-06-18 Thread Petri Lehtinen

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

This is actually not true. When calling add(), mbox (and MMDF and Babyl) append 
the message to the file without rewriting it.

It's the following flush() call that rewrites the whole mailbox contents. I 
think this could be changed to work correctly by not setting self._pending = 
True in _singlefileMailbox.add. This way, the file wouldn't be rewritten by 
flush() if messages are only appended.

OTOH, flush() should still fsync the mailbox file (if we want to ensure that 
the changes are really written to disk). This would probably require a new flag 
in addition to self._pending, to indicate that there are unsynced changes.

--
nosy: +petri.lehtinen

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



[issue3665] Support \u and \U escapes in regexes

2012-06-18 Thread Serhiy Storchaka

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

I forgot about byte patterns. Here is an updated patch.

--
Added file: http://bugs.python.org/file26040/re_unicode_escapes-3.patch

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



[issue1590744] mail message parsing glitch

2012-06-18 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread John Firestone

New submission from John Firestone jo...@freenet.de:

exec(source, Dict()) doesn't call Dict().__getitem__ or Dict().__missing__ if 
the source string contains a function and the function references an undefined 
global.

class Dict1(dict):
def __getitem__(self, key):
print '__getitem__', repr(key)
if key == 's':
return None
return dict.__getitem__(self, key)

class Dict2(dict):
def __missing__(self, key):
print '__missing__', repr(key)
return None

source = if 1:
print '  1'
s
def f():
print '  2'
s
print '  3'
f()

print 'Dict1.__getitem__'
try:
exec(source, Dict1())
except NameError as exc_value:
print '  %s: %s' % (exc_value.__class__.__name__, exc_value)

print 'Dict2.__missing__'
try:
exec(source, Dict2())
except NameError as exc_value:
print '%s: %s' % (exc_value.__class__.__name__, exc_value)


Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:32:06) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
 import curiosity
Dict1.__getitem__
  1
__getitem__ 's'
__getitem__ 'f'
  2
NameError: global name 's' is not defined
Dict2.__missing__
  1
__missing__ 's'
  2
NameError: global name 's' is not defined


--
components: Interpreter Core
files: curiosity.py
messages: 163095
nosy: johnf
priority: normal
severity: normal
status: open
title: exec of function doesn't call __getitem__ or __missing__ on undefined 
global
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file26041/curiosity.py

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



[issue15100] Race conditions in shutil.copy, shutil.copy2 and shutil.copyfile

2012-06-18 Thread Radoslaw A. Zarzynski

New submission from Radoslaw A. Zarzynski 
radoslaw.zarzyn...@student.put.poznan.pl:

shutil.copy and shutil.copy2 first copy a file content and afterwards
change permissions of a destination file. Unfortunately, the sequence isn't 
atomical and may lead to disclosure of matter of any file that is being 
duplicated.

Additionally, shutil.copyfile procedure seems to have a problem with symlinks 
that could result in the corruption of content of any file on filesystem (in 
favorable conditions).

Some functions from shutil module that depend on copy[2] (and thus copyfile) 
are vulnerable too.
For example, shutil.move is using copy2 when os.rename fails because of file 
transfer between filesystems.

I have attached listing from strace(1) system utility below that illustrates 
the disclosure problem.

# ls -l ./shutil_test
-r 1 root root 10 06-18 11:42 shutil_test

# strace -- python -c import shutil; shutil.move('./shutil_test', '/tmp')
many irrelevant lines
open(./shutil_test, O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0400, st_size=10, ...}) = 0
open(/tmp/shutil_test, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0400, st_size=10, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fd82e13e000
read(3, blablabla\n, 16384)   = 10
read(3, , 12288)  = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fd82e13d000
read(3, , 16384)  = 0
write(4, blablabla\n, 10) = 10
close(4)= 0
munmap(0x7fd82e13d000, 4096)= 0
close(3)= 0
munmap(0x7fd82e13e000, 4096)= 0
stat(./shutil_test, {st_mode=S_IFREG|0400, st_size=10, ...}) = 0
utimes(/tmp/shutil_test, {{1340012952, 0}, {1340012539, 0}}) = 0
chmod(/tmp/shutil_test, 0400) = 0

Quick fix for the first issue could rely on os.umask but much more elegant and 
composite solution might use combination of os.open, os.fchmod and os.fdopen 
instead of open(dst, 'wb') in shutil.copyfile procedure which additionally 
rectifies the problem with symlink attack.
However, I am not sure that the last one is portable and won't mess with 
another code.
I have prepared *untested* patches for both propositions.

Best regards,
Radoslaw A. Zarzynski

--
components: Library (Lib)
files: python_shutil_copyfile.diff
keywords: patch
messages: 163096
nosy: radoslaw.zarzynski
priority: normal
severity: normal
status: open
title: Race conditions in shutil.copy, shutil.copy2 and shutil.copyfile
type: security
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file26042/python_shutil_copyfile.diff

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



[issue15100] Race conditions in shutil.copy, shutil.copy2 and shutil.copyfile

2012-06-18 Thread Radoslaw A. Zarzynski

Changes by Radoslaw A. Zarzynski radoslaw.zarzyn...@student.put.poznan.pl:


Added file: http://bugs.python.org/file26043/python_shutil_copy_with_umask.diff

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



[issue15100] Race conditions in shutil.copy, shutil.copy2 and shutil.copyfile

2012-06-18 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
components: +IO
nosy: +flox

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

This looks like a documentation issue:  it's well documented that in the exec 
statement, the globals dictionary must be a dict.  What's not so clear from the 
documentation (AFAICT) is that it must actually have *type* dict, rather than 
merely being an instance of dict.  (Or, from experimentation, it *can* be an 
instance of a dict subclass, but the underlying C-implemented dict methods are 
called directly, so overloads for __getitem__ and the like don't have any 
effect.)

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, mark.dickinson
stage:  - needs patch
type: behavior - 
versions: +Python 3.2, Python 3.3

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



[issue15100] Race conditions in shutil.copy, shutil.copy2 and shutil.copyfile

2012-06-18 Thread Hynek Schlawack

Changes by Hynek Schlawack h...@ox.cx:


--
nosy: +hynek

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread John Firestone

John Firestone jo...@freenet.de added the comment:

I find the behavior inconsistent. As you can see from this example, the 
exec'uted code *does* call the instance's overloaded __getitem__ and 
__missing__ methods when outside a function, but doesn't when inside.

--

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 As you can see from this example, the exec'uted code *does* call the 
 instance's overloaded __getitem__ and __missing__ methods when outside a 
 function, but doesn't when inside.

Yep;  that's because the 's' and 'f' lookups at top level are *local* lookups, 
and the 's' lookup from inside the body of 'f' is done as a *global* lookup (as 
explained in the docs here: [1]).  In the exec statement, the locals can be any 
mapping-like object.  The behaviour's a bit clearer if you pass separate 
globals and locals dictionaries:

 source = \
... print s
... def f():
... print s
... f()
... 
 locals = {'s': 1729}
 globals = {'s': 31415}
 exec source in globals, locals
1729
31415


[1] 
http://docs.python.org/reference/executionmodel.html#interaction-with-dynamic-features

--

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

With Python3 though, __getitem__ seems called though.
OTOH the 'print' symbol is not found, even though the Dict1 got a 
'__builtins__' entry added.

--
nosy: +amaury.forgeotdarc

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



[issue15101] multiprocessing pool finalizer can fail if triggered in background pool thread

2012-06-18 Thread Richard Oudkerk

New submission from Richard Oudkerk shibt...@gmail.com:

Multiprocessing's process pool originally used a finalizer to shutdown the pool 
when the pool object is garbage collected.

Since the maxtasksperchild feature was added, the worker_handler thread holds a 
reference to the pool, preventing garbage collection at least until that thread 
finished.

In some cases the last reference to the pool is owned by the worker_handler 
thread, and as it exits, the finalizer is triggered.  Since the finalizer tries 
to join the worker_handler thread, an error will be raised since a thread 
cannot join itself.

It would have been better if pools had used the context manager protocol rather 
than using RAII -- see Issue #15064.

Unless/until RAII usage is fixed, a quick fix would be to just make the 
finalizer skip trying to join the current thread.

--
messages: 163101
nosy: sbt
priority: normal
severity: normal
status: open
title: multiprocessing pool finalizer can fail if triggered in background pool 
thread
type: behavior

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



[issue15102] Fix 64-bit building for buildbot scripts

2012-06-18 Thread Jeremy Kloth

New submission from Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:

The buildbot scripts do not work for the 64-bit targets.

Firstly, the /p:UseEnv=True parameter to msbuild causes the 32-bit only 
projects (make_buildinfo and make_versioninfo) to fail due to architecture 
mismatch.  The scripts now unconditionally build those projects using the 
32-bit command-line tools.

The make_versioninfo project wasn't completely converted to be 32-bit only 
(issue9981); it would work correctly only from the IDE.  This fixes that and 
removes the Debug configuration as that was already #ifdef'd in the generated 
.h file.

--
components: Build, Cross-Build, Windows
hgrepos: 136
messages: 163102
nosy: jkloth
priority: normal
severity: normal
status: open
title: Fix 64-bit building for buildbot scripts
type: compile error
versions: Python 3.3

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



[issue15052] Outdated comments in build_ssl.py

2012-06-18 Thread Jeremy Kloth

Jeremy Kloth jeremy.kloth+python-trac...@gmail.com added the comment:

In addition to the fixes from issue15102, the only way I could get the ssl 
project to build successfully was to add the Perl installation (C:\Perl\bin) to 
my PATH.

--

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



[issue15040] stdlib compatibility with pypy: mailbox module

2012-06-18 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
title: stdlib compatability with pypy: mailbox.py - stdlib compatibility with 
pypy: mailbox module

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



[issue15052] Outdated comments in build_ssl.py

2012-06-18 Thread Martin v . Löwis

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

Again: installing Perl should not be necessary. That it is currently necessary 
is a bug in the sources.

--

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



[issue15052] Outdated comments in build_ssl.py

2012-06-18 Thread Jeremy Kloth

Jeremy Kloth jeremy.kl...@gmail.com added the comment:

Should I then open another issue just to track that bug?  Have you
even tried using build_ssl.py *without* Perl?  The changes required to
get that to work seem fairly extensive.

--

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



[issue15101] multiprocessing pool finalizer can fail if triggered in background pool thread

2012-06-18 Thread Roundup Robot

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

New changeset 4c07b9c49b75 by Richard Oudkerk in branch '2.7':
Issue #15101: Make pool finalizer avoid joining current thread
http://hg.python.org/cpython/rev/4c07b9c49b75

New changeset e1cd1f430ff1 by Richard Oudkerk in branch '3.2':
Issue #15101: Make pool finalizer avoid joining current thread.
http://hg.python.org/cpython/rev/e1cd1f430ff1

New changeset 59e0a51c5fc3 by Richard Oudkerk in branch 'default':
Issue #15101: Make pool finalizer avoid joining current thread.
http://hg.python.org/cpython/rev/59e0a51c5fc3

--
nosy: +python-dev

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



[issue15064] multiprocessing should use more context manager

2012-06-18 Thread Roundup Robot

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

New changeset 6d2a773d8e00 by Richard Oudkerk in branch 'default':
Issue #15064: Implement context manager protocol for multiprocessing types
http://hg.python.org/cpython/rev/6d2a773d8e00

--
nosy: +python-dev

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-06-18 Thread pmoody

pmoody pyt...@hda3.com added the comment:

I'm not sure if this is still an issue, but returning the address in a packed 
format was an early issue 
(http://code.google.com/p/ipaddr-py/issues/detail?id=14). No objections from me 
for removing it from the network objects or for removing the packed constructor 
(I'm assuming there isn't any python-ism about being able to copy-construct an 
object from any valid representation of said object)

--

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



[issue7360] [mailbox] race: mbox may lose data with concurrent access

2012-06-18 Thread Petri Lehtinen

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

Can this be closed?

--
nosy: +petri.lehtinen

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



[issue5346] mailbox._singlefileMailbox.flush doesn't preserve file rights

2012-06-18 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread John Firestone

John Firestone jo...@freenet.de added the comment:

Thank you all for the quick and interesting responses!

Here is another example, this time showing a simple
s
sometimes behaves like
globals()['s']
and sometimes doesn't.

class Dict(dict):
def __getitem__(self, key):
if key == 's':
return 'got s'
return dict.__getitem__(self, key)

dct = Dict()
dct['the_dict'] = dct
print 0, id(dct)

source = if 1:
print '1', id(globals()), globals() is the_dict
print ' ', globals()['s']
print ' ', s
def f():
print '2', id(globals()), globals() is the_dict
print ' ', globals()['s']
print ' ', s
print '3'
f()

exec(source, dct)


Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:32:06) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
 import curiosity2
0 2459928
1 2459928 True
  got s
  got s
2 2459928 True
  got s
 
Traceback (most recent call last):
  File stdin, line 1, in module
  File curiosity2.py, line 22, in module
exec(source, dct)
  File string, line 10, in module
  File string, line 8, in f
NameError: global name 's' is not defined


--
Added file: http://bugs.python.org/file26044/curiosity2.py

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



[issue7360] [mailbox] race: mbox may lose data with concurrent access

2012-06-18 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Probably.  Unless I'm mistaken, the issue with concurrent rewrite (as opposed 
to append) exists for single-file-mailboxes in the general case, not just in 
Python.  And as far as I know failure is never noisy, the last writer wins.

--
nosy: +r.david.murray

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



[issue7359] mailbox cannot modify mailboxes in system mail spool

2012-06-18 Thread Petri Lehtinen

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

Every program that accesses mailboxes in the system-wide mail spool directory 
needs to have write access to it. This is because dot-locking is achieved by 
creating additional files to that directory, and it must be used (in addition 
to fcntl() locking) to avoid messing up the mailboxes because of concurrent 
access.

In Debian, /var/mail is owned by root:mail with mode 2755, and every MUA is 
setgid mail. See the Debian Policy Manual section 11.6 for more information:


http://www.debian.org/doc/debian-policy/ch-customized-programs.html#s-mail-transport-agents

If you write a MUA or MTA using Python's mailbox module, your program needs to 
have write access to /var/mail. That's the only way to do it correctly. It also 
makes the mailbox module's renaming behavior possible.

--
nosy: +petri.lehtinen
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue15099] exec of function doesn't call __getitem__ or __missing__ on undefined global

2012-06-18 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Yes, this is definitely a dark corner of Python, and one that it seems worth 
trying to illuminate a bit in the documentation.

--

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



[issue15052] Outdated comments in build_ssl.py

2012-06-18 Thread Jeremy Kloth

Jeremy Kloth jeremy.kloth+python-trac...@gmail.com added the comment:

OK, I have discovered my issue(s) building OpenSSL.  When I first downloaded 
the openssl-1.0.1c external, the timestamps for the .asm files ended up being 
older than their corresponding .pl sources therefore triggering the rules in 
the makefile.

I then decided to fix those Perl related issues by installing ActivePerl but 
*without* having it added to my PATH (as build_ssl.py finds it in the default 
location).  This causes build_ssl.py to no longer use the generated .asm files 
as a Perl executable has been found (line 221).

The attached patch ensures that the Perl executable is actually runnable.

--
keywords: +patch
Added file: http://bugs.python.org/file26045/build_ssl.patch

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



[issue15042] Implemented PyState_AddModule, PyState_RemoveModule

2012-06-18 Thread Robin Schreiber

Robin Schreiber robin.schrei...@me.com added the comment:

Added missing documentation. Also added documentation of PyState_FindModule() 
which still happened to be missing.

--
Added file: http://bugs.python.org/file26046/PyState_add-remove_module_v2.patch

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



[issue15052] Outdated comments in build_ssl.py

2012-06-18 Thread Jeremy Kloth

Jeremy Kloth jeremy.kloth+python-trac...@gmail.com added the comment:

I forgot to add that with the patch the comment wrt Perl is truly correct.

--

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



[issue15096] Drop support for the ur string prefix

2012-06-18 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/issue15096
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15102] Fix 64-bit building for buildbot scripts

2012-06-18 Thread Antoine Pitrou

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


--
keywords: +patch
Added file: http://bugs.python.org/file26047/2a20cee18add.diff

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



  1   2   >