[issue8339] urlunparse(urlparse('x://')) now returns 'x:' instead of 'x://'

2010-04-12 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Added additional examples of valid urls in r79988 and branches under the 
roundtrip test cases.

Michael, RDM: If you have any comments on msg102737, let me know. Otherwise we 
can close this issue as wont-fix.

--

___
Python tracker 

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



[issue8374] Some locales are unsupported

2010-04-12 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Martin v. Löwis wrote:
> 
> Martin v. Löwis  added the comment:
> 
> getdefaultlocale is inherently unmaintainable, and shouldn't be used by 
> applications. I wish it was removed from Python (but unfortunately, too many 
> people got tricked into believing that it does something useful).

I disagree on that.

getdefaultlocale() provides a way to access the default locale
(and encoding) on a platform without requiring a call to
setlocale(LC_ALL, "") which would affect the currently running
application and is not thread-safe (just like most other locale
C APIs in the C lib).

getpreferredencoding() just provides encoding information. It doesn't
provide locale information, so I don't see how that could be used
as replacement for getdefaultlocale().

The table needed for normalizing the various locale strings used in
the LANG environment variable (and others) needs to be updated every
now and then, but that's natural for a resource that changes based
on what people use locales for in real life.

> That said, if anybody feels like updating the tables from the various data 
> sources, please go ahead.

I last updated the table in 2008. Will do that again this week.

--

___
Python tracker 

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



[issue8375] test_distutils fails when run with -j

2010-04-12 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

done in r79992

--
status: open -> closed

___
Python tracker 

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



[issue8359] % formating - TypeError: not all arguments converted during string formatting

2010-04-12 Thread Abdellah Chelli

عبدالله شلي (Abdellah Chelli)  added the comment:

Mapping  works too, I don't know how I didn't get it. Thank you Eric.

Ex:
gettext.ngettext("%(package)d package", "%(package)d packages", countInstall) % 
{ 'package': countInstall}

https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/409785/comments/9

Thank you guys, Eric & Georg.

--

___
Python tracker 

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



[issue8374] Some locales are unsupported

2010-04-12 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

M.-A. Lemburg wrote:
>> That said, if anybody feels like updating the tables from the various data 
>> sources, please go ahead.
> 
> I last updated the table in 2008. Will do that again this week.

I saw that Antoine already did this for me: thanks, Antoine !

Could you tell me which X11 version you used ? I've modified the
generation script to also output the added aliases and would like
to list them as well.

--

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue8377] Errata on page:http://docs.python.org/library/stdtypes.html

2010-04-12 Thread Jatin Sanghvi

New submission from Jatin Sanghvi :

Open link: http://docs.python.org/library/stdtypes.html

The statement:

If i or j is negative, the index is relative to the end of the string: len(s) + 
i or len(s) + j is substituted.

is incorrect, should be:

If i or j is negative, the index is relative to the end of the string: len(s) - 
i or len(s) - j is substituted.

--
assignee: georg.brandl
components: Documentation
messages: 102927
nosy: georg.brandl, jatin085
severity: normal
status: open
title: Errata on page:http://docs.python.org/library/stdtypes.html
versions: Python 2.6, Python 2.7

___
Python tracker 

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



[issue8377] Errata on page:http://docs.python.org/library/stdtypes.html

2010-04-12 Thread Walter Dörwald

Walter Dörwald  added the comment:

This is a common thinko. ;)

If i is negative then len(s) - i would be greater that len(s). However len(s) + 
i  is correct. Example:

foo[-1] is foo[len(foo) + (-1)] is foo[len(foo)-1]

--
nosy: +doerwalter
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue3581] failures in test_uuid

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

Applied test_uuid3.patch to trunk (r79954), release26-maint (r79959),
py3k (r79960) and release31-maint (r79961).

No buildbot failures so far, so I'm closing this.

--
stage: commit review -> committed/rejected
status: open -> closed
versions: +Python 3.1, Python 3.2

___
Python tracker 

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



[issue7650] test_uuid is invalid

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

Fixed in issue 3581. Thanks for the report and the comments!

--
assignee:  -> skrah
dependencies: +failures in test_uuid
keywords: +patch
resolution:  -> accepted
stage: needs patch -> committed/rejected
status: open -> closed
superseder:  -> failures in test_uuid

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

Nice catch. The patch looks good to me and applies correctly on my trunk copy. 
There seems to be no test about this in the test suite; do you have a little 
test script to compare old and new code?

On a sidenote, I find all this business with time.time, time.gmtime, 
time.localtime and time.strftime always confusing. We have datetime objects 
now, would it be ok to use them in this module?

Regards

--

___
Python tracker 

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



[issue8339] urlunparse(urlparse('x://')) now returns 'x:' instead of 'x://'

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

By the way, I’ve been meaning to file a bug against the Mercurial schemes 
extension since I saw how it misused URIs (i.e. “py://trunk/” should be 
“py:trunk/”); I hope it’s not too late now that this extension is shipped with 
the program.

Regards

--
nosy: +merwok

___
Python tracker 

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



[issue1481] test_uuid is warning about unreliable functions

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

Issue fixed by test_uuid3.patch from issue 3581 in trunk (r79954),
release26-maint (r79959), py3k (r79960) and release31-maint (r79961).

--
assignee:  -> skrah
keywords:  -needs review
resolution:  -> accepted
stage: patch review -> 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



[issue5341] A selection of spelling errors and typos throughout source

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

Hi

r79951 fixes “simplies” and add the typo “specifyication” . 
Updated my patch to remove that and add this.

Regards

--
Added file: http://bugs.python.org/file16894/functools-typos-pep8.diff

___
Python tracker 

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



[issue4639] Build failure on OpenBSD 4.4-current regarding lstat()

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

This has been fixed in issue 7903.

--
assignee:  -> skrah
keywords: +patch
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> Configure script incorrect for reasonably recent OpenBSD

___
Python tracker 

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



[issue1818] Add named tuple reader to CSV module

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

See also this python-ideas thread: 
http://mail.python.org/pipermail/python-ideas/2010-April/006991.html

--
nosy: +merwok

___
Python tracker 

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



