[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread STINNER Victor

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

+def time_independent_equals(a, b):
+if len(a) != len(b):
+return False

This is not time independent. Is it an issue?

+if type(a[0]) is int:

It's better to write isinstance(a, bytes). You should raise a
TypeError if a is not a bytes or str.

--

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



[issue1859] textwrap doesn't linebreak on \n

2012-04-12 Thread Otto Kekäläinen

Otto Kekäläinen o...@seravo.fi added the comment:

As a note to comments msg60038-msg60040, for anybody like me who ended up here 
after Googling around on how to do wordwrap in Python:

The function textwrap in Python is for single strings/paragraphs only, and it 
does not work as wordwrap normally works in text editors or other programming 
languages (eg. Wordwrap in Python).


If you want to do wordwrap or a block of text, run something like this:

new_msg = 
lines = msg.split(\n)

for line in lines:
if len(line)  75:
w = textwrap.TextWrapper(width=75, break_long_words=False)
line = '\n'.join(w.wrap(line))

new_msg += line + \n

An use case example for this would be, if you have a email message and you want 
to apply word wrapping to it, so that no line would be over 78 characters.

--
nosy: +otto

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



[issue1859] textwrap doesn't linebreak on \n

2012-04-12 Thread Otto Kekäläinen

Otto Kekäläinen o...@seravo.fi added the comment:

In previous comment: (eg. Wordwrap in Python) - (wordwrap() in PHP)

Some examples of how this function works on text blocks:

Original text:

--
*Maksaako riippuvuus yksittäisestä ohjelmistoyritykstä Helsingille vuosittain 
3,4 miljoonaa euroa?*


Helsingin kaupungin raportti OpenOffice-pilottihankkeesta tuottaa 
kaupunkilaisille enemmän kysymyksiä kuin vastauksia. Kaupunki kokeili avoimen 
lähdekoodin hyötyohjelmistopakettia kaupunginvaltuuston jäsenten kannettavissa 
tietokoneissa kymmenen kuukauden ajan vuonna 2011. Ohjelmistopaketti sai 
käyttäjiltä laajan hyväksynnän. Kokeilun päätyttyä kaupunki tuotti pilotista 
raportin, jonka mukaan OpenOfficen käyttöönotto koko virkamieskunnalle tulisi 
hyvin kalliiksi.

Kaupungin raportti väittää, että maksaisi 3,4 miljoonaa euroa vuodessa käyttää 
OpenOfficea. Luku vaikuttaa yllättävän isolta ja raportti ei selosta, miten 
lukuun on päädytty, sanoo Otto Kekäläinen, Euroopan vapaiden ohjelmien säätiö 
(Free Software Foundation Europe, FSFE), Suomen paikalliskoordinaattori. Ilman 
tarkkoja tietoja, luku vaikuttaa perusteettomalta. Ilmeisesti Helsingin 
hallinto ei raporttia laatiessaan edes ollut yhteydessä yleisiin 
OpenOffice-palveluiden tarjoajiin tiedustellaakseen hintoja.
--

Applying
msg.message_body = textwrap.fill(msg.message_body_unwrapped, 75)

--
 *Maksaako
riippuvuus yksittäisestä ohjelmistoyritykstä Helsingille vuosittain
3,4 miljoonaa euroa?*   Helsingin kaupungin raportti OpenOffice-
pilottihankkeesta tuottaa kaupunkilaisille enemmän kysymyksiä kuin
vastauksia. Kaupunki kokeili avoimen lähdekoodin
hyötyohjelmistopakettia kaupunginvaltuuston jäsenten kannettavissa
tietokoneissa kymmenen kuukauden ajan vuonna 2011. Ohjelmistopaketti
sai käyttäjiltä laajan hyväksynnän. Kokeilun päätyttyä
kaupunki tuotti pilotista raportin, jonka mukaan OpenOfficen
käyttöönotto koko virkamieskunnalle tulisi hyvin kalliiksi.
Kaupungin raportti väittää, että maksaisi 3,4 miljoonaa euroa
vuodessa käyttää OpenOfficea. Luku vaikuttaa yllättävän isolta
ja raportti ei selosta, miten lukuun on päädytty, sanoo Otto
Kekäläinen, Euroopan vapaiden ohjelmien säätiö (Free Software
Foundation Europe, FSFE), Suomen paikalliskoordinaattori. Ilman
tarkkoja tietoja, luku vaikuttaa perusteettomalta. Ilmeisesti
Helsingin hallinto ei raporttia laatiessaan edes ollut yhteydessä
yleisiin OpenOffice-palveluiden tarjoajiin tiedustellaakseen hintoja.
--


Applying
msg.message_body = textwrap.fill(msg.message_body_unwrapped, 75, 
break_long_words=False, replace_whitespace=False)

--
*Maksaako
riippuvuus yksittäisestä ohjelmistoyritykstä Helsingille vuosittain
3,4 miljoonaa euroa?*


Helsingin kaupungin raportti OpenOffice-
pilottihankkeesta tuottaa kaupunkilaisille enemmän kysymyksiä kuin
vastauksia. Kaupunki kokeili avoimen lähdekoodin
hyötyohjelmistopakettia kaupunginvaltuuston jäsenten kannettavissa
tietokoneissa kymmenen kuukauden ajan vuonna 2011. Ohjelmistopaketti
sai käyttäjiltä laajan hyväksynnän. Kokeilun päätyttyä
kaupunki tuotti pilotista raportin, jonka mukaan OpenOfficen
käyttöönotto koko virkamieskunnalle tulisi hyvin kalliiksi.
Kaupungin raportti väittää, että maksaisi 3,4 miljoonaa euroa
vuodessa käyttää OpenOfficea. Luku vaikuttaa yllättävän isolta
ja raportti ei selosta, miten lukuun on päädytty, sanoo Otto
Kekäläinen, Euroopan vapaiden ohjelmien säätiö (Free Software
Foundation Europe, FSFE), Suomen paikalliskoordinaattori. Ilman
tarkkoja tietoja, luku vaikuttaa perusteettomalta. Ilmeisesti
Helsingin hallinto ei raporttia laatiessaan edes ollut yhteydessä
yleisiin OpenOffice-palveluiden tarjoajiin tiedustellaakseen hintoja.
--

In case this bug report form wraps the text, you can also view the it at 
pastebin: http://pastebin.com/y6icAJC6

--

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



[issue14452] SysLogHandler sends invalid messages when using unicode

2012-04-12 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

Your three step approach makes sense... But it _is_ still technically a new API 
though in that the UTF8BOM placeholder for LogRecord's is being introduced.  
What would the behavior be when run on an older version without support for 
that placeholder be?

I'm okay with adding this but wouldn't be surprised if release managers are 
not.  But I personally have no need for syslog logging from Python so it'd be 
better to have someone who needs this to work properly chime in.

Perhaps just fixing it nicely in 3.3 is sufficient while documenting the 
misbehavior as a known issue for 2.7 and 3.2.

--
nosy: +gregory.p.smith

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Georg Brandl

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

ISTM that meta /  is neither valid HTML nor valid XHTML.

--
nosy: +georg.brandl

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



[issue14559] (2.7.3 Regression) PC\8.0 directory can no longer be used to build on windows

2012-04-12 Thread Mitchell Blank Jr

New submission from Mitchell Blank Jr m-pyt...@bodyfour.com:

In the diff between 2.7.2 and 2.7.3, we see:

--- Python-2.7.2/PCbuild/pythoncore.vcproj  2011-06-11 08:46:27.0 
-0700
+++ Python-2.7.3/PCbuild/pythoncore.vcproj  2012-04-09 16:07:35.0 
-0700
@@ -1835,6 +1835,10 @@

/File
File
+   RelativePath=..\Python\random.c
+   
+   /File
+   File
RelativePath=..\Python\structmember.c

/File

...however there isn't any similar change to PC\VS8.0\pythoncore.vcproj , 
PC\VS7.1\pythoncore.vcproj, nor PC\VC6\pythoncore.dsp

I don't know if any of those are deprecated, but the VS8.0 .vcproj's definitely 
worked in 2.7.2.  In 2.7.3 the missing random.obj file causes python27.dll to 
fail to link and everything goes downhill from there.

Hand-applying the same change to the PC\VS8.0 directory fixed the problem for 
me.

--
components: Build
messages: 158110
nosy: mitchblank
priority: normal
severity: normal
status: open
title: (2.7.3 Regression)  PC\8.0 directory can no longer be used to build on 
windows
type: compile error
versions: Python 2.7

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



[issue14554] test module: correction

2012-04-12 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file25187/correction.diff

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Ezio Melotti

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

Here's a patch.

--
keywords: +patch
stage: test needed - patch review
Added file: http://bugs.python.org/file25188/issue14538.diff

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



[issue12537] mailbox's _become_message is very fragile

2012-04-12 Thread David Lam

David Lam d...@dlam.me added the comment:

Wow, cool!  Thanks for the update.

--

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



[issue14548] garbage collection just after multiprocessing's fork causes exceptions

2012-04-12 Thread Charles-François Natali

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

 That's a problem indeed. Perhaps we need a global fork lock shared
 between subprocess and multiprocessing?

 I did an atfork patch which included a (recursive) fork lock.  See

    http://bugs.python.org/review/6721/show

 The patch included changes to multiprocessing and subprocess.  (Being able to 
 acquire the lock when doing fd manipulation is quite useful.  For instance, 
 the creation of Process.sentinel currently has a race which can mean than 
 another process inherits the write end of the pipe.  That would cause 
 Process.join() to wait till both processes terminate.)

Indeed, I had a look and it looked good.
I just had a couple minor comments, I'll try to get back to this later
today, or by the end of the week.

 Actually, for Finalizers I think it would be easier to just record and check 
 the pid.

I'd prefer this too.

--

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



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

New submission from Андрей Р lans...@gmail.com:

Issue can be found only in 2.7, in 2.6.6 it works

System:
Linux strix 3.2.14-1-ARCH x86_64
Python information:
Python 2.7.2 (default, Jan 31 2012, 13:19:49) [GCC 4.6.2 20120120 
(prerelease)] on linux2

Snippet to reproduce error:

# -*- encoding: utf-8 -*-
import urllib2

request = urllib2.Request('http://google.com', u'Контент', {'Content-Type': 
'text/plain; charset=utf-8'})
urllib2.urlopen(request).read()

Stacktrace:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/urllib2.py, line 126, in urlopen
return _opener.open(url, data, timeout)
  File /usr/lib/python2.7/urllib2.py, line 394, in open
response = self._open(req, data)
  File /usr/lib/python2.7/urllib2.py, line 412, in _open
'_open', req)
  File /usr/lib/python2.7/urllib2.py, line 372, in _call_chain
