[issue22995] Restrict default pickleability

2016-01-07 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

So yeah, I guess Cython is doing something magical to boost the instance's 
type's basicsize, but I can't tell what from the Python prompt.  It also 
clearly doesn't affect the un/picklability of the instance, so I think the 
entire check is probably misguided.

It should almost definitely not raise a TypeError.  Either disable the entire 
check, or at most make it a warning.

--

___
Python tracker 

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



[issue26045] Improve error message for http.client when posting unicode string

2016-01-07 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks like that Windows buildbot is now green. Of the stable bots only 
OpenIndiana is red, and it's unrelated.

--

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm very skeptical of this. I expect it would cause quite a few surprises for 
people who aren't used to bitmask operations on integers, let alone on (byte) 
strings.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2016-01-07 Thread Andrew Barnert

Andrew Barnert added the comment:

For what it's worth, I looked at some old code (a clean re-implementation of a 
crypto algorithm in Python, used as a unit test for production code in C++) and 
found this:

class BytesBits(bytes):
# from a quick test, 1.12us in NumPy, 1.39us in C, 2.55us this way, 46.1us 
with bytes(genexpr), so we don't need numpy
def _bitwise(self, other, op):
iself = int.from_bytes(self, 'little')
iother = int.from_bytes(other, 'little')
b = op(iself, iother)
return b.to_bytes(len(self), 'little')
def __or__(self, other):
return self._bitwise(other, int.__or__)
__ror__ = __or__
def __and__(self, other):
return self._bitwise(other, int.__and__)
__rand__ = __and__
def __xor__(self, other):
return self._bitwise(other, int.__xor__)
__rxor__ = __xor__

It doesn't do as much error checking as you want, but it was good enough for my 
purposes.

At any rate, the fact that it's trivial to wrap this up yourself (and even more 
so if you just write functions called band/bor/bxor instead of wrapping them up 
in a subclass) implies to me that, if it's not used all that often, it doesn't 
need to be on the builtin types.

--
nosy: +abarnert

___
Python tracker 

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



[issue26046] Typo in documentation of unittest

2016-01-07 Thread Emanuel Barry

Emanuel Barry added the comment:

Think you can submit a patch?

--
keywords: +easy
nosy: +ebarry
stage:  -> needs patch
title: Typo -> Typo in documentation of unittest

___
Python tracker 

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



[issue26046] Typo

2016-01-07 Thread David Sterry

New submission from David Sterry:

In https://docs.python.org/2/library/unittest.html#basic-example the word 
"details" should be "detail".

--
assignee: docs@python
components: Documentation
messages: 257731
nosy: David Sterry, docs@python
priority: normal
severity: normal
status: open
title: Typo
type: enhancement
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



[issue26026] True%2 is True

2016-01-07 Thread Hristo Venev

Hristo Venev added the comment:

One last thing: type(a%b) is A, type(b%a) is int.

--

___
Python tracker 

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



[issue22088] base64 module still ignores non-alphabet characters

2016-01-07 Thread Martin Panter

Martin Panter added the comment:

This new patch applies to Python 3. As well as the above changes, I updated the 
doc strings based on the changes in 92760d2edc9e (Issue 1753718, Issue 20782), 
mainly clarifying the data types functions accept and return. Further fixes:

* In Python 3, b16decode() raises binascii.Error, not TypeError
* The base-85 functions’ data parameter is called “b”, not “s”

--
Added file: http://bugs.python.org/file41522/base64-discard.py3.patch

___
Python tracker 

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



[issue24870] Optimize ascii and latin1 decoder with surrogateescape and surrogatepass error handlers

2016-01-07 Thread INADA Naoki

INADA Naoki added the comment:

FYI, I found a workaround.
https://github.com/PyMySQL/PyMySQL/pull/409

_table = [chr(i) for i in range(128)] + [chr(i) for i in range(0xdc80, 0xdd00)]

def decode_surroundescape(s):
return s.decode('latin1').translate(_table)

In [15]: data = b'\xff' * 1024 * 1024

In [16]: data.decode('ascii', 'surrogateescape') == decode_surroundescape(data)
Out[16]: True

In [17]: %timeit data.decode('ascii', 'surrogateescape')
1 loops, best of 3: 394 ms per loop

In [18]: %timeit decode_surroundescape(data)
10 loops, best of 3: 40 ms per loop

--

___
Python tracker 

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



[issue24870] Optimize ascii and latin1 decoder with surrogateescape and surrogatepass error handlers

