[issue10592] pprint module doesn't work well with OrderedDicts

2010-12-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
superseder: general pprint rewrite - 

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Give a try to this minor variation of the patch with tests added and let me 
know your review comments.

--
Added file: http://bugs.python.org/file19890/Issue3243-4.patch

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



[issue10084] SSL support for asyncore

2010-12-01 Thread Dirkjan Ochtman

Changes by Dirkjan Ochtman dirk...@ochtman.nl:


--
nosy: +djc

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Antoine Pitrou

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

Senthil:

+try:
+   self.sock.sendall(data)

Indentation problem here.

+if isinstance(data,str):
+content_length = len(data)

I'm not sure I understand. What does sending an unicode string mean?

+# Check iterable body support
+def iterable_body():
+yield one
+yield two
+yield three

Iterables of strings? this doesn't seem supported in the patch.

Also, it would be nice if the tests checked that the sent data is as expected.

--

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



[issue10594] Typo in PyList_New doc.

2010-12-01 Thread Antoine Pitrou

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

You don't need to backport, we'll do it ourselves. Can someone from the doc 
team please review/commit?

--
assignee: eli.bendersky - d...@python
nosy: +pitrou
stage:  - patch review

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



[issue8805] urllib should support SSL contexts

2010-12-01 Thread Antoine Pitrou

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

HTTPSHandler now allows to pass an SSLContext and the old API should be buried 
in the ground, closing.

--
resolution:  - rejected
status: open - closed

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



[issue10595] Adding a syslog.conf reader in syslog

2010-12-01 Thread Tarek Ziadé

New submission from Tarek Ziadé ziade.ta...@gmail.com:

The syslog module allows to configure via openlog() the facility.

There's one missing feature though, I'd love to have in a new API: a way to 
read the syslog configuration, and in particular to know where each facility 
file is located on the system.

e.g.:

   from syslog import get_config, LOG_AUTH
   get_config(LOG_AUTH)
  {'filename': '/var/log/auth.log', some other stuff}

I am not sure how easy it would be, looking at the syslog C API...

--
components: Library (Lib)
messages: 122990
nosy: jafo, tarek
priority: normal
severity: normal
status: open
title: Adding a syslog.conf reader in syslog
type: feature request
versions: Python 3.2, Python 3.3

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



[issue10596] modulo operator bug

2010-12-01 Thread Сергей Хлутчин

New submission from Сергей Хлутчин serc...@gmail.com:

Result of the modulo operator is wrong:

 (-2.22044604925e-16)%4
4.0
 (-4.0)%4
-0.0

--
messages: 122991
nosy: Sergio.Ĥlutĉin
priority: normal
severity: normal
status: open
title: modulo operator bug
type: behavior
versions: Python 2.6

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



[issue10596] modulo operator bug

2010-12-01 Thread Antoine Pitrou

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


--
nosy: +mark.dickinson

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



[issue10596] modulo operator bug

2010-12-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

What results were you expecting here?  Both those results look fine to me 
(though it's arguable that the second should be +0.0 rather than -0.0).

--
assignee:  - mark.dickinson

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



[issue10596] modulo operator bug

2010-12-01 Thread Сергей Хлутчин

Сергей Хлутчин serc...@gmail.com added the comment:

From the documetation:
The modulo operator always yields a result with the same sign as its second 
operand (or zero); the absolute value of the result is strictly smaller than 
the absolute value of the second operand.

--

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



[issue7359] mailbox cannot modify mailboxes in system mail spool

2010-12-01 Thread Ole Laursen

Ole Laursen o...@iola.dk added the comment:

Just got bitten by this too.

Renaming is good and all, but as far as I can tell, it will never work with the 
system spool. It's not just that you can't create a temporary file in the 
directory, you can't rename files into it either. If I create an empty file 
somewhere and try to rename it to overwrite my mailbox, I get a permission 
denied. Sad. :(

So I think you have to bite the bullet and write directly to the file. Either 
that or define that the module can't be used to work with system spool 
mailboxes, at least on Debian. But that would be even more sad.

--
nosy: +olau

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



[issue10596] modulo operator bug

2010-12-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Did you look at the second footnote on that page?

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

orsenthil: Hi, i don't quite understand why iter() needs to be called 
explicitly on data? As I understand it, if data is an iterable then you can use 
a for loop on it directly.

--

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



[issue10594] Typo in PyList_New doc.

2010-12-01 Thread Georg Brandl

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

Thanks, fixed in r86914.

--
nosy: +georg.brandl
resolution: accepted - fixed
status: open - closed

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

attaching new patch. this implements the memoryview solution suggested by 
pitrou. but it does contain this thing:

if not request.has_header('Content-length'):
if (not hasattr(data, '__read__') and 
isinstance(data, collections.Iterable)):
print(data,is an iterable)
try:
m = memoryview(data)
print(m.itemsize * len(m))
request.add_unredirected_header(
'Content-length', '%d' % (len(m) * m.itemsize))
except TypeError:
try:
request.add_unredirected_header(
'Content-length', '%d' % len(data))
except TypeError:
raise ValueError(
No Content-Length specified for iterable body)

why is it so nested? because data can support 3 different interfaces:

1) Buffer interface, in that case use memoryview to count bytes
2) Can call len but not buffer: assume len == #bytes
3) Iterable but cannot call len or memoryview: raise ValueError

