Re: Does python(django) have an official database driver to access SQLFire

2012-01-29 Thread Chris Rebert
On Sat, Jan 28, 2012 at 11:12 PM, Niu.Jack jack@igt.com wrote:
 I have a question on Python.  Does python(django) have an official database
 driver to access SQLFire? Or is there any roadmap to deliver an official
 database driver?

Sounds like no; SQLFire's FAQ
(http://communities.vmware.com/docs/DOC-16640 ) and docs mention only
JDBC  ADO.NET support.
A convoluted solution involving Jython or IronPython might be possible however.

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


autoconf error on Windows

2012-01-29 Thread Alec Taylor
PyCrypto's install is giving an autoconf error on Windows, whether I
install from the git repo or normally.

Traceback (most recent call last):
  File C:\Python27\lib\distutils\dist.py, line 972, in run_command
cmd_obj.run()

  File C:\Projects\satchmo_test\satchmo_test\src\pycrypto\setup.py,
line 274, in run
raise RuntimeError(autoconf error)

RuntimeError: autoconf error


Command C:\Python27\python.exe -c import setuptools;
__file__='C:\\Projects\\satchmo_test\\satchmo_test\\src\\pycrypto\\setup.py';
exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__,
'exec')) develop --no-deps failed with error code 1
Full output: http://pastebin.com/Dp3aw077

How can I get PyCrypto to install?

Thanks for all suggestions,

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


Re: autoconf error on Windows

2012-01-29 Thread Chris Rebert
On Sun, Jan 29, 2012 at 12:52 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 PyCrypto's install is giving an autoconf error on Windows, whether I
 install from the git repo or normally.

 Traceback (most recent call last):
  File C:\Python27\lib\distutils\dist.py, line 972, in run_command
    cmd_obj.run()

  File C:\Projects\satchmo_test\satchmo_test\src\pycrypto\setup.py,
 line 274, in run
    raise RuntimeError(autoconf error)

 RuntimeError: autoconf error

 
 Command C:\Python27\python.exe -c import setuptools;
 __file__='C:\\Projects\\satchmo_test\\satchmo_test\\src\\pycrypto\\setup.py';
 exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__,
 'exec')) develop --no-deps failed with error code 1
 Full output: http://pastebin.com/Dp3aw077

Judging by the earlier 'sh' is not recognized as an internal or
external command, operable program or batch file. error message and
after scanning thru the setup.py, sounds like you need to have MinGW
(http://www.mingw.org ) installed. FWICT, there don't seem to be any
current Windows binaries for PyCrypto.

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


Re: autoconf error on Windows

2012-01-29 Thread Alec Taylor
Thanks, but I already have MinGW installed and in PATH.

C:\where g++
C:\libraries\MinGW\bin\g++.exe
C:\libraries\perl\c\bin\g++.exe

On Sun, Jan 29, 2012 at 8:07 PM, Chris Rebert c...@rebertia.com wrote:
 On Sun, Jan 29, 2012 at 12:52 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 PyCrypto's install is giving an autoconf error on Windows, whether I
 install from the git repo or normally.

 Traceback (most recent call last):
  File C:\Python27\lib\distutils\dist.py, line 972, in run_command
    cmd_obj.run()

  File C:\Projects\satchmo_test\satchmo_test\src\pycrypto\setup.py,
 line 274, in run
    raise RuntimeError(autoconf error)

 RuntimeError: autoconf error

 
 Command C:\Python27\python.exe -c import setuptools;
 __file__='C:\\Projects\\satchmo_test\\satchmo_test\\src\\pycrypto\\setup.py';
 exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__,
 'exec')) develop --no-deps failed with error code 1
 Full output: http://pastebin.com/Dp3aw077

 Judging by the earlier 'sh' is not recognized as an internal or
 external command, operable program or batch file. error message and
 after scanning thru the setup.py, sounds like you need to have MinGW
 (http://www.mingw.org ) installed. FWICT, there don't seem to be any
 current Windows binaries for PyCrypto.

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


回复: write 中文 into c:\t1

2012-01-29 Thread 水静流深
file.write(s.decode('gbk').encode('utf-8'))
i open the file  c:\t1, to get  中文 in it 
not  涓枃 
 
-- 原始邮件 --
发件人: MRABpyt...@mrabarnett.plus.com;
发送时间: 2012年1月27日(星期五) 上午10:53
收件人: python-listpython-list@python.org; 

主题: Re: write 中文 into c:\t1

 
On 27/01/2012 02:46, contro opinion wrote:
 |  s='\xd6\xd0\xce\xc4'

  print  s
  中文

  s1=s.decode('gbk').encode('utf-8')

  print  s1
  涓枃

  file=open('c:\\t1','w')

  file.write(s1)

  file.close()
 |

 when i open c:\t1,i get 中文 in it,
 how can i write 涓枃 into c:\t1??

   file.write(print s1)
 File stdin, line 1
 file.write(print s1)
 ^
 SyntaxError: invalid syntax

file.write(s.decode('gbk').encode('utf-8'))
-- 
http://mail.python.org/mailman/listinfo/python-list-- 
http://mail.python.org/mailman/listinfo/python-list


Re: autoconf error on Windows

2012-01-29 Thread Chris Rebert
 On Sun, Jan 29, 2012 at 8:07 PM, Chris Rebert c...@rebertia.com wrote:
 On Sun, Jan 29, 2012 at 12:52 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 PyCrypto's install is giving an autoconf error on Windows, whether I
 install from the git repo or normally.

 Traceback (most recent call last):
  File C:\Python27\lib\distutils\dist.py, line 972, in run_command
    cmd_obj.run()

  File C:\Projects\satchmo_test\satchmo_test\src\pycrypto\setup.py,
 line 274, in run
    raise RuntimeError(autoconf error)

 RuntimeError: autoconf error

 
 Command C:\Python27\python.exe -c import setuptools;
 __file__='C:\\Projects\\satchmo_test\\satchmo_test\\src\\pycrypto\\setup.py';
 exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__,
 'exec')) develop --no-deps failed with error code 1
 Full output: http://pastebin.com/Dp3aw077

 Judging by the earlier 'sh' is not recognized as an internal or
 external command, operable program or batch file. error message and
 after scanning thru the setup.py, sounds like you need to have MinGW
 (http://www.mingw.org ) installed. FWICT, there don't seem to be any
 current Windows binaries for PyCrypto.
On Sun, Jan 29, 2012 at 1:15 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 Thanks, but I already have MinGW installed and in PATH.

 C:\where g++
 C:\libraries\MinGW\bin\g++.exe
 C:\libraries\perl\c\bin\g++.exe

Erm, make that MSYS instead of MinGW?
(I don't run Windows myself.)

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


Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-29 Thread Dominic Binks

snipped lots of mindless nonsense, nothing at all to do with Python

On 25-Jan-12 3:23 PM, Rick Johnson wrote:


... In my world ...


Rick, I may be overstepping the mark here but I believe all participants 
on this list would probably like it if that's precisely where you stayed.


--
Dominic Binks: dbi...@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
--
http://mail.python.org/mailman/listinfo/python-list


Re: autoconf error on Windows

2012-01-29 Thread Alec Taylor
Thanks, adding MSYS's bin to PATH solved that issue.

Now I'm getting linker errors on:

C:\libraries\MinGW\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win-amd64-2.7\Release\src\winrand.o
build\temp.win-amd64-2.7\Release\src\winrandom.def -LC:\Python27\libs
-LC:\Python27\PCbuild\amd64 -lws2_32 -ladvapi32 -lpython27 -lmsvcr90
-o 
C:\Projects\satchmo_test\Prototype\src\pycrypto\lib\Crypto\Random\OSRNG\winrandom.pyd

Full output: http://pastebin.com/SYBkFt3h
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python logging filter limitation, looks intentional?

2012-01-29 Thread Vinay Sajip
On Jan 28, 10:51 am, Chris Withers ch...@simplistix.co.uk wrote:

 To be clear, I wasn't asking for a change to existing behaviour, I was
 asking for the addition of an option that would allow thelogging
 framework to behave as most people would expect when it comes to filters ;-)

And the evidence for most people would be ... ? ;-) It hasn't been
raised before, despite filters working the way they do since Python
2.3 ...