result = func(*args)
  File /usr/lib/python2.7/urllib2.py, line 1199, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File /usr/lib/python2.7/urllib2.py, line 1168, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
  File /usr/lib/python2.7/httplib.py, line 955, in request
self._send_request(method, url, body, headers)
  File /usr/lib/python2.7/httplib.py, line 989, in _send_request
self.endheaders(body)
  File /usr/lib/python2.7/httplib.py, line 951, in endheaders
self._send_output(message_body)
  File /usr/lib/python2.7/httplib.py, line 815, in _send_output
self.send(message_body)
  File /usr/lib/python2.7/httplib.py, line 787, in send
self.sock.sendall(data)
  File /usr/lib/python2.7/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)

--
components: Unicode
messages: 158114
nosy: ezio.melotti, Андрей.Р
priority: normal
severity: normal
status: open
title: urllib2 cannot make POST with utf-8 content
versions: Python 2.7

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



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Андрей Р lans...@gmail.com added the comment:

# -*- encoding: utf-8 -*-
import urllib2

request = urllib2.Request('http://google.com', u'Контент'.encode(utf-8), 
{'Content-Type': 'text/plain; charset=utf-8'})
urllib2.urlopen(request).read()

--

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



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Changes by Андрей Р lans...@gmail.com:


--
status: open - closed

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



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Андрей Р lans...@gmail.com added the comment:

Sorry. My fault

--

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



[issue14452] SysLogHandler sends invalid messages when using unicode

2012-04-12 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 What would the behavior be when run on an older version without support for 
 that placeholder be?

Then it would fail when the format string contained e.g. %(UTF8BOM)s and there 
was no corresponding attribute in the LogRecord - but that's true of any 
feature which is introduced in newer Pythons. I get that it would be unexpected 
in a point release, and that's why I've posted about this on c.l.py (no 
feedback from there so far).

 I'm okay with adding this but wouldn't be surprised if release managers are 
 not.

Hence the post to python-dev, but no release manager has expressed an opinion 
yet.

 Perhaps just fixing it nicely in 3.3 is sufficient while documenting the 
 misbehavior as a known issue for 2.7 and 3.2.

This is doable at a user level, except for the fact that the BOM insertion is 
currently unconditional. If I just remove the BOM insertion in 2.7 and 3.2, 
then I don't need to do the UTF8BOM placeholder thing in the stdlib; I could 
just add a cookbook recipe telling users how to do it. I am thinking about a 
different solution for 3.3 anyway, i.e. adding one or more overridable methods 
to SysLogHandler.

Since no one has objected on c.l.py about the proposed change (which implied 
that if there were no objections, the change would happen) Marko may be right 
that not many people are affected, or care. I'll wait a little while longer, 
and if no objections are forthcoming I'll remove the BOM insertion in 2.7 and 
3.2, add a cookbook recipe for those who need a BOM and leave it at that for 
those versions.

--

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2012-04-12 Thread Nick

Nick spaun2002mob...@gmail.com added the comment:

I faced with the issue on my own PC. For a Russian version of WinOS default PC 
name is ИВАН-ПК (C8 C2 C0 CD 2D CF CA in hex) and it returns from gethostbyaddr 
(CRT) exactly in this form (encoded with system locale cp1251 not UTF8). So 
when the function PyUnicode_FromString is called, it expects that argument is 
utf8 encoded string and throws and error.
A lot of 3rd party modules use gethostbyaddr or getfqdn (which uses 
gethostbyaddr) and I can't just use function that returns names as bytes. 
Surrogate names are also not acceptable because the name mentioned above 
becomes -??

--
nosy: +spaun2002

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



[issue14561] python-2.7.2-r3 suffers test failure at test_mhlib

2012-04-12 Thread Ian Delaney

New submission from Ian Delaney del...@iinet.com.au:

Testing test suite of pyth-2.7.
Re-running failed tests in verbose mode
Re-running test 'test_mhlib' in verbose mode
test_basic (test.test_mhlib.MhlibTests) ... ok
test_listfolders (test.test_mhlib.MhlibTests) ... FAIL

It seems to be pinned down to this one line in test that failed.

ok, it comes down to this.  From test_mhlib.py

def test_listfolders(self):
mh = getMH()
eq = self.assertEqual

#tfolders.sort()\\ Line 184
#eq(folders, tfolders)  \\ Line 185

Commenting them out removes the source of error. The lines that trips up 
include at least 185, 189, 193.  The 'folders' are not equal.

Bug filed in gentoo bugzilla; Bug 387967; 21-10-2011.

The build log from that bug in Comment 2

https://bugs.gentoo.org/attachment.cgi?id=290409

--
components: Tests
messages: 158119
nosy: idella5
priority: normal
severity: normal
status: open
title: python-2.7.2-r3 suffers test failure at test_mhlib
type: behavior
versions: Python 2.7

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



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
nosy: +orsenthil

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



[issue14557] HP-UX libraries not included

2012-04-12 Thread Charles-François Natali

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

Hello Adi,

Thanks for your patch.

Just a detail:


 if platform == 'hp-ux11':
 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']


Wouldn't it be more robust as:

 if platform.startswith('hp-ux'):
 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']


So that it works with older and (potenttially) future HP-UX releases?

