[issue23323] Issue with imaplib and append messages passing a tuple with flags

2015-01-26 Thread Eric V. Smith

Eric V. Smith added the comment:

flags is supposed to be a string. This is not well documented, like much of the 
module.

Try:
flags = r'(\Answered \Seen)'

--
nosy: +eric.smith

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



[issue23323] Issue with imaplib and append messages passing a tuple with flags

2015-01-26 Thread R. David Murray

R. David Murray added the comment:

Indeed, as with much of the early email related code in the stdlib, the 
documentation assumes way too much familiarity with the relevant RFC...which is 
really hard to read.  We should add a few more details to the docs (like FLAGS 
being a string) even if we don't have the resources to do a full overhaul.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, r.david.murray
stage:  - needs patch
versions: +Python 3.4, Python 3.5

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



[issue23323] Issue with imaplib and append messages passing a tuple with flags

2015-01-26 Thread Alessio

New submission from Alessio:

In example when appending a message with more than one flag in a tuple with 
imaplib:

print flags
('\\Answered', '\\Seen')

connection.append('INBOX', flags, date, msg)


---
TypeError Traceback (most recent call last)
ipython-input-42-832414ffe4b5 in module()
 1 connection.append('INBOX', flags, date, msg[1][0][1])

/usr/lib/python2.7/imaplib.py in append(self, mailbox, flags, date_time, 
message)
326 if flags:
327 if (flags[0],flags[-1]) != ('(',')'):
-- 328 flags = '(%s)' % flags
329 else:
330 flags = None

TypeError: not all arguments converted during string formatting


When I have only one flag to append:

print flags
Out[70]: ('\\Answered',)

connection.append('INBOX', flags, date, msg)
Out[74]: ('OK', ['[APPENDUID 1 1012] APPEND completed'])

Any ideas?

Thanks

--
components: Library (Lib)
messages: 234738
nosy: Pilessio
priority: normal
severity: normal
status: open
title: Issue with imaplib and append messages passing a tuple with flags
versions: Python 2.7

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



[issue23293] [Windows] asyncio: race condition related to IocpProactor.connect_pipe()

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 99c3e304a4ea by Victor Stinner in branch '3.4':
Issue #23293, asyncio: Rewrite IocpProactor.connect_pipe() as a coroutine
https://hg.python.org/cpython/rev/99c3e304a4ea

--

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Ezio for your review. Updated patch includes most of your 
suggestions. But I think some places still can be dim.

--
Added file: 
http://bugs.python.org/file37863/re_deprecate_split_zero_width_3.patch

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



[issue14910] argparse: disable abbreviation

2015-01-26 Thread Rémi Rampin

Changes by Rémi Rampin remiram...@gmail.com:


--
nosy: +remram

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



[issue23057] [Windows] asyncio: support signal handlers on Windows (feature request)

2015-01-26 Thread STINNER Victor

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


--
title: asyncio loop on Windows should stop on keyboard interrupt - [Windows] 
asyncio: support signal handlers on Windows (feature request)
type: behavior - enhancement

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 tb = TracebackException(*sys.exc_info, lookup_lines=False)

You don't need an exception tuple in Python 3, the exception instance is enough.

--

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



[issue23208] asyncio: add BaseEventLoop._current_handle (only used in debug mode)

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

I commited  current_handle.patch. It's only a first step, I will also change 
the logger or calls to the logger to use this traceback of the current handle.

--
resolution:  - fixed
status: open - closed

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



[issue23046] asyncio.BaseEventLoop is documented, but only exported via asyncio.base_events

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

Since there is already an open issue suggesting to document AbstractServer (and 
Server), I close this issue.

The original bug was fixed: BaseEventLoop is now part of the asyncio namespace.

--
resolution:  - fixed
status: open - closed

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread Ethan Furman

Ethan Furman added the comment:

it does seem a bit odd -- on the other hand, %s is an alias for %b, is 
deprecated for new 3-only code, and this might help serve as a reminder of that.

Or we could fix it.  ;)

--

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



[issue23187] Segmentation fault, possibly asyncio related

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

Since the issue looks to be related to a third party module (ujson), I close 
this issue.

Note: On UNIX, asyncio is fully implemented in Python, I don't see how it could 
corrupt internal Python structures.

--
resolution:  - not a bug
status: open - closed

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

 def f(a, *b): print(list(a), list(b))

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

Is this correct?

 f(*i for i in ['abc', 'def'])
['a', 'b', 'c', 'd', 'e', 'f'] []
 f(**i for i in ['abc', 'def'])
  File stdin, line 1
f(**i for i in ['abc', 'def'])
^
SyntaxError: invalid syntax

Should neither work?  Both?

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Martin Richard

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


--
nosy: +martius

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-01-26 Thread Demian Brecht

Demian Brecht added the comment:

Thanks for the extra effort on this to satisfy multiple people's opinions. It's 
never an easy thing, especially when dealing with a decentralized group. My 
following comments are largely based on the public API. I haven't done a full 
review of the changes made to the tests.


All extraneous spaces should be removed. For example the first line here:

+
+redirect_path = self._redirect_path(path)
+if redirect_path:


 Lists the files we want the server to check and render to client. We can 
 add/remove file names as required. Order of files denotes priority. Defaults 
 to ['index.htm', 'index.html']

I think this might read a little better as:

Overridable index files. If any of these files are present in a request 
pointing to a directory on the server's file system, the contents of the file 
will be returned. Otherwise, a directory listing will be returned. Defaults to 
['index.htm', 'index.html']. Order of files denotes priority.

That said, I'm not a wordsmith so there may be a (much) better way of 
structuring this.

 +class HTTPStatusType(Enum):

This doesn't sit quite well with me and I think it really should be removed. 
There are very few cases (if any) that I can think of where this would be 
useful. Cases where I've encountered the need for a range check generally is 
around subsets (i.e. 200 and 201 mean entirely different things and /shouldn't/ 
be globbed together). Additionally (this is subjective), I find it a little 
strange that the value of an enum is a range.

If for some reason it stays, I think the values should at least be sets 
allowing for O(1) lookup.

 +def redirect(self, url, status=HTTPStatus.MOVED_PERMANENTLY):

