[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-05-04 Thread Evgeny Kapun

Evgeny Kapun added the comment:

To make fdopendir fail, just pass any valid FD which points to a non-directory, 
such as a file or a pipe.

--

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



[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-05-04 Thread Evgeny Kapun

Evgeny Kapun added the comment:

Simple test:

while True:
try:
listdir(0)
except NotADirectoryError:
pass

--

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



[issue17862] itertools.chunks(iterable, size, fill=None)

2013-05-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The reasons for the previous rejections still hold:  more tools make the 
overall toolset harder to use, not being a primitive operation, dearth of 
real-world use-cases, not being prevalent in other functional languages, easily 
expressible with existing tools, non-consensus on what to do with odd-sizes, 
lack of adoption of the published recipe, and a hard-to-guess function name.

In addition to previously listed reasons, I have vague feelings that this isn't 
the right thing to do.  The feelings are in-part based on poor user experience 
with itertools.groupby(), a function that developers said they wanted but 
ended-up being awkward to fit into real applications, confusing to some users, 
and rarely used in practice.
  
Another source of misgivings is that iterators may not be the right tool for 
this kind of task.  For example, when partitioning data into subgroups for a 
map/reduce operation, iterators won't help because they are evaluated serially 
which precludes any chance of parallelization.  Even in cases of serial 
processing such reading blocks from a socket, the chunks iterator would be 
useless or awkward (i.e. we need more versatility than iterator.next() to 
manage the control-flow, time-outs, out-of-band control, separating headers 
from content, etc.)  In other words, I have a sense that the generic concept of 
break data into chunks tends to occur is situations where the iterator 
protocol would be at odds with a clean solution.

That said, I'll leave this open for a while and do my best to try to warm-up to 
it.  Your recurring enthusiasm for it is a positive point.  Another is its the 
faint resemblance to a numpy reshape operation.

P.S.  In prior discussions, the only real use case that ever surfaced was 
printing long sequences of data across multiple columns.  Even that use case 
was suspect because the desired order is typically in column-major order (for 
example, look at the output of the *nix ls command).

--
priority: normal - low
versions:  -Python 3.3

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



[issue17897] Optimize unpickle prefetching

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, I have no any interesting results. ;) If an effect exists, it should reveal 
itself only in rare cases and be very small. This patch may be considered 
rather as a tiny refactoring (it decreases a number of code lines).

--

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



[issue17900] Recursive OrderedDict pickling

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In additional the patch decreases the size of the pickled data, speeds up 
pickling and unpickling.

$ ./python -c import collections, pickle; od = collections.OrderedDict((i, i) 
for i in range(10)); print(len(pickle.dumps(od)))

Without patch: 1536827.
With patch: 737578.

$ ./python -m timeit -s from pickle import dumps; import collections; od = 
collections.OrderedDict((i, i) for i in range(10))  dumps(od)

Without patch: 454 msec.
With patch: 361 msec.

$ ./python -m timeit -s from pickle import dumps, loads; import collections; 
od = collections.OrderedDict((i, i) for i in range(10)); x = dumps(od)  
loads(x)

Without patch: 1.41 sec.
With patch: 1.15 sec.

--

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



[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

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



[issue17872] Crash in marshal.load() with bad reader

2013-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
type: behavior - crash

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



[issue17776] IDLE Internationalization

2013-05-04 Thread Damien Marié

Damien Marié added the comment:

A side note to justify the localization of IDLE:

I think the internationalization part is important, It's a nearly invisible 
overhead for the code but it will be helpful for example:

- In France, most of the highschool student have to learn python so they learn 
keyword and logic but most of them don't master english. And also in prep 
school like statued in the issue 17760
- Making the beginners more confident with the tool (as it's mostly used by 
beginners)
- Most of the IDE are localized and the OS is localized, it's a matter of 
consistency to localize the IDLE UI

But I'm against localizing exception messages and anything built into python
 
I hope I responsed to some concerns.

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

  1) A separate function might be better.  I think this kind of output would 
 be more useful while inspecting individual byte objects, rather than having 
 it for arbitrary byte objects (that might be inside other containers).

I don't think the general hexdump() function is worth to including in the 
stdlib. It should have too many options (How many bytes display in one line? 
How group hexdigits? What replacemant character for non-printables? Whether or 
not to display addresses? Whether or not to display chars? What are delimiters 
between hexdigits and chars, address and hexdigits? What are line prefix and 
suffix? How display last incomplete line? How display first incomplete line?) 
and this makes it complicated. An application which outputs a hexdump on more 
rich device (a html file or a ANSI-colored terminal) needs advanced options.

However a simple specialized code can be used for special purposes, i.e. 
internally in the pprint module. I don't see how it can be reused and don't 
interested in a general function.

  2) I don't know if the output of pprint is supposed to be eval()uable, but I 
 don't like too much the base64.b16decode(...).replace(' ', '') in the output 
 (especially if the byte objects are short).  If a separate function is used 
 as suggested in 1) this won't be a problem.  Using the hex_codec might be 
 another option.

An alternative option is first output a bytes object as is (perhaps splitting 
it on multiple line as in issue17530) and then output a hexdamp as a comment.

[b'\x7fELF\x01\x01\x01\x00\x00\n'
 b'\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01'
 # 7F 45 4C 46 01 01 01 00 00 0A 00 00 00 00 00 00 | .ELF
 # 02 00 03 00 01  | .
 ]

