[issue24623] Parser: broken line numbers for triple-quoted strings

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue16806

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> col_offset is -1 and lineno is wrong for multiline string 
expressions

___
Python tracker 

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



[issue25631] Segmentation fault with invalid Unicode command-line arguments in embedded Python

2015-11-16 Thread Eryk Sun

Eryk Sun added the comment:

The interpreter isn't initialized, so calling PyErr_Format in a release build 
segfaults when it tries to dereference a NULL PyThreadState. OTOH, a debug 
build should call PyThreadState_Get, which in this case calls Py_FatalError and 
aborts the process. Unfortunately 3.5.0+ debug builds don't call 
PyThreadState_Get due to the fix for issue 25150.

> the possibility of other exceptions being raised early in the 
> initialization sequence remains a potential problem.

PEP 432 proposes a pre-initialization phase that sets a valid Python thread 
state.

--
nosy: +eryksun, ncoghlan

___
Python tracker 

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



[issue25498] Python 3.4.3 regression in ctypes.frombuffer()

2015-11-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b04ae5392cf2 by Serhiy Storchaka in branch '3.4':
Issue #25498: Fixed contributors name.
https://hg.python.org/cpython/rev/b04ae5392cf2

New changeset 3738b0ca1356 by Serhiy Storchaka in branch '3.5':
Issue #25498: Fixed contributors name.
https://hg.python.org/cpython/rev/3738b0ca1356

New changeset 559ff2852cf2 by Serhiy Storchaka in branch 'default':
Issue #25498: Fixed contributors name.
https://hg.python.org/cpython/rev/559ff2852cf2

--

___
Python tracker 

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



[issue13821] misleading return from isidentifier

2015-11-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +pitrou

___
Python tracker 

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2015-11-16 Thread Марк Коренберг

Марк Коренберг added the comment:

Please merge patch, proposed by Eduardo Seabra (Eduardo.Seabra). And document 
that this is UNIX-only solution.

--
versions: +Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41055/test_tempfile.py

___
Python tracker 

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



[issue25635] urllib2 cannot fully read FTP file

2015-11-16 Thread keakon

New submission from keakon:

I found the bug from this slide: 
http://sector.ca/Portals/17/Presentations15/SecTor_Branca.pdf

The second way cannot fully read the file.

import urllib2

url = 'ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-extended-latest'
response = urllib2.urlopen(url)
data = response.read()
print len(data)  # 6653498

data = urllib2.urlopen(url).read()
print len(data)  # 65536


It might be something wrong with the FTP server. It's OK when I read from my 
own FTP server.

--
components: Library (Lib)
messages: 254733
nosy: keakon
priority: normal
severity: normal
status: open
title: urllib2 cannot fully read FTP file
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue25634] Add a dedicated subclass for attribute missing errors

2015-11-16 Thread R. David Murray

R. David Murray added the comment:

I understand what you are concerned about, but unfortunately that would be a 
significant backward compatibility break.  This would need discussion on 
python-ideas, I think.  Even aside from the backward compatibility issue I have 
a feeling the additional complexity this would add to attribute resolution 
would be deemed too large to be worthwhile, but I haven't looked at the 
relevant code so I might be wrong.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue22555] Tracking issue for adjustments to binary/text boundary handling

2015-11-16 Thread Nick Coghlan

Nick Coghlan added the comment:

In discussing the Windows aspects of the bytes/text boundary handling issues 
with Brett & Steve recently, I realised I hadn't clearly defined what "fixed" 
looked like from my perspective.

The attached test case is an initial attempt at that. It currently fails on a 
UTF-8 Linux system, with the "test_dash_c_unicode" case failing when the 
interpreter is misconfigured with "LANG=C" - the problem there is that when we 
encode from the -c command line argument back to bytes, we don't pass 
"surrogateescape".

I'd be interested in knowing how much of this already passes on a Windows 
system.

There's also a currently missing test case, which is to pass the info to the 
subprocess via stdin - "assert_python_ok()" doesn't currently support that, so 
implementing it will either require a new flag, or direct invocation of 
spawn_python().

--
nosy: +brett.cannon, steve.dower
Added file: http://bugs.python.org/file41054/test_cmd_line_unicode.py

___
Python tracker 

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



[issue25635] urllib2 cannot fully read FTP file

2015-11-16 Thread R. David Murray

R. David Murray added the comment:

Most likely it is a timing issue, with the response object sometimes getting 
GCed before the read is complete (your local server would make this less likely 
since the read would complete sooner).

I think this has been fixed in python3.  Can you check?

Note, however, that this is not best practice code.  Ideally you should 
explicitly close the response object after reading from it.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue557704] netrc module can't handle all passwords

2015-11-16 Thread Cristian Măgherușan-Stanciu

Cristian Măgherușan-Stanciu added the comment:

Why is this issue fixed? I still see this problem on 2.7 and 3.4.3.

Can someone please reopen it?

mdengler's patch seems to work fine on my machine on both 2.7 and 3.4.3.

--
nosy: +Cristian Măgherușan-Stanciu

___
Python tracker 

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



[issue25626] Gzip fails for file over 2**32 bytes

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is 3.4 affected? A uint_converter was added in issue18294.

--

___
Python tracker 

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



[issue24750] IDLE: Cosmetic improvements for main window

2015-11-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ff31af003c35 by Terry Jan Reedy in branch '2.7':
Issue #24750: Improve appearance of IDLE editor window status bar.
https://hg.python.org/cpython/rev/ff31af003c35

New changeset ecb74f61a5d4 by Terry Jan Reedy in branch '3.4':
Issue #24750: Improve appearance of IDLE editor window status bar.
https://hg.python.org/cpython/rev/ecb74f61a5d4

New changeset 483a5cd9f975 by Terry Jan Reedy in branch '2.7':
Issue #24750: whitespace
https://hg.python.org/cpython/rev/483a5cd9f975

New changeset 38d9ffbb595b by Terry Jan Reedy in branch '3.4':
Issue #24750: whitespace
https://hg.python.org/cpython/rev/38d9ffbb595b

--
nosy: +python-dev

___
Python tracker 

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



[issue24750] IDLE: Cosmetic improvements for main window

2015-11-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Leaving open for now for scrollbar upgrade.

--

___
Python tracker 

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



[issue24313] json fails to serialise numpy.int64

2015-11-16 Thread Eli_B

Changes by Eli_B :


--
nosy: +Eli_B

___
Python tracker 

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



[issue25616] Extract OrderedDict tests into separate file

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Raymond. Here is a patch. It is in Git format, hence Rietveld will 
not work with it. During creating a patch I found a bug in test_dict_update, it 
tested only default implementation and didn't test subclasses.

--
keywords: +patch
stage:  -> patch review
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41056/test_ordered_dict.patch

___
Python tracker 

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



[issue13821] misleading return from isidentifier

2015-11-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, haypo, serhiy.storchaka
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue24313] json fails to serialise numpy.int64

2015-11-16 Thread Eli_B

Eli_B added the comment:

On 64-bit Windows, my 64-bit Python 2.7.9 and my 32-bit 2.7.10 Python both 
reproduce the failure with a similar traceback.

--

___
Python tracker 

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



[issue25636] Let launcher autoselect best 32-bit Python on 64-bit system

2015-11-16 Thread Christian Ullrich

New submission from Christian Ullrich:

As described in PEP 397, the launcher can autoselect the "best" Python version 
available on a system, or a full version number (major.minor) can be specified. 
In the latter case, optionally a "-32" suffix can be given to select a 32-bit 
version, which is useful on 64-bit systems where a 64-bit Python is also 
present. By default it will select the highest (native) version.

I have an application that runs unmodified on Python 3.[345], but only with the 
32-bit version because it loads a DLL (this is on Windows, but I think the 
basic issue applies to other systems as well) that has no 64-bit version 
available. I would like to run it on any system that has *any* suitable Python 
installed.

However, with the version selection syntax supported by the launcher, I can 
only demand a 32-bit version if I also specify the Python minor version I want, 
and I do not necessarily know that in advance.

What I would like the launcher to support is a version specification that 
allows using the "-32" suffix in all possible combinations with version numbers:

py -3.5-32 (same as today, 32-bit Python 3.5)
py -3-32   (highest 32-bit Python 3)
py -32 (highest 32-bit Python available)

The last form above, with no major version given, would look for the highest 
minor version in the default major version. The syntax might have to be 
different for compatibility reasons, although both incomplete specifications 
would result in an error message in all released versions.

I have been looking for a reason this limited syntax was chosen, but there has 
not to my knowledge been any discussion of this change on python-dev, and the 
May 2011 revision to PEP 397 ("based on python-dev feedback") in which it was 
introduced over the original, more flexible syntax also gives no further hint 
about its reasoning.

Solving this in application code could be done, of course, but both apparent 
solutions are incredibly ugly:

- Reimplementing the version autoselection by listing the available 32-bit 
versions.
- "Shooting blind", invoking every possible version from the top down until one 
works.
  "3.5-32? Nope. 3.4-32? Nope. 3.3-32? Yes!" This approach has the added 
downside that
  the launcher may not be in the $PATH at all. That is improbable, but possible.

I would much rather leave the work to the launcher, where the required 
knowledge is obviously available.

Thanks for hearing me out :-)

--
messages: 254742
nosy: Christian.Ullrich
priority: normal
severity: normal
status: open
title: Let launcher autoselect best 32-bit Python on 64-bit system
type: enhancement

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

