[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Unicode
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue4966] Improving Lib Doc Sequence Types Section

2012-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

Just noting that this has slipped a bit down my Python to-do list (there are 
other things I want to focus on before the first 3.3 alpha).

I'll get back to it at some point, but if someone want to take my branch and 
run with it in the meantime, please feel free.

--
assignee: ncoghlan -> 

___
Python tracker 

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



[issue12627] Implement PEP 394: The "python" Command on Unix-Like Systems

2012-02-12 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue13998] Lookbehind assertions go behind the start position for the match

2012-02-12 Thread Devin Jeanpierre

New submission from Devin Jeanpierre :

compiled regex objects' match method offers an optional "pos" parameter 
described to be roughly equivalent to slicing except for how it treats the "^" 
operation. See http://docs.python.org/library/re.html#re.RegexObject.search

However, the behavior of lookbehind assertions also differs:

>>> re.compile("(?<=a)b").match("ab", 1)
<_sre.SRE_Match object at 0x...>
>>> re.compile("(?<=a)b").match("ab"[1:])
>>>

This alone might be a documentation bug, but the behavior is also inconsistent 
with the behavior of lookahead assertions, which do *not* look past the endpos:

>>> re.compile("a(?=b)").match("ab", 0, 1)
>>> re.compile("a(?=b)").match("ab")
<_sre.SRE_Match object at 0x...>
>>>

--
components: Regular Expressions
messages: 153188
nosy: Devin Jeanpierre, ezio.melotti
priority: normal
severity: normal
status: open
title: Lookbehind assertions go behind the start position for the match
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

> A common programming task is "I want to process this text file,
> I know it's in an ASCII compatible encoding, I don't know which
> one specifically, but I'm only manipulating the ASCII parts
> so it doesn't matter".

Can you give more detail about this use case? Why would you ignore non-ASCII 
characters?

--
nosy: +haypo

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

Usually because the file may contain certain ASCII markers (or you're inserting 
such markers), but beyond that, you only care that it's in a consistent ASCII 
compatible encoding.

Parsing log files from sources that aren't set up correctly often falls into 
this category - you know the markers are ASCII, but the actual message contents 
may not be properly encoded. (e.g. they use a locale dependent encoding, but 
not all the log files are from the same machine and not all machines have their 
locale set up properly). (although errors="replace" can be a better option for 
such "read-only" use cases).

A use case where you really do need "errors='surrogateescape'" is when you're 
reformatting a log file and you want to preserve the encoding for the messages 
while manipulating the pure ASCII timestamps and message headers. In that case, 
surrogateescape is the right answer, because you can manipulate the ASCII bits 
freely while preserving the log message contents when you write the reformatted 
files back out. The reformatting script offers an API that says "put any ASCII 
compatible encoding in, and you'll get that same encoding back out".

You'll get weird behaviour (i.e. as you do in Python 2) if the assumption of an 
ASCII compatible encoding is ever violated, but that would be equally true if 
the script tried to process things at the raw bytes level.

The assumption of an ASCII compatibile text encoding is a useful one a lot of 
the time. The problem with Python 2 is it makes that assumption implicitly, and 
makes it almost impossible to disable it. Python 3, on the other hand, assumes 
very little by default (basically what it returns from 
sys.getfilesystemencoding() and locale.getpreferredencoding()), this requiring 
that the programmer know how to state their assumptions explicitly.

--

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

Why do you use Unicode with the ugly surrogateescape error handler in
this case? Bytes are just fine for such usecase.

The surrogateescape error handler produces unusual characters in range
U+DC80-U+DCFF which cannot be printed to a console because sys.stdout
uses the strict error handler, and sys.stderr  uses the
backslashreplace error handler. If I remember correctly, only UTF-7
encoder allow lone surrogate characters.

--

___
Python tracker 

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



[issue13968] Support recursive globs

2012-02-12 Thread Yuval Greenfield

Yuval Greenfield  added the comment:

Raymond Hettinger, by simple do you mean a single argument rglob function? Or 
do you mean you prefer glob doesn't get a new function?

--

___
Python tracker 

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



[issue13953] Get rid of doctests in packaging.tests.test_version

2012-02-12 Thread Francisco Martín Brugué

Francisco Martín Brugué  added the comment:

Does a "doc test" test the output literally? (I've just always used 
unittest)

Ok, thanks

--

___
Python tracker 

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



[issue13963] dev guide has no mention of mechanics of patch review

2012-02-12 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

AFAIK, all interested parties are supposed to automatically be sent email
notifications whenever anyone posts an update on the review. However,
I've run into a bug 
that seems to be preventing this from working for me.

> * Do all patches go into this review site, or do I have to do something extra 
> to get them to land there?

It should happen automatically, but only if the patch applies cleanly to
the head of the default branch.

> * I have patches for both 2.6 and 3.1 - are they kept separate, or do they 
> affect each other's "delta from patch set"?

If the patch applies cleanly to default (unlikely), I imagine things
could get messy. Most of the time, though, they'll be ignored altogether.

--

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Nadeem Vawda

Changes by Nadeem Vawda :


--
nosy: +nadeem.vawda

___
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