--

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



[issue16429] Emit SyntaxWarning for code that risks UnboundLocalError

2013-05-04 Thread Daniel Urban

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


--
nosy: +daniel.urban

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



[issue17903] Python launcher for windows should search path for #!/usr/bin/env

2013-05-04 Thread Paul Moore

New submission from Paul Moore:

The Python launcher for windows should recognise a hashbang line of 
#!/usr/bin/env python, and use the python executable found on PATH to run the 
script. If no python executable is present on PATH the launcher should fall 
back to the current behaviour (using the default python, as if 
#!/usr/bin/python were present).

This matches the behaviour on other platforms where env is used to ensure that 
the script uses the user's currently activated Python, and is particularly 
important when virtualenvs are being used.

--
assignee: vinay.sajip
components: Windows
messages: 188347
nosy: pmoore, vinay.sajip
priority: normal
severity: normal
status: open
title: Python launcher for windows should search path for #!/usr/bin/env
type: enhancement
versions: Python 3.4

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is an alternative patch which outputs a bytes literal and a hexdump as a 
comment.

--
Added file: http://bugs.python.org/file30121/pprint_bytes_hex_2.patch

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



[issue17904] bytes should be listed as built-in function for 2.7

2013-05-04 Thread Florent Xicluna

New submission from Florent Xicluna:

Looking into the summary table, there's no information about the `bytes` 
built-in alias for `str`:
http://docs.python.org/2/library/functions.html

IMHO it should appear in this table (as str, unicode, bytearray) with the 
appropriate `.. versionadded:`.

--
assignee: docs@python
components: Documentation
messages: 188349
nosy: docs@python, flox
priority: normal
severity: normal
status: open
title: bytes should be listed as built-in function for 2.7
type: behavior
versions: Python 2.7

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



[issue5492] Error on leaving IDLE with quit() or exit() under Linux

2013-05-04 Thread Ger Luijten

Ger Luijten added the comment:

Hello Roger,

Thanks for the clear explanation!

Greetings, Ger

2013/4/20 Roger Serwy rep...@bugs.python.org


 Roger Serwy added the comment:

 Good catch Terry! I've been testing using python -m idlelib.idle instead
 of importing it from an interactive prompt. I'll need to remember to
 consider that test vector in the future.

 I figured out why those messages are popping up. The Tk event loop remains
 running when in the interactive Python REPL due to a PyOS_InputHook driving
 the Tk loop periodically. Some .after callbacks expire and Tcl tries
 calling into a Python function that no longer exists. The ColorDelegator's
 recolorize() and PyShell's poll_subprocess() are the callbacks. (Adding a
 print(name, func) to the after() function in Lib/tkinter/__init__.py
 revealed the link between the Tcl reference name and the Python reference
 name.)

 The extra ColorDelegator call is actually a bug, related to #13495. (I
 need to expand it that issue to include this new problem.) Two
 ColorDelegators get loaded, and only one gets its close() method called
 which properly cancels the .after callback into recolorize. The orphaned
 ColorDelegator still exists in the delegator chain with an active .after
 callback.

 Once both those .after callbacks are canceled, then the error messages
 Terry sees are no longer shown.

 The rev1 patch includes extra code to handle cancellation of the
 poll_subprocess .after callback. I'll be posting the multi-color delegator
 fix to #13495.

 --
 dependencies: +IDLE: Regressions - Two ColorDelegator instances loaded and
 -e no longer edits new files.
 Added file: http://bugs.python.org/file29945/issue5492_rev1.patch

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue5492
 ___


--

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



[issue3405] Add support for the new data option supported by event generate (Tk 8.5)

2013-05-04 Thread Alejandro Rodas

Changes by Alejandro Rodas alexrd...@gmail.com:


--
nosy: +alex.rodas

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Antoine, can you share the code for your benchmarks which show
 performance improvements when framing is enabled? I am seeing the same
 10-15% slowdown even when pickling stuff to pure Python objects:

The performance improvement is when unpickling, not when pickling.
Pickling always buffers data, so framing doesn't bring anything on this
side of the fence.

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le samedi 04 mai 2013 à 09:42 +, Serhiy Storchaka a écrit :
 
 However a simple specialized code can be used for special purposes,
 i.e. internally in the pprint module. I don't see how it can be reused
 and don't interested in a general function.

I don't understand how it would be useful in the pprint module if it
can't be useful as a general function. The general intent is the same:
print something in a nice way. Just the nice way is different
depending on the situations: if my bytes object is simply a bunch of
HTTP headers, I don't want to have a hexdump.

 An alternative option is first output a bytes object as is (perhaps
 splitting it on multiple line as in issue17530) and then output a
 hexdamp as a comment.
 
 [b'\x7fELF\x01\x01\x01\x00\x00\n'
  b'\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01'
  # 7F 45 4C 46 01 01 01 00 00 0A 00 00 00 00 00 00 | .ELF
  # 02 00 03 00 01  | .
  ]

This won't work very nicely in smaller display widths. You'll need too
many lines to represent a bytes object.

--

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



[issue17806] Add keyword args support to str/bytes.expandtabs()

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 FTR the reason to add this is consistency

This always was a weak reason.

 and readability

It is a matter of taste. For me s.expandtabs(3) looks more readable than 
s.expandtabs(tabsize=3).

