[issue13350] Use PyUnicode_FromFomat instead of PyUnicode_Format for fixed formats

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

+1

--
nosy: +loewis

___
Python tracker 

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



[issue10570] curses.tigetstr() returns bytes, but curses.tparm() expects a string

2011-11-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 3a0a94797ac5 by Petri Lehtinen in branch '3.2':
curses.tparm() is expecting a byte string, not curses.tigetstr()
http://hg.python.org/cpython/rev/3a0a94797ac5

New changeset 626c6c7f3af6 by Petri Lehtinen in branch 'default':
curses.tparm() is expecting a byte string, not curses.tigetstr()
http://hg.python.org/cpython/rev/626c6c7f3af6

--

___
Python tracker 

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



[issue7777] Support needed for AF_RDS family

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I think the patch currently lacks a lot of symbolic constants; see my review.

--

___
Python tracker 

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



[issue10570] curses.tigetstr() returns bytes, but curses.tparm() expects a string

2011-11-06 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


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



[issue13354] tcpserver should document non-threaded long-living connections

2011-11-06 Thread Bas Wijnen

New submission from Bas Wijnen :

http://docs.python.org/py3k/library/socketserver.html says:

The solution is to create a separate process or thread to handle each request; 
the ForkingMixIn and ThreadingMixIn mix-in classes can be used to support 
asynchronous behaviour.

There is another way, which doesn't bring multi-threading hell over you: keep a 
copy of the file descriptor and use it when events occur. I recall that this 
suggestion used to be in the documentation as well, but I can't find it 
anymore. It would be good to add this suggestion to the documentation.

However, there is a thing you must know before you can use this approach: 
tcpserver calls shutdown() on the socket when handle() returns. This means that 
the network connection is closed. Even dup2() doesn't keep it open (it lets you 
keep a file descriptor, but it returns EOF). The solution for this is to 
override shutdown_request of your handler to only call close_request (or not 
call anything at all) for sockets which must remain open. That way, as long as 
there is a reference to the socket, the network connection will not be shut 
down. Optionally the socket can be shutdown() explicitly when you're done with 
the connection.

Something like the paragraph above would be useful in the documentation IMO.

--
assignee: docs@python
components: Documentation
messages: 147147
nosy: docs@python, shevek
priority: normal
severity: normal
status: open
title: tcpserver should document non-threaded long-living connections
type: feature request
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



[issue13355] random.triangular error when low = mode

2011-11-06 Thread Mark

New submission from Mark :

When low and mode are the same in random.triangular it gives the following 
error:


: float division
  args = ('float division',)
  message = 'float division' 


When high and mode are the same there is no problem.

--
components: Extension Modules
messages: 147148
nosy: mark108
priority: normal
severity: normal
status: open
title: random.triangular error when low = mode
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



[issue13355] random.triangular error when low = mode

2011-11-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

I can't reproduce this:

Python 2.7.2 |EPD 7.1-2 (32-bit)| (default, Jul  3 2011, 15:40:35) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "packages", "demo" or "enthought" for more information.
>>> from random import triangular
>>> triangular(low=1, high=2, mode=1)  # low == mode
1.185344240827765

Note that the order of the parameters to random.triangular is (low, high, 
mode).  I suspect that you're actually passing identical values for `low` and 
`high`, and that's what's causing the error.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13355] random.triangular error when low = mode

2011-11-06 Thread Mark

Mark  added the comment:

Many thanks, Mark. I'm very new to python so apologies for my obvious mistake 
(you were absolutely right, I was feeding the high and mode in back to front). 

As a separate aside, it would be convenient if low=high=mode returned low (or 
mode or high) rather than error but it's a minor point really and easy to work 
around as is.

Many thanks for your help.

--

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

> What do you suggest? Doing it in _PyEval_SliceIndex() in 2.7 is
> problematic, as we don't want x[None:2], right? :)

Eh? Don't we already have this?

Python 2.7.2 (default, Aug 22 2011, 13:53:27) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> range(5)[None:2]
[0, 1]

Or am I misunderstanding?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13338] Not all enumerations used in _Py_ANNOTATE_MEMORY_ORDER

2011-11-06 Thread Floris Bruynooghe

Floris Bruynooghe  added the comment:

Apologies for not attaching a patch, I thought it was pretty trivial.  Attached 
it now.

--
keywords: +patch
Added file: http://bugs.python.org/file23616/pyatomic.diff

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

> Or am I misunderstanding?

Ah, no, sorry. I wasn't aware of this.

Now the error message set by _PyEval_SliceIndex() makes sense. It doesn't 
itself accept None, but apply_slice() and assign_slice() handle the None case.

There's still the question whether {list,tuple}.index() should accept None or 
not.

--

___
Python tracker 

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



[issue13338] Not all enumerations used in _Py_ANNOTATE_MEMORY_ORDER

2011-11-06 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
keywords: +needs review
stage: needs patch -> patch review

___
Python tracker 

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



[issue13350] Use PyUnicode_FromFomat instead of PyUnicode_Format for fixed formats

2011-11-06 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

This would chop unnecessary lines of code very nicely. +1

--

___
Python tracker 

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



[issue13355] random.triangular error when low = mode