[issue6409] 2to3 -j 4 generates malformed diffs

2010-04-12 Thread George Boutsioukis

Changes by George Boutsioukis :


Removed file: http://bugs.python.org/file16889/output_lock.diff

___
Python tracker 

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



[issue8371] Add a command to download distributions

2010-04-12 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

What would this command do precisely ? Are you thinking about a command that 
scans PyPI ?

why this would be a command btw ? downloading a distribution is not a final 
goal, imho.

Wouldn't it be simpler to have a simple function that provides this feature ? 

> Is it okay to post this as a bug or should I rather mail distutils-sig first? 
> Or mail them now?


A feature request on the distutils2 component is fine. Although for topics that 
needs discussion, a round in the Mailing list is probably better to start.

--

___
Python tracker 

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



[issue6409] 2to3 -j 4 generates malformed diffs

2010-04-12 Thread George Boutsioukis

George Boutsioukis  added the comment:

I updated the patch to keep the new code as local as possible.

--
Added file: http://bugs.python.org/file16895/output_lock.diff

___
Python tracker 

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



[issue8339] urlunparse(urlparse('x://')) now returns 'x:' instead of 'x://'

2010-04-12 Thread Michael Glassford

Michael Glassford  added the comment:

> In those cases, I would assume that 'x://y', x:/y','x:/','/' 
> as valid URLS, but not the two examples you mentioned.

Only 2 comments about this:
1) Although the urlparse documentation does mention the relevant RFCs, on a 
quick read-through I don't see that it actually requires its input to be a 
valid URL.
2) Obviously, some code is using it for invalid URLs.

> Michael, RDM: If you have any comments on msg102737, 
> let me know. Otherwise we can close this issue as wont-fix.

I don't have a problem with this. I reported the issue to bring attention to 
the fact that the change affected real code and to see if anyone had 
suggestions for dealing with the problem in a better way (at the moment, I 
don't).

> By the way, I’ve been meaning to file a bug against the 
> Mercurial schemes extension...

Please do. I don't have anything to do with the Schemes extension except that I 
found this issue while investigating a unit test failure, but if you file an 
issue probably I will look into it--or if I don't, then someone else probably 
will.

--

___
Python tracker 

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



[issue8339] urlunparse(urlparse('x://')) now returns 'x:' instead of 'x://'

2010-04-12 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

On Mon, Apr 12, 2010 at 11:50:57AM +, Michael Glassford wrote:
> 1) Although the urlparse documentation does mention the relevant RFCs, on a 
> quick read-through I don't see that it actually requires its input to be a 
> valid URL.
> 2) Obviously, some code is using it for invalid URLs.

Which is true, because in some cases like urlparse.urljoin(base, rel),
the rel is a relative url it undergoes the same parsing mechanism
applicable to any url and thus there is no way a 'rigorous' check for
authorized url is happening. 

Checks are done for valid chars in scheme and other parsing
behaviours.

> I don't have a problem with this. I reported the issue to bring attention to 
> the fact that the change affected real code and to see if anyone had 
> suggestions for dealing with the problem in a better way (at the moment, I 
> don't).
>

Yeah, I understand the situation with 'changes which break the
existing code', which we try to avoid many times. I shall if this can
be addressed without reverting any recent changes and still being
complaint.

--

___
Python tracker 

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



[issue2054] add ftp-tls support to ftplib - RFC 4217

2010-04-12 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

On Sun, Apr 11, 2010 at 07:43:56PM +, Éric Araujo wrote:
> httplib.Client, ftplib.Client, ftplib.SecureClient would be much more 
> descriptive than httplib.HTTP and ftplib.FTP. Any interest about adding 
> aliases?

Aliases would be a bad idea. -1. It is fine the way the issue is
moving forth now, FTP_TLS.

--
nosy: +orsenthil

___
Python tracker 

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



[issue8374] Some locales are unsupported

2010-04-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Could you tell me which X11 version you used ? I've modified the
> generation script to also output the added aliases and would like
> to list them as well.

It's the file supplied on my Mandriva system, from
libx11-1.2.2-2mdv2010.0.src.rpm

--

___
Python tracker 

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



[issue8378] PYTHONSTARTUP broken on Windows

2010-04-12 Thread John Van Praag

New submission from John Van Praag :

The PYTHONSTARTUP environment variable does not work--does not import the 
indicated startup file--when IDLE is started under Windows. I have tested under 
Windows XP SP2, and under Windows Vista Ultimate 64 bit.

The os.environ variable does list the startup file, but IDLE fails to run it.

--
messages: 102943
nosy: jvanpraag
severity: normal
status: open
title: PYTHONSTARTUP broken on Windows
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue8374] Some locales are unsupported

2010-04-12 Thread Jeroen Ruigrok van der Werven

Jeroen Ruigrok van der Werven  added the comment:

That nl_AW is an interesting one. Aruba is part of the Kingdom of the 
Netherlands, so in essence it should follow nl_NL. From what I can see that 
locale seems to be limited to (certain) Linux systems. I'll raise the issue 
with the CLDR guys as well, since I wonder if this warrants its own locale or 
not (some monetary and number formatting).

But I think the outcome will be to add a nl_AW as well in similar vein as to 
what bo_CN does.

--
nosy: +asmodai

___
Python tracker 

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



[issue7150] datetime operations spanning MINYEAR give bad results

2010-04-12 Thread Anand B Pillai

Anand B Pillai  added the comment:

Can someone update this issue ? Is the 2nd patch tested... ?

--

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

There are a couple problems with this patch.  The first is that fixing 
date_time_string by using strftime rather than email.utils.formatdate is 
suboptimal from a code reuse standpoint.  The reason is that the date in HTTP 
message headers is required to conform to the same RFC standard as that 
generated by formatdate, so it is better to use the same routine to generate 
it.  That way any bug fixes needed to handle RFC compliance are centralized in 
once place.

The second problem with the patch is that strftime generates locale-aware week 
and month names, but per RFC the header timestamps must use English names (see 
for example msg53731 in issue 665194; the comment about locale applies to both 
strftime and strptime).