--
nosy: +neologix
stage:  - patch review

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



[issue14557] HP-UX libraries not included

2012-04-12 Thread Adi Roiban

Adi Roiban a...@roiban.ro added the comment:

Hi,

startswith('hp-ux') should also work as in real world it should be synonym with 
hp-ux11 ... see my reasoning below

I used 'hp-ux11' since this was the system I have access to and can test and I 
was not brave enought to assume that the patch will work on future or past 
version.

According to wikipedia HP-UX 11.00 was relesed in 1997... and I see a trend to 
change the minor version number . Latest is 11.31 released in 2007...

HPUX 10 is from 1995 and I am not sure if Python will work at all on such a 
system.

As a side node, i think that  HPUX will slowly die and we will not see an HP-UX 
12.

Cheers,
Adi

--

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



[issue14412] Sqlite Integer Fields

2012-04-12 Thread Mendez

Mendez goatsofmen...@users.sourceforge.net added the comment:

I've tested the released 2.7.3 and this works fine so there must just have been 
some oddity with the packaging of sqlite in rc2.

--

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



[issue14412] Sqlite Integer Fields

2012-04-12 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Great!

--
resolution:  - out of date
status: open - closed

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



[issue14562] urllib2 maybe blocks too long

2012-04-12 Thread Anrs Hu

New submission from Anrs Hu anders.x...@gmail.com:

If HTTP URL response's Transfer-Encoding is 'Chunked', then the 
urllib2.urlopen(URL).readline() will block until there're enough 8192 bytes, 
even though the first chunk is just a line. 

Every chunks should be processed as soon as posible, so the readline() behavior 
should read a line and return immediately, rather than read 8K data to buffer 
and look up a line from the buffer.

--
components: Library (Lib)
messages: 158124
nosy: Anrs.Hu
priority: normal
severity: normal
status: open
title: urllib2 maybe blocks too long
type: behavior
versions: Python 2.7

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



[issue14562] urllib2 maybe blocks too long

2012-04-12 Thread Senthil Kumaran

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

I am trying to this test this to determine the fault.

--
assignee:  - orsenthil
nosy: +orsenthil
versions: +Python 3.2, Python 3.3

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



[issue14556] telnetlib Telnet.expect fails with timeout=0

2012-04-12 Thread R. David Murray

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

Ah, so there are actually two timeouts of interest.  One is time out if there 
is no more data for X seconds, and the other is time out if there is no match 
for X seconds.  It used to do the former, now it does the latter.

I think you get the former by calling socket.settimeout() and then using a 
blocking call for the expect.

--

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



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-04-12 Thread aliles

New submission from aliles aaron.i...@gmail.com:

Python 3.2 will exit with a segmentation fault if a byte string is used as a 
field name in a subclass of ctypes.Structure.

Python 3.2.2 (default, Dec 18 2011, 18:56:20) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type help, copyright, credits or license for more information.
 import ctypes
 class Point(ctypes.Structure):
... _fields_ = ((b'x', ctypes.c_int), (b'y', ctypes.c_int))
... 
Segmentation fault: 11

This also occurs if None or an int is used as the field name.

I would expect that a TypeError exception would be raised if an attempt is made 
to use an invalid type for the field name.

--
components: ctypes
files: segfault.py
messages: 158127
nosy: aliles
priority: normal
severity: normal
status: open
title: Segmentation fault on ctypes.Structure subclass with byte string field 
names
type: crash
versions: Python 3.2
Added file: http://bugs.python.org/file25189/segfault.py

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



[issue14399] zipfile and creat/update comment

2012-04-12 Thread Serhiy Storchaka

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

Thank you, the TypeError test helped me find the error. Here is the
corrected patch.

For 2.7 it was necessary to turn the ZipFile in the new-style class.

--
Added file: http://bugs.python.org/file25190/fix_zipfile_comment_4.patch
Added file: http://bugs.python.org/file25191/fix_zipfile_comment_4-2.7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14399
___diff -r bd353f12c007 Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py  Wed Apr 11 20:15:10 2012 -0400
+++ b/Lib/test/test_zipfile.py  Thu Apr 12 10:44:42 2012 +0300
@@ -970,6 +970,30 @@
 with zipfile.ZipFile(TESTFN, mode=r) as zipfr:
 self.assertEqual(zipfr.comment, comment2)
 
+def test_unicode_comment(self):
+def setcomment(zipf, comment):
+zipf.comment = comment
+with zipfile.ZipFile(TESTFN, w, zipfile.ZIP_STORED) as zipf:
+zipf.writestr(foo.txt, O, for a Muse of Fire!)
+self.assertRaises(TypeError, setcomment, zipf,
+  this is a comment)
+
+def test_change_comment_in_empty_archive(self):
+with zipfile.ZipFile(TESTFN, a, zipfile.ZIP_STORED) as zipf:
+self.assertFalse(zipf.filelist)
+zipf.comment = bthis is a comment
+with zipfile.ZipFile(TESTFN, r) as zipf:
+self.assertEqual(zipf.comment, bthis is a comment)
+
+def test_change_comment_in_nonempty_archive(self):
+with zipfile.ZipFile(TESTFN, w, zipfile.ZIP_STORED) as zipf:
+zipf.writestr(foo.txt, O, for a Muse of Fire!)
+with zipfile.ZipFile(TESTFN, a, zipfile.ZIP_STORED) as zipf:
+self.assertTrue(zipf.filelist)
+zipf.comment = bthis is a comment
+with zipfile.ZipFile(TESTFN, r) as zipf:
+self.assertEqual(zipf.comment, bthis is a comment)
+
 def check_testzip_with_bad_crc(self, compression):
 Tests that files with bad CRCs return their name from testzip.
 zipdata = self.zips_with_bad_crc[compression]
diff -r bd353f12c007 Lib/zipfile.py
--- a/Lib/zipfile.pyWed Apr 11 20:15:10 2012 -0400
+++ b/Lib/zipfile.pyThu Apr 12 10:44:42 2012 +0300
@@ -698,7 +698,7 @@
 self.compression = compression  # Method of compression
 self.mode = key = mode.replace('b', '')[0]
 self.pwd = None
-self.comment = b''
+self._comment = b''
 
 # Check if we were passed a file-like object
 if isinstance(file, str):
@@ -774,7 +774,7 @@
 print(endrec)
 size_cd = endrec[_ECD_SIZE] # bytes in central directory
 offset_cd = endrec[_ECD_OFFSET] # offset of central directory
-self.comment = endrec[_ECD_COMMENT] # archive comment
+self._comment = endrec[_ECD_COMMENT] # archive comment
 
 # concat is zero, unless zip was concatenated to another file
 concat = endrec[_ECD_LOCATION] - size_cd - offset_cd
@@ -886,6 +886,24 @@
 else:
 self.pwd = None
 
+@property
+def comment(self):
+The comment text associated with the ZIP file.
+return self._comment
+
+@comment.setter
+def comment(self, comment):
+if not isinstance(comment, bytes):
+raise TypeError(comment: expected bytes, got %s % type(comment))
+# check for valid comment length
+if len(comment) = ZIP_MAX_COMMENT:
+if self.debug:
+print('Archive comment is too long; truncating to %d bytes'
+% ZIP_MAX_COMMENT)
+comment = comment[:ZIP_MAX_COMMENT]
+self._comment = comment
+self._didModify = True
+
 def read(self, name, pwd=None):
 Return file bytes (as a string) for name.
 with self.open(name, r, pwd) as fp:
@@ -1287,18 +1305,11 @@
 centDirSize = min(centDirSize, 0x)
 centDirOffset = min(centDirOffset, 0x)
 
-# check for valid comment length
-if len(self.comment) = ZIP_MAX_COMMENT:
-if self.debug  0:
-msg = 'Archive comment is too long; truncating to %d 
bytes' \
-  % ZIP_MAX_COMMENT
-self.comment = self.comment[:ZIP_MAX_COMMENT]
-
 endrec = struct.pack(structEndArchive, stringEndArchive,
  0, 0, centDirCount, centDirCount,
- centDirSize, centDirOffset, len(self.comment))
+ centDirSize, centDirOffset, 
len(self._comment))
 self.fp.write(endrec)
