[issue11962] Buildbot reliability

2011-05-05 Thread Stefan Krah

Stefan Krah  added the comment:

The FreeBSD bot had these error messages in the log files:

1) kernel: swap_pager: indefinite wait buffer: device
2) Approaching the limit on PV entries, consider increasing either the 
vm.pmap.shpgperproc or the vm.pmap.p
v_entry_max sysctl.


I set up the bot from scratch with these changes:

a) Use swap partition (2GB) instead of swap file (2 GB).

b) Use these sysctls:

 kern.ipc.shm_use_phys=1
 vm.pmap.shpgperproc=4096
 vm.pmap.pv_entry_max=16777216

c) Use self-compiled Python2.7 instead of the system Python2.6.


Let's see how that works out. Error 1) is bad, perhaps FreeBSD
does not play well with the qcow2 file system under high load.

--

___
Python tracker 

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



[issue11962] Buildbot reliability

2011-05-05 Thread Stefan Krah

Stefan Krah  added the comment:

On second thought, I don't want to debug possible qcow2 issues, so
I made another change:

d) Use raw format for the image.

--

___
Python tracker 

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



[issue12005] modulo result of Decimal differs from float/int

2011-05-05 Thread Daniel Albeseder

New submission from Daniel Albeseder :

I know that the modulo operation for negative values is not well defined, but I 
would at least expect that the result is the same no matter if you use ints, 
floats or decimals. However Decimal seem to behave else than the builtin types.

Python 3.1.2 (release31-maint, Sep 17 2010, 20:27:33) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> -3 % 5
2
>>> -3. % 5.
2.0
>>> Decimal(-3) % Decimal (5)
Decimal('-3')
>>> 

I could reproduce the same for python 2.6.6.

--
components: Library (Lib)
messages: 135176
nosy: Kotan
priority: normal
severity: normal
status: open
title: modulo result of Decimal differs from float/int
type: behavior
versions: Python 2.6, Python 3.1

___
Python tracker 

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



[issue12005] modulo result of Decimal differs from float/int

2011-05-05 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-05 Thread Erik Cederstrand

New submission from Erik Cederstrand :

Python is via datetime.isocalendar() able to produce the ISO week number and 
ISO weekday from a given date. But it is not possible to do the reverse; 
calculate the date from a year, ISO week number and weekday.

libc strptime()/strftime() mentions a %V and %u directive which does this, i.e. 
Monday in ISO week 22 of the year 2011:

   datetime.strptime('2011221', '%Y%V%u')

returning 2011-05-30 and

   datetime.strptime('2011227', '%Y%V%u')

returning 2011-06-05


libc (on FreeBSD) has this to say:

%V is replaced by the week number of the year (Monday as the first day
   of the week) as a decimal number (01-53).  If the week containing
   January 1 has four or more days in the new year, then it is week 1;
   otherwise it is the last week of the previous year, and the next
   week is week 1.

%u is replaced by the weekday (Monday as the first day of the week) as
   a decimal number (1-7).

--
components: Library (Lib)
messages: 135177
nosy: Erik.Cederstrand
priority: normal
severity: normal
status: open
title: strptime should implement %V or %u directive from libc
type: feature request

___
Python tracker 

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



[issue11015] Bring test.support docs up to date

2011-05-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

I left a few comments on rietveld for the testdoc and remove_fcmp patches.
Unless I'm missing something, assertEqual works just fine in all the places 
where fcmp was used, so there's no need to use assertAlmostEqual.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-05 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +belopolsky

___
Python tracker 

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



[issue12003] documentation: alternate version of xrange seems to fail.

2011-05-05 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, rhettinger

___
Python tracker 

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



[issue1046092] HTMLParser fix to accept malformed tag attributes

2011-05-05 Thread svilen dobrev

svilen dobrev  added the comment:

this seems to eat too much into data and gets past endpos of the chunk 
processed, and parser gets confused and treats any subsequent stuff as data. i 
didn't think out how to fix the regexp as such, but instead limited its span to 
:endpos so it doesnot eat too much. 
seems to happen with unquoted attributes.

--
nosy: +svilend
Added file: http://bugs.python.org/file21891/html.parser.diff

___
Python tracker 

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



[issue1046092] HTMLParser fix to accept malformed tag attributes

2011-05-05 Thread svilen dobrev

Changes by svilen dobrev :


Added file: http://bugs.python.org/file21892/test-htmlparser-attrs.py

___
Python tracker 

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



[issue1046092] HTMLParser fix to accept malformed tag attributes

2011-05-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

This issue is closed, so it's better if you create a new issue.
Even better if you can attach a patch that adds a testcase to 
Lib/test/test_htmlparser.py

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue12007] Console commands won't work

2011-05-05 Thread Jakob Aga

New submission from Jakob Aga :

[PCLOS KDE 2010.12] Console commands (in Konsole & Yakuake) won't work in 
Python 3.2. Like ctrl+l for clearing the screen, arrow keys up & down for 
scrolling through previous python commands. Instead I get e.g. ^L (ctrl+l) and 
^[[A (arrow up) on the interpreter line.
At first I looked through Synaptic (reload etc.), then I tried compiling the 
3.2 version - and built it with 'luck' (yay:)).
The interpreter 'works' by itself though. It's just that I miss doing the usual 
console stuff. 3.2 is installed side by side with Python 2.6, and I haven't had 
any problems with Python 2.x
I've posted this problem on the forums of PCLOS, but no one can answer. 
Hopefully someone here can...?

--
components: IO
messages: 135181
nosy: jake_mcaga
priority: normal
severity: normal
status: open
title: Console commands won't work
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue12008] HtmlParser non-strict goes wrong with unquoted attributes

2011-05-05 Thread svilen dobrev

New submission from svilen dobrev :

nonstrict mode seems to eat too much into data and gets past endpos of the 
chunk processed, and parser gets confused and treats any subsequent stuff as 
data. i didn't think out how to fix the regexp as such, but instead limited its 
span to :endpos so it doesnot eat too much. 
seems to happen with unquoted attributes.