If issue 665194 were implemented formatdate could use it, and then 
BaseHTTPServer could also use it directly.  But absent that it should use 
email.util.formatdate.  (That issue should also answer Éric's question about 
whether we can use DateTime here: not yet.)

Now, the logging routine is a different story.  That timestamp isn't required 
to follow the RFC, and one could argue that it makes sense for its timestamp to 
use the locale.  (One could also ask whether BaseHTTPServer should use the 
logging module, but that is a whole separate issue.)

We definitely should have a unit test before applying this patch, that makes 
sure the timestamp gets generated without error.  Checking the detailed format 
of the timestamp can be assumed to be covered by the unit tests for formatdate. 
 (I don't think those tests are completely adequate; for example they don't 
test that the date remains in English if the locale is different, but again 
that is a different issue.)

--

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

“One could also ask whether BaseHTTPServer should use the logging 
module, but that is a whole separate issue.”
Indeed: http://www.python.org/dev/peps/pep-0337/

Cheers

--

___
Python tracker 

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



[issue8319] HTMLparser does not handle call to handle_data when a tag contains no data.

2010-04-12 Thread Anand B Pillai

Changes by Anand B Pillai :


--
nosy: +pythonhacker

___
Python tracker 

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



[issue8378] PYTHONSTARTUP broken on Windows

2010-04-12 Thread Brian Curtin

Changes by Brian Curtin :


--
components: +IDLE, Windows
nosy: +brian.curtin
priority:  -> normal

___
Python tracker 

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



[issue8026] strftime bug when timedelta is negative

2010-04-12 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

This is not a bug.  The issue boils down to the following:

>>> from datetime import *
>>> d = datetime(2010, 1, 1)
>>> d, d.strftime("%G")
(datetime.datetime(2010, 1, 1, 0, 0), '2009')

and OP expects '2010' instead.  Python behavior is correct as can be verified 
using GNU date utility:

$ date --date=20100101 +%G
2009

The confusion comes from the fact that %G is formatted as the ISO 8601 year.  
This year is the one that contains the greater part of the week (Monday as the 
first day of the week).


Here is another illustration:
>>> d = date(2009,12,31)
>>> for i in range(7):
...(d+timedelta(i)).strftime("%F %a %G %V")
... 
'2009-12-31 Thu 2009 53'
'2010-01-01 Fri 2009 53'
'2010-01-02 Sat 2009 53'
'2010-01-03 Sun 2009 53'
'2010-01-04 Mon 2010 01'
'2010-01-05 Tue 2010 01'
'2010-01-06 Wed 2010 01'

Note that week 1 of 2010 started on Monday, 2010-01-04.

OP is advised to change %G to %Y in his code.

--
nosy: +belopolsky

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Ray.Allen

Changes by Ray.Allen :


--
nosy: +ysj.ray

___
Python tracker 

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



[issue7472] email.encoders.encode_7or8bit(): typo "iso-2202". "iso-2022" is correct.

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

I've applied the fix to trunk in r79994, and py3k in r79996, but I'm leaving 
this open because I still want a unit test for it.

--
keywords: +easy -patch

___
Python tracker 

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



[issue8026] strftime bug when timedelta is negative

2010-04-12 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue6467] PyOS_Readline: treatment of "1234EOF"; behavior of builtin_raw_input

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

There are two cases:

1) stdin and stdout go to a tty:

my_fgets() from Parser/myreadline.c does not handle the case
where fgets() reads some characters followed by an EOF. One
way to deal with this is to consider a sequence like 1234EOF
an empty line.

This is what the patch consider_1234EOF_empty_line.patch
does and it fixes problem 1.

[Another option would be to consider 1234EOF a line and
insert a newline.]


2) stdout is not a tty:

In this case, builtin_raw_input() uses PyFile_GetLine() to
read from stdin. I'm not sure why this is the case.

Perhaps 2) should be a separate issue.

--
components: +Interpreter Core -IO
keywords: +needs review, patch
nosy: +skrah
priority:  -> normal
stage:  -> patch review
title: raw_input() doesn't work as expected when it gets multiple ^D -> 
PyOS_Readline: treatment of "1234EOF"; behavior of builtin_raw_input
type:  -> behavior
Added file: http://bugs.python.org/file16896/consider_1234EOF_empty_line.patch

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Ray.Allen

Ray.Allen  added the comment:

I think there is not much ploblem. Please notice this sentence in the previous 
paragraph in the toturial :

"Behind the scenes, the for statement calls iter() on the container object. The 
function returns an iterator object that defines the method next() which 
accesses elements in the container one at a time."

I think it's clear enough that the container object is different from the 
iterator object, what exactly has the iterator behavior is the iterator object, 
not the container object. And this sentence you mentioned:

"If the class defines next(), then __iter__() can just return self:"

is to teach you define a iterator, not a container. So by reading it carefully, 
you won't define something that is both a container and a iterator, will you? 

If you really define a next() on a class which you want it be a container, and 
then define a __iter__() on it and return self, then your container is exactly 
a generator, not a container. And a generator can certainly iterate only once.

--

___
Python tracker 

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



[issue8378] PYTHONSTARTUP is not run by default when Idle is started

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

Believe it or not, this is the documented behavior of Idle on all platforms.  
You have to specify -s to have PYTHONSTARTUP run.

See the last comment in Issue5594, and also the referenced issue 5233, which 
has a patch that apparently changes this behavior, although that isn't 
mentioned in that issue itself.

I'm making this a feature request for changing the default behavior, to see 
what people think.

--
components:  -Windows
nosy: +kbk, r.david.murray
title: PYTHONSTARTUP broken on Windows -> PYTHONSTARTUP is not run by default 
when Idle is started
type: behavior -> feature request
versions: +Python 3.2 -Python 3.1

___
Python tracker 

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



[issue8326] Cannot import name SemLock on Ubuntu lucid

2010-04-12 Thread David Coconut

David Coconut  added the comment:

Issue 3770 is not relevant because this code works in Python 2.6 on both 
machines (x86 and x86-64). These machines run plenty of other concurrent 
processes also, which would imply to me that sem_open() does work.