I hope there is a simpler way...

--
Added file: http://bugs.python.org/file19891/issue_3243_py3k_5.patch

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

attaching new patch. this implements the memoryview solution suggested by 
pitrou. but it does contain this thing:

if not request.has_header('Content-length'):
if (not hasattr(data, '__read__') and 
isinstance(data, collections.Iterable)):
print(data,is an iterable)
try:
m = memoryview(data)
print(m.itemsize * len(m))
request.add_unredirected_header(
'Content-length', '%d' % (len(m) * m.itemsize))
except TypeError:
try:
request.add_unredirected_header(
'Content-length', '%d' % len(data))
except TypeError:
raise ValueError(
No Content-Length specified for iterable body)

why is it so nested? because data can support 3 different interfaces:

1) Buffer interface, in that case use memoryview to count bytes
2) Can call len but not buffer: assume len == #bytes
3) Iterable but cannot call len or memoryview: raise ValueError

I hope there is a simpler way...

--
Added file: http://bugs.python.org/file19892/issue_3243_py3k_5.patch

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Changes by Xuanji Li xua...@gmail.com:


Removed file: http://bugs.python.org/file19892/issue_3243_py3k_5.patch

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



[issue10597] Py_SetPythonHome document shows same url twice.

2010-12-01 Thread INADA Naoki

New submission from INADA Naoki songofaca...@gmail.com:

http://docs.python.org/c-api/init.html#Py_SetPythonHome
 The libraries are searched in home/lib/pythonversion and 
 home/lib/pythonversion.

Is the second {home}/lib/python{version} wrong?

--
assignee: d...@python
components: Documentation
messages: 123000
nosy: d...@python, naoki
priority: normal
severity: normal
status: open
title: Py_SetPythonHome document shows same url twice.
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue8743] set() operators don't work with collections.Set instances

2010-12-01 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

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



[issue10589] I/O ABC docs should specify which methods have implementations

2010-12-01 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Antoine Pitrou

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

 if not request.has_header('Content-length'):
 if (not hasattr(data, '__read__') and 

What is __read__ supposed to be?

 2) Can call len but not buffer: assume len == #bytes

Why do you need it at all?

--

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



[issue887237] Machine integers

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

As far as I understand, the main concern about issue887237.diff was code 
duplication.  There are two ways to fight it: C preprocessor tricks as in 
issue887237-macro.diff and code generation as done in numpy.  With improved 
macro support in many compilers and debuggers, preprocessor approach may be 
preferable.  However I cannot move this issue forward until those who objected 
to code duplication review the latest patch.  Unassigning.

--
assignee: belopolsky - 
nosy:  -BreamoreBoy

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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
resolution:  - postponed
versions: +Python 3.3 -Python 3.2

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



[issue9268] Document annotation option to pickletools.dis

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
resolution: fixed - 
stage: committed/rejected - needs patch
title: Add annotation option to pickletools.dis - Document annotation option 
to pickletools.dis

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



[issue9528] Add pure Python implementation of time module to CPython

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

BDFL and python-dev were opposed to this idea.

--
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

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



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Travis, feel free to close this without further action or use the information 
here to open a numpy issue.

--
assignee: belopolsky - teoliphant
status: open - pending

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



[issue8902] add datetime.time.now() for consistency

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
resolution:  - postponed
versions: +Python 3.3 -Python 3.2

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



[issue766910] fix one or two bugs in trace.py

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Removed file: http://bugs.python.org/file18959/unnamed

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



[issue766910] fix one or two bugs in trace.py

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Removed file: http://bugs.python.org/file18960/unnamed

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



[issue766910] fix one or two bugs in trace.py

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Eli,

Would you like to review this patch?

--
nosy: +eli.bendersky -BreamoreBoy

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



[issue9527] Add aware local time support to datetime module

2010-12-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

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



[issue7662] time.utcoffset()

2010-12-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo
versions: +Python 3.3 -Python 2.7, Python 3.2

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