And I wonder, would any of those people be willing to accept the
performance impact of the change? I'm not sure how big the impact
would be, but it does involve another hierarchy traversal and
additional calls to the ancestor filters.

Regards,

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


Re: parse binary file

2012-01-29 Thread Peter Otten
contro opinion wrote:

 please download the attachment ,and put in  c:\test.data

Your data didn't make it through.

 and run the folloeing code:
 
 from struct import unpack
 file_obj = open('c:\\test.data', 'r')

Open the file in binary mode to disable CRNL-to-NL translation which will 
corrupt your binary data.

file_obj = open('c:\\test.data', 'rb')

 day = file_obj.read(40)
 while day:
 parsed = list(unpack('LLL', day[:28]))
 print parsed
 day = file_obj.read(40)

 [20081024, 1875631, 1888101, 1825526, 1839621, 31704770, 51634501]
 テi2Iロ
 
 Traceback (most recent call last):
   File C:\data.py, line 5, in module
 parsed = list(unpack('LLL', day[:28]))
 error: unpack requires a string argument of length 28
 
 
 why i can't  parse all of them??i just can get  a small  part of them.

I believe a '\x1a' byte marks the end of a text file. Maybe you've run into 
one of these.

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


Re: parse binary file

2012-01-29 Thread Steven D'Aprano
On Sun, 29 Jan 2012 13:39:25 +0100, Peter Otten wrote:

 contro opinion wrote:
 
 please download the attachment ,and put in  c:\test.data
 
 Your data didn't make it through.

Since this is a text-only newsgroup, it won't.


 and run the folloeing code:
 
 from struct import unpack
 file_obj = open('c:\\test.data', 'r')
 
 Open the file in binary mode to disable CRNL-to-NL translation which
 will corrupt your binary data.
[...]

 why i can't  parse all of them??i just can get  a small  part of them.
 
 I believe a '\x1a' byte marks the end of a text file. Maybe you've run
 into one of these.

That's Windows only, and only when reading in text mode. 



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


Re: parse binary file

2012-01-29 Thread Andrea Crotti

On 01/29/2012 07:51 AM, contro opinion wrote:

please download the attachment ,and put in  c:\test.data



Your program should never use hard-coded path, and actually
I think the majority here is not using windows.

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


Re: parse binary file

2012-01-29 Thread Aaron

On 01/29/2012 03:04 PM, Andrea Crotti wrote:

On 01/29/2012 07:51 AM, contro opinion wrote:

please download the attachment ,and put in  c:\test.data



Your program should never use hard-coded path, and actually
I think the majority here is not using windows.

But I also think that the majority of people on here could change his 
script to run if they are not on Windows

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


Re: [Python-Dev] #include Python.h

2012-01-29 Thread Chris Angelico
On Mon, Jan 30, 2012 at 2:34 AM, Andrea Crotti
andrea.crott...@gmail.com wrote:
 I have a newbie question about CPython.
 Looking at the C code I noted that for example in tupleobject.c there is
 only one include
 #include Python.h

For files like tupleobject.c there's often a corresponding
tupleobject.h in the Include directory - does that help?

 Python.h actually includes everything as far as I can I see so:
 - it's very hard with a not-enough smart editor to find out where the
  not-locally defined symbols are actually defined (well sure that is
  not a problem for most of the people)

Yep. I would recommend using grep for such things, if your editor
can't/won't help you. Or change editors, but that's not always an easy
option.

 - if all the files include python.h, doesn't it generate very big object
  files? Or is it not a problem since they are stripped out after?

As a general rule, object files aren't bloated by excessive .h
inclusion; all that's in the header files is declarations. Having
everything include everything can potentially slow compilation, but
with a modern computer, a modern compiler, and proper division of code
into multiple source files, that's not a significant concern. In any
case, the worst that can happen is overly-large intermediate (.o or
.obj) files; by the time the final binary is built, any duplicates
will have to have been folded down to one anyway.

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


Re: problems with tkinter updates

2012-01-29 Thread yves


In case somebody else is trying to do the same thing, this is what I ended up 
with to get the concept, that I can now integrate in other scripts:


http://projects.zioup.org/scratchpad/python/tkrun.py

--
Yves.  http://www.SollerS.ca/
   http://ipv6.SollerS.ca
   http://blog.zioup.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: object aware of others

2012-01-29 Thread Jerry Hill
On Sun, Jan 29, 2012 at 1:47 AM, Lee lchapli...@gmail.com wrote:

 I was afraid that a list/set/dictionary and alike is the answer, but,
 anyway, thanks everybody.


It doesn't seem too bad to keep track of the instances in the class object
using weak references (http://docs.python.org/py3k/library/weakref.html).
Here's an example that seems to do what you're asking using python 3.2, but
it should be pretty similar in python 2:

import weakref

class A:
_instances = set()
def __init__(self):
self.myname = 'IamA'
print('This is A')
self.__class__._instances.add(weakref.ref(self))
def foo(self):
print(foo)
def update(self):
for ref in self.__class__._instances:
obj = ref()
if obj is not None:
print(The only friends I've got are , ref, obj.myname)


If you're creating lots of instances of A and deleting them, it would
probably be worth removing the old weakrefs from the _instances set instead
of just ignoring them when calling update().

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


Questions about compiled Python (beginner)

2012-01-29 Thread HoneyMonster
I am new to Python (Python 2.7 on Linux). Research indicates that:

a) Compiling Python modules into intermediate bytecode marginally 
improves load time.

b) The Python interpreter will use an already-prepared .pyc file if one 
exists in the same directory as the .py.

That then, is presumably why for every .py file in my site-packages 
directory there is a corresponding .pyc file.

Question 1: What then, are the .pyo files? I note that many of them are 
identical to the .pyc, but that some differ.

Question 2: What happens if the .py file is changed and the .pyc is thus 
made obsolete. Does the interpreter ignore the .pyc? If so, how does it 
know? By the timestamp?

Thanks.

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


How To Use Python/GDAL to create a KML file from an Image?

2012-01-29 Thread Roger Zimmerman
Hi All,

I'd have a contour image file, in either svg, gif or png format. I
know the GPS coordinates for the four corners of the image. I'd like
to create a KML file from that image. I will view the KML file in
Google Earth or ARCGIS.

I understand that GDAL can do this, and I saw a tutorial for
GDAL2TILES. But I would like to do this function within Python. As I
am using Python to create the contour from a countour2d function.

Any suggestions on how to Georeference an image in Python? ( to turn
an image file into a KML file that can be opened by Google Earth). Are
there example Python scripts of how to do it somewhere?

Any ideas appreciated!

Cheers

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


Re: Questions about compiled Python (beginner)

2012-01-29 Thread Terry Reedy

On 1/29/2012 12:57 PM, HoneyMonster wrote:

I am new to Python (Python 2.7 on Linux). Research indicates that:

a) Compiling Python modules into intermediate bytecode marginally
improves load time.


The improvement is larger the larger the file. You may notice that .pyc 
files are only created when a file is imported, not when it is run 
directly.



b) The Python interpreter will use an already-prepared .pyc file if one
exists in the same directory as the .py.

That then, is presumably why for every .py file in my site-packages
directory there is a corresponding .pyc file.


In 3.2+, .pyc files are tucked away in a __pycache__ directory, with a 
version indicator added to the names so one directory can be used with 
more than one version of python.



Question 1: What then, are the .pyo files? I note that many of them are
identical to the .pyc, but that some differ.


They are created when imported into python started with -O (optimize). 
That mainly deletes assertions and maybe something else.