2012-02-12 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Sure, I wanted to add tests as soon as I know that the flow is correct (which 
it isn't :)).

So essentially we want always

CAPABILITIES
LOGIN
CAPABILITIES

?

That's rather simple to achieve. The tests are going to be the harder part. ;)

Re the patch: I tried to generate it using SourceTree but probably did 
something wrong – will use hg next time again.

--

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-02-12 Thread Aaron Staley

Aaron Staley  added the comment:

Active extension modules are MySQL-python, numpy, and crypto.

Here is the output from the non-optimized debug build. Slightly different 
trace, but still some sort of deallocator crashing AFAIK:


#0  0x0046247c in _Py_ForgetReference (op=
, _pipe=None, eof_received=0, 
in_max_packet_size=34816, out_buffer_cv=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x593d3e0>, event=<_Event(_Verbose__verbose=False, _Event__flag=True, 
_Event__cond=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x5a333e0>) at remote 
0x593ded0>, transport=,
  _map=, _pipe=None, eof_received=0, 
in_max_packet_size=34816, out_buffer_cv=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x593d3e0>, event=<_Event(_Verbose__verbose=False, _Event__flag=True, 
_Event__cond=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x5a333e0>) at remote 
0x593ded0>, transport=,
  _map=, _pipe=None, eof_received=0, 
in_max_packet_size=34816, out_buffer_cv=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x593d3e0>, event=<_Event(_Verbose__verbose=False, _Event__flag=True, 
_Event__cond=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x5a333e0>) at remote 
0x593ded0>, transport=
 , _map=, 
_map=, data={}) at 
remote 0x5939588>) at remote 0x5912bc0>, lock=, _Thread__started=<_Event(_Verbose__verbose=False, 
_Event__flag=True, _Event__cond=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x5223300>) at remote 0x47f56f0>, _channel_counter=22, active=False, 
_preferred_compression=('none',), server_object=None, kex_engine=None, 
log_name='paramiko.transport', _x11_handler=None, remote_compression='none', 
_Thread__initiali
 zed=True, server_accepts=[], s...(truncated), throwflag=0) at 
Python/ceval.c:2497
#6  0x004d41c3 in fast_function (func=, 
pp_stack=0x7f56977ed400, n=1, na=1, nk=0) at Python/ceval.c:4099
#7  0x004d3ed3 in call_function (pp_stack=0x7f56977ed400, oparg=0) at 
Python/ceval.c:4034
#8  0x004cec2b in PyEval_EvalFrameEx (f=
Frame 0x5756c40, for file /root/python2.7-2.7.2/Lib/threading.py, line 552, 
in __bootstrap_inner (self=, _map=, 
data={}) at remote 0x5939588>) at remote 0x5912bc0>, lock=, _Thread__started=<_Event(_Verbose__verbose=False, 
_Event__flag=True, _Event__cond=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x5223300>) at remote 0x47f56f0>, _channel_counter=22, active=False, 
_preferred_compression=('none',), server_object=None, kex_engine=None, 
log_name='paramiko.transport', _x11_handler=None, remote_compression='none', 
_Thread__initialized=True
 , server_accepts=[], saved_exc...(truncated), throwflag=0) at 
Python/ceval.c:2666
#9  0x004d41c3 in fast_function (func=, 
pp_stack=0x7f56977ed760, n=1, na=1, nk=0) at Python/ceval.c:4099
#10 0x004d3ed3 in call_function (pp_stack=0x7f56977ed760, oparg=0) at 
Python/ceval.c:4034
#11 0x004cec2b in PyEval_EvalFrameEx (f=
Frame 0x53b9380, for file /root/python2.7-2.7.2/Lib/threading.py, line 525, 
in __bootstrap (self=, _map=, 
data={}) at remote 0x5939588>) at remote 0x5912bc0>, lock=, _Thread__started=<_Event(_Verbose__verbose=False, 
_Event__flag=True, _Event__cond=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condition__waiters=[], 
release=) at 
remote 0x5223300>) at remote 0x47f56f0>, _channel_counter=22, active=False, 
_preferred_compression=('none',), server_object=None, kex_engine=None, 
log_name='paramiko.transport', _x11_handler=None, remote_compression='none', 
_Thread__initialized=True, serv
 er_accepts=[], saved_exception...(truncated), throwflag=0) at 