[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I simplified the partial_repr() code in issue4113b.diff and committed as r86916.

I wonder, however, if for the common case of func being a named function, 
displaying func.__name__ or func.__module__ + '.' + func.__name__ in 
repr(partial) may be more apropriate than repr(f).

For example, 

functools.partial(f, 1, 2, 3, a=5, b={}, c='7')

instead of

functools.partial(function f at 0x100592d98, 1, 2, 3, a=5, b={}, c='7')

--
resolution:  - accepted
stage: needs patch - committed/rejected
status: open - pending

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



[issue10598] curses fails to import on Solaris

2010-12-01 Thread River Tarnell

New submission from River Tarnell ri...@tamara.tcx.org.uk:

On Solaris 10 using system libcurses, curses fails to import:

hemlock% python3.1
Python 3.1.3 (r313:86834, Dec  1 2010, 19:51:26) 
[GCC 4.5.1] on sunos5
Type help, copyright, credits or license for more information.
 import curses
Traceback (most recent call last):
  File /opt/ts/python/3.1/lib/python3.1/curses/__init__.py, line 57, in 
module
has_key
NameError: name 'has_key' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /opt/ts/python/3.1/lib/python3.1/curses/__init__.py, line 59, in 
module
from has_key import has_key
ImportError: No module named has_key


--
components: Extension Modules
messages: 123007
nosy: rtarnell
priority: normal
severity: normal
status: open
title: curses fails to import on Solaris
versions: Python 3.1

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



[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Terry J. Reedy

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

I would prefer the module.name without the repr decoration.

--
status: pending - open

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



[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I think the main purpose of repr is debugging, so I’d favor the unambiguous 
form (with the id) to the nice-looking one (module.name).

--

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



[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Let me close this issue before any serious bikeshedding begins.  We can always 
reconsider when users complain that eval(repr(x)) does not work for their 
partial objects.

--
status: open - closed

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



[issue1598083] Top-level exception handler writes to stdout unsafely

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I don't see anything easy in this issue.  Error handling in exception or 
signal handlers is quite tricky.

I don't see this as a high priority either, but will leave this for others to 
decide.

--
keywords:  -easy
nosy: +belopolsky

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Boštjan Mejak

Changes by Boštjan Mejak bostjan.me...@gmail.com:


Removed file: http://bugs.python.org/file19306/unnamed

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Boštjan Mejak

Changes by Boštjan Mejak bostjan.me...@gmail.com:


Removed file: http://bugs.python.org/file19316/unnamed

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Boštjan Mejak

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

 calendar.LocaleTextCalendar(locale='fr_FR').formatmonthname(2010,10,10)
is not valid because 'fr_FR' is not a valid value for the 'locale' argument

What is valid is this:
 calendar.LocaleTextCalendar(locale='French').formatmonthname(2010,10,10)

--

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Boštjan,

Please don't add comments to closed issues.  If you believe there is a 
remaining issue, please file a new report.  Issue numbers are in good supply!

This issue was fixed in r85728.  It is best when this information is the last 
message on a closed issue.

--

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Boštjan Mejak

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

Yes, I know this issue is closed but I wonder how could your Python
interpreter not error on
 calendar.LocaleTextCalendar(locale='fr_FR').formatmonthname(2010,10,10)

Please retry executing the above line of code in Python 2.7.1 interpreter
and tell me if you get an error. I get this:
 import calendar
 calendar.LocaleTextCalendar(locale='fr_FR').formatmonthname(2010,10,10)
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python27\lib\calendar.py, line 522, in formatmonthname
with TimeEncoding(self.locale) as encoding:
  File C:\Python27\lib\calendar.py, line 490, in __enter__
_locale.setlocale(_locale.LC_TIME, self.locale)
  File C:\Python27\lib\locale.py, line 531, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10092
___Yes, I know this issue is closed but I wonder how could your Python interpreter 
not error ondivspan class=Apple-style-span style=font-family: arial, 
sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); 
gt;gt;gt; 
calendar.LocaleTextCalendar(locale=#39;fr_FR#39;).formatmonthname(2010,10,10)/span/div
divspan class=Apple-style-span style=font-family: arial, sans-serif; 
font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); 
br/span/divdivspan class=Apple-style-span style=font-family: 
arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 
0, 80); Please retry executing the above line of code in Python 2.7.1 
interpreter and tell me if you get an error. I get this:/span/div
divspan class=Apple-style-span style=font-family: arial, sans-serif; 
font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); 
divgt;gt;gt; import calendar/divdivgt;gt;gt; 
calendar.LocaleTextCalendar(locale=#39;fr_FR#39;).formatmonthname(2010,10,10)/div
divTraceback (most recent call last):/divdiv  File 
quot;lt;stdingt;quot;, line 1, in lt;modulegt;/divdiv  File 
quot;C:\Python27\lib\calendar.pyquot;, line 522, in 
formatmonthname/divdiv    with TimeEncoding(self.locale) as 
encoding:/div
div  File quot;C:\Python27\lib\calendar.pyquot;, line 490, in 
__enter__/divdiv    _locale.setlocale(_locale.LC_TIME, 
self.locale)/divdiv  File quot;C:\Python27\lib\locale.pyquot;, line 
531, in setlocale/div
div    return _setlocale(category, locale)/divdivlocale.Error: 
unsupported locale setting/div/span/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10599] sgmllib.parse_endtag() is not respecting quoted text

2010-12-01 Thread Michael Brooks

New submission from Michael Brooks firealwayswo...@gmail.com:

In the attached example is a very simple usage of sgmllib that is trying to 
parse:
input value=a href=http://buglink/a

The bug is that sgmllib is parsing this href.  Browsers on the other hand see 
this as the input's value.  

Also keep in mind that escaping of quote marks in HTML is not like python.  \ 
is not a character literal   thus input value=\a 
href=http://buglink/a is still quoted text and the href should not be 
parsed. 

Thank you

--
components: None
files: sgmllib_bug.py
messages: 123016
nosy: Michael.Brooks
priority: normal
severity: normal
status: open
title: sgmllib.parse_endtag() is not respecting quoted text
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file19895/sgmllib_bug.py

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy:  -belopolsky

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



[issue10599] sgmllib.parse_endtag() is not respecting quoted text

2010-12-01 Thread Michael Brooks

Michael Brooks firealwayswo...@gmail.com added the comment:

Oops, I had a misnomer in my bug report. 
input value=\a href=http://buglink/a is not escaped and there for the 
href should be parsed in this condition but not parsed in the attached 
sgmllib_bug.py.

--

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread Stephen Hansen

Stephen Hansen me+pyt...@ixokai.io added the comment:

On windows, France may work and fr_FR may not; yet on OSX its exactly the 
opposite. Its not consistant across platforms.

--

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



[issue10092] calendar does not restore locale properly

2010-12-01 Thread R. David Murray

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

Boštjan, please see issue 10466 for further information about your question on 
fr_FR vs French.  Windows, as usual, does not follow the standards.

--

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



[issue9915] speeding up sorting with a key

2010-12-01 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Thanks.  This nice, clean diff is much more reviewable and it looks like what I 
expected.   

The use of  Py_LOCAL_INLINE is new to me since we usually use #define instead, 
but this has a cleaner look to it.  I am unclear on whether all the our target 
compilers support an inline keyword.   If you're sure it works everywhere, 
that's great.  If not, consider going back to ugly defines -- those reliably 
work everywhere.

Also note that this patch puts a lot of faith in branch prediction.  If some 
target processor doesn't support it, or has limited ability to remember 
predictions, or mispredicts, then the code will be slower.

That being said, I'm happy with the patch.   You have a +1 from me.

--

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



[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton

New submission from Campbell Barton ideasma...@gmail.com:

Attached is a script which works in linux but not windows XP 32bit with Python 
3.1.3.

The problem is that the path can be written to when specified as bytes but when 
escaped it fails.

--
components: IO
files: utf8_surrogateescape.py
messages: 123022
nosy: ideasman42
priority: normal
severity: normal
status: open
title: surrogateescape'd paths not readable on Windows XP.
versions: Python 3.1
Added file: http://bugs.python.org/file19896/utf8_surrogateescape.py

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



[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton

Campbell Barton ideasma...@gmail.com added the comment:

note, this bug was reported to me by a user running windows 7, 64bits.

--

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



[issue6135] subprocess seems to use local 8-bit encoding and gives no choice

2010-12-01 Thread STINNER Victor

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

 ... it always seems to use the local 8-bit encoding

The locale encoding is not necessary a 8-bit encoding, it can by a multibyte 
like... UTF-8 :-)

--

subprocess.patch: You should maybe use io.open(process.stdout.fileno(), 
encoding=..., errors=...) instead of codecs.getreader/getwriter. The code will 
be closer to Python 3. I think that the io module has a better support of 
unicode than codec reader/writer objects and a nicer API. See:
http://bugs.python.org/issue8796#msg106339

--

 ... allowing [encoding and errors] to accept either a single string
 (as now), or a dict with keys 'stdin', 'stdout', 'stderr'

I like this idea. But what about other TextIOWrapper (or other file classes) 
options: buffer size, newline, line_buffering, etc.?

Why not using a dict for existing stdin, stdout and stderr arguments? Dummy 
example:

process = Popen(
   command,
   stdin={'file': PIPE, 'encoding': 'iso-8859-1', 'newline': False},
   stdout={'file': PIPE', 'encoding': 'utf-8', 'buffering': 0, 
'line_buffering': False},
   ...)

If stdin, stdout or stderr is a dict: the default value of its 'file' key can 
be set to PIPE. I don't think that it's possible to choose the encoding, buffer 
size, or anything else if stdin, stdout or stderr is not a pipe.

With this solution, you cannot specify the encoding for stdin, stdout and 
stderr at once. You have at least to repeat the encoding for stdin and stdout 
(and use stderr=STDOUT).

--

I still hesitate to accept this feature request. Is it really needed to add 
extra arguments for TextIOWrapper? Can't the developer create its own 
TextIOWrapper object with all interesting options?

In Python 3, be able to specify stdout encoding is an interesting feature. 
Control the buffers size is also an interesting option.

My problem is maybe the usage of a dict to specify various options. I'm not 
sure that it is extensible to support future needs.

--

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



[issue9915] speeding up sorting with a key

2010-12-01 Thread Daniel Stutzbach

Daniel Stutzbach stutzb...@google.com added the comment:

 The use of  Py_LOCAL_INLINE is new to me since we usually use #define
 instead, but this has a cleaner look to it.  I am unclear on whether
 all the our target compilers support an inline keyword.   If you're
 sure it works everywhere, that's great.

I fixed ./configure to properly set up Py_LOCAL_INLINE in Issue5553. :-)

It will expand to static inline under both MSVC and gcc.  On older compilers, 
it may expand to static __inline__, static __inline, or whatever else is 
needed to get the job done.  

As a last resort, it will expand to simply static, but I don't know of any 
32-bit (or 64-bit) compilers where that would actually happen.

 Also note that this patch puts a lot of faith in branch prediction.
 If some target processor doesn't support it, or has limited ability
 to remember predictions, or mispredicts, then the code will be slower.

I think even a limited amount of memory dedicated to branch prediction should 
be sufficient.  There are two cases:

1) Sorting a simple type, like an int: the comparison is lightweight, and the 
CPU should have plenty of memory to remember which branch to take in the 
sorting code.