I could be completely wrong as I'm no expert on the inner workings of either 
Python or Ubuntu, but that's what I've been able to deduce so far.

Ubuntu bug in package python3.1 is here: 
https://bugs.launchpad.net/ubuntu/+source/python3.1/+bug/556477

--

___
Python tracker 

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



[issue8367] test_winsound: failure on systems without soundcard

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

Committed in r8, r80001, r80002 and r80003.

--
resolution:  -> accepted
stage: patch review -> 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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

Hello

I thought about two bits in your message: “I think it's clear enough” 
and “So by reading it carefully”. They show that the doc is a bit 
ambiguous here, and while I agree that people should take the time to 
read and understand, I think that documentation can always be made 
clearer. The doc about iterables could tell to return an instance of 
another class or use a generator, and then a separate paragraph would 
explain about using next to define iterators, explaining that iterators 
may or may not be iterable.

Does that sound good?

Regards

--

___
Python tracker 

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



[issue2706] datetime: define division timedelta/timedelta

2010-04-12 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Is there a good reason why this issue is languishing? The requested 
functionality seems to be well motivated, simple to implement with few 
objections resolved in the discussion.

I wonder if it would be helpful to limit this patch to 3.x series.  That way 
some of the controversies about true vs. floor division would disappear and it 
will be easier to accept new features.

--

___
Python tracker 

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



[issue8326] Cannot import name SemLock on Ubuntu lucid

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

I guess I wasn't clear.  The error you are seeing is exactly the error that 
issue 3770 talks about.  The *build* process wasn't able to find a functioning 
sem_open implementation, and therefore you see that error.  Now, clearly your 
platform does have a functioning sem_open implementation, so something must 
have gone wrong during the build process.  Since the build works fine on our 
Ubuntu buildbots 
(http://www.python.org/dev/buildbot/builders/i386%20Ubuntu%203.1/builds/475), 
and since you are working from a prepackaged Lucid binary, I conclude that this 
is most likely an Ubuntu packaging problem.

--

___
Python tracker 

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



[issue7585] difflib should separate filename from timestamp with tab

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

Applied to trunk in r8004 and py3k in r8006.

--
resolution: accepted -> fixed
stage: unit test needed -> 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



[issue1818] Add named tuple reader to CSV module

2010-04-12 Thread Skip Montanaro

Skip Montanaro  added the comment:

Type conversion is a whole 'nuther kettle of fish.  This particular thread is 
long and complex enough that it shouldn't be made more complex.

--

___
Python tracker 

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



[issue8242] Support surrogates in import ; install Python in a non-ASCII directory

2010-04-12 Thread STINNER Victor

STINNER Victor  added the comment:

New patch fixing more issues about undecodable filenames.

 Lib/test/test_subprocess.py |4 -
 Lib/unittest/runner.py  |4 +
 Modules/_posixsubprocess.c  |   21 --
 Modules/getpath.c   |   90 +++-
 Modules/posixmodule.c   |5 +-
 Modules/python.c|6 +-
 Modules/zipimport.c |   11 -
 Objects/fileobject.c|6 +-
 Objects/unicodeobject.c |   22 --
 Parser/tokenizer.c  |   14 --
 Python/_warnings.c  |7 +++
 Python/ast.c|   10 +++-
 Python/ceval.c  |2
 Python/errors.c |2
 Python/import.c |   37 +-
 Python/traceback.c  |   38 ++
 16 files changed, 225 insertions(+), 54 deletions(-)

TODO:
 - Remove assert(PyBytes_Check(opath)); from NullImporter_init() and 
zipimporter_init()
 - Fix setup_context() (_warnings.c)
 - Reencode module filenames if the system default encoding changes
 - Lib/unittest/runner.py and Lib/test/test_subprocess.py contain hacks to fix 
tests. It might be rewritten
 - Fix the 3 "FIXME: use _Py_char2wchar" in getpath.c

I restored code setting the system encoding.

The patch fixes also _posixsubprocess.fork_exec() to support undecodable 
current working directory.

--
Added file: http://bugs.python.org/file16897/surrogates-5.patch

___
Python tracker 

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



[issue8242] Support surrogates in import ; install Python in a non-ASCII directory

2010-04-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file16671/surrogates_bootstrap-4.patch

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

It might be worth mentioning in the tutorial the specific problem the OP points 
out: that if an object returns itself in __iter__, then that object can have 
only one iteration state.  And that therefor only an object that is itself a 
unique iterator (as opposed to a collection wanting to allow iteration) should 
return itself as __iter__.

Also note that in the example in the tutorial it says "easy to add the 
behavior", which *in context* is wrong; pedagogically the better thing to do 
would be to say "it is easy to write a class that implements an iterator".  As 
Éric said, splitting the text so that returning an iterator from a collection 
and constructing an iterator class are distinct topics would greatly improve 
the exposition.

I'm an experienced Python coder, and I've made this mistake myself.  Often it 
doesn't break because the code only iterates the object once, but it would be 
better to have the tutorial encourage doing this correctly by providing good 
examples and explanations.

--
nosy: +r.david.murray
priority:  -> normal
type:  -> behavior
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue2706] datetime: define division timedelta/timedelta

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

It's too late for 2.7 anyway.

--
nosy: +r.david.murray
priority:  -> normal
versions: +Python 3.2 -Python 2.7, Python 3.1

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I think the docs are fine as-is.  At that point in the tutorial, we're trying 
to teach what the iterator protocol is.

The considerations of what makes a good design can be discussed elsewhere.  It 
is not a one-liner.  For example, files are self iterators but lists are not -- 
there are good reasons for either choice.  Explaining those design choices is 
not a good way to *introduce* the iterator protocol.

Recommend closing this report.

--
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue8372] socket: Buffer overrun while reading unterminated AF_UNIX addresses

2010-04-12 Thread David Watson

David Watson  added the comment:

Attaching the C test programs I forgot to attach yesterday -
sorry about that.  I've also tried these programs, and the
patches, on FreeBSD 5.3 (an old version from late 2004).  I found
that it accepted unterminated addresses as well, and unlike Linux
it did not normally null-terminate addresses at all - the
existing socket code only worked for addresses shorter than
sun_path because it zero-filled the structure beforehand.  The
return-unterminated patches worked with or without the
zero-filling.

