[issue39344] Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found

2020-01-15 Thread Ajaya


Ajaya  added the comment:

Thanks all for your quick response. That issue has been resolved by
solution given by  Steve Dower and  Christian Heimes

On Thu, Jan 16, 2020 at 2:41 AM Steve Dower  wrote:

>
> Steve Dower  added the comment:
>
> More precisely, make sure the libcrypto-1_1.dll and libssl-1_1.dll files
> are in the same directory as your _ssl.pyd, but _not_ inside your
> Python38.zip file (zip import does not support native modules, they have to
> be outside of the zip).
>
> --
>
> ___
> Python tracker 
> 
> ___
>

-- 
Regards:
Ajaya Kumar Sutar
Product Engineer
Siemens Industry Software (India) Private Limited
Tower C, Panchashil Business Park,
Cummins India Office Campus,
Survey No. 21, Balewadi,
Pune, India  411045
Tel: +91-20-39182839(O)
09764180686(P)

--
title: ImportError: DLL load failed while importing _ssl: The specified module 
could not be found." -> Getting error while importing ssl " import _ssl # if we 
can't import it, let the error propagate ImportError: DLL load failed while 
importing _ssl: The specified module could not be found."

___
Python tracker 

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



[issue39349] Add "cancel" parameter to concurrent.futures.Executor.shutdown()

2020-01-15 Thread Kyle Stanley


New submission from Kyle Stanley :

This feature enhancement issue is based on the following python-ideas thread: 
https://mail.python.org/archives/list/python-id...@python.org/thread/ZSUIFN5GTDO56H6LLOPXOLQK7EQQZJHJ/

In summary, the main suggestion was to implement a new parameter called 
"cancel" (some bikeshedding over the name is welcome, I was thinking 
"cancel_futures" might be another option) for Executor.shutdown(), that would 
be added to both ThreadPoolExecutor and ProcessPoolExecutor. When set to True, 
this parameter would cancel all pending futures that were scheduled to the 
executor just after setting self._shutdown.

In order to build some experience in working with the internals of the 
executors (particularly for implementing native pools in asyncio in the 
future), I plan on working on this issue; assuming Antoine and/or Brian are +1 
on it. Guido seemed to approve of the idea.

The implementation in ThreadPoolExecutor should be fairly straightforward, as 
it would use much of the same logic that's in the private method 
_initializer_failed() 
(https://github.com/python/cpython/blob/fad8b5674c66d9e00bb788e30adddb0c256c787b/Lib/concurrent/futures/thread.py#L205-L216).
 Minus the setting of self._broken, and cancelling each of the work_items 
(pending futures) instead of setting the BrokenThreadPool exception.

For ProcessPoolExecutor, I'll likely have to spend some more time looking into 
the implementation details of it to figure out how the cancellation will work. 
IIUC, it would involve adding some additional logic in 
_queue_management_worker(), the function which is used by the queue management 
thread to communicate between the main process and the worker processes spawned 
by ProcessPoolExecutor.

Specifically, in the "if shutting_down()" block 
(https://github.com/python/cpython/blob/fad8b5674c66d9e00bb788e30adddb0c256c787b/Lib/concurrent/futures/process.py#L432-L446),
 I think we could add an additional conditional check to see if 
self._cancel_pending_work_items is true (new internal flag set during 
executor.shutdown() if *cancel* is true, just after setting 
"self._shutdown_thread = True"). In this block, it would iterate through the 
pending work items, and cancel their associated future. Here's a rough example 
of what I have in mind:

```
if shutting_down():
try:
# Flag the executor as shutting down as early as possible if it
# is not gc-ed yet.
if executor is not None:
executor._shutdown_thread = True
+  if executor._cancel_pending_work_items:
+  # We only care about the values in the dict, which are
+  # the actual work items.
+  for work_item in pending_work_items.values():
+  work_item.future.cancel()
# Since no new work items can be added, it is safe to shutdown
# this thread if there are no pending work items.
if not pending_work_items:
shutdown_worker()
return
except Full:
# This is not a problem: we will eventually be woken up (in
# result_queue.get()) and be able to send a sentinel again.
pass
```

Would something along the lines of the above be a potentially viable method of 
implementing the *cancel* parameter for ProcessPoolExecutor.shutdown()? The 
main downside to this implementation is that it can't cancel anything that is 
already running (pushed from pending_work_items to call_queue). But from my 
understanding, there isn't a viable means of cancelling anything in the call 
queue; at that point it's too late.

Anyways, I'll work on the ThreadPoolExecutor implementation in the meantime. As 
mentioned previously, that one should be more straightforward. After getting it 
working, I'll open a PR for just ThreadPoolExecutor, and then work on 
ProcessPoolExecutor in another PR after receiving some feedback on the above 
idea.

--
assignee: aeros
messages: 360093
nosy: aeros, bquinlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Add "cancel" parameter to concurrent.futures.Executor.shutdown()
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



[issue38649] tkinter messagebox is sloppy

2020-01-15 Thread David Lambert


David Lambert  added the comment:

Sometimes I say nice things about python.

https://www.quora.com/Is-Python-fast-yet/answer/David-Lambert-86?__nsrc__=4&__snid3__=6376944631

On 10/31/19 1:14 PM, Brett Cannon wrote:
> Brett Cannon  added the comment:
>
> Please note that calling something "sloppy" and that somehow its development 
> was done in some "carelessness" fashion to the point of being "egregious" is 
> not motivating to others to try and help. Trying to support all of this code 
> for free in one's spare time is not easy, so I would ask you try to be more 
> understanding and nicer in your comments.
>
> --
> nosy: +brett.cannon
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks for the opinion.
Sounds reasonable!

--

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread miss-islington


miss-islington  added the comment:


New changeset 19bd3a18626b504dc92abb44019cad600c7ef221 by Miss Islington (bot) 
in branch '3.8':
bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)
https://github.com/python/cpython/commit/19bd3a18626b504dc92abb44019cad600c7ef221


--

___
Python tracker 

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



[issue39344] ImportError: DLL load failed while importing _ssl: The specified module could not be found."

2020-01-15 Thread ppperry


Change by ppperry :


--
title: Getting error while importing ssl " import _ssl # if we 
can't import it, let the error propagate ImportError: DLL load failed while 
importing _ssl: The specified module could not be found." -> ImportError: DLL 
load failed while importing _ssl: The specified module could not be found."

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread miss-islington


miss-islington  added the comment:


New changeset 970188c2d792133e2273924a987e0542659a676f by Miss Islington (bot) 
in branch '3.7':
bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)
https://github.com/python/cpython/commit/970188c2d792133e2273924a987e0542659a676f