There should be an assertion in this block that the status is one of the 
redirect codes (301, 302, 308). Calling redirect('/foo', status=200) doesn't 
make sense.

+ if os.path.isfile(path):
 +return self.get_file(path)
 +
 +# `path` has file with filename in self.index_files
 +for index_file in self.index_files:
 +index = os.path.join(path, index_file)

Before the directory-related logic executes, you could add a check in for 
isdir() and short circuit with a 404 rather than relying on an index file not 
being found and then running into list_directory(), which would result in a 404 
with the message No permission to list directory, which isn't actually 
correct in the case where the directory doesn't exist.

 get_status_type, apply_success_headers, apply_headers

I think that these three methods should be removed as they're superfluous, make 
the code less readable and is inconsistent with how responses and headers are 
sent throughout the rest of server.py. The general practice is:

self.send_response()
self.send_header()
self.send_header()
self.end_headers()

The code in this patch should match that.

get_status_type is not needed as it /should/, if anything, be a single line 
passthrough to a reverse lookup mapping. Iterating over each enum followed by 
an iteration over each value is not optimal behaviour (O(N) rather than O(1)).

--

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



[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e124aab5d9a0 by Victor Stinner in branch 'default':
Issue #15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and
https://hg.python.org/cpython/rev/e124aab5d9a0

--
nosy: +python-dev

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset db7ec64aac39 by Victor Stinner in branch 'default':
Issue #20284: Fix a compilation warning on Windows
https://hg.python.org/cpython/rev/db7ec64aac39

--

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-01-26 Thread Demian Brecht

Demian Brecht added the comment:

 now I’m thinking that should be up to the higher level user

+1. A closed connection is a closed connection, whether it's persistent or not. 
The higher level code should be responsible for the context, not the connection 
level.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Guido van Rossum

Guido van Rossum added the comment:

Both.
On Jan 26, 2015 8:42 AM, Neil Girdhar rep...@bugs.python.org wrote:


 Neil Girdhar added the comment:

 Is this correct?

  f(*i for i in ['abc', 'def'])
 ['a', 'b', 'c', 'd', 'e', 'f'] []
  f(**i for i in ['abc', 'def'])
   File stdin, line 1
 f(**i for i in ['abc', 'def'])
 ^
 SyntaxError: invalid syntax

 Should neither work?  Both?

 --

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


--

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



[issue23316] Incorrect evaluation order of function arguments with *args

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

After thinking about this a bit more, my suggestion is not to fix it.  Instead, 
I suggest that PEP 8 be modified to suggest that all positional arguments and 
iterable argument unpackings precede keyword arguments and keyword argument 
unpackings.  Then, a tool like autopep8 is free to reorganize argument lists.  
Such reorganization will not be possible if f(*a(), b=b()) is different than 
f(b=b(), *a()).

--

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



[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

I applied fix_unicode_v2.diff to Python 3.5.

For older Python versions, it's easy to workaround this issue: ensure 
explicitly that your object is a Unicode object using PyUnicode_Check().

You may write your function to call PyUnicode_EncodeFSDefault() with a 
PyUnicode_Check() check.

I prefer to not touch the stable 3.4 branch.

--
resolution: remind - fixed
status: open - closed
versions:  -Python 3.4

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Joshua Landau

Joshua Landau added the comment:

Quick-fix for Guido's bug attached. I'm not familiar with this part of the 
code, yet, so take this tentatively. I just changed

while (containers  1) {

to

while (containers) {

---

@Guido

My comments were assuming `f(**x for x in y)` meant `f({**x for x in y})`.

I see your reasoning, but I don't like how your version has

 (x for y in z for x in y) ==  (*y for y in z)
f(x for y in z for x in y) != f(*y for y in z)

This seems like a tripping point. I've never wanted to unpack a 2D iterable 
into an argument list, so personally I'm not convinced by the value-add either.

--
Added file: http://bugs.python.org/file37866/starunpack19.diff

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Nick Coghlan

Nick Coghlan added the comment:

I put some detailed comments in the review, but my main large scale concern is 
with the traceback.Frame name. Making frame object an ambiguous phrase 
seems like a bad idea to me, so I've suggested making it FrameSummary (or 
FrameInfo, but on reflection I prefer the more explicit term). That would 
then suggest also making it traceback.StackSummary for consistency.

I think having the top level API be an iterable would be OK, but may be a 
little surprising. Is there a major advantage to avoiding building the whole 
traceback in memory?

--

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



[issue21076] Turn signal.SIG* constants into enums

2015-01-26 Thread Ethan Furman

Ethan Furman added the comment:

I know nothing about this part of CPython, but wouldn't the correct solution be 
to not compare by identity?

--

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



[issue23316] Incorrect evaluation order of function arguments with *args

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

(I also suggest that the evaluation order within a function argument list to be 
defined to be positional and iterable before keyword, otherwise left-to-right — 
rather than strictly left-to-right).

--

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



[issue21076] Turn signal.SIG* constants into enums

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And more, as far as standard signal handler is tested for identity, 
signal.SIG_DFL and _signal.SIG_DFL should be the same object. Current code 
works only due to coincidence of two circumstances:

1) Small integers are cached in CPython.
2) SIG_DFL and SIG_IGN are small integers on common platforms.

When small integer caching is disabled (NSMALLPOSINTS == NSMALLPOSINTS == 0) or 
when platform depended macros SIG_DFL and SIG_IGN are not small integers, the 
signal module will mystically fail.

The simplest way to solve this issue is to backout turning SIG_DFL and SIG_IGN 
into enums.

--
resolution: fixed - 
stage: resolved - patch review
type:  - behavior
Added file: http://bugs.python.org/file37865/signal_no_enum_handlers.patch

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 26/01/2015 19:36, Robert Collins a écrit :
 
 Two key notes: the use of an exception triple is useful to ease
backports of this

Then I'd recommend making it exception-or-tuple (rather than a
*exc_info), so that both situations are satisfied.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Joshua Landau

Joshua Landau added the comment:

Update for the error messages fix.