Question 2: What happens if the .py file is changed and the .pyc is thus
made obsolete. Does the interpreter ignore the .pyc? If so, how does it
know? By the timestamp?


Yes. Yes.

--
Terry Jan Reedy

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


Re: Questions about compiled Python (beginner)

2012-01-29 Thread Cousin Stanley


  This short article provides some basic information
  about  .pyc  and  .pyo  files 

  http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

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


Re: calling a simple PyQt application more than once

2012-01-29 Thread John Posner
Jabba Laci wrote:

 Hi, Thanks for your reply. I forgot to mention that my first solution
 created a headless browser, i.e. it didn't create any GUI. I would
 like to keep it that way, thus I could scrape (AJAX-powered) webpages
 in batch mode without any user interaction.

No head, no problem. Just use a QCoreApplication instead of a
QApplication, and use a QTimer instead of a QPushButton to invoke
do_click():

from PyQt4.QtCore import QUrl, QCoreApplication, QTimer
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest

def process_page(reply_obj):
resp = reply_obj.readAll()
reply_obj.close()
print str(resp).strip()

def do_click():
req = QNetworkRequest(QUrl(MYURL))
mgr.finished.connect(process_page)
mgr.get(req)

MYURL = 'http://simile.mit.edu/crowbar/test.html'

if __name__ == __main__:
# we need only one application object and one net-access mgr
app = QCoreApplication([])
mgr = QNetworkAccessManager()

# use timer instead of button to retrieve web page repeatedly
timer = QTimer()
timer.timeout.connect(do_click)
timer.start(5 * 1000)
 
# start the event loop
app.exec_()

Another thought: if you don't need a GUI, you might consider using plain
old Python, rather than PyQt. Here's some code adapted from
http://www.boddie.org.uk/python/HTML.html:

import urllib

WEBPAGE = http://simile.mit.edu/crowbar/test.html;
SEVERAL_TIMES = 3

for _ in range(SEVERAL_TIMES):
# Get a file-like object for the Python Web site's home page.
f = urllib.urlopen(WEBPAGE)
# Read from the object, storing the page's contents in 's'.
s = f.read()
f.close()
print s

Best,
John

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


Re: parse binary file

2012-01-29 Thread Steven D'Aprano
On Sun, 29 Jan 2012 15:50:49 +0100, Aaron wrote:

 On 01/29/2012 03:04 PM, Andrea Crotti wrote:
 On 01/29/2012 07:51 AM, contro opinion wrote:
 please download the attachment ,and put in  c:\test.data


 Your program should never use hard-coded path, and actually I think the
 majority here is not using windows.

 But I also think that the majority of people on here could change his
 script to run if they are not on Windows

Could, but won't, particularly since the error is so easy to spot without 
even running the code :)


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


Re: constraint based killer sudoku solver performance improvements

2012-01-29 Thread Blockheads Oi Oi

On 27/01/2012 07:47, Blockheads Oi Oi wrote:

On 27/01/2012 06:57, Frank Millman wrote:


Blockheads Oi Oibreamore...@yahoo.co.uk wrote:


I have a working program based on [1] that sets up all different
constraints for each row, column and box and then sets exact sum
constraints for each cage. It'll run in around 0.2 secs for a simple
problem, but a tough one takes 2 hours 45 minutes. I did some research
into improving the performance and found [2] but can't work out how to
implement the constraints given. Can someone please help, assuming that
it's even possible.

[1] http://pypi.python.org/pypi/python-constraint/1.1
[2] http://4c.ucc.ie/~hsimonis/sudoku.pdf


I don't have an answer, but are you aware of this -

http://www.ics.uci.edu/~eppstein/PADS/Sudoku.py

It is a sudoko solver written in pure python.

I don't know what you call a tough problem, but this one solves the
hardest
one I have thrown at it in the blink of an eye. It also outputs a full
trace
of the reasoning it used to arrive at a solution.

Frank Millman



I'd looked at this years back and forgotten all about it so thanks for
the reminder :) Some of the code names directly match ideas given in my
[2] above so I'll take another look.


Just for the record I ended up using gecode-python and 2 hours 45 
minutes became 2 milli seconds with the same model.  As most politicains 
have been known to say, lessons will be learned :)


--
Cheers.

Mark Lawrence.

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


Re: Questions about compiled Python (beginner)

2012-01-29 Thread HoneyMonster
On Sun, 29 Jan 2012 14:01:01 -0500, Terry Reedy wrote:

 On 1/29/2012 12:57 PM, HoneyMonster wrote:
 I am new to Python (Python 2.7 on Linux). Research indicates that:

 a) Compiling Python modules into intermediate bytecode marginally
 improves load time.
 
 The improvement is larger the larger the file. You may notice that .pyc
 files are only created when a file is imported, not when it is run
 directly.
 
 b) The Python interpreter will use an already-prepared .pyc file if one
 exists in the same directory as the .py.

 That then, is presumably why for every .py file in my site-packages
 directory there is a corresponding .pyc file.
 
 In 3.2+, .pyc files are tucked away in a __pycache__ directory, with a
 version indicator added to the names so one directory can be used with
 more than one version of python.
 
 Question 1: What then, are the .pyo files? I note that many of them are
 identical to the .pyc, but that some differ.
 
 They are created when imported into python started with -O (optimize).
 That mainly deletes assertions and maybe something else.

 Question 2: What happens if the .py file is changed and the .pyc is
 thus made obsolete. Does the interpreter ignore the .pyc? If so, how
 does it know? By the timestamp?
 
 Yes. Yes.

Thanks, Terry and Cousin Stanley for the clear explanation and useful URL.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue2636] Adding a new regex module (compatible with re)

2012-01-29 Thread Devin Jeanpierre

Devin Jeanpierre jeanpierr...@gmail.com added the comment:

 In practice, I expect that a pure Python implementation of a regular 
 expression engine would only be fast enough to be usable on PyPy.

Not sure why this is necessarily true. I'd expect a pure-Python implementation 
to be maybe 200 times as slow. Many queries (those on relatively short strings 
that backtrack little) finish within microseconds. On this scale, a couple of 
orders of magnitudes is not noticeable by humans (unless it adds up), and even 
where it gets noticeable, it's better than having nothing at all or a 
non-working program (up until a point).

python -m timeit -n 100 -s import re; x = 
re.compile(r'.*\s*help\s*([^]*)\s*/\s*help.*'); data = ' '*1000 + ' help 
' + 'abc'*100 + '/help' x.match(data)
100 loops, best of 3: 3.27 usec per loop

--
nosy: +Devin Jeanpierre

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-29 Thread Nick Coghlan

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

Ah, nice idea of bringing the boolean constants into the mix so we don't need 
to invent a new sentinel value.

However, to preserve the current behaviour that raise X from Y is essentially 
just syntactic sugar for: _var = X; _var.__cause__ = Y; raise Y, I suggest 
setting the default value for __cause__ to False (indicating not set). 
Then:

  __cause__ is False means no cause set, display context
  __cause__ is None means cause explicitly set to None, suppress context
  Any other value means display cause

The default value for cause is controlled by get_cause and set_cause in 
exceptions.c [1]. The basic idea would be to replace the current usage of 
Py_None and Py_RETURN_NONE in that code with Py_False and Py_RETURN_FALSE, and 
then change the criteria for valid causes to arg != Py_None  
!PyExceptionInstance_Check(arg).

In addition to the files already touched by the patch, Lib/traceback.py [2] and 
its tests will also require updating.

[1] http://hg.python.org/cpython/file/default/Objects/exceptions.c#l293
[2] http://hg.python.org/cpython/file/default/Lib/traceback.py#l117

--

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



[issue2636] Adding a new regex module (compatible with re)

2012-01-29 Thread Georg Brandl

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

Well, REs are very often used to process large chunks of text by repeated 
application.  So if the whole operation takes 0.1 or 20 seconds you're going to 
notice :)

--

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