Python/ceval.c:2666
#12 0x004d1533 in PyEval_EvalCodeEx (co=0x16cb510, globals=
{'current_thread': , '_BoundedSemaphore': 
, 'currentThread': , 
'_Timer': , '_format_exc': , 'Semaphore': , 'activeCount': 
, '_profile_hook': None, '_sleep': , '_trace_hook': None, 'ThreadError': , '_enumerate': , '_start_new_thread': 
, 'BoundedSemaphore': , '_shutdown': , '__all__': 
['activeCount', 'active_count', 'Condition', 'currentThread', 'current_thread', 
'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 
'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'], '_Event': 
, 'active_count': , 
'__package__': Non
 e, '_Condition': , 
arg=
(, 
_map=, data={}) at 
remote 0x5939588>) at remote 0x5912bc0>, lock=, _Thread__started=<_Event(_Verbose__verbose=False, 
_Event__flag=True, _Event__cond=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, _Condit

[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

Patch version 15:
 - round "correctly"
 - datetime.date.fromtimestamp() and datetime.datetime.fromtimestamp() reuses 
_PyTime_t API to support decimal.Decimal without loss of precision
 - add more tests

--
Added file: http://bugs.python.org/file24495/time_decimal-15.patch

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

If such use cases are indeed better handled as bytes, then that's what should 
be documented. However, there are some text processing assumptions that no 
longer hold when using bytes instead of strings (such as "x[0:1] == x[0]"). You 
also can't safely pass such byte sequences to various other APIs (e.g. 
urllib.parse will happily process surrogate escaped text without corrupting 
them, but will throw UnicodeDecodeError for bytes sequences that aren't pure 
7-bit ASCII).

Using surrogateescape instead means that you're only going to have problems if 
you go to encode the data to an encoding other than the source one. That's 
basically the things work in Python 2 with 8-bit strings.

--

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24495/time_decimal-15.patch

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

(Oops, I attached the wrong patch.)

--
Added file: http://bugs.python.org/file24496/time_decimal-15.patch

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24496/time_decimal-15.patch

___
Python tracker 

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



[issue13991] namespace packages depending on order

2012-02-12 Thread andrea crotti

andrea crotti  added the comment:

About the binary file, in theory I agree with you, but that archive contains 5 
or 6 subdirectories with a few almost empty files.

Of course I can write a script that recreates that situation, but does it make 
sense when I can just tar and untar it?
And what should be the security threat in a tar.gz file?

Anyway it doesn't matter and sure I will try to use plain text in the future..

About the bug, for what I can understand the bug comes from pkg_resources:
/usr/lib/python2.7/site-packages/pkg_resources.py is owned by 
python2-distribute 0.6.24-1

and/or from how the import mechanism works on namespace packages, not from 
setuptools..
Should I still move the bug report to somewhere else?

--

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

New try, set the version to 16 to avoid the confusion.

test_time is failing on Windows.

--
Added file: http://bugs.python.org/file24497/time_decimal-16.patch

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Paul Moore

Paul Moore  added the comment:

A better example in terms of "intended to be text" might be ChangeLog files. 
These are clearly text files, but of sufficiently standard format that they can 
be manipulated programmatically.

Consider a program to get a list of all authors who changed a particular file. 
Scan the file for date lines, then scan the block of text below for the 
filename you care about. Extract the author from the date line, put into a set, 
sort and print.

All of this can be done assuming the file is ASCII-compatible, but requires 
non-trivial text processing that would be a pain to do on bytes. But author 
names are quite likely to be non-ASCII, especially if it's an international 
project. And the changelog file is manually edited by people on different 
machines, so the possibility of inconsistent encodings is definitely there. (I 
have seen this happen - it's not theoretical!)

For my code, all I care about is that the names round-trip, so that I'm not 
damaging people's names any more than has already happened.

encoding="ascii",errors="surrogateescape" sounds like precisely the right 
answer here.

(If it's hard to find a good answer in Python 3, it's very easy to decide to 
use Python 2 which "just works", or even other tools like awk which also take 
Python 2's naive approach - and dismiss Python 3's Unicode model as "too hard").

My mental model here is text editors, which let you open any file, do their 
best to display as much as they can and allow you to manipulate it without 
damaging the bits you don't change. I don't see any reason why people shouldn't 
be able to write Python 3 code that way if they need to.

--
nosy: +pmoore

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Florent Xicluna

Florent Xicluna  added the comment:

There was a discussion in December which ruled out some CPython too specific 
implementation details from the documentation.
http://mail.python.org/pipermail/python-dev/2011-December/115063.html

Maybe it's better to remove these 2 lines about the "transparent optimizer". 
Then the "versionchanged" tag can be changed a little:
.. versionchanged:: 3.3
   This module will use a fast implementation whenever available.
   The module :mod:`xml.etree.cElementTree` is deprecated.

Probably we'll add few words in the Doc/whatsnew/3.3.rst too.

--

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Florent Xicluna

Florent Xicluna  added the comment:

Updated patch:
 - add 'XMLID' and 'register_namespace' to the ElementTree.__all__
 - the comment says explicitly that cElementTree is deprecated
 - exercise the deprecated module with the tests

--
Added file: 
http://bugs.python.org/file24498/issue13988_fold_cET_behind_ET_v2.diff

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 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



[issue10287] NNTP authentication should check capabilities

2012-02-12 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

I've added general tests of AUTH USER/PASS as there weren't any present yet.

As I haven't alas heard back from Easynews, I can only presume they allow 
CAPABILITIES after a login – I've added a test case that models this behavior.

Otherwise I did as it was asked: getcapabilities() is tolerant to temporary 
errors and we get them again after a login now.

(I'm also using the remote repo tool now to avoid further patch fuckups – sorry 
for the extra mails.)

--
hgrepos: +113

___
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

2012-02-12 Thread Hynek Schlawack

Changes by Hynek Schlawack :


Added file: http://bugs.python.org/file24499/0cf0b06e1d31.diff

___
Python tracker 

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



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> My mental model here is text editors, which let you open any file, do
> their best to display as much as they can and allow you to manipulate
> it without damaging the bits you don't change. I don't see any reason
> why people shouldn't be able to write Python 3 code that way if they
> need to.

Some text editors try to guess the encoding, which is different from
"display invalid characters anyway".
Other text editors like gedit pop up an error when there are invalid
bytes according to the configured encoding.

That said, people *are* able to write Python 3 code the way you said.
They simply have to use the "surrogateescape" error handler.

--

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

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

Charles-François Natali  added the comment:

> Possibly a double free?

> (gdb) p *op
> $5 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0, ob_type = 0x3c6d9f0}
>

It indeed looks like a double free (see the previous and next pointers
have already been set to NULL).

Could you check if there's not another thread active inside the
interpreter at the same time ("thread apply all bt")?

But I'm afraid it'll be hard to debug with just a core dump.
Do you have any test script that could be used to reproduce the crash?

--

___
Python tracker 

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



[issue13968] Support recursive globs

2012-02-12 Thread R. David Murray

R. David Murray  added the comment:

The last forumulation of what rglob does "apply the glob to the current 
directory and all subdirectories recursively, returning the joined list with 
filenames anchored in the current directory" is simple and intuitive enough for 
me.  (I'm not sure it can be implemented using Nick's module.)

The discussions about starting directory and the meaning of '..' and implicitly 
prepending '*' totally confused me.  If the formulation in my first paragraph 
is the intended semantics and the function actually implements those semantics 
(however it does it under the hood), then I'm fine with it.

--

___
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

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've made a couple of small comments (see "review" link next to the patch).

--

___
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

2012-02-12 Thread Hynek Schlawack

Changes by Hynek Schlawack :


Added file: http://bugs.python.org/file24500/e986dd8bb47d.diff

___
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

2012-02-12 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Thanks! I think I've addressed everything in the latest patch.

--

___
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

2012-02-12 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d789f453387d by Antoine Pitrou in branch '3.2':
Issue #10287: nntplib now queries the server's CAPABILITIES again after 
authenticating (since the result may change, according to RFC 4643).
http://hg.python.org/cpython/rev/d789f453387d

New changeset 98ad67529241 by Antoine Pitrou in branch 'default':
Issue #10287: nntplib now queries the server's CAPABILITIES again after 
authenticating (since the result may change, according to RFC 4643).
http://hg.python.org/cpython/rev/98ad67529241

--
nosy: +python-dev

___
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

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thank you :) Committed now.

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