I've put aside the idea of unifying things for now because there are a couple 
of interdependencies I wasn't expecting and I absolutely don't want the 
fast-path for f(x) to get slower.

--
Added file: http://bugs.python.org/file37867/starunpack20.diff

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

Could you help me understand this a bit better?

I always thought of f(x for x in l) as equivalent to f( (x for x in l) ).

So, I can see that f(*x for x in l) should be equivalent to f( (*x for x in l) 
).

How should we interpret f(**x for x in l)?  Is it then f( {**x for x in l} )?

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Guido van Rossum

Guido van Rossum added the comment:

So I think the test function here should be:

  def f(*a, **k): print(list(a), list(k))

Then we can try things like:

  f(x for x in ['ab', 'cd'])

which prints a generator object, because this is interpreted as an argument 
that's a generator expression.

But now let's consider:

  f(*x for x in ['ab', 'cd'])

I personally expected this to be equivalent to:

  f(*'ab', *'cd')

IOW:

  f('a', 'b', 'c', 'd')

However, it seems your current patch (#18) interprets it as still passing a 
single argument which is the generator expression (*x for x in ['ab', 'cd']) 
which in turn is equivalent to iter(['a', 'b', 'c', 'd']), IOW f() is called 
with a single argument that is a generator.

The PEP doesn't give clarity on what to do here.  The question now is, should 
we interpret things like *x for x in ... as an extended form of generator 
expression, or as an extended form of *arg?  I somehow think the latter is more 
useful and also the more logical extension.

My reasoning is that the PEP supports things like f(*a, *b) and it would be 
fairly logical to interpret f(*x for x in xs) as doing the *x thing for each x 
in the list xs.

I think this same interpretation works for [*x for x in xs] and {*x for x in 
xs}, and we can also extend it to ** in {} and in calls (obviously ** has no 
meaning in list comprehensions or generator expressions).

BTW I think I found another bug in patch #18:

   {**1}
  1
   

That should be an error.

An edge case I'm not sure about: should {**x} accept an iterable of (key, 
value) pairs, like dict(x)?

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

Thanks for the review - shall action it all as it seems all good improvements.

Two key notes: the use of an exception triple is useful to ease backports of 
this: a primary goal for me is being able to use the locals stuff in unittest 
for existing production code bases like OpenStack: there's a balance to be 
struck between new shiny features like __traceback__ and backporting. I'll 
consider the idea of value-or-triple; if all the consuming code is going to be 
using the triple interface I'm not sure the value one would, drumroll please, 
have value.