2011-11-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

> it would be convenient if low=high=mode returned low (or mode or high)

Yes, I agree that random.triangular should degrade gracefully, in the same way 
that random.uniform does.

--

___
Python tracker 

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



[issue10287] NNTP authentication should check capabilities

2011-11-06 Thread Julien ÉLIE

Julien ÉLIE  added the comment:

A drawback is that CAPABILITIES will still being unsent after an upgrade of the 
news server to a more up-to-date version supporting the command.

If CAPABILITIES is not understood by the news server, it is not an issue.  A 
500 response code is usually answered by the news server, which is 
RFC-compliant.  nntplib should then behave properly.  (getcapabilities() 
returns an empty dictionary when CAPABILITIES is not implemented.)

--

___
Python tracker 

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



[issue10287] NNTP authentication should check capabilities

2011-11-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> By always sending capabilities at connection, some servers immediately
> throw an error. I've modified the class initialization to include an
> optional parameter to indicate if this should be disabled.

Which kind of error? As Julien says, we could simply catch it and
proceed.
By the way, when sending a patch, please send a unified diff if possible
("diff -u"; if you are using Mercurial, this should be the default).

--

___
Python tracker 

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



[issue10570] curses.tigetstr() returns bytes, but curses.tparm() expects a string

2011-11-06 Thread STINNER Victor

STINNER Victor  added the comment:

> The entry in Misc/NEWS mentions the change in curses.tigetstr(),
> but actually curses.tparm() has been changed

Woops, thanks for fixing the NEWS file :-)

--

___
Python tracker 

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



[issue13350] Use PyUnicode_FromFomat instead of PyUnicode_Format for fixed formats

2011-11-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 386a319b1825 by Amaury Forgeot d'Arc in branch 'default':
Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
http://hg.python.org/cpython/rev/386a319b1825

--
nosy: +python-dev

___
Python tracker 

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



[issue13350] Use PyUnicode_FromFomat instead of PyUnicode_Format for fixed formats

2011-11-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Now PyUnicode_Format is only called by unicode_mod...

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



[issue13353] documentation problem in logging.handlers.TimedRotatingFileHandler for 2.7

2011-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +vinay.sajip
stage:  -> needs patch

___
Python tracker 

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



[issue7777] Support needed for AF_RDS family

2011-11-06 Thread Charles-François Natali

Charles-François Natali  added the comment:

Here's an updated patch:
- address returned by recvfrom()
- recv flags (MSG_PEEK)
- congestion behavior

I've also added a bunch of constants:
- all the typical SO_ constants
- CMSG flags
- RDMA-related options (RDMA is probably one of the most useful features of RDS)
- I chose to let aside INFO flags, since they don't appear in the man pages  
(and neither here: https://github.com/agrover/python-rds/blob/master/rdma.py, a 
ctypes-based RDS implementation I stumbled upon)
- I didn't add control messages tests: they all pertain to RDMA, which is 
rather tricky to test to test from Python (and my header files don't define 
them)

--
Added file: http://bugs.python.org/file23617/socket_rds-2.diff

___
Python tracker 

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



[issue13355] random.triangular error when low = mode

2011-11-06 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> There's still the question whether {list,tuple}.index() should accept None or 
> not.

The API should not be changed for Py2.7 and Py3.2.  Those changesets should be 
reverted.

For Py3.3, it is open to discussion, but we probably don't need the change 
(making every other implementation also change for nearly zero benefit).

--

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

One other thought:  the API for list.index() doesn't exist in isolation.  There 
is also str.index, the sequence abstract base class, and tons of code that has 
been written to emulate lists.  This is an ancient API (approx 20 years) and 
should only be changed with care.

IOW, I don't think this change should have been made at all, at least not 
without a discussion on python-dev and motivating use cases.

--
priority: normal -> high
resolution: fixed -> 

___
Python tracker 

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



[issue10115] Support accept4() for atomic setting of flags at socket creation

2011-11-06 Thread Vetoshkin Nikita

Vetoshkin Nikita  added the comment:

up?

--

___
Python tracker 

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



[issue13356] test_logging warning on 2.7

2011-11-06 Thread Ezio Melotti

New submission from Ezio Melotti :

$ ./python -Wd -3 -m test.regrtest -v test_logging
== CPython 2.7.2+ (2.7:39573be48b4a, Nov 6 2011, 17:13:44) [GCC 4.6.1]
==   Linux-3.0.0-12-generic-i686-with-debian-wheezy-sid little-endian
==   /home/wolf/dev/py/wide-2.7/build/test_python_6508
Testing with flags: sys.flags(debug=0, py3k_warning=1, division_warning=1, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=1, verbose=0, 
unicode=0, bytes_warning=0)
test_logging
[...]
test_listen_config_10_ok (test.test_logging.ConfigDictTest) ... 
/home/wolf/dev/py/wide-2.7/Lib/logging/config.py:599: UnicodeWarning: Unicode 
equal comparison failed to convert both arguments to Unicode - interpreting 
them as being unequal
  if name in existing:
ok
[...]

--
Ran 43 tests in 2.328s

OK
1 test OK.