--

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread Mariatta


Change by Mariatta :


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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread Mariatta


Mariatta  added the comment:

Thanks!

--
nosy: +Mariatta

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17414
pull_request: https://github.com/python/cpython/pull/18019

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17415
pull_request: https://github.com/python/cpython/pull/18020

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread miss-islington


miss-islington  added the comment:


New changeset fad8b5674c66d9e00bb788e30adddb0c256c787b by Miss Islington (bot) 
(Oz N Tiram) in branch 'master':
bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)
https://github.com/python/cpython/commit/fad8b5674c66d9e00bb788e30adddb0c256c787b


--
nosy: +miss-islington

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread Oz Tiram


Change by Oz Tiram :


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

___
Python tracker 

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



[issue39348] wrong rst syntax in socket.rst

2020-01-15 Thread Oz Tiram


New submission from Oz Tiram :

The code block for the isn't hightlighted:



Changed in version 3.7: When SOCK_NONBLOCK or SOCK_CLOEXEC bit flags are 
applied to type they are cleared, and socket.type will not reflect them. They 
are still passed to the underlying system socket() call. Therefore::

sock = socket.socket(

...

This is because the double colon is directly after the word Therefore.


This fix is very simple:

   :attr:`socket.type` will not reflect them.  They are still passed
-  to the underlying system `socket()` call.  Therefore::
+  to the underlying system `socket()` call.  Therefore,
+
+  ::
 
   sock = socket.socket(
   socket.AF_INET,
   ...


I have prepared a PR for this.

--
assignee: docs@python
components: Documentation
messages: 360086
nosy: Oz.Tiram, docs@python
priority: normal
severity: normal
status: open
title: wrong rst syntax in socket.rst
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue37958] Adding get_profile_dict to pstats

2020-01-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks Daniel!

--
nosy: +gregory.p.smith
resolution:  -> fixed
stage:  -> commit review
status: open -> closed

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread Albert Zeyer


Albert Zeyer  added the comment:

> I think it is worth pointing out that the semantics of 
>
> f = ``open(fd, closefd=True)`` 
>
> are broken (IMHO) because an exception can result in an unreferenced file
> object that has taken over reponsibility for closing the fd, but it can
> also fail without creating the file object.

I thought that if this raises a (normal) exception, it always means that it did 
not have overtaken the `fd`, i.e. never results in an unreferenced file object 
which has taken ownership of `fd`.

It this is not true right now, you are right that this is problematic. But this 
should be simple to fix on the CPython side, right? I.e. to make sure whenever 
some exception is raised here, even if some temporary file object already was 
constructed, it will not close `fd`. It should be consistent in this behavior, 
otherwise indeed, the semantics are broken.

--

___
Python tracker 

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



[issue37958] Adding get_profile_dict to pstats

2020-01-15 Thread miss-islington


miss-islington  added the comment:


New changeset 01602ae40321ecdb375ee6d44eaeac3255857879 by Miss Islington (bot) 
(Daniel Olshansky) in branch 'master':
bpo-37958: Adding get_profile_dict to pstats (GH-15495)
https://github.com/python/cpython/commit/01602ae40321ecdb375ee6d44eaeac3255857879


--
nosy: +miss-islington

___
Python tracker 

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



[issue39310] Add math.ulp(x): unit in the last place

2020-01-15 Thread Tim Peters


Tim Peters  added the comment:

`ulp()` is the right name:  universally understood by those who know how to use 
it, and easy to find exhaustive web explanations for those who don't.

In a different context, spelling out some variant of 
Hypertext_Transfer_Protocol would be as wrong-headed to avoid the "cryptic" 
http.

--

___
Python tracker 

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



[issue39274] Conversion from fractions.Fraction to bool

2020-01-15 Thread Sebastian Berg


Change by Sebastian Berg :


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

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread rekcartgubnohtyp


Change by rekcartgubnohtyp :


--
nosy: +rekcartgubnohtyp

___
Python tracker 

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



[issue14014] codecs.StreamWriter.reset contract not fulfilled

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> 3rd party: IMHO, if somebody relies on the error message, not error type, I 
> think that the code pattern is bad usage

I don't think that we can be pedantic on how projects should be tested.

IMHO it's too risky. I rejected backports. The risk of regression in a *minor* 
release is just too high. Such "cleanup" change is better fitted for a new 3.x 
major release.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> Serhiy: any thoughts about what version should be targeted for eventual 
> removal of the functionality deprecated in this PR? 3.10?

IMHO it should be done at the *very beginning* of a release cycle. Python 3.9.0 
alpha 1 *and* alpha 2 versions have already been released. It's too late for 
the 3.9 cycle.

I'm fine with 3.10.

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> Thank you, Victor, for the comments.  I will update PR 17782.

Since it's a very different approach (modify C vs suppress the false alarm), I 
suggest instead to open a new different PR.

--

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

I modified ceval.c to accept dict subclasses when I was working on PEP 416:
https://www.python.org/dev/peps/pep-0416/

This PEP motivation was to implement a sandbox. The PEP was rejected. Later, I 
closed my pysandbox beause it was "broken by design":
https://lwn.net/Articles/574215/

Paul Sokolovsky wrote in bpo-36220 than his idea is also to implement a sandbox:
https://bugs.python.org/issue36220#msg359046

IMHO we should reject dict subclasses to make Python (especially ceval.c) more 
efficient. The global type must be checked at every place where it's possible 
to specify or override globals. Like the exec() function.

--

___
Python tracker 

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



[issue39274] Conversion from fractions.Fraction to bool

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

Does someone want to propose a PR to modify fractions.Fraction.__bool__() to 
use "return bool(a._numerator)"?

--
keywords: +newcomer friendly
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



[issue39123] PyThread_xxx() not available when using limited API

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue36746] Create test for fcntl.lockf()

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