The reason I suggested the ABC for context managers is mostly to provide a way 
to help people make sure to implement __enter__() and to provide a default 
__exit__() which has the proper signature (I personally always forget how many 
arguments __exit__() takes and what the arguments are past the first one). The 
type part of this feature request is because I realized that a type hint of 
"context manager" isn't really useful, but "context manager returning ..." is 
since a `with` statement does introduce a new variable. IOW none of this has 
anything to do with isinstance() and it's all about easing the use of the 
context manager interface and proper type hints for the `with` statement.

As for a new module analogous to the `types` module just for ABCs, that's fine 
by me. I had the same reaction you did, Raymond, about putting it in 
collections.abc. I can open another issue for that idea and leave this open as 
it's somewhat orthogonal to what I'm proposing.

--

___
Python tracker 

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



[issue22555] Tracking issue for adjustments to binary/text boundary handling

2015-11-16 Thread Steve Dower

Steve Dower added the comment:

Right now all of the tests fail on Windows by default (cp437 for me).

If I change the default IO encoding to utf-8 (hacked into pylifecycle.c, since 
PYTHONIOENCODING is ignored by subprocesses using -E), the four "Misconfigured" 
tests crash at the os.fsencode() call (as "mbcs:strict" cannot encode the 
characters - this may be a real issue, haven't dug into it yet).

Adding more hacks to get past this point brings me back into the ASCII encoding 
performed by the test, and I'm not sure whether that's just an incorrect 
assumption for Windows or not.


Separate issue: if I run "chcp 437" before the tests, the output is garbage. If 
I run "chcp 65001" then it shows the characters in the font correctly. The std 
streams encoding is taken from this value, but it doesn't map back to UTF-8, 
which is probably another issue. If I add a separate check in fileutils.c at 
_Py_device_encoding then I get UTF-8 enabled streams when the console is set 
for cp65001.

However, there are still a number of places that use GetACP() to determine the 
locale and encoding to use, which is incorrect for Unicode-aware programs. In 
particular, this should not happen:

>>> f=open('test.txt', 'w')
>>> f.encoding
'cp1252'

There's no good reason for the default encoding to not be UTF-8 these days, but 
this is a much bigger change. It's probably worth doing for 3.6, but may need 
more discussion...

--

___
Python tracker 

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



[issue25637] Move non-collections-related ABCs out of collections.abc

2015-11-16 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue25637] Move non-collections-related ABCs out of collections.abc

2015-11-16 Thread Yury Selivanov

Yury Selivanov added the comment:

We had this discussion when we were adding Awaitable, AsyncIterable etc.  I 
suggested to simply put them in the top-level 'abc' module (where ABCMeta is 
defined).

--
nosy: +yselivanov

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread R. David Murray

R. David Murray added the comment:

Can you provide a minimum reproducer?  It looks like you are somehow managing 
to use EmailMessage with the compat34 policy, which shouldn't happen unless you 
work at it, or I overlooked something.

Perhaps EmailMessage should disallow setting policy to compat32.

--

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

Let's not pollute the issue with a critique of my notebook. You can feel free 
to email me personally to discuss it if you want, including why I purposefully 
didn't use a logarithmic scale.

--

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-16 Thread Roman Kozhemiakin

New submission from Roman Kozhemiakin:

open('.\\PHYSICALDRIVE1','rb',0)
fails since python 3.5

At the end of _io_FileIO___init___impl function 
_Py_fstat call raise OSError: [WinError 1] Incorrect function
_Py_fstat result not used on windows in this place. 

 440 self->blksize = DEFAULT_BUFFER_SIZE;
---> 441 if (_Py_fstat(self->fd, ) < 0)
 442 goto error;
 443 #if defined(S_ISDIR) && defined(EISDIR)
 444 /* On Unix, open will succeed for directories.
 445In Python, there should be no file objects referring to
 446directories, so we need a check.  */
 447 if (S_ISDIR(fdfstat.st_mode)) {
 448 errno = EISDIR;
 449 PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj);
 450 goto error;
 451 }
 452 #endif /* defined(S_ISDIR) */
 453 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
 454 if (fdfstat.st_blksize > 1)
 455 self->blksize = fdfstat.st_blksize;
 456 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */

--
components: Library (Lib)
messages: 254756
nosy: rokozh
priority: normal
severity: normal
status: open
title: open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: 
[WinError 1] Incorrect function
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue13736] urllib.request.urlopen leaks exceptions from socket and httplib.client

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

There is another patch in duplicate Issue 8823, which has simpler exception 
wrapping code, but does not add wrapping of reply exceptions.

Personally, I wouldn’t endorse any new wrapping HTTP client exceptions, and 
even if wrapping more socket OS errors would be consistent, it could be a 
backwards compatibility problem. I think the best way forward is documentation: 
Issue 25633, Issue 22797.