___
Python tracker 

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



[issue10287] NNTP authentication should check capabilities

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Perhaps I closed too quickly... Julien's original message had two other 
requests:

“If "READER" is advertised, no need to send a "MODE READER" command at all...

If "MODE-READER" is advertised, then "MODE READER" (if wanted) can be sent.
Then, self.capabilities() should be sent again.  Capabilities changed!”

--

___
Python tracker 

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



[issue13198] Remove duplicate definition of write_record_file

2012-02-12 Thread Paul Moore

Paul Moore  added the comment:

Produces RECORD files with CR-CR-LF line endings (see issue13175). This breaks 
pysetup remove.

I can't tell if this patch is good otherwise - it's certainly no worse than the 
behaviour of the unpatched version, but that's not saying much :-)

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Sandro Tosi

Sandro Tosi  added the comment:

Thanks Eli for the heads-up, I had missed Antoine's comment!

Antoine, I'm probably missing something, but SimpleQueue is present in 2.7 and 
3.2 too, so why not mention it in the doc for those versions too?

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Antoine, I'm probably missing something, but SimpleQueue is present in 
> 2.7 and 3.2 too, so why not mention it in the doc for those versions too?

What I mean is that "multiprocessing.SimpleQueue" is a new API, so should be 
3.3-only (while "multiprocessing.queues.SimpleQueue" already exists).

--

___
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

2012-02-12 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

There's one more issue Julien has raised: nntplib attempts to authenticate when 
"AUTHINFO" is sent w/o USER. (haven't tested it but I presume it's still valid)

It's trivial to catch that but I'd say that it's fine to let the server handle 
it if the user has specifically told us to authenticate by giving credentials – 
no? Maybe if dealing with not-entirely-rfc-compliant servers?

I will look into the READER/MODE-READER part.

--

___
Python tracker 

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



[issue13999] Queue references in multiprocessing doc points to Queue module and not to self

2012-02-12 Thread Sandro Tosi

New submission from Sandro Tosi :

At the subject says, several references to Queue are linking to Queue module 
and not to multiprocessing.

--
assignee: docs@python
components: Documentation
messages: 153218
nosy: docs@python, sandro.tosi
priority: normal
severity: normal
stage: needs patch
status: open
title: Queue references in multiprocessing doc points to Queue module and not 
to self
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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Sandro Tosi

Sandro Tosi  added the comment:

It's the way all the subclasses are imported into the main module that got me 
in fault, I think. OK, so if I got it correctly, I should document 
multiprocessing.queue.SimpleQueue in 2.7 and 3.1 and 
multiprocessing.SimpleQueue in 3.3 also adding the hunk to __init__ (thus 
changing the API).

I'd say to document int still near to Queue() and JoinableQueue() - do you 
agree?

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> It's the way all the subclasses are imported into the main module that
> got me in fault, I think. OK, so if I got it correctly, I should
> document multiprocessing.queue.SimpleQueue in 2.7 and 3.1 and
> multiprocessing.SimpleQueue in 3.3 also adding the hunk to __init__
> (thus changing the API).

Yes.

> I'd say to document int still near to Queue() and JoinableQueue() - do
> you agree?

Yes, too.

--

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Eli Bendersky

Eli Bendersky  added the comment:

Florent,

Your updated patch looks good. I think that the explicit import of 
_namespace_map into cElementTree is just to satisfy some weird magic in the 
tests and can probably be removed as well (along with the weird magic :-), but 
that's not really important and can be left for later cleanups.

Regarding the documentation, alright let's not mention the implementation 
detail, and your "versionchanged" addition makes sense. I don't think adding 
directly to whatsnew/3.3.rst is necessary, updating Misc/NEWS is enough.

I'll apply the documentation patch after you apply the code patch. Or if you 
want, you can apply it yourself, I don't mind.

Thanks for the cooperation!

--

___
Python tracker 

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



[issue9750] sqlite3 iterdump fails on column with reserved name

2012-02-12 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 60aa7dacb605 by Petri Lehtinen in branch '2.7':
Fix sqlite3.Connection.iterdump on tables/fields with reserved names or quotes
http://hg.python.org/cpython/rev/60aa7dacb605

New changeset 4b105d328fe7 by Petri Lehtinen in branch '3.2':
Fix sqlite3.Connection.iterdump on tables/fields with reserved names or quotes
http://hg.python.org/cpython/rev/4b105d328fe7