2) Sorting a complex type (i.e., calling a __lt__ method written in Python): 
the processor might not be able to remember which branch to take, but the 
performance impact will be small (as a percentage) since most of the CPU is 
being consumed by the comparisons.

Thanks for taking the time to review this.

--

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



[issue4335] inspect.getsourcelines ignores last line in module

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

3.2 and 2.7 don't exhibit this issue.  I added a test in r86922.

--
nosy:  -BreamoreBoy
resolution:  - out of date
stage: patch review - committed/rejected
status: open - closed

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



[issue9915] speeding up sorting with a key

2010-12-01 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Just for the record, I wanted to highlight how little room there is for 
optimization here.  The sort wrapper is *very* thin:

sortwrapper_richcompare(sortwrapperobject *a, sortwrapperobject *b, int op)
{
if (!PyObject_TypeCheck(b, PySortWrapper_Type)) {
PyErr_SetString(PyExc_TypeError,
expected a sortwrapperobject);
return NULL;
}
return PyObject_RichCompare(a-key, b-key, op);
}

When a key function is defined, this is all you can possibly shave off the time 
for a comparison.  When a key function is not defined, there was no overhead at 
all.

With the patch, we're relying on branch prediction to minimize the cost to the 
regular case and adding a little indirection in the form of lo variables 
becoming lo.keys, etc.  And the number of memmoves is doubled.