PR #17010 of bpo-22367 added tests for fcntl.lockf(). I close this PR as a 
duplicate of bpo-22367. Thanks @nanjekyejoannah anyway!

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Add open_file_descriptor parameter to fcntl.lockf() (use the 
new F_OFD_SETLK flag)

___
Python tracker 

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



[issue19083] IDNA prefix should be case insensitive

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue24416] Have date.isocalendar() return a structseq instance

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue37224] test__xxsubinterpreters fails randomly

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue35665] Function ssl.create_default_context raises exception on Windows 10 when called with ssl.Purpose.SERVER_AUTH) attribute

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
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-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> The changes required to successfully do this backport are many and affect 
> critical areas. I am not in a hurry to do this. If anyone else wants to take 
> this up quickly, please do.

Do you mean that there is a risk that the backport introduces a regression in 
another part of the code? If yes, I would suggest to not backport the change to 
*stable* branches.

People survived with bug. Do you really *have to* backport the fix?

Note: this issue is closed. If you consider to backport it, I suggest to reopen 
the issue.

--

___
Python tracker 

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



[issue39344] Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found

2020-01-15 Thread Steve Dower


Steve Dower  added the comment:

More precisely, make sure the libcrypto-1_1.dll and libssl-1_1.dll files are in 
the same directory as your _ssl.pyd, but _not_ inside your Python38.zip file 
(zip import does not support native modules, they have to be outside of the 
zip).

--

___
Python tracker 

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



[issue39347] Use of argument clinic like parsing and `METH_FASTCALL` support in extension modules

2020-01-15 Thread Sebastian Berg


New submission from Sebastian Berg :

This is mainly an information request, so sorry if its a bit besides the point 
(I do not mind if you just close it). But it seemed a bit too specific to get 
answers in most places...
In Python you use argument clinic, which supports `METH_FASTCALL`, that seems 
pretty awesome.

