[issue33151] importlib.resources breaks on subdirectories

2018-03-26 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


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

___
Python tracker 

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



[issue33151] importlib.resources breaks on subdirectories

2018-03-26 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

is_resource() from zip submodules is also affected

--

___
Python tracker 

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



[issue33151] importlib.resources breaks on subdirectories

2018-03-26 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

Found a bug when trying to read a resource from a subpackage in a zip file.  I 
was actually surprised we didn't have a test for this AFAICT, and when I added 
one, it did fail.

I have a PR coming soon.

--
assignee: barry
components: Library (Lib)
messages: 314500
nosy: barry, brett.cannon
priority: normal
severity: normal
status: open
title: importlib.resources breaks on subdirectories
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-26 Thread Ethan Welty

Ethan Welty  added the comment:

Terry Reedy: I just tried your suggestion of a main clause (code below) and it 
made no difference.

```
import _tkinter
import numpy as np
# multiprocessing.set_start_method("spawn")
import multiprocessing

def parallel_matmul(x):
R = np.random.randn(3, 3)
return np.matmul(R, x)

if __name__ == '__main__':
pool = multiprocessing.Pool(4)
results = pool.map(parallel_matmul, [np.random.randn(3, 5000) for i in 
range(2)])
```

Ronald Oussoren: Good to know that perhaps upgrading to the latest OSX would 
resolve this issue. I tried 'spawn' and 'forkserver' with 
multiprocessing.set_start_method() (see above) but both result in an endless 
stream of errors (with or without importing a graphics backend), although that 
may be my not knowing how to properly use them.

--

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-26 Thread Tim Peters

Tim Peters  added the comment:

I'm the wrong guy to ask about that.  Since I worked at Zope Corp, my natural 
inclination is to monkey-patch everything - but knowing full well that will 
offend everyone else ;-)

That said, this optimization seems straightforward to me:  two distinct method 
implementations for two very different approaches that have nothing in common 
besides the method name & signature.

--

___
Python tracker 

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



[issue33149] Parser stack overflows

2018-03-26 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
resolution:  -> duplicate

___
Python tracker 

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



[issue33149] Parser stack overflows

2018-03-26 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
superseder:  -> s_push: parser stack overflow MemoryError

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> the optimized `_randbelow()` also avoids populating its locals 
> with 5 unused formal arguments

Yes, that clean-up would be nice as well :-)

Any thoughts on having __init__ set a flag versus using __init__subclass__ to 
backpatch the subclass?  To me, the former looks like plain python and latter 
doesn't seem like something that would normally be done in the standard library.

--

___
Python tracker 

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



[issue33149] Parser stack overflows

2018-03-26 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Duplicate of issue3971

--
nosy: +pablogsal

___
Python tracker 

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



[issue30100] WeakSet should allow discard and remove on items that can't have weak references

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> my original motivating case was objects that are hashable but not weakly 
> referenceable.  

It is probably not good design to extend discard() to handle types that aren't 
handled by the other methods.  To me, it isn't at all surprising that the 
business of a WeakSet is to handle objects that are both hashable and weak 
referenceable.  Muddying those waters may do more harm than good.  My 
recommendation is to decline the feature request.

One other thought.  As the Python world starts to encourage type annotations 
and static type checking, one benefit we would hope for is code with cleaner 
matches between the caller and callee signatures.  Accordingly, we shouldn't 
encourage people to write code with odd signatures:
  
x : thing_that_cant_possibly_be_in_the_weakset
some_weakset.discard(x)  # Someday, we might hope this would be flagged

--
status: pending -> open
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



[issue33144] random._randbelow optimization

2018-03-26 Thread Tim Peters

Tim Peters  added the comment:

I don't see anything objectionable about the class optimizing the 
implementation of a private method.

I'll note that there's a speed benefit beyond just removing the two type checks 
in the common case:  the optimized `_randbelow()` also avoids populating its 
locals with 5 unused formal arguments (which are just "a trick" to change what 
would otherwise have been global accesses into local accesses).  So it actually 
makes the method implementation cleaner & clearer too.

But it's really the speed that matters here.

--

___
Python tracker 

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



[issue33150] Signature error for methods of class configparser.Interpolation

2018-03-26 Thread Arno-Can Uestuensoez

New submission from Arno-Can Uestuensoez :

I am not sure whether this is already covered by an issue, it is present in 
3.6.2 and 3.6.4.

The class Interpolation in the configparser module causes an exception:

  File "/opt/python/python-3.6.4/lib/python3.6/configparser.py", line 1123, in 
_join_multiline_values
name, val)
TypeError: before_read() missing 1 required positional argument: 'value'


This is due to the missing 'parser' parameter at the call of 
'Interploation.xyz()' methods, also the case for several other method calls.


class Interpolation:
"""Dummy interpolation that passes the value through with no changes."""

def before_read(self, parser, section, option, value):
return value

   ...

Same for derived classes see e.g.

   class BasicInterpolation(Interpolation):
   ...

   class ExtendedInterpolation(Interpolation):
   ...