Unlike Linux, FreeBSD also accepted oversized sockaddr_un
structures (sun_path longer than its definition), so just
allowing unterminated addresses wouldn't make the full range of
addresses usable there.  That said, I did get a kernel panic
shortly after testing with oversized addresses, so perhaps it's
not a good idea to actually use them :)

--
Added file: http://bugs.python.org/file16898/bindconn.c

___
Python tracker 

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



[issue8372] socket: Buffer overrun while reading unterminated AF_UNIX addresses

2010-04-12 Thread David Watson

Changes by David Watson :


Added file: http://bugs.python.org/file16899/accept.c

___
Python tracker 

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



[issue1220212] os.kill on windows

2010-04-12 Thread Brian Curtin

Brian Curtin  added the comment:

Ported to py3k in r80008.

FAQ text updated in r80009 and r80010.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue8376] Tutorial offers dangerous advice about iterator s: “__iter__() can just return self”

2010-04-12 Thread Anders Kaseorg

Anders Kaseorg  added the comment:

As an experienced Python programmer I am obviously aware that the tutorial is 
trying to teach how to make an iterator class, not how to make a container 
class.

But the tutorial doesn’t make that *clear*.  It should be much more explicit 
about what it is explaining to avoid confusing those concepts in the minds of 
beginners.  (Or even the staff of the MIT introductory CS course.)

One way to fix this confusion would be to explain what one should do for both 
container classes and iterator classes:

"""
Having seen the mechanics behind the iterator protocol, it is easy to add 
iterator behavior to your container classes.  Define a :meth:`__iter__` method 
which returns an object of a separate iterator class.  The iterator class 
should have a :meth:`next` method and an :meth:`__iter__` method (the 
:meth:`__iter__` method of the iterator class should just return ``self``)::

   class ReverseList(object):
   "Container that lets you iterate over the items backwards"
   def __init__(self, data):
   self.data = data
   def __iter__(self):
   return ReverseIterator(self.data)

   class ReverseIterator(object):
   "Iterator for looping over a sequence backwards"
   def __init__(self, data):
   self.data = data
   self.index = len(data)
   def __iter__(self):
   return self
   def next(self):
   if self.index == 0:
   raise StopIteration
   self.index = self.index - 1
   return self.data[self.index]

   >>> for char in ReverseIterator('spam'):
   ... print char
   ...
   m
   a
   p
   s
   >>> for char in ReverseList([1,2,3]):
   ... print char
   ...
   3
   2
   1
"""

--

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand

Changes by Shashwat Anand :


Removed file: http://bugs.python.org/file16890/BaseHTTPServer.patch

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand

Shashwat Anand  added the comment:

Quoting from the docstring of trunk/Lib/email/utils.py -> formatdate()

"We cannot use strftime() because that honors the locale and RFC 2822 requires 
that day and month names be the English abbreviations."

So yes, I do agree that email.utils.formatdate() should be used instead of 
time.strftime() to remove duplicate codes and be compliant with RFC.
Removing previous patch and submitting another.

--

___
Python tracker 

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



[issue7947] Documentation of math.pow, math.hypot, and complex.__abs__

2010-04-12 Thread Mark Dickinson

Changes by Mark Dickinson :


--
status: open -> closed

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Mark Dickinson

Mark Dickinson  added the comment:

Many thanks for the patch.

Applied (minus trailing whitespace :) in r80013.

Leaving open to remind me to merge to other branches.

--
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



[issue8374] Some locales are unsupported

2010-04-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> getdefaultlocale() provides a way to access the default locale
> (and encoding) on a platform without requiring a call to
> setlocale(LC_ALL, "")

That's what it's meant to do, but this is not what it actually does.
In fact, there is no way of determining the locale's encoding without
the help o fthe C library. As for "default locale": this is a flawed
notion in itself. If I use one locale for messages, and the other for
date representation - which one should be the "default" locale?
Also, "default" in what respect?

> getpreferredencoding() just provides encoding information. It doesn't
> provide locale information, so I don't see how that could be used
> as replacement for getdefaultlocale().

Many applications use getdefaultlocale()[1], i.e. ignore the locale part
of the result. They can easily be rewritten to use getpreferredencoding.

> The table needed for normalizing the various locale strings used in
> the LANG environment variable (and others) needs to be updated every
> now and then, but that's natural for a resource that changes based
> on what people use locales for in real life.

However, it also changes based on local administrator preferences -
something that the implementation does not take into account at all.
It may also depend on OS vendor preferences, which is also not
considered in the implementation.

IOW, it returns bogus results.

--

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hmm.  I note that the examples are for a big-endian machine.  I wonder whether 
they should be converted to little-endian, given that most users are on x86 or 
x86_64 hardware these days.

--

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Meador Inge

Meador Inge  added the comment:

> wonder whether they should be converted to little-endian

I thought about that as well.  It sure would make creating new examples easier 
:)  I had to construct the new examples "by hand".

I can regenerate the examples for little-endian if you would like?

--

___
Python tracker 

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



[issue3143] Make the left sidebar in the doc collapsible

2010-04-12 Thread Forest Wilkinson

Forest Wilkinson  added the comment:

I just noticed Ezio's change to the title of this bug.  Does the proposed fix 
address the original bug title ("docs waste a lot of horizontal space on left 
nav bar") for third-party packages that use docutils to generate their docs?  
Or, does it only avoid the problem in the official python documentation?

--

___
Python tracker 

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



[issue6692] asyncore kqueue support

2010-04-12 Thread lasizoillo

Changes by lasizoillo :


--
nosy: +lasizoillo

___
Python tracker 

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



[issue6692] asyncore kqueue support

2010-04-12 Thread Brian Curtin

Changes by Brian Curtin :


--
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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand

Changes by Shashwat Anand :


Added file: http://bugs.python.org/file16900/BaseHTTPServer.patch

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Mark Dickinson

Mark Dickinson  added the comment:

Sure, if you want to.  [Then I won't be able to reproduce what's in the docs on 
either of my machines. :)  One's 32-bit big-endian;  the other's 64-bit 
little-endian.]