--
files: html.parser.diff
keywords: patch
messages: 135182
nosy: svilend
priority: normal
severity: normal
status: open
title: HtmlParser non-strict goes wrong with unquoted attributes
Added file: http://bugs.python.org/file21893/html.parser.diff

___
Python tracker 

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



[issue12008] HtmlParser non-strict goes wrong with unquoted attributes

2011-05-05 Thread svilen dobrev

Changes by svilen dobrev :


--
components: +Library (Lib)
type:  -> behavior
versions: +Python 3.2
Added file: http://bugs.python.org/file21894/test-htmlparser-attrs.py

___
Python tracker 

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



[issue12008] HtmlParser non-strict goes wrong with unquoted attributes

2011-05-05 Thread svilen dobrev

svilen dobrev  added the comment:

(the nonstrict regexp came with Issue1046092)

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Thu,  5 May 2011 03:52:29 +0200, R. David Murray wrote:
> [..] the shell [..] I believe it just looks at the mtime/atime.

/* check_mail () is useful for more than just checking mail.  Since it has
   the paranoids dream ability of telling you when someone has read your
   mail, it can just as easily be used to tell you when someones .profile
   file has been read, thus letting one know when someone else has logged
   in.  Pretty good, huh? */

  /* If the user has just run a program which manipulates the
 mail file, then don't bother explaining that the mail
 file has been manipulated.  Since some systems don't change
 the access time to be equal to the modification time when
 the mail in the file is manipulated, check the size also.  If
 the file has not grown, continue. */

 /* If the mod time is later than the access time and the file
 has grown, note the fact that this is *new* mail. */

> Not all system mail spools are mode 1777.  Mutt needs to be
> setgid mail on systems that aren't, if I understand correctly.
> Making a python program setgid mail is a bit more of security
> issue than making a well-tested C program setgid, since it is
> easier to break out of the box in a python program.

Ok, maybe set-group-ID on /var/mail isn't even necessary;
0 drwxrwxx-x3 root  mail   102  5 May 11:30 mail
is enough as long as
$ groups $USER
states you are member of group mail.  On my system mailbox.py
doesn't have any problems with modifying the mail directory.
If this is not true on your box go and stress your admin, he's not
worth his money - is he?
I.e., whereas it is possible to rewrite mailbox.py to handle issue
#7359 i would not do so because it is unnecessary on correctly
setup boxes.  Maybe mailbox.py has used so much copy-and-paste
from mutt(1)'s mbox.c because that code works well for many years.
And Jason seems to work as root all of the time.

> mailbox is an mbox manipulation program, not a mail delivery
> agent.  If you are using it to write a mail delivery agent,
> I think perhaps the mtime setting code belongs in your
> application, not the mailbox module.

I really don't understand your point now.
Of course the standart is soft like butter in that it seems to
assume that the spool mailbox is then locally processed and
truncated to zero length, so that "mailbox has grown==new mail
arrived", whereas it is also possible to use that spool file as
a real local mailbox, including resorting, partial deletion etc..

This issue is about fixing mailbox.py to adhere MMDF and MBOX
standarts, which is what the patch implements.
This patch works for me locally in that mutt(1) will mention that
new mail has arrived in the boxes.

The patch uses a safe approach by dating back the access time
instead of pointing modification time into the future, which
however will make the patch fail on Pear OS X if the mailbox is on
HFS, case sensitive, because that is buggy and *always* updates
atime; maybe this is because Apple only provides a shallow wrapper
around UFS to integrate that in the Microkernel/IOKit structure,
just in case HFS, case sensitive is really UFS, but i'm guessing
in all directions here.  I would not adjust the patch to fix this,
but the problem exists and it has been noted in this issue.

--
Steffen
sdao...@gmail.com

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Thu,  5 May 2011 03:52:29 +0200, R. David Murray wrote:
> [..] the shell [..] I believe it just looks at the mtime/atime.

   Pretty good, huh?

Mr. Mojo says:

Prowd to be a part of this number.
Successful hills are here to stay.
Everything must be this way.

--

___
Python tracker 

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



[issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

2011-05-05 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, giampaolo.rodola

___
Python tracker 

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



[issue11997] One typo in Doc/c-api/init.rst

2011-05-05 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 76a2354aa427 by Ezio Melotti in branch '2.7':
#11997: fix typo in init.rst.
http://hg.python.org/cpython/rev/76a2354aa427

New changeset 3aa51217492c by Ezio Melotti in branch '3.1':
#11997: fix typo in init.rst.
http://hg.python.org/cpython/rev/3aa51217492c

New changeset 5a2d42a8c1ab by Ezio Melotti in branch '3.2':
#11997: merge with 3.1.
http://hg.python.org/cpython/rev/5a2d42a8c1ab

New changeset 7c9717836c28 by Ezio Melotti in branch 'default':
#11997: merge with 3.2.
http://hg.python.org/cpython/rev/7c9717836c28

--
nosy: +python-dev

___
Python tracker 

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



[issue11997] One typo in Doc/c-api/init.rst

2011-05-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed, thanks for the patch.

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

___
Python tracker 

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2011-05-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

Can you prove that the second one is useless (did it cause you any problem or 
did you just find it reading the source)?
There might be reasons why there are two calls to fp.tell() (e.g. the result is 
different in the two places and/or zinfo.header_offset is read/changed 
somewhere else between the two calls).

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue12005] modulo result of Decimal differs from float/int

2011-05-05 Thread Mark Dickinson

Mark Dickinson  added the comment:

I believe that this was a deliberate design decision, though now that I look it 
seems it's not well documented.  That should probably be fixed, so I see this 
as a documentation issue.

More details:

The specification on which the decimal module is based requires that there be a 
'remainder' operation with the semantics of Decimal's '%' operation (i.e., the 
result of x % y has the sign of x).  However, the specification doesn't say 
anything about how the prescribed operations should map to language constructs.

So the choice was between (1) leaving '%' for Decimal objects unimplemented, 
and providing a separate 'remainder' method, or (2) mapping '%' to Decimal's 
remainder operation, and accepting the slight mismatch between the '%' 
semantics for float and Decimal.