-self.fp.write(self.comment)
+self.fp.write(self._comment)
 self.fp.flush()
 
 if not self._filePassed:
diff -r d60ef141e090 Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py  Wed Apr 

[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread Jon Oberheide

Jon Oberheide j...@oberheide.org added the comment:

 This is not time independent. Is it an issue?

You're correct, the length check does leak the length of the expected digest as 
a performance enhancement (otherwise, your comparison runtime is bounded by the 
length of the attackers input).

Generally, exposing the length and thereby potentially the underlying 
cryptographic hash function (eg. 20 bytes - hmac-sha1) is not considered a 
security risk for this type of scenario, whereas leaking key material certainly 
is. I considered including this nuance in the documentation and probably should.

 It's better to write isinstance(a, bytes). You should raise a
 TypeError if a is not a bytes or str.

Ack, thanks.

--

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Jim Jewett

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

-1 on that particular patch.  

tagname / 


(with only whitespace between / and ) strikes me as obviously intending to 
close the tag, and a reasonably common error.

I can't think of any reason to support nested meta tags while not supporting 
sloppy self-closing tags.

--

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread Antoine Pitrou

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

You could rewrite:

result |= x ^ y

as:

result |= (x != y)

Of course, this assumes that the != operator is constant-time for 1-element 
strings.

--
nosy: +pitrou

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Jim Jewett

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

This issue is also marked for (bugfix-only) 2.7 and 3.2.  

Unless there is a specification somewhere (or at least an editor's draft), I 
can't really see any particular parse as a bugfix.  Was the goal just to make 
the parse finish, as opposed to stopping part way through the text?

--

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread Jon Oberheide

Jon Oberheide j...@oberheide.org added the comment:

 You could rewrite:
 
 result |= x ^ y
 
 as:
 
 result |= (x != y)

You could, but it's best not to introduce any conditional branching based if at 
all possible. For reference, see:

http://rdist.root.org/2009/05/28/timing-attack-in-google-keyczar-library/#comment-5783

--

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread sbt

sbt shibt...@gmail.com added the comment:

Why not just

def time_independent_equals(a, b):
return len(a) == len(b) and sum(x != y for x, y in zip(a, b)) == 0

--

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Removed file: http://bugs.python.org/file24281/5458412752d5.diff

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Removed file: http://bugs.python.org/file24283/f86bb02fd8f4.diff

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Added file: http://bugs.python.org/file25192/aa2dcffa267f.diff

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Added file: http://bugs.python.org/file25193/1e4d2c51b2d9.diff

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



[issue1859] textwrap doesn't linebreak on \n

2012-04-12 Thread Serhiy Storchaka

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

Cooking recipe for Otto:

def wrap_paragraphs(text, width=70, **kwargs):
return [line for para in text.splitlines() for line in textwrap.wrap(para, 
width, **kwargs)]

--
nosy: +storchaka

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



[issue14399] zipfile and creat/update comment

2012-04-12 Thread R. David Murray

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

Thanks.

We've had trouble in the past with a conversion to new style class breaking 
people's code.  People are less likely to be subclassing ZipFile, though, so it 
is probably OK.

--

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Published diff from stock 2.7.3.

Cleanups and simplifications.

Marc, could you possible compile under MacOS X both 2.7 and 3.3 branches, both 
in 32 and 64 bits?.

The tags are:

dtrace-issue13405  - 3.3a2+
dtrace-issue13405_2.7  - 2.7.3

Let me know how is going. Please, document your build environment.

--

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-12 Thread Tom Bachmann

Tom Bachmann e_mc...@web.de added the comment:

Hello,

[this is my first bug report, so I'm sorry if I'm not adhering to some 
conventions]

in what versions of python is this supposed to be fixed? Consider:

% python
Python 2.7.2+ (default, Nov 30 2011, 19:22:03) 
[GCC 4.6.2] on linux2
Type help, copyright, credits or license for more information.
 from pydoc import pager
 from locale import getpreferredencoding
 expr = u'\u211a'
 pager(expr) # error
 pager(expr.encode(getdefaultencoding())) # works


The error is:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/pydoc.py, line 1318, in pager
pager(text)
  File /usr/lib/python2.7/pydoc.py, line 1332, in lambda
return lambda text: pipepager(text, os.environ['PAGER'])
  File /usr/lib/python2.7/pydoc.py, line 1359, in pipepager
pipe.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u211a' in position 
0: ordinal not in range(128)


Best,
Tom

--
nosy: +ness

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Philippe Devalkeneer

Changes by Philippe Devalkeneer phil.le.bienheur...@gmail.com:


--
nosy: +flupke

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



[issue13405] Add DTrace probes

2012-04-12 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

PHP 5.4.0 added DTRACE support:

http://fr2.php.net/ChangeLog-5.php

The python window for 3.3 closes mid june. Let's do not miss it this time :-).

--

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Serhiy Storchaka

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

To be consistent, this patch should remove the references to 
http://www.w3.org/TR/html5/tokenization.html#tag-open-state and 
http://www.w3.org/TR/html5/tokenization.html#tag-open-state as irrelevant.

--
nosy: +storchaka

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-12 Thread R. David Murray

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

It is fixed in Python3.  Apparently Raymond was wrong about it having been 
fixed earlier (or perhaps he was referring to the unicode being removed from 
the pydoc __credits__ string).

--
nosy: +r.david.murray

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-12 Thread Tom Bachmann

Tom Bachmann e_mc...@web.de added the comment:

I see. Thank you.

On 12.04.2012 16:08, R. David Murray wrote:

 R. David Murrayrdmur...@bitdance.com  added the comment:

 It is fixed in Python3.  Apparently Raymond was wrong about it having been 
 fixed earlier (or perhaps he was referring to the unicode being removed from 
 the pydoc __credits__ string).

 --
 nosy: +r.david.murray

 ___
 Python trackerrep...@bugs.python.org
 http://bugs.python.org/issue1065986
 ___

--

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread R. David Murray

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

Yes, after considerable discussion those of working on this stuff decided that 
the goal should be that the parser be able to complete parsing, without error, 
anything the typical browsers can parse (which means, pretty much anything, 
though that says nothing about whether the result of the parse is useful in any 
way).  In other words, we've been treating it as a bug when the parser throws 
an error, since one generally uses the library to parse web pages from the 
internet and having the parse fail leaves you SOL for doing anything useful 
with the bad pages one gets therefrom.  (Note that if the parser was doing 
strict adherence to the older RFCs our decision would have been different...but 
it is not.  It has always accepted *some* badly formed documents, and rejected 
others.)

Also note that BeautifulSoup in Python2 used the sgml parser, which didn't 
throw errors, but that is gone in Python3.  In Python3 BeautifulSoup uses the 
html parser...which is what started us down this road to begin with.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14538
___
___
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-04-12 Thread Yury Selivanov

Changes by Yury Selivanov yseliva...@gmail.com:


--
nosy: +Yury.Selivanov

___
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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Antoine Pitrou

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

Yes, this is all by design. The interpreter *has* to stop: either it stops in a 
controlled way (the fatal error) or the stack is blown and it crashes. If you 
think the fatal error (basically a C abort() call) should be replaced with 
another way of exiting, please suggest so.

(actually, it's not the interpreter as a whole, only the current thread, but 
crashing a thread without affecting the others is probably impossible, due to 
reference leaks, resource cleanup, etc.)

--
nosy: +loewis, pitrou

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



[issue14432] Bug in generator if the generator in created in a C thread

2012-04-12 Thread Antoine Pitrou

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


--
stage:  - patch review

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Dino Viehland

Dino Viehland di...@microsoft.com added the comment:

Antoine: If you're looking at my test.py then my expectation is that this 
doesn't crash because a RuntimeError should be raised when the maximum 
recursion limit is hit, and then the trace handler should be uninstalled 
because it leaks an exception.  And that's exactly what seems to happens on 
Python 2.x.  We shouldn't ever hit the OS stack limit because Python's 
recursion limit should be enforced even in the face of a sys.settrace handler.

--

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Antoine Pitrou

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

 Antoine: If you're looking at my test.py then my expectation is that
 this doesn't crash because a RuntimeError should be raised when the
 maximum recursion limit is hit, and then the trace handler should be
 uninstalled because it leaks an exception.

I don't understand why you say that the trace handler leaks an
exception, since it silences it in the try ... except block.

--

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



[issue14082] shutil doesn't copy extended attributes

2012-04-12 Thread Hynek Schlawack

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

Ok, so I’ve added a function `copyxattr()` and `copy2()` tries to copy all 
possible namespaces.

Tests pass on Linux and Mac OS X.

--
keywords: +patch
Added file: http://bugs.python.org/file25194/xattr.diff

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Dino Viehland

Dino Viehland di...@microsoft.com added the comment:

It's catching the exception when it invokes x, but the recursion enforcement 
should happen at a method prolog, including at the invocation of g.  Therefore 
if we're at or beyond the recursion limit when invoking the trace handler the 
limits should still be enforced and that should be the same as the trace 
handler raising.

--

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Antoine Pitrou

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

 It's catching the exception when it invokes x, but the recursion
 enforcement should happen at a method prolog, including at the
 invocation of g.  Therefore if we're at or beyond the recursion limit
 when invoking the trace handler the limits should still be enforced
 and that should be the same as the trace handler raising.

That's where 3.x is different: 3.x temporarily bumps up the recursion
limit a bit when it is first reached, in order to let various cleanup
handlers run as intended. This is a nice thing in the general case, but
means it can degenerate in more involved or desperate cases.

(although here it's not clear to me why a second recursion error occurs
after the first one)

--

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Antoine Pitrou

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

 FYI this isn't actually causing any problems for me, I just ran into it 
 while doing IronPython development and was surprised to be able to
 crash the interpreter w/ pure Python code, and my crash looked awfully 
 similar to this bug.

I agree that crashing isn't ideal, and there may be more graceful ways of 
crashing instead of abort(), so that people don't get that horrible message box 
under Windows. Suggestions welcome.

--
nosy: +haypo

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Dino Viehland

Dino Viehland di...@microsoft.com added the comment:

Maybe there just needs to be a max that it will bump it up?  

FYI this isn't actually causing any problems for me, I just ran into it while 
doing IronPython development and was surprised to be able to crash the 
interpreter w/ pure Python code, and my crash looked awfully similar to this 
bug.

--

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



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2012-04-12 Thread Charles-François Natali

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

Adi, since you have access to an HP-UX box, could you test the attached patch 
(chown_hpux.diff)?
Also, if you're interested, you could search for other isues HP-UX-specific to 
see if you can help.

--

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



[issue14557] HP-UX libraries not included

2012-04-12 Thread Roundup Robot

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

New changeset 807f331f973d by Charles-François Natali in branch '3.2':
Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
http://hg.python.org/cpython/rev/807f331f973d

New changeset 9481e801ae7c by Charles-François Natali in branch 'default':
Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
http://hg.python.org/cpython/rev/9481e801ae7c

New changeset cc2e3c6d2669 by Charles-François Natali in branch '2.7':
Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
http://hg.python.org/cpython/rev/cc2e3c6d2669

--
nosy: +python-dev

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



[issue14564] Error running: ( echo 'import os'; echo 'help(os)'; )| python |head

2012-04-12 Thread Peng Yu

New submission from Peng Yu pengyu...@gmail.com:

I get the following error when I run the following command. I think that help 
may use something that don't work well with pipe. Could anybody take a look?

~/linux/bin/xplat/src/pymisc/pyhelp/main$ ( echo 'import os'; echo 'help(os)'; 
)| python |head
Help on module os:

NAME
os - OS routines for Mac, NT, or Posix depending on what system we're on.

FILE
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py

MODULE DOCS
http://docs.python.org/library/os
Traceback (most recent call last):
  File stdin, line 2, in module
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py, line 
467, in __call__
return pydoc.help(*args, **kwds)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py, 
line 1727, in __call__
self.help(request)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py, 
line 1774, in help
else: doc(request, 'Help on %s:')
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py, 
line 1511, in doc
pager(render_doc(thing, title, forceload))
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py, 
line 1318, in pager
pager(text)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py, 
line 1416, in plainpager
sys.stdout.write(plain(text))
IOError: [Errno 32] Broken pipe
~/linux/bin/xplat/src/pymisc/pyhelp/main$ ( echo 'import os'; echo 'help(os)'; 
)| python
Help on module os:

NAME
os - OS routines for Mac, NT, or Posix depending on what system we're on.

FILE
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py

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

DESCRIPTION

--
messages: 158154
nosy: Peng.Yu
priority: normal
severity: normal
status: open
title: Error running: ( echo 'import os'; echo 'help(os)'; )| python |head
versions: Python 2.7

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



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2012-04-12 Thread Adi Roiban

Adi Roiban a...@roiban.ro added the comment:

Hi,

Not sure what codebase was used for the patch.

I have manually patched the test on 2.5.6 and the test_posix tests passed.

Thanks!
Adi

--

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



[issue14557] HP-UX libraries not included

2012-04-12 Thread Charles-François Natali

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

Committed, thanks!

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

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



[issue6717] Some problem with recursion handling

2012-04-12 Thread Dino Viehland

Dino Viehland di...@microsoft.com added the comment:

One thought might be to do a recursion check (and maybe for multiple frames) 
when entering a try rather than incrementing the recursion limit to allow the 
handlers to run.  

That would cause the exception to be more likely taken before you run the code 
which needs some form of cleanup and then maybe the recursion limit could be a 
hard limit which can't be increased forever.

--

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-04-12 Thread Glenn Linderman

New submission from Glenn Linderman v+pyt...@g.nevcal.com:

I notice a deficiency in is_cgi: there is no documentation requiring 
cgi_directories to be a single part, only that the initial value happens to be 
a list of two directories, each of which have only a single part or level.  The 
description of is_cgi, however, only requires that the strings in 
self.cgi_directories be prefixes of self.path, followed by / or end of 
string. While it is not at all clear that being followed by end of string would 
produce useful results, the description does allow for multiple parts in the 
directory, but the implementation does not.

Consider a potential value in an overridden or augmented cgi_directories such 
as '/subdomain/cgi-bin'.  The current is_cgi wouldn't handle that.

Solution: replace the following is_cgi code (from current trunk):

collapsed_path = _url_collapse_path(self.path)
dir_sep = collapsed_path.find('/', 1)
head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
if head in self.cgi_directories:
self.cgi_info = head, tail
return True
return False

with:

cln = len( collapsed_path )
found = False
for ix in self.cgi_directories:
ln = len( ix )
print('is_cgi: %d %d - %s - %s'
  % ( ln, cln, ix, collapsed_path ))
if ln == cln  and  ix == collapsed_path:
self.cgi_info = ( ix, '')
found = True
break
elif ( ln  cln  and  collapsed_path[ ln ] == '/'
   and  collapsed_path.startswith( ix )):
self.cgi_info = ( ix, collapsed_path[ ln+1: ])
found = True
break
return found

--
messages: 158158
nosy: v+python
priority: normal
severity: normal
status: open
title: is_cgi doesn't function as documented for cgi_directories

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



[issue14548] garbage collection just after multiprocessing's fork causes exceptions

2012-04-12 Thread sbt

sbt shibt...@gmail.com added the comment:

Alternative patch which records pid when Finalize object is created.  The 
callback does nothing if recorded pid does not match os.getpid().

--
Added file: http://bugs.python.org/file25195/mp_finalize_pid.patch

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-04-12 Thread Glenn Linderman

Changes by Glenn Linderman v+pyt...@g.nevcal.com:


--
nosy: +orsenthil

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



[issue14564] Error running: ( echo 'import os'; echo 'help(os)'; )| python |head

2012-04-12 Thread Charles-François Natali

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

Hello,

this is not a forum to get help with Python, but to report bugs.

In your case, the problem is simply that since help(os) prints more than 10 
lines, head exits, and python gets EPIPE when writing to the pipe (which is 
normal when there's no reader).

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

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



[issue14556] telnetlib Telnet.expect fails with timeout=0

2012-04-12 Thread Joel Lovinger

Joel Lovinger jlovin...@gmail.com added the comment:

2.4 behavior, time out if there is no more data for X seconds, only worked as 
expected in the case of timeout=0. Any other timeout could result in indefinite 
extension and needed fixing.

2.7 behavior, time out if there is no match for X seconds fixes timeout!=0 
cases while breaking for timeout=0.

Can't get former behavior on timeout=0 in 2.7 using socket.settimeout(). Call 
to socket.recv() then throws a timeout exception which isn't caught by 
Telnet.expect.

I think fixing timeout=0 will require a patch to Telnet.expect. The simplest 
would likely be to insert a very eager type read to grab all data without 
blocking before entering the match loop. Won't need to modify existing timeout 
logic and sidesteps any new corner cases on select/recv iteration.

The only functional side effect (other than moving storage in some cases from 
the socket to the Telnet object) is on greedy RE that will have more data to 
match. Documentation already warns against greedy RE as non-deterministic so 
hopefully not an issue.

--

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



[issue14566] run_cgi reverts to using unnormalized path

2012-04-12 Thread Glenn Linderman

New submission from Glenn Linderman v+pyt...@g.nevcal.com:

While is_cgi carefully normalizes the path using _url_collapse_path, if it 
returns True, then run_cgi is called... which sort of starts out using the 
cgi_info created by is_cgi, but then compares and searches using the original 
self.path value instead.  This effectively bypasses both the normalization done 
by _url_collapse_path and the bugs and potential security problems that the 
normalization was intended to fix!

A simple cure is to replace the first two lines of run_cgi:

path = self.path
dir, rest = self.cgi_info

with:

dir, rest = self.cgi_info
path = '/'.join([ dir, rest ])

While this works, one might wonder why is_cgi splits the normalized path into 
two pieces to start with, if it gets recombined, and generally, dir and rest, 
although initialized from cgi_info, often get recalculated in the loop which 
immediately follows in run_cgi... more often than you might expect, if an 
unnormalized path is in the original request, but if the path comes in 
normalized (or the above fix is applied), and the CGI program actually resides 
directly in one of the cgi_directories directories (rather than below it), then 
the dir and rest calculated by is_cgi are actually used, and the loop performs 
only one half iteration.

--
components: Library (Lib)
messages: 158162
nosy: orsenthil, v+python
priority: normal
severity: normal
status: open
title: run_cgi reverts to using unnormalized path
type: security
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-04-12 Thread Glenn Linderman

Glenn Linderman v+pyt...@g.nevcal.com added the comment:

Happily, this can be cured by overriding and replacing is_cgi, but it shouldn't 
be necessary to do so.

--
components: +Library (Lib)
type:  - behavior
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue14548] garbage collection just after multiprocessing's fork causes exceptions

2012-04-12 Thread Antoine Pitrou

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

But what if Finalize is used to cleanup a resource that gets duplicated in 
children, like a file descriptor?
See e.g. forking.py, line 137 (in Popen.__init__())
or heap.py, line 244 (BufferWrapper.__init__()).

--

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2012-04-12 Thread Amaury Forgeot d'Arc

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

Nick, which version of Python are you using? And which function are you running 
exactly?
It seems that a4fd3dc74299 fixed the issue, this was included with 3.2.

--

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



[issue14567] http/server.py query string handling incorrect, inefficient

2012-04-12 Thread Glenn Linderman

New submission from Glenn Linderman v+pyt...@g.nevcal.com:

A URL potentially consists of four parts: path, PATH_INFO, anchor, 
QUERY_STRING.  The syntax is roughly:

/path/parts/cgi-script/path/info/parts#anchor?query-string

where # and ? characters play key roles.

is_cgi not-so-cleverly passes the whole request to _url_collapse_path for 
normalization, resulting in inappropriately normalizing the anchor and 
query-string as well as appropriately normalizing the path and path info parts. 
 Consider that there is no syntax restrictions preventing a query string or 
anchor from containing / and characters. I contrived such strings, and observed 
that they were passed to _url_collapse_path and were inappropriately 
normalized.

Now for non-CGI usage, both the anchor and query-string are ignored by 
server.py (see translate_path which has code to chop them off). For non-CGI 
usage, translate_path is called just once, so this isn't particularly 
inefficient nor is it incorrect. However, for CGI usage it can be both.

It is not clear to me why browsers even send the anchor to the server, but they 
do. Perhaps there are servers that process it, but this one doesn't, in any 
case I can find, and I'm unaware of semantics applied by any server.  
Therefore, parsing and ignoring it seems appropriate.

Presently, inappropriate normalization of the query-string causes no 
correctness problem for CGI requests because of issue 14566 which reverts back 
to the original path.  Should issue 14566 be fixed as recommended, certain 
query-strings will be mangled by the inappropriate normalization. However, even 
though there is not presently a correctness problem, there is an efficiency 
problem for CGI requests: the anchor and query-string are both needlessly 
processed by _url_collapse_path, and potentially repeatedly processed by 
translate_path in the loop at the top of run_cgi. In fact, it is not exactly 
clear whether anchors and query-strings containing cleverly crafted / and . and 
.. combinations might be able to confuse that loop... because translate_path 
chops them off, but the loop does not!

It seems to me that the appropriate place to separate the anchor and query 
string would be in parse_request.  Instead of creating self.command, self.path, 
self.request_version there, I think it would be better to divide the current 
content of self.path into three parts: self.path, self.anchor, and 
self.query_string.

self.path, then, would unambiguously contain only path parts, and would be 
appropriately passed through _url_collapse_path... perhaps even right there in 
parse_request ... it seems appropriate to normalize the path for reqular files 
as well as CGI files for all the same reasons.

Reasons:
1) no ability to access files outside the configured realm due to malicious use 
of .. as a path component -- although it seems translate_path prevents this 
anyway, in a complex manner.
2) proper application of unquote, to allow # and ? characters to exist in path 
parts, and may also legally be applied to other characters by browser code