New changeset 5d0f7b275fe9 by Petri Lehtinen in branch 'default':
Merge branch '3.2'
http://hg.python.org/cpython/rev/5d0f7b275fe9

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Eli Bendersky

Eli Bendersky  added the comment:

By the way, I see that if the explicit import of _namespace_map is commented 
out, the test_xml_etree_c test fails because it's not in the __all__ list. So 
the test can just import it directly with:

from xml.etree.ElementTree import _namespace_map

And the import in cElementTree won't be necessary. After all, _namespace_map is 
definitely not a public API!

This will keep cElementTree an nice-and-clean:

from xml.etree.ElementTree import *

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Eli Bendersky

Eli Bendersky  added the comment:

>> OK, so if I got it correctly, I should document 
>> multiprocessing.queue.SimpleQueue in 2.7 and 3.1 [...]

and 3.2, we're no longer updating 3.1 with such changes

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Eli Bendersky

Changes by Eli Bendersky :


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

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Eli Bendersky

Eli Bendersky  added the comment:

> OK, so if I got it correctly, I should document 
> multiprocessing.queue.SimpleQueue in 2.7 and 3.1 [...]


s/3.1/3.2/

--

___
Python tracker 

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



[issue13491] Fixes for sqlite3 doc

2012-02-12 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

> > In the Doc/includes/sqlite3 directory there are still some scripts that 
> > require the
> > createdb.py, so I didn't nuke the file.
>
> Do these scripts (or a README file) explain about createdb.py?

No. There's no mention of createdb.py anywhere.

> > I also removed the strange "The arguments to :meth:`executescript` must be 
> > :func:`bytes`
> > objects" sentence from the patch. I assume it was a mistake, as it's wrong.
>
> Why not change it so that it’s correct?  (Maybe looking at the file history 
> would
> show where the mistake comes from.)

It's just not in the history, it was only in OP's patch. And it's wrong, as 
executescript() takes an str argument, not bytes.

Having slept over this, I think execute_1.py and execute_2.py should be merged 
as one file, as after my patch, execute_2.py would not be runnable by itself.

This would also be a good chance to look at all the examples and have them 
cleaned up. That could also be a separate patch.

--

___
Python tracker 

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



[issue11836] multiprocessing.queues.SimpleQueue is undocumented

2012-02-12 Thread Sandro Tosi

Sandro Tosi  added the comment:

>> OK, so if I got it correctly, I should document 
>> multiprocessing.queue.SimpleQueue in 2.7 and 3.1 [...]
>
> s/3.1/3.2/

yeah, just a typo :)

--

___
Python tracker 

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



[issue13193] packaging.tests.test_manifest and distutils.tests.test_filelist failures

2012-02-12 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

It appears that while test_process_template() uses "/"-delimited paths
consistently across all OSes, 2.7 also has a test_process_template_line()
that uses os.path.join() to construct its paths. Changing this test to
use hardcoded "/"-delimited paths fixes the failure (see attached patch).

--
stage: needs patch -> commit review
Added file: 
http://bugs.python.org/file24501/fix-test_process_template_lines.diff

___
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

2012-02-12 Thread Hynek Schlawack

Changes by Hynek Schlawack :


Added file: http://bugs.python.org/file24502/b33bcf179df4.diff

___
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

2012-02-12 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

So my take on the whole issue and Antoine "tends to agree". ;)

1. If the user tells us (s)he _wants_ us to authenticate or send MODE READER, 
we do it even if capabilities don't advertise it. There's a lot of 
rfc-non-conformant servers out there. Permanent errors (i.e. not supported) 
will be gracefully swallowed.

That's already status quo.

2. If the server tells us it already _is_ in READER mode, we don't send it 
because in that case we can assume the server knows what it's doing.

The next patch checks whether we're in READER mode before trying to switch the 
mode.

I've also added a test for the basic case where a connection is made to a 
MODE-READER advertising server.

I also added a handler to the nntp2 tests that raises an exception if "mode 
reader" is called although the server advertises itself as "reader".

If there's a consensus of not sending "MODE READER" if not advertised, it's a 
matter of two lines to fix that. Personally, I like this middle ground best.

--

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Florent Xicluna

Florent Xicluna  added the comment:

> from xml.etree.ElementTree import _namespace_map
>
> And the import in cElementTree won't be necessary.
> After all, _namespace_map is definitely not a public API!

Because of the interaction of the support.import_fresh_module with the 
CleanContext context manager, it's not so easy to remove black magic.
I don't find better than:

if hasattr(ET, '_namespace_map'):
_namespace_map = ET._namespace_map
else:
from xml.etree.ElementTree import _namespace_map