For extension modules, I am not sure that argument clinic is a straight forward 
choice, since it probably generates code specific to a single Python version 
and also using, while we need to support multiple versions (including versions 
that do not support `METH_FASTCALL`.

So the question would be if there is some idea for providing such C-API, or for 
example exposing `_PyArg_UnpackKeywords` (which is at the heart of kwarg 
parsing).

My use-case is that some NumPy functions do have a nice speedup when using 
`METH_FASTCALL` and better argument clinic style faster arg-parsing. Which is 
why, looking at these things, I practically reimplemented a slightly dumbed 
down version of `PyArg_ParseTupleAndKeywords` working much like argument clinic 
(except less smart and only using macros and no code generation).

That seems viable, but also feels a bit wrong, so I am curious if there may be 
a better solution or whether it would be plausible to expose 
`_PyArg_UnpackKeywords` to reduce code duplication. (although I suppose due to 
old python version support that would effectively take years)

For completeness, my code in question is here: 
https://github.com/numpy/numpy/pull/15269 with the actual usage pattern being:

static PyObject *my_method(PyObject *self, NPY_ARGUMENTS_DEF)
{
NPY_PREPARE_ARGPARSER;
PyObject *argument1;
int argument2 = -1;
if (!npy_parse_arguments("method", 1, -1, NPY_ARGUMENTS_PASS),
"argument1", NULL, &argument1,
"argument2", &PyArray_PythonPyIntFromInt, &argument2,
NULL, NULL, NULL) {
return NULL;
}
}

--
components: Argument Clinic
messages: 360073
nosy: larry, seberg
priority: normal
severity: normal
status: open
title: Use of argument clinic like parsing and `METH_FASTCALL` support in 
extension modules
type: enhancement

___
Python tracker 

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



[issue39346] gzip module only supports half of possible read/write scenarios

2020-01-15 Thread Drew DeVault


New submission from Drew DeVault :

A gzip file can have uncompressed data written to it, writing compressed data 
to the underlying file. It can also have uncompressed data read from it, 
reading compressed data from the underlying file.

However, it does not support reading compressed data from an underlying 
uncompressed file, nor writing compressed data to an underlying uncompressed 
file.

This makes it impossible to, for example, obtain an arbitrary file-like object 
and produce another file-like object which transparently compresses data read 
from the first.

--
components: Library (Lib)
messages: 360072
nosy: ddevault
priority: normal
severity: normal
status: open
title: gzip module only supports half of possible read/write scenarios
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



[issue39346] gzip module only supports half of possible read/write scenarios

2020-01-15 Thread Drew DeVault


Change by Drew DeVault :


--
type:  -> enhancement

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread Paul Ollis


Paul Ollis  added the comment:

I think it is worth pointing out that the semantics of 

f = ``open(fd, closefd=True)`` 

are broken (IMHO) because an exception can result in an unreferenced file
object that has taken over reponsibility for closing the fd, but it can
also fail without creating the file object.

Therefore it should be considered a bad idea to use open in this way. So
NamedTemporaryFile should take responsibility for closing the fd; i.e. it
should used closefd=False.

I would suggest that NamedTemporaryFile's code should be:

try:
file = _io.open(fd, mode, buffering=buffering, closefd=False,
newline=newline, encoding=encoding, errors=errors)
return _TemporaryFileWrapper(file, name, delete)
except BaseException:
_os.close(fd)
try:
_os.unlink(name)
except OSError:
pass  # On windows the file will already be deleted.
raise

And '_os.close(self.file.fileno())' should be added after each of the two calls
to 'self.file.close()' in _TemporaryFileCloser.

Some notes on the design choices here.

1. The exception handling performs the close *before* the unlink because:

   - That is the normal order that people expect.
   - It is most important that the file is closed. We cannot rule out the 
 possibility of the unlink raising an exception, which could leak the fd.

2. BaseException is caught because we should not leak a file descriptor for
   KeyboardInterrupt or any other exception.

3. It is generally good practice to protect os.unlink with a try ... except
   OSError. So I think this is an appropriate way to prevent the Windows
   specific error. 

   It will also suppress some other, rare but possible, errors. I think that
   this is legitimate behaviour, but it should be documented.

--
nosy: +paul_ollis

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2020-01-15 Thread Carlton Gibson


Change by Carlton Gibson :


--
nosy: +carltongibson

___
Python tracker 

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



[issue39345] Py_Initialize Hangs on Windows 10

2020-01-15 Thread Darren Hamilton


New submission from Darren Hamilton :

This is related to https://bugs.python.org/issue17797, which is closed.

Using Python 3.7.4, Windows 10.0.18362, Visual Studio 2017 and running as a C 
Application.  Py_Initialize() eventually calls is_valid_fd with STDIN.  The 
behavior appears to cause both dup() and fstat() to hang indefinitely (using 
RELEASE MSVCRT DLLs, it works correctly using MSVCRT Debug DLLs).  The call 
stack shows Windows is waiting for some Windows Event.  The recommended patch 
in issue17797 will not work.

is_valid_fd appears to want to read the 'input' using a file descriptor.  since 
both dup and fstat hang, I realized that isatty() would indicate if the file 
descriptor is valid and works for any predefined FD descriptor(STDIN-0, 
STDOUT-1, STDERR-2).

#if defined(MS_WINDOWS)
struct stat buf;
if (fd >= fileno(stdin) && fd <= fileno(stderr)) {
return (_isatty(fd) == 0 && errno == EBADF) ? 0 : 1;
}
else if (fstat(fd, &buf) < 0 && (errno == EBADF || errno == ENOENT))
return 0;
return 1;
#else

--
components: Library (Lib), Windows
messages: 360070
nosy: dhamilton, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Py_Initialize Hangs on Windows 10
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



[issue38884] __import__ is not thread-safe on Python 3

2020-01-15 Thread Brett Cannon


Brett Cannon  added the comment:

@valentyn just assume it's good enough unless some asks otherwise. People are 
probably too busy right now to be looking at this and so you might be waiting a 
while for a more definitive answer.

--

___
Python tracker 

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



[issue38361] syslog: Default "ident" in syslog.openlog() shouldn't contain slash

2020-01-15 Thread Brandt Bucher


Change by Brandt Bucher :


--
components: +Library (Lib) -Extension Modules
nosy: +brandtbucher
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue38884] __import__ is not thread-safe on Python 3

2020-01-15 Thread Valentyn Tymofieiev


Valentyn Tymofieiev  added the comment:

Just checking - is issue38884.zip an acceptable repro for this issue?
Thanks.

--

___
Python tracker 

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



[issue38593] Python 3.7 does not catch infinite recursion for some values of sys.getrecursionlimit()

2020-01-15 Thread Valentyn Tymofieiev


Valentyn Tymofieiev  added the comment:

The stack is fairly deep here, and I didn't have time to filter out the 
smallest repro. 

Since this check is best effort, and not reproducible on the 3.8, perhaps this 
is a low-priority issue.

Thanks.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue39305] Merge nntplib._NNTPBase and nntplib.NNTP

2020-01-15 Thread Luciana


Luciana  added the comment:

Thank you, I am creating the patch now and will submit it later today!

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

While there was no strong agreement on my change, Nathaniel and Giampaolo said 
that it should not harm to merge it :-) So I merged my change.

It has been said multiple times: my change doesn't fully close the race 
condition. It only reduces the risk that it happens. I rephrased my change to 
mention that there is still room for the race condition and that polling only 
*reduces* the risk, it doesn't fully fix the race condition.

--

Changing locking can help. But I'm not sure that it covers *all* cases. For 
example, what if another function calls os.waitpid() directly for whatever 
reason and the process completed? The pid recycling issue can also happen in 
this case, no?

Linux pidfd really fix the issue. If someone wants to enhance subprocess to use 
the new os.pidfd_open(), I suggest to open a separated issue.

Another approach is to emulate pidfd in userspace. Giampaolo explains that he 
also compares the process creation time for that (msg356571). I'm not excited 
to workaround OS issue this way. It requires to write platform specific 
get_create_time() code. I would prefer to reuse what the OS provides when 
available: Linux pidfd.

--

This issue title is quite explicit on purpose: "subprocess.Popen.send_signal() 
should poll the process". I now close this issue: send_signal() does now poll 
:-)

Because there is no *strong* consensus on my change, I decided to not backport 
it to stable branches 3.7 and 3.8.