The locals stuff is as you note not complete or exposed yet. I wanted it in the 
design to be able to vet that it will actually be feasible without a later API 
break. I'm not -quite- there but I do also agree that it doesn't need to be in 
the output layer yet (in fact there's a different ticket for that anyway).

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Guido van Rossum

Guido van Rossum added the comment:

Let's wait until I have a keyboard. In 20 min.
On Jan 26, 2015 8:55 AM, Guido van Rossum gu...@python.org wrote:

 Wait, with that f() definition I'd expect a different result from the
 former -- each letter as a new arg. Right?
 On Jan 26, 2015 8:42 AM, Neil Girdhar rep...@bugs.python.org wrote:


 Neil Girdhar added the comment:

  def f(a, *b): print(list(a), list(b))

 --

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



--

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



[issue23095] [Windows] asyncio: race condition when cancelling a _WaitHandleFuture

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

Pseudo-code:
---
handle = ...
fut = proactor.wait_for_handle(handle)
fut.cancel()
loop.close()
---

Windows functions called in this code:

- A: call RegisterWaitForSingleObject() on an handle
- A: call UnregisterWaitEx() with an event
- B: call RegisterWaitForSingleObject() on this event
- B: the wait on this event completes: the completion is signaled with 
PostToQueueCallback() (our internal callback passed to 
RegisterWaitForSingleObject())
- A: _unregister_wait_cb() is called on the future A
- (but the wait on the object A is never signaled by PostToQueueCallback())

In short, UnregisterWaitEx() is called before the callback passed to 
RegisterWaitForSingleObject() is called. In this case, the callback is never 
called, and so the completion of the wait is never signaled.

Internally, RegisterWaitForSingleObject() is implemented as a pool of threads 
calling WaitForMultipleObjects(). The default limit for the pool is 500 
threads. WaitForMultipleObjects() is limited to 64 objects. Each thread uses a 
timer and computes a timeout. The timer is awaken to cancel a wait.

--

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch includes Ezio's suggestions. Thank you Ezio, they looks great to 
me.

--
Added file: 
http://bugs.python.org/file37864/re_deprecate_split_zero_width_4.patch

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Guido van Rossum

Guido van Rossum added the comment:

Wait, with that f() definition I'd expect a different result from the
former -- each letter as a new arg. Right?
On Jan 26, 2015 8:42 AM, Neil Girdhar rep...@bugs.python.org wrote:


 Neil Girdhar added the comment:

  def f(a, *b): print(list(a), list(b))

 --

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


--

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



[issue23317] Incorrect description of descriptor invocation in Python Language Reference

2015-01-26 Thread Justin Eldridge

Justin Eldridge added the comment:

Ah, I see how writing a description of this which is both concise and precise
would be difficult, especially for Python 2.

 But the Class Binding description is correct, since if the __get__ method is
 *not* defined on the type (of the descriptor), the descriptor instance itself
 is returned (so explicitly calling type in the equivalent expression would 
 be
 wrong)

I see, but couldn't this also be held against the current equivalent?  That
is, saying A.x is equivalent to A.__dict__['x'].__get__(None, A) is not stricly
true when __get__ isn't defined on type(x).

I think I see now why this is difficult to document cleanly, and the Special
method lookup section of the documentation does a good job of explaining this.
The issue isn't exclusive to descriptors. It affects, for example, the
documentation on rich comparison operators, which says that x == y invokes
x.__eq__(y), when this hasn't quite been true since old-style classes.

So saying x == y is equivalent to x.__eq__(y) isn't really correct, and saying
that it is equivalent to type(x).__eq__(x,y) isn't quite right either, as
implicit invocation may bypass the metaclass's __getattribute__. The latter,
however, seems less wrong. Is there a reason that the former is preferred by
the documentation?

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Guido van Rossum

Guido van Rossum added the comment:

@Joshua: Re: f(x: y for x, y in z)

I don't think that follows at all.

We support f(**d) now, but if d == {'a': 1, 'b': 2}, it is equivalent to f(a=1, 
b=2), not f(a: 1, b: 2).

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Joshua Landau

Joshua Landau added the comment:

If we're supporting

f(**x for x in y)

surely we should also support

f(x: y for x, y in z)

I personally don't like this idea.

--

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



[issue23324] Python 3.4.2 running slow on Ubuntu 14.10

2015-01-26 Thread Alan Yorinks

New submission from Alan Yorinks:

Folks,
   I am not trying to waste anyone's time.  If this is not the correct mailing 
list to get this problem resolved, please point me to the correct one.

   To summarize my problem, if I run the configuration below with python 3.4.2 
on Linux, the program reacts to user input (changing a potentiometer) extremely 
slowly. If I run the exact same code on Windows, there is no slow down. Also, 
if I run the exact same setup using pypy 3.2.4, there is no slowdown.

   I also tried running the software on pypy 3.2.4 on Linux and there is no 
slowdown. The only problem I encounter is using Python 3.4.2 on Linux. Python 
2.7.8 works without issue on both Linux and Windows.

   The setup to reproduce the problem is not complicated but requires PyMata to 
be installed on an Arduino Uno or Leonardo attached to the computer.

Prerequisites:
OS: Ubuntu Linux 14.10.
   Python: 3.4.2
   PyMata 2.02 or can be installed from PyPi
   Requires PySerial 2.7
   Arduino Uno or Leonardo microcontroller with StandardFirmata installed.
  
   Program to be executed: located in the PyMata/examples/digital_analog_io 
directory. The file is polling_digital_analog_io.py.

How the problem exhibits itself:
   When adjusting the potentiometer to set the intensity level of the LED, the 
intensity level greatly lags the pot adjustment. On Python 2.7 on Linux and 
Windows, on Python 3.4.2 on Windows, and on pypy3.2.4 on Linux, there is no lag 
and the program behaves as expected.

   The only variable is the Linux version of Python 3.4.2, so it is my belief 
that python 3.4.2 for linux has issues. I will be happy to provide any 
additional information to help resolve this. Again if this is the wrong mailing 
list, please point me to the correct one.

--
components: Interpreter Core
messages: 234774
nosy: MrYsLab
priority: normal
severity: normal
status: open
title: Python 3.4.2 running slow on Ubuntu 14.10
versions: Python 3.4

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



[issue23095] [Windows] asyncio: race condition when cancelling a _WaitHandleFuture

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 36e80c6599aa by Victor Stinner in branch '3.4':
Issue #23095, asyncio: Fix _WaitHandleFuture.cancel()
https://hg.python.org/cpython/rev/36e80c6599aa

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

And for profit, review changes applied (minus the small number I disagreed 
with). I've clarified in the code why the exc_info tuple break out is still 
used (compat with the legacy API is the strongest argument).

I haven't fleshed out the locals thing properly yet, I'm going to do one more 
iteration on that then ask for a final review before committing. (Unless we're 
in freeze ATM ?)

--
Added file: http://bugs.python.org/file37870/issue17911-3.patch

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

actually, strike that, I'm happy with this pending a final +1 from another 
reviewer. Finishing the locals stuff is a separate patch, and will look like a 
single new parameter to StackSummary.extract, similarly on 
TracebackException.__init__ and then change the format logic to show it.

@Antoine - I'm not super happy with inspecting the first arg to do 
type-or-value stuff, if you feel its a super issue we can do it, but I'd rather 
wait and add it once we've got some feedback.

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

The generator thing: the code was refactoring not so long ago to be generator 
based internally with lists as a UI shim. I don't think there is a major 
advantage either way. Less buffering on one hand. Less convenient in some cases 
on the other. Simple use like ''.join(foo.format()) is going to be unaffected.

--

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



[issue23326] Remove redundant __ne__ implementations

2015-01-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

As far as default __ne__ implementation delegates to __eq__, concrete __ne__ 
implementations are mostly redundant. They make sens when default __ne__ did 
not handle non-comparable types correctly, but now it is fixed. Proposed patch 
removes correct but redundant __ne__ implementations (incorrect implementations 
were removed in issue21408).

--
components: Library (Lib)
files: remove___ne__.patch
keywords: patch
messages: 234779
nosy: serhiy.storchaka, vadmium
priority: normal
severity: normal
stage: patch review
status: open
title: Remove redundant __ne__ implementations
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37869/remove___ne__.patch

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



[issue23322] parser module docs missing second example

2015-01-26 Thread Berker Peksag

Berker Peksag added the comment:

Welcome, please go ahead and send a patch. Thanks!

--

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



[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-01-26 Thread Andy Reitz

New submission from Andy Reitz:

On Python 2.7.9, if I set an https_proxy environment variable, where the 
password contains a '/' character, urllib2 fails. Given this test code:

  import os, urllib
  os.environ['http_proxy'] = http://someuser:a/b@10.11.12.13:1234;
  f = urllib.urlopen('http://www.python.org')
  data = f.read()
  print data

I expect this error message (because my sample proxy is totally bogus):

[areitz@SOMEHOST ~]$ python2.7 test.py
Traceback (most recent call last):
  File test.py, line 3, in module
f = urllib.urlopen('http://www.python.org')
  File /usr/lib64/python2.7/urllib.py, line 87, in urlopen
return opener.open(url)
  File /usr/lib64/python2.7/urllib.py, line 213, in open
return getattr(self, name)(url)
  File /usr/lib64/python2.7/urllib.py, line 350, in open_http
h.endheaders(data)
  File /usr/lib64/python2.7/httplib.py, line 997, in endheaders
self._send_output(message_body)
  File /usr/lib64/python2.7/httplib.py, line 850, in _send_output
self.send(msg)
  File /usr/lib64/python2.7/httplib.py, line 812, in send
self.connect()
  File /usr/lib64/python2.7/httplib.py, line 793, in connect
self.timeout, self.source_address)
  File /usr/lib64/python2.7/socket.py, line 571, in create_connection
raise err
IOError: [Errno socket error] [Errno 101] Network is unreachable

Instead, I receive this error:

[areitz@SOMEHOST ~]$ python2.7 test.py
Traceback (most recent call last):
  File test.py, line 3, in module
f = urllib.urlopen('http://www.python.org')
  File /usr/lib64/python2.7/urllib.py, line 87, in urlopen
return opener.open(url)
  File /usr/lib64/python2.7/urllib.py, line 213, in open
return getattr(self, name)(url)
  File /usr/lib64/python2.7/urllib.py, line 339, in open_http
h = httplib.HTTP(host)
  File /usr/lib64/python2.7/httplib.py, line 1107, in __init__
self._setup(self._connection_class(host, port, strict))
  File /usr/lib64/python2.7/httplib.py, line 712, in __init__
(self.host, self.port) = self._get_hostport(host, port)
  File /usr/lib64/python2.7/httplib.py, line 754, in _get_hostport
raise InvalidURL(nonnumeric port: '%s' % host[i+1:])
httplib.InvalidURL: nonnumeric port: 'a'

Note that from the error, it seems as if urllib2 is incorrectly parsing the 
password from the proxy URL. When trying this with curl 7.19.7, I see the 
proper behavior (the correct password is parsed from the proxy URL).

--
components: Library (Lib)
messages: 234809
nosy: Andy.Reitz
priority: normal
severity: normal
status: open
title: urllib2 fails for proxy credentials that contain a '/' character
type: behavior
versions: Python 2.7

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



[issue22671] Typo in class io.BufferedIOBase docs

2015-01-26 Thread Berker Peksag

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


--
nosy: +berker.peksag
stage: needs patch - patch review

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



[issue23269] Tighten-up search loops in sets

2015-01-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Applied Sirhiy's version of the patch but may switch to the j=0 version later.

--
resolution:  - fixed
status: open - closed

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



[issue23322] parser module docs missing second example

2015-01-26 Thread Vipul Sharma

Vipul Sharma added the comment:

Can I work on this ? This would be my first contribution here also it looks 
good for a beginner

--
nosy: +Vipul.Sharma

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



[issue23269] Tighten-up search loops in sets

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b2a3d764e63 by Raymond Hettinger in branch 'default':
Issue #23269:  Tighten search_loop in set_insert_clean()
https://hg.python.org/cpython/rev/0b2a3d764e63

--
nosy: +python-dev

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

Everything seems to work except two tests are still failing: parser and venv.  
Any ideas Joshua?

Also, we have to decide what to do with f(*x for x in l) and f(**x for x in l).

--
Added file: http://bugs.python.org/file37877/starunpack23.diff

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



[issue23286] A typo in the tutorial

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b3f0d7f50544 by Berker Peksag in branch '3.4':
Issue #23286: Fix typo in the tutorial.
https://hg.python.org/cpython/rev/b3f0d7f50544

New changeset 8cb151ff1575 by Berker Peksag in branch 'default':
Issue #23286: Fix typo in the tutorial.
https://hg.python.org/cpython/rev/8cb151ff1575

--
nosy: +python-dev

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



[issue23286] A typo in the tutorial

2015-01-26 Thread Berker Peksag

Berker Peksag added the comment:

Fixed. Thanks for the patch!

--
nosy: +berker.peksag
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

Why do you consider it crippling?

--

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



[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-01-26 Thread Andy Reitz

Andy Reitz added the comment:

Sorry, went a bit too quickly -- here is the sample code that I meant to use:

  import os, urllib2
  os.environ['http_proxy'] = http://someuser:a/b@10.11.12.13:1234;
  f = urllib2.urlopen('http://www.python.org')
  data = f.read()
  print data

And the stack trace that I receive:

Traceback (most recent call last):
  File test.py, line 3, in module
f = urllib2.urlopen('http://www.python.org')
  File /usr/lib64/python2.7/urllib2.py, line 154, in urlopen
return opener.open(url, data, timeout)
  File /usr/lib64/python2.7/urllib2.py, line 431, in open
response = self._open(req, data)
  File /usr/lib64/python2.7/urllib2.py, line 449, in _open
'_open', req)
  File /usr/lib64/python2.7/urllib2.py, line 409, in _call_chain
result = func(*args)
  File /usr/lib64/python2.7/urllib2.py, line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File /usr/lib64/python2.7/urllib2.py, line 1166, in do_open
h = http_class(host, timeout=req.timeout, **http_conn_args)
  File /usr/lib64/python2.7/httplib.py, line 712, in __init__
(self.host, self.port) = self._get_hostport(host, port)
  File /usr/lib64/python2.7/httplib.py, line 754, in _get_hostport
raise InvalidURL(nonnumeric port: '%s' % host[i+1:])
httplib.InvalidURL: nonnumeric port: 'a'

It actually looks the same -- so I suppose this issue affects both urllib and 
urllib2.

--

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



[issue23208] asyncio: add BaseEventLoop._current_handle (only used in debug mode)

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 54d74f954bf9 by Victor Stinner in branch '3.4':
Issue #23208, asyncio: Add BaseEventLoop._current_handle
https://hg.python.org/cpython/rev/54d74f954bf9

--
nosy: +python-dev

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



[issue23293] [Windows] asyncio: race condition related to IocpProactor.connect_pipe()

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b6ab8fe16d16 by Victor Stinner in branch '3.4':
Issue #23293, asyncio: Cleanup IocpProactor.close()
https://hg.python.org/cpython/rev/b6ab8fe16d16

--

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



[issue11578] Increase test coverage for timeit.py

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7e7c825f75ad by Serhiy Storchaka in branch '2.7':
Issue #11578: Backported test for the timeit module.
https://hg.python.org/cpython/rev/7e7c825f75ad

--

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e8db1cbe416b by Serhiy Storchaka in branch '2.7':
Issue #18518: timeit now rejects statements which can't be compiled outside
https://hg.python.org/cpython/rev/e8db1cbe416b

New changeset a5769fa55791 by Serhiy Storchaka in branch '3.4':
Issue #18518: timeit now rejects statements which can't be compiled outside
https://hg.python.org/cpython/rev/a5769fa55791

New changeset b0a686260b5d by Serhiy Storchaka in branch 'default':
Issue #18518: timeit now rejects statements which can't be compiled outside
https://hg.python.org/cpython/rev/b0a686260b5d

--

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



[issue23321] Crash in str.decode() with special error handler

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think the changeset which made decoders to use _PyUnicodeWriter (issue16311) 
is responsible of the regression.

For example consider b'\x80abc'.decode('utf-8', 'backslashreplace').

The writer reserves string buffer with size 4 (every byte produces at most 1 
character). First byte is incorrect and replaced by 4-character string 
'\\x80'. The writer increases min_length but doesn't resize the buffer because 
its size is enough to write replacement string. But following writes of ASCII 
characters cause buffer overflow.

--

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



[issue23094] Unpickler failing with PicklingError at frame end on readline due to a broken comparison

2015-01-26 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/issue23094
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23322] parser module docs missing second example

