[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Oops, that should have been:

if init is MISSING:
init = True

--

___
Python tracker 

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



[issue29752] Enum._missing_ not called for __getitem__ failures

2018-01-21 Thread Ethan Furman

Ethan Furman  added the comment:

I'm not convinced this piece needs to be in the stdlib.  Unlike other bits that 
need extensive metaclass support this is trivial to add:

  class DerivedEnumMeta(EnumMeta):
def __getitem__(cls, name):
try:
return cls._member_map_[name]
except KeyError:
result = cls._missing_name_(name)
if isinstance(result, cls):
return result
raise

--
resolution:  -> rejected
stage: test needed -> resolved
status: open -> closed
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



[issue32617] dict.update does not concat/replace if same key

2018-01-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm sorry the name is confusing to you, but this behavior is correct, and how 
dict.update is defined:

https://docs.python.org/3.6/library/stdtypes.html#dict.update

As such, it cannot be changed.

If you want a function that merges values, you'll need to write it yourself.

Eric.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> 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



[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Only hash has the tri-state True/False/None behavior, defaulting to None. It's 
this way because None is the "do what's rational, based on eq and frozen" 
behavior. None of the other parameters work this way. 

There's a long issue in the attrs repo that describes how they came to this 
conclusion: https://github.com/python-attrs/attrs/issues/136. I think it makes 
sense.

None of the dataclass parameters have a sentinel that would let me detect if 
the user provided a value or not. In the case of hash, I can't detect if they 
explicitly passed hash=None or just didn't provide a value. I've given this 
some thought, and couldn't come up with a use case for knowing this. For 
example, if init had a sentinel value of MISSING, what would the code ever do 
except start with:
if init is sentinel:
init = True
?

In addition to your list of dunder-control-parameters, there's frozen. It 
determines if instances are immutable (to the extent that they can be made 
immutable).

--

___
Python tracker 

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



[issue12735] request full Unicode collation support in std python library

2018-01-21 Thread Greg Lindahl

Change by Greg Lindahl :


--
nosy: +wumpus

___
Python tracker 

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



[issue32618] fix test_codeccallbacks.test_mutatingdecodehandler

2018-01-21 Thread Xiang Zhang

Change by Xiang Zhang :


--
keywords: +patch
pull_requests: +5112
stage:  -> patch review

___
Python tracker 

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



[issue32618] fix test_codeccallbacks.test_mutatingdecodehandler

2018-01-21 Thread Xiang Zhang

New submission from Xiang Zhang :

test_codeccallbacks.test_mutatingdecodehandler is introduced in 
e78178e2c05ec2bb628b70a8b5422bb4dae63343. Obviously it should test against both 
test.replacing and test.mutating but it tests test.replacing twice.

--
components: Tests
keywords: easy
messages: 310398
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: fix test_codeccallbacks.test_mutatingdecodehandler
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue32617] dict.update does not concat/replace if same key

2018-01-21 Thread Avnish Midha

New submission from Avnish Midha :

The dict does not seem to work as one would expect a dictionary or a hashtable 
to work. 

dict.update(otherdict) just replaces the entries as per otherdict, removing 
items which were extra in dict too and just keeping items as per new data in 
otherdict only. Shouldn't this be actually about updating the dict with 
new/updated entries and not touching those entries which pre-existed?

Sample program below:
import pandas as pd

x = {'name': ['A', 'B', 'C'], 'col2': [3, 4,6]}
y = {'name': ['B', 'C', 'D', 'E'], 'col2': [1,2, 9, 10]}


print ("X = \n" + str(x))

print ("Y = \n" + str(y))

x.update(y)

print ("updated dict = \n"  + str(x) + "\n")

#

Output:

X = 
{'name': ['A', 'B', 'C'], 'col2': [3, 4, 6]}
Y = 
{'name': ['B', 'C', 'D', 'E'], 'col2': [1, 2, 9, 10]}
updated dict = 
{'name': ['B', 'C', 'D', 'E'], 'col2': [1, 2, 9, 10]}


Expected value:
updated dict = 
{'name': ['A','B', 'C', 'D', 'E'], 'col2': [3, 1, 2, 9, 10]}


Somehow to do this basic hashtable or dictionary update kind of operation is 
too complex in python and update() should have actually functioned as expected 
above IMO.

--
components: Interpreter Core
files: dict_try.py
messages: 310397
nosy: Avnish Midha
priority: normal
severity: normal
status: open
title: dict.update does not concat/replace if same key
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47400/dict_try.py

___
Python tracker 

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



[issue4356] Add "key" argument to "bisect" module functions

2018-01-21 Thread Greg Lindahl

Change by Greg Lindahl :


--
nosy: +wumpus

___
Python tracker 

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



[issue17799] settrace docs are wrong about "c_call" events

2018-01-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

Too bad, it's been like this since the feature was first created. It would
most likely break other code that uses the tracing hooks, so you'd have to
propose it as a new feature.

--

___
Python tracker 

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



[issue32616] Significant performance problems with Python 2.7 built with clang 3.x or 4.x

2018-01-21 Thread INADA Naoki

Change by INADA Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue32616] Significant performance problems with Python 2.7 built with clang 3.x or 4.x