2016-01-07 Thread STINNER Victor

STINNER Victor added the comment:

> In [18]: %timeit decode_surroundescape(data)
> 10 loops, best of 3: 40 ms per loop

Cool! Good job.

--

___
Python tracker 

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



[issue26032] Use scandir() to speed up pathlib globbing

2016-01-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Library (Lib)
dependencies: +File descriptor leaks in os.scandir(), regular files handled as 
directories in the glob module
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



[issue26029] Broken sentence in extending documentation

2016-01-07 Thread Upendra Kumar

Upendra Kumar added the comment:

I am submitting the patch with small change suggested by you. Thank you.

--
keywords: +patch
nosy: +upendra-k14
Added file: http://bugs.python.org/file41524/building_additional.patch

___
Python tracker 

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



[issue26045] Improve error message for http.client when posting unicode string

2016-01-07 Thread Martin Panter

Martin Panter added the comment:

After reading through the linked thread, there are a few error message 
proposals:

Guido: "use data.encode('utf-8') if you want the data to be encoded in UTF-8". 
(Then of course the server might not like it.)

Andrew Barnert: A UnicodeEncodeError (or subclass of it?) with text like "HTTP 
body without encoding defaults to 'latin-1', which can't encode character 
'\u' in position 30: ordinal not in range(256)")

Paul Moore: Encode as ASCII and catch UnicodeEncodeError and re-raise as a 
TypeError "Unicode string supplied without an explicit encoding".

Emil, do you think any of these would help?

--

___
Python tracker 

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



[issue26045] Improve error message for http.client when posting unicode string

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Any solution that encodes Unicode in a way that works for some characters but 
fails for others has the same problem that Unicode had in Python 3. 
Unfortunately we're stuck with such a solution (Latin-1) and for backwards 
compatibility reasons we can't change it. If we were to deprecate it, we should 
warn for *any* data given as a Unicode string, even if it's plain ASCII (even 
if it's an empty string :-).

But even if we don't deprecate it, we can still change the text of the error 
message (but not the type of the exception used) to be more clear.

Can we please start drafting a suitable error message here?

--

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Oops, sorry about that. I will see if I can figure out how to repro this -- on 
my own Mac it succeeds. In the mean time if you could have a look yourself 
(since you can repro it on your own computer) I'd be grateful. Initial hunches: 
maybe a case-insensitivity crept into the test?

--

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-01-07 Thread Dan Kegel

Dan Kegel added the comment:

Still present in python 2.7.9, but fixed in python 3.4.3.
Also, in python 3.4.3, output is immediate, there seems to be no
input buffering.

--
nosy: +dankegel

___
Python tracker 

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



[issue5501] Update multiprocessing docs re: freeze_support

2016-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f08d4712a055 by Berker Peksag in branch '3.5':
Issue #5501: Clarify that invoking freeze_support() on non-Windows platforms 
has no effect
https://hg.python.org/cpython/rev/f08d4712a055

New changeset 2902f32d1ae9 by Berker Peksag in branch 'default':
Issue #5501: Clarify that invoking freeze_support() on non-Windows platforms 
has no effect
https://hg.python.org/cpython/rev/2902f32d1ae9

--
nosy: +python-dev

___
Python tracker 

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



[issue25672] set SSL_MODE_RELEASE_BUFFERS

2016-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b5b0394ed20b by Benjamin Peterson in branch 'default':
merge 3.5 (closes #25672)
https://hg.python.org/cpython/rev/b5b0394ed20b

--
nosy: +python-dev
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



[issue26017] Update https://docs.python.org/3/installing/index.html to always quote arguments

2016-01-07 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Here is the patch with the changes suggested by Brett.

Having created this patch, I had second thoughts on this change. Folks who use 
pip often, usually use it without any quotes, like `pip install requests`, `pip 
install CherryPy`. Pinned down versions are most often required by projects and 
they mention it in the requirements.txt in an unquoted manner
Ref: https://pip.readthedocs.org/en/1.1/requirements.html
It works fine as it is not the shell which is parsing this file.

Since ">" thing parsed by shell on the command line is a special thing, why not 
address that scenario with more clarification, instead of quoting all the 
examples, which seem contrary to the common usage patterns?

--
keywords: +patch
nosy: +orsenthil
Added file: http://bugs.python.org/file41529/Issue26017.patch

___
Python tracker 

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



[issue26044] Name mangling overrides externally defined names

2016-01-07 Thread Ethan Furman

Ethan Furman added the comment:

Nice work with the debugging. but what you have proved is that Python is 
behaving exactly as designed [0].

While true that the current implementation does have the pitfall you have 
discovered, removing it is not worth the cost in complexity.

The proper "fix" is not to have __vars outside of a class.


[0] 
[https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references]

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

___
Python tracker 

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



[issue26036] Unnecessary arguments on smtpd.SMTPServer

2016-01-07 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue26042] Consider dropping magic number for more detailed .pyc file name