Neither of these actions are presently performed for regular files, only for 
CGI files.

If the processing happens in parse_request, then other code would be affected:

is_cgi would no longer need to call _url_collapse_path, as it would already be 
done

translate_path would no longer need to parse off query strings or anchors, as 
it would already be done

translate_path would no longer need to call urllib.parse.unquote, as it would 
already be done.

run_cgi would no longer need to parse anchor or query, but instead could 
reference query as self.query_string

--
components: Library (Lib)
messages: 158166
nosy: orsenthil, v+python
priority: normal
severity: normal
status: open
title: http/server.py query string handling incorrect, inefficient
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue14555] clock_gettime/settime/getres: Add more clock identifiers

2012-04-12 Thread STINNER Victor

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

more_clock_ids.patch: add more clock identifiers. Don't add the following 
clocks: CLOCK_BOOTTIME_ALARM, CLOCK_REALTIME_ALARM, CLOCK_UPTIME_FAST, 
CLOCK_UPTIME_PRECISE, CLOCK_MONOTONIC_PRECISE, CLOCK_REALTIME_PRECISE.

The documentation should be improved :-/

--
keywords: +patch
Added file: http://bugs.python.org/file25196/more_clock_ids.patch

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



[issue11750] Mutualize win32 functions

2012-04-12 Thread Antoine Pitrou

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


