[issue37212] ordered keyword arguments in unittest.mock.call repr and error messages

2019-06-10 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

With PEP 468 implemented in Python 3.6 the order of keyword arguments are 
preserved. In mock.call the arguments are sorted [0]. This makes the output 
different from the expectation that order should be same as the one passed. 
This was implemented in issue21256 where ordered kwargs was suggested but I 
guess it was not implemented and hence sort was used for deterministic output. 
The PEP also links to the discussion where ordered kwargs was discussed [1] in 
2009 before ordered dict implementation.

Given that keyword argument dictionary is now deterministic is it okay to drop 
sorting in 3.9? This is backwards incompatible with 3.8 where code might have 
depended upon the sorted output so if this requires a python-dev discussion I 
would be happy to start one.


# (b=1, a=2) is the actual call but "actual" in error message is noted as (a=2, 
b=1)

>>> from unittest.mock import call, Mock
>>> call(b=1, a=2)
call(a=2, b=1)
>>> m = Mock()
>>> m(b=1, a=2)

>>> m.assert_called_with(c=3)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 870, in assert_called_with
raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: mock(c=3)
Actual: mock(a=2, b=1)

# With proposed change removing sorting

>>> from unittest.mock import call, Mock
>>> call(b=1, a=2)
call(b=1, a=2)
>>> m = Mock()
>>> m(b=1, a=2)

>>> m.assert_called_with(c=3)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 870, in assert_called_with
raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: mock(c=3)
Actual: mock(b=1, a=2)

[0] 
https://github.com/python/cpython/blob/c879ff247ae1b67a790ff98d2d59145302cd4e4e/Lib/unittest/mock.py#L2284
[1] https://mail.python.org/pipermail/python-ideas/2009-April/004163.html

--
components: Library (Lib)
messages: 345106
nosy: cjw296, mariocj89, michael.foord, xtreak
priority: normal
severity: normal
status: open
title: ordered keyword arguments in unittest.mock.call repr and error messages
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



[issue37074] os.stat() does not work for NUL and CON

2019-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you mind to create a PR Eryk?

--

___
Python tracker 

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



[issue36548] Make the repr of re flags more readable

2019-06-10 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



[issue37213] Peeephole optimizer does not optimize functions with multiline expressions

2019-06-10 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The optimization is skipped if lnotab contains 255. It was very uncommon in 
older versions (only when the function contains very large expressions, larger 
than hundreds of lines or bytecode instructions), but in 3.8 this situation is 
common.

For example:

[x
 for x in a if x]

  1   0 BUILD_LIST   0
  2 LOAD_FAST0 (.0)
>>4 FOR_ITER12 (to 18)

  2   6 STORE_FAST   1 (x)
  8 LOAD_FAST1 (x)
 10 POP_JUMP_IF_FALSE   16

  1  12 LOAD_FAST1 (x)
 14 LIST_APPEND  2
>>   16 JUMP_ABSOLUTE4
>>   18 RETURN_VALUE

if x:
if (y and
z):
foo()
else:
bar()

  1   0 LOAD_NAME0 (x)
  2 POP_JUMP_IF_FALSE   20

  2   4 LOAD_NAME1 (y)
  6 POP_JUMP_IF_FALSE   18

  3   8 LOAD_NAME2 (z)

  2  10 POP_JUMP_IF_FALSE   18

  4  12 LOAD_NAME3 (foo)
 14 CALL_FUNCTION0
 16 POP_TOP
>>   18 JUMP_FORWARD 6 (to 26)

  6 >>   20 LOAD_NAME4 (bar)
 22 CALL_FUNCTION0
 24 POP_TOP
>>   26 LOAD_CONST   0 (None)
 28 RETURN_VALUE

You can see non-optimized jumps to jumps (from 10 to 16 and from 6 and 10 to 16 
correspondingly).

This is a consequence of two features: ability to encode negative line 
differences in lnotab and setting lines for both outer and inner expressions.

Two ways to solve this issue:

1. Move optimizations from Python/peephole.c to Python/compile.c (see 
issue32477 and issue33318). This is a new feature and it is too late for 3.8.

2. Make the peepholer to work with lnotab containing 255.

Pablo, are you interesting?

--
components: Interpreter Core
messages: 345108
nosy: benjamin.peterson, pablogsal, serhiy.storchaka, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: Peeephole optimizer does not optimize functions with multiline 
expressions
type: behavior
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



[issue32477] Move jumps optimization from the peepholer to the compiler

2019-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Opened issue37213 for the regression in the peepholer.

--

___
Python tracker 

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



[issue37213] Peeephole optimizer does not optimize functions with multiline expressions

2019-06-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +3.8regression

___
Python tracker 

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



[issue29717] `loop.add_reader` and `<

2019-06-10 Thread Алексей Костырин

Алексей Костырин  added the comment:

Checked latest master (c879ff247ae1b67a790ff98d2d59145302cd4e4e), 3.8 - 3.5 
branches - can not reproduce.
OS - macOS

--
nosy: +Алексей Костырин

___
Python tracker 

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



[issue37172] Odd error awaiting a Future

2019-06-10 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Not sure what "idempotency fix" means in the context of Future objects.

Could you describe desired behavior or, even better, provide a pull request 
that demonstrates your desire?

--

___
Python tracker 

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



[issue29717] `loop.add_reader` and `<

2019-06-10 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

If fd is a regular file it is not supported well by all select/poll/epoll.
Registration may succeed but the data is marked as "already ready for reading".

Not sure if we should do anything.
The situation may be changed after eventual providing asyncio API for files 
(there is no actual work for it yet).

--

___
Python tracker 

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



[issue37107] ensurepip --upgrade doesn't change the version of pip used by venv

2019-06-10 Thread Petr Viktorin


Petr Viktorin  added the comment:

Please don't forget that it is possible to use venv without PyPI.

With my Fedora hat on: as a distro, we don't trust PyPI as a package delivery 
infrastructure. Lots of users do, and we allow the users to easily but 
explicitly opt in to trusting it by running "pip install". (In the same way, we 
don't trust rubygems, npm, CPAN, hackage, etc. -- there are too many, and PyPI 
is not special.)

Changing venv's existing `--upgrade` option to start installing from PyPI is 
problematic. We'd probably need to patch it out, creating an inconsistency 
between the distro and upstream: it would not do what `python3 -m pip install 
--upgrade pip` does.

ISTM, the proposed semantics aren't consistent: "venv --upgrade" would not 
match what "pip --upgrade" does: it would do what "pip install --upgrade pip" 
does. The latter needs an extra argument, explicitly saying *what* to upgrade. 
Making "pip" implicit makes sense for "ensurepip", but not for "venv".

Also, in my view, "network" should not be used as a synonym for PyPI (outside 
pip).

Could we instead make `venv --upgrade` print out a warning, saying that it 
upgrades Python, and to upgrade pip you should `python -m pip install --upgrade 
pip` instead?

---

> Unless you're using a Linux distro Python that has been patched
> to inject the external pip installation with rewheel or dirtbike,
> getting a venv that uses the externally updated version of pip
> requires running
> `python3 - m venv --system-site-packages --without-pip ...`.

FWIW, "rewheel" is no more: Fedora now distributes the wheels themselves, and 
patches system ensurepip to look in /usr/share/python-wheels/.

--

___
Python tracker 

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



[issue37172] Odd error awaiting a Future

2019-06-10 Thread Dima Tisnek


