[issue35766] Merge typed_ast back into CPython

2019-01-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue35793] round() doesn't return the right value when I put 0.5 in it.

2019-01-20 Thread Ned Deily


Change by Ned Deily :


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



[issue35793] round() doesn't return the right value when I put 0.5 in it.

2019-01-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

Please read the documentation of round builtin function.
https://docs.python.org/3/library/functions.html#round

For the built-in types supporting round(), values are rounded to the closest 
multiple of 10 to the power minus ndigits; if two multiples are equally close, 
rounding is done toward the even choice (so, for example, both round(0.5) and 
round(-0.5) are 0, and round(1.5) is 2).

--
nosy: +corona10

___
Python tracker 

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



[issue35793] round() doesn't return the right value when I put 0.5 in it.

2019-01-20 Thread Mingun Pak


New submission from Mingun Pak :

It should be 1, but it returns 0.

--
components: Library (Lib)
files: Screen Shot 2019-01-20 at 9.40.52 PM.png
messages: 334112
nosy: Mingun Pak
priority: normal
severity: normal
status: open
title: round() doesn't return the right value when I put 0.5 in it.
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file48069/Screen Shot 2019-01-20 at 9.40.52 
PM.png

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread Ned Deily


Ned Deily  added the comment:

Merged on behalf of Steve.  Thanks, Marc!

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-20 Thread Ned Deily


Change by Ned Deily :


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



[issue12707] Deprecate addinfourl getters

2019-01-20 Thread Demian Brecht


Change by Demian Brecht :


--
nosy: +demian.brecht

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2019-01-20 Thread Demian Brecht


Demian Brecht  added the comment:

What if the docs for socket functions that took system-level flag parameters 
had links to relevant online man pages? I don't think a single entry at the top 
of the page would be optimal. I know that I tend to skip the preamble and just 
go directly to the function I'm interested in.

I know that it's not a perfect solution because there's a good chance of those 
links going stale. I'm also relatively sure that we wouldn't want to have an 
exhaustive list. However, I think in this instance that /something/ would be 
better than nothing. Even if the link is stale or the target OS isn't included, 
it would give the reader a place to start, which is currently lacking.

--

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2019-01-20 Thread Demian Brecht


Change by Demian Brecht :


--
nosy: +demian.brecht

___
Python tracker 

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



[issue35792] Specifying AbstractEventLoop.run_in_executor as a coroutine conflicts with implementation/intent

2019-01-20 Thread Christopher Hunt


New submission from Christopher Hunt :

Currently AbstractEventLoop.run_in_executor is specified as a coroutine, while 
BaseEventLoop.run_in_executor is actually a non-coroutine that returns a Future 
object. The behavior of BaseEventLoop.run_in_executor would be significantly 
different if changed to align with the interface . If run_in_executor is a 
coroutine then the provided func will not actually be scheduled until the 
coroutine is awaited, which conflicts with the statement in PEP 3156 that it 
"is equivalent to `wrap_future(executor.submit(callback, *args))`".

There has already been an attempt in bpo-32327 to convert this function to a 
coroutine. We should change the interface specified in `AbstractEventLoop` to 
indicate that `run_in_executor` is not a coroutine, which should help ensure it 
does not get changed in the future without full consideration of the impacts.

--
components: asyncio
messages: 334109
nosy: asvetlov, chrahunt, yselivanov
priority: normal
severity: normal
status: open
title: Specifying AbstractEventLoop.run_in_executor as a coroutine conflicts 
with implementation/intent
type: behavior
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



[issue35292] Make SimpleHTTPRequestHandler load mimetypes lazily

2019-01-20 Thread Demian Brecht


Change by Demian Brecht :


--
nosy: +demian.brecht

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2019-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11392, 11393, 11394

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2019-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11392

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2019-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11392, 11393

___
Python tracker 

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



[issue35722] disable_existing_loggers does not apply to the root logger

2019-01-20 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker 

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



[issue35722] disable_existing_loggers does not apply to the root logger

2019-01-20 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
stage:  -> patch review
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



[issue34656] memory exhaustion in Modules/_pickle.c:1393

2019-01-20 Thread Matej Cepl


Matej Cepl  added the comment:

Does it even make sense to make a security patch for 2.7 for this one?

--
nosy: +mcepl

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2019-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

(A, B, C, D, E, F) would not be correct as B is order 2 and "C" and "A" is 
order 1. The correct orders are the inner-group permutations of:

[{'A', 'F'}, {'B', 'D', 'E'}, {'C'}]