--

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread Matthieu Pepin

Matthieu Pepin added the comment:

Yes, I will make a small reproducer.

--

___
Python tracker 

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



[issue25641] urllib/request.py/getproxies_environment() throws "dictionary changed size during iteration" error occasionally

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

How are you managing to get os.environ to change inside that function? Another 
thread or garbage collector callback perhaps?

My understanding is that os.environ is coupled to the C library’s environment, 
and that is not thread-safe.

--
nosy: +martin.panter
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-16 Thread SilentGhost

Changes by SilentGhost :


--
components: +IO, Windows
keywords: +3.5regression
nosy: +benjamin.peterson, paul.moore, pitrou, steve.dower, stutzbach, 
tim.golden, zach.ware
stage:  -> test needed

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread Matthieu Pepin

New submission from Matthieu Pepin:

Message.is_attachment() throws the exception below:

 File "/usr/lib/python3.5/email/message.py", line 956, in is_attachment
return False if c_d is None else c_d.content_disposition == 'attachment'
AttributeError: 'str' object has no attribute 'content_disposition'

It seems to work fine for me with:

return c_d == 'attachment'

--
components: email
messages: 254757
nosy: Matthieu Pepin, barry, r.david.murray
priority: normal
severity: normal
status: open
title: Message.is_attachment() throws exception
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread R. David Murray

R. David Murray added the comment:

I mean compat32.

--

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think these histograms would look better with logarithmic scale.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread Matthieu Pepin

Matthieu Pepin added the comment:

Ok I think the bug is not where I thought. First, my workaround does not work. 
Second, I use the following to generate my Message:

message_from_string(s, _class=EmailMessage)

Maybe the bug is in the parser?

--

___
Python tracker 

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



[issue25641] urllib/request.py/getproxies_environment() throws "dictionary changed size during iteration" error occasionally

2015-11-16 Thread alphalfalfa

New submission from alphalfalfa:

For the following lines of code, "dictionary changed size during iteration" 
would be thrown when the environment variables change while in iteration.

Python-3.5.0/Lib/urllib/request.py
2393 for name, value in os.environ.items():
2394 name = name.lower()
2395 if value and name[-6:] == '_proxy':
2396 proxies[name[:-6]] = value

--
components: Library (Lib)
messages: 254767
nosy: alphalfalfa
priority: normal
severity: normal
status: open
title: urllib/request.py/getproxies_environment() throws "dictionary changed 
size during iteration" error occasionally
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue8823] urllib2 does not catch httplib.BadStatusLine

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

Issue 13736 also proposes to wrap HTTP client exceptions, although I personally 
don’t really endorse this.

The other option is to fix the documentation: Issue 25633, Issue 22797.

--
resolution: accepted -> duplicate
status: open -> closed
superseder:  -> urllib.request.urlopen leaks exceptions from socket and 
httplib.client

___
Python tracker 

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



[issue25633] The documentation for urllib.request should mention http.client.HTTPException

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

Closely related: Issue 22797 proposes documenting some circumstances where 
ValueError is raised directly. Perhaps you can review and enhance the patch 
already there.

Also related:

Issue 13736 proposes to wrap http.client exceptions (which I disagree with), 
and add extra wrapping for socket.error (which I may agree with for 
consistency), and document existing “exception leaks”.

Issue 6471 discusses awkwardnesses of getting at the underlying exception that 
URLError wraps.

--
nosy: +martin.panter
stage:  -> needs patch

___
Python tracker 

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



[issue7759] mhlib fails on Btrfs filesystem (test_mhlib failure)

2015-11-16 Thread Neil Schemenauer

Neil Schemenauer added the comment:

Okay, feel free to close this bug.  I had heard that HFS+ counts files but I 
don't have a way to verify that.

--

___
Python tracker 

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



[issue25637] Move non-collections-related ABCs out of collections.abc

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

I guess is the objection of putting concrete ABCs in the abc module is that the 
abc module contains the actual code to implement ABCs and not ABCs themselves. 
Personally I would be fine with a submodule within abc like abc.interfaces.

Personally I'm starting to warm to the idea of sticking ABCs in proper packages 
as e.g. functools.abc for Callable; namespaces are one honking great idea after 
all. :)

--

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, so when you say "horrible for everyone", this is really IronPython and 
Jython, right? :-) Other runtimes seem to do ok (perhaps not stellar, but ok).

--

___
Python tracker 

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



[issue25626] Gzip fails for file over 2**32 bytes

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

3.4 shouldn’t be affected by the gzip regression. In 3.4 the gzip module does 
not set max_length to limit the decompression size.

In 3.4 the underlying zlib module will also raise OverflowError if 
max_lenth=2**32, and my patch could be applied, but I don’t think it is worth 
it at this stage.

--

___
Python tracker 

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