--
nosy: +sbt

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Serhiy Storchaka

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

I apologize for misplaced sarcasm. After more careful reading of the source 
code, I found out that the patch really meets the specifications and the 
behavior of all tested me browsers. Despite its awkward appearance, the patch 
fixes a flaw of the original code for this corner case. But it allows the 
passage of an invalid code in strict mode. I think, this problem can be solved 
by a more direct way, perhaps even simplifying the original code.

--

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



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2012-04-12 Thread Robin Schreiber

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

Apparently this issue has not been dealt with for quite some time now. As a 
prospective GSoC student, I still need to submit a patch to pass final 
screening and I thought, that the needed patch here would be quite suitable for 
a beginner. I plan to submit a patch, which simply replaces the deprecated 
method calls with the new ones. 
Maybe we can also remove some parts of the module code, because of the new 
semantics of prepare_v2(), however I would first like to hear Gerhards opinion 
on that :-)

--
nosy: +Robin.Schreiber

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-04-12 Thread Jon Oberheide

Jon Oberheide j...@oberheide.org added the comment:

Here's a v2 patch. Changes include checking the input types via isinstance, 
test cases to exercise the type checking, and a note documenting the leak of 
the input length.

--
Added file: http://bugs.python.org/file25197/hmac-time-independent-v2.patch

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