(Assuming that the lower diagram goes from top to bottom)

--

___
Python tracker 

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



[issue35786] get_lock() method is not present for Values created using multiprocessing.Manager()

2019-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

You are not using multiprocessing.Value:

>>> import multiprocessing
>>> x = multiprocessing.Value("i", 0)
>>> x.get_lock()


--
nosy: +pablogsal

___
Python tracker 

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



[issue28607] C implementation of parts of copy.deepcopy

2019-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Hy Rasmus,

would you like to make a PR with your patch and adding some tests?

Thanks!

--
nosy: +pablogsal

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2019-01-20 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

> 2) Topological sorting usually is well-defined on totally connected graphs, 
> so I do not know what exactly it means to topologically sort two disjoint 
> graphs. This was one of the main drawbacks of the tuple-based approach, but I 
> think it may be a good property.

To give a use-case, I'm currently using topological sort to order a list of 
tasks where edges represent dependencies between tasks. Sometime a group of 
tasks does not share a dependency with another group any relative order between 
those two groups is correct:


A -> B

   C
  / \
 D   E
  \ /
   F

The order (A, B, C, D, E, F) would be correct in this example as would (C, A, 
E, B, D, F).

I think the general topological sort in Python should be able to handle such 
inputs.

--

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2019-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Although I think the API with the dictionary may be cleaner, I still do not 
like it completely.

1) One of the reasons is that implementing C3 directly with the topological 
sort is not straightforward as the different nodes that are at the same level 
are unordered and therefore any permutation of all these is a valid topological 
sort, while C3 comes from a stable sort. The version with pairs is stable on 
the other hand.

2) Topological sorting usually is well-defined on totally connected graphs, so 
I do not know what exactly it means to topologically sort two disjoint graphs. 
This was one of the main drawbacks of the tuple-based approach, but I think it 
may be a good property.

--

___
Python tracker 

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



[issue20479] Efficiently support weight/frequency mappings in the statistics module

2019-01-20 Thread Oscar Benjamin


Oscar Benjamin  added the comment:

Sorry, sent too soon...

> Matlab doesn't support even weighted mean as far as I can tell. There
> is wmean on the matlab file exchange:
https://stackoverflow.com/a/36464881/9450991

This is a separate function `wmean(data, weights)`. It has to be a
separate function though because it's third party code so the author
couldn't change the main mean function.

R ships with a weighted.mean function but I think for standard
deviation you need third party libs.

A quick survey but the main impression I get is that providing API for
this is not that common. The only good-looking API is the statsmodel
one.

--

___
Python tracker 

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



[issue20479] Efficiently support weight/frequency mappings in the statistics module

2019-01-20 Thread Oscar Benjamin


Oscar Benjamin  added the comment:

> I would find it very helpful if somebody has time to do a survey of
> other statistics libraries or languages (e.g. numpy, R, Octave, Matlab,
> SAS etc) and see how they handle data with weights.

Numpy has only sporadic support for this. The standard mean function
does not have any way to provide weights but there is an alternative
called average that computes the mean and has an optional weights
argument. I've never heard of average before searching for "numpy
weighted mean" just now. Numpy's API often has bits of old cruft from
where various numerical packages were joined together so I'm not sure
they would recommend their current approach. I don't think there are
any other numpy functions for providing weighted statistics.

Statsmodels does provide an API for this as explained here:
https://stackoverflow.com/a/36464881/9450991
Their API is that you create an object with data and weights and can
then call methods/attributes for statistics.

Matlab doesn't support even weighted mean as far as I can tell. There
is wmean on the matlab file exchange:

>
> - what APIs do they provide?
> - do they require weights to be positive integers, or do they
>   support arbitrary float weights?
> - including negative weights?
>   (what physical meaning does a negative weight have?)
>
> At the moment, a simple helper function seems to do the trick for
> non-negative integer weights:
>
> def flatten(items):
> for item in items:
> yield from item
>
> py> data = [1, 2, 3, 4]
> py> weights = [1, 4, 1, 2]
> py> statistics.mean(flatten([x]*w for x, w in zip(data, weights)))
> 2.5
>
> In principle, the implementation could be as simple as a single
> recursive call:
>
> def mean(data, weights=None):
> if weights is not None:
> return mean(flatten([x]*w for x, w in zip(data, weights)))
> # base case without weights is unchanged
>
> or perhaps it could be just a recipe in the docs.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2019-01-20 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I have updated the PR to receive a dictionary of sets as in Eric V. Smith's 
package. I have maintained the guts of the current algorithm as it scales much 
better:

>>> test_data = {x:{x+n for n in range(100)} for x in range(1000)}

>>> %timeit list(toposort.toposort(test_data)) # The one in PyPi
910 ms ± 2.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

>>> %timeit list(functools.toposort(test_data)) # In this PR

69.3 ms ± 280 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

>>> list(functools.toposort(l)) == list(toposort.toposort(l))
True

--
Removed message: https://bugs.python.org/msg334099

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2019-01-20 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I have updated the PR to receive a dictionary of sets as in Eric V. Smith's 
package. I have maintained the guts of the current algorithm as it scales much 
better:

>>> test_data = {x:{x+n for n in range(100)} for x in range(1000)}

>>> %timeit list(toposort.toposort(l)) # The one in PyPi
910 ms ± 2.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

>>> %timeit list(functools.toposort(l)) # In this PR

69.3 ms ± 280 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

>>> list(functools.toposort(l)) == list(toposort.toposort(l))
True

--

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread miss-islington


miss-islington  added the comment:


New changeset 2fa53cfa8960f4bcb36718da4424e980fc305ef5 by Miss Islington (bot) 
in branch '3.7':
bpo-35699: fix distuils cannot detect Build Tools 2017 anymore (GH-11495)
https://github.com/python/cpython/commit/2fa53cfa8960f4bcb36718da4424e980fc305ef5


--
nosy: +miss-islington

___
Python tracker 

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



[issue32603] Deprecation warning on strings used in re module

2019-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11389, 11390, 11391

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11389, 11390

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11389

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-20 Thread Ned Deily


Ned Deily  added the comment:


New changeset b2dc4a3313c236fedbd6df664722cd47f3d91a72 by Ned Deily (Marc 
Schlaich) in branch 'master':
bpo-35699: fix distuils cannot detect Build Tools 2017 anymore (GH-11495)
https://github.com/python/cpython/commit/b2dc4a3313c236fedbd6df664722cd47f3d91a72


--
nosy: +ned.deily

___
Python tracker 

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



[issue34424] Unicode names break email header

2019-01-20 Thread Jens Troeger


Jens Troeger  added the comment:

Can somebody please review and merge 
https://github.com/python/cpython/pull/8803 ? I am still waiting for this fix 
the become mainstream.

--

___
Python tracker 

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



[issue35791] Unexpected exception with importlib

2019-01-20 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This might be a bug in "py", which uses a vendored version of apipkg that 
replaces sys.modules["py"] with a lazy loading object. That copy of apipkg does 
not copy __spec__ into the lazy loading object.

If this is indeed consider to be a bug in py I'll file an issue with them.

--

___
Python tracker 

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



[issue35791] Unexpected exception with importlib

2019-01-20 Thread Ronald Oussoren


New submission from Ronald Oussoren :

Using Python 3.7.2 on macOS 10.14 I get an unexpected exception when calling 
"importlib.util.find_spec('py')" after importing "py". find_spec works as 
expected before I import 'py'. 

See the repl session below:

Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib.util
>>> importlib.util.find_spec("py")
ModuleSpec(name='py', loader=<_frozen_importlib_external.SourceFileLoader 
object at 0x10a953fd0>, 
origin='/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py/__init__.py',
 
submodule_search_locations=['/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py'])
>>> import py
>>> importlib.util.find_spec("py")
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/util.py",
 line 111, in find_spec
raise ValueError('{}.__spec__ is not set'.format(name)) from None
ValueError: py.__spec__ is not set

This is with py version 1.7.0 installed (pip install py)

--
components: Library (Lib)
messages: 334094
nosy: brett.cannon, eric.snow, ncoghlan, ronaldoussoren
priority: normal
severity: normal
status: open
title: Unexpected exception with importlib
type: behavior
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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-20 Thread Eric Fahlgren


Eric Fahlgren  added the comment:

Thanks, I installed 3.7.2 on one of our non-production machines and it appears 
that gettext has been fixed, so I'm closing this.

> python -V
Python 3.7.2
> python bpo35785.py --foo
usage: bpo35785.py [-h] [--foo FOO]
bpo35785.py: error: argument --foo: expected one argument

--
resolution:  -> fixed
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



[issue35790] Correct a statement about sys.exc_info() values restoration

2019-01-20 Thread Géry

Change by Géry :


--
keywords: +patch, patch, patch
pull_requests: +11386, 11387, 11388
stage:  -> patch review

___
Python tracker 

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



[issue35790] Correct a statement about sys.exc_info() values restoration

2019-01-20 Thread Géry

Change by Géry :