2018-01-21 Thread Zhiming Wang

New submission from Zhiming Wang :

Python 2.7 could be significantly slower (5x in some cases) when compiled with 
clang 3.x or 4.x, compared to clang 5.x. This is quite a problem on macOS, 
since the latest clang from Apple (which comes with Xcode 9.2) is based on LLVM 
4.x. This issue was first noticed by Bart Skowron and reported to the Homebrew 
project.[1]

I ran some preliminary benchmarks (here[2] are the exact setup scripts) with 
just a simple loop:

import time

def f(n):
while n > 0:
n -= 1

start = time.time()
f(5000)
stop = time.time()
print('%.6f' % (stop - start))

and here are my results:

- macOS 10.13.2 on a MacBook Pro:

2.082144/usr/bin/python2.7
7.964049/usr/local/bin/python2.7
8.750652dist/python27-apple-clang-900/bin/python2.7
8.476405dist/python27-clang-3.9/bin/python2.7
8.625660dist/python27-clang-4.0/bin/python2.7
1.760096dist/python27-clang-5.0/bin/python2.7
3.254814/usr/local/bin/python3.6
2.864716dist/python-master-apple-clang-900/bin/python3
3.071757dist/python-master-clang-3.9/bin/python3
2.925192dist/python-master-clang-4.0/bin/python3
2.908782dist/python-master-clang-5.0/bin/python3

- Ubuntu 17.10 in VirtualBox:

1.475095/usr/bin/python2.7
8.576817dist/python27-clang-3.9/bin/python2.7
8.165588dist/python27-clang-4.0/bin/python2.7
1.779193dist/python27-clang-5.0/bin/python2.7
1.728321dist/python27-gcc-5/bin/python2.7
1.570040dist/python27-gcc-6/bin/python2.7
1.604617dist/python27-gcc-7/bin/python2.7
2.323037/usr/bin/python3.6
2.964338dist/python-master-clang-3.9/bin/python3
3.054277dist/python-master-clang-4.0/bin/python3
2.734908dist/python-master-clang-5.0/bin/python3
2.490278dist/python-master-gcc-5/bin/python3
2.494691dist/python-master-gcc-6/bin/python3
2.642277dist/python-master-gcc-7/bin/python3

I haven't got time to run more rigorous benchmark suites (e.g., the 
performance[3] package). I did try the floating point benchmark from 
performance, and again saw a 2x difference in performance.

[1] https://github.com/Homebrew/homebrew-core/issues/22743
[2] https://gist.github.com/zmwangx/f8151ba8907ba8159a07fdd1528fc2b5
[3] https://pypi.python.org/pypi/performance