2016-01-07 Thread Brett Cannon

New submission from Brett Cannon:

The reason the magic number exists in .pyc files is because back in Python 2 we 
only had a single .pyc file per module, which meant if you suddenly switched 
versions of Python you needed a way to know that the .pyc file was wrong for 
the running version of Python.

This is not the case in Python 3. Thanks to __pycache__ directories we have 
separate .pyc files per release version of Python (we also have .pyc files for 
each optimization level of Python). If we changed the 
sys.implementation.cache_tag to include the bugfix version -- and maybe even 
release level -- then the magic number wouldn't be necessary for users. It does 
make developing bytecode a little bit more difficult for core developers since 
they will have to clear out their .pyc files during development, but users 
wouldn't be affected.

Now I don't know if this is really worth the simplification it provides. I 
don't think it's worth the compatibility break for any code that may be reading 
.pyc files and I doubt there is any measurable performance benefit.  But the 
realization struck me and I figured I should at least write it down in case 
anyone else thinks of it.

--
components: Interpreter Core
messages: 257705
nosy: brett.cannon, eric.snow, ncoghlan
priority: low
severity: normal
stage: test needed
status: open
title: Consider dropping magic number for more detailed .pyc file name
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



[issue26027] Support Path objects in the posix module

2016-01-07 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4043e08e6e52 by Guido van Rossum in branch '3.4':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012.
https://hg.python.org/cpython/rev/4043e08e6e52

New changeset 8a3b0c1fb3d3 by Guido van Rossum in branch '3.5':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012. (Merge 3.4->3.5)
https://hg.python.org/cpython/rev/8a3b0c1fb3d3

New changeset 398cb8c183da by Guido van Rossum in branch 'default':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012. (Merge 3.5->3.6)
https://hg.python.org/cpython/rev/398cb8c183da

--

___
Python tracker 

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



[issue24120] pathlib.(r)glob stops on PermissionDenied exception

2016-01-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4043e08e6e52 by Guido van Rossum in branch '3.4':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012.
https://hg.python.org/cpython/rev/4043e08e6e52

New changeset 8a3b0c1fb3d3 by Guido van Rossum in branch '3.5':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012. (Merge 3.4->3.5)
https://hg.python.org/cpython/rev/8a3b0c1fb3d3

New changeset 398cb8c183da by Guido van Rossum in branch 'default':
Add another try/except PermissionError to avoid depending on listdir order. Fix 
issues #24120 and #26012. (Merge 3.5->3.6)
https://hg.python.org/cpython/rev/398cb8c183da

--

___
Python tracker 

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



[issue26031] Add stat caching option to pathlib

2016-01-07 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue26043] ON DELETE CASCADE does not work when using sqlite3 library

2016-01-07 Thread Vitaminus Maximus

New submission from Vitaminus Maximus:

Let me provide a completely reproducible code, which demonstrates the issue:

>>> import sqlite3
>>> cnx = sqlite3.connect("mytest.db")
>>> cnx.isolation_level = None
>>> cursor = cnx.cursor()
>>> cnx.execute("BEGIN")

>>> cursor.execute("CREATE TABLE test_table (id integer)")

>>> cursor.execute("CREATE UNIQUE INDEX id_primary ON test_table(id)")

>>> cursor.execute("INSERT INTO test_table (id) VALUES (1),(2),(3)")

>>> cursor.execute("CREATE TABLE test_table_2(id_fk integer, txt text,  
FOREIGN KEY (id_fk) REFERENCES test_table(id) ON DELETE CASCADE)")