[issue2636] Adding a new regex module (compatible with re)

2012-01-29 Thread Devin Jeanpierre

Devin Jeanpierre jeanpierr...@gmail.com added the comment:

It'd be nice if we had some sort of representative benchmark for real-world 
uses of Python regexps. The JS guys have all pitched in to create such a thing 
for uses of regexps on thew web. I don't know of any such thing for Python.

I agree that a Python implementation wouldn't be useful for some cases. On the 
other hand, I believe it would be fine (or at least tolerable) for some others. 
I don't know the ratio between the two.

--

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



[issue13901] test_get_outputs (test_distutils) failure with --enable-shared on Mac OS X

2012-01-29 Thread toggtc

New submission from toggtc tog...@gmail.com:

Current 2.7.2 + building on OS X 10.7.2 and gcc 4.2.1 (Apple build 5666.3):

i686-apple-darwin11-gcc-4.2.1: 
/private/var/folders/jy/dhptnvj90b34s0135sb_g6w8gn/T/tmpAfN6sj/foo.so: No 
such file or directory

==
ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
--
Traceback (most recent call last):
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/tests/test_build_ext.py,
 line 291, in test_get_outputs
cmd.run()
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/command/build_ext.py,
 line 340, in run
self.build_extensions()
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/command/build_ext.py,
 line 449, in build_extensions
self.build_extension(ext)
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/command/build_ext.py,
 line 531, in build_extension
target_lang=language)
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/ccompiler.py,
 line 741, in link_shared_object
extra_preargs, extra_postargs, build_temp, target_lang)
  File 
/Users/toggtc/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/distutils/unixccompiler.py,
 line 258, in link
raise LinkError, msg
LinkError: command 'gcc' failed with exit status 1


DYLD_LIBRARY_PATH is not defined in default environment of OS X.
but, ./configure and ./configure.in are:
Darwin*)
LDLIBRARY='libpython$(VERSION).dylib'
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'

= RUNSHARED=DYLD_LIBRARY_PATH=`pwd`:

and, test_build_ext.py:
 53 def _fixup_command(self, cmd):
 ...
 63 if (sysconfig.get_config_var('Py_ENABLE_SHARED') and
 64 not sys.platform.startswith('win')):
 65 runshared = sysconfig.get_config_var('RUNSHARED')
 66 if runshared is None:
 67 cmd.library_dirs = ['.']
 68 else:
 69 name, equals, value = runshared.partition('=')
 70 cmd.library_dirs = value.split(os.pathsep)

= library_dirs=['`pwd`', '']

link command via unixccompier:
gcc-4.2 ... /foo.o -L`pwd` -L (empty!) -o /private/var/folder.../foo.so

= No such file or directory
---

(for 2.7.2) 
https://raw.github.com/toggtc/python-patch/master/2.7.2/distutils_test_fixup_command_2.7.2.patch
(for 3.2.2) 
https://raw.github.com/toggtc/python-patch/master/3.2.2/distutils_test_fixup_command_3.2.2.patch

--
assignee: tarek
components: Distutils, Macintosh
messages: 152219
nosy: eric.araujo, tarek, toggtc
priority: normal
severity: normal
status: open
title: test_get_outputs (test_distutils) failure with --enable-shared on Mac OS 
X
versions: Python 2.7, Python 3.2

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



[issue13897] Move fields relevant to coroutine/generators out of frame into generator/threadstate

2012-01-29 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Amaury Forgeot d'Arc wrote:
 
 - Why is it called CoState?  is it related to coroutines?

Yes it is related to coroutines, threads and generators *are*
(a limited form of) asymmetric coroutines, even if we don't usually 
think of them that way).

Perhaps GenState would be a better name
(treating the threadstate as a sort of top level pseudo-generator)?

--

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



[issue13897] Move fields relevant to coroutine/generators out of frame into generator/threadstate

2012-01-29 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Nick Coghlan wrote:
 Nick Coghlan ncogh...@gmail.com added the comment:
 
 The division of responsibilities between generator objects and the eval loop 
 is currently a little messy. The eval loop deals almost entirely with frame 
 objects and also handles swapping exception states around on behalf of 
 generators, which is why the generator specific exception state currently 
 lives on frame objects (i.e. to avoid the eval loop needing to know too much 
 about the internal structure of generator objects).

In my patch the exception state does not need swapping at all, so the 
question of whose responsibility it is become mute.
Neither generator nor ceval need to do it.

 
 Before generator related state can reasonably be moved out of the frame 
 objects, those responsibilities should be divided more cleanly. Ron Adam has 
 made an initially attempt at tackling that problem in issue 13607.
 
 Once the responsibilities are divided appropriately, *then* we can look at 
 the fields that ceval no longer touches and see if they should be moved 
 somewhere else (whether that's directly into the generator struct or into a 
 new struct referenced from the generator struct).

This patch is largely orthogonal to that proposed for issue 13607.
In fact the new CoState struct would be a better place to pass data 
between PyEval_EvalFrame() and gen_send(), rather than adding yet 
another field to the frame.

--
title: Move fields relevant to coroutine/generators out of frame into 
generator/threadstate - Move fields relevant to coroutine/generators out of
  frame into generator/threadstate

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



[issue1625] bz2.BZ2File doesn't support multiple streams

2012-01-29 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

 I am just recompressing a 77GB file because of this :-(.

Sorry to hear that :(

 I would consider that a bug, not a feature request.

Semantic issues aside, my concern here is that the patch for 2.7 is considerably
larger than the one for 3.3, and the code it modifies is more fragile.

An alternative solution I'd like to pursue is to backport 3.3's BZ2File
implementation to run on 2.7, and release it on PyPI. That way there's no risk
of introducing regressions for people who don't need this facility, and those
who do can get it without needing to upgrade to 2.7.3 (or even wait for it to be
released). It shouldn't take much effort to get it working on 2.6 as well.

How does that sound?

--

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



[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2012-01-29 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Antoine Pitrou rep...@bugs.python.org wrote:
  I thought the whole Py_buffer API was only temporarily removed from the
  limited API until the issues were sorted out:
  
  http://bugs.python.org/issue10181#msg125462
 
 I'm talking about the memoryview access macros. It's like
 PyList_GET_SIZE, it isn't part of the limited API and you have to use
 PyList_GetSize instead.

You're right: I presumed that the macros were excluded temporarily
when in fact that had already happened in 62b61abd02b8.

  The flags are primarily for the memoryview itself to avoid repeated calls
  to PyBuffer_IsContiguous(). So when 3rd-party uses PyMemoryView_GET_BUFFER
  to get the view and also needs to determine the contiguity type, that
  code could also use the flags.
 
 But why would 3rd-party code use PyMemoryView_GET_BUFFER instead of, for
 example, PyObject_GetBuffer? You seldom have APIs which *expect* a
 memoryview, I think. Instead, they would expect a buffer-compatible
 object.

That's a good question. It looks to me that the macro was present as
PyMemoryView() initially. You renamed it in #3560 (with Guido's approval),
and later PyMemoryView_GET_BUFFER appeared in the docs.

I think 3rd-party code uses the macros mainly because they are
present and, in the case of PyMemoryView_GET_BUFFER, documented.
In most situations PyObject_GetBuffer() could be used indeed.

Most use cases I can think of would also involve having access to
the managed buffer API. As an example, here's a technique that is
similar to what goes on in PyMemoryView_GetContiguous():

Suppose you have an initialized bytes object that you want to
wrap as a multi-dimensional exporter. Then:

   - Base the memoryview on the bytes object and keep exactly one
 reference to it.

   - Adjust the shape, strides etc. to get the structure you want.

   - Return the view: You now have a fully compliant exporter that
 only needs a single Py_DECREF() to disappear and do all cleanup.

Of course this could also be exposed as a function, e.g.:

   /* stealing a reference to bytes */
   PyMemoryView_FromBytesAndInfo(PyObject *bytes, Py_buffer *info);

So let's make the flags private. What do you prefer?

  1) Leave them in memoryview.h, but with a leading underscore:

   _Py_MEMORYVIEW_C
   [...]

  2) Move them to memoryobject.c, with a leading underscore.

  3) Move them to memoryobject.c, without a leading underscore (I find
 this more readable).

  4) Move them to memoryobject.c as MV_C, MV_FORTRAN, etc.