To me, the main advantage of the patch is that it saves a little memory for 
each key:

   typedef struct {
   PyObject_HEAD
   PyObject *key;
   PyObject *value;
   } sortwrapperobject;

Just wanted to post this so there weren't any illusions about the patch being a 
big win.

--

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



[issue9915] speeding up sorting with a key

2010-12-01 Thread Daniel Stutzbach

Daniel Stutzbach stutzb...@google.com added the comment:

 Just wanted to post this so there weren't any illusions about the
 patch being a big win.

 When a key function is defined, this is all you can possibly shave
 off the time for a comparison.

I don't want to argue whether the patch is a big win or not (I recognize that 
it is a tradeoff), but when using a key it does shave off more than the call to 
sortwrapper_richcompare.

Stack with sortwrapper:

long_richcompare
do_richcompare
PyObject_RichCompare
sortwrapper_richcompare
do_richcompare
PyObject_RichCompare
PyObject_RichCompareBool
count_run
list_sort

Stack without:

long_richcompare
do_richcompare
PyObject_RichCompare
PyObject_RichCompareBool
count_run
list_sort

--

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



[issue10580] Installer sentence in bold

2010-12-01 Thread R. David Murray

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

I think Boštjan is correct that that sentence is not parallel to the others.  
If I understand correctly, at that point the installation is complete, and it 
is the final 'exit or back' dialog.  So I think the title should be Complete 
Python x.x.x Installation.  Note, however, that I'm just looking at the code, 
not running the install.  Brian has more experience with the typical installer 
dialogs, so he'll have a better opinion, I think.

--
nosy: +r.david.murray

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



[issue2380] Raise a Py3K warning for catching nested tuples with non-BaseException exceptions

2010-12-01 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

issue2380.diff does not apply anymore.

--
assignee:  - belopolsky
stage:  - needs patch

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



[issue10601] sys.displayhook: use backslashreplace error handler if repr(value) is not encodable to sys.stdout

2010-12-01 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

On Windows, the Python interpreter fails to display a result if stdout encoding 
is unable to encode it. This problem exists since Python 3.0. Eg. see issue 
#1602.

This problem is not specific to Windows. Even if stdout encoding is UTF-8 
(which is the default encoding of Mac OS X and most Linux distributions), it 
fails on surrogate characters (because the UTF-8 encoder refuses surrogate 
characters in Python 3). Eg. see issue #5110.

Even if a Python (core? :-)) developer can see this behaviour as expected, it 
looks like different users (including me) don't like it and would prefer to see 
the result instead of an unicode exception. The problem is that we don't know 
directly (except for simple commands) if the error comes from the command or if 
printing the result failed.

This issue is specific to sys.displayhook, the callback used by the Python 
interpreter to display the result of a command. It doesn't concern print() or 
sys.stdout.write().

--

The best solution would be to check if the terminal is able to render a 
character, but this is not possible for technical reasons. The best that we can 
do is to catch the UnicodeEncodeError and use another error handler (than 
sys.stdout.errors) which doesn't fail. 'backslashreplace' is a good candidate.

Ezio Melotti implemented this solution and attached a patch to issue #9198.