Perhaps the wrong choice was made.  But it's there now, and to me it's not so 
obviously wrong that it's worth the upheaval of deprecating '%' for Decimal 
objects.

Of course there's a third choice, which is to implement the float % semantics 
for the Decimal type;  however, this is outside the scope of the 
specification---none of the specified operations matches this behaviour, and 
I'd oppose the addition of such an operation to the Decimal module.  There's a 
strong sense in which Decimal's % is a more natural operation for 
floating-point types than float's %.  (For one thing, it's exact in many 
circumstances, while float's % suffers from surprising results with negative 
operands.)

Reclassifying as a documentation issue.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

Yes if you are a member of group mail you would not need setgid mail, obviously.

The problem report in question was submitted by one of the Debian maintainers, 
so I have to believe that the system in question was not misconfigured.  This 
part of the discussion should move to that issue, I think.  I guess I was wrong 
to link them :)

So, if the mailbox code is imitating mutt (and it may well be, the bulk of it 
was written as a summer of code project in 2005), what does mutt do in the case 
you are talking about?

--

___
Python tracker 

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



[issue12005] modulo result of Decimal differs from float/int

2011-05-05 Thread Mark Dickinson

Mark Dickinson  added the comment:

The doc change should also note that // and divmod suffer from a similar 
mismatch:

>>> Decimal(-2) // Decimal(3)
Decimal('-0')
>>> -2 // 3
-1
>>> -2.0 // 3
-1.0

However, the invariant that x = x // y * y + x % y is retained, as it should be.

--

___
Python tracker 

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



[issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

2011-05-05 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
assignee:  -> giampaolo.rodola

___
Python tracker 

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2011-05-05 Thread Johan Euphrosine

Johan Euphrosine  added the comment:

I just find it while reading the source, for fixing #11980

zinfo.header_offset is only read in self._write_check, and it seems to me that 
no file operation are performed on self.fp between the two call. So I can't see 
see how it could different.

Also the tests suite still pass after removing the second one :)

Let me know if you want me to do more investigation.

--

___
Python tracker 

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



[issue10775] assertRaises as a context manager should accept a 'msg' keyword argument.

2011-05-05 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy:  -ncoghlan

___
Python tracker 

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



[issue11690] Devguide: Add "communication" FAQ

2011-05-05 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee: docs@python -> ncoghlan

___
Python tracker 

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



[issue11647] function decorated with a context manager can only be invoked once

2011-05-05 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> ncoghlan
versions: +Python 3.2, Python 3.3

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

@sdaoden(, @pitrou): Antoine proposes to skip the zlib "big buffer" (1 GB) test 
on 32 bits system. What do you think?

On 64 bits system, we check a buffer of 2 GB-1 byte (0x7FFF bytes). Is the 
test useful or not? What do we test?

Can you check if the test crashs on Mac OS X on a 32 bits system (1 GB buffer) 
if you disable F_FULLFSYNC in mmapmodule.c? Same question on a 64 bits system 
(2 GB-1 byte buffer)?

The most important test if to test crc32 & adler32 with a buffer bigger than 4 
GB, but we cannot write such test in Python 2.7 because the zlib module stores 
buffer sizes into int variables. So the "big buffer" test of Python 2.7 
test_zlib is maybe just useful (on 32 and 64 bits). Can we just remove the test?

--

___
Python tracker 

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2011-05-05 Thread Johan Euphrosine

Johan Euphrosine  added the comment:

Here is a log that shows zinfo.header_offset value after each .tell() when 
running test_zipfile

--
Added file: http://bugs.python.org/file21895/zinfo.header_offset.log

___
Python tracker 

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



[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

> If the user base cannot be calculated, paths
> starting with ~ should not exist or be used at all in this context.

It's not "~" but "{userbase}" substitution variable.

Here is a new patch implementing this idea: don't create the variables using 
the user directory if the user doesn't exist (if we cannot get the user 
directory). I didn't test distutils, I just try to start Python (it does work 
using bug.c).

--
Added file: http://bugs.python.org/file21896/nonexistent_user.patch

___
Python tracker 

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



[issue12009] netrc module crashes if netrc file has comment lines

2011-05-05 Thread Ruslan Mstoi

New submission from Ruslan Mstoi :

It seems recent patch from Issue 10464 has introduced problems into
one line comment handling of netrc module.


Problem 1:

If there is a line starting with a comment sign the
following traceback is shown:

Traceback (most recent call last):
  File "/usr/lib/python2.7/netrc.py", line 32, in __init__
self._parse(file, fp)
  File "/usr/lib/python2.7/netrc.py", line 90, in _parse
file, lexer.lineno)
netrc.NetrcParseError: bad follower token '#' (./.netrc, line 3)


This can be fixed by modifying netrc.py like this:
71c71
< if (tt=='' or tt == 'machine' or
---
> if (tt=='' or tt == 'machine' or tt[0] == "#" or

Problem 2:

Now with the patch above it seems to work as long as there are
no comment lines like these:

a) with only pound sign:
#

b) with a pound sign followed by text without any space in between
#comment

If comment line like that is followed by netrc token that token
is consumed by fp.readline(). For example, if netrc file has
these contents:

<<<

machine host.domain.com login username password something

# comment1
machine host2.domain.com login username2 password something2

#comment2
machine host3.domain.com login username3 password something3

#
machine host4.domain.com login username4 password something4
>>>

netrc object will have entries only for host3 and host4.

--
messages: 135196
nosy: rmstoi
priority: normal
severity: normal
status: open
title: netrc module crashes if netrc file has comment lines
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

Ah ah, this bug is funny :-) test_regexp doesn't fail because of a race 
condition or a file system issue, but because of the regex!

The regex "ba.*" is applied on the fullname, not only on the basename. If the 
temporary contains "ba", the test fails :-) Replace tempfile.mkdtemp() by 
tempfile.mkdtemp(prefix='bar') in CommandLineTests.setUp() to always reproduce 
this bug.

--

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