--
messages: 310395
nosy: zmwangx
priority: normal
severity: normal
status: open
title: Significant performance problems with Python 2.7 built with clang 3.x or 
4.x
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



[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Larry Hastings

Larry Hastings  added the comment:

Do all the parameters to the decorator take a default value of "None", so that 
you can differentiate between explicit True, explicit False, and 
did-not-specify?

Is this the complete list of these dunder-method-generation-control parameters? 
init repr eq order hash

--
nosy: +larry

___
Python tracker 

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



[issue17799] settrace docs are wrong about "c_call" events

2018-01-21 Thread Xiang Zhang

Xiang Zhang  added the comment:

Hi Guido. Looking at the implementation, it seems pdb ignores c_call not by 
relying on the interpreter, but bdb takes no action when encountering C events. 
Yeah, even bdb wrongly expects C events will be triggered for settrace. [1]

And what if some debuggers want not only to trace Python events but also C 
events, then it has to mix the power of trace and profile but can't only rely 
on trace.

[1] https://github.com/python/cpython/blob/master/Lib/bdb.py#L59

--
versions: +Python 3.6, Python 3.7 -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



[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Here is my proposal for making it easier for the user to supply dunder methods 
that dataclasses would otherwise automatically add to the class.

For all of these cases, when I talk about init=, repr=, eq=, order=, hash=, or 
frozen=, I'm referring to the parameters to the dataclass decorator.

When checking if a dunder method already exists, I mean check for an entry in 
the class's __dict__. I never check to see if a member is defined in a base 
class.

Let's get the easy ones out of the way first.

__init__
If __init__ exists or init=False, don't generate __init__.

__repr__
If __repr__ exists or repr=False, don't generate __repr__.

__setattr__
__delattr__
If frozen=True and either of these methods exist, raise a TypeError. These 
methods are needed for the "frozen-ness" of the class to be implemented, and if 
they're already set then that behavior can't be enforced.

__eq__
If __eq__ exists or eq=False, don't generate __eq__.

And now the harder ones:

__ne__
I propose to never generate a __ne__ method. Python will call __eq__ and negate 
the result for you. If you feel you really need a non-matching __ne__, then you 
can write it yourself without interference from dataclasses.

__lt__
__le__
__gt__
__ge__
I propose to treat each of these individually, but for each of them using the 
value of the order= parameter. So:
If __lt__ exists or order=False, don't generate __lt__.
If __le__ exists or order=False, don't generate __le__.
If __gt__ exists or order=False, don't generate __gt__.
If __ge__ exists or order=False, don't generate __ge__.
If for some crazy reason you want to define some of these but not others, then 
set order=False and write your desired methods.

__hash__
Whether dataclasses might generate __hash__ depends on the values of hash=, 
eq=, and frozen=. Note that the default value of hash= is None. See below for 
an explanation.

If hash=False, never generate __hash__. If hash=True, generate __hash__ unless 
it already exists.

If hash=None (the default), then use this table to decide whether and how to 
generate __hash__:
eq=?frozen=?__hash__
False   False   do not generate __hash__
False   Truedo not generate __hash__
TrueFalse   set __hash__ to None unless it already exists
TrueTruegenerate __hash__ unless it already exists
 and is None

Note that it's almost always a bad idea to specify hash=True or hash=False. The 
action based on the above table (where hash=None, the default), is usually the 
correct behavior.

One special case to recognize is if the class defines a __eq__. In this case, 
Python will assign __hash__=None before the dataclass decorator is called. The 
decorator cannot distinguish between these two cases (except possibly by using 
the order of __dict__ keys, but that seems overly fragile):

@dataclass
class A:
def __eq__(self, other): pass

@dataclass
class B:
def __eq__(self, other): pass
__hash__ = None

This is the source of the last line in the above table: for a dataclass where 
eq=True, frozen=True, and hash=None, if __hash__ is None it will still be 
overwritten. The assumption is that this is what the user wants, but it's a 
tricky corner case. It also occurs if setting hash=True and defining __eq__. 
Again, it's not expected to come up in normal usage.

--
keywords:  -patch

___
Python tracker 

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



[issue32591] Deprecate sys.set_coroutine_wrapper and replace it with more focused API(s)

2018-01-21 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 3510334361d6d39aad89e4e0d9bccd0695668583 by Yury Selivanov in 
branch 'master':
bpo-32591: Fix PyExc_WarnFormat call (follow-up commit) (#5263)
https://github.com/python/cpython/commit/3510334361d6d39aad89e4e0d9bccd0695668583


--

___
Python tracker 

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



[issue27815] Make SSL suppress_ragged_eofs default more secure

2018-01-21 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

The current default is hard to defend -- it's a clear violation of the TLS 
specs. But I suspect that changing it will be pretty disruptive, because 
suppress_ragged_eof=True is the de facto standard for HTTP-over-TLS (generally 
justified on the grounds that HTTP has its own framing, so the TLS-level 
close-notify stuff is redundant), and that means that if we flip it cases that 
used to work correctly will start raising errors. We could avoid some of these 
issues by making http.client explicitly use suppress_ragged_eof=True, but then 
that won't fix Martin's problems...

A discussion about changing it should also consider what to do on 
sslsock.close(), since right now Python always gives the other side a "ragged 
eof" unless you call "sslsock.unwrap()", and I've never seen any code that does 
this. So flipping the suppress_ragged_eof default by itself will make Python's 
ssl module fail at interoperating with itself.

> 1. Truncate Set-Cookie field, with no terminating newline. [...] Python 
> (unpatched) treats the Set-Cookie field as valid. It appears in the 
> HTTPResponse object, with no clue that it was truncated.

This sounds like a bug in http.client – the lack of terminating newline should 
cause a parse failure regardless of what the SSL layer does (and regardless of 
whether we're even using SSL).

> 2. Content-Length response with truncated text/html. [...] In most cases, 
> Python raised an IncompleteRead exception, but it depended on the pattern of 
> read calls

Also a bug in http.client.

> 3. “Connection: close” response with truncated HTML:

This one's a little more interesting... First, "Connection: close" doesn't 
affect the framing of the HTTP body, it just says that this connection can't be 
reused for another request afterwards. The way HTTP works, if you have a 
response with neither a Content-Length header *nor* a Transfer-Encoding: 
chunked header, then it's assumed that the framing is determined by the 
connection being closed -- I assume that this is what you generated here. Now, 
this is a hack for backwards compatibility with HTTP/1.0; in theory, no modern 
server should ever generate such a response. In practice, who knows, people do 
all kinds of nonsense.

But... do we really think that servers who can't be bothered to implement 
HTTP/1.1, are also going to take the trouble to make sure their SSL/TLS 
handling is correct to the spec? If the server decides to use connection-close 
framing, that's their decision, and the client is kind of at their mercy.

--
nosy: +njs

___
Python tracker 

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



[issue27815] Make SSL suppress_ragged_eofs default more secure

2018-01-21 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I converted the patch to a PR.  

It wouldn't merge which means I did it manually, so please check it for errors. 
 Some issues I ran into:
1. The patch had a change to __slots__, but that line no longer existed and I 
didn't know if I needed to make a different change to accommodate it.
2. I converted the 'What's New' to a blurb.

--
nosy: +csabella

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2018-01-21 Thread ppperry

New submission from ppperry :

Take the following code:

import builtins
class K(dict):
def __getitem__(self, k):
if k not in builtins.__dict__:
print("get %s" % k)
return dict.__getitem__(self, k)
def __setitem__(self, k, v):
print("set %s" % k)
dict.__setitem__(self, k, v)
exec("""
foo = "bar"
foo
try:
qyz
except NameError:
pass
class K:
baz = foo
def f(ggg=foo): pass
def g(ggg=foo):
global f
f = 87
f
g()
""",K())

This should consitently either call or not call the overridden methods on the 
dictionary, producing either no output or:

set foo
get foo
get qyz
get foo
get foo
set K
get foo
set g
get g
set f
get f

Instead, only sometime the override gets called, producing

set foo
get foo
get qyz
set K
get foo
set g
get g
get f

meaning that 
(a) modifications of global variables via global statements
(b) code at class-level

ignore overridden methods, whereas everything else follows them

--
components: Interpreter Core
messages: 310388
nosy: ppperry
priority: normal
severity: normal
status: open
title: Inconsistent behavior if globals is a dict subclass
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



[issue31787] various refleaks when calling the __init__() method of an object more than once

2018-01-21 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Raymond,

You approved this PR pending some test cases.  Would you have the chance to 
take another look?

Thanks!


Oren, it looks like you'll need to rebase before this could be merged.

--
nosy: +csabella, rhettinger

___
Python tracker 

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



[issue32614] Fix documentation examples of using re with escape sequences

2018-01-21 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
keywords: +patch
pull_requests: +5111
stage:  -> patch review

___
Python tracker 

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



[issue32614] Fix documentation examples of using re with escape sequences

2018-01-21 Thread Cheryl Sabella

New submission from Cheryl Sabella :

If a documentation example would produce a DeprecationWarning for an invalid 
escape sequence, change the example to use a raw string.

--
assignee: docs@python
components: Documentation
messages: 310386
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Fix documentation examples of using re with escape sequences
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32304] Upload failed (400): Digests do not match on .tar.gz ending with x0d binary code

2018-01-21 Thread bbayles

Change by bbayles :


--
keywords: +patch
pull_requests: +5110
stage: needs patch -> patch review

___
Python tracker 

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



[issue32613] Use PEP 397 py launcher in windows faq

2018-01-21 Thread Julien Palard

New submission from Julien Palard :

The windows FAQ (https://docs.python.org/3.6/faq/windows.html) uses `python` to 
launch python, I think it should use the `py` python launcher from pep 397.

--
assignee: mdk
components: Documentation
keywords: easy
messages: 310385
nosy: mdk
priority: low
severity: normal
stage: needs patch
status: open
title: Use PEP 397 py launcher in windows faq
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue32591] Deprecate sys.set_coroutine_wrapper and replace it with more focused API(s)

2018-01-21 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +5109

___
Python tracker 

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



[issue32612] pathlib.(Pure)WindowsPaths can compare equal but refer to different files

2018-01-21 Thread benrg

New submission from benrg :

(Pure)WindowsPath uses str.lower to fold paths for comparison and hashing. This 
doesn't match the case folding of actual Windows file systems. There exist 
WindowsPath objects that compare and hash equal, but refer to different files. 
For example, the strings

  '\xdf' (sharp S) and '\u1e9e' (capital sharp S)
  '\u01c7' (LJ) and '\u01c8' (Lj)
  '\u0130' (I with dot) and 'i\u0307' (i followed by combining dot)
  'K' and '\u212a' (Kelvin sign)

are equal under str.lower folding but are distinct file names on NTFS volumes 
on my Windows 7 machine. There are hundreds of other such pairs.

I think this is very bad. The reverse (paths that compare unequal but refer to 
the same file) is probably unavoidable and is expected by programmers. But 
paths that compare equal should never be unequal to the OS.

How to fix this:

Unfortunately, there is no correct way to case fold Windows paths. The FAT, 
NTFS, and exFAT drivers on my machine all have different behavior. (The 
examples above work on all three, except for 'K' and '\u212a', which are 
equivalent on FAT volumes.) NTFS stores its case-folding map on each volume in 
the hidden $UpCase file, so even different NTFS volumes on the same machine can 
have different behavior. The contents of $UpCase have changed over time as 
Windows is updated to support new Unicode versions. NTFS and NFS (and possibly 
WebDAV) also support full case sensitivity when used with Interix/SUA and 
Cygwin, though this requires disabling system-wide case insensitivity via the 
registry.

I think that pathlib should either give up on case folding entirely, or should 
fold very conservatively, treating WCHARs as equivalent only if they're 
equivalent on all standard file systems on all supported Windows versions.

If pathlib folds case at all, there should be a solution for people who need to 
interoperate with Cygwin or SUA tools on a case-sensitive machine, but I 
suppose they can just use PosixPath.

--
components: Library (Lib), Windows
messages: 310384
nosy: benrg, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pathlib.(Pure)WindowsPaths can compare equal but refer to different files
type: security
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue17799] settrace docs are wrong about "c_call" events

2018-01-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

The reason not to pass C calls to the tracing function is that tracing exists 
to support pdb and other debuggers, and pdb only cares about tracing through 
Python code. So the docs should be updated.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +5108
stage:  -> patch review

___
Python tracker 

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



[issue32611] Tkinter taskbar icon (Windows)

2018-01-21 Thread Minion Jim

New submission from Minion Jim :

When using Python version 3.6.4, Tkinter shows a blank icon on the taskbar. 
This means any Tkinter window including IDLE and a blank one. Unfortunately, I 
don't have a screenshot to show this as I reinstalled version 3.6.3 which works 
perfectly.

--
components: Windows
messages: 310382
nosy: Minion Jim, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Tkinter taskbar icon (Windows)
type: behavior
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



[issue32314] Implement asyncio.run()

2018-01-21 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset a4afcdfa55ddffa4b9ae3b0cf101628c7bff4102 by Yury Selivanov in 
branch 'master':
bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262)
https://github.com/python/cpython/commit/a4afcdfa55ddffa4b9ae3b0cf101628c7bff4102


--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2018-01-21 Thread Yury Selivanov

Yury Selivanov  added the comment:

I've pushed a new version of the patch that I intend to merge tomorrow.

The last version has only one minor change: it uses fast-path for "slightly" 
non-compact dicts too (dicts don't use *at most* 3 entries).  This protects us 
from pathological cases when a huge dict being almost emptied with pop/del and 
then gets copied -- we indeed want the copy to be compact.

Although I believe that the real issue is that del and pop don't compact dicts 
from time to time, but I don't want that issue to hold off this patch in any 
way.

> If you will make dict copying removing holes and extend your patch to dict 
> constructor, it could be more useful.

It's already useful -- I'm supporting a large code base (>0.5M LOC) which uses 
dict.copy() extensively, and it shows up in profile.  I've seen it in many 
other places (particularly ORMs love to store information in dicts and use 
dict.copy() to track dirty state/changes).  Please don't say that dict.copy() 
is not a common operation or that dict(other_dict) is more common than 
other_dict.copy() -- that's simply incorrect.

> The side effect of this patch is making dict.copy() atomic. This is a worthy 
> feature if extent it to dict constructor.

I agree.  I'll work on that later in a follow-up PR.  Let's move in small steps.

--

___
Python tracker 

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



[issue32314] Implement asyncio.run()

2018-01-21 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +5107

___
Python tracker 

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



[issue32610] asyncio.all_tasks() should return only non-finished tasks.

2018-01-21 Thread Yury Selivanov

Yury Selivanov  added the comment:

I agree, returning done tasks is pretty useless.

This is a new function so let's fix its behavour.  We need to:

1. Document this difference between new asyncio.all_tasks() and now deprecated 
Task.all_tasks().

2. Make sure that Task.all_tasks() works in 3.7 in the same way it was working 
before 3.7.

--

___
Python tracker 

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



[issue32610] asyncio.all_tasks() should return only non-finished tasks.

2018-01-21 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Current behavior has a subtle pitfall.
The function returns a list of *existing* tasks (not removed by decref or 
explicit call).
If user's code has a strong reference to some task the task will be in return 
list for unpredictable amount of time, even if the task was done.

Returning only *alive* tasks can make a function result more predictable (`not 
task.done()`).

Opinions?

--
components: asyncio
messages: 310378
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.all_tasks() should return only non-finished tasks.
versions: Python 3.7

___
Python tracker 

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



[issue32532] improve sys.settrace and sys.setprofile documentation

2018-01-21 Thread Xiang Zhang

Xiang Zhang  added the comment:

Hi Pablo, it would be nice. But for #17799, I don't know actually which part 
should be fixed, doc or code? I think it's better to consult gurus on 
python-dev mail list.

--

___
Python tracker 

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



[issue32583] Crash during decoding using UTF-16/32 and custom error handler

2018-01-21 Thread Xiang Zhang

Xiang Zhang  added the comment:

I write a draft patch, without tests yet. I'll add them later. Reviews are 
appreciated. I also check the Windows codepage equivalent and encoders, look to 
me they don't suffer the problem.

--
keywords: +patch
stage: needs patch -> patch review
Added file: https://bugs.python.org/file47399/issue32583.patch

___
Python tracker 

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



[issue32591] Deprecate sys.set_coroutine_wrapper and replace it with more focused API(s)

2018-01-21 Thread Yury Selivanov

Yury Selivanov  added the comment:

Merged!  Thank you, Nathaniel!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement
versions:  -Python 3.8

___
Python tracker 

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



[issue32609] Add setter and getter for min/max protocol ersion

2018-01-21 Thread Christian Heimes

Change by Christian Heimes :


--
keywords: +patch
pull_requests: +5106
stage: needs patch -> patch review

___
Python tracker 

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



[issue32609] Add setter and getter for min/max protocol ersion

2018-01-21 Thread Christian Heimes

New submission from Christian Heimes :

OpenSSL 1.1 has introduced a new API to set the minimum and maximum supported 
protocol version. The API is easier to use than the old OP_NO_TLSv1 option 
flags, too

https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_min_proto_version.html

Debian used the new setters to disable TLS 1.0 and 1.1 in testing, #31453. The 
old TLS versions have been enabled again for now. Python must expose the new 
API in case Debian decides to disable them again.

I also like to deprecate the old OP_NO_TLSv1 et al. flags in favor of the new 
API. The option flags are awkward to use and easy to get wrong. For example 
applications must not leave holes in the OP_NO range (e.g. allow TLS 1.0 and 
1.2 but disable 1.1).

--
assignee: christian.heimes
components: SSL
messages: 310374
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: Add setter and getter for min/max protocol ersion
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32430] Simplify Modules/Setup{,.dist,.local}

2018-01-21 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

A solution to this issue must deal with the following use case:

A developer has made changes to Modules/Setup and is tracking these changes in 
a VCS, for example with mercurial or with a git submodule through a symlink. By 
the time he is about to pull the commit that is fixing this issue from the 
Python repository, he is also experimenting with a new modification in 
Modules/Setup that he has not commited or staged yet in his own mercurial or 
git submodule repository or whatever.

IMO a solution to this issue that overwrites the current user changes when he 
is merging the corresponding commit is not acceptable.

--

___
Python tracker 

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



[issue32608] Incompatibilities with the socketserver and multiprocessing packages

2018-01-21 Thread Michael Durso

Change by Michael Durso :


--
keywords: +patch
pull_requests: +5104
stage:  -> patch review

___
Python tracker 

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



[issue32430] Simplify Modules/Setup{,.dist,.local}

2018-01-21 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

I fully concur with all points in Victor msg310345.

--

___
Python tracker 

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



[issue32608] Incompatibilities with the socketserver and multiprocessing packages

2018-01-21 Thread Michael Durso

New submission from Michael Durso :

This is more of an issue with socketserver rather than multiprocessing.  I 
could not find socketserver experts to add to the nosy list, but I've included 
the multiprocessing experts for completeness.

Under specific conditions, multiprocessing queues cease to work when modules 
like socketserver is used, more specifically when fork() is used.  This makes 
sense that things can break when fork() is used since a simple forked process 
has things like file descriptors and threads invalidated.  The 
socketserver.ForkingMixIn class, which has very reasonable use-cases, causes 
multiprocessing queues and threads to break.  A script that replicates and 
simulates the issue is attached.

The attached script sets up a multiprocessing queue used for logging across all 
sub-processes, then uses a socketserver.ForkingTCPServer to handle new client 
connection.  What's happening is the fork() is invalidating the thread in the 
QueueHandler in each new sub-process (for each new client conncetion).  It 
turns the QueueHandler into a dead object.

In this scenario, the only indication the problem exists is the fact that log 
messages are not actually logged.  But I think it's plausible that more than 
just log data could be lost.

When a non-modified version of CPython, the script should run and produce a log 
file.  However, logs from the client connection handler (MyClientHandler) will 
be lost and never sent to the logging handler that performs the actual file 
writing.  To exercise the proposed fix to CPython, build the changes to 
socketserver.py and then change the script's "USE_FIX" flag to "True" and run 
the script.

--
components: Library (Lib)
files: multiprocessing_socketserver.py
messages: 310371
nosy: davin, pitrou, rbprogrammer
priority: normal
severity: normal
status: open
title: Incompatibilities with the socketserver and multiprocessing packages
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47398/multiprocessing_socketserver.py

___
Python tracker 

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



[issue32498] urllib.parse.unquote raises incorrect errormessage when string parameter is bytes

2018-01-21 Thread stein-k

stein-k  added the comment:

Patch for tests.

Added test for calling unquote with bytes input and removed Exception raised in 
original test.

--
Added file: 
https://bugs.python.org/file47397/urllib_parse_unquote_handle_bytes_test.patch

___
Python tracker 

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



[issue32607] After Python Installation Error

2018-01-21 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

This looks like a broken or incorrectly configured Django installation.

What happens when you run this from your operating system shell?

python3.6 -E -S

If you are on Windows, you might need to use this instead:

py -E -S

--
nosy: +steven.daprano

___
Python tracker 

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



[issue32607] After Python Installation Error

2018-01-21 Thread Shrivatsa Hosabettu

New submission from Shrivatsa Hosabettu :

Please let me know the below error is ok to have or how to resolve it?

3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)]
Traceback (most recent call last):
  Python Shell, prompt 0, line 21
  File "", line 1, in 
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django\__init__.py",
 line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django\conf\__init__.py",
 line 56, in __getattr__
