[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Ananthakrishnan: Do you know how arrays and pointers work in C?

--

___
Python tracker 

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



[issue39704] Disable code coverage

2020-02-20 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Just to clarify is it about just disabling the automatic comment about code 
coverage on PRs or the code coverage build itself?

--
nosy: +xtreak

___
Python tracker 

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



[issue39704] Disable code coverage

2020-02-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur.

--
nosy: +rhettinger

___
Python tracker 

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



[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-20 Thread Ananthakrishnan

Ananthakrishnan  added the comment:

This is my code for math.gcd:

static PyObject *
math_gcd(PyObject *module, PyObject *args, Py_ssize_t n)
{
PyObject *g = 0, *item, *in;

Py_ssize_t i;
for (i = 0; i < n; i++) {
item = args[i];
in = PyNumber_Index(item);
if (in == NULL) {
return NULL;
}
g = _PyLong_GCD(g, in);
}
Py_DECREF(in);
return g;
}



This is showing an error:

error: incompatible types when assigning to type ‘PyObject * {aka struct 
_object *}’ from type ‘PyObject {aka struct _object}’
   item = args[i];
   ^^^

--

___
Python tracker 

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



[issue38657] Clarify numeric padding behavior in string formatting

2020-02-20 Thread miss-islington


miss-islington  added the comment:


New changeset 09db1da63f866afff8a64ae3c60acdcd6bc80501 by Miss Islington (bot) 
in branch '3.7':
bpo-38657: Clarify numeric padding behaviour in string formatting (GH-17036)
https://github.com/python/cpython/commit/09db1da63f866afff8a64ae3c60acdcd6bc80501


--

___
Python tracker 

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



[issue38657] Clarify numeric padding behavior in string formatting

2020-02-20 Thread miss-islington


miss-islington  added the comment:


New changeset a2075121217e809c9a5511f6ca225c12f340de0c by Miss Islington (bot) 
in branch '3.8':
bpo-38657: Clarify numeric padding behaviour in string formatting (GH-17036)
https://github.com/python/cpython/commit/a2075121217e809c9a5511f6ca225c12f340de0c


--

___
Python tracker 

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



[issue38657] Clarify numeric padding behavior in string formatting

2020-02-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17958
pull_request: https://github.com/python/cpython/pull/18588

___
Python tracker 

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



[issue38657] Clarify numeric padding behavior in string formatting

2020-02-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17957
pull_request: https://github.com/python/cpython/pull/18587

___
Python tracker 

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



[issue38657] Clarify numeric padding behavior in string formatting

2020-02-20 Thread miss-islington


miss-islington  added the comment:


New changeset 424e5686d82235e08f8108b8bbe034bc91421689 by Pete Wicken in branch 
'master':
bpo-38657: Clarify numeric padding behaviour in string formatting (GH-17036)
https://github.com/python/cpython/commit/424e5686d82235e08f8108b8bbe034bc91421689


--
nosy: +miss-islington

___
Python tracker 

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



[issue39684] PyUnicode_IsIdentifier has two if/thens that can be combined

2020-02-20 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 933fc53f3f9c64ffa703b1f23a93bec560faea57 by Andy Lester in branch 
'master':
closes bpo-39684: Combine two if/thens and squash uninit var warning. (GH-18565)
https://github.com/python/cpython/commit/933fc53f3f9c64ffa703b1f23a93bec560faea57


--
nosy: +benjamin.peterson
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



[issue39598] ERR_CACHE_MISS

2020-02-20 Thread Gustavo


Gustavo  added the comment:

If you need more help on this issue, you can try the following guide: 
https://chromenotopening.com

--
nosy: +gustavoxo

___
Python tracker 

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



[issue39622] KeyboardInterrupt is ignored when await asyncio.sleep(0)

2020-02-20 Thread Zhibin Dong


Zhibin Dong  added the comment:

Thank you for your investigation, I will also try to see what went wrong.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Vedran Čačić

Vedran Čačić  added the comment:

Hm... is "exact result" a technical term that's defined somewhere? Because to 
me it seems that this

> "If there exists an exact result at a lower precision, this
result should also be returned at MAX_PREC (without MemoryError)".

is a mathematical statement, and surely for Decimal('0.07776') ** 
Decimal('0.2') _there exists_ an exact result at a lower precision. Maybe this 
should be reworded as "If there exists ... _and an implementation knows about 
it_, it should also be returned ..."

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset b6271025c640c228505dc9f194362a0c2ab81c61 by Miss Islington (bot) 
in branch '3.8':
bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581) 
(#18584)
https://github.com/python/cpython/commit/b6271025c640c228505dc9f194362a0c2ab81c61


--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset c6f95543b4832c3f0170179da39bcf99b40a7aa8 by Miss Islington (bot) 
in branch '3.7':
bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581) 
(#18585)
https://github.com/python/cpython/commit/c6f95543b4832c3f0170179da39bcf99b40a7aa8


--

___
Python tracker 

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



[issue35950] io.BufferedReader.writabe is False, but io.BufferedReader.truncate does not raise OSError

2020-02-20 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +17956
pull_request: https://github.com/python/cpython/pull/18586

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17954
pull_request: https://github.com/python/cpython/pull/18584

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17955
pull_request: https://github.com/python/cpython/pull/18585

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset 90930e65455f60216f09d175586139242dbba260 by Stefan Krah in branch 
'master':
bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581)
https://github.com/python/cpython/commit/90930e65455f60216f09d175586139242dbba260


--

___
Python tracker 

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



[issue39704] Disable code coverage

2020-02-20 Thread Ammar Askar


Ammar Askar  added the comment:

Agreed, it's way too noisy. This PR which touches absolutely no code 
https://github.com/python/cpython/pull/18583#issuecomment-589432937

claims to "increase coverage by 1.01%."

This doesn't really add much value and only adds noise in the pull requests.

--
nosy: +ammar2

___
Python tracker 

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



[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values

2020-02-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> It does seem like a good solution.

Great. I'll close this issue then as the proposed solution is actually not as 
straightforward as it seems. Task names exist specifically to solve this case.

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



[issue39660] Contextvars: Optional callbacks on state change

2020-02-20 Thread Leonard Lausen


Leonard Lausen  added the comment:

> No, but there's C API that you can use to get/set contextvars. If a C library
> is hard coded to use threadlocals I'm afraid there's nothing we can do about
> it except fixing their C code to make state storage pluggable.

I agree the C library could check the Python state. On the other hand, the 
Python frontend may be just one of multiple supported language frontends of the 
library. So it seems preferable if Python could tell the library when to change 
state.

> What library do you have in mind?

MXNet has such a thread-local C API to enable / disable recording for autograd. 
https://github.com/apache/incubator-mxnet/blob/9b38df0622fec677e6b4891dfc4c10295359996d/include/mxnet/c_api.h#L1260-L1266

> Theoretically yes, for debug purposes at least. But I still fail to see how
> you could use that API even if it existed.

Consider we are in "context 1". When we change the state in the C library by 
calling `old_state = lib.set_state(new_state)`, we get to know the prior state. 
When switching to "context 2", `lib.set_state(old_state)` should be called. 
When switching back to "context 1", `lib.set_state(new_state)` should be called 
again. It's analogous to contextvars.

Would there be too much overhead if allowing specification of a python function 
that contextvars calls on context changes?

--

___
Python tracker 

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



[issue39699] Some CIs silence potentially useful output from make

2020-02-20 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
pull_requests: +17953
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18583

___
Python tracker 

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



[issue39699] Some CIs silence potentially useful output from make

2020-02-20 Thread Ammar Askar


Change by Ammar Askar :


--
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open
title: Ubuntu Github action not fully running build process -> Some CIs silence 
potentially useful output from make
type: behavior -> enhancement

___
Python tracker 

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



[issue39660] Contextvars: Optional callbacks on state change

2020-02-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Would there be too much overhead if allowing specification of a python 
> function that contextvars calls on context changes?

Potentially yes, especially if we allow more than one context change callback.  
Allowing just one makes the API inflexible (what if you want to use two 
libraries from PyPI that both want to use the callback).  Allowing multiple 
context change callbacks leads to complicated API.

For extra context: context switches occur on every callback invocation in 
asyncio and there can be thousands of them per seconds (or even more). Adding 
any extra code to context switching code will noticeably degrade the 
performance.

In general, I'd suggest patching the C library to make state management 
customizable (like CPython allows you to customize which memory allocator to 
use)

--

___
Python tracker 

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



[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values

2020-02-20 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

Oh I just learned that since python3.8 you can name individual tasks. Sorry for 
the confusion :)
It does seem like a good solution.

--

___
Python tracker 

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



[issue39704] Disable code coverage

2020-02-20 Thread Stefan Krah


New submission from Stefan Krah :

The automated code coverage on GitHub is quite inaccurate and needlessly flags 
PRs as red.

I'd prefer to make this opt-in.

--
messages: 362367
nosy: skrah
priority: normal
severity: normal
status: open
title: Disable code coverage

___
Python tracker 

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



[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values

2020-02-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> I agree, but wouldn't you agree that some information is better than no 
> information?

We do agree with that. Making it work in the way that does not disturb people 
when a 10mb bytes string is passed is challenging. We could just cut everything 
after 100 characters, but it's not an ideal solution either.

> But in case the same task is run many times with different arguments, the 
> task's name by itself doesn't provide very useful information...

So make it useful. You can concatenate critical arguments reprs to task names 
or make them informative in other way.  If you're working with a third-party 
library that doesn't use task names consider making a PR.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:

BTW, this PR implements the invariant:

"If there exists an exact result at a lower precision, this
result should also be returned at MAX_PREC (without MemoryError)".

So non-integer powers are left out, since _decimal has no notion
of exact non-integer powers yet.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:

Fortunately libmpdec raises MemoryError almost instantaneously, so the PR 
retries 
the affected operations with estimated upper bounds for exact results without 
slowing down the common case.

The docs still need updating because people will still wonder why 1 / Decimal(3)
freezes the Linux machine at MAX_PREC. ;)


The Python implementation cannot use this approach because memory grows slowly. 
 
I'm not sure though if anyone _would_ run _pydecimal at MAX_PREC.

--
type:  -> enhancement

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2020-02-20 Thread Andrew Bartlett


Andrew Bartlett  added the comment:

This breaks Samba's build:

https://bugzilla.samba.org/show_bug.cgi?id=14266

While we are of course able to patch new versions of Samba, this will make it 
harder to bisect back though Samba history.  It would be really great if this 
kind of change could be reverted or at least deferred so Samba can rely on a 
stable language platform for it's build system.

--
nosy: +abartlet

___
Python tracker 

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



[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values

2020-02-20 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

> Not so easy to find a satisfactory generic approach.
I agree, but wouldn't you agree that some information is better than no 
information?

>Task has a name exactly for the purpose of distinguishing similar but 
>different tasks
But in case the same task is run many times with different arguments, the 
task's name by itself doesn't provide very useful information...

--

___
Python tracker 

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



[issue39699] Ubuntu Github action not fully running build process

2020-02-20 Thread Steve Dower


Steve Dower  added the comment:

Probably just where I copied it from. PRs welcome!

--

___
Python tracker 

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



[issue39695] Failed to build _uuid module, but libraries was installed

2020-02-20 Thread Marco Sulla


Marco Sulla  added the comment:

Ah, well, this is not possible. I was banned from the mailing list. I wrote my 
"defense" to conduct...@python.org in date 2019-12-29, and I'm still waiting 
for a response...

--

___
Python tracker 

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



[issue39660] Contextvars: Optional callbacks on state change

2020-02-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Is there any existing API that can be used to call `lib.set_state` on context 
> changes?

No, but there's C API that you can use to get/set contextvars. If a C library 
is hard coded to use threadlocals I'm afraid there's nothing we can do about it 
except fixing their C code to make state storage pluggable.

What library do you have in mind?

> If not, would it make sense to extend `contexvars` to allow users to 
> configure that `lib.set_state` is called on context change?

Theoretically yes, for debug purposes at least.  But I still fail to see how 
you could use that API even if it existed.

--

___
Python tracker 

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



[issue39184] Many command execution functions are not raising auditing events

2020-02-20 Thread miss-islington


miss-islington  added the comment:


New changeset d0a464e31ac67685ef8ad35ecd993f17dfd6ab35 by Miss Islington (bot) 
in branch '3.8':
bpo-39184: Fix incorrect return value (GH-18580)
https://github.com/python/cpython/commit/d0a464e31ac67685ef8ad35ecd993f17dfd6ab35


--

___
Python tracker 

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



[issue39537] Change line number table format

2020-02-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue39184] Many command execution functions are not raising auditing events

2020-02-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17952
pull_request: https://github.com/python/cpython/pull/18582

___
Python tracker 

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



[issue39184] Many command execution functions are not raising auditing events

2020-02-20 Thread miss-islington


miss-islington  added the comment:


New changeset 6c444d0dab8f06cf304263b34beb299101cef3de by Steve Dower in branch 
'master':
bpo-39184: Fix incorrect return value (GH-18580)
https://github.com/python/cpython/commit/6c444d0dab8f06cf304263b34beb299101cef3de


--

___
Python tracker 

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



[issue39660] Contextvars: Optional callbacks on state change

2020-02-20 Thread Leonard Lausen


Leonard Lausen  added the comment:

Consider a `lib = ctypes.CDLL(lib_path, ctypes.RTLD_LOCAL)` which provides APIs 
`lib.compute`, `lib.set_state` and a Python interface wrapping both in `def 
compute`, `def set_state`. Let's assume `lib.set_state` sets a thread-local 
state in the library implementation and further  that the behaviour of 
`lib.compute` depends on the last call to `lib.set_state`. 

Users of the Python interface may call `set_state` and `compute` concurrently 
in coroutines. Thereby one coroutine may change the state in the library, prior 
to another coroutine calling `compute`. This leads to a wrong result.

If `set_state` and `compute` were pure python functions, `contextvars` could be 
used to implement set_state and provide context-local state.

Is there any existing API that can be used to call `lib.set_state` on context 
changes? If so, please let me know. If not, would it make sense to extend 
`contexvars` to allow users to configure that `lib.set_state` is called on 
context change?

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-20 Thread Stefan Krah


Change by Stefan Krah :


--
keywords: +patch
pull_requests: +17951
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18581

___
Python tracker 

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



[issue39695] Failed to build _uuid module, but libraries was installed

2020-02-20 Thread Ammar Askar


Ammar Askar  added the comment:

Sorry about your experience Marco but I think the dev guide is pretty clear on 
all these steps (including having to redo `make clean`). You can find some 
discussion on the build system here 
https://discuss.python.org/t/is-there-prior-discussion-around-the-build-system-of-cpython-itself/2813
 but for now I'm going to close this as "not-a-bug" because the dev guide 
covers it.

If your proposal is to make dependent modules build without re-configuring, 
please contribute to that discussion or bring it up on the ideas forum.

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



[issue39184] Many command execution functions are not raising auditing events

2020-02-20 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +17950
pull_request: https://github.com/python/cpython/pull/18580

___
Python tracker 

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



[issue39699] Ubuntu Github action not fully running build process

2020-02-20 Thread Ammar Askar


Ammar Askar  added the comment:

Aah sorry. This was my mistake, I didn't notice that we're passing `-s` 
(silent) to make. It is actually performing the build underneath, just not with 
the outputs that get produced form other CIs.

Steve, is there a reason the Github action and Azure pipelines:

* 
https://github.com/python/cpython/blob/1246d892038a693304549f8574e6c2784b91589a/.azure-pipelines/posix-steps.yml#L23

* 
https://github.com/python/cpython/blob/1246d892038a693304549f8574e6c2784b91589a/.github/workflows/build.yml#L58

both pass `-s` to make but Travis doesn't? It seems like it might potentially 
hide useful information about the build.

* 
https://github.com/python/cpython/blob/1246d892038a693304549f8574e6c2784b91589a/.travis.yml#L170

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



[issue38576] CVE-2019-18348: CRLF injection via the host part of the url passed to urlopen()

2020-02-20 Thread Matej Cepl


Matej Cepl  added the comment:

Just to say this is reproducible only on rather old enterprise Linux 
distributions, where CVE-2016-10739 bug in glibc has not been fixed. I believe 
it means RHEL-6, SUSE SLE-10, 11, 12 (not sure whether it applies to some old 
Debian as well).

--

___
Python tracker 

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



[issue39695] Failed to build _uuid module, but libraries was installed

2020-02-20 Thread Marco Sulla


Marco Sulla  added the comment:

Well, the fact is, basically, for the other libraries you have not to re-run 
`configure`. You have to install only the missing C libraries and redo `make`. 
This works, for example, for zlib, lzma, ctypes, sqlite3, readline, bzip2.

Furthermore, it happened to me that I re-run `configure` without a `make clean` 
before: the `make` process stopped because configuration was changed, and I 
have to do a `make clean`. A big waste of time.

--

___
Python tracker 

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



[issue39617] max_workers argument to concurrent.futures.ProcessPoolExecutor is not flexible enough

2020-02-20 Thread sds


sds  added the comment:

On a closer observation, I think you are eminently right.
Idle workers take far far far too much RAM.
In fact, I would like to be able to specify that the workers are to be spinned 
up on demand only and terminated immediately when they they are done.

--

___
Python tracker 

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



[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-20 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

> If I understand the following code correctly, there seems to be a busy loop 
> waiting for the SimpleQueue.put to signal that an item was entered to queue.

This is not a busywait. Actually, the loop you specified will never repeat more 
than twice. At the first iteration, the queue's lock is acquired. At the second 
iteration, the loop waits for the lock to be released (by trying to acquire the 
lock again, which is not busywait). The lock is only released when something is 
put into the queue, so at that point the loop exits and the function returns.

Avraham, could you provide a minimal python script that will reproduce the CPU 
usage spike?

--
nosy: +kmaork

___
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

2020-02-20 Thread wim glenn


Change by wim glenn :


--
nosy: +wim.glenn

___
Python tracker 

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



[issue39698] asyncio.sleep() does not adhere to time.sleep() behavior for negative numbers

2020-02-20 Thread Marco Sulla


Marco Sulla  added the comment:

> I recall very many cases in third-party libraries and commercial applications

Source?

--

___
Python tracker 

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



[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values

2020-02-20 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Not so easy to find a satisfactory generic approach.
An argument can also be 10 MiB length bytes array, a dictionary with 10,000 
elements, HTML page, name it.
All these objects are printable but their representation is too verbose.
Task can have a dozen of arguments, only the latest may be meaningful for 
logically separating one task from others.

Task has a name exactly for the purpose of distinguishing similar but different 
tasks, please use it. Only the task creator knows how to name it better.

--

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2020-02-20 Thread Geoffrey Bache


Geoffrey Bache  added the comment:

@Valentyn Tymofieiev - true, and thanks for the tip, though the symptoms 
described there are somewhat different from what I'm observing. Also, my 
problem seems to be dependent on zipping the Python code, which that one isn't.

--

___
Python tracker 

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



[issue39622] KeyboardInterrupt is ignored when await asyncio.sleep(0)

2020-02-20 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

I wrote a small script that checks the behavior of asyncio.sleep when called 
with small amounts of time (starting from 0). For each amount I checked 500 
times whether SleepTest has stopped when interrupted with SIGINT. Below are the 
results:

SLEEP TIME  SIGINT FAILURE PERCENT
0   26.6%
1e-06   9.8%
2e-06   11.8%
3e-06   11.2%
4e-06   9.6%
5e-06   13.8%
6e-06   5.6%
7e-06   2.6%
8e-06   1.4%
9e-06   1.6%
1e-05   2.2%
1.1e-05 2.2%
1.2e-05 2.0%
1.3e-05 1.8%
1.4e-05 0.8%

It is worth mentioning that the failure amount increased when my CPU was 
busier. Maybe it is because of false positives in my script (although I think I 
used relatively generous timeouts when waiting for the ioloop to start running 
and for the process to die after a SIGINT) and maybe it is because of the 
nature of the bug in asyncio. I didn't put a lot of effort into distinguishing 
between the two, as increasing the timeouts also made my CPU less busy.

Anyway, there is definitely a weird behavior here, and I still think there is a 
specific piece of code in asyncio that's causing it. Maybe I'll look at the 
code a bit, or try to think of other ways to approach this.

--

___
Python tracker 

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



[issue39698] asyncio.sleep() does not adhere to time.sleep() behavior for negative numbers

2020-02-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> The ship has sailed, this change breaks a lot of existing code without a 
> strong reason.

Yes.

It's a common thing to compute asyncio.sleep delay and sometimes it goes 
negative. The current behavior is part of our API now.

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Steve Dower


Steve Dower  added the comment:

Looks like the get_externals.py script needs to be made a bit more robust - 
downloading from GitHub hasn't been very reliable this week.

--
components: +Windows
nosy: +paul.moore, tim.golden, zach.ware

___
Python tracker 

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



[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Ananthakrishnan: Sure, go ahead.

Let's make the process a bit more streamlined than last time around: see if you 
can put together a PR that passes all the CI checks before asking for review. 
If you get stuck, make a work-in-progress PR and ask for help in a comment on 
that PR rather than via email.

A couple of pointers:

- Take a look at the existing math.hypot implementation to see how to deal with 
multiple arguments. (Note that argument clinic doesn't currently work for *args 
functions.)

- For the first working version, don't bother making special cases for the 
zero-argument or one-argument gcd (or even the case of two arguments). You just 
want the equivalent of the following Python code, which is perfectly general:

def gcd(*args):
g = 0
for arg in args:
g = gcd_2arg(g, operator.index(arg))
return g

where gcd_2arg is the original 2-argument gcd (in C, _PyLong_GCD). We can 
always optimise later.

--

___
Python tracker 

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



[issue39692] Subprocess using list vs string

2020-02-20 Thread Jonny Weese


Jonny Weese  added the comment:

> So the command_string provided (the first word or the first quoted 
> expression) is interpreted as a shell program, and this program is invoked 
> with the remaining words as its arguments.

Correct.

> As you say, simply slapping quotes around all the args produces a subtle 
> difference: the arg in the position of `$0` is used as an actual positional 
> parameter in one case, and as the shell name in the other case

It is not quite just a shifting of the positional args.

$ bash -c 'f() { printf "%s\n"; }; f "$@"' - foo bar baz
=> "From a string, read this bash script, which defines a function f and then 
invokes f on all of its arguments. Now invoke that script with an executable 
name of "-" and the arguments "foo" "bar" and "baz".

$ bash -c 'f() { printf "%s\n"; }; f "$@" - foo bar baz'
=> "From a string, read this bash script, which defines f and then invokes f on 
all the script arguments as well as "-" "foo" "bar" and "baz". Then invoke that 
script with no other arguments."

--

___
Python tracker 

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



[issue39622] KeyboardInterrupt is ignored when await asyncio.sleep(0)

2020-02-20 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

This behaved similarly on my machine, also ubuntu. But it also happened (less 
often) with small numbers, like sleep(0.01).

Also, I tried it on my windows 10 and experienced another unexpected behavior - 
only when using sleep(0), Ctrl-C would not work *at all* from time to time. 
Most of the times it would stop the program immediately. This also happened 
when using 0.01 instead of 0.

Unless 0.01 turns into 0 somewhere along the way, I'd 
suspect that there is a piece of code inside asyncio's core that doesn't handle 
interrupting correctly (both on linux and windows), and using sleep with small 
numbers just makes it much more probable for this piece of code to be running 
when the Ctrl-C signal is sent.

I'll try to dig in more.

--

___
Python tracker 

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



[issue39589] Logging QueueListener should support context manager

2020-02-20 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> not a bug
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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Stefan Krah


Change by Stefan Krah :


--
status: closed -> open

___
Python tracker 

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



[issue39692] Subprocess using list vs string

2020-02-20 Thread Niklas Smedemark-Margulies


Niklas Smedemark-Margulies  added the comment:

Good point - the phrasing I suggested there is not accurate, and there is more 
complicated behavior available than simply specifying a single executable. 
Here's the bash manual's info about "-c" flag:

"""
If the -c option is present, then commands are read from the first non-option 
argument command_string.   If  there  are arguments  after  the  
command_string, the first argument is assigned to $0 and any remaining 
arguments are assigned to the positional parameters.  The assignment to $0 sets 
the name of the shell, which is used in warning  and  error  messages.
"""

So the command_string provided (the first word or the first quoted expression) 
is interpreted as a shell program, and this program is invoked with the 
remaining words as its arguments. As you point out, this command_string can be 
a terminal expression like `true`, a function definition like you provided, an 
executable, or other possibilities, but in any case it will be executed with 
the remaining args.

(This also matches how the library code assigns `executable`: 
https://github.com/python/cpython/blob/master/Lib/subprocess.py#L1707)

As you say, simply slapping quotes around all the args produces a subtle 
difference: the arg in the position of `$0` is used as an actual positional 
parameter in one case, and as the shell name in the other case:

$ bash -c 'f() { printf "%s\n" "$@"; }; f "$@"' - foo bar baz
foo
bar
baz
 $ bash -c 'f() { printf "%s\n" "$@"; }; f "$@" - foo bar baz'
-
foo
bar
baz

(Unless I am misunderstanding the behavior here).

It's a bit frustrating that this approach would not work to simplify the usage, 
but (assuming my explanation is correct) I concede that code might certainly be 
depending on this behavior and setting the shell name with args[1] (and they 
would not want this to become a positional parameter instead).


Improving on my first attempt, here's another possible phrasing for the docs:
"""
Using `shell=True` invokes the sequence of args via ` -c` where  
is the chosen system shell (described elsewhere on this page). In this case, 
the item at args[0] is a shell program, that will be invoked on the subsequent 
args. The item at args[1] will be stored in the shell variable `$0`, and used 
as the name of the shell. The subsequent items at args[2:] will be stored as 
shell parameters (`$1`, `$2`, etc) and available as positional parameters (e.g. 
using `echo $@`).
"""

I would certainly be happy to defer on giving a precise and thorough statement 
for the docs, but clarifying/highlighting this behavior definitely seems useful.

Thanks again

--

___
Python tracker 

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:

Re-opening this issue, Azure fails too often:

https://github.com/python/cpython/pull/18577

https://dev.azure.com/Python/cpython/_build/results?buildId=58220=logs=c83831cd-3752-5cc7-2f01-8276919eb334

--

___
Python tracker 

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Stefan Krah


Stefan Krah  added the comment:

Closing and reopening the PR helped.

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



[issue39660] Contextvars: Optional callbacks on state change

2020-02-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue39692] Subprocess using list vs string

2020-02-20 Thread Jonny Weese


Jonny Weese  added the comment:

> it seems strange/wrong to invoke an executable via "bash -c executable arg1 
> arg2", rather than just "executable arg1 arg2"!

I agree it's strange to invoke a single executable that way, but remember that 
-c allows a string of arbitrary bash code. (It just happens that bash code that 
consists of a single executable calls it -- useful behavior in a shell.)

Consider:

$ bash -c 'f() { printf "%s\n" "$@"; }; f "$@"' - foo bar baz
foo
bar
baz

> 1) If there exist use cases for setting `shell=True` and doing "bash -c 
> my_executable arg2 arg3", then the documentation should say something like 
> the following:
> """
> Using `shell=True` invokes the sequence of args via `bash -c`. In this case, 
> the first argument MUST be an executable, and the subsequent arguments will 
> be stored as bash parameters for that executable (`$0`, `$1`, etc).
> """

I'd be okay with clearer docs, but the given language is not quite right. For 
example, the actual shell call is /bin/sh (and depends on the platform). And, 
as described above, I think it would be too restrictive to say the first 
argument must be a single executable.

On the other hand, I disagree with option 2. I think raising an error would be 
very restrictive, and secretly quoting the argument could be surprising for 
(the few) people who understand the underlying shell mechanism.

--

___
Python tracker 

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



[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Thanks and apologies for missing the duplicate.

Not a problem: much better to have a potential bug reported twice than not at 
all.

--

___
Python tracker 

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



[issue39703] Floor division operator and floats

2020-02-20 Thread Kostis Gourgoulias


Kostis Gourgoulias  added the comment:

Aha, I see! Thanks and apologies for missing the duplicate.

--

___
Python tracker 

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



[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

Ah, found the duplicate (or at least one of them): 
https://bugs.python.org/issue27463

--
components: +Interpreter Core -macOS
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Floor division is not the same as the floor of division

___
Python tracker 

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



[issue39692] Subprocess using list vs string

2020-02-20 Thread Niklas Smedemark-Margulies


Niklas Smedemark-Margulies  added the comment:

Thanks very much for getting back to me so quickly, and for identifying the 
reason for the difference in behavior.

Sorry to harp on a relatively small behavior, but it cost me a few hours and it 
might cause confusion for others as well.

It still seems like an oversight that the body of a program invoked by `bash 
-c` would not be quoted. Consider the following two examples:

$ bash -c echo my critical data > file.txt
$ cat file.txt 

$ # My data was lost!

Or again in Python:

>>> import subprocess
>>> res1 = subprocess.run(['echo', 'my', 'critical', 'data', '>', 'file.txt'], 
>>> shell=True, capture_output=True)
>>> res1.returncode
0
>>> exit()
$ cat file.txt
cat: file.txt: No such file or directory
$ # The file is not even created!



I know that the subsequent args are stored as bash arguments to the first 
executable/quoted program, for example:

$ bash -c 'echo $0' foo
foo

or

>>> res1 = subprocess.run(['echo $0', 'foo'], shell=True, capture_output=True)
>>> res1.stdout
b'foo\n'


However, it seems strange/wrong to invoke an executable via "bash -c executable 
arg1 arg2", rather than just "executable arg1 arg2"! In other words, the 
combination of `shell=True` with a sequence of args appears to behave 
surprisingly/wrong.


---


Here's the only part of the docs I could find that discuss the interaction 
between `shell=True` and args.:
"""
The shell argument (which defaults to False) specifies whether to use the shell 
as the program to execute. If shell is True, it is recommended to pass args as 
a string rather than as a sequence.
"""



I think there are ~2 cases here:

1) If there exist use cases for setting `shell=True` and doing "bash -c 
my_executable arg2 arg3", then the documentation should say something like the 
following:
"""
Using `shell=True` invokes the sequence of args via `bash -c`. In this case, 
the first argument MUST be an executable, and the subsequent arguments will be 
stored as bash parameters for that executable (`$0`, `$1`, etc).
"""

2) The body of the program invoked with `bash -c` should always be quoted. In 
this case, there should either be a code fix to quote the body, or a 
`ValueError` when `shell=True` and args is a sequence.


How does this sound from your perspective?

--

___
Python tracker 

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



[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Shouldn't the two approaches provide the same answer?

In a word, no. :-)

math.floor(1/0.01) involves *two* operations, and there's an intermediate 
rounding step which happens to round the true mathematical result of 1/0.01 up 
to 100.0. Taking the floor of that then (of course) gives 100.0.

1//0.01 is the single-operation equivalent, that doesn't include an 
intermediate round.

There are lots of other cases where a combination of two or more operations is 
mathematically equivalent to a single operation, but produces a different 
result due to an intermediate round; for example, things like `log(n) / log(2)` 
versus `log2(n)`, or `round(x, 2)` versus `round(100.0*x)/100.0`.

There's unfortunately no way to square the circle here that doesn't cause 
surprises in at least some corner cases.

I'm almost sure this issue is a duplicate, but I haven't found a good target 
for that duplicate yet. I'll continue searching.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Akos Kiss


Akos Kiss  added the comment:

I couldn't find any discussion in the language reference about fundamental 
differences between calls to built-in functions and user-defined functions. (I 
tried to read Sections 6.3.4. "Calls" and 8.6. "Function definitions" 
carefully.) Until now I had the impression that built-in and user-defined 
functions should be as similar as possible.

BTW, a user-defined function can also implement support for unused/excess 
keyword arguments (or arguments used on-demand): it only has to add **kwargs at 
the end of its signature. And that's exactly how the documentation specifies 
the signature of format: str.format(*args, **kwargs). That API documentation 
signals (to me at least) that this function should be called just like any 
other function that has a (*args, **kwargs) signature, be it built-in of 
user-defined.

--

___
Python tracker 

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +steve.dower

___
Python tracker 

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



[issue39703] Floor division operator and floats

2020-02-20 Thread Kostis Gourgoulias


New submission from Kostis Gourgoulias :

This was brought to my attention by a colleague, Albert B.

When considering the floor division // operator, 1//0.01 should return 100.0, 
but instead returns 99.0. My understanding is that this is because 0.01 is 
represented by 

Decimal('0.0120816681711721685132943093776702880859375')

which is greater than 0.01.

math.floor(1/0.01) correctly outputs 100. Shouldn't the two approaches provide 
the same answer?

--
components: macOS
messages: 362330
nosy: Kostis Gourgoulias, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Floor division operator and floats
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



[issue37196] Allowing arbitrary expressions in the @expression syntax

2020-02-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
resolution:  -> duplicate
status: open -> closed
superseder:  -> PEP 614: Relaxing Grammar Restrictions On Decorators

___
Python tracker 

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2020-02-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> PEP 614: Relaxing Grammar Restrictions On Decorators

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2020-02-20 Thread Valentyn Tymofieiev


Valentyn Tymofieiev  added the comment:

@gjb1002: see also https://bugs.python.org/issue38884, which demonstrates that 
concurrent imports are not thread-safe on Python 3.

--

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2020-02-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +17949
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18570

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2020-02-20 Thread Brandt Bucher


New submission from Brandt Bucher :

The attached PR implements PEP 614's revised grammar for decorators, with 
tests. In short:

decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE

becomes

decorator: '@' namedexpr_test NEWLINE

I'm marking it as DO-NOT-MERGE until the PEP is accepted, but code review is 
still appreciated. Discussion of the PEP itself should go to the Python-Dev 
thread:

https://mail.python.org/archives/list/python-...@python.org/thread/SLKFAR56RA6A533O5ZOZ7XTJ764EMB7I

--
assignee: brandtbucher
components: Interpreter Core
messages: 362328
nosy: brandtbucher, gvanrossum
priority: normal
severity: normal
status: open
title: PEP 614: Relaxing Grammar Restrictions On Decorators
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm with Eric and don't see this as a problem in practice.

Also, the kwarg handling for functions is fundamentally different because all 
arguments need to be matched.  In contrast, the kwargs for format() are only 
used on-demand:

>>> '{found}'.format(found='used', not_found='ignored')
'used'

I recommend this be left as-is.

--
nosy: +rhettinger

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

Okay, then I agree with Serhiy on the change.

And I agree that .format(**locals()) is an anti-pattern, and should use 
.format_map(locals()) instead. Not that it's related directly to this issue, I 
just like to point it out where I can.

--

___
Python tracker 

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Stefan Krah


New submission from Stefan Krah :

There is no status report, no details link and manually committing is 
prohibited:

https://github.com/python/cpython/pull/18569

--

___
Python tracker 

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



[issue39701] Azure Pipelines PR broken

2020-02-20 Thread Stefan Krah


Change by Stefan Krah :


--
nosy: skrah
priority: normal
severity: normal
status: open
title: Azure Pipelines PR  broken

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2020-02-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

Why "sys.python_libdir"?  Isn't that too public? A lot of similar path-related 
info is in sysconfig; why shouldn't it be there?
How does "sys.python_libdir" work on other platforms?

--

___
Python tracker 

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



[issue39692] Subprocess using list vs string

2020-02-20 Thread Jonny Weese


Jonny Weese  added the comment:

I believe this behavior is expected (at least in posix-land).

Lib/subprocess.py L1702 shows that whenever shell=True, the args that are 
constructed are [unix_shell, "-c"] + args.

And so we can reproduce your behavior just using a regular shell. (This is 
Darwin but with a recent bash from homebrew):

$ bash -c 'exit 1'  # like subprocess string case
$ echo $?
1
$ bash -c exit 1  # like subprocess list case (note args are separated)
$ echo $?
0

--
nosy: +jweese

___
Python tracker 

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



[issue39700] asyncio.selector_events._SelectorTransport: Add logging when sock.getpeername() fails

2020-02-20 Thread David


Change by David :


--
keywords: +patch
Added file: 
https://bugs.python.org/file48900/log-peername-and-sockname-errors.patch

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Akos Kiss


Akos Kiss  added the comment:

Re: Eric

I had a code where `'sometemplate'.format()` got a dictionary from outside (as 
a parameter, not from `locals()`), and that dictionary had `None` as a key. 
Actually, I wasn't even aware of that `None` key until I tried to execute the 
same code in PyPy where it failed with a `TypeError`. That's when I started to 
dig down to the root of the incompatibility.

Now, my code has a workaround to have an `if key is not None` filter in the 
comprehension that constructs the dict. (I'm not sure whether it can be called 
a workaround, since this is how it should have been written in the first place. 
It turns out I was just (ab)using an implementation detail / deviation.)

So much about real-world use cases.

There is one more use case that comes to my mind, but it is admittedly 
theoretical (for now, at least). If I ever wanted to patch/wrap/mock 
`str.format` then the wrapped version would behave differently from the 
built-in version (throw an error when the original does not). But this is 
hypothetical at the moment because I "can't set attributes of 
built-in/extension type 'str'" and don't have the time to experiment with 
complex mocking/patching/wrapping approaches.

--

___
Python tracker 

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



[issue39698] asyncio.sleep() does not adhere to time.sleep() behavior for negative numbers

2020-02-20 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The ship has sailed, this change breaks a lot of existing code without a strong 
reason.
I recall very many cases in third-party libraries and commercial applications 
where a negative argument for asyncio.sleep() is processed as asyncio.sleep(0) 
without failure.

--

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See similar issue for SimpleNamespace: https://bugs.python.org/issue31655.

We should add a similar check in str.format(). Accepting a non-string keys is 
an implementation detail. There is no guarantee that it works in other 
implementations.

It should not hit performance, because the kwargs dict is usually small, the 
check is cheap, and formatting itself can be expensive. For the case when you 
need to pass a huge dict and use only few items from it, you can use 
str.format_map().

--

___
Python tracker 

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



[issue39699] Ubuntu Github action not fully running build process

2020-02-20 Thread Steve Dower


Steve Dower  added the comment:

46s seems okay to me, especially since the 23s for autoconf is separate.

Try introducing a warning/error into the source code and see if it breaks.

--

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

Is this causing some practical problem? I can't think of any way to reference 
non-string kwargs in a format string, but maybe I'm not being creative enough. 
And if there is such a way, then changing this wouldn't be backward compatible.

--

___
Python tracker 

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



[issue39700] asyncio.selector_events._SelectorTransport: Add logging when sock.getpeername() fails

2020-02-20 Thread David


New submission from David :

`sock.getpeername` can fail for multiple reasons (see 
https://pubs.opengroup.org/onlinepubs/7908799/xns/getpeername.html) but in  
`asyncio.selector_events._SelectorTransport` it's try/excepted without any 
logging of the error:

```
if 'peername' not in self._extra:
try:
self._extra['peername'] = sock.getpeername()
except socket.error:
self._extra['peername'] = None
```

This makes it very difficult to debug. Would it be OK if I added here a log 
with information on the error?

Thanks!

--
components: asyncio
messages: 362317
nosy: asvetlov, dsternlicht, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.selector_events._SelectorTransport: Add logging when 
sock.getpeername() fails
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



[issue39699] Ubuntu Github action not fully running build process

2020-02-20 Thread Ammar Askar


New submission from Ammar Askar :

I think the Github action for building CPython on Ubuntu is accidentally 
caching the built Python files.

If we take a look at: https://github.com/python/cpython/runs/455936632#step:7:1
and
https://github.com/python/cpython/pull/18567/checks?check_run_id=457662461#step:8:1

It seems like it's running way too fast (and producing too little output) to 
actually be building all of CPython.

Adding Steve who originally authored the action to the nosy list to see if they 
might have any insight.

--
components: Build
messages: 362316
nosy: ammar2, steve.dower
priority: normal
severity: normal
status: open
title: Ubuntu Github action not fully running build process
type: behavior

___
Python tracker 

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



[issue39697] Failed to build with --with-cxx-main=g++-9.2.0

2020-02-20 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

See also https://bugs.python.org/issue23644

--
nosy: +vstinner, xtreak

___
Python tracker 

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



[issue39698] asyncio.sleep() does not adhere to time.sleep() behavior for negative numbers

2020-02-20 Thread Marco Sulla


New submission from Marco Sulla :

Python 3.9.0a3+ (heads/master-dirty:f2ee21d858, Feb 19 2020, 23:19:22) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.sleep(-1)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: sleep length must be non-negative
>>> import asyncio
>>> async def f():
... await asyncio.sleep(-1)
... print("no exception")
... 
>>> asyncio.run(f())
no exception

I think that also `asyncio.sleep()` should raise `ValueError` if the argument 
is less than zero.

--
components: asyncio
messages: 362314
nosy: Marco Sulla, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.sleep() does not adhere to time.sleep() behavior for negative 
numbers
versions: Python 3.9

___
Python tracker 

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



[issue39697] Failed to build with --with-cxx-main=g++-9.2.0

2020-02-20 Thread Marco Sulla

New submission from Marco Sulla :

I tried to compile Python 3.9 with:


CC=gcc-9.2.0  ./configure --enable-optimizations --with-lto 
--with-cxx-main=g++-9.2.0
make -j 2

I got this error:

g++-9.2.0 -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall
-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 
-Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden -fprofile-generate -I./Include/internal  -I. -I./Include
-DPy_BUILD_CORE -o Programs/_testembed.o ./Programs/_testembed.c
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ 
is not valid for C++
cc1plus: warning: command line option ‘-std=c99’ is valid for C/ObjC but not 
for C++
sed -e "s,@EXENAME@,/usr/local/bin/python3.9," < ./Misc/python-config.in 
>python-config.py
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh 
>python-config
gcc-9.2.0 -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g 
-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden -fprofile-generate -I./Include/internal  -I. -I./Include
-DPy_BUILD_CORE \
  -DGITVERSION="\"`LC_ALL=C git --git-dir ./.git rev-parse --short HEAD`\"" 
\
  -DGITTAG="\"`LC_ALL=C git --git-dir ./.git describe --all --always 
--dirty`\"" \
  -DGITBRANCH="\"`LC_ALL=C git --git-dir ./.git name-rev --name-only 
HEAD`\"" \
  -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
In file included from ./Include/internal/pycore_atomic.h:15,
 from ./Include/internal/pycore_gil.h:11,
 from ./Include/internal/pycore_pystate.h:11,
 from ./Programs/_testembed.c:10:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/stdatomic.h:40:9: error: 
‘_Atomic’ does not name a type

I suppose simply `Programs/_testembed.c` is a C source file and must not be 
compiled with g++

PS: as a workaround, `--with-cxx-main=gcc-9.2.0` works, but probably it's not 
optimal.

--
components: Build
messages: 362313
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: Failed to build with --with-cxx-main=g++-9.2.0
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39696] Failed to build _ssl module, but libraries was installed

2020-02-20 Thread Ammar Askar


Ammar Askar  added the comment:

As pointed out in your other issue:

https://devguide.python.org/setup/#unix

> If you decide to Install dependencies, you will need to re-run both configure 
> and make.

--
nosy: +ammar2
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



[issue39696] Failed to build _ssl module, but libraries was installed

2020-02-20 Thread Marco Sulla


New submission from Marco Sulla :

Similarly to enhancement request #39695, I missed to install the debian package 
with the include files for SSL, before compiling Python 3.9.

After installed it, `make` continued to not find the libraries and skipped the 
creation of module _ssl.

Searching on internet, I found that doing:

make clean
./configure etc
make

works.

Maybe the SSL library check is done only at configure phase?

--
components: Build
messages: 362311
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: Failed to build _ssl module, but libraries was installed
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39695] Failed to build _uuid module, but libraries was installed

2020-02-20 Thread Ammar Askar


Ammar Askar  added the comment:

Is this still a problem after you run configure again?

As pointed out in https://devguide.python.org/setup/#unix

> If you decide to Install dependencies, you will need to re-run both configure 
> and make.

--
nosy: +ammar2

___
Python tracker 

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



[issue39695] Failed to build _uuid module, but libraries was installed

2020-02-20 Thread Marco Sulla


New submission from Marco Sulla :

When I first done `make` to compile Python 3.9, I did not installed some debian 
development packages, like `uuid-dev`. So `_uuid` module was not built.

After installed the debian package I re-run `make`, but it failed to build 
`_uuid` module. I had to edit manually `Modules/_uuidmodule.c` and remove all 
the `#ifdef` directives and leave only `#include `

Maybe `HAVE_UUID_UUID_H` and `HAVE_UUID_H` are created at `configure` phase 
only?

--
components: Build
messages: 362309
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: Failed to build _uuid module, but libraries was installed
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue31542] pth files in site-packages of venvs are executed twice

2020-02-20 Thread sinoroc


sinoroc  added the comment:

https://stackoverflow.com/a/60169657/11138259

--
nosy: +sinoroc

___
Python tracker 

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



  1   2   >