Ah ah, this bug is funny :-) test_regexp doesn't fail because of a race 
condition or a file system issue, but because of the regex!

The regex "ba.*" is applied on the fullname, not only on the basename. If the 
temporary contains "ba", the test fails :-) Replace tempfile.mkdtemp() by 
tempfile.mkdtemp(prefix='bar') in CommandLineTests.setUp() to always reproduce 
this bug.

--

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

Ah ah, this bug is funny :-) test_regexp doesn't fail because of a race 
condition or a file system issue, but because of the regex!

The regex "ba.*" is applied on the fullname, not only on the basename. If the 
temporary contains "ba", the test fails :-) Replace tempfile.mkdtemp() by 
tempfile.mkdtemp(prefix='bar') in CommandLineTests.setUp() to always reproduce 
this bug.

--

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
Removed message: http://bugs.python.org/msg135199

___
Python tracker 

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



[issue12000] SSL certificate verification failed if no dNSName entry in subjectAltName

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Are you sure about "if not san and not dnsnames"? It is even more restrictive 
than the currently condition. "if not dnsnames" looks like it would fit the 
bill better.

Also, better if you can provide a complete patch, including additional test(s) 
in Lib/test/test_ssl.py.
(see http://docs.python.org/devguide/runtests.html if you want information 
about running/writing tests)

--
nosy: +pitrou
versions:  -Python 3.4

___
Python tracker 

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



[issue11888] Add C99's log2() function to the math library

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

Updated patch to use the system log2() if it is available. The test pass with 
the system log2() on Linux (Debian Sid, eglibc 2.11.2).

--
Added file: http://bugs.python.org/file21897/issue11888-2.patch

___
Python tracker 

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



[issue12005] modulo result of Decimal differs from float/int

2011-05-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue11965] Simplify context manager in os.popen

2011-05-05 Thread Chris Rose

Chris Rose  added the comment:

I'm pretty sure that the os._wrap_close wrapper is not the same thing as the 
Popen context manager. I don't think it's useful to try refactor this. As 
Antoine points out, the current wrapper serves a very different purpose.

--
nosy: +offby1

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

@haypo: trouble, trouble on the dev-list, as i've seen currently.
Sorry, sorry.  (Cannot subscribe, my DynIP's are often blacklisted ;)
Of course my comments were completely wrong, as Ethan has pointed
out correctly.

This is all s**t.  These are mmap(2) related issues and should be
tested in Lib/test/test_mmap.py.  However that does not use
with open:
create sparse file
materialize
yet so that the Pear OS X sparsefile bug doesn't show up.  In fact
it doesn't do a full beam-me-up test at all yet?

> Is the test useful or not? What do we test?

We do test that mmap.mmap materializes a buffer which can be
accessed (readonly) from [0]..[len-1].
And that the checksums that zlib produces for that buffer are
correct.  Unfortunately we cannot test 0x8000+ no more because
Python prevents that such a buffer can be used - that's a shame.
Maybe we could test 0x7FFF*2 aka 0xfffe in two iterations.

> Can you check if the test crashs on Mac OS X on a 32 bits system
> (1 GB buffer) if you disable F_FULLFSYNC in mmapmodule.c? Same
> question on a 64 bits system (2 GB-1 byte buffer)?

Aeh - F_FULLFSYNC was not yet committed at that time in 2.7.

> Can we just remove the test?

If i - choke! - need to write tests, i try to catch corner cases.
The corner cases would be 0,MAX_LEN(-1) and some (rather pseudo)
random values around these and maybe some in the middle.
(Plus some invalid inputs.)

Can we remove it?  I would keep it, Apple is preparing the next
major release (uname -a yet states 10.7.0 even though it's
10.6.7), and maybe then mmap() will fail for 0xDEADBEEF.
Who will be the one which detects that otherwise??

--

___
Python tracker 

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



[issue11647] function decorated with a context manager can only be invoked once

2011-05-05 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e4ba097123f6 by Nick Coghlan in branch '3.2':
Issue #11647: allow contextmanager objects to be used as decorators as 
described in the docs. Initial patch by Ysj Ray.
http://hg.python.org/cpython/rev/e4ba097123f6

New changeset b23d1df7e47e by Nick Coghlan in branch 'default':
Merge #11647 update from 3.2
http://hg.python.org/cpython/rev/b23d1df7e47e

--
nosy: +python-dev

___
Python tracker 

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



[issue12000] SSL certificate verification failed if no dNSName entry in subjectAltName

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

P.S.: if you're really right ('have those RFC's, but didn't read
them yet), you could also open an issue for Mercurial at
http://mercurial.selenic.com/bts - i think those guys do the very
same.

Thanks, Steffen!

--
nosy: +sdaoden

___
Python tracker 

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



[issue11647] function decorated with a context manager can only be invoked once

2011-05-05 Thread Nick Coghlan

Nick Coghlan  added the comment:

The core bug has been fixed for 3.2.1 and forward ported to 3.3.

I credited the patch to "Ysj Ray" in ACKS and NEWS, let me know if you'd prefer 
a different attribution.

Leaving the issue open for now, since _recreate_cm() should be renamed and 
documented for 3.3 (but I haven't settled on a public name at this point - 
recreate_cm() isn't quite right for the public API, as reusable CMs aren't 
actually recreated by the method)

--
versions:  -Python 3.2

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Thu,  5 May 2011 13:42:29 +0200, R. David Murray wrote:
> what does mutt do in the case you are talking about?

16 -rwxr-s---  1 steffen  mail  14832 23 Jan 19:13 usr/bin/mutt_bitlock
set bitlock_program="~/usr/bin/mutt_bitlock -p"

I see.  Unfortunately the world is not even almost perfect.
So should f?truncate(2) be used if the resulting file is empty?

> what does mutt do in the case you are talking about?

Otherwise there is only one solution: a mailbox-is-readonly policy
has to be introduced.
That will surely drive users insane which see that they in fact
have write access to the file.
Python has got bad cards.

--

___
Python tracker 

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-05 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

This is a reasonable request and easy to implement.  I am not sure how often 
this functionality is needed, so I am only +0 on this feature.