This is why I kept the import in the deprecated "cElementTree" at first.
It does not hurt (it's private API), and it makes the test easier.

( If you have doubts, try ./python -m test test_xml_etree{,_c} or variants. )


I will probably commit code and documentation at once. It makes things easier 
regarding traceability.

--

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

Actually this test fails due to another reason. I'm still investigating it.

In the meantime, a different bug was found:

# stty size | cat
46 157
# python3.3 -c 'import os; print(os.get_terminal_size())' | cat
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument

Especially redirection to `less` is often used. `stty size` works, so it should 
be possible to fix Python.

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

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

Using strace, I see that stty calls ioctl(TIOCGWINSZ) on stdin (fd=0)
if it failed on stdout (fd=1), whereas Python only tries stdout.

Attached patch implements a similar idea.

--
Added file: http://bugs.python.org/file24503/get_terminal_size_pipe.patch

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Your patch is wrong. It always discards ioctl(stdout), even if it was 
successful.

--

___
Python tracker 

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



[issue3905] subprocess failing in GUI applications on Windows

2012-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In 3.2.2, starting IDLE from a Command Prompt, I get the same error as Denver. 
Starting IDLE 'normally', from the icon, there is no error. So even though 
Command Prompt detaches pythonw in some way and gives me a new prompt to do 
something else, there is something different about the pythonw process that 
trips up subprocess.

Changing ["python", "-c", "print(32)"] to ["notepad"] gives the same result. 
Running in the interactive interpreted eliminated the error. So does changing 
stdin=None to stdin=subprocess.PIPE eliminates the error and brings up Notepad, 
which seems to operate normally. (I am guessing that it ignores stdin, etc.).

I see that that the latter was known in the original post and plausibly 
diagnosed by Trent Mick, but never fixed because it was not obvious how to do 
so.

Can the WindowsError be caught in subproccess, and if it is this error (6), 
follow the alternate patch that is used for NULL returns? Could that cause 
worse problems that the current situation?

If this is unfixable due to Windows behavior, perhaps we should say something 
in the doc.

--
nosy: +terry.reedy
stage:  -> test needed
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 3.0

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

New try (I fixed my email address and the patch).

--
Added file: http://bugs.python.org/file24504/get_terminal_size_pipe-2.patch

___
Python tracker 

___diff -r 5d0f7b275fe9 Lib/shutil.py
--- a/Lib/shutil.py Sun Feb 12 21:06:57 2012 +0200
+++ b/Lib/shutil.py Mon Feb 13 00:25:38 2012 +0100
@@ -912,7 +912,7 @@ def get_terminal_size(fallback=(80, 24))
 # only query if necessary
 if columns <= 0 or lines <= 0:
 try:
-size = os.get_terminal_size(sys.__stdout__.fileno())
+size = os.get_terminal_size()
 except (NameError, OSError):
 size = os.terminal_size(fallback)
 if columns <= 0:
diff -r 5d0f7b275fe9 Modules/posixmodule.c
--- a/Modules/posixmodule.c Sun Feb 12 21:06:57 2012 +0200
+++ b/Modules/posixmodule.c Mon Feb 13 00:25:38 2012 +0100
@@ -10532,7 +10532,7 @@ get_terminal_size(PyObject *self, PyObje
 int columns, lines;
 PyObject *termsize;
 
-int fd = fileno(stdout);
+int fd = -1;
 /* Under some conditions stdout may not be connected and
  * fileno(stdout) may point to an invalid file descriptor. For example
  * GUI apps don't have valid standard streams by default.
@@ -10547,8 +10547,23 @@ get_terminal_size(PyObject *self, PyObje
 #ifdef TERMSIZE_USE_IOCTL
 {
 struct winsize w;
-if (ioctl(fd, TIOCGWINSZ, &w))
-return PyErr_SetFromErrno(PyExc_OSError);
+
+if (fd == -1) {
+fd = fileno(stdout);
+if (ioctl(fd, TIOCGWINSZ, &w)) {
+if (errno != EINVAL)
+return PyErr_SetFromErrno(PyExc_OSError);
+/* ioctl(TIOCGWINSZ) may fail on stdout if stdout is a pipe,
+   retry on stin */
+fd = fileno(stdin);
+if (ioctl(fd, TIOCGWINSZ, &w))
+return PyErr_SetFromErrno(PyExc_OSError);
+}
+}
+else {
+if (ioctl(fd, TIOCGWINSZ, &w))
+return PyErr_SetFromErrno(PyExc_OSError);
+}
 columns = w.ws_col;
 lines = w.ws_row;
 }