2015-01-26 Thread Berker Peksag

Berker Peksag added the comment:

The second example was removed in 
https://hg.python.org/cpython/rev/19ca70b463c5 It would be better to just 
update the see also note in the token documentation.

--
keywords: +easy
nosy: +berker.peksag
stage:  - needs patch
versions:  -Python 3.2, Python 3.3

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



[issue21408] delegation of `!=` to the right-hand side argument is not always done

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e516badfd3b2 by Serhiy Storchaka in branch '3.4':
Issue #21408: The default __ne__() now returns NotImplemented if __eq__()
https://hg.python.org/cpython/rev/e516badfd3b2

New changeset 7e9880052401 by Serhiy Storchaka in branch 'default':
Issue #21408: The default __ne__() now returns NotImplemented if __eq__()
https://hg.python.org/cpython/rev/7e9880052401

--
nosy: +python-dev

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



[issue23292] Enum doc suggestion

2015-01-26 Thread Mark Summerfield

Mark Summerfield added the comment:

Nice answer Ethan (but I can't vote you up since stack overflow won't let me 
vote or even comment anymore).

As for adding export_to(), it seems like a good idea. However, personally, I 
think the signature should be

hoist_into(namespace, cls, *clses)

to allow multiple enums in the same module to be exported in one go. (Just 
kidding about the new name though.)

