[issue22215] embedded NUL character exceptions

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Simplified a code in getargs.c as suggested by Victor.

--
Added file: 
http://bugs.python.org/file36556/valueerror_embedded_nul_character_3.patch

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread Serhiy Storchaka

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


Removed file: 
http://bugs.python.org/file36556/valueerror_embedded_nul_character_3.patch

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread Serhiy Storchaka

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


Added file: 
http://bugs.python.org/file36557/valueerror_embedded_nul_character_3.patch

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



[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Akima

Akima added the comment:

I just realised that monkeyfart!££ is actually a valid relative path name.  
What I said still holds, just replace monkeyfart!££ with elephant*dung? 
(which contains the invalid characters: *? ).

--

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



[issue22226] Refactor dict result handling in Tkinter

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Terry. Fixed style in two methods, added a summary to Treeview.set() 
docstring and changed returns/sets to return/set. But I disagree with other 
suggestions. Return value of 3-arg call is insignificant implementation detail. 
In any case these changes are irrelevant to this issue.

--
Added file: http://bugs.python.org/file36558/tkinter_splitdict_3.patch

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



[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Akima

Akima added the comment:

eryksun: You have marked this bug as effecting Python 2.7.  When I tested for 
the bug on 2.7.5 the problem didn't show up:

Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import os.path
 os.path.isabs(r\\server)
True
 os.path.isabs(r\\server\share)
True
 os.path.isabs(r\\server\share\folder)
True
 os.path.isabs(r\\server\share\folder\folder)
True


Did you independently test a later release of version 2.7 and find the issue?  
If not, could you remove Python 2.7 from the Versions list.

--

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



[issue13968] Support recursive globs

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Looks good to me!

--

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



[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is the consequence of recent backporting splitdrive() implementation from 
3.x to 2.7.

--

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread STINNER Victor

STINNER Victor added the comment:

The latest patch looks good to me.

--

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



[issue20188] ALPN support for TLS

2014-09-06 Thread Cory Benfield

Cory Benfield added the comment:

Updating to mention a concern with ALPN implementation. HTTP/2 requires that a 
cipher with AEAD be negotiated. However, it also allows for offering a wider 
range of cipher suites: if an AEAD cipher is not present, this will allow 
fallback to HTTP/1.1.

There's some interplay between ALPN and cipher selection here. We'll want to 
ensure that either ALPN negotiation can inform cipher selection or vice-versa, 
or writing a Python HTTP/2 server will get tricky fast.

--

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



[issue22346] asyncio documentation does not mention provisional status

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fefe7822e6b8 by Nick Coghlan in branch '3.4':
Issue #22346: also include asyncio PEP 411 notice in 3.4
http://hg.python.org/cpython/rev/fefe7822e6b8

--

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



[issue22340] Fix Python 3 warnings in Python 2 tests

2014-09-06 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: patch review - resolved

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



[issue22295] Clarify available commands for package installation

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e8447da8791d by Nick Coghlan in branch '3.4':
Issue #22295: Adopt 'python -m pip' as the preferred invocation
http://hg.python.org/cpython/rev/e8447da8791d

New changeset a969b42e6e2b by Nick Coghlan in branch 'default':
Merge issue #22295 fix from 3.4
http://hg.python.org/cpython/rev/a969b42e6e2b

--
nosy: +python-dev

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



[issue22295] Clarify available commands for package installation

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Switched to python -m pip.

To deal with python3 vs python parallel system installs, I made the 
assumption that folks are using virtual environments explicitly, rather than 
diving into the arcana associated with using pip in conjunction with a system 
Python installation.

--
resolution:  - fixed
stage:  - resolved
status: open - closed
versions: +Python 3.4, Python 3.5

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



[issue22343] Install bash activate script on Windows when using venv

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 from me - Vinay?

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Since both paths are valid and both paths refer to the same file, some 
 developers may find this result counterintuitive.

On the other hand the proposed solution is regular. If you input an extended 
path, you get an extended path as output.

There are other factors that can come into play, such as hard links under Unix 
(and perhaps under Windows too). The recommended way to check if two paths 
point to the same file is still os.path.samefile().

Another approach would be for pathlib to *always* use extended paths internally 
on Windows absolute paths; I don't know which side effects that could have, 
though.

Note we could also add methods to switch from the extended to the regular form 
and vice-versa.

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, I think I've found a possible underlying culprit: there's a separate C 
level codec_search_cache on the interpreter object that is independent of 
encodings._cache.

The attached patch eliminates the reference leaks entirely (using 
gc.get_referrers() to get a reference to the otherwise inaccessible internal 
interpreter cache).

However, the patch has a bunch of changes that may not be necessary if that 
cache is dealt with properly, so I'm going to revert everything, and *start* 
with fixing the cache cleanup.

--
Added file: 
http://bugs.python.org/file36559/issue22166_no_leaks_too_many_changes.diff

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Yep, it looks like the mess with the reference cycles in the tracebacks was 
just a secondary problem: the real culprit was the internal cache keeping 
everything else alive.

Attached patch just adds clearing encodings._cache and the CPython internal 
cache to the ExceptionChainingTest.tearDown() method.

The latter is accomplised via gc.get_referrers() and popping the codec's name 
from any dict remaining in that list after clearing the known caches, so it 
will actually handle any hidden name based caches on any interpreter.

--
Added file: 
http://bugs.python.org/file36560/issue22166_clear_internal_cache.diff

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



[issue22348] Documentation of asyncio.StreamWriter.drain()

2014-09-06 Thread Martin Richard

New submission from Martin Richard:

Hi,

Following the discussion on the python-tulip group, I'd like to propose a patch 
for the documentation of StreamWriter.drain().

This patch aims to give a better description of what drain() is intended to do, 
and when to use it. In particular, it highlights the fact that calling drain() 
does not mean that any write operation will be performed, nor is required to be 
called.

--
components: asyncio
files: asyncio-streams-drain-doc.patch
hgrepos: 273
keywords: patch
messages: 226487
nosy: gvanrossum, haypo, martius, yselivanov
priority: normal
severity: normal
status: open
title: Documentation of asyncio.StreamWriter.drain()
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file36561/asyncio-streams-drain-doc.patch

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



[issue22348] Documentation of asyncio.StreamWriter.drain()

2014-09-06 Thread Martin Richard

Changes by Martin Richard mart...@martiusweb.net:


--
hgrepos:  -273

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I'd much rather see a private function somewhere (in the _codecs module) to 
clear that private interpreter cache.

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Yeah, I'm wary of the GC hack as well. It's a nice way to prove that this the 
internal cache is the problem, but probably not something we want to commit.

A codecs._forget_codec helper in the C module would be all that was needed to 
handle it. Other implementations could then also use that to clear their own 
internal cache (if they have one).

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 06.09.2014 15:03, Nick Coghlan wrote:
 A codecs._forget_codec helper in the C module would be all that was needed 
 to handle it. Other implementations could then also use that to clear their 
 own internal cache (if they have one).

If you want to take that approach, please call that function
codecs._clear_lookup_cache() and also add a new C API
_PyCodecRegistry_ClearLookupCache() to Python/codecs.c.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

--
nosy: +lemburg

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



[issue22339] Incorrect behavior when subclassing enum.Enum

2014-09-06 Thread Kiss György

Kiss György added the comment:

I found one thing which you can't do subclassing Enum what you can with 
metaclasses:
enforcing type checking at class creation time. Values are passed to __new__ as 
positional arguments, so it's impossible to tell the difference between these 
two:

class SingleValue(MultiVAlueEnum):
one = 1, 'one'
two = 2


class Tuple(MultiVAlueEnum):
one = 1, 'one'
two = 2,

because in both cases (2,) would be passed. It's not a big deal, but Explicit 
is better than implicit. and also I would like to avoid typos, which I often 
make like this:

class StrValues(MultiValueEnum):
one = ('One'
  'one')
two = ('two',
  'Two')

In this case, the first member would be accepted as 'Oneone' instead of ('One', 
'one') and I see no way to check that without metaclasses. Do you?

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Steve Dower

Steve Dower added the comment:

Actually, I'd be inclined to never use the prefix within pathlib and then add 
it on if necessary when converting to a string. That would also solve a problem 
like:

 p = Path(C:\\) / ('a'*150) / ('a'*150)
 p.stat()
FileNotFoundError: [WinError 3] The system cannot find the path specified: ...
 p2 = Path(?\\ + str(p))
 p2.stat()
os.stat_result(...)

The hardest part about this is knowing with certainty whether it's needed. We 
can certainly detect most cases automatically.

Maybe we also need an extra method or a format character to force a str() with 
prefix? Or maybe having an obvious enough function that people can monkey-patch 
if necessary - the \\?\ prefix is an edge case for most people already, and 
checking the total length would bring that to 99% IME.

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Steve Dower

Steve Dower added the comment:

If anyone wanted to test that really long path, here's the incantation to 
create it:

 import os, pathlib
 os.mkdir(C:\\a)
 os.mkdir(C:\\a\\ + a*150)
 os.rename(C:\\a, C:\\ + a*150)
 p = pathlib.Path(C:\\) / (a*150) / (a*150)

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be just do not use the unique name?

--
nosy: +serhiy.storchaka

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 25032ec29315 by Serhiy Storchaka in branch 'default':
Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
http://hg.python.org/cpython/rev/25032ec29315

--

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-09-06 Thread Guido van Rossum

Guido van Rossum added the comment:

- This bug should discuss doc updates, not question the rules.

- The rules have evolved over time and the docs stayed behind.

- We should definitely update the 2.7 docs as well as the 3.4 and 3.5 (in 
development) docs.  The 2.7 docs need to be different than the 3.x docs.

- The language reference manual should clearly state the rules so that 
implementers can use them as guidelines for implementation.

- There are several sets of relevant rules:

(a) How is each operator translated into a series of lookups and method calls, 
etc.  It's similar to other binary operators except that the reverse for __lt__ 
is __gt__ instead of __rlt__, and there's an extra rule that if __ne__ doesn't 
exist we compute __eq__ and take the opposite.

(b) The default implementation (e.g. default == falls back to 'is',  raises 
TypeError).

(c) The rules for built-in types, especially numbers (if there are still 
special cases that aren't explained by the __xx__ methods on the various 
numeric types).

--
nosy: +gvanrossum

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Victor.

--

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



[issue22215] embedded NUL character exceptions

2014-09-06 Thread Serhiy Storchaka

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


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue22131] uuid.bytes optimization

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Alex, Raymond, could you please make a review of my patch?

--

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



[issue22131] uuid.bytes optimization

2014-09-06 Thread Alex Gaynor

Alex Gaynor added the comment:

Patch looks good to me.

--

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



[issue22226] Refactor dict result handling in Tkinter

2014-09-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

looks good to commit.

--
stage: patch review - commit review

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



[issue22339] Incorrect behavior when subclassing enum.Enum

2014-09-06 Thread Ethan Furman

Ethan Furman added the comment:

You could do the same kind of check in __new__, but consider this:

class StrValues(MultiValueEnum):
one = ('One'
  'one',
   '1')
two = ('two',
  'Two',
   '2')

In this scenario the 'Oneone' mistake would still not be automatically caught.  
There are the two ways I deal with this type of problem:

  - unit tests
  - formatting

The formatting looks like this:

class StrValues(MultiValueEnum):
one = (
'One'
'one',
'1',
)
two = (
'two',
'Two',
'2',
)

This style of format does several things for us:

  - easier to read the code:
 - each value is on it's own line
 - each value is lined up
 - there is white space between the values of one attribute and
   the values of the next attribute

  - easier to read diffs, as we don't see extraneous stuff like

-  '2'
+  '2',

  - easier to spot mistakes, since we get used to seeing that trailing
comma and it's absence will stand out.

--

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



[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c1fb19907cc4 by Serhiy Storchaka in branch '3.4':
Issue #19524: Fixed resource leak in the HTTP connection when an invalid
http://hg.python.org/cpython/rev/c1fb19907cc4

New changeset 43bf95480c3c by Serhiy Storchaka in branch 'default':
Issue #19524: Fixed resource leak in the HTTP connection when an invalid
http://hg.python.org/cpython/rev/43bf95480c3c

--
nosy: +python-dev

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



[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Martin.

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed
type:  - behavior

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



[issue22343] Install bash activate script on Windows when using venv

2014-09-06 Thread Vinay Sajip

Vinay Sajip added the comment:

I have no particular objection to this, and it's not a lot of work to make it 
happen. The POSIX scripts were left out in case the opposite view was advanced 
- that these scripts would be of no use to most people on Windows, and 
shouldn't be there cluttering up the place :-)

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

This investigation also showed why the original tests that used a
non-unique name didn't work: the codec was getting cached the first time
through and hence not seeing the different codecs registered by other tests.

MAL, my plan was to provide an API to forget a specific named codec rather
than flush the whole cache. I agree a private C API would also be a good
idea, though.

--

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



[issue22131] uuid.bytes optimization

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f7b5038d3102 by Serhiy Storchaka in branch 'default':
Issue #22131: Modernized the code of the uuid module.
http://hg.python.org/cpython/rev/f7b5038d3102

New changeset d8c6b15a2ae3 by Serhiy Storchaka in branch '2.7':
Issue #22131: Fixed a bug in handling an error occured during reading from
http://hg.python.org/cpython/rev/d8c6b15a2ae3

New changeset 8a61a287776d by Serhiy Storchaka in branch '3.4':
Issue #22131: Fixed a bug in handling an error occured during reading from
http://hg.python.org/cpython/rev/8a61a287776d

--
nosy: +python-dev

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



[issue22131] uuid.bytes optimization

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Alex.

--
assignee:  - serhiy.storchaka
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue22226] Refactor dict result handling in Tkinter

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7b0fdc1e917a by Serhiy Storchaka in branch '2.7':
Issue #6: Added private function _splitdict() in the Tkinter module.
http://hg.python.org/cpython/rev/7b0fdc1e917a

New changeset f89995a4ec11 by Serhiy Storchaka in branch '3.4':
Issue #6: Added private function _splitdict() in the Tkinter module.
http://hg.python.org/cpython/rev/f89995a4ec11

New changeset 11cf18ec1900 by Serhiy Storchaka in branch 'default':
Issue #6: Added private function _splitdict() in the Tkinter module.
http://hg.python.org/cpython/rev/11cf18ec1900

--
nosy: +python-dev

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



[issue22226] Refactor dict result handling in Tkinter

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Terry for your review.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue22349] Remove more unnecessary version checks from distutils

2014-09-06 Thread Thomas Kluyver

New submission from Thomas Kluyver:

Following on from issue 22200, this removes some more code in distutils that 
checks which Python version it's running on. As part of the standard library, 
distutils should always be running on the version of Python which it ships with.

--
components: Distutils
files: rm-more-distutils-version-checks.patch
keywords: patch
messages: 226510
nosy: dstufft, eric.araujo, takluyver
priority: normal
severity: normal
status: open
title: Remove more unnecessary version checks from distutils
versions: Python 3.5
Added file: 
http://bugs.python.org/file36562/rm-more-distutils-version-checks.patch

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



[issue22200] Remove distutils checks for Python version

2014-09-06 Thread Thomas Kluyver

Thomas Kluyver added the comment:

I've made a patch removing some more of these version checks in issue 22349.

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 06.09.2014 21:14, Nick Coghlan wrote:
 
 This investigation also showed why the original tests that used a
 non-unique name didn't work: the codec was getting cached the first time
 through and hence not seeing the different codecs registered by other tests.
 
 MAL, my plan was to provide an API to forget a specific named codec rather
 than flush the whole cache. I agree a private C API would also be a good
 idea, though.

I don't think such a specific API for only forgetting a single codec
is useful outside this particular test case, since you typically
don't know the names of the cached codecs.

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, the point here is to add a private API just for our test suite, not 
something users would want to call.

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I'd be inclined to never use the prefix within pathlib and then add it on if 
 necessary when converting to a string

That may be very surprising when that prefix appears, though... At least with 
explicit methods the user would have to invoke them, instead of getting 
unexpected results implicitly.

I don't know what Windows users think about all this, though (I uses Linux 
myself).

--

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



[issue22323] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm... sorry for the delay, there's no review link. Perhaps the patch is not 
against the latest default?

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Steve Dower

Steve Dower added the comment:

It's no less expected than having OS functions fail because the path is too 
long.

Using it to maintain dots at the end of directory/file names is a little less 
safe and may break some code. Maybe pathlib should strip these if there is no a 
prefix? (For example, C:\Test. == C:\Test == \\?\C:\Test != 
\\?\C:\Test.)

If most (or all) of the file handling functions in Python are using *W() APIs 
and can support the prefix, I'd rather add it in silently if only to avoid the 
long path issue. It's really the sort of implementation detail that pathlib 
should be able to hide from the app developer and the user (Node.js does this, 
for example, as its node_modules hierarchies regularly exceed the max path 
limitation).

Maybe the best approach is to preserve the prefix if it already exists, and add 
it if it becomes necessary. File operations are most likely to succeed in this 
case, even if it may be surprising to users.

--

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



[issue22324] Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()

2014-09-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The cache is released when the string is released. While the string exists it's 
wchar_t representation can be needed again. That is for what the cache exists.

--

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



[issue22349] Remove more unnecessary version checks from distutils

2014-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7fece97e605d by Benjamin Peterson in branch '3.4':
remove various dead version checks (closes #22349)
http://hg.python.org/cpython/rev/7fece97e605d

New changeset 688701337b1a by Benjamin Peterson in branch 'default':
merge 3.4 (#22349)
http://hg.python.org/cpython/rev/688701337b1a

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 If most (or all) of the file handling functions in Python are using *W() APIs 
 and can support the prefix, I'd rather add it in silently if only to avoid 
 the long path issue.

This would only work for fully-qualified paths, right? Not relative ones.

I'm all for making things higher-level, I just want to make sure it won't break 
existing use cases :-)

--

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



[issue22166] test_codecs leaks references

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Targeted API to forget a particular codec name.

Normally we don't care about the caching (as evidenced by the fact it took 14+ 
years to want this feature).

The intent with this API is to be able to selective purge a particular codec 
when we either care about getting the latest version of a specific codec (no 
current use cases) or to avoid the appearance of leaking references when 
looking up lots of custom codecs (this case).

I considered dropping the per-test naming scheme, but decided I liked the fact 
it kept these test instances orthogonal, even though they all use the shared 
TEST_CODECS registry. The lack of global side effects is also a benefit of just 
popping the named codec, rather than purging the entire cache.

--
Added file: 
http://bugs.python.org/file36563/issue22166_with_forget_codec_helper_api.diff

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



[issue5309] distutils doesn't parallelize extension module compilation

2014-09-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch:
- add the -j option to the build command as well (even though it's only used 
by build_ext)
- in setup.py, only force parallel compilation if make was called with -j

--
Added file: http://bugs.python.org/file36564/build_ext_parallel5.patch

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-09-06 Thread Martin Panter

Martin Panter added the comment:

The point about “a != b” deferring to “not a.__eq__(b)” is not documented 
anywhere that I am aware of. In fact the opposite is currently documented at 
https://docs.python.org/release/3.4.0/reference/datamodel.html#richcmpfuncs, 
so maybe this needs to be fixed, one way or another.

--

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



[issue5309] distutils doesn't parallelize extension module compilation

2014-09-06 Thread Antoine Pitrou

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


--
stage: needs patch - patch review

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



[issue5309] distutils doesn't parallelize extension module compilation

2014-09-06 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

- Is support for infinite jobs planned?
  (GNU make supports it for -j without number argument.)

- self.parallel = int(self.parallel) would raise ValueError when a non-number 
is passed. I suggest to print user-friendly error message.

--

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-06 Thread Steve Dower

Steve Dower added the comment:

 This would only work for fully-qualified paths, right? Not relative ones.

Correct, and I think we're most of the way there with how drives are handled. 
Since the prefix only works with absolute paths, why not treat it as part of 
the drive name?

--

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



[issue11572] bring Lib/copy.py to 100% coverage

2014-09-06 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
components: +Library (Lib)
nosy: +berker.peksag
type:  - enhancement
versions: +Python 3.5 -Python 3.3

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



[issue11822] Improve disassembly to show embedded code objects

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Sorry for the long delay in doing anything with this patch. Unfortunately, 
trunk has moved on quite a bit since this patch was submitted, and it's no 
longer directly applicable.

However, the basic principle is sound, so this is a new patch that aligns with 
the changes made in 3.4 to provide an iterator based bytecode introspection 
API. It also changes the indenting to be based on the structure of the bytecode 
disassembly - nested lines start aligned with the opcode *name* on the 
preceding line. This will get unreadable with more than two or three levels of 
nesting, but at that point, hard to read disassembly for the top level function 
is the least of your worries. (A potentially useful option may to be add a flag 
to turn off the implicit recursion, easily restoring the old single level 
behaviour. I'd like the recursive version to be the default though, since it's 
far more useful given that Python 3 comprehensions all involve a nested code 
object)

A descriptive header makes the new output more self-explanatory. Note that I 
did try repeating the code object repr from the LOAD_CONST opcode in the new 
header - it was pretty unreadable, and redundant given the preceding line of 
disassembly.

Two examples, one showing Torsten's list comprehension from above, and another 
showing that the nested line numbers work properly.

This can't be applied as is - it's still missing tests, docs, and fixes to 
disassembly output tests that assume the old behaviour.

 dis.dis('[x**2 for x in range(3)]')
  1   0 LOAD_CONST   0 (code object listcomp at 
0x7f459ec4a0c0, file dis, line 1)
Disassembly for nested code object
  1   0 BUILD_LIST   0
  3 LOAD_FAST0 (.0)
6 FOR_ITER16 (to 25)
  9 STORE_FAST   1 (x)
 12 LOAD_FAST1 (x)
 15 LOAD_CONST   0 (2)
 18 BINARY_POWER
 19 LIST_APPEND  2
 22 JUMP_ABSOLUTE6
   25 RETURN_VALUE
  3 LOAD_CONST   1 ('listcomp')
  6 MAKE_FUNCTION0
  9 LOAD_NAME0 (range)
 12 LOAD_CONST   2 (3)
 15 CALL_FUNCTION1 (1 positional, 0 keyword pair)
 18 GET_ITER
 19 CALL_FUNCTION1 (1 positional, 0 keyword pair)
 22 RETURN_VALUE
 def f():
... print(Hello)
... def g():
... for x in range(10):
... yield x
... return g
... 
 dis.dis(f)
  2   0 LOAD_GLOBAL  0 (print)
  3 LOAD_CONST   1 ('Hello')
  6 CALL_FUNCTION1 (1 positional, 0 keyword pair)
  9 POP_TOP

  3  10 LOAD_CONST   2 (code object g at 0x7f459ec4a540, 
file stdin, line 3)
Disassembly for nested code object
  4   0 SETUP_LOOP  25 (to 28)
  3 LOAD_GLOBAL  0 (range)
  6 LOAD_CONST   1 (10)
  9 CALL_FUNCTION1 (1 positional, 0 keyword 
pair)
 12 GET_ITER
   13 FOR_ITER11 (to 27)
 16 STORE_FAST   0 (x)

  5  19 LOAD_FAST0 (x)
 22 YIELD_VALUE
 23 POP_TOP
 24 JUMP_ABSOLUTE   13
   27 POP_BLOCK
   28 LOAD_CONST   0 (None)
 31 RETURN_VALUE
 13 LOAD_CONST   3 ('f.locals.g')
 16 MAKE_FUNCTION0
 19 STORE_FAST   0 (g)

  6  22 LOAD_FAST0 (g)
 25 RETURN_VALUE

--
Added file: http://bugs.python.org/file36565/issue11822_nested_disassembly.diff

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



[issue22350] nntplib file write failure causes exception from QUIT command

2014-09-06 Thread Martin Panter

New submission from Martin Panter:

The following code triggers an NNTPProtocolError, as long as the body is large 
enough to cause an intermediate flush of the output file. The reason I think is 
that the body() method aborts in the middle of reading the BODY response, and 
when the context manager exits, a QUIT command is attempted, which continues to 
read the BODY response.

 with NNTP(localhost) as nntp:
... nntp.body(example, file=/dev/full)
... 
Traceback (most recent call last):
  File /usr/lib/python3.4/nntplib.py, line 491, in _getlongresp
file.write(line)
OSError: [Errno 28] No space left on device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 2, in module
  File /usr/lib/python3.4/nntplib.py, line 757, in body
return self._artcmd(cmd, file)
  File /usr/lib/python3.4/nntplib.py, line 727, in _artcmd
resp, lines = self._longcmd(line, file)
  File /usr/lib/python3.4/nntplib.py, line 518, in _longcmd
return self._getlongresp(file)
  File /usr/lib/python3.4/nntplib.py, line 504, in _getlongresp
openedFile.close()
OSError: [Errno 28] No space left on device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 2, in module
  File /usr/lib/python3.4/nntplib.py, line 367, in __exit__
self.quit()
  File /usr/lib/python3.4/nntplib.py, line 936, in quit
resp = self._shortcmd('QUIT')
  File /usr/lib/python3.4/nntplib.py, line 512, in _shortcmd
return self._getresp()
  File /usr/lib/python3.4/nntplib.py, line 459, in _getresp
raise NNTPProtocolError(resp)
nntplib.NNTPProtocolError: line of data from BODY command

It is hard to work around because the context manager and quit() methods seem 
to be the only public interfaces for closing the connection, and they both try 
to do a QUIT command first. I am thinking of something equivalent to this for a 
workaround, however it is bit hacky and may not be reliable in all cases:

nntp = NNTP(localhost)
abort = False
try:
...
try:
nntp.body(example, file=/dev/full)
except (NNTPTemporaryError, NNTPPermanentError):
raise  # NNTP connection still intact
except:
abort = True
raise
...
finally:
try:
nntp.quit()
except NNTPError:
# Connection cleaned up despite exception
if not abort:
raise

Perhaps the “nntplib” module could abort the connection itself if any command 
does not complete according to the protocol. Or at the very least, provide an 
API to manually abort the connection without poking at the internals.

--
components: Library (Lib)
messages: 226526
nosy: vadmium
priority: normal
severity: normal
status: open
title: nntplib file write failure causes exception from QUIT command
versions: Python 3.4

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



[issue21468] NNTPLib connections become corrupt after long periods of activity

2014-09-06 Thread Martin Panter

Martin Panter added the comment:

Perhaps this is similar to Issue 22350 which I just raised. Whenever the NNTP 
context manager exits, a QUIT command is called, and if the context manager is 
exiting due to a protocol error or some other exception not handled by the 
protocol, the code will try and read other protocol data as the QUIT response.

Perhaps your code was interrupted in the middle of reading a yEnc binary body 
and that is why it looks like garbage?

--
nosy: +vadmium

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



[issue22351] NNTP constructor exception leaves socket for garbage collector

2014-09-06 Thread Martin Panter

New submission from Martin Panter:

If the nntplib.NNTP constructor fails, it often leaves the connection and 
socket open until the garbage collector cleans them up and emits a 
ResourceWarning:

 try:
... NNTP(localhost)
... except Exception as err:
... print(repr(err))
... 
NNTPTemporaryError('400 Service temporarily unavailable',)
 gc.collect()
__main__:1: ResourceWarning: unclosed socket.socket fd=3, 
family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, 
laddr=('127.0.0.1', 54819), raddr=('127.0.0.1', 119)
12

This happens both for error responses that are expected by the protocol, e.g. 
service unavailable as above, authentication errors. It also happens for other 
exceptions such as EOFError if the connection is closed with no response.

--
components: Library (Lib)
messages: 226528
nosy: vadmium
priority: normal
severity: normal
status: open
title: NNTP constructor exception leaves socket for garbage collector
type: resource usage
versions: Python 3.4

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2014-09-06 Thread Guido van Rossum

Guido van Rossum added the comment:

That's a pretty new feature. Someone probably forgot to clean up all the
places where it was documented.

On Sat, Sep 6, 2014 at 4:18 PM, Martin Panter rep...@bugs.python.org
wrote:


 Martin Panter added the comment:

 The point about “a != b” deferring to “not a.__eq__(b)” is not documented
 anywhere that I am aware of. In fact the opposite is currently documented
 at 
 https://docs.python.org/release/3.4.0/reference/datamodel.html#richcmpfuncs,
 so maybe this needs to be fixed, one way or another.

 --

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


--

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



[issue22352] Ensure opcode names and args fit in disassembly output

2014-09-06 Thread Nick Coghlan

New submission from Nick Coghlan:

While exploring display options for issue 11822, I found that the new matrix 
multiplication opcode names (BINARY_MATRIX_MULTIPLY and 
INPLACE_MATRIX_MULTIPLY) don't fit in the nominal field width in the 
disassembly output (which is currently 20 characters).

These two clock in at 22 and 23 characters respectively.

In practice, they do fit, since neither takes on argument, which effectively 
allows an extra 5 characters (while still looking neat) and unlimited 
characters if we ignore expanding past the column of opcode arguments.

However, it would be good to:

1. Factor out the opname and oparg sizes to private class attributes on 
dis.Instruction

2. have a test in test_dis that scans dis.opnames and ensures all opcodes  
dis.HAVE_ARGUMENT have names shorter than the combined length of the two 
fields, and that all opcodes = HAVE_ARGUMENT will fit in the opname field, 
even with an argument present.

Have such a test will ensure any new opcodes added can be displayed without any 
problems, rather than anyone having to remember to check manually.

--
assignee: ncoghlan
components: Library (Lib)
messages: 226530
nosy: ncoghlan
priority: low
severity: normal
status: open
title: Ensure opcode names and args fit in disassembly output
type: behavior
versions: Python 3.5

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



[issue11822] Improve disassembly to show embedded code objects

2014-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

I didn't want to add a second argument to turn off the new behaviour, so I 
changed it such that passing a value  0 for nested turns off the new feature 
entirely. Levels = 0 enable it, defining which level to start with. The 
default level is 0 so there's no implied prefix, and nested code objects are 
displayed by default. This picks up at least comprehensions, lambda expressions 
and nested functions. I haven't checked how it handles nested classes yet.

I used this feature to get the old tests passing again by turning off the 
recursion feature. New tests for the new behaviour are still needed.

I also tweaked the header to show the *name* of the code object. The full repr 
is to noisy, but the generic message was hard to read when there were multiple 
nested code objects.

--
Added file: 
http://bugs.python.org/file36566/issue11822_nested_disassembly_with_off_switch.diff

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