A work around seems to be:

- defining a dummy with changed signatures as parameter 'interpolation'

--
components: Argument Clinic, Build, asyncio
messages: 314493
nosy: acue, asvetlov, larry, yselivanov
priority: normal
severity: normal
status: open
title: Signature error for methods of class configparser.Interpolation
type: compile error
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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset c8698cff7ccc8dc730c58523c7ef4113ea8d3049 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.6':
bpo-27212: Modify islice recipe to consume initial values preceding start 
(GH-6195) (GH-6267)
https://github.com/python/cpython/commit/c8698cff7ccc8dc730c58523c7ef4113ea8d3049


--

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset f328caf4caafd4521c356af8cb8a299f27603c90 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.7':
bpo-27212: Modify islice recipe to consume initial values preceding start 
(GH-6195) (#GH-6266)
https://github.com/python/cpython/commit/f328caf4caafd4521c356af8cb8a299f27603c90


--

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5992

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5991

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset da1734c58d2f97387ccc9676074717d38b044128 by Raymond Hettinger 
(Cheryl Sabella) in branch 'master':
bpo-27212: Modify islice recipe to consume initial values preceding start 
(GH-6195)
https://github.com/python/cpython/commit/da1734c58d2f97387ccc9676074717d38b044128


--

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> it could also be done at instantiation time (the attached patch
> uses __init_subclass__ for that purpose 

FWIW, a 10-25% speedup is only possible because the remaining code is already 
somewhat fast.  All that is being proposed is removing couple of lines that 
elsewhere would be considered somewhat thin:

random = self.random
if type(random) is BuiltinMethod \
   or type(getrandbits) is Method:

Overall, the idea of doing the check only once at instantiation time seems 
promising.  That said, I have unspecific general worries about using 
__init_subclass__ and patching the subclass.  Perhaps Serhiy, Tim, or Mark will 
have thoughts on whether this sort of self-patching is something we want to be 
doing in the standard library, whether it would benefit PyPy, and whether it 
has risks to existing code, to debugging and testing, and to future maintenance.

If I were the one to go the route of making a single pre-check, my instinct 
would be to just set a flag in __init__, so that the above code would simplify 
to:

if self._valid_getrandbits:
...

--
assignee:  -> rhettinger
nosy: +mark.dickinson, serhiy.storchaka, tim.peters

___
Python tracker 

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



[issue33148] RuntimeError('Event loop is closed') after cancelling getaddrinfo and closing loop

2018-03-26 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yeah, getaddrinfo isn't actually cancellable (because it's a blocking call that 
has to be run in a thread), but it's side-effect-free so if the user requests 
that it be cancelled then it's safe to return immediately while it keeps 
running in the background, and asyncio does so. But if we've already decided to 
discard the result then it's better to do that silently, like you say.

When trio hits this case, it does silently throw away the result: 
https://github.com/python-trio/trio/blob/aebb42888dd0978c3b74f8c9cdf8aec2ce2cbd73/trio/_threads.py#L372-L377
It's a little bit more obvious in trio's case because there we 100% know that 
if the call to `trio.run` has finished, then there's no-one listening for the 
result, and that the user has explicitly requested this behavior. In asyncio's 
case, I guess in *theory* someone could still be hoping the Future's done 
callback will be invoked even after the loop is closed. This seems unlikely 
though... and in general when the loop is closed then every other registered 
callback is silently discarded, so doing that for run_in_executor seems fine 
too.

--
nosy: +njs

___
Python tracker 

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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

>  However, let me argue my case one more time, and if you still disagree, feel 
> free to close this.

Thank you for expressing your ideas so clearly.  However, I'm going to go with 
Tim's recommendation and leave the docs as is.

At this point, you already have a complete understanding of what the tool does 
and how to use it, so there isn't anything at stake other than a feeling a 
vindication for a bug that is already resolved.  Looking to the needs of other 
users, I think we're best off not even bringing up non-guaranteed 
implementation details and instead follow the example of Numpy and R.  Thanks 
again for the suggestion, but we'll respectfully decline this time around.

--
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



[issue33149] Parser stack overflows

2018-03-26 Thread Isaac Elliott

Isaac Elliott  added the comment:

Because of the way recursive descent parsing works,

[[

is actually the minimal input required to reproduce this in python3.

In python2, the bug is still present, but requires a slightly deeper nesting:



--

___
Python tracker 

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



[issue33149] Parser stack overflows

2018-03-26 Thread Isaac Elliott

New submission from Isaac Elliott :

python3's parser stack overflows on deeply-nested expressions, for example:

[[]]

or

aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa()

These are both minimal examples, so if you remove one level of nesting from 
either then python3 will behave normally.

--
messages: 314485
nosy: Isaac Elliott
priority: normal
severity: normal
status: open
title: Parser stack overflows
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



[issue33148] RuntimeError('Event loop is closed') after cancelling getaddrinfo and closing loop

2018-03-26 Thread Vitaly Kruglikov

New submission from Vitaly Kruglikov :

I see this exception on the terminal:
```
exception calling callback for 
Traceback (most recent call last):
  File 
"/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/_base.py",
 line 324, in _invoke_callbacks
callback(self)
  File 
"/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/futures.py",
 line 414, in _call_set_state
dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File 
"/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py",
 line 620, in call_soon_threadsafe
self._check_closed()
  File 
"/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py",
 line 357, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
```

When executing this code:
```
import asyncio

while True:
loop = asyncio.new_event_loop()

coro = loop.getaddrinfo('www.google.com', 80)

task = asyncio.ensure_future(coro, loop=loop)

task.cancel()

loop.call_soon_threadsafe(loop.stop)

loop.run_forever()

loop.close()
```

Shouldn't a cancelled operation go away (or at least pretend to go away) 
cleanly?

--
components: asyncio
messages: 314484
nosy: asvetlov, vitaly.krug, yselivanov
priority: normal
severity: normal
status: open
title: RuntimeError('Event loop is closed') after cancelling getaddrinfo and 
closing loop
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



[issue32873] Pickling of typing types

2018-03-26 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
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



[issue32873] Pickling of typing types

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset d0e04c82448c750d4dc27f2bddeddea74bd353ff by Miss Islington (bot) 
in branch '3.7':
bpo-32873: Treat type variables and special typing forms as immutable by copy 
and pickle (GH-6216)
https://github.com/python/cpython/commit/d0e04c82448c750d4dc27f2bddeddea74bd353ff


--
nosy: +miss-islington

___
Python tracker 

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



[issue32873] Pickling of typing types

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5990

___
Python tracker 

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



[issue32873] Pickling of typing types

2018-03-26 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 834940375ae88bc95794226dd8eff1f25fba1cf9 by Ivan Levkivskyi in 
branch 'master':
bpo-32873: Treat type variables and special typing forms as immutable by copy 
and pickle (GH-6216)
https://github.com/python/cpython/commit/834940375ae88bc95794226dd8eff1f25fba1cf9


--

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset 57db13e582ad269d6e067fe934122207cc992739 by Miss Islington (bot) 
in branch '3.6':
bpo-32844: Fix a subprocess misredirection of a low fd (GH5689)
https://github.com/python/cpython/commit/57db13e582ad269d6e067fe934122207cc992739


--

___
Python tracker 

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



[issue33146] contextlib.suppress should capture exception for inspection and filter on substrings

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

What kind useful information to you expect to get before an exception is raised?

For example:

with suppress(FileNotFoundError) as e:
 os.remove(somefile)

What could *e* possibly be that would be useful.  AFAICT, all we know at the 
time of __enter__ is the exception class.  No new information was created by 
the context manager call.

Ideally, it would be great is this API were to remain simple.  User code would 
likely be more clear if any other logic were done outside the context manager 
rather than happening indirectly and inexplicitly in the suppress call.  To me, 
"suppress" means suppress -- it doesn't mean capture and analyze that which is 
ignored.  So, at first glance, this seems like a mix of feature creep and 
mission creep.

--
nosy: +ncoghlan, rhettinger
type:  -> enhancement

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset 05455637f3ba9bacd459700f4feab783e5967d69 by Miss Islington (bot) 
in branch '3.7':
bpo-32844: Fix a subprocess misredirection of a low fd (GH5689)
https://github.com/python/cpython/commit/05455637f3ba9bacd459700f4feab783e5967d69


--
nosy: +miss-islington

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5989

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5988

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread Gregory P. Smith

Gregory P. Smith  added the comment:


New changeset 0e7144b064a19493a146af94175a087b3888c37b by Gregory P. Smith 
(Alexey Izbyshev) in branch 'master':
bpo-32844: Fix a subprocess misredirection of a low fd (GH5689)
https://github.com/python/cpython/commit/0e7144b064a19493a146af94175a087b3888c37b


--

___
Python tracker 

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



[issue33128] PathFinder is twice on sys.meta_path

2018-03-26 Thread Brett Cannon

Change by Brett Cannon :


--
keywords: +3.7regression
nosy: +brett.cannon

___
Python tracker 

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



[issue4819] Misc/cheatsheet needs updating

2018-03-26 Thread Mark Dickinson

Mark Dickinson  added the comment:

Given that Misc/cheatsheet doesn't exist any more in the Python 3 repo, and 
Python 2 is nearing end-of-life, I suspect this should just be closed.

--
stage: needs patch -> resolved
status: pending -> closed

___
Python tracker 

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



[issue1704621] interpreter crash when multiplying large lists

2018-03-26 Thread Guido van Rossum

Guido van Rossum  added the comment:

@imz Please file a new issue.

--

___
Python tracker 

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



[issue1704621] interpreter crash when multiplying large lists

2018-03-26 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

Hi!

This is broken for tuples (but not for lists, as in the example here) in 2.7.14 
for me. Should we reopen this issue and fix it better?

[builder@localhost ~]$ python
Python 2.7.14 (default, Nov  7 2017, 17:07:17) 
[GCC 6.3.1 20170118 (ALT 6.3.1-alt2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [0] * 2**20
>>> x *= 2**20
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> x = [0,0,0,0,0,0] * 2**20
>>> x *= 2**20
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> x = ('a', 'b')
>>> x = ('a', 'b') * 2**20
>>> x *= 2**20
Segmentation fault
[builder@localhost ~]$ python --version
Python 2.7.14
[builder@localhost ~]$ python
Python 2.7.14 (default, Nov  7 2017, 17:07:17) 
[GCC 6.3.1 20170118 (ALT 6.3.1-alt2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxsize
2147483647
>>> sys.maxint
2147483647
>>> 
[builder@localhost ~]$ python RPM/BUILD/Python-2.7.14/Lib/test/test_tuple.py
test_addmul (__main__.TupleTest) ... ok
test_bigrepeat (__main__.TupleTest) ... Segmentation fault
[builder@localhost ~]$

--
nosy: +imz

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks for the bug report.

--
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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset c6147acd2ce5fa9e344f179b539f3b21b9ae1a6d by Miss Islington (bot) 
in branch '3.7':
bpo-33141: Have dataclasses.Field pass through __set_name__ to any default 
argument. (GH-6260)
https://github.com/python/cpython/commit/c6147acd2ce5fa9e344f179b539f3b21b9ae1a6d


--
nosy: +miss-islington

___
Python tracker 

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



[issue28055] pyhash's siphash24 assumes alignment of the data pointer

2018-03-26 Thread Rolf Eike Beer

Rolf Eike Beer  added the comment:

So, what is the problem with this? Either the compiler knows that unaligned 
accesses are no problem and optimizes them away anyway, or it is kept because 
it would crash otherwise. I can confirm that no sparc version >= 3.5 (have not 
tried older) survives the test suite on Gentoo Sparc (64 bit kernel, 32 bit 
userspace) without memcpy().

--
nosy: +Dakon

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5987

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset de7a2f04d6b9427d568fcb43b6f512f9b4c4bd84 by Eric V. Smith in 
branch 'master':
bpo-33141: Have dataclasses.Field pass through __set_name__ to any default 
argument. (GH-6260)
https://github.com/python/cpython/commit/de7a2f04d6b9427d568fcb43b6f512f9b4c4bd84


--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

Looks great to me. Thanks!

--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

I've updated the PR.

I left those lines in, and added a different test. After all, it does need to 
work with real descriptors.

--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

Yeah and I think lines 2709-2712 of TestDescriptors also needs removed.

--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

Yes, I noticed the same thing. I'll remove the test.

--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

Eric, looking at the PR; note that if you do this for the __set_name__ check:

if inspect.ismethoddescriptor(self.default):

...an object like the one below will not get its __set_name__ called, even 
though PEP 487 says it should:

class D:
def __set_name__(self, o, n):
self.name = n

class C:
d: int = D()

if __name__ == "__main__":
print(f"C.d.name = {C.d.name}") # __set_name__ was called
assert inspect.ismethoddescriptor(C.d) # Error

--

___
Python tracker 

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



[issue28055] pyhash's siphash24 assumes alignment of the data pointer

2018-03-26 Thread Rolf Eike Beer

Change by Rolf Eike Beer :


--
pull_requests: +5986

___
Python tracker 

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



[issue33147] Update references for RFC 3548 to RFC 4648

2018-03-26 Thread Paul Hoffman

Paul Hoffman  added the comment:

I signed the contributor agreement form on 2017-06-23

--

___
Python tracker 

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



[issue33145] unaligned accesses in siphash24() lead to crashes on sparc

2018-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Actually this looks like a duplicate of issue28055.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pyhash's siphash24 assumes alignment of the data pointer

___
Python tracker 

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



[issue33147] Update references for RFC 3548 to RFC 4648

2018-03-26 Thread Paul Hoffman

New submission from Paul Hoffman :

serhiy-storchaka asked me to open an issue about whether Python implements RFC 
4648. As far as I can tell it does, correctly, for the parts of RFC 4648 
covered in the doc. My PR was about simply updating a reference to an RFC that 
was made obsolete.

--
messages: 314462
nosy: paulehoffman
priority: normal
pull_requests: 5985
severity: normal
status: open
title: Update references for RFC 3548 to RFC 4648

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

I don't expect there to be too much usage of Field objects, so I'm not so 
worried about it.

If you can, try out the code in the PR. Thanks.

--

___
Python tracker 

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



[issue33146] contextlib.suppress should capture exception for inspection and filter on substrings

2018-03-26 Thread Jason R. Coombs

New submission from Jason R. Coombs :

I propose the following expansion of the interface of contextlib.suppress. 
Currently, when entering the context, suppress returns None. Instead, it could 
return an object that provides some detail about the exception.

Inspiration for an implementation exists in pytest 
(https://github.com/pytest-dev/pytest/blob/ff3d13ed0efab6692a07059b1d61c53eec6e0412/_pytest/python_api.py#L627),
 capturing the commonly-encountered use-cases, where one wishes to capture, 
suppress, and then act on a subset of exceptions, allowing others to raise 
normally.

In [py-181](https://github.com/pytest-dev/py/pull/181), I suggest exposing this 
functionality generally, but others had an instinct similar to mine - that 
perhaps the stdlib should be providing this interface.

In addition to saving the exception for inspection, the pytest implementation 
also allows a "message" to be supplied (for those exceptions where only some 
subset of the class of Exception is suppressed).

I present this concept here for consideration and feedback. Can 
contextlib.suppress be expanded with such an interface?

--
components: Library (Lib)
messages: 314461
nosy: jason.coombs
priority: normal
severity: normal
status: open
title: contextlib.suppress should capture exception for inspection and filter 
on substrings
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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Change by Eric V. Smith :


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

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

I suppose one downside of that solution is __set_name__ will be called for 
every Field whether or not it is need. Probably can't be helped without major 
complications.

--

___
Python tracker 

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



[issue33145] unaligned accesses in siphash24() lead to crashes on sparc

2018-03-26 Thread Rolf Eike Beer

Change by Rolf Eike Beer :


--
components: Library (Lib)
nosy: Dakon
priority: normal
pull_requests: 5983
severity: normal
status: open
title: unaligned accesses in siphash24() lead to crashes on sparc
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue31920] pygettext ignores directories as inputfile argument

2018-03-26 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +5982
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



[issue24356] venv documentation incorrect / misleading

2018-03-26 Thread Steven Downum

Change by Steven Downum :


--
nosy: +steven.downum

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

Sounds like a relatively easy solution then. Hopefully it makes the beta 3 so I 
can use it immediately- thanks!

--

___
Python tracker 

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




[issue31201] make test: module test that failed doesn't exist

2018-03-26 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
keywords: +easy
stage:  -> needs patch
title: module test that failed doesn't exist -> make test: module test that 
failed doesn't exist
type:  -> enhancement
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

Nick Coghlan suggested (on python-dev) to have Field implement __set_name__ and 
call through to the default value, if it exists.

That approach seems to work fine. I'll generate a PR with tests sometime before 
today's release.

--

___
Python tracker 

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



[issue6986] _json crash on scanner/encoder initialization error

2018-03-26 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 7c2d97827fd2ccd72ab7a98427f87fcfe3891644 by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-6986: Add a comment to clarify a test of _json.make_encoder(). (GH-3789)
https://github.com/python/cpython/commit/7c2d97827fd2ccd72ab7a98427f87fcfe3891644


--

___
Python tracker 

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



[issue31504] Documentation for return value for string.rindex is missing when search string is empty

2018-03-26 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-26 Thread Wolfgang Maier

New submission from Wolfgang Maier :

Given that the random module goes a long way to ensure optimal performance, I 
was wondering why the check for a match between the random and getrandbits 
methods is performed per call of Random._randbelow, when it could also be done 
at instantiation time (the attached patch uses __init_subclass__ for that 
purpose and, in my hands, gives 10-25% speedups for calls to methods relying on 
_randbelow).
Is it really necessary to guard against someone monkey patching the methods 
rather than using inheritance?

--
components: Library (Lib)
files: randbelow.patch
keywords: patch
messages: 314455
nosy: rhettinger, wolma
priority: normal
severity: normal
status: open
title: random._randbelow optimization
type: performance
versions: Python 3.8
Added file: https://bugs.python.org/file47501/randbelow.patch

___
Python tracker 

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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-26 Thread Scott Eilerman

Scott Eilerman  added the comment:

Raymond, Tim, thanks for your replies so far. I understand (and for the most 
part, agree with) your points about not being able to list every behavior, and 
not wanting to cause uncertainty in users. However, let me argue my case one 
more time, and if you still disagree, feel free to close this.

1. It is expected (in fact, one might argue it's the entire point) that 
initializing random.seed() with a fixed value will produce a repeatable set of 
results for a traditional random number generator. An user expects that calling 
the following should always produce the same sequence of numbers:

random.seed(22)
random.random()
random.random()
random.random()

2. Based on that behavior for one of the most typical/traditional functions in 
the random module, a naive user (me) might assume that random.sample() is 
drawing from its population in a similar manner (i.e. that sequence of returned 
items, regardless of how many you ask the function to return, is uniquely 
determined by the seed). While this is certainly an assumption...

2a. This assumption is somewhat validated by the introductory section of the 
random module docs, which states "Almost all module functions depend on the 
basic function random()..."

2b. More importantly, an user can "validate" this assumption by doing some 
simple tests, e.g.:

choices = range(100)
random.seed(22)
random.sample(choices,1)
random.seed(22)
random.sample(choices,2)
random.seed(22)
random.sample(choices,3)
... and so on

Because of the nature of the set/list optimization, it is VERY possible that an 
user could do due diligence in testing like this (a few different seeds, a few 
different sets of "choices", testing up to k=10) and never uncover the 
problematic behavior. You'd pretty much have to set up some loops like I did 
earlier in this thread, which I don't think many users would do unless the 
expect to find a problem. Even then, with certain selections of "choices", you 
might still get the "expected" results.

2c. If you suspected a problem, or really wanted to be sure the function does 
what you assume it will do, obviously you can open up random.py and take a 
look. However, I doubt many users do this for every built-in module and 
function they use; clearly the point of documentation is to avoid this scenario.

3. As Raymond mentioned, this does not appear to be a "common" problem, and 
perhaps that is enough to not add anything to the docs. However, due to the 
somewhat elusive nature of the behavior, it could certainly go undetected in 
many cases, potentially causing problems without anyone noticing. Perhaps I 
chose a very unorthodox implementation to get the results I desired; I easily 
could have used random.shuffle() or random.sample(pop, len(pop)) and picked the 
nth element. However, one could imagine cases in which you have a very large 
population and you want to optimize by using sample() to get the nth random 
draw rather than randomizing the entire list, so I don't think it's an entirely 
unjustified approach.

4. Given the above points, I'd argue that a one-line insertion into the docs 
would help users steer clear of a hard-to-anticipate, potentially costly 
pitfall. My suggested language is a more direct identification of the possible 
consequences, though I agree that it it perhaps too worry-inducing without 
specifying the "cause" of the problem. Raymond's algorithmic note may be a 
better choice and would have been enough of an indicator for me to avoid the 
mistake I made.

--

___
Python tracker 

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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2018-03-26 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Hey Jurjen,

Do you mind converting your patch in a Pull request please?

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue30100] WeakSet should allow discard and remove on items that can't have weak references

2018-03-26 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue24024] str.__doc__ needs an update

2018-03-26 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The current docstring is correct. The signature str(object, encoding="utf-8", 
errors="strict") is not correct, because str(object) is not the same as 
str(object, encoding="utf-8", errors="strict").

>>> str([1, 2])
'[1, 2]'
>>> str([1, 2], encoding="utf-8", errors="strict")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: decoding to str: need a bytes-like object, list found
>>> str(b'abc')
__main__:1: BytesWarning: str() on a bytes instance
"b'abc'"
>>> str(b'abc', encoding="utf-8", errors="strict")
'abc'

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey

Rick Teachey  added the comment:

hmmm... if I check the C.d class attribute it seems to return the
descriptor instance object (not a field object) before any C instances have
been created. i guess this is just a part of how the dataclass
implementation works.

i didn't realize there's nothing "special" going on with descriptors here-
the descriptors "just work" by virtue of being set to the class attribute
at creation time. interesting.

maybe because of this descriptors should short-circuit the field creation
process entirely? that would be a shame though. having the option of
auto-including a descriptor in the class repr turns out to be very useful
and i'm already playing around with it in a project.

one idea: what if it there were a keyword argument to mark a field as a
descriptor, allowing tje descriptor to be set at type creation? this would
need to disallow init=True, i think. and setting a field default to a
descriptor class would then raise a type error.

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler

On Mon, Mar 26, 2018 at 6:47 AM, Eric V. Smith 
wrote:

>
> Eric V. Smith  added the comment:
>
> I suppose I could, when overwriting the class member, check for
> inspect.ismethoddescriptor and call __set_name__ myself.
>
> --
> components: +Library (Lib)
> versions: +Python 3.8
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue33143] encode UTF-16 generates unexpected results

2018-03-26 Thread Anders Rundgren

Anders Rundgren  added the comment:

Thanx for the superquick response!
I really appreciate it.

I'm obviously a Python n00b

Anders

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-26 Thread Nick Coghlan

Nick Coghlan  added the comment:

Just noting that while I've closed this issue as fixed, I think we still have 
quite a bit of work to do to get our handling of these pre-init config settings 
to a place we're genuinely happy with (or as happy as backwards compatibility 
constraints permit).

However, the next step in that process is likely to involve at least myself, 
Victor & Eric getting together in person to discuss it at PyCon US (as I'm 
pretty sure we'll all be there this year), and deciding on how we'd like PEP 
432 to look for Python 3.8.

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-26 Thread Nick Coghlan

Change by Nick Coghlan :


--
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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-26 Thread Nick Coghlan

Nick Coghlan  added the comment:

Harmut, thanks for the status update!

Victor, the problem is that both sys.warnoptions and sys._xoptions get read by 
Py_Initialize(), so setting them afterwards is essentially pointless - while 
you do still change the contents of the sys attributes, doing so doesn't have 
any further effect.

In 3.8, we'll hopefully make an updated version of PEP 432 public, and hence be 
able to deprecate calling them prior to Py_InitializeCore, and either advise 
folks to use the the new config structs instead, or else adjust the way that 
_PySys_BeginInit and _PySys_EndInit work so that the relevant sys module 
attributes get created in Py_InitializeCore rather than in 
Py_InitializeMainInterpreter.

--

___
Python tracker 

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



[issue20082] Misbehavior of BufferedRandom.write with raw file in append mode

2018-03-26 Thread Erik Bray

Erik Bray  added the comment:

I keep forgetting about this (given that it's like 5 years old now).  Let me 
see if I can make a new PR for it...

--

___
Python tracker 

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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

I suppose I could, when overwriting the class member, check for 
inspect.ismethoddescriptor and call __set_name__ myself.

--
components: +Library (Lib)
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



[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Eric V. Smith

Eric V. Smith  added the comment:

That's a tough one. Because C.d is not set to a descriptor at type creation 
time (it's set to a Field object), the __set_name__ behavior is never invoked. 
It's when the @dataclass decorator is called that C.d is set to D().

https://docs.python.org/3/reference/datamodel.html#creating-the-class-object

I'm not sure it's possible to work around this without duplicating some of the 
type creation code, and even then I'm not convinced it's doable.

--

___
Python tracker 

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



[issue33143] encode UTF-16 generates unexpected results

2018-03-26 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

b'\x20' is the same as b' '.

--
nosy: +serhiy.storchaka
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



[issue33122] ftplib: FTP_TLS seems to have problems with sites that close the encrypted channel themselfes

2018-03-26 Thread Jürgen

Jürgen  added the comment:

Hi, thanks for tanking care of this issue.
I am mainly working on a windows client and connect to a z/OS host.
Attached you find the ftplib.py I patched to workaround this.

Here is the output of the list command which ends up in an exception (this time 
from a unix machine, where I still have found the unpatched version of 
ftplib.py): 

>>> ftplib.FTP_TLS.debugging=True
>>> conn=ftplib.FTP_TLS(host=url, user=user, passwd=passw)
*resp* '220-TCPFT000 IBM FTP CS V2R2 at tcpip06, 11:38:07 on 2018-03-26.\n220 
Connection will close if idle for more than 5 minutes.'
*cmd* 'AUTH TLS'
*resp* '234 Security environment established - ready for negotiation'
*cmd* 'USER SBx'
*resp* '331 Send password please.'
*cmd* 'PASS '
*resp* '230 SBx is logged on.  Working directory is "SBx.".'
>>> conn.prot_p()
*cmd* 'PBSZ 0'
*resp* '200 Protection buffer size accepted'
*cmd* 'PROT P'
*resp* '200 Data connection protection set to private'
'200 Data connection protection set to private'
>>> conn.retrlines("LIST 'SBx.SBx.*'")
*cmd* 'TYPE A'
*resp* '200 Representation type is Ascii NonPrint'
*cmd* 'PASV'
*resp* '227 Entering Passive Mode (53,113,100,193,250,60)'
*cmd* "LIST 'SBx.SBx.*'"
*resp* '125 List started OK'
Volume UnitReferred Ext Used Recfm Lrecl BlkSz Dsorg Dsname
IDV101 3390   2018/03/21 16   68  VB4092  4096  PS  
'SBx.SBx.SPUFI.OUT'
Migrated
'SBx.SBx.SPUFI.SOAOUT'
IDV10T 3390   2018/03/08 13   62  VB4092  4096  PS  
'SBx.SBx.SPUFI.WHC'
Migrated'SBx.SBx.VI870V'
Migrated'SBx.SBx.VI871V'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.4/ftplib.py", line 484, in retrlines
conn.unwrap()
  File "/usr/lib/python3.4/ssl.py", line 811, in unwrap
s = self._sslobj.shutdown()
OSError: [Errno 0] Error

--
Added file: https://bugs.python.org/file47500/ftplib.py

___
Python tracker 

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



[issue33143] encode UTF-16 generates unexpected results

2018-03-26 Thread Anders Rundgren

New submission from Anders Rundgren :

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> v = '\u20ac'
>>> print (v)
€
>>> v.encode('utf-16')
b'\xff\xfe\xac '
>>> v.encode('utf-16_be')
b' \xac'

I had expected to get pair of bytes with 20 AC for the € symbol

--
components: Unicode
messages: 314443
nosy: anders.rundgren@gmail.com, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: encode UTF-16 generates unexpected results
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



[issue31947] names=None case is not handled by EnumMeta._create_ method

2018-03-26 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Library (Lib)
nosy: +barry, eli.bendersky, ethan.furman
stage:  -> patch review
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



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build

2018-03-26 Thread Andreas Jung

Change by Andreas Jung :


--
components: +Installation

___
Python tracker 

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



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build

2018-03-26 Thread Andreas Jung

Change by Andreas Jung :


--
title: Fatal Python error: Py_Initialize: Unable to get the locale encoding -> 
Fatal Python error: Py_Initialize: Unable to get the locale encoding on 
Debian/Python 3.6.4 source build

___
Python tracker 

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



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding

2018-03-26 Thread Andreas Jung

New submission from Andreas Jung :

Unable to build Python 3.6.4 from sources on a fresh Debian system:

@plone /tmp/Python-3.6.4 $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/;
SUPPORT_URL="https://www.debian.org/support;
BUG_REPORT_URL="https://bugs.debian.org/;

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes-std=c99 -Wextra -Wno-unused-result 
-Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include
-DPy_BUILD_CORE \
  -DGITVERSION="\"`LC_ALL=C `\"" \
  -DGITTAG="\"`LC_ALL=C `\"" \
  -DGITBRANCH="\"`LC_ALL=C `\"" \
  -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
rm -f libpython3.6m.a
ar rc libpython3.6m.a Modules/getbuildinfo.o
ar rc libpython3.6m.a Parser/acceler.o Parser/grammar1.o Parser/listnode.o 
Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o 
Parser/firstsets.o Parser/grammar.o Parser/pgen.o Parser/myreadline.o 
Parser/parsetok.o Parser/tokenizer.o
ar rc libpython3.6m.a Objects/abstract.o Objects/accu.o Objects/boolobject.o 
Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o 
Objects/cellobject.o Objects/classobject.o Objects/codeobject.o 
Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o 
Objects/exceptions.o Objects/genobject.o Objects/fileobject.o 
Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o 
Objects/iterobject.o Objects/listobject.o Objects/longobject.o 
Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o 
Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o 
Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o 
Objects/setobject.o Objects/sliceobject.o Objects/structseq.o 
Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o 
Objects/unicodectype.o Objects/weakrefobject.o
ar rc libpython3.6m.a Python/_warnings.o Python/Python-ast.o Python/asdl.o 
Python/ast.o Python/bltinmodule.o Python/ceval.o Python/compile.o 
Python/codecs.o Python/dynamic_annotations.o Python/errors.o 
Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o 
Python/getcopyright.o Python/getplatform.o Python/getversion.o 
Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o 
Python/modsupport.o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o 
Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o 
Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o 
Python/pytime.o Python/random.o Python/structmember.o Python/symtable.o 
Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrcmp.o 
Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o 
Python/fileutils.o Python/dynload_shlib.o   Python/thread.o  Python/frozen.o
ar rc libpython3.6m.a Modules/config.o Modules/getpath.o Modules/main.o 
Modules/gcmodule.o
ar rc libpython3.6m.a Modules/_threadmodule.o  Modules/posixmodule.o  
Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  
Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  
Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  
Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  
Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o 
Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o 
Modules/textio.o Modules/stringio.o  Modules/zipimport.o  
Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  
Modules/symtablemodule.o  Modules/xxsubtype.o
ranlib libpython3.6m.a
gcc -pthread   -Xlinker -export-dynamic -o python Programs/python.o 
libpython3.6m.a -lpthread -ldl  -lutil   -lm  
gcc -pthread   -Xlinker -export-dynamic -o Programs/_testembed 
Programs/_testembed.o libpython3.6m.a -lpthread -ldl  -lutil   -lm  
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x7f1757349440 (most recent call first):
Aborted
generate-posix-vars failed
Makefile:575: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1

--
messages: 314442
nosy: ajung
priority: normal
severity: normal
status: open
title: Fatal Python error: Py_Initialize: Unable to get the locale encoding
type: compile error
versions: Python 3.6

___
Python tracker 

___

[issue24132] Direct sub-classing of pathlib.Path

2018-03-26 Thread qb-cea

Change by qb-cea :


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

___
Python tracker 

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



[issue33096] ttk.Treeview.insert() does not allow to insert item with "False" iid

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset 45116d393f713bbe918f16b33a0bba28b15bc96b by Miss Islington (bot) 
in branch '3.6':
bpo-33096: Fix ttk.Treeview.insert. (GH-6228)
https://github.com/python/cpython/commit/45116d393f713bbe918f16b33a0bba28b15bc96b


--

___
Python tracker 

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



[issue33096] ttk.Treeview.insert() does not allow to insert item with "False" iid

2018-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset a7b1b847f665aafc22557917cea32ec34c9b4418 by Miss Islington (bot) 
in branch '3.7':
bpo-33096: Fix ttk.Treeview.insert. (GH-6228)
https://github.com/python/cpython/commit/a7b1b847f665aafc22557917cea32ec34c9b4418


--
nosy: +miss-islington

___
Python tracker 

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



[issue33096] ttk.Treeview.insert() does not allow to insert item with "False" iid

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5980

___
Python tracker 

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



[issue33096] ttk.Treeview.insert() does not allow to insert item with "False" iid

2018-03-26 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5979

___
Python tracker 

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



[issue33096] ttk.Treeview.insert() does not allow to insert item with "False" iid

2018-03-26 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3ab44c0783eebdff687014f7d14d5dec59b6bd39 by Serhiy Storchaka 
(Garvit Khatri) in branch 'master':
bpo-33096: Fix ttk.Treeview.insert. (GH-6228)
https://github.com/python/cpython/commit/3ab44c0783eebdff687014f7d14d5dec59b6bd39


--

___
Python tracker 

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