--
assignee: vinay.sajip
components: Library (Lib)
messages: 147165
nosy: ezio.melotti, vinay.sajip
priority: normal
severity: normal
stage: needs patch
status: open
title: test_logging warning on 2.7
type: behavior
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



[issue10115] Support accept4() for atomic setting of flags at socket creation

2011-11-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> What value should we assign to sock->sock_timeout if SOCK_NONBLOCK was 
> specified in accept4() call?

The same value as for other non-blocking sockets, IMO.

> And in socket.py should we check as in original accept:
> if getdefaulttimeout() is None and self.gettimeout():
>sock.setblocking(True)

I don't think so, since the whole point of accept4() is to override normal 
flags creation.

--
versions: +Python 3.3 -Python 3.2

___
Python tracker 

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



[issue10115] Support accept4() for atomic setting of flags at socket creation

2011-11-06 Thread Vetoshkin Nikita

Vetoshkin Nikita  added the comment:

> The same value as for other non-blocking sockets, IMO.
There are three possible values I think:
1. parent's current sock_timeout
2. global default socket timeout
3. 0

Can you please tell which one? I assume it should be number 3.

--

___
Python tracker 

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



[issue10115] Support accept4() for atomic setting of flags at socket creation

2011-11-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > The same value as for other non-blocking sockets, IMO.
> There are three possible values I think:
> 1. parent's current sock_timeout
> 2. global default socket timeout
> 3. 0
> 
> Can you please tell which one? I assume it should be number 3.

Yes (again, IMO).

--

___
Python tracker 

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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Michael Brooks

New submission from Michael Brooks :

Open the attached file "red_test.html" in a browser.  The "bad" elements are 
blue because the style tag isn't parsed by any known browser.   However,  the 
HTMLParser library will incorrectly recognize them.

--
components: Library (Lib)
files: red_test.html
messages: 147169
nosy: Michael.Brooks
priority: normal
severity: normal
status: open
title: HTMLParser parses attributes incorrectly.
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file23618/red_test.html

___
Python tracker 

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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

Thanks for the report.
Could you try with the latest 2.7 and see if you can reproduce the problem? 
(see the devguide for instructions.)

If you can reproduce the issue even on the latest 2.7, it would be great if you 
could provide a patch with a test case like the ones in 
Lib/test/test_htmlparser.py.

--
nosy: +ezio.melotti
stage:  -> test needed

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 19ffa12ffdd4 by Petri Lehtinen in branch '2.7':
Revert "Accept None as start and stop parameters for list.index() and 
tuple.index()"
http://hg.python.org/cpython/rev/19ffa12ffdd4

New changeset ed0e85efac47 by Petri Lehtinen in branch '3.2':
Revert "Accept None as start and stop parameters for list.index() and 
tuple.index()"
http://hg.python.org/cpython/rev/ed0e85efac47

New changeset 106f9e1ad7ab by Petri Lehtinen in branch 'default':
Revert "Accept None as start and stop parameters for list.index() and 
tuple.index()"
http://hg.python.org/cpython/rev/106f9e1ad7ab

--

___
Python tracker 

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