Merged your changes and subsequent tweaks to py3k in r80016.

--

___
Python tracker 

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



[issue6409] 2to3 -j 4 generates malformed diffs

2010-04-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r80018. Thanks for the patch.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-12 Thread Andy Friesen

New submission from Andy Friesen :

In certain circumstances, "if __debug__" seems to be evaluating its "else" 
clause even when -O is not specified.  This can cause very  surprising behavior.

a.zip contains a single file named a/__init__.pyo.  It is the compiled form of 
the following code:

if __debug__:
print 'DEBUG'
else:
print 'RELEASE'
if __debug__ == True:
raise Exception("this is impossible")

pythonbug.py evaluates this script with the following:

import sys
sys.path = ['a.zip']
import a

When using Windows Python 2.6.2 and 2.6.5, running pythonbug.py produces this 
output:

RELEASE
Traceback (most recent call last):
  File "pythonbug.py", line 3, in 
import a
  File "__init__.py", line 8, in 
raise Exception("this is impossible")
Exception: this is impossible

When -O is passed, the exception is not raised.

My best guess is that the Python bytecode is optimizing the "if __debug__" test 
away in the produced .pyo, but does not actually affect the value of __debug__ 
or check more complex expressions involving __debug__.

--
files: pythonbug.zip
messages: 102975
nosy: afriesen
severity: normal
status: open
title: if __debug__: has nonobvious behaviour when evaluating .pyo without -O
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file16901/pythonbug.zip

___
Python tracker 

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



[issue5277] email message.get_params() and related methods sometimes fail.

2010-04-12 Thread Shashwat Anand

Shashwat Anand  added the comment:

According to RFC2231 the named disposition (content disposition field) is 
provided by the MIME mechanism. The encoded parameter like the following:

Content-Disposition: inline;
 filename*0="Re: [Mailman-Users] Messages shunted with \"TypeError: ";
 filename*1="decodingUnicode is not supported\".eml"

is not behaving the way it should be.
The patch by rcoyner seems fine to me as it rectifies the wrong behaviour of 
_parseparam i.e. the counting issue of nested 'double quotes' and clears the 
unit tests.

--
nosy: +l0nwlf

___
Python tracker 

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



[issue3143] Make the left sidebar in the doc collapsible

2010-04-12 Thread R. David Murray

R. David Murray  added the comment:

I'm pretty sure it only applies to the python docs, since this is the Python 
tracker, not the Sphinx or docutils tracker.  (I'm not sure how the 
'Documentation tools (Sphinx)' component gets in there...as far as I know 
Sphinx bugs go the Sphinx bug tracker.)

--
nosy: +r.david.murray
versions: +Python 3.2 -Python 3.0

___
Python tracker 

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



[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It's probably caused by optimizations in the peepholer indeed.

--
nosy: +pitrou, rhettinger
priority:  -> low
versions: +Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-12 Thread Brett Cannon

Brett Cannon  added the comment:

Your assessment of what is going on, Andy, is correct; the peephole optimizer 
for bytecode optimizes away the `if __debug__` section of the `if` statement 
for .pyo files.

But that is actually a reasonable thing for the compiler to do as you are not 
supposed to run optimized bytecode with the interpreter not running under -O. 
Running a .pyo file under an interpreter run w/o -O is like compiling for 
64-bit but then running on a 32-bit system; you are not following assumptions 
you told the compiler could be made about the runtime.

So I am closing this as 'wont fix'. Best solution is to simply not run bytecode 
directly and instead execute the source as bytecode should be treated more as 
an optimization than some directly executable file format. But if you must 
execute the bytecode directly, simply make sure you don't mix .pyo/.pyc with an 
improper setting of -O.

--
nosy: +brett.cannon
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue8380] Port of the gdb7 debugging hooks to the "py3k" branch

2010-04-12 Thread Dave Malcolm

New submission from Dave Malcolm :

I'm attaching a patch for the py3k branch to port the gdb hooks to Python 3.

The libpython.py code installed to python-gdb.py "knows" about the internal 
details of the Python within the tree.  This patch makes the necessary changes 
to that code for the internals of Python 3, rather than Python 2.

Note that libpython.py is intended to run inside a gdb linked against 
libpython2, and so libpython.py is still Python 2 code; however I've updated it 
to expect the so-called "inferior process" to be Python 3:
* Py_TPFLAGS_STRING_SUBCLASS becomes Py_TPFLAGS_BYTES_SUBCLASS
* PyStringObjectPtr becomes PyBytesObjectPtr
* change PyObjectPtr to correctly locate "ob_size": with Python 2 
variable-sized subclasses we could simply look it up as a field of the subclass 
struct, but for Python 3 the field may be in an ob_base member, or in an 
ob_base.ob_base member.  We have to cast to a PyVarObject* to find it
* PyIntObject went away; PyBoolObject is now a subclass of PyLongObject
* writing out frames needed a slight rewrite with the change from co_filename 
and co_name from PyStringObject* to PyUnicodeObject*

This makes the "proxy values" concept a bit awkward; for example a "str" in the 
inferior Python 3 process looks like a "unicode" to the gdb Python 2 process.  
This and the int->long change required a lot of minor updating to expected 
values in the selftests.

The test_gdb.py and gdb_sample.py code _are_ for Python 3.  I've assumed that 
all output is in UTF-8 for now.

For Python 2, I was testing the code by putting a breakpoint on PyObject_Print, 
and printing objects, as a convenient hook for scraping gdb's stdout.

PyObject_Print still exists in Python 3, but isn't used by the "print" 
implementation, so I needed a handy function that I could put a breakpoint on, 
and invoke from the Python side: I looked for something with METH_O that isn't 
called by site.py and doesn't require an import.  I chose the "id" builtin, 
which corresponds to Python/ceval.c:builtin_id ()

Some minor 2to3-style fixes were also needed in the test code

All of the selftests are currently commented out to keep the buildbot clean 
(apparently from a merge from trunk), and I've kept them commented out.  They 
all pass on my machine with:
  make -j4 ; ./python -Wd ./Lib/test/regrtest.py -v test_gdb