Thanks everyone for this very interesting discussion!

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e85a305503bf83c5a8ffb3a988dfe7b67461cbee by Victor Stinner in 
branch 'master':
bpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984)
https://github.com/python/cpython/commit/e85a305503bf83c5a8ffb3a988dfe7b67461cbee


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ed154c387efc5f978ec97900ec9e0ec6631d5498 by Victor Stinner (Hai 
Shi) in branch 'master':
bpo-1635741: Port _json extension module to multiphase initialization (PEP 489) 
(GH-17835)
https://github.com/python/cpython/commit/ed154c387efc5f978ec97900ec9e0ec6631d5498


--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Ned Deily


Ned Deily  added the comment:

I should have checked first.  The move was completed ahead of schedule and it's 
now back in service.  The tests should no loner fail.

https://lars.ingebrigtsen.no/2020/01/15/news-gmane-org-is-now-news-gmane-io/

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> FYI, gmane.io is down for a server move today.  It should be back in service 
> by 2100 GMT.

I propose to do nothing and wait. Travis CI is not currently preventing to 
merge a PR.

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Ned Deily


Ned Deily  added the comment:

FYI, gmane.io is down for a server move today.  It should be back in service by 
2100 GMT.

--
nosy: +ned.deily

___
Python tracker 

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



[issue35058] Unable to Install Python on Windows

2020-01-15 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue39344] Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found

2020-01-15 Thread Christian Heimes


Christian Heimes  added the comment:

It sounds like Python cannot load the OpenSSL DLLs or a dependency of the 
OpenSSL DLLs. IIRC the libraries are called libssl.dll and libcrypto.dll. The 
files must be in the current DLL search path.

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue39344] Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found

2020-01-15 Thread SilentGhost


Change by SilentGhost :


--
assignee:  -> christian.heimes
components: +SSL
nosy: +christian.heimes
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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

But for now on, IMHO skip is better choice.

--

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

FYI this change broke librepo which calls PyLong_FromLong() without holding the 
GIL. In Python 3.8, "it works". In Python 3.9, it does crash: get_small_int() 
gets a NULL tstate and then dereference a NULL pointer.

librepo bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1788918

IMHO it's a bug in librepo: the GIL must be held to use Python C API.

--

___
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-01-15 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

The changes required to successfully do this backport are many and affect 
critical areas. I am not in a hurry to do this. If anyone else wants to take 
this up quickly, please do.

--

___
Python tracker 

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



[issue39344] Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found

2020-01-15 Thread Ajaya


New submission from Ajaya :

We have built python3.7.5 and python3.8.1 source code in windows 10 machine. I 
have created an embedded interptreter where i am trying to "import ssl" but it 
is failing with error "Journal execution results for 
D:\workdir\PR\9616145\9616145\journal.py...
Syntax errors:
Line 98: Traceback (most recent call last):
  File "D:\workdir\PR\9616145\9616145\journal.py", line 1, in 
import ssl
  File "", line 259, in load_module
  File 
"D:\workdir\PR\PRUnits\PythonIssuefix381\wntx64\kits\nxbin\python\Python38.zip\ssl.py",
 line 98, in 
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed while importing _ssl: The specified module could 
not be found."

This error was coming from python 3.7.4 and it was working fine till python 
3.7.3. 

There is also one work around if i replaced _ssl.pyd with python3.7.3 _ssl.pyd 
it is working fine. I also found python 3.7.3 is using openssl-1.1.1c where as 
python3.7.5 and python3.8.1 is using openssl- 1.1.1d.

I have also checked in using python 3.7.5  installing  and import ssl is 
working fine. I have also checked that _ssl.pyd in installer  and _ssl.pyd is 
created by manually built size is different.

I am not getting the exact root cause what has happened. Could you please me i 
have already stucked  and not able to work.

--
components: Windows
files: journal.py
messages: 360055
nosy: Ajaya, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Getting error while importing ssl " import _ssl # if we 
can't import it, let the error propagate ImportError: DLL load failed while 
importing _ssl: The specified module could not be found."
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48846/journal.py

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

s = nntplib.NNTP('nntp.perl.org')
s = nntplib.NNTP('news.mozilla.org')

I 've checked a few servers list to use.
But I don't know that they are proper to use.

--

___
Python tracker 

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



[issue35058] Unable to Install Python on Windows

2020-01-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue35058] Unable to Install Python on Windows

2020-01-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> Is this 2.7 only issue? I think it is too late.

I vaguely recall that Christian Heimes wrote something about Python 3 in a 
private email, but I cannot find this email anymore :-p In case of doubt, I 
marked Python 3 as affected as well.

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

Same for news.gmane.org

>>> s = nntplib.NNTP('news.gmane.org')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/corona10/oss/cpython/Lib/nntplib.py", line 1045, in __init__
self.sock = self._create_socket(timeout)
  File "/Users/corona10/oss/cpython/Lib/nntplib.py", line 1062, in 
_create_socket
return socket.create_connection((self.host, self.port), timeout)
  File "/Users/corona10/oss/cpython/Lib/socket.py", line 843, in 
create_connection
raise err
  File "/Users/corona10/oss/cpython/Lib/socket.py", line 831, in 
create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

--

___
Python tracker 

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



[issue39104] ProcessPoolExecutor hangs on shutdown nowait with pickling failure

2020-01-15 Thread Patrick Buxton


Patrick Buxton  added the comment:

Added core developer to get some feedback

--
nosy: +patbuxton, pitrou

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue35665] Function ssl.create_default_context raises exception on Windows 10 when called with ssl.Purpose.SERVER_AUTH) attribute

2020-01-15 Thread Pedja


Pedja  added the comment:

This is still an issue. Serious one. People are unable to just remove this 
certificate as it is needed for everyday use.

It is reasonable that application does not deal with invalid certificates. 
I can understand application to breaks if one tries to use invalid certificate. 

But this is not that case. Application breaks on just enumerating certificates 
even if it does not need it at all.