I don't see an urgent need for this feature and don't like a complication. 
Let's defer this change until the passing of the keyword arguments will not be 
significantly optimized. I'm -0 for committing right now.

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Removed file: http://bugs.python.org/file30121/pprint_bytes_hex_2.patch

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Added file: http://bugs.python.org/file30122/pprint_bytes_hex_2.patch

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 I don't understand how it would be useful in the pprint module if it
 can't be useful as a general function.

How can it be used besides pprint/pformat functions?

  Just the nice way is different
 depending on the situations: if my bytes object is simply a bunch of
 HTTP headers, I don't want to have a hexdump.

Then perhaps a new parameter for pprint/pformat needed (hex=True?). I think 
printing integers in hexadecimal can sometimes be useful too.

 This won't work very nicely in smaller display widths. You'll need too
 many lines to represent a bytes object.

This is a nature of hexdumps. Every byte requires 4+ characters (or 3+ if group 
hexdigits tighter).

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

  I don't understand how it would be useful in the pprint module if it
  can't be useful as a general function.
 
 How can it be used besides pprint/pformat functions?

I don't understand your question. Do you never print some data at the
command-line prompt? Or even as part of small test programs?

 Then perhaps a new parameter for pprint/pformat needed (hex=True?). I
 think printing integers in hexadecimal can sometimes be useful too.

Passing type-specific parameters to pprint/pformat sounds like a bad
idea to me. And I don't think you'd want to print *all* integers as hex.

  This won't work very nicely in smaller display widths. You'll need too
  many lines to represent a bytes object.
 
 This is a nature of hexdumps. Every byte requires 4+ characters (or 3+
 if group hexdigits tighter).

Which is why the proposal doesn't fit well with pprint/pformat.

--

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



[issue16316] Support xz compression in mimetypes module

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 26068bfec70e by Serhiy Storchaka in branch '2.7':
Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
http://hg.python.org/cpython/rev/26068bfec70e

New changeset d04259af01ff by Serhiy Storchaka in branch '3.3':
Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
http://hg.python.org/cpython/rev/d04259af01ff

--

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



[issue16316] Support xz compression in mimetypes module

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Have backported.

--
resolution:  - fixed
status: open - closed
versions:  -Python 3.2

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



[issue15809] IDLE console uses incorrect encoding.

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If there are no objections I will commit the patch soon.

--

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



[issue16945] rewrite CGIHTTPRequestHandler to always use subprocess

2013-05-04 Thread Charles-François Natali

Charles-François Natali added the comment:

The latest version of the patch passes on Linux, OpenIndiana and Windows.

Note that I did apply the select()-hack on all platforms (not only Windows), 
because if I understood #427345 correctly, it's really there to bypass a 
non-standard IE behavior (which appends trailing '\r\n'), and doesn't depend on 
the platform.

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

The idea is that the output of pprint should be something like (once #17530 is 
applied):
 pprint.pprint(b'\x7fELF\x01\x01\x01\x00\x00\n\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01')
(b'\x7fELF\x01\x01\x01\x00\x00\n\x00\x00'
 b'\x00\x00\x00\x00\x02\x00\x03\x00\x01')

whereas the output of hexdump can be something like:
pprint.hexdump(b'\x7fELF\x01\x01\x01\x00\x00\n\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01')
7F 45 4C 46 01 01 01 00 00 0A 00 00 00 00 00 00 | .ELF
02 00 03 00 01  | .

hexdump() could accept some additional args too if required, but otherwise I 
don't think the details are so important as long as it produces something 
readable for a human.

--

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



[issue17819] removes need for CONFIG_SITE external configuration

2013-05-04 Thread Antonio Cavallo

Antonio Cavallo added the comment:

So far it seems the special handling in config.site is restricted to these two 
bits ptc/ptmx (I'm targeting android in cross compiling at the moment).

--

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



[issue17905] Add check for locale.h

2013-05-04 Thread Antonio Cavallo

New submission from Antonio Cavallo:

This patch adds autoconf.ac check for the locale.h file in addition to 
langinfo.h. The patch contains also a fix to Python/fileutils.c file.

The android ndk provides locale.h but no langinfo.h: this fixes the issue.

BTW bionic doesn't have any runtime support for locale at the moment in the 
standard build at least.

--
components: Build, Cross-Build
files: locale_h_configure.ac.patch
keywords: patch
messages: 188362
nosy: benjamin.peterson, cavallo71, doko, haypo
priority: normal
severity: normal
status: open
title: Add check for locale.h
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file30123/locale_h_configure.ac.patch

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



[issue17810] Implement PEP 3154 (pickle protocol 4)

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here are some numbers:

# Without the patch

$ ./python -m timeit -s import pickle, io; d=pickle.dumps(list(range(1000)), 
4); b=io.BytesIO(d) b.seek(0); pickle.load(b)
1 loops, best of 3: 180 usec per loop

$ ./python -m timeit -s import pickle, _pyio as io; 
d=pickle.dumps(list(range(1000)), 4); b=io.BytesIO(d) b.seek(0); 
pickle.load(b) 
100 loops, best of 3: 4.52 msec per loop

# With the patch

$ ./python -m timeit -s import pickle, io; d=pickle.dumps(list(range(1000)), 
4); b=io.BytesIO(d) b.seek(0); pickle.load(b)
1 loops, best of 3: 42.8 usec per loop

$ ./python -m timeit -s import pickle, _pyio as io; 
d=pickle.dumps(list(range(1000)), 4); b=io.BytesIO(d) b.seek(0); 
pickle.load(b)
1 loops, best of 3: 47.3 usec per loop

--

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



[issue17906] Add a string error handler to JSON encoder/decoder

2013-05-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Inspired by simplejson issue [1] which is related to standard json module too. 
JSON parser 3.3+ and wide builds of 3.2- raise an error on invalid strings 
(i.e. with unpaired surrogate), while narrow builds and some third-party 
parsers. Wide builds are right, such JSON data is invalid. However it will be 
good to be optionally more permissive to input data. Otherwise it is not easy 
process such invalid data.

I propose to add an error parameter to JSON decoder and encoder with the same 
meaning as in string decoding/encoding. strict is default and surrogatepass 
corresponds to narrow builds (and non-strict third-party parsers).

[1] https://github.com/simplejson/simplejson/issues/62

--
assignee: serhiy.storchaka
components: Extension Modules, Library (Lib), Unicode
messages: 188364
nosy: bob.ippolito, ezio.melotti, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a string error handler to JSON encoder/decoder
type: enhancement
versions: Python 3.4

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



[issue7855] Add test cases for ctypes/winreg for issues found in IronPython

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5f82b68c1f28 by Ezio Melotti in branch '3.3':
#7855: Add tests for ctypes/winreg for issues found in IronPython.  Initial 
patch by Dino Viehland.
http://hg.python.org/cpython/rev/5f82b68c1f28

New changeset df655ebf74d7 by Ezio Melotti in branch 'default':
#7855: merge with 3.3.
http://hg.python.org/cpython/rev/df655ebf74d7

--
nosy: +python-dev

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



[issue7855] Add test cases for ctypes/winreg for issues found in IronPython

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e71406d8ed5d by Ezio Melotti in branch '2.7':
#7855: Add tests for ctypes/winreg for issues found in IronPython.  Initial 
patch by Dino Viehland.
http://hg.python.org/cpython/rev/e71406d8ed5d

--

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



[issue7855] Add test cases for ctypes/winreg for issues found in IronPython

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

This should be fixed now.
Thanks for the report and the patch (and thanks Zach for confirming that it 
works on Windows and for the review)!

--
assignee: dino.viehland - ezio.melotti
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue16518] add buffer protocol to glossary

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 003e4eb92683 by Ezio Melotti in branch '3.3':
#16518: use bytes-like object throughout the docs.
http://hg.python.org/cpython/rev/003e4eb92683

New changeset d4912244cce6 by Ezio Melotti in branch 'default':
#16518: merge with 3.3.
http://hg.python.org/cpython/rev/d4912244cce6

--

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



[issue16518] add buffer protocol to glossary

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

The attached patch uses bytes-like objects in the error messages.

--
Added file: http://bugs.python.org/file30124/issue16518-3.diff

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



[issue17904] bytes should be listed as built-in function for 2.7

2013-05-04 Thread Antoine Pitrou

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


--
stage:  - needs patch

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



[issue17859] improve error message for saving ints to file

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

 binary-mode write requires bytes-like object, not 'int'

Looks like the function that raises the error (Objects/abstract.c:352) doesn't 
have enough information to produce a message like that.
I attached a patch to #16518 that improves this and other error messages (this 
particular error is replaced by a bytes-like object is required, not 'int').

--
type:  - enhancement

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



[issue17901] _elementtree.TreeBuilder raises IndexError on end if constructed with element_factory=None

2013-05-04 Thread Antoine Pitrou

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


--
nosy: +eli.bendersky
stage:  - patch review

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 I don't understand your question. Do you never print some data at the
 command-line prompt? Or even as part of small test programs?

To be honest, I very rarely even use pprint. I'm too lazy to import it. If I 
want to quickly get a hexdump, I use something like `' '.join('%02X'%i for i in 
data)`. It is shorter than `import pprint; pprint.hexdump(data)`. For a small 
program most likely the standard hexdump() will not be enough.

 Passing type-specific parameters to pprint/pformat sounds like a bad
 idea to me.

Agree. Of course it would be better to automatically determine a nice display 
(use hexdump only for large non-printable bytes).

 And I don't think you'd want to print *all* integers as hex.

If you want to print bytes in hex, why not ints and floats? ;)  In fact I don't 
want to print data as hex, so shut up.

 Which is why the proposal doesn't fit well with pprint/pformat.

Perhaps I misunderstood your wish. I'm not against consider pprint as a black 
box, which does all good magic inside by default. The use of this feature does 
not require anything from the users and does not impose obligations on the 
maintainers. But I'm not interested in a separate function.

--

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



[issue17868] pprint long non-printable bytes as hexdump

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le samedi 04 mai 2013 à 15:41 +, Serhiy Storchaka a écrit :
  Which is why the proposal doesn't fit well with pprint/pformat.
 
 Perhaps I misunderstood your wish. I'm not against consider pprint as
 a black box, which does all good magic inside by default. The use of
 this feature does not require anything from the users and does not
 impose obligations on the maintainers. But I'm not interested in a
 separate function.

The problem is the good magic will depend on the situation. Really, I
don't want a hexdump of a HTTP message :-)
Which is why there should be a separate function for those *wishing* a
hexdump.

--

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



[issue1298835] Add a vendor-packages directory for system-supplied modules