This also contains a port of the (partial?) fix for issue 8330 from trunk's 
r79986 that doesn't seem to have been merged to py3k (it needed a fair amount 
of rewriting).

--
assignee: loewis
components: Demos and Tools
files: port-gdb7-hooks-to-py3k.patch
keywords: patch
messages: 102980
nosy: dmalcolm, loewis
severity: normal
stage: patch review
status: open
title: Port of the gdb7 debugging hooks to the "py3k" branch
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file16902/port-gdb7-hooks-to-py3k.patch

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Meador Inge

Meador Inge  added the comment:

> Sure, if you want to.  [Then I won't be able to reproduce what's in the
> docs on either of my machines. :)  One's 32-bit big-endian;  the other's
> 64-bit little-endian.]
>

I guess it's painful either way.  I think the only fair thing to do is
provide examples for multiple scenarios, e.g. 32-bit little-endian, 64-bit
big-endian, etc...  Share the pain :)

Cool, thanks!  Your padding note tweak is a definite improvement over what I
originally had.

--
Added file: http://bugs.python.org/file16903/unnamed

___
Python tracker 

___Sure, if you want to. 
 [Then I won't be able to reproduce what's in the docs on either of my 
machines. :)  One's 32-bit big-endian;  the other's 64-bit 
little-endian.]
I guess it's painful either way.  I think 
the only fair thing to do is provide examples for multiple scenarios, e.g. 
32-bit little-endian, 64-bit big-endian, etc...  Share the pain :)

Merged your changes and subsequent tweaks to py3k in r80016.
Cool, thanks! 
 Your padding note tweak is a definite improvement over what I originally 
had.
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8380] Port of the gdb7 debugging hooks to the "py3k" branch

2010-04-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Should we call it libpython3.py, in order to distinguish it from the 2.x 
version?

--
nosy: +pitrou

___
Python tracker 

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



[issue7355] Struct incorrectly compiles format strings

2010-04-12 Thread Meador Inge

Meador Inge  added the comment:

Those last two sentences where meant to be in response to your "Merged your 
changes and subsequent tweaks to py3k in r80016." comment.  I tried to reply to 
the tracker from my mail client and things got reformatted :(

--

___
Python tracker 

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



[issue8314] test_ctypes fails in test_ulonglong on sparc buildbots

2010-04-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It should be ported to py3k, the sparc buildbots still fail there.

--
nosy: +pitrou

___
Python tracker 

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



[issue8314] test_ctypes fails in test_ulonglong on sparc buildbots

2010-04-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
status: closed -> pending

___
Python tracker 

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



[issue4970] test_os causes delayed failure on x86 gentoo buildbot: Unknown signal 32

2010-04-12 Thread Stefan Krah

Stefan Krah  added the comment:

This type of failure appears again in current builds:

http://www.python.org/dev/buildbot/builders/x86 gentoo 
3.x/builds/2160/steps/test/logs/stdio

--
nosy: +skrah
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



[issue8380] Port of the gdb7 debugging hooks to the "py3k" branch

2010-04-12 Thread Dave Malcolm

Dave Malcolm  added the comment:

> Should we call it libpython3.py, in order to distinguish it from the 2.x
> version?

We could; it gets copied to python-gdb.py by the Makefile though.

The code is intended to track the low-level implementation details of the tree 
that its in, so I'd expect the python 2 and python 3 versions to drift apart 
over time, FWIW

--

___
Python tracker 

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



[issue8381] New Window Error

2010-04-12 Thread Aaron

New submission from Aaron :

When ever I try to open a new window or open a saved file in the IDLE (on a 
mac) it freezes. I am running snow leppord on a very new mac.

--
components: IDLE
messages: 102987
nosy: aaron.the.cow
severity: normal
status: open
title: New Window Error
type: crash

___
Python tracker 

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



[issue8364] Update site.setquit docstring

2010-04-12 Thread Brian Curtin

Brian Curtin  added the comment:

Committed in r80022 and r80023. Thanks.

--
assignee:  -> brian.curtin
nosy: +brian.curtin
priority:  -> normal
resolution:  -> fixed
stage:  -> 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



[issue8381] IDLE 2.6 freezes on OS X 10.6

2010-04-12 Thread Ned Deily

Ned Deily  added the comment:

This is a duplicate of Issue6864.  The problem is seen with the Apple-supplied 
IDLE in OS X 10.6 and appears to be an interaction with IDLE 2.6 and the 
Apple-supplied Cocoa Tk 8.5. One workaround is to install Python 2.6.5 using 
the python.org OS X installer and use its IDLE which does not exhibit this 
problem because it is linked with Tk 8.4.  Or, if you can use Python 2.5 
instead, you may be OK with Apple's built-in /usr/bin/idle2.5 .

--
assignee:  -> ronaldoussoren
components: +Macintosh
nosy: +ned.deily, ronaldoussoren
title: New Window Error -> IDLE 2.6 freezes on OS X 10.6
versions: +Python 2.6

___
Python tracker 

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



[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-12 Thread Timothy Fitz

Timothy Fitz  added the comment:

In this case bytecode isn't an optimization, it's a distribution choice (this 
bug reared it's ugly head in our closed-source downloadable client).

I think that implausible execution paths are still a bug. 

Running a .pyo without -O should be explicitly an error. For instance can we 
change python to reliably blow up at import time? Or implicitly run as if you 
added -O?

--
nosy: +Timothy.Fitz

___
Python tracker 

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



[issue8382] cStringIO and StringIO doesn't behave the same way

2010-04-12 Thread Tarek Ziadé

New submission from Tarek Ziadé :

Looks like the python version of StringIO can write tuples, but not the C 
version. I am not sure this is intended:

>>> from cStringIO import StringIO as cStringIO
>>> from StringIO import StringIO as StringIO
>>> string = StringIO()
>>> string.write(('my', 'tuple'))
>>> cstring = cStringIO()
>>> cstring.write(('my', 'tuple'))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: write() argument 1 must be string or read-only character buffer, not 
tuple

--
components: Library (Lib)
messages: 102991
nosy: tarek
severity: normal
status: open
title: cStringIO and StringIO doesn't behave the same way
type: behavior
versions: Python 2.6, Python 2.7

___
Python tracker 

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



[issue8382] cStringIO and StringIO don't behave the same way

2010-04-12 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--
title: cStringIO and StringIO doesn't behave the same way -> cStringIO and 
StringIO don't behave the same way

___
Python tracker 

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



[issue8364] Update site.setquit docstring

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

Answer to myself by Brian Curtin on the chatroom:

Him: it’s in the code so i would file it like code. "Library" for py modules, 
"Extension Modules" if its a C extension

Me: Your answer implies that components are mapped to directories, not areas 
(i.e. Library == Lib, documentation == Doc, not the general concept of 
documentation).

--

___
Python tracker 

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



[issue8382] cStringIO and StringIO don't behave the same way

2010-04-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Probably not. I guess an implicit str() is done on the argument given to 
write():

>>> s = StringIO()
>>> s.write((1,2))
>>> s.write(3)
>>> s.getvalue()
'(1, 2)3'

--
nosy: +pitrou
priority:  -> normal

___
Python tracker 

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



[issue8382] StringIO.write() takes any argument and converts it to a string

2010-04-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
title: cStringIO and StringIO don't behave the same way -> StringIO.write() 
takes any argument and converts it to a string

___
Python tracker 

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



[issue8382] StringIO.write() takes any argument and converts it to a string

2010-04-12 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Yes, I am not sure what would be the best fix though. We cannot raise an error 
on StringIO now because this will break lots of code out there. 

In the meantime, I think it's cleaner to avoid doing implicit str() 
conversions, so I think cStringIO has a better approach.

I would be in favor of a status quo for 2.x

--

___
Python tracker 

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



[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2010-04-12 Thread Kyle VanderBeek

Kyle VanderBeek  added the comment:

Ping?  Is anyone working on this?  Have Eric's concerns been addressed and can 
we pickle/unpickle all exceptions yet?

--
nosy: +kylev

___
Python tracker 

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



[issue8383] pickle is unable to encode unicode surrogates

2010-04-12 Thread STINNER Victor

New submission from STINNER Victor :

Python3 uses unicode surrogates to store undecodable filenames. Eg. the 
filename b"abc\xff.py" is encoded as "abc\xdcff.py" if the file system encoding 
is ASCII. Pickle is unable to store them:

./python -c 'import pickle; pickle.dumps("abc\udcff")'
(...)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 
20: surrogates not allowed

This is a limitation of pickle (in the binary mode): Python accepts to store 
any unicode character, but pickle doesn't.

Using "surrogatepass" error handler should be enough to fix this issue.

Related issue: #3672 (Reject surrogates in utf-8 codec) -> r72208 creates 
"surrogatepass" error handler.

--
components: Library (Lib)
messages: 102996
nosy: haypo, lemburg, loewis
severity: normal
status: open
title: pickle is unable to encode unicode surrogates
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue8383] pickle is unable to encode unicode surrogates

2010-04-12 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
Added file: http://bugs.python.org/file16904/pickle_surrogates.patch

___
Python tracker 

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



[issue8383] pickle is unable to encode unicode surrogates

2010-04-12 Thread STINNER Victor

STINNER Victor  added the comment:

I found this bug indirectly: test_logging failed on a SocketHandler if 
LogRecord.pathname contains a surrogate character. SocketHandler uses pickle to 
serialize the record.

--

___
Python tracker 

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



[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2010-04-12 Thread Craig McQueen

Craig McQueen  added the comment:

I tried it in Python 3.1.2.

\Python31\python.exe setup.py build --compiler=mingw32

I got a stack-trace:

...
  File "C:\Python31\lib\distutils\cygwinccompiler.py", line 280, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Python31\lib\distutils\cygwinccompiler.py", line 124, in __init__
if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()

--

___
Python tracker 

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



[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2010-04-12 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Craig, that's another bug, can you open another issue for that?

The missing vcvarsall.bat bug is cleared and I will close this issue once I've 
reverted distutils state in the 3.x branch

--

___
Python tracker 

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



[issue8384] Distutils C extension build with MinGW on Windows fails

2010-04-12 Thread Craig McQueen

New submission from Craig McQueen :

I tried to build a C extension in Python 3.1.2.

\Python31\python.exe setup.py build --compiler=mingw32

I got a stack-trace:

...
  File "C:\Python31\lib\distutils\cygwinccompiler.py", line 280, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Python31\lib\distutils\cygwinccompiler.py", line 124, in __init__
if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()

This is Windows 2000 SP4, with MinGW 5.1.6.

--
assignee: tarek
components: Distutils
messages: 103000
nosy: cmcqueen1975, tarek
severity: normal
status: open
title: Distutils C extension build with MinGW on Windows fails
type: crash
versions: Python 3.1

___
Python tracker 

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



[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2010-04-12 Thread Craig McQueen

Craig McQueen  added the comment:

Sure can--done. Issue #8384.

--

___
Python tracker 

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



[issue5341] A selection of spelling errors and typos throughout source

2010-04-12 Thread Éric Araujo

Changes by Éric Araujo :


Removed file: http://bugs.python.org/file16855/functools-typos-pep8.diff

___
Python tracker 

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



[issue5341] A selection of spelling errors and typos throughout source

2010-04-12 Thread Éric Araujo

Changes by Éric Araujo :


Removed file: http://bugs.python.org/file16894/functools-typos-pep8.diff

___
Python tracker 

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



[issue5341] A selection of spelling errors and typos throughout source

2010-04-12 Thread Éric Araujo

Éric Araujo  added the comment:

I saw the author of functools on the chatroom and asked for feedback. Summary:

* Rewrapping, whitespace changes, quote changes and other minor PEP 8 stuff is 
not worth the trouble it creates (eats time without improving Python’s quality, 
and also disturbing use of $vcs blame);
* Doc changes have to apply to all four branches, not just trunk and py3k.

This leaves the two typos.  I’ll port the “built{-,}in” fixes to 2.6 and 3.1 
later.

--

___
Python tracker 

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



  1   2   >