It is advisable for application just to skip and ignore invalid certificate 
unless it is required for application to work.

Please reconsider action on this issue to prevent application breaking when it 
is not necessary.

--
nosy: +pedja

___
Python tracker 

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



[issue39164] Add private _PyErr_GetExcInfo() function which accepts a tstate argument

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3f12ac18a407983a23d43ae785e805e773571477 by Victor Stinner in 
branch 'master':
bpo-39164: Fix compiler warning in PyErr_GetExcInfo() (GH-18010)
https://github.com/python/cpython/commit/3f12ac18a407983a23d43ae785e805e773571477


--

___
Python tracker 

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



[issue33351] Support compiling with clang-cl on Windows

2020-01-15 Thread Gisle Vanem


Gisle Vanem  added the comment:

I will add to this issue my *only* compile problem I had using clang-cl ver 9. 
It has an issue with parsing the `frame_t` structure in Modules/_tracemalloc.c:

Modules/_tracemalloc.c(64,11): error: declaration of anonymous struct must be a 
definition
  typedef struct
  ^
Modules/_tracemalloc.c(64,3): warning: typedef requires a name 
[-Wmissing-declarations]
  typedef struct
  ^~~
Modules/_tracemalloc.c(77,11): warning: #pragma pack(pop, ...) failed: stack 
empty [-Wignored-pragmas]
  #pragma pack(pop)
  ^
Modules/_tracemalloc.c(110,5): error: unknown type name 'frame_t'
frame_t frames[1];
^
--

I commented on and suggested a fix for _tracemalloc.c here:
https://github.com/python/cpython/commit/8d59eb1b66c51b2b918da9881c57d07d08df43b7#r36794938

--
nosy: +gvanem
type: enhancement -> compile error
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue39303] Refactor cmd module

2020-01-15 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Dan, thank you for your contribution.  Please see the pull request for the 
motivation behind closing this.

--
nosy: +cheryl.sabella
resolution:  -> rejected
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



[issue39340] shutil.rmtree and write protected files

2020-01-15 Thread Eryk Sun


Eryk Sun  added the comment:

I'm not certain exactly what you want Python to be doing here, but let's start 
out by clarifying some concepts.

> Reproduction method linux
> mkdir test; touch test/file.txt; chmod -w test/file.txt

Unlinking a file requires write permission to the parent directory, since 
that's what's getting directly modified. Indirectly, if it's the last link to 
the file, then the file itself gets deleted. But Unix has no delete permission 
on individual files. You may have been misled into thinking so by bash, which 
requests confirmation when unlinking a file that lacks write permission. 

That said, some Linux filesystems implement an [i]mmutable file attribute (e.g. 
chattr +i test/file.txt). Unlinking an immutable file is completely disallowed, 
so Linux requires super-user access to modify this file attribute. In practice, 
we can differentiate the two cases by the errno value. If the parent directory 
doesn't allow write access, the error is EACCES. But if the file is immutable, 
the error is EPERM. 

> Reproduction method windows
> mkdir test && type nul > test\file.txt && attrib +R test\file.txt

In Windows, delete access (actually delete/rename access, i.e. unlink/relink) 
is separate from write access.

For all filesystems, a file's share-access control trumps everything else. If 
previous opens do not share delete access, a request for delete access fails as 
a sharing violation (32).

Else if the user's access token has SeRestorePrivilege enabled, then delete 
access will be granted. Actually, the file open also has to request backup 
semantics for this privilege to apply, but the internal open used by WINAPI 
DeleteFileW does this for us.

Else if the parent directory grants delete-child access to the user or one of 
the user's enabled groups, then the user is granted delete access to the file. 

Else the discretionary access control on a file may grant or deny delete access 
-- if it's also allowed by mandatory access control. Delete access will not be 
granted if the file's mandatory label denies write-up access and the label is 
at a higher integrity level (defaults to medium) than that of the user's access 
token (defaults to medium).

Windows filesystems also support a readonly file attribute. We can open a 
readonly file for delete access, which has to be allowed because Windows allows 
renaming (relinking) a readonly file. However when we try to set a readonly 
file's delete disposition, such as via SetFileInformationByHandle: 
FileDispositionInfo, the request will fail with access denied (5). (Actually, 
at the lower-level NT API level, this case is STATUS_CANNOT_DELETE, which is 
differentiated from STATUS_ACCESS_DENIED, but the Windows API aggregates them.) 
Normally this two-step open/delete process is wrapped up in a single call such 
as DeleteFileW. However, if you're using the two-step process directly, note 
that Windows 10 has a new disposition flag to ignore the readonly attribute: 
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE.

--
nosy: +eryksun

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is this 2.7 only issue? I think it is too late.

--

___
Python tracker 

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



[issue39222] unittest.mock.Mock.parent is broken or undocumented

2020-01-15 Thread Mario Corchero


Mario Corchero  added the comment:

> My suggestion would be to add `parent` to the docs @xtreak links to as a way 
> to resolve this issue.

+1, we should probably add it on the docs of the constructor here 
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock as it 
is done for name and having a section like the on for name.

--

___
Python tracker 

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



[issue35058] Unable to Install Python on Windows

2020-01-15 Thread Amelia smith


Amelia smith  added the comment:

Steps to canon printer error b200  Fix by Canon Support .Dial Tollfree 
+1-800-570-3215 To Fix group b200 mistake, Canon Printer Error B200.
https://www.printersupport24x7.com/questions/how-to-fix-canon-printer-error-b200/

--

___
Python tracker 

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



[issue35058] Unable to Install Python on Windows

2020-01-15 Thread Amelia smith


Amelia smith  added the comment:

Steps to canon printer error b200  Fix by Canon Support. Dial Tollfree 
+1-800-570-3215 To Fix group b200 mistake, Canon Printer Error B200.
printersupport24x7.com/questions/how-to-fix-canon-printer-error-b200/