2013-05-04 Thread Éric Araujo

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


--
components: +Interpreter Core -Distutils2, Library (Lib)
versions: +Python 3.4 -Python 3.3

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



[issue1298835] Add a vendor-packages directory for system-supplied modules

2013-05-04 Thread Éric Araujo

Éric Araujo added the comment:

Adding Nick to this discussion, since distutils-sig is talking about these 
issues right now.

Previous discussions:
http://mail.python.org/pipermail/python-list/2005-September/345116.html
http://mail.python.org/pipermail/python-dev/2005-September/056682.html
http://mail.python.org/pipermail/python-dev/2003-August/037487.html

Barry: if you could summarize how and why doko introduced dist-packages in 
Debian, or let me copy parts of email we exchanged a couple years ago, I think 
it could help.  Nick seems inclined to standardize doko’s solution, but IIRC it 
was an imperfect but working compromise, so we might want to rethink it.

--
assignee: tarek - 
nosy: +ncoghlan

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



[issue17906] Add a string error handler to JSON encoder/decoder

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I wonder if json should simply be less strict by default. If you pass the raw 
unescaped character, the json module accepts it:

 json.loads('{a: \ud8e9}')
{'a': '\ud8e9'}

It's only if you pass the escaped representation that json rejects it:

 json.loads('{a: \\ud8e9}')
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/antoine/cpython/default/Lib/json/__init__.py, line 316, in loads
return _default_decoder.decode(s)
  File /home/antoine/cpython/default/Lib/json/decoder.py, line 344, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File /home/antoine/cpython/default/Lib/json/decoder.py, line 360, in 
raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Unpaired high surrogate: line 1 column 9 (char 8)

--

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



[issue17906] Add a string error handler to JSON encoder/decoder

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #11489.

--

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



[issue17854] symmetric difference operation applicable to more than two sets

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

 Return a new set with elements in an odd number of the sets.

This wording is not really clear to me.

IMHO the documentation is fine as is.  The evaluation order works as usual, 
and, since the symmetric difference is an associative (and commutative) 
operation, the order doesn't even matter.

--
nosy: +ezio.melotti
type: behavior - enhancement

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



[issue1298835] Add a vendor-packages directory for system-supplied modules

2013-05-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The discussion on distutils-sig that Éric is referring to is one were I ended 
up pointing out that PEP 439 (bootstrapping pip in 3.4) needs to address this 
in some manner, so that pip (which installs to site-packages) doesn't end up 
fighting with system package managers that are also installing to site-packages 
in many cases.

Since the distro vendors are in a better situation to change their target 
installation directory, the consensus on the list was that something *like* the 
current Debian solution is most appropriate (I wasn't aware this issue existed 
at the time).

The current situation is annoying-but-tolerable with pip as a third party 
solution, but unacceptable once the command is being provided by Python itself. 
As with virtual environments, something with upstream support may be able to be 
cleaner than a third party workaround.

Relevant distutils-sig 
post:http://mail.python.org/pipermail/distutils-sig/2013-May/020673.html 
(ignore the initial quoted part - I was just flat out wrong earlier in that 
thread)

--
nosy: +richard

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



[issue17862] itertools.chunks(iterable, size, fill=None)

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

FWIW I'm +1 about adding grouper(), since it happened to me to use it and 
suggest more often than any other recipe (I think it's the only recipe I 
used/know), and even more often than some of the current itertools.
The fact that has been requested several times already it's a good indication 
that it's something useful, and not a feature creep (I don't think any other 
recipe received nearly as many requests).

Regarding use cases, a few days ago I needed it while shuffling a sequence of 
20 chars and then split it in four 5-chars long groups.
I also remember writing code like this more than once:
 s = 'abcd'
 n = 5
 [s[x:x+n] for x in range(0,len(s),n)]
['a', 'b', 'c', 'd']

(As a side note, I find the grouper(iterable, n, fill) signature more intuitive 
than grouper(n, iterable, fill) (the recipe uses the latter).)

--
assignee: rhettinger - 
nosy: +ezio.melotti
stage:  - needs patch
type:  - enhancement

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



[issue17862] itertools.chunks(iterable, size, fill=None)

2013-05-04 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee:  - rhettinger

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



[issue17877] Skip test_variable_tzname when the zoneinfo database is missing

2013-05-04 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee:  - ezio.melotti
stage: patch review - commit review

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



[issue17887] docs: summary page - generator vs iterator vs iterable

2013-05-04 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
type:  - enhancement
versions: +Python 2.7, Python 3.3, Python 3.4

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



[issue17890] argparse: mutually exclusive groups full of suppressed args can cause AssertionErrors

2013-05-04 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

I am not sure if I am missing something. I had filled out the form at 
http://www.python.org/psf/contrib/contrib-form/ on the day I submitted the 
patch and even got back an email from Ewa Jodlowska. However, I don't see any 
* after my name. I submitted the same form to contribut...@python.org and 
shot a mail to python-dev mailing list but there is no change. Any suggestions?

--

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



[issue1298835] Add a vendor-packages directory for system-supplied modules

2013-05-04 Thread Matthias Klose

Matthias Klose added the comment:

there is more than one thing addressed with the 'dist-packages' choice of name.

