[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2019-04-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur that this should be closed. We have a decade of evidence that no one 
really needs this.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Steve Dower


Steve Dower  added the comment:

I don't recall where I got the empty string from, but it's certainly what I've 
used there for a while. Maybe it's required in register_namespace() to set the 
default namespace?

--

___
Python tracker 

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



[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2019-04-14 Thread ppperry


ppperry  added the comment:

See also issue32615

--
nosy: +ppperry

___
Python tracker 

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



[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Eric Wieser


Eric Wieser  added the comment:

> Revising the code example to use an empty array

I think you mean

>>> import array
>>> memoryview(array.array('H', [])).itemsize
2

Your example is an array containing 0, not an empty array - but the conclusion 
is the same.

> It is technically un-necessary as it can be obtained using 
> PyBuffer_SizeFromFormat

This obviously predicates on `PyBuffer_SizeFromFormat` being implemented, which 
according to the docs it is not.

> I think that the grammar would allow for an empty record "T{}" that would 
> have itemsize 0 but is of little use inside numpy.

It also allows for records of empty arrays, "T{(0)d:data:}". While these are of 
little use, they _are_ supported by both ctypes and numpy, so we should support 
them in the PEP3118 interface used between them.

--
nosy: +Eric Wieser

___
Python tracker 

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



[issue36619] when is os.posix_spawn(setsid=True) safe?

2019-04-14 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +nanjekyejoannah, vstinner

___
Python tracker 

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



[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Stefan Krah


Stefan Krah  added the comment:

I agree that it is a ctypes issue, itemsize should be equal to 
struct.calcsize(fmt), which is never 0 for normal PEP-3118 types like the one 
in the example.



[Pedantically, I think that the grammar would allow for an empty record "T{}" 
that would have itemsize 0 but is of little use inside numpy.]

--

___
Python tracker 

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2019-04-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Fixing one case is better than fixing no cases.

--
nosy: +skrah, terry.reedy

___
Python tracker 

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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-14 Thread Michael Felt

Michael Felt  added the comment:

On 14/04/2019 18:04, Michael Felt wrote:
> Is this a good way to get started?

So, as an example - seems to be many attributes in test/support/__init__.py

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 5bd15a2..e20567f 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -101,6 +101,8 @@ __all__ = [
 # network
 "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port",
"open_urlresource",
 "bind_unix_socket",
+    # platform
+    "is_aix",
 # processes
 'temp_umask', "reap_children",
 # logging
@@ -815,6 +817,7 @@ requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
 requires_lzma = unittest.skipUnless(lzma, 'requires lzma')

 is_jython = sys.platform.startswith('java')
+is_aix = platform.system() == 'AIX'

 is_android = hasattr(sys, 'getandroidapilevel')

diff --git a/Lib/test/test_c_locale_coercion.py
b/Lib/test/test_c_locale_coercion.py
index 35272b5..0685ed8 100644
--- a/Lib/test/test_c_locale_coercion.py
+++ b/Lib/test/test_c_locale_coercion.py
@@ -10,6 +10,7 @@ import unittest
 from collections import namedtuple

 from test import support
+is_aix = support.is_aix
 from test.support.script_helper import (
 run_python_until_end,
 interpreter_requires_environment,
@@ -40,7 +41,7 @@ if sys.platform.startswith("linux"):
 # TODO: Once https://bugs.python.org/issue30672 is addressed,
we'll be
 #   able to check this case unconditionally
 EXPECTED_C_LOCALE_EQUIVALENTS.append("POSIX")
-elif sys.platform.startswith("aix"):
+elif is_aix:
 # AIX uses iso8859-1 in the C locale, other *nix platforms use ASCII
 EXPECTED_C_LOCALE_STREAM_ENCODING = "iso8859-1"
 EXPECTED_C_LOCALE_FS_ENCODING = "iso8859-1"

I had originally been thinking using _AIX, but the convention seems to
be is_xyzsomething.

Comments welcome.

--

___
Python tracker 

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



[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

https://docs.python.org/3/library/stdtypes.html#typememoryview
says "itemsize The size in bytes of each element of the memoryview"
Revising the code example to use an empty array:
>>> import array, struct
>>> m = memoryview(array.array('H', [0])
>>> m.itemsize
2
I agree that itemsize should also be non-zero for ctype formats.

--
title: memoryview & ctypes: incorrect PEP3118 itemsize for empty array -> 
memoryview & ctypes: incorrect itemsize for empty array

___
Python tracker 

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



[issue32782] memoryview & ctypes: incorrect PEP3118 itemsize for empty array

2019-04-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This is actually about memoryview.itemsize within ctypes.

--
components: +ctypes
title: memoryview gives incorrect PEP3118 itemsize for empty array -> 
memoryview & ctypes: incorrect PEP3118 itemsize for empty array

___
Python tracker 

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



[issue32782] ctypes: memoryview gives incorrect PEP3118 itemsize for array of length zero

2019-04-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This issue is about the itemsize attribute of instances of the built-in 
memoryview class.  Ctypes in only involved in providing format information.  
Hence the nosy additions.

On Win10 with 3.8, ctypes has no uint attributes.  Using 'c_int32' instead, I 
see the same behavior (itemsize 0 for empty structure).

About itemsize, https://www.python.org/dev/peps/pep-3118/ says

"This is a storage for the itemsize (in bytes) of each element of the shared 
memory. It is technically un-necessary as it can be obtained using 
PyBuffer_SizeFromFormat, however an exporter may know this information without 
parsing the format string and it is necessary to know the itemsize for proper 
interpretation of striding. Therefore, storing it is more convenient and 
faster."

The first line could be seen as implying that itemsize is undefined if there 
are no items (and as justifying numbytes/numitems otherwise).  The 0 return 
could be seen as equivalent to a None return from a python-coded function.  If 
so, it is not a bug, and there might be code that would break if it is changed.

On the other hand, the next lines imply that itemsize is *usually*, though not 
necessarily, a cache for PyBuffer_SizeFromFormat.  This could be seen as 
implying that in the absence of other information, the itemsize should be 
calculated from the format, making 0 a bug.

--
components: +Interpreter Core -ctypes
nosy: +skrah, teoliphant, terry.reedy
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue32782] memoryview gives incorrect PEP3118 itemsize for empty array

2019-04-14 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: ctypes: memoryview gives incorrect PEP3118 itemsize for array of length 
zero -> memoryview gives incorrect PEP3118 itemsize for empty array

___
Python tracker 

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



[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2019-04-14 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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

___
Python tracker 

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



[issue27326] SIGSEV in test_window_funcs of test_curses

2019-04-14 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

Cannot reproduce the crash with Python 3.7.3 on ncurses 6.1.

--
resolution:  -> out of date
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



[issue36630] failure of test_colors_funcs in test_curses with ncurses 6.1

2019-04-14 Thread Xavier de Gaye

New submission from Xavier de Gaye :

ncurses version: 6.1
TERM: screen-256color

$  ./python -m test -u curses test_curses
Run tests sequentially
0:00:00 load avg: 0.55 [1/1] test_curses
test test_curses failed -- Traceback (most recent call last):
  File "/path/to/Lib/test/test_curses.py", line 285, in test_colors_funcs
curses.pair_content(curses.COLOR_PAIRS - 1)
OverflowError: signed short integer is greater than maximum

test_curses failed

== Tests result: FAILURE ==


Not sure if the following is relevant.

In /usr/include/ncurses.h:

NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
...
#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
...
extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;

ncurses 6.1 release notes [1] says:

The TERMINAL structure in  is now opaque. Doing that allowed making 
the structure larger, to hold the extended numeric data.
...
The new data in TERMINAL holds the same information as TERMTYPE, but with 
larger numbers (“int” versus “short”). It is named TERMTYPE2.

[1] https://www.gnu.org/software/ncurses/

--
components: Tests
messages: 340228
nosy: xdegaye
priority: normal
severity: normal
status: open
title: failure of test_colors_funcs in test_curses with ncurses 6.1
type: behavior
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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset 3c5a858ec6a4e5851903762770fe526a46d3c351 by Stefan Behnel in 
branch 'master':
bpo-30485: Re-allow empty strings in ElementPath namespace mappings since they 
might actually be harmless and unused (and thus went undetected previously). 
(#12830)
https://github.com/python/cpython/commit/3c5a858ec6a4e5851903762770fe526a46d3c351


--

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel

Stefan Behnel  added the comment:

The script seems to generally assume that "" is a good representation for "no 
prefix", i.e. the default namespace, although that is IMHO more correctly 
represented as None. It's not very likely that this is the only script out 
there that makes that assumption.

In fact, this might not be an entirely stupid assumption, given that None 
doesn't sort together with strings, for example. And sorting prefixes is not an 
unusual thing to do.

That makes it a case of "practicality beats purity", I guess …

I'll change the implementation to allow empty strings.

--
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function

2019-04-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Test that your fix does not break the case of 8-bit non-ascii docstring.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The relevant line is at 
https://github.com/python/cpython/blob/cd466559c4a312b3c1223a774ad4df19fc4f0407/PC/layout/support/appxmanifest.py#L407
 . I guess it's something related to build artifacts for Windows and Steve can 
have a better answer over the file's usage and this specific line of change.

--
nosy: +steve.dower

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

Interesting. Thanks for investigating this. It looks like the script 
"appxmanifest.py" uses an empty string as prefix for a lookup:

  File "D:\a\1\s\PC\layout\support\appxmanifest.py", line 407, in 
get_appxmanifest
node = xml.find("m:Identity", NS)

I don't know where that script comes from, but it suggests that strictly 
rejecting this kind of invalid library usage might not be the right thing to do 
for now. It seems to be a case where users pass an arbitrary prefix-namespace 
dict into .find() that they happen to have lying around, expecting unused 
mappings to be ignored. I pushed a PR that removes the exception for now.

--

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel


Change by Stefan Behnel :


--
pull_requests: +12755

___
Python tracker 

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2019-04-14 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.6

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I am not sure but this commit seems to have broken Azure CI on master for 
Windows. The build checks were green when the PR while merging. I can see the 
ValueError added in e9927e1820caea01e576141d9a623ea394d43dad raised in the 
below CI log and it's occurring consistently

https://dev.azure.com/Python/cpython/_build/results?buildId=40862=logs=0fcf9c9b-89fc-526f-8708-363e467e119e=ae411532-3d9e-5cb2-bb36-07007cc5bb48=37=38=1=1

--
nosy: +xtreak

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread miss-islington


miss-islington  added the comment:


New changeset 9f9e029bd2223ecba46eaefecadf0ac252d891f2 by Miss Islington (bot) 
in branch '3.7':
bpo-16079: fix duplicate test method name in test_gzip. (GH-12827)
https://github.com/python/cpython/commit/9f9e029bd2223ecba46eaefecadf0ac252d891f2


--
nosy: +miss-islington

___
Python tracker 

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



[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function

2019-04-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is still an issue with latest 2.7. I went ahead and created PR based on 
Victor's suggestion in msg121294. I am not sure of the correct way to test this 
I have used cStringIO.StringIO as the stream for a test case with a unicode 
description along with setting default encoding as 'ascii'. I tested the 
original report to make sure the patch fixes the error.

$ PYTHONIOENCODING=ascii ./python.exe ../backups/bpo10417.py --verbose
test_unicode_docstring (__main__.UnicodeTest)
t\xe4st - docstring with unicode character ... ok

--
Ran 1 test in 0.004s

OK

--
nosy: +xtreak
stage: patch review -> test needed

___
Python tracker 

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



[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function

2019-04-14 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
keywords: +patch
pull_requests: +12754
stage: test needed -> patch review

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
type: enhancement -> behavior

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12753

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset cd466559c4a312b3c1223a774ad4df19fc4f0407 by Gregory P. Smith in 
branch 'master':
bpo-16079: fix duplicate test method name in test_gzip. (GH-12827)
https://github.com/python/cpython/commit/cd466559c4a312b3c1223a774ad4df19fc4f0407


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
components: +Tests

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +easy
versions: +Python 3.7, Python 3.8 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-14 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +12752
stage:  -> patch review

___
Python tracker 

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



[issue36608] Replace bundled pip and setuptools with a downloader in the ensurepip module

2019-04-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I proposed to move bundled pip and setuptools to the external repository and 
download them at build time like Tcl and other dependencies on Windows.

--

___
Python tracker 

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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-14 Thread Michael Felt


Michael Felt  added the comment:

I took a peak at test.support.

a) I see that while many tests import test.support, or from test.support import 
 - not all tests use this.

b) I see that only 35 .py files in Lib/test have the string 
sys.platform.startswith, and there are 76 files that have sys.platform (so, 
there are roughly 40 files that have sys.platform without startswith).

I can start by adding _AIX to test.support and adding (as needed) from 
test.support import _AIX (and later _Linux, _Darwin) in the "35" files. If that 
seems to be working - and looking - proper the other 40 files could be added to 
the change.

Is this a good way to get started?

--

___
Python tracker 

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



[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Dan Timofte


Dan Timofte  added the comment:

i will provide a patch, i'll make a pull request next week.

a call to self._write_to_self() should also be added to create_task() before it 
returns . i'll make the correction for this as well.

--

___
Python tracker 

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



[issue36629] imaplib test fails with errno 101

2019-04-14 Thread Marat Sharafutdinov


Marat Sharafutdinov  added the comment:

I see this error on my local Bamboo CI (runs on CentOS 7).

--

___
Python tracker 

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



[issue36629] imaplib test fails with errno 101

2019-04-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Did you see this failure somewhere in CI or is it in local machine? The imaplib 
test has below comment : 

if hasattr(errno, 'EADDRNOTAVAIL'):
# socket.create_connection() fails randomly with
# EADDRNOTAVAIL on Travis CI.
expected_errnos.append(errno.EADDRNOTAVAIL)

As noted in initial report test_socket has ENETUNREACH added 
https://github.com/python/cpython/blob/929b70473829f04dedb8e802abcbd506926886e1/Lib/test/test_socket.py#L4808
 so ENETUNREACH could also be added to this test too?

--
nosy: +barry, r.david.murray, vstinner, xtreak

___
Python tracker 

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



[issue36628] Enhancement: i-Strings

2019-04-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Some discussions in the past and the common suggestion/idiom is to use 
textwrap.dedent. I agree with @SilentGhost that it should be first brought up 
in python-ideas and also addressing the concerns for similar proposal in the 
past if they are still valid.

Proposes d"" for indentation : 
https://mail.python.org/pipermail/python-ideas/2010-November/008589.html
https://mail.python.org/pipermail/python-dev/2005-July/054649.html

--
nosy: +xtreak

___
Python tracker 

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



[issue36629] imaplib test fails with errno 101

2019-04-14 Thread Marat Sharafutdinov


New submission from Marat Sharafutdinov :

==
FAIL: test_imap4_host_default_value (test.test_imaplib.TestImaplib)
--
Traceback (most recent call last):
  File "/home/python/Lib/test/test_imaplib.py", line 94, in 
test_imap4_host_default_value
self.assertIn(cm.exception.errno, expected_errnos)
AssertionError: 101 not found in [111, 99]

--

I guess `errno.ENETUNREACH` should be added to the `expected_errnos` as it done 
within `test_create_connection` (test.test_socket.NetworkConnectionNoServer).

--
components: Tests
messages: 340212
nosy: decaz
priority: normal
severity: normal
status: open
title: imaplib test fails with errno 101
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



[issue13127] xml.dom.Attr.name is not labeled as read-only

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

The intended interface seems to be to change .name rather than .localName, so 
yes, that should be documented somewhere.

The implementation seems a bit funny in that a "self._localName", if set, takes 
precedence, but there doesn't seem to be an official way to set it. The Attr() 
constructor even takes a "localname" argument, which it then ignores. o_O

--
components: +XML
stage: test needed -> needs patch
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



[issue36628] Enhancement: i-Strings

2019-04-14 Thread SilentGhost


SilentGhost  added the comment:

This type of enhancements should be in the first place discussed on 
python-ideas mailing list and a PEP would probably be needed at the second 
stage. Not that I think it's likely this suggestion has much chance.

What you're desiring can already be implemented using implicit string 
concatenation (with addition of some parentheses in some of your examples).

--
nosy: +SilentGhost
resolution:  -> postponed
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



[issue35967] Better platform.processor support

2019-04-14 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In PR 12824 (https://github.com/python/cpython/pull/12824), I've developed a 
test that should assure the current output from uname().processor.

I've merged those changes with PR 12239, which if the tests pass, should 
illustrate the values returned are unchanged.

@lemburg, would you be willing to review these PRs to confirm they capture and 
address your concern?

--

___
Python tracker 

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



[issue36628] Enhancement: i-Strings

2019-04-14 Thread Aditya Shankar


New submission from Aditya Shankar :

Problem: multiline strings are a pain to represent (other than of-course in 
docstrings), representing a multiline string inside a function looks something 
like this -

def foo():
# some code
...
...
# some code
text = """abc meta alpha chronos
dudes uptomes this text
is nonsense"""
return somethingwith(text)

or

def foo():
# some code
...
...
# some code
text = "\n".join(["abc meta alpha chronos",
  "dudes uptomes this text",
  "is nonsense"])
return somethingwith(text)

an enhancement would be - 

def foo():
# some code
...
...
# some code
text = i"""
abc meta alpha chronos
dudes uptomes this text
is nonsense
"""
return somethingwith(text)
i.e. all initial spaces are not considered as a part of the string in each ine

for example while throwing an exception -
def foo(bad_param):
...
try:
some_function_on(bad_param)
except someException:
throw(fi"""
you cant do that because, and I'm gonna explain
this in a paragraph of text with this {variable}
because it explains things more clearly, also
here is the {bad_param}
""")
...
which is far neater than -

def foo(bad_param):
...
try:
some_function_on(bad_param)
except someException:
throw(f"""you cant do that because, and I'm gonna explain
this in a paragraph of text with this {variable}
because it explains things more clearly, also
here is the {bad_param}""")
...

pros:
- represented code is closer to output text
- implementation should not be too hard

--
components: Interpreter Core
messages: 340208
nosy: Aditya Shankar
priority: normal
severity: normal
status: open
title: Enhancement: i-Strings
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



[issue13927] Document time.ctime format

2019-04-14 Thread Harmandeep Singh


Harmandeep Singh  added the comment:

I have updated the PR, this time I have kept it really simple, and have added 
examples showing both the cases.

--

___
Python tracker 

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



[issue13127] xml.dom.Attr.name is not labeled as read-only

2019-04-14 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Stefan,

Do you think this should be documented?

--
nosy: +cheryl.sabella, scoder

___
Python tracker 

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



[issue35278] [security] directory traversal in tempfile prefix

2019-04-14 Thread Oliver Bestwalter


Oliver Bestwalter  added the comment:

I am not sure if this justifies a new issue so I add this here.

The suffix parameter can also be used for a traversal attack. It is possible to 
completely clobber anything in dir and prefix (at least on Windows).

e.g. calling mkdtemp or NamedTemporaryFile with these paramers ...

dir=r"C:\tmp",
prefix="pre",
suffix="../../../../../../../../../gotcha"

Will result in a directory or file being created at C:/gotcha.

I also wonder if this would justify adding a warning to the documentation for 
all existing Python versions?

Quoting from the documentation of mkstemp 
(https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp):

> If prefix is specified, the file name will begin with that prefix; otherwise, 
> a default prefix is used.
>
> If dir is specified, the file will be created in that directory [...]

As both claims are rendered untrue when using suffix in the above described way 
I think this should be amended.

--
nosy: +obestwalter

___
Python tracker 

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



[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Callin `self._write_to_self()` from `loop.stop()` should fix your problem.

Would you provide a patch?

--

___
Python tracker 

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



[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue36627] composing generator expression doesn't work as expected

2019-04-14 Thread SilentGhost


SilentGhost  added the comment:

I probably won't be able to better explain the issue then Benjamin did in the 
referenced issue. Just to note, that (...) in your code are called generator 
expressions.

--
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> nested generator expression produces strange results
title: composing filter() doesn't work as expected -> composing generator 
expression doesn't work as expected

___
Python tracker 

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



[issue36231] no "proper" header files on macOS 10.14 Mojave

2019-04-14 Thread Dmitrii Pasechnik


Dmitrii Pasechnik  added the comment:

In case,I have opened PR https://github.com/python/cpython/pull/12825
to provide our solution to this issue.

--

___
Python tracker 

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



[issue36231] no "proper" header files on macOS 10.14 Mojave

2019-04-14 Thread Dmitrii Pasechnik


Change by Dmitrii Pasechnik :


--
pull_requests: +12750
stage:  -> patch review

___
Python tracker 

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



[issue36627] composing filter() doesn't work as expected

2019-04-14 Thread Tsvika Shapira


New submission from Tsvika Shapira :

the following code:

```
lists_to_filter = [
['a', 'exclude'],
['b']
]
# notice that when 'exclude' is the last element, the code returns the expected 
result
for exclude_label in ['exclude', 'something']:
lists_to_filter = (labels_list for labels_list in lists_to_filter if 
exclude_label not in labels_list)
# notice that changing the line above to the commented line below (i.e. 
expanding the generator to a list) will make the code output the expected 
result, 
# i.e. the issue is only when using filter on another filter, and not on a 
list
# lists_to_filter = [labels_list for labels_list in lists_to_filter if 
exclude_label not in labels_list]
lists_to_filter = list(lists_to_filter)
print(lists_to_filter)
```

as far as i understand, the code above should output "[['b']]"
instead it outputs "[['a', 'exclude'], ['b']]"

--
messages: 340200
nosy: Tsvika Shapira
priority: normal
severity: normal
status: open
title: composing filter() doesn't work as expected
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue31658] xml.sax.parse won't accept path objects

2019-04-14 Thread Stefan Behnel


Change by Stefan Behnel :


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



[issue31658] xml.sax.parse won't accept path objects

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

Thanks for your contribution.

--

___
Python tracker 

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



[issue31658] xml.sax.parse won't accept path objects

2019-04-14 Thread Stefan Behnel

Stefan Behnel  added the comment:


New changeset 929b70473829f04dedb8e802abcbd506926886e1 by Stefan Behnel 
(Mickaël Schoentgen) in branch 'master':
bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)
https://github.com/python/cpython/commit/929b70473829f04dedb8e802abcbd506926886e1


--

___
Python tracker 

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



[issue31658] xml.sax.parse won't accept path objects

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

PR looks good to me. Doesn't look critical enough for a backport, though.

--
nosy: +scoder
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-14 Thread László Kiss Kollár

Change by László Kiss Kollár :


--
nosy: +lkollar

___
Python tracker 

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



[issue36625] Obsolete comments in docstrings in fractions module

2019-04-14 Thread Mark Dickinson


Mark Dickinson  added the comment:

Agreed that these should be fixed.

--

___
Python tracker 

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



[issue36622] Inconsistent exponent notation formatting

2019-04-14 Thread Mark Dickinson


Mark Dickinson  added the comment:

FWIW, here's where that "at least two digits" is encoded in the CPython source: 
https://github.com/python/cpython/blob/bf94cc7b496a379e1f604aa2e4080bb70ca4020e/Python/pystrtod.c#L1227

*If* we wanted to, it would be an easy change to get rid of the extra leading 
exponent zeros.

--

___
Python tracker 

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



[issue36622] Inconsistent exponent notation formatting

2019-04-14 Thread Mark Dickinson


Mark Dickinson  added the comment:

Indeed it's deliberate. When the Decimal type was introduced, the "at least two 
exponent digits" behaviour of float formatting was already long established. 
But the specification that the Decimal type was based on (and the extensive 
test cases from the same source) use the minimum number of exponent digits 
instead.

If we want to make the two things consistent, that means either deliberately 
introducing incompatibilities with the Decimal specification, or changing 
long-standing behaviour for float.

There's no reason in principle that we couldn't modify the float formatting to 
use a single digit in the exponent (assuming that exponent is smaller than 10 
in absolute value). I'd expect that that would upset more people than it would 
help, though.

My guess is that the "at least 2 digits" rule in C99 7.24.2 is there to make it 
easier to align tables of values formatted in scientific notation. I can't 
think of another reason for force at least two digits.

For your use-case, could you convert all `float` objects to `Decimal` objects 
before comparison? The float to Decimal conversion doesn't lose any information 
(unlike the reverse conversion).

Closing this as "not a bug". There's certainly room for proposing and 
discussing changes to the behaviour, but that's probably best done on the 
python-ideas mailing list rather than the bug tracker.

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



[issue36227] Add default_namespace argument to xml.etree.ElementTree.tostring()

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

Thank you for you contribution.

--
components: +XML
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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:

I've merged the PR. It matches the implementation that has been released in 
lxml almost two years ago.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue30485] Element.findall(path, dict) doesn't insert null namespace

2019-04-14 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset e9927e1820caea01e576141d9a623ea394d43dad by Stefan Behnel in 
branch 'master':
bpo-30485: support a default prefix mapping in ElementPath by passing None as 
prefix (#1823)
https://github.com/python/cpython/commit/e9927e1820caea01e576141d9a623ea394d43dad


--

___
Python tracker 

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



[issue36227] Add default_namespace argument to xml.etree.ElementTree.tostring()

2019-04-14 Thread Stefan Behnel

Stefan Behnel  added the comment:


New changeset ffca16e25a70fd44a87b13b379b5ec0c7a11e926 by Stefan Behnel (Bernt 
Røskar Brenna) in branch 'master':
bpo-36227: ElementTree.tostring() default_namespace and xml_declaration 
arguments (GH-12225)
https://github.com/python/cpython/commit/ffca16e25a70fd44a87b13b379b5ec0c7a11e926


--

___
Python tracker 

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



[issue36622] Inconsistent exponent notation formatting

2019-04-14 Thread Stefan Krah


Stefan Krah  added the comment:

Yes, I'd think the decisions are deliberate.

Floats follow printf(), this is from the manual for 'e':

  "The exponent always contains at least two digits; if the value is zero, the 
exponent is 00."


And decimal follows the specification at 
http://speleotrove.com/decimal/ .


Of course Python's format() could decide to override the specification, but it 
would lead to more code complexity.

But I don't think that mixing float/decimal output is a common use case.

--

___
Python tracker 

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



[issue36600] re-enable test in nntplib

2019-04-14 Thread Marcin Niemira


Marcin Niemira  added the comment:

Hey,

Yes, it does. Closing issue and PR.

Cheers!

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



[issue36180] mboxMessage.get_payload throws TypeError on malformed content type

2019-04-14 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

A simplified reproducer as below. The tuple is returned from here 
https://github.com/python/cpython/blob/830b43d03cc47a27a22a50d777f23c8e60820867/Lib/email/message.py#L93
 and perhaps is an untested code path? The charset gets a tuple value of 
('utf-8��', '', '"utf-8Â\xa0"') . 


import mailbox
import tempfile

broken_message = """
>From l...@murphy.debian.org Wed Sep 24 01:22:15 2003
Date: Wed, 24 Sep 2003 07:05:50 +0200
From: Test test 
To: debian-devel-fre...@lists.debian.org
Subject: Re: Test
Mime-Version: 1.0
Content-Type: text/plain; charset*=utf-8†''utf-8%C2%A0

trés intéressé
"""

with tempfile.NamedTemporaryFile() as f:
f.write(broken_message.encode())
f.seek(0)
msg = mailbox.mbox(f.name)
for m in msg:
print(m.get_payload())

$ ../cpython/python.exe bpo36180.py
Traceback (most recent call last):
  File "bpo36180.py", line 21, in 
print(m.get_payload())
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/email/message.py", 
line 267, in get_payload
payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
TypeError: decode() argument 1 must be str, not tuple
sys:1: ResourceWarning: unclosed file <_io.BufferedRandom 
name='/var/folders/2b/mhgtnnpx4z943t4cc9yvw4qwgn/T/tmp4ddavb6g'>

--
nosy: +xtreak

___
Python tracker 

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



[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2019-04-14 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am willing to close it.

--

___
Python tracker 

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



[issue31954] Don't prevent dict optimization by coupling with OrderedDict

2019-04-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It the pure Python implementation PyDict_GetItem also
returns value, not node of linked list.

> How about raising DeprecationWarning when OrderedDict is passed to
PyDict_* APIs?

This would violate the Liskov substitution principle and add an overhead for 
using PyDict_* APIs with regular dicts.

--

___
Python tracker 

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



[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Dan Timofte


Change by Dan Timofte :


--
type:  -> behavior

___
Python tracker 

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



[issue33632] undefined behaviour: signed integer overflow in threadmodule.c

2019-04-14 Thread Martin Panter

Martin Panter  added the comment:

Victor, if you run the test suite, one of the test cases should trigger the 
overflow. I used to compile with Undefined Behaviour Sanitizer to print 
messages when these errors occur; see 
 for my setup at the time. I 
presume Antoine did something similar.

I do not remember, but suspect the test case might be the following lines of 
“BaseLockTests.test_timeout” in Lib/test/lock_tests.py, testing a fraction of a 
second less than PY_TIMEOUT_MAX:

# TIMEOUT_MAX is ok
lock.acquire(timeout=TIMEOUT_MAX)

Perhaps reducing PY_TIMEOUT_MAX by a few centuries would be one way to avoid 
the problem. In my patch I avoided the problem by rearranging the arithmetic, 
so that the timeout value is only compared and reduced, never added.

--

___
Python tracker 

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