self._setup(name)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django\conf\__init__.py",
 line 43, in _setup
self._wrapped = Settings(settings_module)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django\conf\__init__.py",
 line 106, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\__init__.py",
 line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 994, in _gcd_import
return _find_and_load(name, _gcd_import)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 971, in _find_and_load
return _find_and_load_unlocked(name, import_)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 941, in _find_and_load_unlocked
_call_with_frames_removed(import_, parent)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 219, in _call_with_frames_removed
return f(*args, **kwds)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 994, in _gcd_import
return _find_and_load(name, _gcd_import)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 971, in _find_and_load
return _find_and_load_unlocked(name, import_)
  File 
"C:\Users\adm\AppData\Local\Programs\Python\Python36-32\Lib\importlib\_bootstrap.py",
 line 953, in _find_and_load_unlocked
raise ModuleNotFoundError(_ERR_MSG.format(name), name=name)
builtins.ModuleNotFoundError: No module named 'simplesocial'

--
messages: 310368
nosy: shri_vatsa
priority: normal
severity: normal
status: open
title: After Python Installation Error
type: behavior
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



[issue32391] Add StreamWriter.wait_closed()

2018-01-21 Thread Nathaniel Smith

Change by Nathaniel Smith :


--
nosy: +njs

___
Python tracker 

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