Also, I'll add a note to the docs that PyMemoryView_GET_BUFFER can
probably be avoided by using PyObject_GetBuffer() directly.

--

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



[issue13848] io.open() doesn't check for embedded NUL characters

2012-01-29 Thread Hynek Schlawack

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

I have fixed the refleak, added a _PyUnicode_HasNULChars and integrated it into 
the Win32-unicode-if-branch. Couldn't test it due to lack of win32 – the 
function itself is tested though.

--
Added file: http://bugs.python.org/file24355/open-nul.patch

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



[issue13817] deadlock in subprocess while running several threads using Popen

2012-01-29 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +rosslagerwall

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



[issue13848] io.open() doesn't check for embedded NUL characters

2012-01-29 Thread Hynek Schlawack

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

With Georg's kind help I added some improvements:

 - I've been reluctant to waste heap for caching the nul string but he 
convinced me that I was being ridiculous ;)
 - For some reason there was a stray character inside, that should be fixed too.

In related news, I'm also adding tests for fileio since the last patch.

--
Added file: http://bugs.python.org/file24356/open-nul.patch

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



[issue13902] Sporadic test_threading failure on FreeBSD 6.4 buildbot

2012-01-29 Thread Nadeem Vawda

New submission from Nadeem Vawda nadeem.va...@gmail.com:

http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%206.4%203.x/builds/2206/steps/test/logs/stdio

FAIL: test_6_daemon_threads (test.test_threading.ThreadJoinOnShutdown)
--
Traceback (most recent call last):
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_threading.py, 
line 675, in test_6_daemon_threads
self.assertFalse(err)
AssertionError: b'[52879 refs]\nT' is not false

--
components: Tests
keywords: buildbot
messages: 152226
nosy: nadeem.vawda, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Sporadic test_threading failure on FreeBSD 6.4 buildbot
type: behavior
versions: Python 3.3

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-29 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Current semantics (before patch):

cause is not None  -- cause is set, display it instead of context
cause is None  -- no cause, try to display context

context is not None  -- no context
context is None  -- context set, display it (unless cause already displayed)

---

Proposed semantics (after patch)

cause is True  -- context set, but no display
cause is not None  -- cause set, display it instead of context
cause is None  -- no cause, try to display context

context is None -- no context
context is not None -- context set, display it (unless cause already displayed)

---

I prefer to go with True for cause, instead of False, as a way of saying Yes, 
there was an exception before this one, but I'm not going to display it as 
opposed to None meaning No there is no cause, and I'm not going to show you 
the context either.

Using True instead of False, and leaving the None's as they are now, preserves 
the behavior of None meaning none, as in there isn't one.

--

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-29 Thread Georg Brandl

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

Hmm, so from None sets cause to True, while all other from X sets cause 
to X.  That does not sound like a good idea to me.

--
nosy: +georg.brandl

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Mark Shannon

New submission from Mark Shannon m...@hotpy.org:

The proposed dictionary implementation allows sharing of keys  hashes between 
dictionaries. This leads to substantial memory savings for object-oriented 
programs. For non-OO programs the impact is negligible.

--
components: Interpreter Core
hgrepos: 109
messages: 152229
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: New shared-keys dictionary implementation
type: performance
versions: Python 3.4

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



[issue13857] Add textwrap.indent() as counterpart to textwrap.dedent()

2012-01-29 Thread Georg Brandl

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

BTW, the short spelling looks like it wouldn't indent the first line.

--
nosy: +georg.brandl

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



[issue13857] Add textwrap.indent() as counterpart to textwrap.dedent()

2012-01-29 Thread Georg Brandl

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

Otherwise +1.

--

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Georg Brandl

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

r'[\w]' also matches word chars.  I find that a very useful property, since you 
can easily build classes like '[\w.]'  It's also impossible to change this 
without breaking lots of regexes.  It's also explicitly documented, although 
IMO it's not clear it extends to \A and \Z, since it talks about character 
classes.  So this is a docs issue.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, georg.brandl

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



[issue13900] documentation page on email.parser contains self-referential non-definition of headersonly parameter

2012-01-29 Thread Roundup Robot

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

New changeset 0d5667171356 by Georg Brandl in branch '3.2':
Fix #13900: resolve self-referential description of a parameter.
http://hg.python.org/cpython/rev/0d5667171356

--
nosy: +python-dev

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



[issue13900] documentation page on email.parser contains self-referential non-definition of headersonly parameter

2012-01-29 Thread Georg Brandl

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

Should now be fixed. Thanks for the report.

--
nosy: +georg.brandl

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



[issue13900] documentation page on email.parser contains self-referential non-definition of headersonly parameter

2012-01-29 Thread Roundup Robot

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

New changeset 690d5978bd21 by Georg Brandl in branch '2.7':
Fix #13900: resolve self-referential description of a parameter.
http://hg.python.org/cpython/rev/690d5978bd21

--

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



[issue13900] documentation page on email.parser contains self-referential non-definition of headersonly parameter

2012-01-29 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
keywords: +patch
Added file: http://bugs.python.org/file24357/061f8573af54.diff

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



[issue13896] shelf doesn't work with 'with'

2012-01-29 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

Oh, I haven't noticed that. Using contextlib.closing solves my problem. Thanks.

--

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

[\w] should definitely work, but [\B] doesn't seem to match anything useful, 
and it just fails silently because it's neither equivalent to \B nor to [B]:
 re.match(r'foo\B', 'foobar')  # on a non-word-boundary -- matches fine
_sre.SRE_Match object at 0xb76dd3a0
 re.match(r'foo[B]', 'fooBar')  # same as r'fooB'
_sre.SRE_Match object at 0xb76dd1e0
 re.match(r'foo[\B]', 'foobar')  # not equivalent to \B
 re.match(r'foo[\B]', 'fooBar')  # not equivalent to [B]

The same is true for \Z and \A:
 re.match(r'foo\Z', 'foo')  # end of the string -- matches fine
_sre.SRE_Match object at 0xb76dd3a0
 re.match(r'foo[Z]', 'fooZ')  # same as r'fooZ'
_sre.SRE_Match object at 0xb76dd1e0
 re.match(r'foo[\Z]', 'foo')  # not equivalent to \Z
 re.match(r'foo[\Z]', 'fooZ')  # not equivalent to [Z]

 re.match(r'\Afoo', 'foo')  # beginning of the string -- matches fine
_sre.SRE_Match object at 0xb76dd1e0
 re.match(r'[A]foo', 'Afoo')  # same as r'Afoo'
_sre.SRE_Match object at 0xb76dd3a0
 re.match(r'[\A]foo', 'foo')  # not equivalent to \A
 re.match(r'[\A]foo', 'Afoo')  # not equivalent to [A]

Inside [], \b switches from word boundary to backspace:
 re.match(r'foo\b', 'foobar')  # not on a word boundary -- no matches
 re.match(r'foo\b', 'foo bar')  # on a word boundary  -- matches fine
_sre.SRE_Match object at 0xb74a4ec8
 re.match(r'foo[\b]', 'foo bar')  # not equivalent to \b
 re.match(r'foo[\b]', 'foo\bbar')  # matches backspace
_sre.SRE_Match object at 0xb76dd3d8
 re.match(r'foo([\b])', 'foo\bbar').group(1)
'\x08'