PS I should have said earlier, thanks Eli:-)

--

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



[issue23321] Crash in str.decode() with special error handler

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

 Debugging build crashes in some circumstances in str.decode() (...) buildbots 
 are broken without it

Is it a regression? Would it be possible to identify the changeset
responsible of the regression?

--

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

It's strange that %s format raises an error about the %b format:

 b's? %s' % 1
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: %b requires bytes, or an object that implements __bytes__, not 'int'

--

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



[issue7665] test_urllib2 and test_ntpath fail if path contains \

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank for your review Senthil.

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

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



[issue7665] test_urllib2 and test_ntpath fail if path contains \

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e12c9e5bc89 by Serhiy Storchaka in branch '2.7':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/1e12c9e5bc89

New changeset 04fa56628830 by Serhiy Storchaka in branch '3.4':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/04fa56628830

New changeset 1db1cd711104 by Serhiy Storchaka in branch 'default':
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
https://hg.python.org/cpython/rev/1db1cd711104

--
nosy: +python-dev

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



[issue23094] Unpickler failing with PicklingError at frame end on readline due to a broken comparison

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5e13b74d377 by Serhiy Storchaka in branch '3.4':
Issue #23094: Fixed readline with frames in Python implementation of pickle.
https://hg.python.org/cpython/rev/d5e13b74d377

New changeset c347c21e5afa by Serhiy Storchaka in branch 'default':
Issue #23094: Fixed readline with frames in Python implementation of pickle.
https://hg.python.org/cpython/rev/c347c21e5afa

--
nosy: +python-dev

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



[issue23268] Fix comparison of ipaddress classes

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9a7d965ab80f by Serhiy Storchaka in branch '3.4':
Issue #23268: Fixed bugs in the comparison of ipaddress classes.
https://hg.python.org/cpython/rev/9a7d965ab80f

New changeset 051f2a234d8a by Serhiy Storchaka in branch 'default':
Issue #23268: Fixed bugs in the comparison of ipaddress classes.
https://hg.python.org/cpython/rev/051f2a234d8a

--
nosy: +python-dev

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



[issue21408] delegation of `!=` to the right-hand side argument is not always done

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Martin.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed
versions: +Python 3.5 -Python 3.3

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



[issue23268] Fix comparison of ipaddress classes

2015-01-26 Thread Serhiy Storchaka

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


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

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



[issue19361] Specialize exceptions thrown by JSON parser

2015-01-26 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/issue19361
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19361] Specialize exceptions thrown by JSON parser

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 07af9847dbec by Serhiy Storchaka in branch 'default':
Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError.
https://hg.python.org/cpython/rev/07af9847dbec

--
nosy: +python-dev

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

Buildbots are unhappy. Example:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%202.7/builds/837/steps/test/logs/stdio

1 test failed:
test_timeit

Re-running test 'test_timeit' in verbose mode
test test_timeit crashed -- type 'exceptions.ImportError': No module named 
support
Traceback (most recent call last):
  File ./Lib/test/regrtest.py, line 901, in runtest_inner
  File 
/usr/home/buildbot/python/2.7.koobs-freebsd10/build/Lib/test/test_timeit.py, 
line 8, in module
from test.support import run_unittest
ImportError: No module named support
[44296 refs]
*** Error code 1

--
nosy: +haypo

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Already fixed in 617c226da195. Needs time for buildbots to rerun tests. I 
didn't noticed error when backported tests because there was local file 
support.py in my workspace.

--

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



[issue14099] ZipFile.open() should not reopen the underlying file

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ae42c4576438 by Serhiy Storchaka in branch '2.7':
Issue #14099: Backout changeset c2c4cde55f6f (except adapted tests).
https://hg.python.org/cpython/rev/ae42c4576438