--
nosy: +ameliasmith010

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread Albert Zeyer


Albert Zeyer  added the comment:

If you anyway accept that KeyboardInterrupt can potentially leak, by just using 
`except Exception`, it would also be solved here.

--

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread Robert Xiao


Robert Xiao  added the comment:

Could this be solvable if `closefd` were a writable attribute? Then we could do

file = None
try:
file = io.open(fd, ..., closefd=False)
file.closefd = True
except:
if file and not file.closefd:
os.close(fd)
raise

I believe this should be bulletproof - a KeyboardInterrupt can happen anywhere 
in the `try` and we will not leak or double-close. Either file.closefd is set, 
in which case `file` owns the fd and will close it eventually, or file.closefd 
is not set in which case the fd needs to be manually closed, or file doesn't 
exist (exception thrown in io.open or while assigning file), in which case the 
fd still needs to be manually closed.

Of course, this can leak if a KeyboardInterrupt lands in the `except` - but 
that's not something we can meaningfully deal with. The important thing is that 
this shouldn't double-close if I analyzed it correctly.

This is a somewhat annoying pattern, though. I wonder if there's a nicer way to 
implement it so we don't end up with this kind of boilerplate everywhere.

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-15 Thread STINNER Victor


New submission from STINNER Victor :

Should we disable documentation test on nntplib? It's surprising that 
test_nntplib test on the other Travis CI jobs.

https://travis-ci.org/python/cpython/jobs/637325027

Warning, treated as error:

**

File "library/nntplib.rst", line ?, in default

Failed example:

s = NNTP('news.gmane.io')

Exception raised:

Traceback (most recent call last):

  File "/home/travis/build/python/cpython/Lib/doctest.py", line 1329, in 
__run

exec(compile(example.source, filename, "single",

  File "", line 1, in 

s = NNTP('news.gmane.io')

  File "/home/travis/build/python/cpython/Lib/nntplib.py", line 1045, in 
__init__

self.sock = self._create_socket(timeout)

  File "/home/travis/build/python/cpython/Lib/nntplib.py", line 1062, in 
_create_socket

return socket.create_connection((self.host, self.port), timeout)

  File "/home/travis/build/python/cpython/Lib/socket.py", line 843, in 
create_connection

raise err

  File "/home/travis/build/python/cpython/Lib/socket.py", line 831, in 
create_connection

sock.connect(sa)

ConnectionRefusedError: [Errno 111] Connection refused

--
components: Tests
messages: 360039
nosy: vstinner
priority: normal
severity: normal
status: open
title: Travis CI: documentation job fails in library/nntplib.rst with random 
network issue on news.gmane.io
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



[issue39342] Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl

2020-01-15 Thread Chris Burr


Change by Chris Burr :


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

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

See also some discussion on regarding this class of vulnerability : 
https://bugs.python.org/issue36260

--
nosy: +serhiy.storchaka, xtreak

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

Is this issue a duplicate of bpo-36260 "[security] CVE-2019-9674: Zip Bomb 
vulnerability" which has been closed by documenting the issue (without touching 
zipfile.py)?

The zipfile documentation now contains an explicit warning against ZIP bombs:

"""
Resources limitations

The lack of memory or disk volume would lead to decompression failed. For 
example, decompression bombs (aka ZIP bomb) apply to zipfile library that can 
cause disk volume exhaustion.
"""

https://docs.python.org/dev/library/zipfile.html#resources-limitations

Note: bpo-36462 "CVE-2019-9674 : zip bomb vulnerability in Lib/zipfile.py" was 
closed as duplicate of bpo-36260.

--

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

Amit Laish reported the exact same vulnerability to rubyzip and they released a 
fix for it, CVE-2019-16892.

--

___
Python tracker 

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



[issue39342] Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl

2020-01-15 Thread Chris Burr


Change by Chris Burr :


--
assignee:  -> christian.heimes
components: +SSL -Library (Lib)
nosy: +christian.heimes

___
Python tracker 

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



[issue39342] Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl

2020-01-15 Thread Chris Burr


New submission from Chris Burr :

Enabling proxy certificate validation requires X509_V_FLAG_ALLOW_PROXY_CERTS to 
be included in the verify flags.[1] This should be exposed as 
ssl.VERIFY_ALLOW_PROXY_CERTS to match with the other X509_V_FLAG_* variables.

https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html

--
components: Library (Lib)
messages: 360035
nosy: chrisburr
priority: normal
severity: normal
status: open
title: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl
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



[issue39341] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file48845/malicious.zip

___
Python tracker 

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



[issue39341] [security] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +christian.heimes, rschiron
title: zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size 
-> [security] zipfile: ZIP Bomb vulnerability, don't check announced 
uncompressed size

___
Python tracker 

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



[issue39341] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file48844/poc.py

___
Python tracker 

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



[issue39341] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file48843/create_zip.py

___
Python tracker 

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



[issue39341] zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size

2020-01-15 Thread STINNER Victor


New submission from STINNER Victor :

Laish, Amit (GE Digital) reported a vulnerability in the zipfile module to the 
PSRT list. The module is vulnerable to ZIP Bomb:
https://en.wikipedia.org/wiki/Zip_bomb

A 100 KB malicious ZIP file announces an uncompressed size of 1 byte but 
extracting it writes 100 MB on disk.

Python 2.7 is vulnerable.

Python 3.7 does not seem to be directly vulnerable. The proof of concept fails 
with:

$ python3 poc.py 
The size of the uncompressed data is: 1 bytes
Traceback (most recent call last):
  File "poc.py", line 18, in 
extract() # The uncompressed size is more than 20GB :)
  File "poc.py", line 6, in extract
zip_ref.extractall('./')
  File "/usr/lib64/python3.7/zipfile.py", line 1636, in extractall
self._extract_member(zipinfo, path, pwd)
  File "/usr/lib64/python3.7/zipfile.py", line 1691, in _extract_member
shutil.copyfileobj(source, target)
  File "/usr/lib64/python3.7/shutil.py", line 79, in copyfileobj
buf = fsrc.read(length)
  File "/usr/lib64/python3.7/zipfile.py", line 930, in read
data = self._read1(n)
  File "/usr/lib64/python3.7/zipfile.py", line 1020, in _read1
self._update_crc(data)
  File "/usr/lib64/python3.7/zipfile.py", line 948, in _update_crc
raise BadZipFile("Bad CRC-32 for file %r" % self.name)
zipfile.BadZipFile: Bad CRC-32 for file 'dummy1.txt'

The malicious ZIP file size is 100 KB. Extracting it writes dummy1.txt: 100 MB 
only made of a single character "0" (zero, Unicode character U+0030 or byte 
0x30) repeated on 100 MB.

The original proof of concept used a 20 MB ZIP writing 20 GB on disk. It's just 
the same text file repeated 200 files. I created a smaller ZIP just to be able 
to upload it to bugs.python.org.

Attached files:

* create_zip.py: created malicious.zip from valid.zip: modify the uncompressed 
size of compressed dummy1.txt
* valid.zip: compressed dummy1.txt, file size is 100 KB
* poc.py: extract malicious.zip

--

The zipfile documentation describes "Decompression pitfalls":
https://docs.python.org/dev/library/zipfile.html#decompression-pitfalls

The zlib.decompress() function has a max_length parameter:
https://docs.python.org/dev/library/zlib.html#zlib.Decompress.decompress

See also my notes on "Archives and Zip Bomb":
https://python-security.readthedocs.io/security.html#archives-and-zip-bomb

--

unzip program of Fedora unzip-6.0-44.fc31.x86_64 package has the same 
vulnerability:

$ unzip malicious.zip 
Archive:  malicious.zip
  inflating: dummy1.txt 

$ unzip -l malicious.zip 
Archive:  malicious.zip
  Length  DateTimeName
-  -- -   
1  03-12-2019 14:10   dummy1.txt
- ---
1 1 file

--

According to Riccardo Schirone (Red Hat), p7zip, on the other hand, seems to 
use the minimum value between the header value and the file one, so it extracts 
only 1 byte and correctly complains about CRC failures.

--
components: Library (Lib)
messages: 360034
nosy: vstinner
priority: normal
severity: normal
status: open
title: zipfile: ZIP Bomb vulnerability, don't check announced uncompressed size
type: security
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39340] shutil.rmtree and write protected files