[issue14568] HP-UX local libraries not included

2012-04-12 Thread Adi Roiban

New submission from Adi Roiban a...@roiban.ro:

Hi,

Sorry for bothering you.

In my initial report, I did not added /usr/local/lib paths , since I was 
thinking that Python should only work with the default library location.
Now I see that /usr/local is added just at the beginning of module building.

The default HPUX system comes with openssl, but for example there is no zlib.

Now, on HPUX one can use the Connect archives from  http://hpux.connect.org.uk/

They come with a nice tool for providing similar functionality like apt-get or 
yum.

zlib is included in HPUX Connect archive.

HPUX Connect packages are installed in /usr/local

With the initial code I was able to build hashlib and other extensions using 
libraries from /usr/local

To include /usr/local/lib/hpux* in the path, I also had to add them to 
self.compiler.library_dirs as otherwise they were not added in LD.

I am not sure how it did work in the first place, since on HPUX openssl is in 
/usr/lib/hpux* and not in /usr/lib/

Here is the code

# HP-UX keeps files in lib/hpux folders.
if platform == 'hp-ux11':
for hpux_path in [
'/usr/lib/hpux64', '/usr/lib/hpux32',
'/usr/local/lib/hpux64', '/usr/local/lib/hpux32',
]:
lib_dirs += hpux_path
add_dir_to_list(self.compiler.library_dirs, hpux_path)

With the following code I was able to also build the extensions using libraries 
from /usr/local on HPUX.

I am new to python build system and I am not sure if this is the right way to 
do it.

I am also new to 'hg'. I have pulled the latest changed for cpython but I can 
not see the previous changes in 'default' branch.

I have attached a patch based on 76268:3df2f4a83816

Thanks!
Adi

--
components: Extension Modules
files: hpux_local_lib.diff
keywords: patch
messages: 158171
nosy: adiroiban
priority: normal
severity: normal
status: open
title: HP-UX local libraries not included
Added file: http://bugs.python.org/file25198/hpux_local_lib.diff

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



[issue14568] HP-UX local libraries not included

2012-04-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +neologix

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



[issue14444] Virtualenv not portable from Python 2.7.2 to 2.7.3 (os.urandom missing)

2012-04-12 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

For posterity, here's the release notes that we had drafted on the pirate pad:

Note: This patch release of Python may have compatibility implications for 
environments utilizing the third-party virtualenv. For more detail see XXX.
[the note above is intended to be included as a line-item in the release notes, 
referencing the file below]
Upgrade issues with virtualenv
==
In order to enact a security fix in Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3, the 
implementation of os.urandom was updated. The implementation of urandom was 
moved from the os module (Python stdlib) to the posix module (built in to the 
Python executable binary). As a result, when upgrading a host to one of these 
new Python versions, virtual environments created with earlier versions of 
Python will now be missing os.urandom. This issue only exists for Unix hosts.
This happens because the virtualenv bundles the older Python executable (which 
does not have an implementation of urandom), but then references the newer 
standard library (in which the os module also does not have an implementation 
of urandom).
In environments where this error occurs, the error is most likely exhibited as 
an AttributeError:
$ $ENV/bin/python -c import os; os.urandom
Traceback (most recent call last):
  File string, line 1, in module
AttributeError: 'module' object has no attribute 'urandom'
Workaround
=
The workaround is to remove the 'python' binary from $ENV/bin and re-run 
virtualenv for the required Python version or versions on that environment. For 
example:
$ rm $ENV/bin/python
$ virtualenv --python python2.7 $ENV
It's necessary to remove the main python binary because virtualenv will not 
replace it if it already exists. If the virtualenv contained multiple Python 
versions, run virtualenv on it again with each Python. If the --distribute flag 
was used in the initial creation of the virtualenv, use it again here.

--

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



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-04-12 Thread Amaury Forgeot d'Arc

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

This is a duplicate of issue12764, which was already fixed for 3.2.2 (in 
September 2011)
Which version of python are you using exactly?
What does import platform; platform.python_revision() return?

--
nosy: +amaury.forgeotdarc

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



[issue14569] pystate.c #ifdef ordering problem

2012-04-12 Thread Jim Jewett

New submission from Jim Jewett jimjjew...@gmail.com:

The C linkage is guarded by WITH_THREAD.  The 'extern C {' and '}' 
declarations should be in effect regardless of threading.

Note that the bug can only be triggered by compiling without threads, but with 
a C++ compiler; this is obscure enough that I don't feel strongly about 
backporting.

--
components: Interpreter Core
keywords: easy
messages: 158174
nosy: Jim.Jewett
priority: normal
severity: normal
status: open
title: pystate.c #ifdef ordering problem
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2012-04-12 Thread Nick

Nick spaun2002mob...@gmail.com added the comment:

Originally I tried 3.2.2 (32bit), but I've just checked 3.2.3 and got the same.
A code for reproduce is simple:

from socket import gethostbyaddr
a = gethostbyaddr('127.0.0.1')

leads to:
Traceback (most recent call last):
  File C:\Users\user\test\test.py, line 13, in module
a = gethostbyaddr('127.0.0.1')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 5: invalid 
continuation byte

Or more complex sample:

def main():
import http.server
port = 80
handlerClass = http.server.SimpleHTTPRequestHandler
srv = http.server.HTTPServer((, port), handlerClass )
srv.serve_forever()
if __name__ == __main__:
main()

Attempt of connection to the server leads to:


Exception happened during processing of request from ('127.0.0.1', 1156)
Traceback (most recent call last):
  File C:\Python32\lib\socketserver.py, line 284, in _handle_request_noblock
self.process_request(request, client_address)
  File C:\Python32\lib\socketserver.py, line 310, in process_request
self.finish_request(request, client_address)
  File C:\Python32\lib\socketserver.py, line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File C:\Python32\lib\socketserver.py, line 637, in __init__
self.handle()
  File C:\Python32\lib\http\server.py, line 396, in handle
self.handle_one_request()
  File C:\Python32\lib\http\server.py, line 384, in handle_one_request
method()
  File C:\Python32\lib\http\server.py, line 657, in do_GET
f = self.send_head()
  File C:\Python32\lib\http\server.py, line 701, in send_head
self.send_response(200)
  File C:\Python32\lib\http\server.py, line 438, in send_response
self.log_request(code)
  File C:\Python32\lib\http\server.py, line 483, in log_request
self.requestline, str(code), str(size))
  File C:\Python32\lib\http\server.py, line 517, in log_message
(self.address_string(),
  File C:\Python32\lib\http\server.py, line 559, in address_string
return socket.getfqdn(host)
  File C:\Python32\lib\socket.py, line 355, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 5: invalid 
continuation byte


P.S. My PC name is USER-ПК

--

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



[issue14569] pystate.c #ifdef ordering problem

2012-04-12 Thread Jim Jewett

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

http://hg.python.org/cpython/file/0f114b855824/Python/pystate.c#l25


#ifdef WITH_THREAD
#include pythread.h
static PyThread_type_lock head_mutex = NULL; /* Protects interp-tstate_head */
#define HEAD_INIT() (void)(head_mutex || (head_mutex = 
PyThread_allocate_lock()))
#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK)
#define HEAD_UNLOCK() PyThread_release_lock(head_mutex)
 