>>> cursor.execute("INSERT INTO test_table_2 (id_fk, txt) VALUES 
(1,\"one\"),(2,\"two\"),(3,\"three\")")

>>> res = cursor.execute("SELECT * FROM test_table_2")
>>> res

>>> for r in res:
... print(r)
...
(1, 'one')
(2, 'two')
(3, 'three')
>>> cursor.execute("PRAGMA foreign_keys = ON")

>>> cursor.execute("DELETE FROM test_table WHERE id = 1")

>>> res = cursor.execute("SELECT * FROM test_table_2")
>>> for r in res:
... print(r)
...
(1, 'one')
(2, 'two')
(3, 'three')

As you can see, even though I explicitly set isolation_level, start transaction 
and specify PRAGMA foreign_keys = ON, it does not work. The expected behaviour 
is that when I run the last SELECT command, it should return only two rows 
(because a "parent" raw with id = 1 was deleted). By the way, if I run these 
commands in pure sqlite prompt, then I get what I expect to see.

--
components: Library (Lib)
messages: 257709
nosy: Vitaminus Maximus
priority: normal
severity: normal
status: open
title: ON DELETE CASCADE does not work when using sqlite3 library
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



[issue22995] Restrict default pickleability

2016-01-07 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Your explanation still doesn't entirely make sense to me yet because the crash 
is happening in what seems to be a Cython implementation class, not a generated 
class based on a .pyx in some other project using Cython.

I tried to search the Cython Trac but either my Trac-fu sucks or nobody has yet 
reported compatibility problems with Python 3.5.1 to upstream.  I don't see any 
other relevant bug reports, and Cython's git head passes its test suite with 
Python 3.5.1 (other than the asyncio_generators test which is probably 
unrelated and has already been reported to the Cython mailing list).

It's always possible of course that the Python change is triggering a bug not 
caught by the Cython test suite, but something as fundamental as pickling would 
be surprising if not tested.

Turning the error into a warning does have a lot of appeal for 3.5 maintenance. 
 It could be kept as an error in 3.6.  At the least, can the exception text 
include more information about *why* the pickling failure occurs. (Note that 
the exact error message can be raised in multiple places, so I had to build a 
custom 3.5.1 to distinguish between them; I don't have gdb set up in the build 
environment yet.)

It's still worth better understanding why this change is causing the bugs in 
projects using Cython, and reviewing what happens with Python 3.5.0.  For 
completeness, I also want to verify that there isn't some problem specifically 
related to Ubuntu's version of Python 3.5.1, although the tests against 
Cython's git head use the same version.

--

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Should be fixed for real now.

--
status: open -> closed

___
Python tracker 

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



[issue22995] Restrict default pickleability

2016-01-07 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

You asked what reductor(4) returns in Python 3.5.0:

> /usr/lib/python3.5/copy.py(176)deepcopy()
-> rv = reductor(4)
(Pdb) reductor(4)
(, (,), None, None, None)

And this is completely reasonable:

(Pdb) p rv
(, (,), None, None, None)
(Pdb) p rv[0](*rv[1])
NameAssignment(entry=None)

I'm doing another debug build of Python to get more information about which 
extra bit of basicsize is getting added to trigger the TypeError.

--

___
Python tracker 

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



[issue22995] Restrict default pickleability

2016-01-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm not well known with Cython. Can it replace Python class with extension 
class on fly? There is a declaration of the NameAssignment class in 
Cython/Compiler/FlowControl.pxd. We need Cython expert.

--

___
Python tracker 

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



[issue26042] Consider dropping magic number for more detailed .pyc file name

2016-01-07 Thread Eric Snow

Eric Snow added the comment:

That's an interesting thought.  My intuition is that it wouldn't be worth doing.

It would certainly trade one development overhead for another, so it's a bit of 
a wash there, I think.  Are there other spots in the stdlib that rely on the 
magic number?  Is it used much outside the stdlib?

--

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Martin Panter

Martin Panter added the comment:

Thanks, your latest change seems to have fixed it on my Linux computer, and 
most of the buildbots. However now there is a failure on 
:

==
FAIL: test_rglob_common (test.test_pathlib.PathTest)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", 
line 1460, in test_rglob_common
"linkB/fileB", "dirA/linkC/fileB"])
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", 
line 1451, in _check
self.assertEqual(set(glob), { P(BASE, q) for q in expected })
AssertionError: Items in the second set but not the first:
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/linkB/fileB')
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/dirB/linkD/fileB')
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/dirA/linkC/fileB')

==
FAIL: test_rglob_common (test.test_pathlib.WindowsPathTest)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", 
line 1460, in test_rglob_common
"linkB/fileB", "dirA/linkC/fileB"])
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", 
line 1451, in _check
self.assertEqual(set(glob), { P(BASE, q) for q in expected })
AssertionError: Items in the second set but not the first:
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/linkB/fileB')
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/dirB/linkD/fileB')
WindowsPath('C:/buildbot.python.org/3.x.kloth-win64/build/build/test_python_1700/@test_1700_tmp/dirA/linkC/fileB')