2020-01-15 Thread Peter Liedholm


New submission from Peter Liedholm :

Ubuntu 18.4 and Windows 7 has different behaviour when deleting write protected 
files with rmtree.

Ubuntu silently deletes them (unexpected?)
Windows moans about access denied (expected?)

Reproduction method linux
mkdir test; touch test/file.txt; chmod -w test/file.txt

Reproduction method windows
mkdir test && type nul > test\file.txt && attrib +R test\file.txt

Reproduction method cont.
python3 -c "import shutil; shutil.rmtree('test')"

--
components: Library (Lib)
messages: 360033
nosy: PeterFS
priority: normal
severity: normal
status: open
title: shutil.rmtree and write protected files
versions: Python 3.6, Python 3.8

___
Python tracker 

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



[issue39310] Add math.ulp(x): unit in the last place

2020-01-15 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Brett]

> Can I just say that "ulp" is totally non-obvious what that even means unless 
> you have a specific math background?

It's a good point. I guess we have a choice between using the domain-specific 
standard-ish name (which should be immediately meaningful to experts, but 
doesn't give much of a hint to non-experts) or using something more descriptive 
(which then risks confusing experts until they figure out "oh, that's just 
ulp").

There's also the option of spelling it out as "unit_in_last_place", but I'm not 
sure that benefits anyone.

For meaningful descriptive names, "float_resolution" or "gap_to_next" are about 
the best I can come up with. "precision" is too ambiguous.

NumPy has "numpy.spacing". But this exhibits exactly the trap of *not* using 
the "ulp" name: on a first glance, I incorrectly decided that NumPy *didn't* 
implement a ulp function. Then, having found `numpy.spacing`, I had to read the 
description carefully in order to recognise that "oh, this is just ulp". 
(Actually, I had to do more, since the description doesn't make all the corner 
cases clear, and in fact is currently wrong for powers of 2.)

If we can get people can coalesce around a preferred alternative name, we could 
consider changing this.

--

___
Python tracker 

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



[issue39164] Add private _PyErr_GetExcInfo() function which accepts a tstate argument

2020-01-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17409
pull_request: https://github.com/python/cpython/pull/18010

___
Python tracker 

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



[issue8800] add threading.RWLock

2020-01-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks for sharing, your project looks viable!

--

___
Python tracker 

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



[issue39339] ProcessPoolExecutor() Exception in thread QueueManagerThread

2020-01-15 Thread ss


Change by ss <1162276...@qq.com>:


--
title: Exception in thread QueueManagerThread -> ProcessPoolExecutor()   
Exception in thread QueueManagerThread

___
Python tracker 

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



[issue39339] Exception in thread QueueManagerThread

2020-01-15 Thread ss


New submission from ss <1162276...@qq.com>:

os.cpu_count() is 64, but 61 to 64 raise Exception in thread QueueManagerThread 
Error: ValueError: need at most 63 handles, got a sequence of length 63.

--
components: Windows
messages: 360030
nosy: paul.moore, pythonpython, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Exception in thread QueueManagerThread
type: compile error
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