--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.3

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

> The problem report in question was submitted by one of the
> Debian maintainers.

Yeah, a documentainer at least.
I've used Debian (Woody i think that was 3.1).
Actually great because Lehmanns, Heidelberg, Germany did not
include the sources but they've sent me the sources (on seven CD's
as far as i remember) for free after i've complained.

Linux is really great.  You don't need internet access at all
because of that fantastic documentation, everywhere.  You look
into /dev and /sys and /proc and it's all so translucent!!  And
the GNU tools and libraries - they are so nicely designed.
The source code is so clean.  It's really an enlightened system.

Then i discovered FreeBSD 4.8 which released me from all that.
\|/
_ .
 |
 -
 |
(I still had hairs at that time.  But that was long ago.)

--

___
Python tracker 

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



[issue6116] frame.f_locals keeps references to things for too long

2011-05-05 Thread Facundo Batista

Facundo Batista  added the comment:

Making a copy of f_locals values to return a dictionary that doesn't hold 
references to the locals of the frame is not that simple (for me, at least):

- shallow copy: we'll return always a new dict, with the values being a copy of 
locals; this is simpler, but what about other objects that are referenced in in 
those values? For example, in locals exists a list A which holds a reference to 
object B; the new dict we return will have copy of A, but this copy will still 
reference B.

- deep copy: we'll return a new dict with a deep copy of all values; this is 
safer, but what about memory? In any case, how we could do a deep copy here? 
calling Python's code copy.deepcopy()?

I want to add a fourth option to JP's initial ones:

- have other attribute, something like f_locals_weak that is a list of tuples 
[(name, value), ...], being the values a weak reference to the real locals.

What do you think?

Regards,

--
nosy: +facundobatista

___
Python tracker 

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



[issue665194] datetime-RFC2822 roundtripping

2011-05-05 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Rather than shoehorning datetime class support into existing functions, I think 
a separate set of functions should be written to convert between RFC 2822 
timestamps and datetime instances.  Currently, email.utils has three functions 
dealing with date-time specification in email messages:

formatdate(timeval=None, localtime=False, usegmt=False),
parsedate(data),
parsedate_tz(data)

To work with datetime instances, we can just provide two functions.  For lack 
of better names, I'll call them format_datetime and parse_datetime.  Rather 
than using a localtime flag in the format function, I suggest to always 
interpret naive datetime instances (those with tzinfo = None) as time given in 
UTC with no information about the local time zone. Per RFC  2822, this should 
be formatted with "-" in the timezone field.  The format_datetime() may 
take usegmt flag, but it may be better to handle usegmt=True case by a separate 
format_datetime_gmt() function.

The parse_datetime() function should use a similar convention and produce aware 
datetime instances unless TZ field contains "-".  In this case a naive 
datetime containing unchanged time data should be produced.

The problem of guessing the local timezone offset or converting naive datetime 
instance presumed to be in local time to an aware instance does not belong to 
the email package.  This functionality should be added to the datetime module.  
See issue 9527.

There is a remaining question to which I don't have an immediate answer: How 
should parse_datetime() handle valid RFC 2882 date-time specifications that 
cannot be represented as a valid datetime.  For example, a spec with seconds=60 
or timezone > 2400.

--

___
Python tracker 

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



[issue11965] Simplify context manager in os.popen

2011-05-05 Thread Éric Araujo

Éric Araujo  added the comment:

Looks like I’ve misunderstood and there is no duplication.  If you feel sure 
about it, please reject and close this report.

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

Steffen, your sense of humor is great, but oftentimes I have no clue what you 
are talking about.  Where does ftruncate factor in?

I was asking what mutt does when it modifies a file in the hopes that it had 
some pithy algorithm for making sure the mailbox atime and utime conform to the 
semi-standard you are talking about, so we could steal it.

I'd like to see a solution to this issue.  My two problems with your patch are 
(1) it feels wrong to set the atime earlier than the last actual atime and (2) 
unconditionally doing the work in flush means it might get set even when there 
wasn't an intended "new mail" condition.

In other words, I think the fix is ugly :).  However, neither of those concerns 
are necessarily blockers.  Practicality beats purity in many cases, and this 
may be one of them.

--

___
Python tracker 

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



[issue6116] frame.f_locals keeps references to things for too long

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Making a copy of f_locals values to return a dictionary that doesn't 
> hold references to the locals of the frame is not that simple

I think you misunderstood the bug report. The issue here is not that locals are 
referenced from the dict, it's that the dict is kept alive (since it is cached) 
longer that it should.

By the way, reading the discussion again, I think we could simply make dicts 
weak-referenceable. A dict is already quite big in memory and I don't think 
adding a pointer to the struct would make a significant difference.

--
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +belopolsky

___
Python tracker 

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



[issue12007] Console commands won't work

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

I believe this is out of scope for Python itself, and is a platform 
distribution issue.  The platform must do some special magic to make those 
things work; they don't in a vanilla python build as far as I know.  You might 
look to your readline configuration for clues.

--
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> pending

___
Python tracker 

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



[issue12009] netrc module crashes if netrc file has comment lines

2011-05-05 Thread R. David Murray

Changes by R. David Murray :


--
keywords: +easy
nosy: +r.david.murray
stage:  -> test needed
type: crash -> behavior

___
Python tracker 

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



[issue6116] frame.f_locals keeps references to things for too long

2011-05-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I vote for option 1. We already eschew hacks with locals().

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 76bd26565cc7 by R David Murray in branch '3.2':
#11873: Improve test regex so random directory names don't cause test to fail
http://hg.python.org/cpython/rev/76bd26565cc7

New changeset 83e069281810 by R David Murray in branch 'default':
Merge: #11873: Improve test regex so random directory names don't cause test to 
fail
http://hg.python.org/cpython/rev/83e069281810

--
nosy: +python-dev

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

I ran the patched version 2945 times without failure.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

+self.assertRunOK('-q', '-x', 'ba[^\/]*$', self.pkgdir)