[issue25637] Move non-collections-related ABCs out of collections.abc

2015-11-16 Thread Brett Cannon

New submission from Brett Cannon:

In discussing adding a context manager ABC in issue #25609, the idea of 
creating a new module for ABCs that is more analogous to the types modules came 
up. Currently all ABCs that are generic in the stdlib and don't belong to a 
specific module end up in collections.abc, e.g. the Awaitable ABC has nothing 
to do with data structures and yet it's in a module in the collections package.

What we could do is create an interfaces module which contains all the ABCs 
that are not specific to a package. This would mean moving the ABCs out of 
collections.abc that have nothing to do with collections such as things for 
async, etc. The real question, though, is how to decide what belongs where, 
e.g. is Iterable/Iterator a collection, and if so then what about Generator?

The other option is that instead of introducing a generic interfaces module we 
simply create appropriate new modules to house the thematic ABCs and avoid a 
dumping ground scenario, e.g. some new module for the async stuff instead of 
just dumping them in an interfaces module. All the other ABCs could probably 
find existing homes, e.g. Callable could go into functools (although do we want 
to start a practice of having an abc submodule for all instances where ABCs 
exist and thus introduce functools.abc?).

--
components: Library (Lib)
messages: 254744
nosy: brett.cannon, rhettinger, stutzbach
priority: normal
severity: normal
stage: test needed
status: open
title: Move non-collections-related ABCs out of collections.abc
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

That link is to a Jupyter notebook so you don't have to watch anything. Plus 
the video is not even up yet so you can't skip the keynote even if you wanted 
to since you can't watch it yet. :)

--

___
Python tracker 

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



[issue7759] mhlib fails on Btrfs filesystem (test_mhlib failure)

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, what I read, HFS+ counts files. st_ntlink is a number of files and 
directories + 2 (perhaps for fake "." and ".."). This value never less than 2 + 
number_of_subdirectories, hence the code should work. Just an optimization has 
no any effect (as well as on FS where st_ntlink == 1).

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

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

Depending on how issue #25637 turns out, the ABC could go into contextlib or a 
new interfaces modules.

--

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Brett Cannon

New submission from Brett Cannon:

If you look at bit.ly/pycon-ca-keynote you will notice that the etree_parse and 
etree_iterparse benchmarks were horrible for everyone. Because of how badly 
everyone seemed to do, I think the benchmarks should be verified to be doing 
reasonable things on implementations other than CPython 2.7.

--
components: Benchmarks
messages: 254746
nosy: brett.cannon, pitrou
priority: normal
severity: normal
status: open
title: Verify the etree_parse and etree_iterparse benchmarks are working 
appropriately

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Brett Cannon

Brett Cannon added the comment:

Well, Jython and IronPython obviously did the worst, but even Python 3 didn't 
do as well as I would have expected, so I still want to double-check the 
benchmarks to see if it's obvious why CPython 2.7 beats out everyone.

--

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue25638] Verify the etree_parse and etree_iterparse benchmarks are working appropriately

2015-11-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Would you have a quick summary for those not willing to watch a whole keynote?

--

___
Python tracker 

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



[issue20220] test_datetime, test_tarfile, test_strptime time zone failures

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

The RHEL and SLES buildbots seem to be much happier. (Apart from timeouts in 
2.7, which is probably a separate issue.) I also opened a glibc bug: 
.

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

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

Thinking about this more I believe it's possible for any of the FD callbacks in 
selector_events.py to be placed into loop._ready multiple times if the loop is 
stopped after the FD is ready (and the callback is scheduled) but before the 
callback is called. In all cases such a scenario results in the same callback 
(with the same future) being scheduled twice; the first call will call 
fut.set_result() and then the second call, if the FD is (still, or again) 
ready, will fail calling fut.set_result() on the same Future.

The reason we've only seen reports of this for _sock_connect_cb() is probably 
that the other calls are all uncommon -- you have to explicitly call 
loop.sock_accept(), loop.sock_recv(), or loop.sock_sendall(), which is not the 
usual (or recommended) idiom. Instead, most people use Transports and 
Protocols, which use a different API, and create_server() doesn't use 
sock_accept().  But create_connection() *does* call sock_connect(), so that's 
used by everybody's code.

I think the discussed change to stop() to set a flag that is only checked after 
all the ready for-loop is done might work here -- it guarantees that all I/O 
callbacks get to run before the selector is polled again. However, it requires 
that an I/O callback that wants to modify the selector in order to prevent 
itself from being called must do so itself, not schedule some other call that 
modifies the selector. That's fine for the set of I/O callbacks I've looked at.

I just don't feel comfortable running the ready queue before polling the 
selector, since a worst-case scenario could starve the selector completely (as 
I sketched before -- and the proposed modification to stop() doesn't directly 
change this).

--