--
keywords: +patch, patch
pull_requests: +11386, 11387
stage:  -> patch review

___
Python tracker 

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



[issue35790] Correct a statement about sys.exc_info() values restoration

2019-01-20 Thread Géry

Change by Géry :


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

___
Python tracker 

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



[issue35790] Correct a statement about sys.exc_info() values restoration

2019-01-20 Thread Géry

New submission from Géry :

In the documentation of the try statement 
(https://docs.python.org/3/reference/compound_stmts.html#the-try-statement), I 
think that the sentence:

"sys.exc_info() values are restored to their previous values (before the call) 
when returning from a function that handled an exception."

should be replaced by this sentence:

"sys.exc_info() values are restored to their previous values (before the call) 
when leaving an exception handler."

as proven by this code which does not use any "function that handled an 
exception" and yet restores sys.exc_info() values:


>>> try:
... raise ValueError
... except:
... try:
...  raise TypeError
... except:
... print(sys.exc_info())
... print(sys.exc_info())
... 
(, TypeError(), )
(, ValueError(), )

--
assignee: docs@python
components: Documentation
messages: 334092
nosy: docs@python, eric.araujo, ezio.melotti, maggyero, mdk, willingc
priority: normal
severity: normal
status: open
title: Correct a statement about sys.exc_info() values restoration
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



[issue35787] shlex.split inserts extra item on backslash space space

2019-01-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree that the current behavior makes sense. I think "preserve the literal 
value of the next character" means the space won't be interpreted as a 
separator.

In the first example (I think better written as shlex.split(r'a \ b')), the 
first space is a separator. The second space is not a separator because of the 
backslash, so it's part of the second token ' b'.

In the second example (shlex.split(r'a \  b')), the first space is a separator, 
the second space is not a separator because of the backslash, and the third 
space is a separator. This explains why there's no space before the 'b'.

I assume peter.otten's example is bash. I can confirm with zsh:

[~]$ python3 -c 'import sys; print(sys.argv)' a   b
['-c', 'a', 'b']
[~]$ python3 -c 'import sys; print(sys.argv)' a \ b
['-c', 'a', ' b']
[~]$ python3 -c 'import sys; print(sys.argv)' a \  b
['-c', 'a', ' ', 'b']

I'm going to close this. But anyone wants to suggest a documentation patch, 
feel free to reopen this.

Also, changing this would no doubt break some code, so I'd recommend against 
changing it even if I didn't think it was doing the right thing.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


Samuel Colvin  added the comment:

Thanks for the explanation David.

It would be really useful if this was prominently noted in smtpd, it would have 
saved me spending my morning fixing these things. There's also (AFAIK) nothing 
about this being deprecated in the docs.

More generally I understand the idea of deprecated code that doesn't get 
updated to conform to latest conventions, but surely if the code exists in the 
standard lib. it should at least work as it was originally intended or be 
removed?

Since the PR is done and passing surely it would be better to merge it than 
leave PureProxy completely broken.

By the way, aiosmtpd is not in good shape:
1. Its proxy handler is blocking 
https://github.com/aio-libs/aiosmtpd/blob/master/aiosmtpd/handlers.py#L119
2. Its proxy handler appears to be broken in some other way, I couldn't get it 
to forward emails which is why I resorted to using standard smtpd.
3. It's built in a very odd way, it appears to use threading not asyncio to run 
the main controller 
https://github.com/aio-libs/aiosmtpd/blob/master/aiosmtpd/controller.py#L54

--

___
Python tracker 

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



[issue35789] Typo in unittest.mock docs

2019-01-20 Thread Jim Carroll


Jim Carroll  added the comment:

Never mindi see this issue has been reported previously and the typo is 
considered intentional.

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread R. David Murray


R. David Murray  added the comment:

Thanks for being willing to work on this, but smtpd is deprecated in favor of 
aiosmtpd (which is not part of the stdlib).  smtpd should really only be used 
for internal stdlib testing, but it is retained for backward compatibility 
reasons.

All of these issues have been previously reported and were closed in favor of 
recommending aiosmtpd because we are no longer maintaining smtpd.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue35789] Typo in unittest.mock docs

2019-01-20 Thread Jim Carroll


New submission from Jim Carroll :

There is a typo in the unittest.mock documentation found at 
https://docs.python.org/3/library/unittest.mock.html.

There are seven(7) instances of the word assret, where the author clearly 
intended assert.

--
assignee: docs@python
components: Documentation
messages: 334087
nosy: docs@python, jamercee
priority: normal
severity: normal
status: open
title: Typo in unittest.mock docs
type: enhancement
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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