This regex matchs 'ba(...)\'. I think that you wanted to write r'[^\\/]'.

--

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Quick review at http://bugs.python.org/review/8407/show

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

After half an hour of shallow inspection.

mutt really modifies mailbox files in place (mbox_sync_mailbox())
after creating (all the new tail in) a temporary file.  Then
seek()/write()/truncate() etc..  It however has mutt_dotlock(1)
and it does block signals and it is a standalone program and thus
i don't think this behaviour can be used by Python.

In respect to our issue here i must really admit that mutt does:

prepare new tail
stat box
modify box to incorporate tail
close box
utime box with stat result times
reopen box

So actually the result looks as if it never has been modified.
But maybe it is because like this it is in sync with the standart,
since strictly speaking there is no *new* mail in the box.

Unless you vote against it i'll write a patch tomorrow which will
use a state machine which only triggers the utime if some kind of
setitem has occurred.  I can't help you to overcome your malaise
against soiling an atime's pureness.
'Really want a future date??

--

___
Python tracker 

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



[issue665194] datetime-RFC2822 roundtripping

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

Do you think we can get 9527 in?  My patch was based on the non-existence of a 
LocalTimezone facility in the stdlib.

Good point about the special interpretation of -.  Given 9527 (and only 
given 9527) it would indeed make sense to restrict email to aware datetimes 
plus naive datetimes for - timestamps.

I'll have to keep a flag for the 60th second  outside of the datetime instance 
(or pretend it doesn't exist :)

--
dependencies: +Add aware local time support to datetime module

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

You are right that I got the regex wrong (I'm bad at regexes), but in fact it 
is fine the way it is.  Since there's no r, the regex is actually "ba[^/]$", 
which is exactly what I meant.

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

"prepare new tail" means all of the text from the first modified line to the 
end?  (As opposed to "just the new mail"?)

mailbox does locking.  I see no reason in principle it couldn't stat/restore, 
it would just be setting the times on the new file rather than on a 
truncated/rewritten old file.  How hard that would be to incorporate into the 
existing logic I have no idea.  Of course there may be issues about this I 
haven't thought of.

>From what you said, if mutt is the model for what mailbox should do, it 
>shouldn't set the mtime later than the atime itself, it should only preserve 
>it if it already was.  Which was my point about using mailbox as a delivery 
>agent: if you *are* using it as a delivery agent, then the application using 
>it as a delivery agent would be the one to set the mtime greater than the 
>atime.  mailbox itself would (following the mutt model) just be preserving the 
>existing relationships.

Do you think the mutt model is a good one to follow?

--

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

Oh, and does mutt's behavior apply to any mbox, or only the one in the system 
spool?

--

___
Python tracker 

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



[issue665194] datetime-RFC2822 roundtripping

2011-05-05 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, May 5, 2011 at 12:44 PM, R. David Murray  wrote:
..
> Do you think we can get 9527 in?

I hope we can.  Pure Python implementation can be improved by deducing
the TZ offset from localtime() and gmtime() calls.  In C we can use
additional struct tm fields when they are available to do even better.
 Would you like to add your voice to support #9527?

..
> I'll have to keep a flag for the 60th second  outside of the datetime 
> instance (or pretend it doesn't exist :)

If you can find an e-mail message archived somewhere with 60 seconds
in the timestamp, it will be a powerful argument to extend seconds
range that can be stored in datetime objects.   I doubt such messages
exist, though.  Few systems can produce such a timestamp even if they
happen to process an e-mail during a leap second.  In
parse_datetime(), your choice will be between raising an error and
approximating the leap second with the nearest representable time.  I
think clamping 60 seconds to 59 is the best option and this is what
datetime.fromtimestamp does if the system happens to produce a leap
second in the timetuple.

--

___
Python tracker 

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



[issue10399] AST Optimization: inlining of function calls

2011-05-05 Thread Pas

Changes by Pas :


--
nosy: +pas

___
Python tracker 

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



[issue9527] Add aware local time support to datetime module

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

LocalTimezone support would be *really* helpful for the email module.  It would 
allow us to have unambiguous semantics for datetime objects representing 
timestamps exacted from or inserted into email messages (see issue 665194 for 
recent discussion).  The email module is already trying to handle timestamp 
translation, and I'd be willing to bet it is buggier than the proposal here.

At one point I even started to copy the LocalTimezone class from the docs into 
the email module.  I implemented a naive extension of the current formatdate 
function instead, but after Alexander's feedback on #665194 I think the naive 
implementation is not a good idea.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue665194] datetime-RFC2822 roundtripping

2011-05-05 Thread R. David Murray

R. David Murray  added the comment:

Yes, since the package will save the original text anyway, I think just 
clamping to 59 is best.

Hmm.  Maybe instead I could put in an assert that says "please report this 
incident to bugs.python.org so we can argue that datetime should get support 
for leap seconds) :)

--

___
Python tracker 

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



[issue1479611] speed up function calls

2011-05-05 Thread Pas

Changes by Pas :


--
nosy: +pas

___
Python tracker 

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



[issue6116] frame.f_locals keeps references to things for too long

2011-05-05 Thread Facundo Batista

Facundo Batista  added the comment:

Antoine, to see if I understood correctly... if we build the dict, and just 
return it but don't save it in the frame, this leak would be solved? (yes, it'd 
be slower because everytime it's asked, it'd need to be built again)

--

___
Python tracker 

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



[issue8498] Cannot use backlog = 0 for sockets

2011-05-05 Thread Charles-François Natali

Charles-François Natali  added the comment:

> Thanks for the tip. I added the unit test and uploaded my final patch
> (which includes all changes).