The primary reason is to have a directory where you only find python packages 
as distributed by the linux distribution, and where installers do not install 
to by default.  Even if this directory is non-writable, people did call 'sudo 
python setup.py install', and then did report issues on the Ubuntu tracker 
caused by these installs. Such a vendor place should never be the default to be 
installed to by default.

There is a Debian policy to support /usr/local, and that's the reason you find 
a second directory /usr/local/lib/pythonx.y/dist-packages. A 'sudo python 
setup.py install' installs into this location, distribution maintainers 
providing Debian packages are supposed to call setup.py install 
--install-layout=deb to install into the debian system installation.

At this time Barry still new to distro policies, was surprised to find 
/usr/local/lib/pythonx.y/site-packages being used by the system python, which 
is also used by a local python build which is configured without any --prefix 
parameters. So the system python now uses dist-packages in both /usr and 
/usr/local to not interfere with a local python installation.

Note that for python3, Debian and Ubuntu are trying to share dist-packages 
across python3 versions to ease upgrades from one version to the other, and 
trying to support more than one version during the upgrade (calling that 
/usr/lib/python3/dist-packages).

--

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e39a8f8ceb9f by Brett Cannon in branch 'default':
#17115,17116: Have modules initialize the __package__ and __loader__
http://hg.python.org/cpython/rev/e39a8f8ceb9f

--
nosy: +python-dev

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


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

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



[issue17116] xml.parsers.expat.(errors|model) don't set the __loader__ attribute

2013-05-04 Thread Brett Cannon

Brett Cannon added the comment:

New changeset e39a8f8ceb9f by Brett Cannon in branch 'default':
#17115,17116: Have modules initialize the __package__ and __loader__
http://hg.python.org/cpython/rev/e39a8f8ceb9f

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

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



[issue17894] Edits to descriptor howto

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

Attached a patch that rephrases part of the suggestions made by Ned.

--
nosy: +ezio.melotti
Added file: http://bugs.python.org/file30125/issue17894.diff

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



[issue5845] rlcompleter should be enabled automatically

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5ef330bac50 by Antoine Pitrou in branch 'default':
Issue #5845: Enable tab-completion in the interactive interpreter by default, 
thanks to a new sys.__interactivehook__.
http://hg.python.org/cpython/rev/d5ef330bac50

--
nosy: +python-dev

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



[issue5845] rlcompleter should be enabled automatically

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

End-users will hopefully rejoice :)

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

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Brett Cannon

Brett Cannon added the comment:

Just to keep on top of what is left to do for this to happen:

* get_magic(): expose in importlib
* find_module()/load_module(): eliminate all uses in the stdlib and fully 
deprecate
* new_module(): use types.ModuleType() instead
* reload(): relocate
* cache_from_source(): relocate
* source_from_cache(): relocate
* get_tag(): deprecate
* lock_held()/acquire_lock()/release_lock(): deprecate
* NullImporter: deprecate

Everything else can stay undocumented as-is (deprecated or simply exposed 
through _imp which can stay undocumented).

I plan to make individual issues for these things as I solidify the decision of 
how to handle them.

--
nosy: +benjamin.peterson

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



[issue17907] Deprecate imp.new_module() in favour of types.ModuleType

2013-05-04 Thread Brett Cannon

New submission from Brett Cannon:

imp.new_module() does not need to exist since code can use types.ModuleType's 
constructor.

--
components: Library (Lib)
keywords: easy
messages: 188388
nosy: brett.cannon
priority: low
severity: normal
stage: test needed
status: open
title: Deprecate imp.new_module() in favour of types.ModuleType
versions: Python 3.4

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Deprecate imp.new_module() in favour of types.ModuleType

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

Some buildbots are failing after this:
http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/7840
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/4536

FAIL: test_everyone_has___loader__ (test.test_importlib.test_api.StartupTests)
--
Traceback (most recent call last):
  File 
/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_importlib/test_api.py,
 line 201, in test_everyone_has___loader__
'{!r} lacks a __loader__ attribute'.format(name))
AssertionError: False is not true : 'test.pydoc_mod' lacks a __loader__ 
attribute

--
nosy: +ezio.melotti

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Brett Cannon

Brett Cannon added the comment:

While thinking about asking on G+ for feedback, I realized that if I get this 
to the point of a module-level warning, it won't be a big deal. It would be 
just like warnings you deal with when supporting old versions of Python along 
with newer versions where things are now deprecated. That way  users of imp 
could just do::

with warnings.catch_warnings():
warnings.simplefilter(ignore)
import imp

and be done with it. This means still striving to deprecate every function in 
imp so that it can all be replaced with a single module-level deprecation is a 
reasonable goal to have.

--

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

This might be OK, however you won't be able to point to the alternatives in the 
deprecation message (e.g. new_module() is deprecated, use types.ModuleType() 
instead).
This can still be done in the docs though.

--

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Brett Cannon

Brett Cannon added the comment:

Right, the docs would say the imp modules is deprecated; please see the module 
documentation for alternatives or something.

--

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



[issue17408] second python execution fails when embedding

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8c1385205a35 by Antoine Pitrou in branch '3.3':
Issue #17408: Avoid using an obsolete instance of the copyreg module when the 
interpreter is shutdown and then started again.
http://hg.python.org/cpython/rev/8c1385205a35

New changeset 0b34fd75b937 by Antoine Pitrou in branch 'default':
Issue #17408: Avoid using an obsolete instance of the copyreg module when the 
interpreter is shutdown and then started again.
http://hg.python.org/cpython/rev/0b34fd75b937