___
Python tracker 

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-16 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

I committed the patch as it was. But normally I do try to keep the number of 
lines in the diff close to the minimum, even when committing. RST files are 
like source code and it doesn’t matter if the wrapping is not 100% perfect, 
because they get turned into HTML or whatever anyway. Plus keeping the diff to 
a minimum helps when looking through the repository history with annotate or 
whatever.

On the other hand, for doc strings, I think it is best to rewrap them, because 
that is the wrapping you end up with in pydoc and help().

--

___
Python tracker 

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



[issue25615] Document unsorted behaviour of glob.glob

2015-11-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa4f0096b719 by Martin Panter in branch '2.7':
Issue #25615: Document unsorted behaviour of glob; patch by Dave Jones
https://hg.python.org/cpython/rev/fa4f0096b719

New changeset 7ca6a13db0e5 by Martin Panter in branch '3.4':
Issue #25615: Document unsorted behaviour of glob; patch by Dave Jones
https://hg.python.org/cpython/rev/7ca6a13db0e5

New changeset f928dcb448a9 by Martin Panter in branch '3.5':
Issue #25615: Merge glob doc from 3.4 into 3.5
https://hg.python.org/cpython/rev/f928dcb448a9

New changeset a6bc96c2b8be by Martin Panter in branch 'default':
Issue #25615: Merge glob doc from 3.5
https://hg.python.org/cpython/rev/a6bc96c2b8be

--
nosy: +python-dev

___
Python tracker 

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



[issue25642] Setting maxsize breaks asyncio.JoinableQueue/Queue

2015-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