[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

It's now reverted on all branches. I posted to python-dev alreay earlier.

--

___
Python tracker 

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



[issue13327] Update utime API to not require explicit None argument

2011-11-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 99e118951a80 by Brian Curtin in branch 'default':
Fix #13327. Remove the need for an explicit None as the second argument to
http://hg.python.org/cpython/rev/99e118951a80

--
nosy: +python-dev

___
Python tracker 

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



[issue6203] 3.x locale does not default to C, contrary to the documentation and to 2.x behavior

2011-11-06 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

If the thread safety of setlocale() is a problem, does anybody know how 
portable uselocale() is? It sets the locale of the current thread only, so it's 
safe to temporarily change the locale and then set it back.

--
nosy: +petri.lehtinen

___
Python tracker 

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



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-06 Thread Michael Brooks

New submission from Michael Brooks :

The HTML tag at the bottom of this page correctly identified has having cdata 
like properties and trigger set_cdata_mode().  Due to the cdata properties of 
this tag,  the only way to end the data segment is with a closing  
tag, NO OTHER tag can close this data segment.  Currently in cdata mode the 
HTMLParser will use this regular expression to close this script tag: 
re.compile(r'<(/|\Z)'),  however this script tag is setting a variable with 
data that contains "" which will terminate this script tag prematurely.

I have written and tested the following patch on my system:
#used to terminate cdata elements
endtagfind_script = re.compile('(?i)')
endtagfind_style = re.compile('(?i)')

class html_patch(HTMLParser.HTMLParser):
# Internal -- sets the proper tag terminator based on cdata element type
def set_cdata_mode(self, tag):
#We check if the script is either a style or a script
#based on self.CDATA_CONTENT_ELEMENTS
if tag=="style":
self.interesting = endtagfind_style
elif tag=="script":
self.interesting = endtagfind_script
else:
self.error("Unknown cdata type:"+tag) # should never happen
self.cdata_tag = tag 


This cdata tag isn't parsed properly by HTMLParser,  but it works fine in a 
browser:

pwa.setup(
pwa.searchview,
'lhid_searchheader',
'lhid_content',
'lhid_trayhandle',
'lhid_tray',
{'query': 'test',
'tagQuery': '',
'searchScope': '',
'owner': '',
'doCrowding': false,
'isOwner': false,
'albumId': ''
,'experimentalsearchquality': true},
'firealwaysworks'
,
{feedUrl: 
'https://picasaweb.google.com/data/feed/tiny/all?alt=jsonm&kind=photo&access=public&filter=1&q=test',
feedPreload: null},
{NEW_HOMEPAGE:1,NEW_ONE_BAR:1,fr:1,tags:1,search:1,globalsearch:1,globalsearchpromo:1,newfeatureslink:1,cart:1,contentcaching:1,developerlink:1,payments:1,newStrings:1,cccquota:1,signups:1,flashSlideshow:1,URL_SHORTENER_VISIBILITY:1,emailupload:1,photopickeralbumview:1,PWA_NEWUI:1,WILDCARD_QUERY_FEED:1,recentphotos:1,editinpicasa:1,imagesearch:1,froptin:1,FR_CONTINUOUS_CLUSTERING:1,asyncUploads:1,PERFORMANCE_EXPERIMENTS:1,BAKED_PRELOAD_FEEDS:1,albumviewlimit:1,HQ_VIDEOS:1,VIDEO_INFO_DISPLAY:1,CSI:1,EXPERIMENTAL_SEARCH_QUALITY:1,COMMENT_TRANSLATION:1,NEW_COMMENT_STYLE:1,ENABLE_NEW_FLAG_ABUSE_FORM:1,QRCODE:1,CHINA:1,GWS_URL_REDIRECTION:1,FEATURED_PHOTOS:1,COMMENT_SUBSCRIPTION:1,COMMENT_SUBSCRIPTION_SETTING:1,PICASA_MAC:1,AD_ON_SEARCHPAGE:1,API_AUTO_ACCOUNTS:1,FOCUS_GROUP_ACL:1,PHOTOSTREAM:1,BACKEND_ACL:1,ADVANCED_SEARCH:1,FACE_SEARCH:1,CAMERA_SEARCH:1,NOTIFICATION:1,PIXELATED_PREVIEW:1,TRANSPARENT_PIXELATED_PREVIEW:1,NEW_SETTINGS_PAGE:1,VIEW_STARRERS:1,FR_FOCUS_MERGE:1,AD_ON_SEARCH_ONE
 
UP:1,GALLERY_COMMENTS:1,COMMENT_ABUSE_BLOCKING:1,FAVORITE_NOTIFICATION:1,IMAGE_ONLY_LINK:1,RECENT_PHOTOS_SLIDESHOW:1,HEART:1,SMALLER_IMAGE:1,FAST_SLIDESHOW:1,VIEW_CONTACTS:1,COLLABORATIVE_ALBUMS:1,PRINT_MARKETPLACE:1,PRINT_MARKETPLACE_REPLACEMENT:1,VIEW_COUNT:1,POST_TO:1,GAPLUS:1,PICASA_PROMO:1,DOUBLECLICK_PREMIUM_ADS:1,DOUBLECLICK_EXPLORE_MAIN:1,DOUBLECLICK_MYPHOTOS:1,DOUBLECLICK_PUBLIC_GALLERY:1,DOUBLECLICK_USER_ALBUM:1,DOUBLECLICK_USER_PHOTO:1,DOUBLECLICK_VISITOR_ADS:1,PRODUCTION:1,NOSCRIPT:1,UNLISTED_GALLERY:1,GA_TRACKING:1,UNLIMITED_GALLERY:1,PICNIK_EDIT:1,MICROSCOPE_ZOOM:1,FR_V2:1,FAVORITE_SUGGESTION:1,FAVORITE_UPDATE:1,MERGED_PROFILES_SOFTLAUNCH:1,MERGED_PROFILES:1,MERGED_PROFILES_ASYNC:1,NEW_FR_UI:1,GAPLUS_UNMERGED_SOCIALIZATION:1,OPTOUT_ACL_NOTIFICATION:1,HTTPS_VISIBILITY:1,DEFAULT_HTTPS:1,EXTENDED_EXIF:1,DOUBLECLICK_MULTISLOT:1,ONEPICK:1,PER_ALBUM_GEO_VISIBILITY:1,FOCUS_MERGE_LINK_DIALOG_VISIBILITY:1,SHAREBOX_VISIBILITY:1,AUTO_DOWNSIZE:1,BULK_ALBUM_EDITOR_VISIBILITY:1,PROF
 ILE_NAME_CHECK:1,COLLABORATIVE_NAMETAGS:1,NOT_FOUND_404:1,REDIRECT_TO_PLUS:1},
{
'gdataVersion': '4.0',
'updateCartPath': '\x2Flh\x2FupdateCart?rtok=b8S9ibYqrTMF',
'editCaptionsPath': '',
'albumMapPath': '',
'albumKmlUrl': '',
'selectedPhotosPath': 
'\x2Flh\x2FselectedPhotos?tok=QUI1UGxRYk9fNmw1Q2tVeS1DWnY3UlFoTTY1RzRNNWphdzoxMzIwNjAyMzA3NDYx',
'setLicensePath': '',
'setStarPath': 
'\x2Flh\x2FsetStar?tok=QUI1UGxRWW4zY1ZKb3U0TzROZU5tUHhIV3hhRW9HcUYwQToxMzIwNjAyMzA3NDYx',
'peopleManagerPath': '',
'peopleSearchPath': '',
'clusterViewPath': '',
'frOptStatus': 'OptedIn',
'isNameTagsVisible': '','authUserIsPhotosUser': true,
'authUserNickname': 'Some Nickname',
'authUserPortraitUrl': 
'https:\x2F\x2Flh4.googleusercontent.com\x2F-UI9ZfIFfyQI\x2FAAI\x2FAAA\x2Fm0enLvZXYbI\x2Fs32-c\x2Ffirealwaysworks.jpg',
'authUserProfileUrl':'https:\x2F\x2Fprofiles.google.com\x2F115162402406836485912',
 
'authUser':{name:'firealwaysworks',isProfileUser:1,isLoggedIn:1,user:1,isOwner:1
,'showGeo': 0
},
'foreignNickname': '',
'subjects': [
]
,
'owner': {name:'firealwaysworks',n

[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-06 Thread Michael Brooks

Changes by Michael Brooks :


--
type:  -> behavior

___
Python tracker 

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



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

Have you tried with the latest 2.7? (see msg147170)

--
nosy: +ezio.melotti
stage:  -> test needed

___
Python tracker 

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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Michael Brooks

Michael Brooks  added the comment:

Yes, I am running the latest version,  which is python 2.7.2.

On Sun, Nov 6, 2011 at 12:14 PM, Ezio Melotti wrote:

>
> Ezio Melotti  added the comment:
>
> Thanks for the report.
> Could you try with the latest 2.7 and see if you can reproduce the
> problem? (see the devguide for instructions.)
>
> If you can reproduce the issue even on the latest 2.7, it would be great
> if you could provide a patch with a test case like the ones in
> Lib/test/test_htmlparser.py.
>
> --
> nosy: +ezio.melotti
> stage:  -> test needed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-06 Thread Michael Brooks

Michael Brooks  added the comment:

Yes I am running python 2.7.2.

On Sun, Nov 6, 2011 at 12:52 PM, Ezio Melotti wrote:

>
> Ezio Melotti  added the comment:
>
> Have you tried with the latest 2.7? (see msg147170)
>
> --
> nosy: +ezio.melotti
> stage:  -> test needed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

I mean 2.7.3 (i.e. the development version).
You need to get a clone of Python as explained here: 
http://docs.python.org/devguide/

--

___
Python tracker 

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



[issue13359] urllib2 doesn't escape spaces in http requests

2011-11-06 Thread Davide Rizzo

New submission from Davide Rizzo :

urllib2.urlopen('http://foo/url and spaces') will send a HTTP request line like 
this to the server:

GET /url and spaces HTTP/1.1

which the server obviously does not understand. This contrasts with urllib's 
behaviour which replaces the spaces (' ') in the url with '%20'.

Related: #918368 #1153027

--
components: Library (Lib)
messages: 147180
nosy: davide.rizzo, orsenthil
priority: normal
severity: normal
status: open
title: urllib2 doesn't escape spaces in http requests
type: behavior
versions: Python 2.7, 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



[issue13359] urllib2 doesn't escape spaces in http requests

2011-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> test needed

___
Python tracker 

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



[issue13360] UnicodeWarning raised on dict() and set()

2011-11-06 Thread Florent Xicluna

New submission from Florent Xicluna :

The UnicodeWarning is raised on some dict or set operations.
It is not very helpful, and sometimes annoying.
And it is somewhat inconsistent.


# ** warning not raised **

$ python2.7 -c "print u'd\xe9' in {'foo', 'bar'}"
False
$ python2.7 -c "print 'd\xe9' in {u'foo', u'bar'}"
False
$ python2.7 -c "print 'd\xc3\xa9' in {u'foo', u'd\xe9'}"
False


# ** warning raised **

$ python2.7 -c "print 'd\xe9' in {u'foo', u'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments 
to Unicode - interpreting them as being unequal
False
$ python2.7 -c "print u'd\xe9' in {'foo', 'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments 
to Unicode - interpreting them as being unequal
False

--
components: Unicode
messages: 147181
nosy: ezio.melotti, flox
priority: normal
severity: normal
status: open
title: UnicodeWarning raised on dict() and set()
type: behavior
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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Michael Brooks

Michael Brooks  added the comment:

Python 2.7.3 is still affected by both of these issues.

On Sun, Nov 6, 2011 at 12:56 PM, Ezio Melotti wrote:

>
> Ezio Melotti  added the comment:
>
> I mean 2.7.3 (i.e. the development version).
> You need to get a clone of Python as explained here:
> http://docs.python.org/devguide/
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue13356] test_logging warning on 2.7

2011-11-06 Thread Florent Xicluna

Changes by Florent Xicluna :


--
dependencies: +UnicodeWarning raised on dict() and set()
nosy: +flox

___
Python tracker 

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



[issue13360] UnicodeWarning raised on dict() and set()

2011-11-06 Thread Florent Xicluna

Florent Xicluna  added the comment:

Similar expressions where the warning is raised or not (depending on "latin-1" 
comparison):


$ python2.7 -c "print u'd\xe9' in {'foo', 'd\xe9r'}"
False
$ python2.7 -c "print u'd\xe9' in {'foo', 'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments 
to Unicode - interpreting them as being unequal
False


$ python2.7 -c "print 'd\xe9r' in {u'foo', u'd\xe9'}"
False
$ python2.7 -c "print 'd\xe9'  in {u'foo', u'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments 
to Unicode - interpreting them as being unequal
False

--

___
Python tracker 

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



[issue10287] NNTP authentication should check capabilities

2011-11-06 Thread Nathan Clayton

Nathan Clayton  added the comment:

When using Easynews, it sends a 480 error (e.g. "nntplib.NNTPTemporaryError: 
480 You must log in.")

--

___
Python tracker 

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



[issue7777] Support needed for AF_RDS family

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Not having tests for the control messages is fine with me - we don't need to 
test Linux, but Python.

--

___
Python tracker 

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



[issue13356] test_logging warning on 2.7

2011-11-06 Thread Florent Xicluna

Florent Xicluna  added the comment:

This is the expression which raises the warning.

>>> u'compiler.parser' in ['\xab\xd7\xbb', u'\u013f\xd6G']
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both 
arguments to Unicode - interpreting them as being unequal
False


See also issue #13360

--

___
Python tracker 

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



[issue13360] UnicodeWarning raised on dict() and set()

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I fail to see the issue. What exactly is the problem with the warning? It looks 
all consistent and helpful to me.

--
nosy: +loewis

___
Python tracker 

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



[issue13360] UnicodeWarning raised on sequence and set comparisons

2011-11-06 Thread Florent Xicluna

Florent Xicluna  added the comment:

Often sequences or sets have heterogeneous keys, mixing  and , 
and in this case there's no easy way to work with them without raising this 
UnicodeWarning.
The "logging" module is such an example.

Of course it is only a warning, not a strong annoyance.

--
title: UnicodeWarning raised on dict() and set() -> UnicodeWarning raised on 
sequence and set comparisons

___
Python tracker 

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



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2011-11-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

I'm not sure what is the best solution here.

unescape uses a regex with replaceEntities as callback to replace the entities 
in attribute values.
The problem is that replaceEntities currently returns unicode, and if unescape 
receives a str, an automatic coercion to unicode happens and an error is raised 
whenever the str is non-ascii.

The possible solutions are:
 1) Document the status quo (i.e replaceEntities always returns unicode, and an 
error is raised whenever a string that contains non-ascii chars is passed);
 2) Change replaceEntities to return str only for ascii chars (as the patch 
proposed by Zbigniew does).  This works as long as the entity resolves to an 
ascii character, but keep failing for the other cases.

The first option is cleaner, and means that if you want to parse something you 
should always use unicode, otherwise it might fail (In case of ambiguity, 
refuse the temptation to guess).
The second option might allow you to parse a few more documents without 
converting them to unicode, but only if you are lucky (i.e. you don't get any 
unicode mixed with non-ascii str).  If most of the entities in attributes 
resolve to ascii (e.g. "e; & ' > <), it might be more 
practical to return str and avoid unnecessary errors, while still adding a note 
in documentation that passing unicode is better.

--
nosy: +ezio.melotti, r.david.murray
type:  -> behavior
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



[issue13353] documentation problem in logging.handlers.TimedRotatingFileHandler for 2.7

2011-11-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 0b779988e8b7 by Vinay Sajip in branch '2.7':
Closes issue #13353: version doumentation about utc parameter corrected.
http://hg.python.org/cpython/rev/0b779988e8b7

--
nosy: +python-dev

___
Python tracker 

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



[issue13353] documentation problem in logging.handlers.TimedRotatingFileHandler for 2.7

2011-11-06 Thread Vinay Sajip

Changes by Vinay Sajip :


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



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2011-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue13360] UnicodeWarning raised on sequence and set comparisons

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> Often sequences or sets have heterogeneous keys, mixing  and
> , and in this case there's no easy way to work with them
> without raising this UnicodeWarning.

That's a bug in the application. You must not mix byte strings
and unicode strings as dictionary keys. Whether or not the warning
is produced: the behavior would still be fairly unpredictable, and
vary with Python versions.

> Of course it is only a warning, not a strong annoyance.

This warning is deliberate. It tells the developer that something
is broken about this application.

--

___
Python tracker 

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



[issue13323] urllib2 does not correctly handle multiple www-authenticate headers in an HTTP response

2011-11-06 Thread David Fischer

David Fischer  added the comment:

With this patch, the AbstractBasicAuthHandler (and its subclasses) performs a 
regex search on the amalgamated "www-authenticate" header for basic 
authentication. 

This fixes the case where you have an HTTP response of the form:

HTTP/1.1 401 Authorization Required
Server: HTTPd/1.0
WWW-Authenticate: Basic realm="Secure Area"
WWW-Authenticate: SomethingElse realm="Alternative"
...

In the above case, AbstractBasicAuthHandler will attempt basic auth against the 
"Secure Area" realm.

--
keywords: +patch
Added file: http://bugs.python.org/file23619/urllib2_basicauth.patch

___
Python tracker 

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



[issue13356] test_logging warning on 2.7

2011-11-06 Thread Vinay Sajip

Vinay Sajip  added the comment:

Thanks, Florent. This patch was by you in response to issue #8201 - do you have 
any suggestion as to the best way to resolve this? I tried changing the 
non-ASCII logger to '\xc3\xb4\xc3\xbc', which decodes cleanly to u'\xf4\xfc' 
(o-circumflex u-umlaut), but it apparently still fails to convert to Unicode 
when doing the comparison, and so still raises the warning. Is there any 
byte-string sequence which won't give the error in this circumstance? Obviously 
I could convert it to Unicode, but then the test is checking correct operation 
when you have a non-ASCII (byte-)string name as well as a Unicode name for 
loggers.

--

___
Python tracker 

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



[issue13356] test_logging warning on 2.7

2011-11-06 Thread Florent Xicluna

Florent Xicluna  added the comment:

I suggest to use encoded string as keys in loggerDict.
It should solve both issue #8201 and this one.
Moreover, it seems in line with msg147191 from Martin on issue #13360.

Patch attached.

--
components: +Unicode
dependencies:  -UnicodeWarning raised on sequence and set comparisons
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file23620/issue13356_logging.diff

___
Python tracker 

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



[issue13361] getLogger does not check its argument

2011-11-06 Thread Florent Xicluna

New submission from Florent Xicluna :

>>> import logging
>>> log = logging.getLogger(any)
Traceback (most recent call last):
  File "", line 1, in 
  File "./Lib/logging/__init__.py", line 1730, in getLogger
return Logger.manager.getLogger(name)
  File "./Lib/logging/__init__.py", line 1114, in getLogger
self._fixupParents(rv)
  File "./Lib/logging/__init__.py", line 1142, in _fixupParents
i = name.rfind(".")
AttributeError: 'builtin_function_or_method' object has no attribute 'rfind'
>>> log = logging.getLogger(any)
>>> log.error("It should not create this logger")
It should not create this logger
>>>

--
components: Library (Lib)
messages: 147196
nosy: flox
priority: normal
severity: normal
stage: needs patch
status: open
title: getLogger does not check its argument
type: behavior
versions: Python 2.7, 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



[issue13361] getLogger does not check its argument

2011-11-06 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue583975] gethostbyaddr lag

2011-11-06 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

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



[issue13362] Many PEP 8 errors

2011-11-06 Thread skreft

New submission from skreft :

Hi all, I was reading Python's source code and was surprised to find many PEP 8 
errors.

The file that I found specially non PEP8 compliant is 
Lib/encodings/punnycode.py, but there are many others that are not compliant.

I think that this issue should be addressed, since Python's source code should 
be the model for good Pythonic code.

I would love to contribute on this topic. But since many files would be 
modified I don't know how to proceed. I see two things that could help to 
reduce the non compliance of the code. One is to have a website showing the non 
compliances of each file. And the one I like the most is to have a special test 
that checks the compliance of the code. The only problem is that it would rely 
on the external tool pep8 (http://pypi.python.org/pypi/pep8).

Let me know what you think.

Sebastian

--
messages: 147197
nosy: skreft
priority: normal
severity: normal
status: open
title: Many PEP 8 errors
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue13362] Many PEP 8 errors

2011-11-06 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Generally, we don't do style cleanups for the sake of style cleanups.

--
nosy: +benjamin.peterson
resolution:  -> 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



[issue13363] Many usages of dict.keys(), dict.values(), dict.items() when the iter version could be used

2011-11-06 Thread skreft

New submission from skreft :

In Python 2.7, there are many patterns of the form

for x in mapping.(keys()|values()|items()):
#code
when the iterator version of those method could be used.
Is there any reason for using those methods?

I see that in some other parts of the code the iterator version is used. Here 
is the summary:

   Non iter version Iter version
Keys   160  21 
Values 35   23
Items  249  79

I sued the following command

$ egrep -R "for.*[.]iterkeys\(\)" . | wc -l 


What's the position about this? Does it worth it to fix this?

--
messages: 147199
nosy: skreft
priority: normal
severity: normal
status: open
title: Many usages of dict.keys(), dict.values(), dict.items() when the iter 
version could be used
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



[issue13283] removal of two unused variable in locale.py

2011-11-06 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Éric, thanks for paying attention to this. In this particular case, I checked 
the code and verified that the variables were not used anywhere. But I will 
comply with the policy in the future.

Thanks again for pointing out.

--

___
Python tracker 

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



[issue13364] Duplicated Code

2011-11-06 Thread skreft

New submission from skreft :

By using tools like clonedigger is possible to spot some repeated code.
One file that caught my attention is Lib/decimal.py. It has many portions of 
duplicated code. 

Here is an example:
def logical_or(self, other, context=None):
"""Applies an 'or' operation between self and other's digits."""
if context is None:
context = getcontext()

other = _convert_other(other, raiseit=True)

if not self._islogical() or not other._islogical():
return context._raise_error(InvalidOperation)

# fill to context.prec
(opa, opb) = self._fill_logical(context, self._int, other._int)

# make the operation, and clean starting zeroes
result = "".join([str(int(a)|int(b)) for a,b in zip(opa,opb)])
return _dec_from_triple(0, result.lstrip('0') or '0', 0)

def logical_xor(self, other, context=None):
"""Applies an 'xor' operation between self and other's digits."""
if context is None:
context = getcontext()

other = _convert_other(other, raiseit=True)

if not self._islogical() or not other._islogical():
return context._raise_error(InvalidOperation)

# fill to context.prec
(opa, opb) = self._fill_logical(context, self._int, other._int)

# make the operation, and clean starting zeroes
result = "".join([str(int(a)^int(b)) for a,b in zip(opa,opb)])
return _dec_from_triple(0, result.lstrip('0') or '0', 0)


What's the posture about this? Should this be fixed?

ps: Even more duplicated code is found in python 2.7.

--
messages: 147201
nosy: skreft
priority: normal
severity: normal
status: open
title: Duplicated Code
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue13362] Many PEP 8 errors

2011-11-06 Thread skreft

skreft  added the comment:

Hi all again:

in the original posting of this issue,  I asked what would be the best way to 
address this issue. Additionally I proposed to use existing tools to check the 
current code. These tools could be easily added to the tests in a non failing 
mode, so developers who modify the code, could know that the source code does 
not follow the coding style and probably she/he could improve the code. This 
tool would also help newcomers to contribute better code.

Unfortunately, by the decision of rejecting this issue without even answering 
the full issue, I conclude that the Python team is not willing to improve its 
own basecode.

I repeat my posture, python source code should be a model of a python project, 
hence if there are tools that can ensure or improve the quality of the project, 
they should be incorporated to the development process.

--

___
Python tracker 

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



[issue13357] HTMLParser parses attributes incorrectly.

2011-11-06 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
priority: normal -> high

___
Python tracker 

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



[issue13362] Many PEP 8 errors

2011-11-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I concur with Benjamin.

This is a waste of time and a potential source of new errors.

--
nosy: +rhettinger

___
Python tracker 

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



[issue13363] Many usages of dict.keys(), dict.values(), dict.items() when the iter version could be used

2011-11-06 Thread Ned Deily

Ned Deily  added the comment:

Thanks for you interest in improving Python. As noted in the response to one of 
your other issues, we generally do not do style cleanups just for the sake of 
style cleanups.  In addition, our policy for current maintenance branches, like 
Python 2.7, is to apply bug fixes only.  As there will be no further feature 
releases for Python 2, anything other than a bug fix would only be a candidate 
for the next Python 3 release (Python 3.3).

See the Python Developer's Guide for more information:
http://docs.python.org/devguide/devcycle.html#maintenance-branches

--
nosy: +ned.deily
resolution:  -> rejected
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



[issue12760] Add create mode to open()

2011-11-06 Thread David Townshend

David Townshend  added the comment:

It is already possible to write a wrapper function that does it:

def create(file):
fd = os.open(file, os.O_EXCL | os.O_CREAT | os.O_WRONLY)
return os.fdopen(fd)

The point it not that it can't be done, but that it is not straight forward.  
The docs say this about os.open(): "This function is intended for low-level 
I/O. For normal usage, use the built-in function open()" 

I wouldn't call creating a new file low-level I/O, but it is normal usage.

--

___
Python tracker 

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



[issue13364] Duplicated Code

2011-11-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

How would you suggest refactoring this?

For that example, I'd prefer not to remove the repetition;  as it is, the code 
is clean and clear.  Eliminating the repetition would involve adding an extra 
layer of indirection, making the code in one of these functions harder to 
follow.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13349] Uninformal error message in index() and remove() functions