--
nosy: +python-dev

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



[issue17882] test_objecttypes fails for 3.2.4 on CentOS 6

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

3.2 only gets security fixes, can you try with 3.3/default and see if it fails 
there?

(The devguide has instructions about getting an updated clone and testing on 
3.3/default if you need them.)

--
nosy: +benjamin.peterson, ezio.melotti, loewis
type:  - behavior

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



[issue17408] second python execution fails when embedding

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thank you for reporting! This should be fixed now.

--
components: +Interpreter Core -None
nosy: +pitrou
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: +Python 3.4

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Brett Cannon

Brett Cannon added the comment:

It's because test_pydoc is actively deleting the __loader__ of a test module. 
I'll have a look to figure out why it's doing that.

--
resolution: fixed - 
status: closed - open

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



[issue16742] PyOS_Readline drops GIL and calls PyOS_StdioReadline, which isn't thread safe

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

So, could you propose a patch?

--
nosy: +pitrou

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



[issue10363] Embedded python, handle (memory) leak

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Closing as the original issue is fixed. Other leaks should be reported as 
separate issues.

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

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



[issue15809] IDLE console uses incorrect encoding.

2013-05-04 Thread Roger Serwy

Roger Serwy added the comment:

There is a problem. Adding the encoding comment to the top of the source causes 
off-by-one line errors in the traceback.

Take as an example:

 1/0

Traceback (most recent call last):
  File pyshell#0, line 2, in module
ZeroDivisionError: integer division or modulo by zero


--

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch adding a call to gc.collect() after cleaning up most modules, 
with tests.

--
keywords: +patch
nosy: +ncoghlan
stage: commit review - patch review
type: resource usage - enhancement
versions: +Python 3.4 -Python 3.2
Added file: http://bugs.python.org/file30126/gcshutdown.patch

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



[issue2262] Helping the compiler avoid memory references in PyEval_EvalFrameEx

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This avenue doesn't look promising at all. Closing.

--
resolution:  - works for me
stage:  - committed/rejected
status: open - closed

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



[issue17806] Add keyword args support to str/bytes.expandtabs()

2013-05-04 Thread Mark Dickinson

Mark Dickinson added the comment:

 For me s.expandtabs(3) looks more readable than s.expandtabs(tabsize=3).

I disagree:  I think the second is more readable, and I think it's especially 
helpful to those not intimately familiar with the language (which probably 
accounts for the vast majority of Python users) to see code like 
s.expandtabs(tabsize=3), or int(43, base=8), or 
s.splitlines(keepends=True):  such code is instantly understandable, whereas 
someone seeing s.splitlines(True) likely has to stop and wonder what the 
True is doing.

--

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



[issue11406] There is no os.listdir() equivalent returning generator instead of list

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

+1 for iterdir. However, if we get a separate scandir() returning entries with 
attributes, is iterdir() still useful?

--

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



[issue16518] add buffer protocol to glossary

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The attached patch uses bytes-like objects in the error messages.

I'm surprised your patch doesn't touch Python/getargs.c.

--

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



[issue16445] SEGFAULT when deleting Exception.message

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This looks like it is fixed by Mark's commit. Other proposals should go into 
separate issues.

--
nosy: +pitrou
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions:  -Python 3.2, Python 3.3, Python 3.4

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



[issue17705] Fill Character cannot be \0

2013-05-04 Thread Antoine Pitrou

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


--
stage:  - patch review

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



[issue16518] add buffer protocol to glossary

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

FWIW I was grepping for buffer protocol/interface/api, and then double-checking 
for buffer in the resulting files.  Python/getargs.c doesn't seem to mention 
the buffer protocol/interface/api at all.

--

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



[issue14173] PyOS_FiniInterupts leaves signal.getsignal segfaulty

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0201d8fa8bd0 by Antoine Pitrou in branch '2.7':
Issue #14173: Avoid crashing when reading a signal handler during interpreter 
shutdown.
http://hg.python.org/cpython/rev/0201d8fa8bd0

New changeset 0dfd5c7d953d by Antoine Pitrou in branch '3.3':
Issue #14173: Avoid crashing when reading a signal handler during interpreter 
shutdown.
http://hg.python.org/cpython/rev/0dfd5c7d953d

New changeset 753bcce45854 by Antoine Pitrou in branch 'default':
Issue #14173: Avoid crashing when reading a signal handler during interpreter 
shutdown.
http://hg.python.org/cpython/rev/753bcce45854

--
nosy: +python-dev

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



[issue14173] PyOS_FiniInterupts leaves signal.getsignal segfaulty

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This should be fixed now. Thank you for diagnosing this bug!

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 3.4 -Python 3.2

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



[issue6178] Core error in Py_EvalFrameEx 2.6.2

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 As an update (since someone else has this problem) this issue stopped 
 once we converted from centos to archlinux (www.archlinux.org). May be 
 an underlying issue with something in the centos environment. We used 
 the same modules same configuration basically same compilation for
 python.

Ok, let's close this issue then.

--
resolution:  - works for me
stage:  - committed/rejected
status: open - closed

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bb023c3426bc by Brett Cannon in branch 'default':
#17115: Remove what appears to be a useless chunk of code which broke
http://hg.python.org/cpython/rev/bb023c3426bc