Should also be fixed in the next 3.4/3.5 releases. We rewrote the guts of the 
Queue class to be much simpler. See https://github.com/python/asyncio 
(specifically, 
https://github.com/python/asyncio/commit/872597ba12953849cc6893042fd044073b87f870).

--

___
Python tracker 

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



[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2015-11-16 Thread Michael Foord

Michael Foord added the comment:

I'm happy to blacklist __wrapped__ in call. I don't see how call can detect 
that kind of introspection in the general case though. Limiting call depth 
would be one option, but any limit is going to be arbitrary and I don't "like" 
that as a solution.

--

___
Python tracker 

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



[issue24313] json fails to serialise numpy.int64

2015-11-16 Thread Amit Feller

Changes by Amit Feller :


--
nosy: +Amit Feller

___
Python tracker 

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



[issue25644] Unable to open IDLE on Windows 10 with Python 2.7.10

2015-11-16 Thread Jatin Miglani

New submission from Jatin Miglani:

Hi,
Seems like an issue with IDLE on Windows 10 with Python 2.7.10 active Python 
distribution. I'm able to open IDLE but it crash immediately. Try with deleting 
.idle folder but it couldn't help. Then I moved backed to 2.7.9 version 
which ultimately helps to get it invoked from machine. 
Kindly reproduce and check the 2.7.10 distribution with windows 10 64 bit.
Thanks
Jatin Miglani

--
components: IDLE
messages: 254782
nosy: jatanig
priority: normal
severity: normal
status: open
title: Unable to open IDLE on Windows 10 with Python 2.7.10
type: crash

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Justin Mayfield

Justin Mayfield added the comment:

You bet.

--

___
Python tracker 

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



[issue25640] Message.is_attachment() throws exception

2015-11-16 Thread R. David Murray

R. David Murray added the comment:

Ah, yes, that would do it.  EmailMessage should definitely throw an error if it 
gets compat32 as a policy, that would have told you what you were doing "wrong".

What you want to be doing is:

  msg = message_from_string(mystring, policy=default)

That will get you an EmailMessage object.  Note, however, that you almost never 
want message_from_string, because real email messages are bytes objects, not 
strings.  string only works if your message is ASCII only. (There's an open 
issue about documenting this properly...and a big doc revision in the offing.)

--

___
Python tracker 

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



[issue25640] EmailMessage should throw an error if policy is set to compat32

2015-11-16 Thread R. David Murray

Changes by R. David Murray :


--
title: Message.is_attachment() throws exception -> EmailMessage should throw an 
error if policy is set to compat32

___
Python tracker 

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



[issue25642] Setting maxsize breaks asyncio.JoinableQueue/Queue

2015-11-16 Thread Chris Seto

New submission from Chris Seto:

When maxsize is set on a JoinableQueue/Queue and the queue is full (maxsize <= 
len(queue)) _put is called rather than __put_internal.
__put_internal increments _unfinished_tasks but _put does not.
Whenever using maxsize in a Queue calling task_done will almost always cause a 
ValueError('task_done() called too many times').

--
components: asyncio
files: test.py
messages: 254773
nosy: Chris Seto, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Setting maxsize breaks asyncio.JoinableQueue/Queue
type: crash
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file41057/test.py

___
Python tracker 

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



[issue22555] Tracking issue for adjustments to binary/text boundary handling

2015-11-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Thanks. I suspect some of the Windows problems are indeed due to bogus 
assumptions in my draft tests, but at the same time, folks should be able to 
invoke subprocesses with Unicode values without needing extensive knowledge of 
platform specific Unicode handling arcana (whether that's *nix or Windows).

I've added Victor to the nosy list as well, since he'd previously expressed 
interest in implementing a cross-platform "force UTF-8" mode for 3.6 (akin to 
the default behaviour on Mac OS X), and I suspect these proposed test cases 
will be relevant to such a capability.

--
nosy: +haypo

___
Python tracker 

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



[issue25642] Setting maxsize breaks asyncio.JoinableQueue/Queue

2015-11-16 Thread Chris Seto

Chris Seto added the comment:

Looks to be fixed in python 3.6

--
resolution:  -> fixed

___
Python tracker 

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



[issue23883] __all__ lists are incomplete

2015-11-16 Thread Martin Panter

Martin Panter added the comment:

issue23883_fileinput.v2.patch looks good to me.

--

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

@Justin: Do you want to come up with a PR for the stop() changes?
Hopefully including tests (I bet at least one test will fail -- our
tests in generally are pretty constraining).

On Mon, Nov 16, 2015 at 6:32 PM, Justin Mayfield  wrote:
>
> Justin Mayfield added the comment:
>
> +1
>
> Let me know what I can do to help.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Justin Mayfield

Justin Mayfield added the comment:

+1

Let me know what I can do to help.

--

___
Python tracker 

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



[issue25643] Python tokenizer rewriting

2015-11-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is preliminary patch that refactors the lowest level of Python tokenizer, 
reading and decoding. It splits the code on smaller simpler functions, 
decreases the source size by 37 lines, and fixes bugs: issue14811, issue18961, 
and a number of others. Added tests for most of fixed bugs (except leaks and 
others hardly reproducible). But the fix for other bugs can be harder, 
especially for issues with null byte (issue1105770, issue20115).

Many bug easily can be fixed if read all Python file in memory instead of 
reading it line by line. I don't know if it is acceptable.

--
assignee: serhiy.storchaka
components: Interpreter Core
files: tokenize_input.patch
keywords: patch
messages: 254778
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Python tokenizer rewriting
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file41058/tokenize_input.patch

___
Python tracker 

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



[issue25633] The documentation for urllib.request should mention http.client.HTTPException

2015-11-16 Thread jon orebro

New submission from jon orebro:

The documentation for urllib.request should mention that a robust client using 
urllib.request must be prepared for exceptions of type 
http.client.HTTPException in addition to urllib.error.URLError.

Example: the server breaks HTTP and returns an empty status line and we get a 
http.client.BadStatusLine.

--
assignee: docs@python
components: Documentation
messages: 254720
nosy: docs@python, jon orebro
priority: normal
severity: normal
status: open
title: The documentation for urllib.request should mention 
http.client.HTTPException
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue25634] Add a dedicated subclass for attribute missing errors

2015-11-16 Thread Jun Wang

New submission from Jun Wang:

See this simple example:

class A(): 
def __init__(self, x=None): 
self.x = x

@property
def t(self): 
return self.x.t

def __getattr__(self, name): 
return 'default'

print(A().t)


AttributeError is raised as "'NoneType' object has no attribute 't'". Currently 
__getattr__ is called if any AttributeError is raised, so the result of a.t is 
*default*, while an AttributeError is the desired behavior.

The most intuitive solution seems to add a subclass of AttributeError, say 
AttributeMissError, which triggers __getattr__. At present, I have to do some 
tricky and ugly things to __getattribute__ to show where the AttributeError 
occurs, or it's quite hard to figure out what happened with no informative 
traceback messages.

--
components: Interpreter Core
messages: 254722
nosy: 王珺
priority: normal
severity: normal
status: open
title: Add a dedicated subclass for attribute missing errors
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue9051] Improve pickle format for timezone aware datetime instances

2015-11-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e48da8f01316 by Serhiy Storchaka in branch '3.4':
Issue #9051: Added tests for pickling and copying the timezone objects.
https://hg.python.org/cpython/rev/e48da8f01316

New changeset 634905e9628d by Serhiy Storchaka in branch '3.5':
Issue #9051: Added tests for pickling and copying the timezone objects.
https://hg.python.org/cpython/rev/634905e9628d

New changeset 9c31544d6a66 by Serhiy Storchaka in branch 'default':
Issue #9051: Added tests for pickling and copying the timezone objects.
https://hg.python.org/cpython/rev/9c31544d6a66

--
nosy: +python-dev

___
Python tracker 

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



[issue20220] test_datetime, test_tarfile, test_strptime time zone failures

2015-11-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 673b4b093796 by Martin Panter in branch '3.4':
Issue #20220: Add DST rules to work around glibc quirk
https://hg.python.org/cpython/rev/673b4b093796

New changeset 364bd520d9f1 by Martin Panter in branch '3.5':
Issue #20220: Merge time zone workaround from 3.4 into 3.5
https://hg.python.org/cpython/rev/364bd520d9f1

New changeset 039a370d047d by Martin Panter in branch 'default':
Issue #20220: Revert time zone test debugging, revision 139c18943d9b
https://hg.python.org/cpython/rev/039a370d047d

New changeset 007235e65603 by Martin Panter in branch 'default':
Issue #20220: Merge time zone workaround from 3.5
https://hg.python.org/cpython/rev/007235e65603

--
nosy: +python-dev

___
Python tracker 

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



[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2015-11-16 Thread Michael Foord

Michael Foord added the comment:

Patch looks good to me.

--

___
Python tracker 

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



[issue9051] Improve pickle format for timezone aware datetime instances

2015-11-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> import pickle, pickletools, datetime
>>> len(pickle.dumps([datetime.datetime.utcfromtimestamp(i) for i in 
>>> range(1)], 3)) / 1
30.9283
>>> len(pickle.dumps([datetime.datetime.fromtimestamp(i, datetime.timezone.utc) 
>>> for i in range(1)], 3)) / 1
32.936
>>> len(pickle.dumps([datetime.datetime.utcfromtimestamp(i) for i in 
>>> range(1)], 4)) / 1
19.0074
>>> len(pickle.dumps([datetime.datetime.fromtimestamp(i, datetime.timezone.utc) 
>>> for i in range(1)], 4)) / 1
21.0144

In best case the UTC timezone costs only 2 bytes per datetime instance (BINGET 
+ 1-byte index). In worst case it can cost 5 bytes (LONG_BINGET + 4-bytes 
index). Saving few bytes for single timezone instance has significant effect 
only for small pickled data. But in this case it is more advantageous to save a 
datetime just as a timestamp. I suggest to close this issue.

--

___
Python tracker 

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



[issue25641] urllib/request.py/getproxies_environment() throws "dictionary changed size during iteration" error occasionally

2015-11-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

For a simple fix, 2393 should probably read:

for name, value in list(os.environ.items()):

--
nosy: +rhettinger

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-16 Thread Eryk Sun

Eryk Sun added the comment:

As a workaround you can open a file descriptor via os.open:

>>> import os
>>> fd = os.open(r'\\.\PhysicalDrive0', os.O_RDONLY | os.O_BINARY)
>>> os.read(fd, 512)[:8]
b'3\xc0\x8e\xd0\xbc\x00|\x8e'

> _Py_fstat result not used on windows in this place. 

While it's pretty much useless, it is possible to open a CRT file descriptor 
for a directory handle:

>>> h = _winapi.CreateFile('C:\\', 0x8000, 3, 0, 3, 0x0200, 0)
>>> fd = msvcrt.open_osfhandle(h, os.O_RDONLY)
>>> open(fd)
Traceback (most recent call last):
  File "", line 1, in 
IsADirectoryError: [Errno 21] Is a directory: 3

So calling _Py_fstat shouldn't be skipped on Windows.

The issue is that a raw disk device doesn't support querying information 
(IRP_MJ_QUERY_INFORMATION), as shown in this local kernel debugging session:

lkd> !object \GLOBAL??\PhysicalDrive0
[...]
Target String is '\Device\Harddisk0\DR0'

lkd> !object \Device\Harddisk0\DR0
Object: e001c4fa4500  Type: (e001c3d7bd30) Device
[...]

lkd> !devobj e001c4fa4500
Device object (e001c4fa4500) is for:
 DR0 \Driver\disk DriverObject e001c4fa3310
[...]

lkd> !drvobj \Driver\disk 2
[...]
Dispatch routines:
[...]
[05] IRP_MJ_QUERY_INFORMATION  f8037251a06c  nt!IopInvalidDeviceRequest
[06] IRP_MJ_SET_INFORMATIONf8037251a06c  nt!IopInvalidDeviceRequest
[...]

Specifically WinAPI GetFileInformationByHandle calls the system function 
NtQueryInformationFile. The system call makes an IRP_MJ_QUERY_INFORMATION I/O 
request of the driver, which for a raw disk device is handled by 
IopInvalidDeviceRequest. This fails the request with 
STATUS_INVALID_DEVICE_REQUEST (0xC010), which translates to WinAPI 
ERROR_INVALID_FUNCTION (0x0001). 

Possibly in the case of ERROR_INVALID_FUNCTION, FileIO can just call 
PyErr_Clear and skip the code that uses fdfstat.

--
nosy: +eryksun

___
Python tracker 

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