A couple comments (note that I'm not entitled to accept or commit a patch, so 
feel free to ignore them if I'm just being a pain):
- "the maximum value is system-dependent (usually 5)"
I would remove this "usually 5" part: since the kernel silently adjusts the 
value, it shouldn't be of interest to the programmer. Furthermore, this was 
probably true a decade ago, but nowadays it doesn't hold anymore, Linux for 
example allows a much higher limit
- port = support.bind_port(srv)
Since you don't care about which port you get bound to, you could discard the 
port value, or even call srv.bind((HOST, 0)) directly
- I'm not sure that creating a new SocketListenBacklog0Test TestCase just for 
this check is necessary. Since it's so short, you could just add a new test to 
e.g. GeneralModuleTests

> Is it ok to remove the files I uploaded previously? 

It's probably a good idea, so there won't be any confusion with "stale" patches 
and test scripts.

--
keywords: +needs review

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> As I think about this more... I'm not sure how much performance there
> is to gain here in practice.  It seems like any time I'd want to use
> readinto(), it's because I want to do my own buffering, in which case
> why would I use a BufferedReader?

The difference between buffered I/O and raw I/O isn't only the presence
of a buffer. For example read(N) on a buffered object will loop until N
bytes are satisfied (or EOF is reached), while read(N) on a raw I/O
object will give you whatever the system call returns.

I would add that third-party buffering would be better helped by the
prefetch() method I proposed on python-ideas:
http://mail.python.org/pipermail/python-ideas/2010-September/008179.html

readinto() is really about minimizing copies and allocations when you
already have storage allocated for the result.
(note that TextIOWrapper could have used readinto(), but instead opted
for the slightly useless read1())

--

___
Python tracker 

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



[issue8426] multiprocessing.Queue fails to get() very large objects

2011-05-05 Thread Charles-François Natali

Charles-François Natali  added the comment:

> You can not pickle individual objects larger than 2**31.

Indeed, but that's not what's happening here, the failure occurs with much 
smaller objects (also, note the OP's "cPickle is perfectly capable of pickling 
these objects").
The problem is really with the underlying pipe/unix socket filling up.

--

___
Python tracker 

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



[issue11729] libffi assembler relocation check is not robust, fails with clang

2011-05-05 Thread Ismail Donmez

Ismail Donmez  added the comment:

Ping? Shall I submit a fix for Modules/_ctypes/libffi/configure.ac or better 
yet will you sync in-tree libffi?

--

___
Python tracker 

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




[issue11729] libffi assembler relocation check is not robust, fails with clang

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, ctypes is kindof unmaintained right now, and the private libffi copy 
belongs to that module.
(the reason we have a libffi copy is that, IIUC, it's patched)

--
nosy: +pitrou

___
Python tracker 

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



[issue11729] libffi assembler relocation check is not robust, fails with clang

2011-05-05 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +doko

___
Python tracker 

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



[issue11149] [PATCH] Configure should enable -fwrapv for clang

2011-05-05 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Brett, can you test this?

--
assignee:  -> brett.cannon
nosy: +rhettinger

___
Python tracker 

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



[issue11729] libffi assembler relocation check is not robust, fails with clang

2011-05-05 Thread Ismail Donmez

Ismail Donmez  added the comment:

Patch for configure.ac then?

--

___
Python tracker 

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-05 Thread Erik Cederstrand

Erik Cederstrand  added the comment:

At least in Denmark, week numbers are used regularly in everyday communication 
and planning, and the numbering follows the ISO rules. Also, the week starts on 
Monday.

--

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2011-05-05 Thread Bryce Verdier

Bryce Verdier  added the comment:

Here is the patch to fix the documentation. Asked some core developers off the 
bug tracker how to handle this bug in relation to the bigger issue regarding 
"STOP" leading to an infinite loop.

--
keywords: +patch
nosy: +louiscipher
Added file: http://bugs.python.org/file21898/issue11163.py33.patch

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

In fact i like my idea of using iterations.
I have some time tomorrow, so if nobody complains until then,
i write diffs for the tests of 3.x and 2.7 with these updates:

- Two different target sizes:
1. 0x + x (7)
2. 0x7FFF + x (7)
- On 32 bit systems, use iterations on a potentially safe buffer
  size.  I think 0x4000 a.k.a 1024*1024*1024 is affordable,
  but 512 MB are probably more safe?  I'll make that a variable.
- The string will be 'DeadAffe' (8).
- The last 4 bytes of the string will always be read on their own
  (just in case the large buffer sizes irritated something down
  the path).

--

___
Python tracker 

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



[issue7359] mailbox cannot modify mailboxes in system mail spool

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

Issue #11935 becomes gigantic and may even swamp this one over!

--
nosy: +sdaoden

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2011-05-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I think this is the wrong patch for reasons given below.
The example should be replaced instead.

Readline is documented as returning '' at EOF for text files.
Iter(func,sentinel) is documented as calling func until sentinel is returned. 
If that never happens, it never stops. That makes it dangerous unless one KNOWS 
for sure that the sentinel WILL be returned or is willing to continue 
indefinitely. I think a sentence should be added to the doc to warn about this.

So I consider the premise of the example, "One useful application of the second 
form of iter() is to read lines of a file until a certain line is reached.", to 
be somewhat dubious. The example could be considered instead to be an example 
of when NOT to use the second form. This application should better be written 
to avoid a possible infinite loop as

with open(name) as fp:
  for line in fp:
if line == sentinel:
  break
process(line)

I think a better example would be (3.2 version, use raw_input for 2.7):

def my_input():
return input("Enter data or return to stop: ")
for data in iter(my_input, ''):
process(data)

Your alternative also works, but the above is something one might actually do. 
Even that is hardly much better than:

while True:
  data = input("Enter data or return to stop}
  if not data: break
  process data

--
nosy: +terry.reedy

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2011-05-05 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3 -Python 2.6

___
Python tracker 

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



[issue12010] Compile fails when sizeof(wchar_t) == 1

2011-05-05 Thread David Coles

New submission from David Coles :

On Android platforms bionic defines wchar_t as char. This causes compiling of 
unicodeobject.c to fail with "#error "unsupported wchar_t and PyUNICODE sizes, 
see issue #8670".

The unusual thing is that the configure script does detect if wchar_t is usable 
(HAVE_USABLE_WCHAR_T) but the wide code support block in unicodeobject.c does 
not check this (only an #ifdef HAVE_WCHAR_T).

Possibly the quick solution is to change this #ifdef to '#if 
defined(HAVE_WCHAR_T) && defined(HAVE_USABLE_WCHAR_T)'. The header 
unicodeobject.h does check for HAVE_USABLE_WCHAR_T but will only define 
HAVE_WCHAR_T if it is not already defined.

--
components: Build
messages: 135242
nosy: dcoles
priority: normal
severity: normal
status: open
title: Compile fails when sizeof(wchar_t) == 1
type: compile error

___
Python tracker 

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



[issue12011] The signal module should raise OSError for OS-related exceptions, not RuntimeError

2011-05-05 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Treating RuntimeError as if it could take an errno is no good:

>>> try: signal.siginterrupt(32, 12345)
... except RuntimeError as e: print(e.errno)
... 
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: (22, 'Invalid argument')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 2, in 
AttributeError: 'RuntimeError' object has no attribute 'errno'


Changing it breaks compatibility a bit but I think it's worth it.

--
components: Library (Lib)
messages: 135243
nosy: haypo, ncoghlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: The signal module should raise OSError for OS-related exceptions, not 
RuntimeError
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue12011] The signal module should raise OSError for OS-related exceptions, not RuntimeError

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

I asked if I should use RuntimeError or OSError for the new signal functions 
(#8407) on python-dev. Georg Brandl answered:

"If it has an errno, it should be a subclass of EnvironmentError."

--

___
Python tracker 

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



[issue12011] The signal module should raise OSError for OS-related exceptions, not RuntimeError

2011-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +georg.brandl

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-05 Thread John O'Connor

John O'Connor  added the comment:

Attached patch draft for buffered_readinto(). patchcheck removed some 
whitespace as well.

Daniel, I agree. BufferedReader.readinto seemingly defeats the purpose of using 
a BufferedReader to begin with. Though, for the difference Antoine pointed out 
it makes sense (more of an accumulator).

Interesting thread about prefetch(). +1

--
keywords: +patch
Added file: http://bugs.python.org/file21899/buffered_readinto.patch

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2011-05-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue11163] iter() documentation code doesn't work

2011-05-05 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'll replace this with a better example using binary chunked reads that 
terminate with an empty string.

--
priority: normal -> low

___
Python tracker 

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



[issue12010] Compile fails when sizeof(wchar_t) == 1

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Do you want to propose a patch? I'm not sure any of us can test on an Android 
setup.

--
nosy: +pitrou
stage:  -> needs patch
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue12010] Compile fails when sizeof(wchar_t) == 1

2011-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-05 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Thu,  5 May 2011 19:04:16 +0200, R. David Murray wrote:
> "prepare new tail" means all of the text from the first modified
> line to the end?  (As opposed to "just the new mail"?) mailbox
> does locking.  I see no reason in principle it couldn't
> stat/restore, it would just be setting the times on the new file
> rather than on a truncated/rewritten old file.  How hard that
> would be to incorporate into the existing logic I have no idea.
> Of course there may be issues about this I haven't thought of.

Me too and even more.
Clearly mailbox.py cannot do any dotlocking due to missing
permissions, so this is silently ignored to be able to proceed at
all.  Therefore only fcntl/flock locking is used for
a /var/{spool/}mail box by mailbox.py.  This is fine as long as
all programs agree in locking such a file in the usual way, that
is, use both, dotlocking *and* flock/lock, and restart from the
beginning if one of them fails due to another program holding that
very lock.  mutt does that but i won't do any bet here.

And then the signal handling, and Python even supports threading,
and it is embeddable and there may be third-party modules also
involved.  This is the Death Valley of programming.

$PYP mb.flush()
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 659, in 
flush
new_file = _create_temporary(self._path)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 2061, 
in _create_temporary
os.getpid()))
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 2051, 
in _create_carefully
fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0o666)
OSError: [Errno 13] Permission denied: 
'/var/mail/steffen.1304628960.sherwood.local.37135'