New changeset 680b47c96e08 by Serhiy Storchaka in branch '3.4':
Issue #14099: Backout changeset e5bb3044402b (except adapted tests).
https://hg.python.org/cpython/rev/680b47c96e08

New changeset 4973ccd46e32 by Serhiy Storchaka in branch 'default':
Issue #14099: Writing to ZipFile and reading multiple ZipExtFiles is
https://hg.python.org/cpython/rev/4973ccd46e32

New changeset 9cbf9f96920d by Serhiy Storchaka in branch 'default':
Issue #14099: Restored support of writing ZIP files to tellable but
https://hg.python.org/cpython/rev/9cbf9f96920d

--

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



[issue14099] ZipFile.open() should not reopen the underlying file

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry Stepan and David, but for this feature you need wait 3.5.

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

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could anyone please make a review (mainly documentation)? It would be good to 
get this change in first alpha.

--

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



[issue23321] Crash in str.decode() with special error handler

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e8937861ee3 by Victor Stinner in branch 'default':
Issue #22286, #23321: Fix failing test on Windows code page 932
https://hg.python.org/cpython/rev/1e8937861ee3

--

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



[issue22286] Allow backslashreplace error handler to be used on input

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e8937861ee3 by Victor Stinner in branch 'default':
Issue #22286, #23321: Fix failing test on Windows code page 932
https://hg.python.org/cpython/rev/1e8937861ee3

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Nick Coghlan

Nick Coghlan added the comment:

On the triple-or-value front, the main case I see for considering the you 
don't need exception state triples any more argument already lost is the fact 
exc_info still returns a triple, and __exit__ methods still accept them as 
unpacked arguments. The C level exception handling APIs are also all still 
exception state triple based. In this view, __traceback__ is primarily about 
accessing *chained* tracebacks, while the top-level APIs still focus on 
exception state triples.

This perspective also has the virtue of confining use of the Python 3 only 
exception traceback attribute to code that is taking advantage of a Python 3 
only feature (i.e. exception chaining). For chaining independent exception 
state handling, working with exception state triples then remains the one 
obvious way to do it, a way which is conveniently also source compatible 
between Python 2 and 3.

--

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

 Please see zipimport_fix.patch for the possible fix.

The solution looks good. Can you please try to convert  zipimport_test.py to a 
patch for test_zipimport.py and combine it with   zipimport_fix.patch  to 
create a complete patch?

You should also sign the contributor agreement:
https://www.python.org/psf/contrib/contrib-form/

--

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



[issue23324] Nonblocking serial io using Arduino and Ubuntu 14.10 (Python 3.4.2) performance slowdown

2015-01-26 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

 I do agree that it is a corner case scenario and using ASCII names is a 
 better option :-)

Since the patch is short, I see no problem to fix this issue.

--

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



[issue22936] traceback module has no way to show locals

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

First cut implementation. I'm sure there is lots we can add, but this will make 
things nicer in and of itself.

Thanks for the pointer to cgitb, I've skimmed it and its definitely much more 
comprehensive. I'm not entirely sure about the best way to glue it and the new 
traceback API together; or even if thats needed.

--
keywords: +patch
Added file: http://bugs.python.org/file37875/issue-22936-1.patch

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread Swapneel Ambre

New submission from Swapneel Ambre:

On Windows, using zipimport module APIs like get_filename on a file with 
non-ascii characters in the full path fails with 

UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: 
invalid character ( Full output attached in errorlog.txt ).

The issue is that Modules/zipimport.c has a function compile_source which tries 
to run PyUnicode_EncodeFSDefault on the pathname. On Windows, the default 
encoding is 'mbcs' which cannot handle unicode characters.