Dima Tisnek  added the comment:

I think that if a Future is abused, the following two should return *same* 
error:

async def test():
await asyncio.gather(reader(), writer())

-vs-

async def test():
await asyncio.gather(reader(), reader(), writer())

--

___
Python tracker 

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



[issue36742] CVE-2019-10160: urlsplit NFKD normalization vulnerability in user:password@

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13804
pull_request: https://github.com/python/cpython/pull/13937

___
Python tracker 

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



[issue37172] Odd error awaiting a Future

2019-06-10 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Agree, it would be fine.
So the behavior is not changed but the error text should be clear, right?

--

___
Python tracker 

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



[issue37213] Peeephole optimizer does not optimize functions with multiline expressions

2019-06-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thank you very much, Serhiy!

I am interested, I will try to look at the problem and try to get a PR soon.

What of the two possible solutions that you mention you think is better? I 
assume if we make the peephole optimizer work with lnotab containing 255 we 
could backport to 3.8 as a bugfix, right?

--
assignee:  -> pablogsal

___
Python tracker 

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



[issue36742] CVE-2019-10160: urlsplit NFKD normalization vulnerability in user:password@

2019-06-10 Thread Riccardo Schirone


Riccardo Schirone  added the comment:

> CVE-2019-10160 has been assigned by Red Hat to this flaw.

For clarity, CVE-2019-10160 has been assigned to the bug introduced with the 
fix for the functional regression mentioned in this bug, and not to the bug 
itself explained in the first comment. See 
https://bugzilla.redhat.com/show_bug.cgi?id=1718388 for more details about it.

--

___
Python tracker 

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



[issue37172] Odd error awaiting a Future

2019-06-10 Thread Dima Tisnek


Dima Tisnek  added the comment:

Yes, I think that would be sufficient!

I don't know about implementation though, as there's some magic in the way 
Future.__await__ tries to guess how it was called. I hope one day that magic 
could go away, but I neither understand the origin nor the mechanics of it, 
so... My gut tells me that fixing the error involves digging into that magic.

--

___
Python tracker 

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



[issue37151] Calling code cleanup after PEP 590

2019-06-10 Thread shafiq sahil


shafiq sahil  added the comment:

http://www.mobile-phone.pk/search/

--
nosy: +shafiq sahil

___
Python tracker 

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



[issue37213] Peeephole optimizer does not optimize functions with multiline expressions

2019-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, we should backport the fix to 3.8. There is a bug in 3.8.

--

___
Python tracker 

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



[issue37214] Add new EncodingWarning warning category: emitted when the locale encoding is used implicitly

2019-06-10 Thread STINNER Victor


New submission from STINNER Victor :

Spin-off of INADA-san's PEP 597: I propose to emit a new EncodingWarning 
warning when the locale encoding is used implicitly.

I propose to add a new warning to be able to control how they are handled: 
either make them hard error (python3.9 -W error::EncodingWarning) or ignore 
them (python3.9 -W ignore::EncodingWarning).

Displaying these warnings by default or not is an open question discussed in 
PEP 597 discussion:
https://discuss.python.org/t/pep-597-use-utf-8-for-default-text-file-encoding/1819

I propose to only emit a warning which can be turned off easily to not bother 
people who don't care of encodings. There are many legit cases where a Python 
application works well in a control environment whereas it would break on any 
other environment, but the application is only used in one specific 
environment. For example, an application may only be run in a container which 
has a well defined locale and locale encoding, but will never be run on 
Windows, macOS, FreeBSD or HP-UX.

Writing portable code is *great*. But I'm not sure that *all* code must be 
portable. For example, it's also fine to use Python to write applications 
specific to Linux, again, for code only run in a controlled environment. Many 
companies have private projects which will never run outside their "walls" 
(outside their datacenters ;-)).

--
components: Library (Lib)
messages: 345121
nosy: vstinner
priority: normal
severity: normal
status: open
title: Add new EncodingWarning warning category: emitted when the locale 
encoding is used implicitly
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



[issue37214] Add new EncodingWarning warning category: emitted when the locale encoding is used implicitly

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue37151] Calling code cleanup after PEP 590

2019-06-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue36221] Setting PYTHONASYNCIODEBUG breaks warnings

2019-06-10 Thread Alexey Kostyrin


Alexey Kostyrin  added the comment:

Can not reproduce - warning is displayed with PYTHONASYNCIODEBUG=1 
Python version:
Python 3.8.0b1+ (heads/3.8:3f7629d93c, Jun 10 2019, 13:46:55) 
[Clang 10.0.0 (clang-1000.10.44.4)] on darwin

--
nosy: +def_bk

___
Python tracker 

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



[issue37214] Add new EncodingWarning warning category: emitted when the locale encoding is used implicitly

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Building Python (make) with PR 13938 emits 7 EncodingWarning warnings:

$ PYTHONWARNINGS=always::EncodingWarning make

/home/vstinner/prog/python/master/Lib/sysconfig.py:228: EncodingWarning: 
encoding=None
  with open(filename, errors="surrogateescape") as f:
/home/vstinner/prog/python/master/Lib/sysconfig.py:371: EncodingWarning: 
encoding=None
  with open(config_h) as f:

./setup.py:559: EncodingWarning: encoding=None
  with open(tmpfile) as fp:
./setup.py:691: EncodingWarning: encoding=None
  with open(config_h) as file:
./setup.py:893: EncodingWarning: encoding=None
  with open(tmpfile) as fp:
./setup.py:1369: EncodingWarning: encoding=None
  with open(f) as file:
./setup.py:1496: EncodingWarning: encoding=None
  with open(zlib_h) as fp:


The test suite cannot be run if EncodingWarning are treated as error, an 
exception fails before running the first test:

$ PYTHONWARNINGS=error::EncodingWarning ./python -W error::EncodingWarning -m 
test -j0 -r
...
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
427, in display_header
print("==", platform.platform(aliased=True),
  ...
  File "/home/vstinner/prog/python/master/Lib/platform.py", line 613, in 
_syscmd_uname
output = subprocess.check_output(('uname', option),
  ...
  File "/home/vstinner/prog/python/master/Lib/subprocess.py", line 821, in 
__init__
self.stdout = io.TextIOWrapper(self.stdout,
EncodingWarning: encoding=None


To be able to run the test suite, I turned off the warning in subprocess.Popen 
using this change:

diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index d34c57828b..d89911cc32 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -749,6 +749,9 @@ class Popen(object):
 self.stderr = None
 self.pid = None
 self.returncode = None
+if not encoding:
+import locale
+encoding = locale.getpreferredencoding(False)
 self.encoding = encoding
 self.errors = errors


Using PR 13938 and subprocess.Popen change, at least 136 tests are failing. I 
have to interrupt the test suite since 7 tests hang:

$ PYTHONWARNINGS=error::EncodingWarning ./python -W error::EncodingWarning -m 
test -j0 -r
...
7 tests omitted:
test_cmd_line_script test_concurrent_futures test_httpservers
test_multiprocessing_fork test_multiprocessing_spawn test_ssl
test_subprocess

258 tests OK.

136 tests failed:
test___all__ test__xxsubinterpreters test_argparse test_asyncio
test_atexit test_base64 test_baseexception test_bdb test_bool
test_builtin test_bz2 test_calendar test_capi test_cgi test_cgitb
test_cmath test_cmd_line test_compile test_compileall test_complex
test_configparser test_contextlib test_coroutines test_cprofile
test_csv test_ctypes test_dbm test_dbm_dumb test_decimal
test_defaultdict test_deque test_difflib test_distutils
test_doctest test_eintr test_email test_embed test_eof
test_exceptions test_faulthandler test_file test_file_eintr
test_filecmp test_fileinput test_float test_gc test_gdb test_gzip
test_hash test_http_cookiejar test_httplib test_idle test_imp
test_import test_importlib test_inspect test_io test_iter
test_json test_lib2to3 test_linecache test_list test_lltrace
test_logging test_lzma test_mailbox test_mailcap test_math
test_module test_modulefinder test_multiprocessing_forkserver
test_multiprocessing_main_handling test_netrc test_ntpath
test_opcodes test_os test_parser test_pathlib test_pdb test_pickle
test_pipes test_pkg test_pkgimport test_pkgutil test_platform
test_poll test_popen test_posix test_posixpath test_profile
test_py_compile test_pydoc test_quopri test_random test_readline
test_regrtest test_repl test_runpy test_sax test_script_helper
test_select test_set test_shutil test_signal test_site test_socket
test_source_encoding test_stat test_support test_symbol test_sys
test_sysconfig test_tabnanny test_tarfile test_tcl test_tempfile
test_threading test_tools test_trace test_traceback
test_tracemalloc test_turtle test_unicodedata test_unittest
test_univnewlines test_userlist test_utf8_mode test_venv
test_warnings test_weakref test_webbrowser test_xml_etree
test_xml_etree_c test_zipfile test_zipimport
test_zipimport_support


For example, if EncodingWarning is treated as an error, 
test_cmd_line_script.test_repl_stderr_flush() hangs:

$ PYTHONWARNINGS=error::EncodingWarning ./python -W error::EncodingWarning -m 
test -v test_cmd_line_script -m test_repl_stderr_flush
...
0:00:00 load avg: 0.83 [1/1] test_cmd_line_script
test_repl_stderr_flush (test.test_cmd_line_script.CmdLineTest) ... 


I would like to believe that Python code base is sane in general and that we 
handle encodings properly (I spent a significant amount of time to ensure that 
it's the case ;-)). So even if Python itself emits so many warnings, I don't 
think that it would be a good ide

[issue37214] Add new EncodingWarning warning category: emitted when the locale encoding is used implicitly

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Another test: try to build a venv to get pip:


Building a venv is ok. Good, our stdlib is not so bad :-)

$ PYTHONWARNINGS=error::EncodingWarning ./python -W error::EncodingWarning -m 
venv --without-pip env


But ensurepip fails soon:

$ PYTHONWARNINGS=error::EncodingWarning ./env/bin/python -W 
error::EncodingWarning -m ensurepip --verbose
/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/pyparsing.py:3068: 
SyntaxWarning: invalid escape sequence \w
/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/pyparsing.py:3068: 
SyntaxWarning: invalid escape sequence \w
/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop 
working
Exception:
Traceback (most recent call last):
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py",
 line 179, in main
status = self.run(options, args)
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/install.py",
 line 255, in run
with self._build_session(options) as session:
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py",
 line 87, in _build_session
session = PipSession(
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", 
line 344, in __init__
self.headers["User-Agent"] = user_agent()
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", 
line 108, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
120, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
674, in linux_distribution
self.name() if full_distribution_name else self.id(),
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
712, in name
name = self.os_release_attr('name') \
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
883, in os_release_attr
return self._os_release_info.get(attribute, '')
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
550, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
  File 
"/tmp/tmpyxn9yklq/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 
921, in _os_release_info
with open(self.os_release_file) as release_file:
EncodingWarning: encoding=None


Note: an "up to date" pip still emits many SyntaxWarning and DeprecationWarning 
warnings :-(


New attempt using "always" action:

$ PYTHONWARNINGS=always::EncodingWarning ./env/bin/python -W 
always::EncodingWarning -m ensurepip --verbose
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/pyparsing.py:3068: 
SyntaxWarning: invalid escape sequence \w
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/pyparsing.py:3068: 
SyntaxWarning: invalid escape sequence \w
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop 
working
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py:921: 
EncodingWarning: encoding=None
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py:995: 
EncodingWarning: encoding=None
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py:1131: 
EncodingWarning: encoding=None
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/distro.py:1030: 
EncodingWarning: encoding=None
/home/vstinner/prog/python/master/Lib/subprocess.py:824: EncodingWarning: 
encoding=None
  self.stdout = io.TextIOWrapper(self.stdout,
Ignoring indexes: https://pypi.org/simple
Created temporary directory: /tmp/pip-ephem-wheel-cache-2hizyo3q
Created temporary directory: /tmp/pip-req-tracker-kb535zvl
Created requirements tracker '/tmp/pip-req-tracker-kb535zvl'
Created temporary directory: /tmp/pip-install-_z_c4ze9
Looking in links: /tmp/tmpc309fubz
Collecting setuptools
  0 location(s) to search for versions of setuptools:
  Skipping link /tmp/tmpc309fubz (from -f); not a file
  Skipping link file:///tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl; wrong 
project name (not setuptools)
  Found link file:///tmp/tmpc309fubz/setuptools-40.8.0-py2.py3-none-any.whl, 
version: 40.8.0
  Local files found: /tmp/tmpc309fubz/setuptools-40.8.0-py2.py3-none-any.whl
  Using version 40.8.0 (newest of versions: 40.8.0)
/tmp/tmpc309fubz/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/req/req_tracker.py:60:
 EncodingWarning: encoding=None
  Added setuptools from 
file:///tmp/tmpc309fubz/setuptoo

[issue37214] Add new EncodingWarning warning category: emitted when the locale encoding is used implicitly

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

My subprocess patch was wrong: you must use attached subprocess.patch.

--
Added file: https://bugs.python.org/file48408/subprocess.patch

___
Python tracker 

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



[issue34677] Event scheduler page example

2019-06-10 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you for the report.  As others have said, the actual time.time() value 
for the two `s.enter` events is different even though the `delay` value of 5 
seems like it should be the same.  As @xtreak pointed out, the example is 
clever in showing that using `enter` instead of `enterabs` can make the queue 
behave in unexpected ways.

Closing as 'not a bug'.

--
nosy: +cheryl.sabella
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2019-06-10 Thread Andrei Zene


Andrei Zene  added the comment:

I have updated PR 13842(https://github.com/python/cpython/pull/13842) to 
dynamically alocate the fd_sets on windows.

I did some testing on windows with the following two paterns:
1. 1 transient clients: (open connection, send message, close connection)
2. 1024 permanent clients: (open connection, then in infinite loop: (read 
message, send message back))

Everything seemed to be fine.

I didn't do any testing on Linux.

On windows I also had to remove the if that vstinner added to check if the 
greatest file descriptor is greater than the setsize. That condition always 
failed for me on Windows. Apparently, according to: 
https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/nf-winsock2-select,
 windows ignores nfds and "is included only for compatibility with Berkeley 
sockets." The documentation also states that the FD_ "macros are compatible 
with those used in the Berkeley software, but the underlying representation is 
completely different.", and: "Internally, socket handles in an fd_set structure 
are not represented as bit flags as in Berkeley Unix. Their data representation 
is opaque."

This is why I chose to determine setsize based on the inputs. If you think 
that's not going to work, please say why :)

--

___
Python tracker 

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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread Jakub Kulik


New submission from Jakub Kulik :

After the integration of https://bugs.python.org/issue36842, build with dtrace 
is broken on systems where files that reference DTrace probes need to be 
modified in-place by dtrace (e.g., Solaris).

The reason for that is that Python/sysmodule.o, which newly contains some 
dtrace references, was not added to DTRACE_DEPS.

--
components: Build
messages: 345128
nosy: kulikjak
priority: normal
severity: normal
status: open
title: Build with dtrace is broken on some systems
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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread Jakub Kulik


Change by Jakub Kulik :


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

___
Python tracker 

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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +13807
pull_request: https://github.com/python/cpython/pull/13940

___
Python tracker 

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



[issue36842] Implement PEP 578

2019-06-10 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +13808
pull_request: https://github.com/python/cpython/pull/13940

___
Python tracker 

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



[issue36742] CVE-2019-10160: urlsplit NFKD normalization vulnerability in user:password@

2019-06-10 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue37130] pathlib does not handle '..' directory

2019-06-10 Thread N.P. Khelili


N.P. Khelili  added the comment:

First, there is no real special case about the '.' path. The parse_args() 
method simlply removes then during __new__() (around line 80) as they are not 
needed. Double dots having to be kept, are later considered valid by the name 
@property.

In test_pathlib.py, '..' are just ignored in a lot of tests. In my previous 
post, I pointed the bahaviour of .stem and .parent. But we should also consider 
the question of .anchor. The doc says that it should return the """The 
concatenation of the drive and root, or ''."""

but the code is:

anchor = self._drv + self._root
return anchor

leading to:

>>> Path('.').anchor
''
>>> Path('..').anchor
''

and:

>>> Path('foo').anchor
''

when one would probably expect '.', './..' and './foo'.

I also found:

>>> Path('*').match('.')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/nono/BUILD/cpython/Lib/pathlib.py", line 956, in match
raise ValueError("empty pattern")
ValueError: empty pattern


>>> Path('*').match('..')
False

While the behaviour of .stem (cf up msg 344770) dates from initial commit of 
test_pathlib, maybe breaking it may be a bad idea... ( I really don't know.)

I have a working code that sets name to '' for '..' and adds a special case in 
.stem() so that we do not remove any line in test_pathlib, but only adds some.

I think anyway, it is too soon for any pull request. Questions are:

- Should .name allways return a string, even if empty?
- Should P('..').parent really return '.'?
- Is it ok that .match() make that much difference between '.' and '..'?
- Am I correct in my expectations about .anchor ?
- May .stem behaviour be changed ?

--
title: pathlib.with_name() doesn't like unnamed files. -> pathlib does not 
handle '..' directory

___
Python tracker 

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



[issue36842] Implement PEP 578

2019-06-10 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



[issue34850] Emit a syntax warning for "is" with a literal

2019-06-10 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



[issue23649] tarfile not re-entrant for multi-threading

2019-06-10 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



[issue36842] Implement PEP 578

2019-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 8a8b59c9794674b50b2242698c29038034f4864c by Miss Islington (bot) 
(Christian Heimes) in branch 'master':
bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
https://github.com/python/cpython/commit/8a8b59c9794674b50b2242698c29038034f4864c


--
nosy: +miss-islington

___
Python tracker 

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



[issue36842] Implement PEP 578

2019-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13810
pull_request: https://github.com/python/cpython/pull/13942

___
Python tracker 

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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 8a8b59c9794674b50b2242698c29038034f4864c by Miss Islington (bot) 
(Christian Heimes) in branch 'master':
bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
https://github.com/python/cpython/commit/8a8b59c9794674b50b2242698c29038034f4864c


--
nosy: +miss-islington

___
Python tracker 

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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13809
pull_request: https://github.com/python/cpython/pull/13942

___
Python tracker 

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



[issue36842] Implement PEP 578

2019-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset bac6e63fd63960a1ab862befab42de05d32667c2 by Miss Islington (bot) 
in branch '3.8':
bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
https://github.com/python/cpython/commit/bac6e63fd63960a1ab862befab42de05d32667c2


--

___
Python tracker 

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



[issue37215] Build with dtrace is broken on some systems

2019-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset bac6e63fd63960a1ab862befab42de05d32667c2 by Miss Islington (bot) 
in branch '3.8':
bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
https://github.com/python/cpython/commit/bac6e63fd63960a1ab862befab42de05d32667c2


--

___
Python tracker 

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



[issue37216] mac installation document wrong for python 3.7.3

2019-06-10 Thread makdon


New submission from makdon :

According the mail in docs mailing list, there's a typo in python installation 
document on Macos. I will check it and create a PR if necessary.


The email says:


https://docs.python.org/3/using/mac.html#getting-and-installing-macpython

says
"What you get after installing is a number of things:

A MacPython 3.6 folder in your Applications folder."

However, after installing just now

$ /usr/local/bin/python3 -V
Python 3.7.3

I instead found a folder called

/Applications/Python 3.7

--
assignee: docs@python
components: Documentation
messages: 345134
nosy: docs@python, makdon
priority: normal
severity: normal
status: open
title: mac installation document wrong for python 3.7.3
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



[issue37216] mac installation document wrong for python 3.7.3

2019-06-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Relevant email : https://mail.python.org/pipermail/docs/2019-June/041030.html

--
components: +macOS
nosy: +ned.deily, ronaldoussoren, xtreak

___
Python tracker 

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



[issue34850] Emit a syntax warning for "is" with a literal

2019-06-10 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue37107] ensurepip --upgrade doesn't change the version of pip used by venv

2019-06-10 Thread Steve Dower


Steve Dower  added the comment:

I'm with Petr here. ensurepip/venv should only go as far as we support, which 
is the version of the wheels included in our bundle. We should continue having 
the stdlib pretend that PyPI doesn't exist.

External network access would justify the longer option, in my opinion: 
"--upgrade-pip-from-pypi"

--

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks and hangs

2019-06-10 Thread Tal Einat


Tal Einat  added the comment:

> 'max(n, 50)' should have been 'min(n, 50)'  Tal, does you comment avove about 
> the former apply when corrected to the latter?

Yes. To use your terms, I prefer incrementing over thresholding.

> This is all that is needed for getrecursionlimit.

If we go with incrementing, then getrecursionlimit should likely decrement the 
returned value by the same amount, so that 
setrecursionlimit(getrecursionlimit()) doesn't change the recursion limit.

> Currently, at least on CPython, n must be >= 1 or ValueError is raised.  I 
> don't like changing that.

This is another issue that incrementing avoids.

Since it looks like we're in general agreement, Terry, I'll work up a PR.

--

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks and hangs

2019-06-10 Thread Tal Einat


Tal Einat  added the comment:

Setting the recursion limit too low also causes issues in a plain Python 
interactive session. With current master (to be 3.9) on Win10, I get issues 
with values up to 6. In IDLE values up to 20 cause an immediate exception 
similar to the one described by Serhiy.

Anyways, I think we should increment by 25, to always set "safe" values.

--

___
Python tracker 

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



[issue37130] pathlib does not handle '..' directory

2019-06-10 Thread Brett Cannon


Change by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue37206] Incorrect application of Argument Clinic to dict.pop()

2019-06-10 Thread Ned Deily


Ned Deily  added the comment:

As I noted on the PR: "I'm not going to get into whether this PR is appropriate 
for 3.8 but, assuming it were, I would be very concerned about making a change 
of this size and complexity in 3.7 at this stage in its lifecycle."

--
nosy: +lukasz.langa, ned.deily

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks and hangs

2019-06-10 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue37217] SSL socket segfaults during a connect() using a punycode domain containg a umlaut

2019-06-10 Thread kmille

New submission from kmille :

Hey,

chs@gw-sss-nb8:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 16.04.4 LTS
Release:16.04
Codename:   xenial
chs@gw-sss-nb8:~$ python3 --version
Python 3.5.2
chs@gw-sss-nb8:~$ cat segfault.py 
import ssl
import socket

hostname = "www.xn--b.buchhandlunggründen.de"

ctx = ssl.create_default_context()
s = ctx.wrap_socket(socket.socket(), server_hostname=hostname)
s.check_hostname = True
try:
s.connect((hostname, 443))
except UnicodeError as incorrect_punycode:
pass

chs@gw-sss-nb8:~$ python3 segfault.py 
Segmentation fault

The problem does not occur if I remove the ü in www.xn--b.buchhandlunggründen.de

On my Arch the DNS fails (above the name doesn't resolve too but I seems like 
it doesn't matter):
kmille@linbox timetracking master % python3 omg.py 
Traceback (most recent call last):
  File "omg.py", line 10, in 
s.connect((hostname, 443))
  File "/usr/lib/python3.7/ssl.py", line 1150, in connect
self._real_connect(addr, False)
  File "/usr/lib/python3.7/ssl.py", line 1137, in _real_connect
super().connect(addr)
socket.gaierror: [Errno -2] Name or service not known
kmille@linbox timetracking master % python3 --version
Python 3.7.3

If you need further help please ask.

Thank you for python <3

kmille

--
components: ctypes
messages: 345140
nosy: kmille
priority: normal
severity: normal
status: open
title: SSL socket segfaults during a connect() using a punycode domain containg 
a umlaut
versions: Python 3.5

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks and hangs

2019-06-10 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-13944.

--

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks and hangs

2019-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

[Initially written before you posted the PR]
Serhiy's result suggests that 25 might not always be enough and he suggested 
50.  Plus IDLE sometimes makes more calls internally.  Lets go with at least 30.

I agree that "get...(set...(n)) == n" (when n is positive, a check we should 
emulate) and "set...(get...())" leaving limit as it was are desirable.  The 
docs and docstrings just need to say what we do.  Possible additions.
"This IDLE wrapper adds 30 to prevent possible uninterruptible loops."
"This IDLE wrapper subtracts 30 to compensate for the 30 IDLE adds when setting 
the limit."

The main reason I can think of for users to play with low recursion limits is 
to explore the implementation.  They simply cannot get stock CPython behavior 
when running with IDLE.  So I want the IDLE wrappers to not be completely 
transparent. For that to be obvious in calltips, the first line should say so.

The main reason I want to intervene is to prevent the not-nice behavior of 
hanging until a manual restart.  I checked, and it is still possible.

In 3.8.0b1, the min n is not 1 but current stack + 5.
>>> sys.setrecursionlimit(11)
Traceback (most recent call last):
  File "", line 1, in 
sys.setrecursionlimit(11)
RecursionError: cannot set the recursion limit to 11 at the recursion depth 6: 
the limit is too low

Our increment will prevent a user from seeing this, but this is necessary to 
prevent ...

>>> sys.setrecursionlimit(12)
# hangs, once after printing "Exception ignored in thread started by"
# until manual restart.
# 18 hangs after printing 60 lines of a double exception.
# 20 does not hang and calling 'f' from the original message
# gets a truncated traceback ending with
   [Previous line repeated 12 more times]

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue13889] str(float) and round(float) issues with FPU precision

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13812
pull_request: https://github.com/python/cpython/pull/13946

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13813
pull_request: https://github.com/python/cpython/pull/13946

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Oh. Using PR 13889, I'm able to reproduce the bug up to Python 3.4. Example at 
commit commit e76cbc781044ee01b059f3702c580e66266b84c5 (tag: v3.4.10):

$ wget 'https://github.com/python/cpython/pull/13889.patch'
$ git apply 13889.patch
$ ./python -m test  -F -m test_threads_join_2  test_threading
[  1] test_threading
[  2] test_threading
(...)
[ 10] test_threading
[ 11] test_threading
Fatal Python error: Py_EndInterpreter: not the last thread

Current thread 0x7f418b3280c0 (most recent call first):
  File "/home/vstinner/prog/python/3.4/Lib/test/support/__init__.py", line 2304 
in run_in_subinterp
  File "/home/vstinner/prog/python/3.4/Lib/test/test_threading.py", line 877 in 
test_threads_join_2
  (...)
Aborted (core dumped)

--

___
Python tracker 

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



[issue37218] Default hmac.new() digestmod has not been removed from documentation

2019-06-10 Thread Alex Willmer


New submission from Alex Willmer :

Until Python 3.8 hmc.new() defaulted the digestmod argument to 'hmac-md5'. This 
was deperecated, to be removed in Python 3.8. In Python 3.8.0b1 it is gone, e.g.

Python 3.8.0b1 (default, Jun  6 2019, 03:44:52) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hmac
>>> hmac.new(b'qwertyuiop').name
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/hmac.py", line 146, in new
return HMAC(key, msg, digestmod)
  File "/usr/lib/python3.8/hmac.py", line 49, in __init__
raise ValueError('`digestmod` is required.')
ValueError: `digestmod` is required.

but the deprecation note, and the documented signature haven't been updated.

PR incoming

--
assignee: docs@python
components: Documentation
messages: 345144
nosy: Alex.Willmer, docs@python
priority: normal
severity: normal
status: open
title: Default hmac.new() digestmod has not been removed from documentation
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



[issue37218] Default hmac.new() digestmod has not been removed from documentation

2019-06-10 Thread Alex Willmer


Alex Willmer  added the comment:

Scratch the part about documented signature, it's still `hmac.new(... 
digestmod=None)`, the check happens in the body of the function

--

___
Python tracker 

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



[issue24412] setUpClass equivalent for addCleanup

2019-06-10 Thread Lisa Roach


Change by Lisa Roach :


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



[issue37218] Default hmac.new() digestmod has not been removed from documentation

2019-06-10 Thread Alex Willmer


Change by Alex Willmer :


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

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

threading._shutdown() uses threading.enumerate() which iterations on 
threading._active.

threading.Thread registers itself into threading._active using its 
_bootstrap_inner() method. It unregisters itself when _bootstrap_inner() 
completes, whereas its is_alive() method still returns true: since the 
underlying native thread still runs and the Python thread state still exists.

_thread._set_sentinel() creates a lock and registers a tstate->on_delete 
callback to release this lock. It's called by 
threading.Thread._set_tstate_lock() to set threading.Thread._tstate_lock. This 
lock is used by threading.Thread.join() to wait until the thread completes.


_thread.start_new_thread() calls the C function t_bootstrap() which ends with:

tstate->interp->num_threads--;
PyThreadState_Clear(tstate);
PyThreadState_DeleteCurrent();
PyThread_exit_thread();

_PyThreadState_DeleteCurrent() calls tstate->on_delete() which releases 
threading.Thread._tstate_lock lock.

In test_threads_join_2() test, PyThreadState_Clear() blocks on clearing thread 
variables: the Sleeper destructor of the Sleeper instance sleeps.

The race condition is that:

* threading._shutdown() rely on threading._alive
* Py_EndInterpreter() rely on the interpreter linked list of Python thread 
states: interp->tstate_head.

--

___
Python tracker 

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



[issue37219] empty set difference does not check types of values

2019-06-10 Thread Anthony Sottile


New submission from Anthony Sottile :

This is a regression from python2.x behaviour:

$ python2
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = set()
>>> x.difference(123)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is not iterable


$ python3.8
Python 3.8.0b1 (default, Jun  6 2019, 03:44:52) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = set()
>>> x.difference(123)
set()

The regression appears to be introduced in this patch: 4103e4dfbce

https://github.com/python/cpython/commit/4103e4dfbce

--
components: Library (Lib)
messages: 345147
nosy: Anthony Sottile, rhettinger
priority: normal
severity: normal
status: open
title: empty set difference does not check types of values
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



[issue36905] test_typing.GetTypeHintTests.test_get_type_hints_modules_forwardref unexpected success while running whole test suite sequentially

2019-06-10 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Unexpected success of test_get_type_hints_modules_forwardref  
in test_typing

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13816
pull_request: https://github.com/python/cpython/pull/13948

___
Python tracker 

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



[issue37220] test_idle crash on Windows when run with -R:

2019-06-10 Thread Zachary Ware


New submission from Zachary Ware :

See for example https://buildbot.python.org/all/#/builders/33/builds/613

This build ended when I logged into the machine and clicked the "Close the 
program" button on the "python_d.exe crashed" dialog box.  Here's the details 
from that dialog:

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: python_d.exe
  Application Version:  0.0.0.0
  Application Timestamp:5cfe5fd5
  Fault Module Name:tk85g.dll
  Fault Module Version: 8.5.2.19
  Fault Module Timestamp:   5bf46c38
  Exception Code:   c005
  Exception Offset: 0002ef7f
  OS Version:   6.3.9600.2.0.0.256.27
  Locale ID:1033
  Additional Information 1: 0d70
  Additional Information 2: 0d701a26b222a63773c5247c2c1f6fa1
  Additional Information 3: 044d
  Additional Information 4: 044dd28b2ab7dea188c1da19a590076d



Bisection shows that the issue showed up with 
1b57ab5c6478b93cf4150bd8c475022252776598 in bpo-37177.

--
assignee: terry.reedy
components: IDLE, Windows
keywords: buildbot
messages: 345148
nosy: paul.moore, steve.dower, taleinat, terry.reedy, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: test_idle crash on Windows when run with -R:
versions: Python 2.7

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Other references to test_threads_join_2() failures:

* bpo-36989: fails once AIX
* bpo-27791: 2 failures in 2016 in "AMD64 FreeBSD 10 Shared 3.x" buildbots (I 
closed the issue with: "Sadly, such bug is hard to reproduce. I didn't look at 
buildbots recently, and I don't have access to FreeBSD, so I just close the 
issue :-/")
* bpo-28084: once failure on "AMD64 FreeBSD 9.x 3.x" buildbot (closed as a 
duplicate of bpo-27791)

See also bpo-18808: "Thread.join returns before PyThreadState is destroyed" 
(issue which added the test).

--

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13817
pull_request: https://github.com/python/cpython/pull/13949

___
Python tracker 

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



[issue33591] ctypes does not support fspath protocol

2019-06-10 Thread Robert


Robert  added the comment:

Can anyone do a review?

--

___
Python tracker 

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



[issue36402] test_threading: test_threads_join_2() failed with "Fatal Python error: Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

test_threading: test_threads_join_2() was added by commit 7b47699 in 2013, but 
the test failed randomly since it was added. It's just that failures were 
ignored until I created https://bugs.python.org/issue36402 last March.

In fact, when the test failed randomly on buildbot (with tests run in 
parallel), it was fine since test_threading was re-run alone and then the test 
passed. The buildbot build was seen overall as a success. Previous issues were 
closed (see my previous comment).

The test shows the bug using subinterpreters (Py_EndInterpreter), but the bug 
also exists in Py_Finalize() which hash the same race condition (it also calls 
threading._shutdown()). It's just that Py_EndInterpreter() is stricter, it 
contains this assertion:

if (tstate != interp->tstate_head || tstate->next != NULL)
Py_FatalError("Py_EndInterpreter: not the last thread");

Attached py_finalize.patch adds the same assertion to Py_Finalize.

I added test_threading.test_finalization_shutdown() to PR 13948. If you run 
test_finalization_shutdown() with py_finalize.patch, Py_Finalize() fails with a 
similar assertion error.

But py_finalize.patch is incompatible with the principle of daemon threads and 
so cannot be commited.

--
Added file: https://bugs.python.org/file48409/py_finalize.patch

___
Python tracker 

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



[issue36402] threading._shutdown() race condition: test_threading test_threads_join_2() fails randomly

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_threading: test_threads_join_2() failed with "Fatal Python error: 
Py_EndInterpreter: not the last thread" on AMD64 FreeBSD CURRENT Shared 3.x -> 
threading._shutdown() race condition: test_threading test_threads_join_2() 
fails randomly

___
Python tracker 

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



[issue18808] Thread.join returns before PyThreadState is destroyed

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

_thread._set_sentinel() and threading.Thread._tstate_lock is a great 
enhancement, as Py_EndInterprter() which now calls threading._shutdown().

FYI I found yet another race condition, this time in threading._shutdown(). See 
bpo-36402 follow-up: "threading._shutdown() race condition: test_threading 
test_threads_join_2() fails randomly".

--
nosy: +vstinner

___
Python tracker 

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



[issue37221] PyCode_New API change breaks backwards compatibility policy

2019-06-10 Thread Nick Coghlan


New submission from Nick Coghlan :

The Porting section of the What's New guide is for changes where the old 
behaviour was at best arguably correct, but it's still possible someone was 
relying on it behaving exactly the way it used to.

It isn't for us to say "We broke all extensions that use this existing public C 
API by adding a new parameter to its signature".

For 3.8b2, the function with the extra parameter should be renamed to 
PyCode_NewEx, and a PyCode_New compatibility wrapper added that calls it with 
the extra parameter set to zero.

--
keywords: 3.8regression
messages: 345153
nosy: lukasz.langa, ncoghlan, pablogsal
priority: release blocker
severity: normal
stage: needs patch
status: open
title: PyCode_New API change breaks backwards compatibility policy
type: compile error
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



[issue37221] PyCode_New API change breaks backwards compatibility policy

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

PyCode_New() and types.CodeType constructor are actively discussed:

* 
https://mail.python.org/archives/list/python-...@python.org/thread/VXDPH2TUAHNPT5K6HBUIV6VASBCKKY2K/
* bpo-36896
* bpo-36886

--
nosy: +vstinner

___
Python tracker 

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



[issue37222] urllib missing voidresp breaks CacheFTPHandler

2019-06-10 Thread Dan Hemberger


New submission from Dan Hemberger :

When using the CacheFTPHandler in the most basic of contexts, a URLError will 
be thrown if you try to reuse any of the FTP instances stored in the handler. 
This makes CacheFTPHandler unusable for its intended purpose. Note that the 
default FTPHandler circumvents this issue by creating a new ftplib.FTP instance 
for each connection (and thus never reuses any of them).

Here is a simple example illustrating the problem:

"""
import urllib.request as req 
import ftplib

opener = req.build_opener(req.CacheFTPHandler)
req.install_opener(opener)

ftplib.FTP.debugging = 2 

for _ in range(2):
req.urlopen("ftp://www.pythontest.net/README";, timeout=10)
"""

>From the ftplib debugging output, we see the following communication between 
>the client and server:

"""
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (159,89,235,38,39,111).\n'
*resp* '227 Entering Passive Mode (159,89,235,38,39,111).'
*cmd* 'RETR README'
*put* 'RETR README\r\n'
*get* '150 Opening BINARY mode data connection for README (123 bytes).\n'
*resp* '150 Opening BINARY mode data connection for README (123 bytes).'
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '226 Transfer complete.\n'
*resp* '226 Transfer complete.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '200 Switching to Binary mode.\n'
*resp* '200 Switching to Binary mode.'
ftplib.error_reply: 200 Switching to Binary mode.
"""

The client and the server have gotten out of sync due to the missing voidresp() 
call, i.e. the client sends 'Type I' but receives the response from the 
previous 'RETR README' command. When ftp.voidresp() is added anywhere between 
after the ftp.ntransfercmd() and before the next command is sent (i.e. by 
reverting 2d51f687e133fb8141f1a6b5a6ac51c9d5eddf58), we see the correct 
send/receive pattern:

"""
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (159,89,235,38,39,107).\n'
*resp* '227 Entering Passive Mode (159,89,235,38,39,107).'
*cmd* 'RETR README'
*put* 'RETR README\r\n'
*get* '150 Opening BINARY mode data connection for README (123 bytes).\n'
*resp* '150 Opening BINARY mode data connection for README (123 bytes).'
*get* '226 Transfer complete.\n'
*resp* '226 Transfer complete.'
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (159,89,235,38,39,107).\n'
*resp* '227 Entering Passive Mode (159,89,235,38,39,107).'
*cmd* 'RETR README'
*put* 'RETR README\r\n'
*get* '150 Opening BINARY mode data connection for README (123 bytes).\n'
*resp* '150 Opening BINARY mode data connection for README (123 bytes).'
*get* '226 Transfer complete.\n'
*resp* '226 Transfer complete.'
"""

By inspecting the methods of ftplib.FTP, we can see that every use of 
ntransfercmd() is followed by a voidresp(), see e.g. retrbinary, retrlines, 
storbinary, storlines, and voidcmd.

I hope that some experts in urllib and ftplib can weigh in on any of the 
subtleties of this issue, but I think it's clear that the missing 
ftp.voidresp() call is a significant bug.

--
Some historical notes about this issue
--

This issue has been documented in a number of other bug reports, but I don't 
think any have addressed the complete breakage of the CachedFTPHandler that it 
causes.

The breaking change was originally introduced as a resolution to issue16270. 
However, it's not clear from the comments why it was believed that removing 
ftp.voidresp() from endtransfer() was the correct solution. In either case, 
with this commit reverted, both the test outlined in this report and in 
issue16270 work correctly.

@orsenthil has suggested this fix (to revert the change to endtransfer) in 
msg286020, and has explained his reasoning in detail in msg286016.

@Ivan.Pozdeev has also explained this issue in msg282797 and provided a similar 
patch in issue28931, though it does more than just revert the breaking commit 
and I'm not sure what the additional changes are intending to fix.

--
components: Library (Lib)
messages: 345155
nosy: danh
priority: normal
severity: normal
status: open
title: urllib missing voidresp breaks CacheFTPHandler
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



[issue36373] Deprecate explicit loop parameter in all public asyncio APIs

2019-06-10 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
pull_requests: +13818
pull_request: https://github.com/python/cpython/pull/13950

___
Python tracker 

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



[issue16270] urllib hangs when closing connection

2019-06-10 Thread Dan Hemberger


Change by Dan Hemberger :


--
pull_requests: +13820
pull_request: https://github.com/python/cpython/pull/13951

___
Python tracker 

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



[issue37222] urllib missing voidresp breaks CacheFTPHandler

2019-06-10 Thread Dan Hemberger


Change by Dan Hemberger :


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

___
Python tracker 

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



[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-37223: test_io logs Exception ignored in:  warnings.

--

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


New submission from STINNER Victor :

bpo-18748 modified io.IOBase finalizer to no longer silence close() exception 
in develoment and in debug mode.

The commit 472f794a33221ea835a2fbf6c9f12aa2bd66d1b0 fixed a few destructor 
errors in test_io, but there are still a few:

test_uninitialized (test.test_io.PyBufferedReaderTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 836, in raw
return self._raw
AttributeError: 'BufferedReader' object has no attribute '_raw'
ok

test_max_buffer_size_removal (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
with self._write_lock:
AttributeError: 'BufferedWriter' object has no attribute '_write_lock'
ok

test_misbehaved_io (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1308, in close
self.flush()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1269, in flush
self._flush_unlocked()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1285, in 
_flush_unlocked
raise OSError("write() returned incorrect number of bytes")
OSError: write() returned incorrect number of bytes
ok

test_uninitialized (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
with self._write_lock:
AttributeError: 'BufferedWriter' object has no attribute '_write_lock'
ok

test_writer_close_error_on_close (test.test_io.CBufferedRWPairTest) ...
Exception ignored in: <_io.BufferedWriter>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 611, in 
_callTestMethod
method()
ValueError: flush of closed file
ok

test_constructor_max_buffer_size_removal (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_constructor_with_not_readable (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_constructor_with_not_writeable (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_isatty (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
self.reader.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: 
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1300, in close
if self.raw is None or se

[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests:  -13234

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-36918 (test_urllib) and bpo-37069 (regrtest: log unraisable 
exceptions and uncaught thread exceptions).

--

___
Python tracker 

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



[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13821
pull_request: https://github.com/python/cpython/pull/13952

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

PR 13952 fix many errors, but not of all them.

test_io.PyBufferedWriterTest.test_misbehaved_io() logs a warning, whereas 
test_io.CBufferedWriterTest.test_misbehaved_io() doesn't. It seems like 
_pyio.BufferedWriter lacks bpo-32228 fix.

Extract of the C implementation:

static PyObject *
_bufferedwriter_flush_unlocked(buffered *self)
{
...

if (!VALID_WRITE_BUFFER(self) || self->write_pos == self->write_end)
goto end;

/* First, rewind */
rewind = RAW_OFFSET(self) + (self->pos - self->write_pos);
if (rewind != 0) {
n = _buffered_raw_seek(self, -rewind, 1);
if (n < 0) {
goto error;
}
self->raw_pos -= rewind;
}
...


end:
/* This ensures that after return from this function,
   VALID_WRITE_BUFFER(self) returns false.

   This is a required condition because when a tell() is called
   after flushing and if VALID_READ_BUFFER(self) is false, we need
   VALID_WRITE_BUFFER(self) to be false to have
   RAW_OFFSET(self) == 0.

   Issue: https://bugs.python.org/issue32228 */
_bufferedwriter_reset_buf(self);
Py_RETURN_NONE;

error:
return NULL;
}

--

___
Python tracker 

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



[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4f6f7c5a611905fb6b81671547f268c226bc646a by Victor Stinner in 
branch 'master':
bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)
https://github.com/python/cpython/commit/4f6f7c5a611905fb6b81671547f268c226bc646a


--

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

New changeset 4f6f7c5a611905fb6b81671547f268c226bc646a by Victor Stinner in 
branch 'master':
bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)
https://github.com/python/cpython/commit/4f6f7c5a611905fb6b81671547f268c226bc646a

--

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue37224] test__xxsubinterpreters failed on AMD64 Windows8.1 Refleaks 3.8

2019-06-10 Thread STINNER Victor


New submission from STINNER Victor :

https://buildbot.python.org/all/#/builders/224/builds/5

0:46:02 load avg: 1.53 [259/423/1] test__xxsubinterpreters failed -- running: 
test_httplib (1 min 6 sec), test_mmap (16 min 42 sec)
beginning 6 repetitions
123456
..Exception in thread Thread-28:
Traceback (most recent call last):
  File "D:\buildarea\3.8.ware-win81-release.refleak\build\lib\threading.py", 
line 923, in _bootstrap_inner
self.run()
  File "D:\buildarea\3.8.ware-win81-release.refleak\build\lib\threading.py", 
line 865, in run
self._target(*self._args, **self._kwargs)
  File 
"D:\buildarea\3.8.ware-win81-release.refleak\build\lib\test\test__xxsubinterpreters.py",
 line 51, in run
interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 182
test test__xxsubinterpreters failed -- Traceback (most recent call last):
  File 
"D:\buildarea\3.8.ware-win81-release.refleak\build\lib\test\test__xxsubinterpreters.py",
 line 492, in test_subinterpreter
self.assertTrue(interpreters.is_running(interp))
AssertionError: False is not true

(...)

FAIL: test_still_running (test.test__xxsubinterpreters.DestroyTests)
--
Traceback (most recent call last):
  File 
"D:\buildarea\3.8.ware-win81-release.refleak\build\lib\test\test__xxsubinterpreters.py",
 line 765, in test_still_running
interpreters.destroy(interp)
AssertionError: RuntimeError not raised

--
components: Tests
messages: 345162
nosy: eric.snow, vstinner
priority: normal
severity: normal
status: open
title: test__xxsubinterpreters failed on AMD64 Windows8.1 Refleaks 3.8
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



[issue37224] test__xxsubinterpreters failed on AMD64 Windows8.1 Refleaks 3.8

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

See bpo-33356.

--

___
Python tracker 

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



[issue36918] ValueError warning in test_urllib due to io.IOBase destructor

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests:  -13428

___
Python tracker 

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



[issue36918] ValueError warning in test_urllib due to io.IOBase destructor

2019-06-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13823
pull_request: https://github.com/python/cpython/pull/13955

___
Python tracker 

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



[issue36402] threading._shutdown() race condition: test_threading test_threads_join_2() fails randomly

2019-06-10 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue36918] ValueError warning in test_urllib due to io.IOBase destructor

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Well, maybe Python GC can be enhanced. In the meanwhile, I would like to make 
these warnings quiet since they are very annoying when I have to analyze 
buildbot warnings. Moreover, this issues blocks my bpo-37069.

Maybe open a separated issue to propose to enhance the GC, if you have an idea 
how to change it.

--

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b589cef9c4dada2fb84ce0fae5040ecf16d9d5ef by Victor Stinner in 
branch 'master':
bpo-37223: test_io: silence destructor errors (GH-13954)
https://github.com/python/cpython/commit/b589cef9c4dada2fb84ce0fae5040ecf16d9d5ef


--

___
Python tracker 

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



[issue37223] test_io logs Exception ignored in: warnings

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

Once bpo-36918 will be fixed, I will backport changes to Python 3.8.

--

___
Python tracker 

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



[issue36918] ValueError warning in test_urllib due to io.IOBase destructor

2019-06-10 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed PR 13955: a fix in 2 lines.

--

___
Python tracker 

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



[issue37221] PyCode_New API change breaks backwards compatibility policy

2019-06-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks, Nick for opening this issue. If everyone agrees this is the best path 
forward I can make a PR. Take into account that doing such rename will break 
again the projects that have adapted already (primarily only Cython). I would 
like to give some context around the change itself.

* Last time the function was changed in commit 
4f72a78684bbfcdc43ceeabb240ceee54706c4b0 (for adding keyword-only parameters) a 
wrapper was not created or a new compatibility layer was not created. This 
happened as well in the past when the function slowly growed from 3 parameters 
in 1990 to 16 parameters currently. If we decide to provide the wrapper, this 
would be the first time we do this for changes in this function.

* In the past, backwards incompatible changes that came from syntax changes 
were reported in the What's New. For example, in Python3.6 we added "async and 
await names are now reserved keywords. Code using these names as identifiers 
will now raise a SyntaxError" in the porting session and one could argue that 
that broke more code than this change. I am not saying this to justify breaking 
changes, just to give more context of somehow similar situations on how we 
report changes that we knew that were backwards incompatible due to new 
features.

* A quick (and I acknowledge that is partial and incomplete) search in GitHub 
about usages of PyCode_New excluding interpreter files to avoid forks and the 
like, points mainly at Cython (and Pyrex forks). Cython already adapted to this 
change, so changing it back will break Cython and all other possible extensions 
that already adapted after the last alpha.

* In the email thread 
https://mail.python.org/archives/list/python-...@python.org/thread/VXDPH2TUAHNPT5K6HBUIV6VASBCKKY2K/,
 Stefan Behnel (who is also a Cython maintainer) said in relation to adding 
PyCode_NewEx:

>It's not a commonly used function, and it's easy for C code to adapt. I
>don't think it's worth adding a new function to the C-API here, compared to
>just changing the signature. Very few users would benefit, at the cost of
>added complexity.

--

___
Python tracker 

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



[issue37220] test_idle crash on Windows when run with -R:

2019-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The #37177 patch touched SearchDialogBase.py and test_searchdialogbase.py.  I 
reproduced a premature stop if the full IDLE suite is run, but don't understand 
all of the results.

After fresh update and rebuild:
python -m test -ugui test_idle
3.9 runs fine, no noise
2.7 runs fine except for 2 '''can't invoke "event" command:...'''s

python -m test -R3:3 -ugui -m SearchDialogBaseTest test_idle
3.9 runs fine, no noise
2.7 runs fine, no noise (so from other tests)

python -m test -R3:3 -ugui test_idle
3.9 runs fine, but 18 instances of "can't invoke "event" command:..."
# ==> noise from other tests, only with -R
2.7 prints 2 "can'ts" and one "complete a round '.'.  After a pause, presumibly 
to run round 2, it exits to the Windows prompt.

Commenting out "self.top.transient('')" in close() solves the problem.  There 
is some interaction between running 2.7 (versus 3.x), tcl/tk 8.5.19 (versus 
8.6), testing with -R, running other IDLE test files, and disabling 'transient' 
(back to default).  (Tal, this sort of thing is part of why I don't backport to 
2.7.)

An alternate fix for me is a slight change in the test cleanup.  Preparing PRs.

--

___
Python tracker 

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



[issue37220] test_idle crash on Windows when run with -R:

2019-06-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +13824
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/13957

___
Python tracker 

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



[issue37216] mac installation document wrong for python 3.7.3

2019-06-10 Thread makdon


makdon  added the comment:

Thanks xtreak. I am a beginner on python mailing list and now i've learn how to 
get a link to the email.


And i found a version error on windows installation document on version 3.6.8 
that the picture is still using version 3.5:

https://docs.python.org/3.6/using/windows.html#installation-steps

I will check them and create PR for it.

--

___
Python tracker 

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



  1   2   >