So this seems to be the safest and most useful approach in this
context, because i do not want to imagine what happens if
something weird occurs in the middle of writing "the tail"
otherwise.  So i stop thinking about issue #7359.

> Do you think the mutt model is a good one to follow?

You mean resetting atime/mtime back to before the rename?
I don't like that and i don't understand it because the file has
been modified, so i think i would do (now,now) in that case
instead (because of the MMDF/MBOX newer==new mail case).
And in case a new mail has been inserted (now-2.42,now).

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thank you for the patch. A couple of comments:

- the whole slow path (which loops calling _bufferedreader_raw_read()) should 
be surrounded by calls to ENTER_BUFFERED() and LEAVE_BUFFERED()

- other things:

+if (!PyArg_ParseTuple(args, "O:readinto", &buffer))
+return NULL;
+
+if (PyObject_GetBuffer(buffer, &buf, PyBUF_CONTIG) == -1)
+return NULL;

You should use the "w*" typecode instead (see the readinto implementation in 
Modules/_io/fileio.c for an example).

+if (n == -2) {
+Py_INCREF(Py_None);
+res = Py_None;
+}

If `written` is > 0, this should return the number of bytes instead (mimicking 
_bufferedreader_read_generic). Adding a test for that would be nice too (in 
Lib/test/test_io.py).

--

___
Python tracker 

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



[issue12010] Compile fails when sizeof(wchar_t) == 1

2011-05-05 Thread David Coles

David Coles  added the comment:

Sure. There are a few other build issues (mainly missing types/structs in 
Bionic) that are preventing a complete build. I'll put together a patch once I 
have a working build and can verify that HAVE_USABLE_WCHAR_T is set correctly 
set on a normal Linux build.

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-05 Thread John O'Connor

John O'Connor  added the comment:

Thanks for the feedback. I made the changes, PTAL.

--
Added file: http://bugs.python.org/file21900/buffered_readinto2.patch

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-05 Thread STINNER Victor

STINNER Victor  added the comment:

> http://bugs.python.org/review/8407/show

Updated patch (version 2).

Note: sigpending() doesn't return an error code but -1 on error.

--
Added file: http://bugs.python.org/file21901/pending_signals-2.patch

___
Python tracker 

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



  1   2   >