This has already been fixed in the import machinery on python 3 ( see issue 
http://bugs.python.org/issue13758, http://bugs.python.org/issue11619). The 
solution is to pass the pathname as Unicode directly to the compiler.

--
components: Unicode, Windows
files: errorlog.txt
messages: 234786
nosy: amswap, ezio.melotti, haypo, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: zipimport to import from non-ascii pathname on Windows
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37872/errorlog.txt

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread Swapneel Ambre

Swapneel Ambre added the comment:

I have tried to fix this by calling Py_CompileStringObject instead of 
Py_CompileString , thus avoiding the need to Encode the pathname. Please see 
zipimport_fix.patch for the possible fix.

--
keywords: +patch
Added file: http://bugs.python.org/file37874/zipimport_fix.patch

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



[issue23095] [Windows] asyncio: race condition when cancelling a _WaitHandleFuture

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

I fixed many other issues related to the IocpProactor. This time it should be 
ok. I ran the Tulip and Trollius test suite a lot of times, in release and 
debug mode. I didn't see any warning nor hang. I also ran test_asyncio of 
Python as well.

I close this issue again.

--
resolution:  - fixed
status: open - closed

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 In this view, __traceback__ is primarily about accessing *chained*
 tracebacks

Please let's not make up sophistic arguments when the only motivation for 
triples is backwards compatibility of *existing* APIs.

Exception triples are an unnecessary bother in Python 3. This new API should 
accept exception instances primarily. Accepting triples as well is ok but it 
shouldn't be made the only possibility.

--

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Changes by Neil Girdhar mistersh...@gmail.com:


Added file: http://bugs.python.org/file37876/starunpack22.diff

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



[issue2292] Missing *-unpacking generalizations

2015-01-26 Thread Neil Girdhar

Neil Girdhar added the comment:

fixed a minor bug with the function address, and made a number of polishing 
changes.

--
Added file: http://bugs.python.org/file37871/starunpack21.diff

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread Swapneel Ambre

Swapneel Ambre added the comment:

I am attaching the test script I have used to reproduce the issue.

--
Added file: http://bugs.python.org/file37873/zipimport_test.py

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



[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand the issue: does it only concern the name of the ZIP file? Or 
also paths inside the ZIP?

In both cases, the workaround is to use only ASCII names.

I spent a lot of times on supporting any Unicode name, everyone in Python. I 
didn't expect that people have so different and crazy use cases :-)

--

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



[issue23324] Nonblocking serial io using Arduino and Ubuntu 14.10 (Python 3.4.2) performance slowdown

2015-01-26 Thread Carol Willing

Carol Willing added the comment:

Alan, Thanks for reporting your issue. I have spent some time looking at it, 
and I have triaged it as best as I am able for the other developers and you. I 
am editing the issue title for clarity.

The issue is related to nonblocking i/o between a 'linux' (Ubuntu 14.10) system 
and an Arduino and the performance difference of the i/o channel noticed by the 
user on Python 3.4.2 and 2.7.9.

Third party packages (PyMata and pySerial) as well as threading module of 
CPython are used by the application that was reported in the original issue. 
Due to hardware constraints, I have not duplicated the issue.

I have done some research on the sources used by the application.

At the lowest level, i/o between the Arduino and the system is dependent on 
operating system implementation differences. There are differences between how 
i/o is implemented by pySerial for different operating systems. Comments in the 
pySerial source and docs state that nonblocking io and read differ and some 
functions (such as the nonblocking() method are highlighted as not portable.) 
There are also comments in the pySerial source code that not all systems 
support polling properly (presumably at their lower level os code).

Though perhaps not directly related (but at least tangentially),
this blog post explains some nonblocking differences between Python
3 and Python 2 (the last few paragraphs are most relevant).
http://ballingt.com/2014/03/01/nonblocking-stdin-in-python-3.html

---
Notes from a reverse walkthrough of the source code
---

In PyMata/examples/digital_analog_io/polling_digital_analog_io.py,
analog = board.analog_read(POTENTIOMETER)

In PyMata/pymata.py, Python's threading module is imported, and
the PyMata class contains the API:
data_lock = threading.Lock() is set
analog_read(self, pin) method uses the data_lock and returns
data value from pymata's command_handler's analog_response_table

Pymata's command_handler PyMata/pymata_command_handler.py has the
following information in its docstring:
There is no blocking in either communications direction.

There is blocking when accessing the data tables through the _data_lock

The get_analog_response_table method uses the data_lock.

PyMata's pymata_serial.py uses pySerial's class serial.Serial to
open and initialize a serial port. The following lines are in the
__init__ for PyMataSerial class:

# without this, running python 3.4 is extremely sluggish
if sys.platform == 'linux':
# noinspection PyUnresolvedReferences
self.arduino.nonblocking()

It should be noted that programs using pySerial's nonblocking()
method are not portable.

The following is the run method for PyMataSerial:

def run(self):

This method continually runs. If an incoming character is available on 
the serial port
it is read and placed on the _command_deque
@return: Never Returns

while not self.is_stopped():
# we can get an OSError: [Errno9] Bad file descriptor when shutting 
down
# just ignore it
try:
if self.arduino.inWaiting():
c = self.arduino.read()
self.command_deque.append(ord(c))
except OSError:
pass
except IOError:
self.stop()
self.close()

The pySerial inWaiting() method is used to determine whether there
are bytes to be read by the read() method.
The source for pySerial 
http://svn.code.sf.net/p/pyserial/code/trunk/pyserial/serial/serialutil.py 
points out variations between Python 2
and 3 for string vs byte reading.

Interestingly, pySerial's Serial class can be assembled in two ways: 1) using 
pySerial's file-like emulation or 2) using io.RawIOBase.
From 
http://svn.code.sf.net/p/pyserial/code/trunk/pyserial/serial/serialposix.py,
# assemble Serial class with the platform specific implementation and the base
# for file-like behavior. for Python 2.6 and newer, that provide the new I/O
# library, derive from io.RawIOBase
try:
import io
except ImportError:
# classic version with our own file-like emulation
class Serial(PosixSerial, FileLike):
pass
else:
# io library present
class Serial(PosixSerial, io.RawIOBase):
pass

class PosixPollSerial(Serial):
\
Poll based read implementation. Not all systems support poll properly.
However this one has better handling of errors, such as a device
disconnecting while it's in use (e.g. USB-serial unplugged).


--
components: +IO
nosy: +willingc
title: Python 3.4.2 running slow on Ubuntu 14.10 - Nonblocking serial io using 
Arduino and Ubuntu 14.10 (Python 3.4.2) performance slowdown
type:  - performance

___
Python tracker rep...@bugs.python.org

[issue23327] zipimport to import from non-ascii pathname on Windows

2015-01-26 Thread Swapneel Ambre

Swapneel Ambre added the comment:

Sorry I was not very clear about the use case. 

The name of the zipfile or any parent directory name could contain non-ascii 
characters. Consider a use case where you want to ship some product with third 
party module shipped as an egg file (say example.egg) along with your product. 
You don't have control over where the product files gets installed. Someone 
could install the product files under say C:\的\product_name. So both your 
product (exe or python files) and the egg files are installed under a path with 
non-ascii characters in it. Any import statements trying to import modules from 
the egg file will fail with UnicodeEncodeError as zipimport will try to use 
PyUnicode_EncodeFSDefault with 'mbcs' encoding on Windows. 

I hope the use case is clearer now. I do agree that it is a corner case 
scenario and using ASCII names is a better option :-)

I will create a complete patch and sign contributor agreement.

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Robert Collins

Robert Collins added the comment:

So its fairly simple IMO: it will be more code, not less, to support the 
non-triple API, *and* it can be added later, unless we're proposing not to 
support the triple API at all (which hasn't been proposed AFAICT).

To me thats a fairly strong argument for adding non-triple support later.

--

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-01-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 27/01/2015 00:30, Robert Collins a écrit :
 
 Robert Collins added the comment:
 
 So its fairly simple IMO: it will be more code, not less, to support
the non-triple API, *and* it can be added later, unless we're proposing
not to support the triple API at all (which hasn't been proposed AFAICT).

I am proposing it. Passing a single exception instance is the natural
way of expressing such an API. Crippling Python 3 APIs for the purpose
of backwards compatibility is not ok.

Nobody wants to write some_func(exc.__class__, exc, exc.__traceback__)
when they could simply write some_func(exc).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17911
___
___
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

2015-01-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 107669985805 by Berker Peksag in branch 'default':
Add whatsnew entry for issue #5309.
https://hg.python.org/cpython/rev/107669985805

--

___
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



  1   2   >