--

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue17115] __loader__ = None should be fine

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 97b7bd87c44c by Brett Cannon in branch 'default':
#17115: I hate you MS for not supporting C99.
http://hg.python.org/cpython/rev/97b7bd87c44c

--

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



[issue17289] readline.set_completer_delims() doesn't play well with others

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for reporting this. Do you want to contribute a proper patch? You'll 
find instructions at http://docs.python.org/devguide/

--
nosy: +pitrou
stage:  - needs patch
versions:  -Python 3.2

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



[issue17890] argparse: mutually exclusive groups full of suppressed args can cause AssertionErrors

2013-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Wait a week and see what happens.

--

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



[issue17855] Implement introspection of logger hierarchy

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Perhaps you should explain what the point of this is.

--
nosy: +pitrou

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



[issue17854] symmetric difference operation applicable to more than two sets

2013-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If you take the union/intersection/symmetric difference of n sets, the result 
is a set with all items that appears in one/all/an odd number of the n sets. 
The union and intersection methods actually accept n inputs, because the result 
is obvious, useful, and can be obtained faster that with n-1 binary operations. 
The symmetric_difference method does not, I presume because the result in not 
obvious (but that cuts both ways), not known to be useful, and perhaps would 
not be much faster than than n-1 binary operations.

--

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



[issue11698] Improve repr for structseq objects to show named, but unindexed fields

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for the patch. (Yes, I'm looking at this a bit late :-))

First, there seems to be a problem with the repr() of of.stat() results:

 ./python -c import os; print(os.stat('LICENSE'))
posix.stat_result(st_mode=33204, st_ino=6553619, st_dev=2053, st_nlink=1, 
st_uid=1000, st_gid=1000, st_size=15089, st_atime=1367693898, 
st_mtime=1365264866, st_ctime=1366481591, st_atime=1367693898.528636, 
st_mtime=1365264866.4163036, st_ctime=1366481591.9862735, 
st_atime_ns=1367693898528635928, st_mtime_ns=1365264866416303676, 
st_ctime_ns=1366481591986273627, st_blksize=4096, st_blocks=32, st_rdev=0)

As you see, fields such as st_atime are duplicated.

There are other issues with the patch:

* C variable declarations should always be at the beginning of blocks 
(otherwise it's not C89-compliant)

* C++-style comments (//) are forbidden

* I don't understand in which circumstances 
`Py_TYPE(obj)-tp_members[i-n_unnamed_fields].name` can be NULL

--

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-05-04 Thread Phillip J. Eby

Phillip J. Eby added the comment:

It looks like maybe basic2 should be importing basic, not basic2.
Otherwise, you might as well just import basic2 directly and be done
with it.  ;-)  Likewise, I think indirect should be importing from
indirect2, not from itself?  i.e., I'd expect that test to fail even
with the change.  In addition, even if that is fixed, it's still not
testing a cycle involving util; it's really just testing the same
thing as basic is supposed to be testing.

It also looks as though like the rebinding test doesn't actually test
any rebinding, since nobody ever imports the thing that's rebound.
It's failing for the same reason as the subpackage test.  The
subpackage test looks like a valid test, though - i.e., it's the
basic case correctly implemented as a parent-child cycle.  It's
actually the only one of the tests that tests what it says it does.

--

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



[issue17894] Edits to descriptor howto

2013-05-04 Thread Ned Batchelder

Ned Batchelder added the comment:

I worked with Ezio to make a new patch with the full edits.

I have other ideas for edits to the rest of the document, but we can discuss 
those if you like these...

--
Added file: http://bugs.python.org/file30127/descriptor_howto_2.patch

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



[issue17907] Deprecate imp.new_module() in favour of types.ModuleType

2013-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue17177] Document/deprecate imp

2013-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue17855] Implement introspection of logger hierarchy

2013-05-04 Thread R. David Murray

R. David Murray added the comment:

I think that's what the link in the first message does.  However, as I remember 
Bradon's talk, the short answer is: make it easy to discover (and therefore 
reason about) the hierarchy of logging objects that results from all the 
logging setup calls in an application.

--
nosy: +r.david.murray

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



[issue17908] Unittest runner needs an option to call gc.collect() after each test

2013-05-04 Thread Guido van Rossum

New submission from Guido van Rossum:

It would be nice if there was a command-line option to tell the test runner to 
call gc.collect() after each test.

See https://groups.google.com/d/msg/python-tulip/tstjvOQowIU/IRihc8NCHZUJ -- 
Glyph points out that always doing this is problematic because it slows down 
tests too much; OTOH it's a useful option to have in case you're tracking down 
something that happens (or doesn't happen) when an object is collected (e.g. in 
__del__).

--
components: Library (Lib)
keywords: easy
messages: 188420
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: Unittest runner needs an option to call gc.collect() after each test
type: enhancement
versions: Python 3.4

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



[issue17894] Edits to descriptor howto

2013-05-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Please don't go crazy with this.  I will look at the suggestions and make some 
edits to improve its readability but am not going to change it into a breezy 
conversational style.  Instead, I'll likely put together a separate descriptor 
tutorial that presents an easier on-ramp (in contrast to an authoritative 
document closely tied to the actually implementation details).

--

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



[issue17908] Unittest runner needs an option to call gc.collect() after each test

2013-05-04 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #17534.

--
nosy: +ezio.melotti, michael.foord
stage:  - needs patch

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



  1   2   >