> Should I create a new issue(s) for these problems or is there some agreement 
> that only actual bugs will be fixed in little-used modules like this?

I would create new issue for each point to discuss, but I would like listen 
other opinions

--
nosy: +eamanu

___
Python tracker 

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



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

2019-01-20 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Hi Berker, 

Thanks for you response. 

I agree when you say that patch.dict is a simply operation, but I think that 
this test can be necessary, if for some reason the implementation of patch.dict 
(or its parts) decide change. 

> I think the relationship between dict and OrderedDict (including any other 
> dict subclasses and dict-like objects) and anything related to insertion 
> order should be tested either in test_dict or in test_ordered_dict.

I am not sure if this has to be tested on test_dict or test_oredered_dict, 
because we are not testing specifically dict-like objects.

This test, can be written on test_patch_dict and not create a new 
`test_patch_dict_with_orderdict`.

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2019-01-20 Thread tjh


tjh  added the comment:

If you're here looking for a solution, deleting previously installed deps 
helped me. In my case this was:

$ rm -rf ~/.local/lib/python2.7/site-packages/  # path may differ depending 
where you install these
$ pip install cffi

--
nosy: +tjh

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


Change by Samuel Colvin :


--
keywords: +patch, patch, patch
pull_requests: +11381, 11382, 11383
stage:  -> patch review

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


Change by Samuel Colvin :


--
keywords: +patch, patch
pull_requests: +11381, 11382
stage:  -> patch review

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


Change by Samuel Colvin :


--
keywords: +patch, patch, patch, patch
pull_requests: +11381, 11382, 11383, 11384
stage:  -> patch review

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


Change by Samuel Colvin :


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

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-20 Thread Samuel Colvin


New submission from Samuel Colvin :

smtpd.PureProxy.process_message and smtpd.MailmanProxy.process_message are 
defined to not receive the extra kwargs which they're called with.

They both also expect "data" to be str when it's actually bytes.

Thus they're completed broken at the moment.

I'd like to submit a PR to fix these two bugs.

There are a number of other issues/potential improvements to smtpd which are 
not critical but I guess should be fixed:
* no support for starttls
* use of print(..., file=DEBUGSTREAM) instead of logger.debug
* no type hints
* PureProxy's forwarding doesn't try starttls

Should I create a new issue(s) for these problems or is there some agreement 
that only actual bugs will be fixed in little-used modules like this?

--
components: email
messages: 334083
nosy: barry, r.david.murray, samuelcolvin
priority: normal
severity: normal
status: open
title: smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and 
more
type: crash
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



[issue35787] shlex.split inserts extra item on backslash space space

2019-01-20 Thread Peter Otten


Peter Otten <__pete...@web.de> added the comment:

To me the current shlex behaviour makes sense, and the shell (tested with bash) 
behaves the same way:

$ python3 -c 'import sys; print(sys.argv)' a   b
['-c', 'a', 'b']
$ python3 -c 'import sys; print(sys.argv)' a \  b
['-c', 'a', ' ', 'b']

--
nosy: +peter.otten

___
Python tracker 

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



[issue35787] shlex.split inserts extra item on backslash space space

2019-01-20 Thread Max


New submission from Max :

I believe in both cases below, the ouptu should be ['a', 'b']; the extra ' ' 
inserted in the list is incorrect:

python3.6
Python 3.6.2 (default, Aug  4 2017, 14:35:04)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> shlex.split('a \ b')
['a', ' b']
>>> shlex.split('a \  b')
['a', ' ', 'b']
>>>

Doc reference: https://docs.python.org/3/library/shlex.html#parsing-rules
> Non-quoted escape characters (e.g. '\') preserve the literal value of the 
> next character that follows;

I believe this implies that backslash space should be just space; and then two 
adjacent spaces should be used (just like a single space) as a separator 
between arguments.

--
components: Library (Lib)
messages: 334081
nosy: max
priority: normal
severity: normal
status: open
title: shlex.split inserts extra item on backslash space space
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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-20 Thread Dong-hee Na

Dong-hee Na  added the comment:

➜  cpython.git git:(3.7) ✗ ./python.exe bpo-35785.py --foo test
➜  cpython.git git:(3.7) ✗ ./python.exe bpo-35785.py --foo 1
➜  cpython.git git:(3.7) ✗ ./python.exe bpo-35785.py --foo
usage: bpo-35785.py [-h] [--foo FOO]
bpo-35785.py: error: argument --foo: expected one argument

--

___
Python tracker 

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