I wrote a new version of his patch, changes:

 - Create a subfunction (for better readability)
 - Clear the UnicodeEncodeError before calling sys_displayhook_unencodable() 
(anyway, the exception will be lost on next error, eg. if 
PyObject_GetAttrString() fails)
 - Clear the (AttributeError) exception if PyObject_GetAttrString(outf, 
buffer) fails
 - Add an unit test: test ASCII, ISO-8859-1 and UTF-8 with non-ASCII, surrogate 
and non-BMP (printable or not) characters
 - Complete and update sys.displayhook documentation
 - Fix a refleak if stdout_encoding_str == NULL
 - Use PyObject_CallMethod() instead of PyTuple_Pack() + PyEval_CallObject() 
for a shorter (and more readable) code

--

I don't know how to test the case: sys.stdout.write(repr(value)) fails and 
sys.stdout has no buffer attribute. A mockup should maybe be used in the unit 
test?

--
components: Unicode
files: displayhook_unencodable.patch
keywords: patch
messages: 123031
nosy: belopolsky, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: sys.displayhook: use backslashreplace error handler if repr(value) is 
not encodable to sys.stdout
versions: Python 3.2
Added file: http://bugs.python.org/file19897/displayhook_unencodable.patch

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



[issue10601] sys.displayhook: use backslashreplace error handler if repr(value) is not encodable to sys.stdout

2010-12-01 Thread STINNER Victor

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

This issue is opposed to the PEP 3128:

 Default error-handler of sys.stdout should be 'backslashreplace'.

Stuff written to stdout might be consumed by another program that might 
misinterpret the escapes. For interactive session, it is possible to make 
'backslashreplace' error-handler to default, but may add confusion of the kind 
it works in interactive mode but not when redirecting to a file. 

But if you read #1602, #5110 and #9198, you will see that not everybody agrees 
with the PEP.

--

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



[issue9198] Should repr() print unicode characters outside the BMP?

2010-12-01 Thread STINNER Victor

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

I created a new issue for Ezio's proposition to patch sys.displayhook: issue 
#10601.

To answer the initial question, Should repr() print unicode characters outside 
the BMP?, Marc-Andre, Ezio and me agree that we should keep the current 
behavior for non-BMP chars (i.e. print them normally) and so I close this issue.

--

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



[issue10601] sys.displayhook: use backslashreplace error handler if repr(value) is not encodable to sys.stdout

2010-12-01 Thread STINNER Victor

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


--
nosy: +amaury.forgeotdarc, lemburg

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



[issue9198] Should repr() print unicode characters outside the BMP?

2010-12-01 Thread STINNER Victor

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


--
resolution:  - invalid
status: open - closed

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



[issue10601] sys.displayhook: use backslashreplace error handler if repr(value) is not encodable to sys.stdout

2010-12-01 Thread STINNER Victor

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

 This issue is opposed to the PEP 3128:

  Default error-handler of sys.stdout should be 'backslashreplace'

Oops sorry, no it is not opposed to the PEP (this issue doesn't propose to 
change the default error handler of sys.stdout).

--

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