@@ -10559,6 +10574,10 @@ get_terminal_size(PyObject *self, PyObje
 DWORD nhandle;
 HANDLE handle;
 CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+if (fd == -1)
+fd = 1;
+
 switch (fd) {
 case 0: nhandle = STD_INPUT_HANDLE;
 break;
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread Zbyszek Szmek

Zbyszek Szmek  added the comment:

> Using strace, I see that stty calls ioctl(TIOCGWINSZ) on stdin (fd=0)
> if it failed on stdout (fd=1), whereas Python only tries stdout.
It was done this way by design. Maybe checking stdin can be also useful,
but it is a rather big change in semantics. I think it should be a separate bug.

It is pretty common for programs to behave differently when run through pipe, 
even if stdin is on a tty. stty is rather the exception than the rule. E.g. 
almost all programs disable color when piped explicitly through less. 'dpkg | 
cat' ignores terminal width. So does git and ls.
stty is special, because the only purpose of that program is to query terminal 
size, but it cannot be taken as a model for the behaviour of a general purpose 
program.

--

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

The purpose of os.get_terminal_size() is the same as `stty size`, so `stty 
size` could be a model for behavior of os.get_terminal_size().

--

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

> E.g. almost all programs disable color when piped explicitly through less.

Using my patch, you can use os.get_terminal_size(sys.stdout.fileno()) if you 
like to get an error if sys.stdout is a pipe. My patch only changes the 
behaviour if no argument is specified (hum, the "special" behaviour should be 
documented). Or you can also check explicitly sys.stdout.isatty().

It is just more convinient to fallback to stdin if stdout is not a TTY.

--

___
Python tracker 

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



[issue13930] lib2to3 ability to output files into a different directory and alter their names

2012-02-12 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
hgrepos:  -111

___
Python tracker 

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



[issue13930] lib2to3 ability to output files into a different directory and alter their names

2012-02-12 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset ceea9ebfe003 by Gregory P. Smith in branch '3.2':
Issue #13930: Adds ability for 2to3 to write its output to a different
http://hg.python.org/cpython/rev/ceea9ebfe003

New changeset 9f583700d27f by Gregory P. Smith in branch '2.7':
Issue #13930: Adds ability for 2to3 to write its output to a different
http://hg.python.org/cpython/rev/9f583700d27f

New changeset 4b791e513c2c by Gregory P. Smith in branch 'default':
Issue #13930: Adds ability for 2to3 to write its output to a different
http://hg.python.org/cpython/rev/4b791e513c2c

--
nosy: +python-dev

___
Python tracker 

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



[issue13930] lib2to3 ability to output files into a different directory and alter their names

2012-02-12 Thread Gregory P. Smith

Changes by Gregory P. Smith :


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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

STINNER Victor  added the comment:

Here is the version 17 of my patch. This version is mostly complete and so can 
be reviewed. Summary of the patch:

 - Add a _PyTime_t structure to store any timestamp in any resolution, 
universal structure used by all functions manipulating timestamps instead of C 
double to avoid loss of precision
 - Add many functions to create timestamp (set _PyTime_t structure) or to get a 
timestamp in a specific format (int, float, Decimal, timeval or timespec 
structure, in milliseconds, etc.)
 - Round to nearest with ties going away from zero (rounding method called 
"ROUND_HALF_UP" in Decimal)
 - Functions creating timestamps get a new optional timestamp argument to 
specify the requested return type, e.g. time.time(timestamp=int) returns an int
 - Functions getting timestamps argument now also support decimal.Decimal
 - Raise an OverflowError instead of a ValueError if a timestamp cannot be 
stored in a C time_t type

The patch is huge, but as I wrote before, I will split it into smaller parts:

 - Add _PyTime_t API
 - Use the new API in the time module
 - Use the new API in the os module
 - etc.

Changes in the version 17 of my patch:

 - tested on Linux 32/64 bits, OpenBSD 64 bits, FreeBSD 64 bits, Windows 64 bits
 - fix portability issues (for various time_t and C long sizes)

--
Added file: http://bugs.python.org/file24505/time_decimal-17.patch

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24473/time_decimal-14.patch

___
Python tracker 

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24497/time_decimal-16.patch

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-02-12 Thread Aaron Staley

Aaron Staley  added the comment:

As far as I can tell, no other thread is active.  Their backtraces are all 
either:


#0  0x7f283dedd300 in sem_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00519295 in PyThread_acquire_lock (lock=0xe7dd50, waitflag=1) at 
Python/thread_pthread.h:321
#2  0x004c734f in PyEval_RestoreThread (tstate=0xfbfb40) at 
Python/ceval.c:357


or

Thread 77 (Thread 0x7f2808fb1700 (LWP 30292)):
#0  0x7f283d57a773 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7f283c458739 in internal_select (s=0x7f2831432ca0, writing=0) at 
/root/python2.7-2.7.2/Modules/socketmodule.c:692
#2  0x7f283c45acdf in sock_recv_guts (s=0x7f2831432ca0, cbuf=0x339bf7c 
"\313\313\313\313\313\313\313\313\313\313\313\313\313\313\313", , len=16, flags=0) at 
/root/python2.7-2.7.2/Modules/socketmodule.c:2356
(More stack frames follow...)

or

Thread 17 (Thread 0x7f2829ff3700 (LWP 19252)):
#0  0x7f283d57f913 in select () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7f283d2a1fac in floatsleep (secs=0) at 
/root/python2.7-2.7.2/Modules/timemodule.c:943
#2  0x7f283d2a0cd9 in time_sleep (self=0x0, args=(,)) at /root/python2.7-2.7.2/Modules/timemodule.c:206
(More stack frames follow...)

or
Thread 12 (Thread 0x7f2834e5f700 (LWP 19223)):
#0  0x7f283d57f913 in select () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7f2839cb275e in select_select (self=0x0, args=([<_socketobject at 
remote 0x7f2830f4d1a0>, <_socketobject at remote 0x2106ec0>], [], [], )) at /root/python2.7-2.7.2/Modules/selectmodule.c:278
#2  0x0055f0ee in PyCFunction_Call (func=, 
arg=([<_socketobject at remote 0x7f2830f4d1a0>, <_socketobject at remote 
0x2106ec0>], [], [], ), kw=0x0) at 
Objects/methodobject.c:81
(More stack frames follow...)


Unfortunately, I've only been able to produce the segfault with this program 
(an EC2 server monitor and deployer).  It's very site specific and couldn't run 
on another machine.

That said, I can trigger these segfaults with high reliability, so I can 
certainly add additional debugging logs if requested.

--

___
Python tracker 

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



[issue13955] email: RFC 2822 has been obsoleted by RFC 5322

2012-02-12 Thread R. David Murray

R. David Murray  added the comment:

Hmm.  I misread this.  You are, in fact correct, but I don't think there is 
anything comprehensive to do here.  As I make changes and have actually checked 
then against RFC 5322, I'm either changing or adding that RFC number to the 
comments and docs.

--

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-02-12 Thread Aaron Staley

Aaron Staley  added the comment:

I should note that my program is also affected by this bug:
http://bugs.python.org/issue13817
(couldn't isolate it until I used the pydebug configure info).

--

___
Python tracker 

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



[issue8739] Update to smtpd.py to RFC 5321

2012-02-12 Thread R. David Murray

R. David Murray  added the comment:

Alberto, might you still interested in working on this?  I thought I'd do a 
quick update to current trunk and check it in, but in the process of doing that 
I found some issues.  I suspect it has been frustrating for you that nothing 
happened with this for 3.2, but it is a non-trivial patch since it involves RFC 
conformance.

I'm uploading what I got done of the update.  I've restored your introduction 
of a size argument to the smtp and channel classes (I don't know why Giampaolo 
objected, adding keyword arguments is not backward incompatible).  A max data 
size was introduced to deal with a DOS attack on the SMTPD server, called 
data_size_limit.  I changed that to be 'max_message_size' (rather than your 
size_limit) because this patch will make it be used for implementing that 
extended SMTP feature (as well as continuing to provide the 
DOS-preventing-limit by default).

There are still not enough tests.  In particular there are no tests for the 
smtpd command line functionality, and there was a bug in that in the last patch 
(it was still using the class argument you had eliminated at Giampaolo's 
request).  Writing those tests is of course a bit of a pain, but by combining 
the stuff from script_helpers with smtplib, it ought to be possible.  (But I 
wouldn't let a lack of command line tests prevent me from committing a 
completed patch.)

The more important problem is that your implementation of RFC 5321 left out a 
critical piece: parameters on the MAIL FROM and RCPT TO commands, and in 
particular the SIZE parameter to MAIL FROM.  Without that you aren't actually 
implementing RFC 1870 (or, for that matter, 5321 since a compliant server 
should reject unknown parameters as a syntax error).

I know it has been a long time, but are you still interested in working on 
this?  I haven't had much time to review stuff lately, much less do coding for 
the stdlib, but I'd really like to see this in 3.3, so if you are willing to 
work on it I'll commit to reviewing it in a timely fashion.

--
assignee:  -> r.david.murray
versions: +Python 3.3 -Python 3.2
Added file: http://bugs.python.org/file24506/rfc5321.patch

___
Python tracker 

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



[issue13979] Automatic *libc.so loading behaviour

2012-02-12 Thread Meador Inge

Meador Inge  added the comment:

'find_library' itself actually loads no libraries.  I suspect what happened was 
that the following code in the 'uuid' module coupled with the 'find_library' 
bug caused 'liblttng-ust-libc.so' to be loaded:

for libname in ['uuid', 'c']:
try:
lib = ctypes.CDLL(ctypes.util.find_library(libname))
except:
continue
if hasattr(lib, 'uuid_generate_random'):
_uuid_generate_random = lib.uuid_generate_random
if hasattr(lib, 'uuid_generate_time'):
_uuid_generate_time = lib.uuid_generate_time

This issue was fixed in 3.3 as a part of the optimization done in issue11258. I 
can still reproduce the problem in 2.7 and 3.2.

I am just going to backport the 3.3 regex to 2.7 and 3.2.  This is not an issue 
for the '_findLib_gcc' regex because the GCC output has a different format.  
'_findLib_ldconfig' is never actually called so I removed it.  Patch attached.

--
keywords: +patch
stage: needs patch -> patch review
versions:  -Python 3.3
Added file: http://bugs.python.org/file24507/issue13979-v0.patch

___
Python tracker 

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



[issue12297] Clarifications to atexit.register and unregister doc

2012-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

+ This function returns *func* which makes it possible
add , after 'func'.

+This obviously only works with functions that ...
I think I would like this better without 'obviously' (which you inherited).

Otherwise, seems good to go to me.

--

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-02-12 Thread Aaron Staley

Aaron Staley  added the comment:

Used latest mercurial 2.7 branch and segfault still occurs.

--

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-02-12 Thread Aaron Staley

Aaron Staley  added the comment:

Also, the only particular things by code does is have a lot of threads (100+), 
holds open many ssh connections (with paramiko) and I do occasionally use 
PyThreadState_SetAsyncExc to asynchronously terminate threads.

--

___
Python tracker 

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



[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

2012-02-12 Thread Eli Bendersky

Eli Bendersky  added the comment:

Alright, it's not really important at this point and can be cleaned up
later.

>
> I will probably commit code and documentation at once. It makes things
> easier regarding traceability.
>

Sounds good

--

___
Python tracker 

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



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2012-02-12 Thread Mike Perry

Mike Perry  added the comment:

Hello,

I am still able to reproduce this issue with Python 3.2.2. It seems as if this 
bug was closed with a the note:

r70039 3.1 forward ported > 3.2 > default.  Will be in 3.2.1.

This leads me to believe that either 3.2.2 has a regression or the patch never 
made it into 3.2.1. 

Can anyone chime in with some more details?

Thanks,

Mike

--
nosy: +Mike.Perry

___
Python tracker 

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



[issue13866] {urllib, urllib.parse}.urlencode should not use quote_plus

2012-02-12 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Stephen - urlencode is responsible for producing the 
application/x-www-form-urlencoded  format, usually used in the FORMs in the web.
As per the spec, the Space characters are replaced by `+'. - 

http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1

What you are looking for is probably quote and quote_plus helper functions.

When I had this doubt (long back), I referred to Java's URLEncoder class to see 
how it was behaving and then looked at the HTML specs. It was kind of standard 
behavior across different libraries.  Closing this as invalid.

--
resolution:  -> invalid
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2012-02-12 Thread Mike Perry

Mike Perry  added the comment:

Figured I should capture the exception. See below.

3.2.2+ (default, Jan  8 2012, 07:22:26) 
[GCC 4.6.2]

Traceback (most recent call last):
  File "/usr/bin/idle3", line 5, in 
main()
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 1429, in main
root.mainloop()
  File "/usr/lib/python3.2/tkinter/__init__.py", line 1012, in mainloop
self.tk.mainloop(n)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc0 in position 0: invalid 
start byte

--

___
Python tracker 

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