#ifdef __cplusplus
extern C {
#endif

--
priority: normal - low
stage:  - needs patch
type:  - compile error

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



[issue9960] test_structmembers fails on s390x (bigendian 64-bit): int/Py_ssize_t issue

2012-04-12 Thread Dave Malcolm

Dave Malcolm dmalc...@redhat.com added the comment:

The originally attached patch is no good for the the 2.* branch, as it appears 
that _testcapimodule.c will not become ssize_t safe in Python 2.*; see e.g.:
  http://hg.python.org/cpython/rev/3ecddf168f1f

Am attaching a revised patch that I'm applying downstream in Fedora's builds of 
2.7.3

--
Added file: 
http://bugs.python.org/file25199/fix-test_structmember-on-64bit-bigendian.patch

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2012-04-12 Thread STINNER Victor

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

a4fd3dc74299 only fixed socket.gethostname(), not socket.gethostbyaddr().

--

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



[issue12991] Python 64-bit build on HP Itanium - Executable built successfully but modules failed with HP Compiler

2012-04-12 Thread Adi Roiban

Changes by Adi Roiban a...@roiban.ro:


--
nosy: +adiroiban

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



[issue1572968] release GIL while doing I/O operations in the mmap module

2012-04-12 Thread Adi Roiban

Changes by Adi Roiban a...@roiban.ro:


--
nosy: +adiroiban

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



[issue9123] insecure os.urandom on VMS

2012-04-12 Thread Adi Roiban

Changes by Adi Roiban a...@roiban.ro:


--
nosy: +adiroiban

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



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2012-04-12 Thread Adi Roiban

Adi Roiban a...@roiban.ro added the comment:

I am not sure how the search works, but for example I was not able to reach 
http://bugs.python.org/issue5895 while searching for hpux or hp-ux using the 
internal search.

Also I was not able to find any aix or solaris bug.

In case you bump over an hpux, aix, solaris bug, please add me to the noisy 
list and I will take a look.

Thanks!
Adi

--

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



[issue14548] garbage collection just after multiprocessing's fork causes exceptions

2012-04-12 Thread sbt

sbt shibt...@gmail.com added the comment:

 But what if Finalize is used to cleanup a resource that gets 
 duplicated in children, like a file descriptor?
 See e.g. forking.py, line 137 (in Popen.__init__())
 or heap.py, line 244 (BufferWrapper.__init__()).

This was how Finalize objects already acted (or were supposed to).

In the case of BufferWrapper this is intended.  BufferWrapper objects do not 
have reference counting semantics.  Instead the memory is deallocated when the 
object is garbage collected in the process that created it.  (Garbage 
collection in a child process should *not* invalidate memory owned by the 
parent process.)  You can prevent the parent process from garbage collecting 
the object too early by following the advice below from the documentation:

  Explicitly pass resources to child processes

On Unix a child process can make use of a shared resource created in a 
parent process using a global resource. However, it is better to pass 
the object as an argument to the constructor for the child process.

Apart from making the code (potentially) compatible with Windows this 
also ensures that as long as the child process is still alive the object 
will not be garbage collected in the parent process. This might be 
important 
if some resource is freed when the object is garbage collected in the 
parent process.

In the case of the sentinel in Popen.__init__(), it is harmless if this end of 
the pipe gets accidentally inherited by another process.  Since Process does 
not have a closefds argument like subprocess.Popen unintended leaking happens 
all the time.  And even without the pid check, I think this finalizer would 
very rarely be triggered in a child process.  (A Process object can only be 
garbage collected after it has been joined, and it can only be joined by it 
parent process.)

--

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



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2012-04-12 Thread R. David Murray

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

Search is currently not returning all matching issues, unfortunately.  You 
might get a few more hits by searching for hpux in the title field via advanced 
search.

--
nosy: +r.david.murray

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



[issue14399] zipfile and creat/update comment

2012-04-12 Thread Roundup Robot

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

New changeset ac0ec1f31b0a by R David Murray in branch '2.7':
#14399: zipfile now correctly handles comments added to empty zipfiles.
http://hg.python.org/cpython/rev/ac0ec1f31b0a

New changeset 4186f20d9fa4 by R David Murray in branch '3.2':
#14399: zipfile now correctly handles comments added to empty zipfiles.
http://hg.python.org/cpython/rev/4186f20d9fa4

New changeset e5b30d4b0647 by R David Murray in branch 'default':
Merge #14399: zipfile now correctly handles comments added to empty zipfiles.
http://hg.python.org/cpython/rev/e5b30d4b0647

--
nosy: +python-dev

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



[issue14399] zipfile and creat/update comment

2012-04-12 Thread R. David Murray

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

Thanks, Serhiy.

I made one small change, using 'with self.assertEqual' in the TypeError test.  
You might want to check that out, it is a useful technique.

Oh, and I removed the type check from the 2.7 patch.  You can use a unicode 
string as long as it doesn't contain non-ASCII (the reason we created 
python3!), so it would be a backward incompatible change to raise a TypeError 
there.

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

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



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-04-12 Thread aliles

aliles aaron.i...@gmail.com added the comment:

Should I build a version from the tip of the 3.2 or default branch on 
hg.python.org?

This version is Python 3.2.2 built using homebrew. The revision is being 
reported as an empty string.

Python 3.2.2 (default, Dec 18 2011, 18:56:20) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type help, copyright, credits or license for more information.
 import platform
 platform.python_revision()
''
 platform.python_version_tuple()
('3', '2', '2')
 platform.python_build()
('default', 'Dec 18 2011 18:56:20')
 platform.release()
'11.3.0'
 platform.version()
'Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; 
root:xnu-1699.24.23~1/RELEASE_X86_64'

Sorry, I did a search but didn't find issue12764. :-(

--

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



[issue14538] HTMLParser: parsing error

2012-04-12 Thread Ezio Melotti

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

Attached a new patch with a few more tests and a simplification of the attrfind 
regex.


 But it allows the passage of an invalid code in strict mode.

HTMLParser is following the HTML5 specs, and doesn't do validation, so there's 
no strict mode (and the strict mode of Python 3 will be removed/deprecated 
soon).

 I think, this problem can be solved by a more direct way,
 perhaps even simplifying the original code.

This might be true, but I'm quite happy with this patch for now.  Maybe one day 
I'll rewrite it.


 Unless there is a specification somewhere (or at least an editor's
 draft), I can't really see any particular parse as a bugfix.

If HTMLParser doesn't parse as the HTML5 specs say, then it's considered a bug.

--
Added file: http://bugs.python.org/file25200/issue14538-2.diff

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



[issue1559549] ImportError needs attributes for module and file name

2012-04-12 Thread Brett Cannon

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


--
assignee: brian.curtin - brett.cannon

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



[issue14428] Implementation of the PEP 418

2012-04-12 Thread STINNER Victor

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

Patch version 7:
 - Add time.perf_counter() and time.process_time()
 - Replace accuracy key with precision in time.get_clock_info() result

--
Added file: http://bugs.python.org/file25201/pep418-7.patch

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



[issue14428] Implementation of the PEP 418

2012-04-12 Thread STINNER Victor

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

perf_counter_process_time.patch: replace time.clock if windows else time.time 
with time.perf_counter, and getrusage/clock with time.process_time.

pybench and timeit now use time.perf_counter() by default. profile uses 
time.proces_time() by default.

pybench uses time.get_clock_info() to display the precision and the underlying 
C function (or the resolution if the precision is not available).

Tools/pybench/systimes.py and Tools/pybench/clockres.py may be removed: these 
features are now available directly in the time module.

--
Added file: http://bugs.python.org/file25202/perf_counter_process_time.patch

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



  1   2   >