I don’t have a Windows setup so I can’t really help much with this one.

--

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2016-01-07 Thread Andrew Barnert

Changes by Andrew Barnert :


Added file: http://bugs.python.org/file41527/patch4a.diff

___
Python tracker 

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



[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-07 Thread Guido van Rossum

Guido van Rossum added the comment:

I think I understand the Windows failure. I uncommented some tests that were 
previously broken due to the symlink loop and/or PermissionError, but one of 
these has a different expected outcome if symlinks don't work. I've pushed a 
hopeful fix for that (no Windows box here either, but the buildbots are good 
for this :-).

--

___
Python tracker 

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



[issue26045] Improve error message for http.client when posting unicode string

2016-01-07 Thread Emil Stenström

New submission from Emil Stenström:

This issue is in response to this thread on python-ideas: 
https://mail.python.org/pipermail/python-ideas/2016-January/037678.html

Note that Cory did a lot of encoding background work here:
https://mail.python.org/pipermail/python-ideas/2016-January/037680.html

---
Bug description:

When posting an unencoded unicode string directly with python-requests you get 
the following stacktrace:

import requests
r = requests.post("http://example.com;, data="Celebrate ") 
...
  File "../lib/python3.4/http/client.py", line 1127, in _send_request
body = body.encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 14-15: 
ordinal not in range(256) 

This is because requests uses http.client, and http.client assumes the encoding 
to be latin-1 if given a unicode string. This is a very common source of bugs 
for beginners who assume sending in unicode would automatically encode it in 
utf-8, like in the libraries of many other languages.

The simplest fix here is to catch the UnicodeEncodeError and improve the error 
message to something that points beginners in the right direction.

Another option would be to:
- Keep encoding in latin-1 first, and if that fails try utf-8

Other possible solutions (that would be backwards incompatible) includes:
- Changing the default encoding to utf-8 instead of latin-1
- Detect an unencoded unicode string and fail without encoding it with a 
descriptive error message

---

Just to show that this is a problem that exists in the wild, here are a few 
examples that all crashes on the same line in http.client (not all going 
through the requests library:

- https://github.com/kennethreitz/requests/issues/2838
- https://github.com/kennethreitz/requests/issues/1822
- 
http://stackoverflow.com/questions/34618149/post-unicode-string-to-web-service-using-python-requests-library
- 
https://www.reddit.com/r/learnpython/comments/3violw/unicodeencodeerror_when_searching_ebay_with/
- https://github.com/codecov/codecov-python/issues/35
- https://github.com/google/google-api-python-client/issues/145
- https://bugs.launchpad.net/ubuntu/+source/lazr.restfulclient/+bug/1414063

--
components: Unicode
messages: 257721
nosy: Emil Stenström, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Improve error message for http.client when posting unicode string
type: enhancement
versions: Python 3.2, Python 3.3, 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



[issue26042] Consider dropping magic number for more detailed .pyc file name

2016-01-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about zipimport? It doesn't use __pycache__ directories, but just try to 
read *.pyc file, then *.py file.

The launcher on Windows also check magic number (it contains a mapping from 
magic numbers to Python versions).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26042] Consider dropping magic number for more detailed .pyc file name

2016-01-07 Thread Brett Cannon

Brett Cannon added the comment:

I figured it was a wash. Closing as "won't fix".

As for zipimport, it's busted thanks to the fact that it doesn't work with 
__pycache__ directories. Yet another reason it needs to be rewritten.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue22995] Restrict default pickleability

2016-01-07 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I added some debugging to the if(required) clause.  This is interesting:

basicsize 16
slotnames 0 basicsize 16
tp_basicsize 80 basicsize 16

tp_basicsize comes in at 16 bytes.  tp_dictoffset and tp_weaklistoffset must 
both be 0, and while slotnames is not Py_None, it must be adding 0 to the 
basicsize.  Since sizeof(PyObject *) can't be 0, it must mean that 
Py_SIZE(slotnames) is 0 (since they are multiplied).

But as you can see tp_basicsize is 80.  So essentially 
PyBaseObject_Type.tp_basicsize is 16 but obj->ob_type->tp_basicsize is 80, and 
that triggers the traceback.

--

___
Python tracker 

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