[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread STINNER Victor

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

Use surrogateescape error handler to decode a Windows path is not a good idea. 
On Windows, the problem is not to decode a path (ANSI = wide char), but to 
encode a path (wide char = ANSI) to use a function expecting bytes path 
encoded to the ANSI code page. surrogateescape is only useful on the *decode* 
operation, to store undecodable bytes in special characters.

Why do you decode a Windows path using UTF-8? UTF-8 is not used, by default, as 
an ANSI code page. But first, what do you manipulate bytes path on Windows?

If you would like a portable program supporting UNIX/BSD (bytes) and Windows 
(unicode) paths with a single type, you should use str instead of bytes, 
because Unicode (with surrogateescape) is a superset of bytes.

Python 3.2 has os.fsencode() and os.fsdecode() functions to do that easily (to 
decode/encode UNIX/BSD paths).

--
nosy: +haypo

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



[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function

2010-12-01 Thread STINNER Victor

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

See also #10601: sys.displayhook: use backslashreplace error handler if 
repr(value) is not encodable to sys.stdout.

--

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



[issue8863] Display Python backtrace on SIGSEGV, SIGFPE and fatal error

2010-12-01 Thread STINNER Victor

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

 If it's an env variable, though, it should be clear that it's
 CPython-specific, so I'm not sure how to call it.

Why do you think that only this variable is CPython-specific? CPython has an 
option called PYTHONDONTWRITEBYTECODE, but PyPy doesn't create .pyc files (and 
I suppose that nor IronPython nor Jython create such files).

I propose to call the variable PYTHONNOFAULTHANDLER. I removed SEG because it 
does catch other faults than segmentation faults.

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Wed, Dec 01, 2010 at 10:06:25AM +, Antoine Pitrou wrote:
 +try:
 +   self.sock.sendall(data)
 
 Indentation problem here.

I could notice it now. Shall fix it.

 
 +if isinstance(data,str):
 +content_length = len(data)
 
 I'm not sure I understand. What does sending an unicode string mean?

That's my mistake with understanding, I just realized (again) that
socket.send, socket.sendall does only bytes. And we don't encode the
unicode code string to send as bytes too.

 +def iterable_body():
 +yield one
 +yield two
 +yield three
 
 Iterables of strings? this doesn't seem supported in the patch.

It should be:

+yield bone
+yield btwo
+yield bthree

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Wed, Dec 01, 2010 at 02:56:56PM +, Xuanji Li wrote:
 orsenthil: Hi, i don't quite understand why iter() needs to be
 called explicitly on data? As I understand it, if data is an
 iterable then you can use a for loop on it directly.
 

The reasoning I followed was, data is an Iterable (a collection) and
you get an Iterator by passing via iter(). And you send the items by
looping over the iterator.

Honestly, I am not sure if iter is needed here too. I thought it was
not needed too, when you determine it is an Iterable and iterate over
it using the for loop. But I kept the iter() method just to create an
instance and send it.

Antoine, which would be the correct/ better?

--

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



Re: [issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran
On Wed, Dec 01, 2010 at 05:08:26PM +, Antoine Pitrou wrote:
 Antoine Pitrou pit...@free.fr added the comment:
  if not request.has_header('Content-length'):
  if (not hasattr(data, '__read__') and 
 
 What is __read__ supposed to be?

I don't think is required. The previous 2.x version patch was doing
this just to ensure that it is not file object and then it is a
sequence. (I could not understand why)

Now, when you determine that the sequence can be bytes, bytearray or
array.array then testing for memory view is enough. File objects
without Content-Length would raise an Exception too.

  2) Can call len but not buffer: assume len == #bytes
 
 Why do you need it at all?
 
Not required. For the same reason as above.
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9611] FileIO not 64-bit safe under Windows

2010-12-01 Thread STINNER Victor

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

I agree that clamping is a nice solution, and attached patch implements it.

About the question of the loop: FileIO.readall() uses while(1) without checking 
for signals. It looks like new_buffersize() maximum size is not BIGCHUNK but 
(BIGCHUNK-1)*2:

/* Keep doubling until we reach BIGCHUNK;
   then keep adding BIGCHUNK. */
if (currentsize = BIGCHUNK)
return currentsize + currentsize;
else
return currentsize + BIGCHUNK;

Is it a bug? But (BIGCHUNK-1)*2 is always smaller than INT_MAX. So readall() 
isn't affected by this bug. Should it be patched?

posix.read() doesn't have the bug because it uses an int for the size.

--
keywords: +patch
Added file: http://bugs.python.org/file19898/read_write_32bits.patch

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



[issue9611] FileIO not 64-bit safe under Windows

2010-12-01 Thread STINNER Victor

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

(oops, the patch contained unrelated changes: remove trailing spaces)

--
Added file: http://bugs.python.org/file19899/read_write_32bits.patch

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



[issue9611] FileIO not 64-bit safe under Windows

2010-12-01 Thread STINNER Victor

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


Removed file: http://bugs.python.org/file19898/read_write_32bits.patch

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Thu, Dec 02, 2010 at 02:19:10AM +, Senthil Kumaran wrote:
 On Wed, Dec 01, 2010 at 10:06:25AM +, Antoine Pitrou wrote:
  +try:
  +   self.sock.sendall(data)
  
  Indentation problem here.
 
 I could notice it now. Shall fix it.

Sorry, there was not any, if you viewed the patch online, it looked
as if there was, but not really. (I was surprised as how it could be
and not be caught by tests in the first place).

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

  2) Can call len but not buffer: assume len == #bytes

 Why do you need it at all?

Hmm, I'm looking at the the tests in urllib2 that fail if we omit this... in 
test_urllib2 there are tests that do this:

req = Request(http://example.com/;, )

and they expect Content-Length to be set to 0...

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Updated patch after correcting the mistake (bytes vs str) in the previous one.

--
Added file: http://bugs.python.org/file19900/Issue3243-6.patch

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



Re: [issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran
On Thu, Dec 02, 2010 at 03:08:55AM +, Xuanji Li wrote:
 
 req = Request(http://example.com/;, )

That should be:

 req = Request(http://example.com/;, b)

I updated some of those in the latest updated patch.

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

And my version too...

--
Added file: http://bugs.python.org/file19901/issue_3243_py3k_6.patch

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



[issue10464] netrc module not parsing passwords containing #s.

2010-12-01 Thread R. David Murray

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

Committed to py3k in r86925, 3.1 in r86926, and 2.7 in r86927.

Thanks for the patch, Xuanji.

--
nosy: +r.david.murray
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Thu, Dec 02, 2010 at 03:16:53AM +, Xuanji Li wrote:
 And my version too...
 

+if hasattr(data, '__len__') and not len(data):
+request.add_unredirected_header('Content-length', '0')

This is very special case. It should not be so. There was wrong
examples in the test_urllib2 which I just corrected.

Expect for the difference in (it = iter(data) - Which I am seeking
some advice too). Rest of the things in both patches are same.

Thank you.

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Thu, Dec 02, 2010 at 03:20:05AM +, Xuanji Li wrote:
 Actually I don't think you can go around changing test_urllib2.py,
 they are after all regression tests... and surely some users will
 send  as data.
 

Think about it this way. In py3k, socket.send can handle only bytes,
not string. So sending  as data to the socket.send is wrong.

--

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

thought of a better way, we can check if data is true; this will cover  and 
b. this is in issue_3243_py3k_7.patch

--
Added file: http://bugs.python.org/file19902/issue_3243_py3k_7.patch

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



[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Glaring at my mistakes.

 There was wrong examples in the test_urllib2 which I just corrected.

There were..

 Expect for the difference in (it = iter(data) - Which I am seeking

Except for ...

--

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



[issue9573] importing a module that executes fork() raises RuntimeError

2010-12-01 Thread Nick Coghlan

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

Fixed for 3.2 in r86928.

The fix has not been backported to 3.1, since it depends on the fix for issue 
7242 (r78527) which was itself never backported to 3.1 after being forward 
ported to the py3k branch as part of a bulk merge (r83318)

Backporting to 2.7 would also be a manual process (although much easier, since 
issue 7242 is already fixed in that branch)

Given the obscurity of the error, I'm going to close this as fixed without 
backporting it. Anyone that wants it fixed in the 2.7 and 3.1 maintenance 
branches is free to develop and post the requisite patches :)

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

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



[issue10602] csv test_register_kwargs has invalid message parameters

2010-12-01 Thread Alex Earl

New submission from Alex Earl slide.o@gmail.com:

in test_csv.py, the follow test is declared.

def test_register_kwargs(self):
name = 'fedcba'
csv.register_dialect(name, delimiter=';')
try:
self.assertTrue(csv.get_dialect(name).delimiter, '\t')
self.assertTrue(list(csv.reader('X;Y;Z', name)), ['X', 'Y', 'Z'])
finally:
csv.unregister_dialect(name)

The assertTrue method take an expression to test for true and a message to 
display if that expression is false. If the test's goal is to test that 
delimiter is set so it's not None, then it will output a tab if the test fails. 
On the second line, the list would be displayed if the list returned from the 
reader is an empty list. The result of the reader operation is not the list on 
the right side anyway.


 list(csv.reader('X;Y;Z', name))
[['X'], ['', ''], ['Y'], ['', ''], ['Z']]

--
messages: 123055
nosy: Alex.Earl
priority: normal
severity: normal
status: open
title: csv test_register_kwargs has invalid message parameters
type: behavior
versions: Python 2.6, Python 2.7

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



[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton

Campbell Barton ideasma...@gmail.com added the comment:

This bug is with blender3d, were the paths are stored internally in C as simple 
char arrays - bytes.

We could expose all path names as bytes too through our C/python API, this 
would at least be a 1:1 mapping, however Id prefer using strings if possible.

Since blender projects need to be portable - compress entire projects and run 
on different systems, we cant ensure the native fs encoding is used.

So surrogateescape seems to work very well, except for this one case I've run 
into, windows only.

--

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



[issue10600] surrogateescape'd paths not readable on Windows XP.

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

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

This is not a bug. You can't expect that using an arbitrary codec (such as 
UTF-8) with the surrogateescape code, and expect to be able that opening the 
file will be able to produce the correct filename. This won't work on Unix, in 
the general case, either. The surrogateescape code will work correctly in this 
setup only when used with the filesystem encoding.

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

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



[issue10482] subprocess and deadlock avoidance

2010-12-01 Thread Glenn Linderman

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

Here's an updated _writerthread idea that handles more cases:

def _writerthread(self, fhr, fhw, length=None):
if length is None:
flag = True
while flag:
buf = fhr.read( 512 )
fhw.write( buf )
if len( buf ) == 0:
flag = False
else:
while length  0:
buf = fhr.read( min( 512, length ))
fhw.write( buf )
length -= len( buf )
# throw away additional data [see bug #427345]
while select.select([fhr._sock], [], [], 0)[0]:
if not fhr._sock.recv(1):
break
fhw.close()

--

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



[issue10482] subprocess and deadlock avoidance

2010-12-01 Thread Glenn Linderman

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

Sorry, left some extraneous code in the last message, here is the right code:

def _writerthread(self, fhr, fhw, length=None):
if length is None:
flag = True
while flag:
buf = fhr.read( 512 )
fhw.write( buf )
if len( buf ) == 0:
flag = False
else:
while length  0:
buf = fhr.read( min( 512, length ))
fhw.write( buf )
length -= len( buf )
fhw.close()

--

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



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-12-01 Thread Terry J. Reedy

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

I removed trailing '\' and whitespace, refreshed against current repository, 
removing conflicts, and committed. r86930

--
assignee: georg.brandl - terry.reedy
resolution: accepted - fixed
status: open - closed

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



[issue10047] python-2.6.6 coredump running newspipe

2010-12-01 Thread Thomas Klausner

Thomas Klausner t...@giga.or.at added the comment:

I've updated the operating system to a 5.99.39, and the problem disappeared. 
Strange. Thanks for the suggestions.

--
status: open - closed

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