Given that \b doesn't keep its word boundary meaning inside the [], \B (and \A 
and \Z) shouldn't keep it either (also because I can't see how having these 
inside [] would be of any use).
On the other hand I'm not sure they should be equivalent to B, A, Z either.  
There are several escape sequences in the form \X (where X is an upper- or 
lower-case letter) that are not equivalent to X (\a\b\d\f\s\x\w\D\S\W...).
Raising an error that says something like I don't think [\A] does what you 
think it does, use [A] instead. might be a better option (and in case anyone 
is wondering about re.escape, I just checked and it doesn't escape letters).  
Even if this is technically backward incompatible, any string that has \A, \B, 
\Z inside [] can be considered buggy IMHO (unless someone can come up with a 
valid use case where they do something useful).

--
assignee: docs@python - 

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Georg Brandl

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

Interesting. That shifts the issue, since the current behavior is neither of 
the two that make sense. Then it would indeed make the most sense to raise in 
these cases.

(I wonder what these patterns actually would match, but I have no time to look 
in the sre sources right now...)

--

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



[issue13872] socket.detach doesn't mark socket._closed

2012-01-29 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
nosy: +pitrou

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-29 Thread Roundup Robot

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

New changeset 9be82f458b79 by Charles-François Natali in branch 'default':
Issue #6774: Back out c8b77efe8b56, which only brings confusion.
http://hg.python.org/cpython/rev/9be82f458b79

--
nosy: +python-dev

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



[issue4966] Improving Lib Doc Sequence Types Section

2012-01-29 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

 One other point... the branch is actually now relative to default, not
 3.2. While that was due to a merging mistake on my part, it also means
 I can legitimately ignore the narrow/wide build distinction in the
 section on strings.

So will this go on 3.3 only or are you planning to push it on 3.2(/2.7) too?

--

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



[issue6774] socket.shutdown documentation: on some platforms, closing one half closes the other half

2012-01-29 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

I've reverted the commit.

--
resolution:  - rejected
stage:  - committed/rejected
status: open - closed
versions: +Python 3.3

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-29 Thread Patrick Westerhoff

Patrick Westerhoff patrickwesterh...@gmail.com added the comment:

I have to agree with Georg on that. I think it would make more sense to 
introduce some internal flag/variable that keeps track of if the cause was 
explicitely set. So if cause was set (i.e. `from X` syntax is used), then 
always display it in favor of the context – except that a None-cause causes 
nothing to display.

Regardless of that I’m actually not sure if just changing the way the cause is 
displayed is a correct way to handle the context. If I explicitely raise an 
exception in an except-handler, I usually don’t expect that new exception to 
get the previous exception attached to. In the original example, I want to 
completely replace the “context” by a new exception without implicitely keeping 
over the original exception.

So even if using `from None` will prevent the context from being displayed (as 
the explicitely set cause will override it), the `__context__` will probably 
still be set by the `raise` statement, and I think that shouldn’t happen. Hence 
the `raise X instead` or `raise as X` idea that simply does not set the context 
but “destroys” it.

--

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



[issue13904] Generator as *args: TypeError replaced

2012-01-29 Thread July Tikhonov

New submission from July Tikhonov july.t...@gmail.com:

 set().union(*(None[k] for k in range(5)))
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: union() argument after * must be a sequence, not generator

Clearly, exception in not relevant, since next line works:

 set().union(*([k] for k in range(5)))
{0, 1, 2, 3, 4}

Correct exception would be

 None[1]
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'NoneType' object is not subscriptable

Problem is in python function call mechanics.
set().union can be replaced by any callable;
Generator can be replaced by any TypeError-raising iterable. Exceptions other 
then TypeError are handled correctly.

Python/ceval.c:4322
ext_do_call() converts stararg to tuple.
If any TypeError is raised, it is replaced with
TypeError(%s argument after * must be a sequence, not %s)


Proposed solution:

Probably, we can avoid replacing TypeError. Exceptions in the above cases would 
become relevant, and

 int(*None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: type object argument after * must be a sequence, not NoneType

would become

 int(*None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'NoneType' object is not iterable

so exception is still recognizable (and, may be, even more relevant, since we 
don't actually need _sequence_ as stararg, _iterable_ would be enough).

--
components: Interpreter Core
files: typeerror-replaced-in-stararg.diff
keywords: patch
messages: 152243
nosy: july
priority: normal
severity: normal
status: open
title: Generator as *args: TypeError replaced
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file24358/typeerror-replaced-in-stararg.diff

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



[issue13904] Generator as *args: TypeError replaced

2012-01-29 Thread July Tikhonov

Changes by July Tikhonov july.t...@gmail.com:


Added file: 
http://bugs.python.org/file24359/typeerror-replaced-in-stararg-test.diff

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Mark Shannon

Changes by Mark Shannon m...@hotpy.org:


Added file: http://bugs.python.org/file24360/6a21f3b35e20.diff

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


Removed file: http://bugs.python.org/file24357/061f8573af54.diff

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



[issue13848] io.open() doesn't check for embedded NUL characters

2012-01-29 Thread Antoine Pitrou

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

The patch works under Windows here (on branch default).

--
stage: needs patch - patch review

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



[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2012-01-29 Thread Antoine Pitrou

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

 Of course this could also be exposed as a function, e.g.:
 
/* stealing a reference to bytes */
PyMemoryView_FromBytesAndInfo(PyObject *bytes, Py_buffer *info);

I think we should minimize the number of reference-stealing functions.

 So let's make the flags private. What do you prefer?

I don't really mind, whatever you think is best :)

--

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



[issue2636] Adding a new regex module (compatible with re)

2012-01-29 Thread Antoine Pitrou

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

 It'd be nice if we had some sort of representative benchmark for
 real-world uses of Python regexps. The JS guys have all pitched in to
 create such a thing for uses of regexps on thew web. I don't know of
 any such thing for Python.

See http://hg.python.org/benchmarks/, there are regex benchmarks there.

 I agree that a Python implementation wouldn't be useful for some
 cases. On the other hand, I believe it would be fine (or at least
 tolerable) for some others. I don't know the ratio between the two.

I think the ratio would be something like 2% tolerable :)

As I said to Ezio and Georg, I think adding the regex module needs a
PEP, even if it ends up non-controversial.

--

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



[issue13872] socket.detach doesn't mark socket._closed

2012-01-29 Thread Antoine Pitrou

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

 socket.socket.detach doesn't mark the socket._closed flag.

Well, does it have to? It's only an internal detail, it's not exposed as a 
public API.

--

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



[issue13848] io.open() doesn't check for embedded NUL characters

2012-01-29 Thread Roundup Robot

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

New changeset 572bb8c265c0 by Antoine Pitrou in branch '3.2':
Issue #13848: open() and the FileIO constructor now check for NUL characters in 
the file name.
http://hg.python.org/cpython/rev/572bb8c265c0

New changeset 6bb05ce1cd1f by Antoine Pitrou in branch 'default':
Issue #13848: open() and the FileIO constructor now check for NUL characters in 
the file name.
http://hg.python.org/cpython/rev/6bb05ce1cd1f

--
nosy: +python-dev

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



[issue13890] test_importlib failures under Windows

2012-01-29 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Is there a technological reason environ is not updated, or is it simply
oversight?

Lib/os.py: under POXIX, os.environ reflects posix.environ (it uses the same
underlying dict), while under Windows, os.environ uses a distinct dict from
nt.environ.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue13890
 ___


--

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



[issue13848] io.open() doesn't check for embedded NUL characters

2012-01-29 Thread Antoine Pitrou

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

I've made small changes and committed the patch in 3.2 and 3.3.
2.7 would need further changes and I don't think it's worth the bother.
Thanks!

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

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



[issue13890] test_importlib failures under Windows

2012-01-29 Thread Antoine Pitrou

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

I think it's more laziness. _Environ.__setitem__ could also update the original 
mapping.

--
nosy: +haypo

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Antoine Pitrou

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


--
nosy: +benjamin.peterson, pitrou
stage:  - patch review
versions: +Python 3.3 -Python 3.4

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



[issue6210] Exception Chaining missing method for suppressing context

2012-01-29 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Patrick: The value in this enhancement is in not displaying the chained 
exception.  I do not see any value in throwing it away completely.  If you 
don't care about __context__ you can safely ignore it.  On the other hand, if 
it is completely removed, and you do care about it... well, too bad.

Georg, Nick:  On further thought, I agree that having 'from None' set cause 
from None to True is counter-intuitive, and there is consistency in having 
__context__ as None and __cause__ as False.

Thanks, Nick, for the pointers on the necessary changes.

--

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Terry J. Reedy

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

In the initial comment, 'Dummy' to 'Deleted' here but only here:
-   Holds an active (key, value) pair.  Active can transition to Dummy 
+   Holds an active (key, value) pair.  Active can transition to Deleted 

Im Lib/test/test_pprint.py
 def test_set_reprs(self): ...
 # Consequently, this test is fragile and ...
+# XXX So why include this test in the first place?
Raymond, I believe you added this 44927 and revised for 3.x in 45067.
I imagine it will also be a problem with randomized hashes. Should it be 
removed or somehow revised?

--
nosy: +terry.reedy

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Philip Jenvey

Changes by Philip Jenvey pjen...@underboss.org:


--
nosy: +pjenvey

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



[issue13905] Built-in Types Comparisons should mention rich comparison methods

2012-01-29 Thread Catalin Iacob

New submission from Catalin Iacob iacobcata...@gmail.com:

In 2.7 the Comparisons section of stdtypes.rst only talks about __cmp__ and 
never mentions the rich comparison methods:
Instances of a class normally compare as non-equal unless the class defines 
the __cmp__() method. Refer to Basic customization) for information on the use 
of this method to effect object comparisons.

The first sentence is false, instances can also compare as equal if they define 
__eq__. And since __cmp__ is gone in Python3, I think the rich comparison 
methods should at least be mentioned, or even emphasized over __cmp__ to help 
people write more forward compatible code.

--
assignee: docs@python
components: Documentation
messages: 152254
nosy: catalin.iacob, docs@python
priority: normal
severity: normal
status: open
title: Built-in Types Comparisons should mention rich comparison methods
type: enhancement
versions: Python 2.7

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



[issue13905] Built-in Types Comparisons should mention rich comparison methods

2012-01-29 Thread Catalin Iacob

Catalin Iacob iacobcata...@gmail.com added the comment:

Here's my attempt at a patch. It mostly takes the text from the default branch 
and adds references to __cmp__.

--
keywords: +patch
Added file: http://bugs.python.org/file24361/issue13905v1.patch

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



[issue5231] Change format of a memoryview

2012-01-29 Thread Antoine Pitrou

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

Shouldn't this be closed in favour of #10181?

--

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



[issue1625] bz2.BZ2File doesn't support multiple streams

2012-01-29 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

 An alternative solution I'd like to pursue is to backport 3.3's BZ2File
 implementation to run on 2.7, and release it on PyPI.

Well, that was easier than I expected. It didn't take much work to get it
working under 2.6, 2.7 and 3.2. I've put up this bz2file module on
GitHub https://github.com/nvawda/bz2file. I'll package it up and upload
it to PyPI sometime soon.

--

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



[issue13507] Modify OS X installer builds to package liblzma for the new lzma module

2012-01-29 Thread David Bolen

David Bolen db3l@gmail.com added the comment:

I recently built the xz library on my OSX Tiger buildbot (that also does the 
daily DMGs via the build script), and Nadeem mentioned this ticket.

As an FYI, I wasn't able to get the xz library (5.0.3) to configure/build as a 
universal build (i386/ppc) in a single step (as in the build script recipes).  
It appears to use some compile options incompatible with multiple -arch.

For my buildbot, I built it twice (as i386 and ppc) and then combined the 
libraries (static and shared) using lipo.  This appears to work for both the 
regular buildbot and the DMG creation.

In peeking at the build script this approach is a bit beyond the current recipe 
process, so would need more work than just a new recipe.  Assuming a build/lipo 
process is considered legitimate for release installers, of course, I'm not 
that sure how much I ended up cheating.

--
nosy: +db3l

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



[issue5231] Change format of a memoryview

2012-01-29 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Yes, it's really superseded by #10181 now. I'm closing as 'duplicate',
since technically it'll be fixed once the patch for #10181 is committed.

--
dependencies:  -Problems with Py_buffer management in memoryobject.c (and 
elsewhere?)
resolution:  - duplicate
stage: needs patch - committed/rejected
status: open - closed
superseder:  - Problems with Py_buffer management in memoryobject.c (and 
elsewhere?)

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



[issue13897] Move fields relevant to coroutine/generators out of frame into generator/threadstate

2012-01-29 Thread Amaury Forgeot d'Arc

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

IMO tstate-exc_value has nothing to do with generators.  Changing its name 
seems gratuitous breakage to me.

--

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



[issue13897] Move fields relevant to coroutine/generators out of frame into generator/threadstate

2012-01-29 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

The important part is not the change of name, but wrapping them in a 
struct which can be embedded in both PyThreadState and PyGenObject.

The state-exc_XXX trio of values are the currently handled exception
(sys.exc_info()) and are shadowed by generator exception handlers.
My patch models that shadowing rather than swapping the values in and 
out. This allows me to eliminate save_exc_state(), swap_exc_state()
and restore_and_clear_exc_state() completely.

--

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



[issue13868] Add hyphen doc fix

2012-01-29 Thread Boštjan Mejak

Boštjan Mejak bostjan.me...@gmail.com added the comment:

If floating point in a sentence is in a role of an adjective, then it must be 
written as floating-point (with a hyphen), otherwise not.

Example: The number 3.5 is a floating-point number.

Please consult some English orthography book and start writing correct English.

--

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread John Machin

John Machin sjmac...@lexicon.net added the comment:

@Ezio: Comparison of the behaviour of \letter inside/outside character classes 
is irrelevant. The rules for inside can be expressed simply as:

1. Letters dDsSwW are special; they represent categories as documented, and do 
in fact have a similar meaning outside character classes.

2. Otherwise normal Python rules for backslash escapes in string literals 
should be followed. This means automatically that \a - \x07, \A - A, \b - 
backspace, \B - B, \z - z and \Z - Z.

@Georg: No need to read the source, just read my initial posting: It's compiled 
as a zero-length matcher (at) inside a character class (in) i.e. a 
nonsense, then at runtime the illegality is deliberately ignored.

--

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread John Machin

John Machin sjmac...@lexicon.net added the comment:

Whoops: normal Python rules for backslash escapes should have had a note but 
revert to the C behaviour of stripping the \ from unrecognised escapes which 
is what re appears to do in its own \ handling.

--

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



[issue13889] str(float) and round(float) issues with FPU precision

2012-01-29 Thread Samuel Iseli

Samuel Iseli samuel.is...@gmail.com added the comment:

Hi Marc, the changes to the pythoncore.vcproj Visual-Studio file define the 
HAVE_VC_FUNC_FOR_X87 symbol. I use this symbol to enable the precision-setting 
macros in pyport.h. I made this similar to the existing code for gcc (linux).

You can change this but currently this symbol has to be defined somewhere for 
the macros to have an effect.

--

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



[issue13906] mimetypes.py under windows - bad exception catch

2012-01-29 Thread Alexander Maksimenko

New submission from Alexander Maksimenko alex.mclan...@gmail.com:

mimetypes.py(249) expectts Unicode*En*codeError, but Unicode*De*codeError 
happens when registry has non latin symbols (Vista Home 64).

I just change cathc jn next line to UnicodeDecodeError and all now works fine. 
But may be error not here, but on encode method which raise negative exception


F:\c:\python27\python -m SimpleHTTPServer
Traceback (most recent call last):
  File test.py, line 2, in module
import SimpleHTTPServer
  File c:\python27\lib\SimpleHTTPServer.py, line 27, in module
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File c:\python27\lib\SimpleHTTPServer.py, line 204, in 
SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
  File c:\python27\lib\mimetypes.py, line 355, in init
db.read_windows_registry()
  File c:\python27\lib\mimetypes.py, line 259, in read_windows_registry
for ctype in enum_types(mimedb):
  File c:\python27\lib\mimetypes.py, line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal 
not in range(128)


-- here after changes -

F:\c:\python27\python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
mc-quad - - [30/Jan/2012 02:02:18] GET / HTTP/1.1 200 -
mc-quad - - [30/Jan/2012 02:02:18] code 404, message File not found
mc-quad - - [30/Jan/2012 02:02:18] GET /favicon.ico HTTP/1.1 404 -

--
components: Library (Lib)
messages: 152267
nosy: mclander
priority: normal
severity: normal
status: open
title: mimetypes.py under windows - bad exception catch
type: behavior
versions: Python 2.7

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



[issue13856] xmlrpc / httplib changes to allow for certificate verification

2012-01-29 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

Thanks for submitting the patch. Couple of comments.

1. This is a new feature, so the patch should be addressed against 3.x. 
2. The patch lacks tests and documentation and hence it is not complete.

You could take a look at http/client.py or ssl.py (with test_ssl.py) for for 
passing the key and cert from the client.

Antoine - I fail to recollect, but is there any reason for the clients in the 
stdlib are not carrying a ca_file and doing a certificate validation of the 
server connection? Is it required (or a good idea) ?

--
nosy: +pitrou
versions: +Python 3.3 -Python 2.7

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



[issue13906] mimetypes.py under windows - bad exception catch

2012-01-29 Thread R. David Murray

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

This is a duplicate of issue 9291.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - mimetypes initialization fails on Windows because of non-Latin 
characters in registry

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



[issue13856] xmlrpc / httplib changes to allow for certificate verification

2012-01-29 Thread Antoine Pitrou

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

 Antoine - I fail to recollect, but is there any reason for the clients 
 in the stdlib are not carrying a ca_file and doing a certificate
 validation of the server connection?

Well, if you are a security expert you can volunteer to maintain a trusted 
certificates' file in the Python repository :) I think nobody else amongst us 
is qualified.

--

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



[issue13703] Hash collision security issue

2012-01-29 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

On Jan 28, 2012, at 07:26 PM, Dave Malcolm wrote:

This turns out to pass without PYTHONHASHRANDOMIZATION in the
environment, and fail intermittently with it.

Note that make test invokes the built python with -E, so that it
ignores the setting of PYTHONHASHRANDOMIZATION in the environment.

Barry, Benjamin: does fixing this bug require getting the full test
suite to pass with randomization enabled (and fixing the intermittent
failures due to ordering issues), or is it acceptable to merely have
full passes without randomizing the hashes?

I think we at least need to identify (to the best of our ability) the tests
that fail and include them in release notes.  If they're easy to fix, we
should fix them.  Maybe also open a bug report for each failure.

I'm okay though with some tests failing in 2.6 with this environment variable
set.  We needn't go back and fix them in 2.6 (since we're in security-fix only
mode), but I'll bet you'll get almost the same set for 2.7 and there we
*should* fix them, even if it happens after the release.

What do the buildbots do?

I'm not sure, but as long as the buildbots are green, I'm happy. :)

--

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



[issue13703] Hash collision security issue

2012-01-29 Thread Jim Jewett

Jim Jewett jimjjew...@gmail.com added the comment:

Given PYTHONHASHSEED, what is the point of PYTHONHASHRANDOMIZATION?

Alternative:

On startup, python reads a config file with the seed (which defaults to zero).

Add a function to write a random value to that config file for the next startup.

--

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



[issue7097] urlparse.urljoin of simple http:// and somedomain.com produces incorrect result

2012-01-29 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

 urljoin(http://;, //somedomain.com)
results in http://somedomain.com;

So, I wonder if this  way to specify the relative url properly and not the 
base-url. 

The test suite of urlparse tries to follow all the advertised scenarios for 
RFC3986 and also some more tests (which are usually discovered by de-facto 
scenarios of how other clients (mainly browsers) deal with it. If there is a 
browser behavior which we should emulate, without breaking existing code, we 
should consider this, otherwise we could leave this in invalid state.  Thanks!

--
nosy: +orsenthil

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



[issue13856] xmlrpc / httplib changes to allow for certificate verification

2012-01-29 Thread Martin v . Löwis

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

For 3.x, xmlrpc.client should just pass-through the SSL context. Since the code 
to do so will be quite different from the current patch, I'm tempted to close 
this issue as rejected, unless Nathanael indicates that he would like to redo 
the patch for 3.x; this issue could then be recycled for that.

orsenthil: I don't fully understand your question (what kind of carrying 
should the clients do); the standard library most certainly supports validation 
of the server certificate.

--

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



[issue13907] test_pprint relies on set/dictionary repr() ordering

2012-01-29 Thread Mark Shannon

New submission from Mark Shannon m...@hotpy.org:

The function test_set_reprs() includes the comment:
Consequently, this test is fragile and implementation-dependent
Changing the dictionary iteration ordering breaks it.

--
components: Tests
messages: 152272
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: test_pprint relies on set/dictionary repr() ordering

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



[issue13703] Hash collision security issue

2012-01-29 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Barry A. Warsaw wrote:
 Barry A. Warsaw ba...@python.org added the comment:
 
 On Jan 28, 2012, at 07:26 PM, Dave Malcolm wrote:
 
 This turns out to pass without PYTHONHASHRANDOMIZATION in the
 environment, and fail intermittently with it.

 Note that make test invokes the built python with -E, so that it
 ignores the setting of PYTHONHASHRANDOMIZATION in the environment.

 Barry, Benjamin: does fixing this bug require getting the full test
 suite to pass with randomization enabled (and fixing the intermittent
 failures due to ordering issues), or is it acceptable to merely have
 full passes without randomizing the hashes?
 
 I think we at least need to identify (to the best of our ability) the tests
 that fail and include them in release notes.  If they're easy to fix, we
 should fix them.  Maybe also open a bug report for each failure.

http://bugs.python.org/issue13903 causes even more tests to fail,
so I'm submitting bug reports for most of the failing tests already.

--

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



[issue13703] Hash collision security issue

2012-01-29 Thread Martin v . Löwis

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

 Given PYTHONHASHSEED, what is the point of PYTHONHASHRANDOMIZATION?

How would you do what it does without it? I.e. how would you indicate
that it should randomize the seed, rather than fixing the seed value?

 On startup, python reads a config file with the seed (which defaults to zero).

-1 on configuration files that Python reads at startup (let alone in a
bugfix release).

--

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



[issue4966] Improving Lib Doc Sequence Types Section

2012-01-29 Thread Nick Coghlan

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

Trying to make this change in 2.7 would actually be a bit of a nightmare - how 
do you cleanly split documentation of the binary data and text processing 
sequence types when str is used for both?

The change would be *mostly* feasible in 3.2 (that's why I started my branch 
from there), but there are still some sharp edges that go away in 3.3 (mainly 
the narrow/wide Unicode split).

So unless anyone is really keen to see the update in 3.2, my current plan is to 
leave the maintenance versions alone and only update it for 3.3. Going that way 
also provides better opportunities for post-checkin feedback from folks that 
aren't set up to build the docs themselves (rebuilding the docs is fairly 
straightforward on *nix, but Terry tells me that using Windows complicates that 
process quite a bit).

--

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



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
nosy: +gregory.p.smith

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



[issue13874] test_faulthandler: read_null test fails with current clang

2012-01-29 Thread Roundup Robot

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

New changeset f71249d785d6 by Victor Stinner in branch 'default':
Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation
http://hg.python.org/cpython/rev/f71249d785d6

--
nosy: +python-dev

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



[issue13874] test_faulthandler: read_null test fails with current clang

2012-01-29 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Does my commit fix the issue?

--

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



  1   2   >