2011-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> needs patch

___
Python tracker 

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



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2011-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> needs patch
Added file: http://bugs.python.org/file23621/issue3932-test.diff

___
Python tracker 

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



[issue13362] Many PEP 8 errors

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

skreft: I can see nothing wrong by having a website that lists PEP 8 violations 
in the standard library - feel free to create one on wiki.python.org.

Your preferred solution of having automated tests is not feasible. Taking 
punycode.py (sic) as an example (of which I'm the author): I disagree with some 
of the warnings that the tool produces (and hence I probably disagree with 
parts of PEP 8 also). The warnings I agree with (about missing space 
characters), I also agree with Benjamin and Raymond: we shouldn't fix these in 
the code, since that would clutter the version history of the file (suggesting 
that it was modified when there wasn't any substantial change). The same 
reasoning probably applies to many other "violations".

When you said that punycode.py violates PEP 8, I was concerned. Then seeing the 
actual complaints of the tool make me laugh, since they are *really* 
micrological, when I was expecting substantial problems.

--
nosy: +loewis

___
Python tracker 

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



[issue13363] Many usages of dict.keys(), dict.values(), dict.items() when the iter version could be used

2011-11-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

skreft: since you were asking for a reason why the code looks the way it looks 
- the code in many cases predates the introduction of iterkeys and friends.

I personally find the names iterkeys/itervalues/iteritems fairly ugly, and 
rather avoid them for prettiness reasons, unless there is a real problem that 
requires using iterators. Thankfully, the issue was resolved in Python 3, where 
.keys() does the right thing (i.e. returning a view).

--
nosy: +loewis

___
Python tracker 

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